import{jsx as e}from"react/jsx-runtime";import t from"@heroicons/react/24/outline/PhoneIcon";import{useState as o}from"react";import{C as r}from"./ConnectPhoneForm-DtsOvq6k.mjs";import{u as i}from"./internal-context-dfitw7Ot.mjs";import{u as n}from"./modal-context-DBwfUxD-.mjs";import{u as m}from"./privy-context-Bi6vqCPc.mjs";import{S as a}from"./ScreenLayout-Caq5mGD8.mjs";import"styled-components";import"@privy-io/js-sdk-core";import"./context-BKnOUECq.mjs";import"tinycolor2";import"./useActiveWallet-BEfvREjE.mjs";import"viem/utils";import"./wallet-connect-58EobR5U.mjs";import"./errors-Dd6zfYtp.mjs";import"ofetch";import"./getPublicClient-D4yNgeGy.mjs";import"viem";import"viem/chains";import"eventemitter3";import"./events-context-BJ75xIIf.mjs";import"./index-BtwxknTg.mjs";import"zustand";import"react-device-detect";import"./get-entropy-details-for-user-BIWg0YxF.mjs";import"./user-D5cqJNp9.mjs";import"./ModalHeader-DffkxvO4.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./Chip-D2-wZOHJ.mjs";import"./LoadingSkeleton-U6-3yFwI.mjs";import"@privy-io/are-addresses-equal";import"./Screen-D8KNyGVj.mjs";import"./index-Dq_xe9dz.mjs";const s=({title:i="Update your phone number",subtitle:n="Add the phone number you'd like to use going forward. We'll send you a confirmation code",onSubmit:m,isSubmitting:s=!1})=>{let[c,p]=o(null);/*#__PURE__*/return e(a,{title:i,subtitle:n,icon:t,primaryCta:{label:s?"Submitting":"Update",onClick:async()=>{c?.qualifiedPhoneNumber&&await m(c)},disabled:!c?.isValid||s},watermark:!0,children:/*#__PURE__*/e(r,{onChange:e=>{p(e)},onSubmit:async()=>{},noIncludeSubmitButton:!0,hideRecent:!0})})},c={component:()=>{let{currentScreen:t,data:r,navigate:a,setModalData:c}=n(),{user:p}=m(),{initUpdatePhone:u}=i(),[l,d]=o(!1);/*#__PURE__*/return e(s,{onSubmit:async e=>{d(!0);try{if(!p?.phone?.number)throw Error("User is required to have an phone number to update it.");await u(p?.phone?.number,e.qualifiedPhoneNumber),a("AwaitingPasswordlessCodeScreen")}catch(e){c({errorModalData:{error:e,previousScreen:r?.errorModalData?.previousScreen||t||"LinkPhoneScreen"}}),a("ErrorScreen")}finally{d(!1)}},isSubmitting:l})}};export{c as UpdatePhoneScreen,s as UpdatePhoneScreenView,c as default};
//# sourceMappingURL=UpdatePhoneScreen-UTjbsUkC.mjs.map
