"use strict";var e=require("react/jsx-runtime"),r=require("@heroicons/react/24/outline/PhoneIcon"),t=require("react"),i=require("./ConnectPhoneForm-xFB1DoYY.js"),n=require("./internal-context-CdsQ3LEl.js"),o=require("./modal-context-BgeioxwT.js"),u=require("./privy-context-UTJouJ1x.js"),a=require("./ScreenLayout-DaFW0I3a.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("styled-components"),require("@privy-io/js-sdk-core"),require("./context-rs-ygOK2.js"),require("tinycolor2"),require("./useActiveWallet-dTc6deka.js"),require("viem/utils"),require("./wallet-connect-BuohfvHK.js"),require("./errors-CBapWvRs.js"),require("ofetch"),require("./getPublicClient-CFd_sHBk.js"),require("viem"),require("viem/chains"),require("eventemitter3"),require("./events-context-Di6--rDg.js"),require("./index-Ub4KpwSY.js"),require("zustand"),require("react-device-detect"),require("./get-entropy-details-for-user-D63rM5_a.js"),require("./user-D2oPA-vS.js"),require("./ModalHeader-Cpls13mi.js"),require("@heroicons/react/24/outline/ArrowLeftIcon"),require("@heroicons/react/24/outline/ArrowRightIcon"),require("@heroicons/react/24/outline/QuestionMarkCircleIcon"),require("@heroicons/react/24/outline/XMarkIcon"),require("./Chip-C6r7fZiR.js"),require("./LoadingSkeleton-BoyADunQ.js"),require("@privy-io/are-addresses-equal"),require("./Screen-8NusMFtu.js"),require("./index-ByFhjjzH.js");var c=/*#__PURE__*/s(r);const l=({title:r="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:o,isSubmitting:u=!1})=>{let[s,l]=t.useState(null);/*#__PURE__*/return e.jsx(a.ScreenLayout,{title:r,subtitle:n,icon:c.default,primaryCta:{label:u?"Submitting":"Update",onClick:async()=>{s?.qualifiedPhoneNumber&&await o(s)},disabled:!s?.isValid||u},watermark:!0,children:/*#__PURE__*/e.jsx(i.ConnectPhoneNumberForm,{onChange:e=>{l(e)},onSubmit:async()=>{},noIncludeSubmitButton:!0,hideRecent:!0})})},d={component:()=>{let{currentScreen:r,data:i,navigate:a,setModalData:s}=o.usePrivyModal(),{user:c}=u.usePrivyContext(),{initUpdatePhone:d}=n.usePrivyInternal(),[q,h]=t.useState(!1);/*#__PURE__*/return e.jsx(l,{onSubmit:async e=>{h(!0);try{if(!c?.phone?.number)throw Error("User is required to have an phone number to update it.");await d(c?.phone?.number,e.qualifiedPhoneNumber),a("AwaitingPasswordlessCodeScreen")}catch(e){s({errorModalData:{error:e,previousScreen:i?.errorModalData?.previousScreen||r||"LinkPhoneScreen"}}),a("ErrorScreen")}finally{h(!1)}},isSubmitting:q})}};exports.UpdatePhoneScreen=d,exports.UpdatePhoneScreenView=l,exports.default=d;
//# sourceMappingURL=UpdatePhoneScreen-CCx5YCE7.js.map
