@clerk/ui 1.0.0-snapshot.v20251215212157 → 1.0.0-snapshot.v20251216175437
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{207_ui_3321de_1.0.0-snapshot.v20251215212157.js → 207_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{217_ui_3321de_1.0.0-snapshot.v20251215212157.js → 217_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{360_ui_3321de_1.0.0-snapshot.v20251215212157.js → 360_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{444_ui_3321de_1.0.0-snapshot.v20251215212157.js → 444_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{573_ui_3321de_1.0.0-snapshot.v20251215212157.js → 573_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{970_ui_3321de_1.0.0-snapshot.v20251215212157.js → 970_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/ClerkUi.js +2 -2
- package/dist/Components.js +0 -7
- package/dist/Components.js.map +1 -1
- package/dist/{apiKeys_ui_3321de_1.0.0-snapshot.v20251215212157.js → apiKeys_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{checkout_ui_3321de_1.0.0-snapshot.v20251215212157.js → checkout_ui_338113_1.0.0-snapshot.v20251216175437.js} +2 -2
- package/dist/common/EmailLinkVerify.js +1 -1
- package/dist/common/Gate.js +1 -1
- package/dist/common/RemoveResourceForm.js +1 -1
- package/dist/common/SSOCallback.js +1 -1
- package/dist/common/withRedirect.js +1 -1
- package/dist/components/APIKeys/APIKeys.js +1 -1
- package/dist/components/APIKeys/RevokeAPIKeyConfirmationModal.js +1 -1
- package/dist/components/Checkout/CheckoutComplete.js +1 -1
- package/dist/components/Checkout/CheckoutForm.js +1 -1
- package/dist/components/Checkout/CheckoutPage.js +1 -1
- package/dist/components/Checkout/parts.js +1 -1
- package/dist/components/CreateOrganization/CreateOrganizationForm.js +1 -1
- package/dist/components/CreateOrganization/CreateOrganizationPage.js +1 -1
- package/dist/components/ImpersonationFab/index.js +1 -1
- package/dist/components/OAuthConsent/OAuthConsent.js +1 -1
- package/dist/components/OrganizationList/UserInvitationList.js +1 -1
- package/dist/components/OrganizationList/UserMembershipList.js +1 -1
- package/dist/components/OrganizationList/UserSuggestionList.js +1 -1
- package/dist/components/OrganizationProfile/ActionConfirmationPage.js +1 -1
- package/dist/components/OrganizationProfile/ActiveMembersList.js +1 -1
- package/dist/components/OrganizationProfile/AddDomainForm.js +1 -1
- package/dist/components/OrganizationProfile/DomainList.js +1 -1
- package/dist/components/OrganizationProfile/InviteMembersForm.js +1 -1
- package/dist/components/OrganizationProfile/InviteMembersScreen.js +1 -1
- package/dist/components/OrganizationProfile/InvitedMembersList.js +1 -1
- package/dist/components/OrganizationProfile/OrganizationAPIKeysPage.js +1 -1
- package/dist/components/OrganizationProfile/OrganizationGeneralPage.js +1 -1
- package/dist/components/OrganizationProfile/OrganizationMembers.js +1 -1
- package/dist/components/OrganizationProfile/OrganizationProfileNavbar.js +1 -1
- package/dist/components/OrganizationProfile/ProfileForm.js +1 -1
- package/dist/components/OrganizationProfile/RemoveDomainForm.js +1 -1
- package/dist/components/OrganizationProfile/RequestToJoinList.js +1 -1
- package/dist/components/OrganizationProfile/VerifiedDomainForm.js +1 -1
- package/dist/components/OrganizationProfile/VerifyDomainForm.js +1 -1
- package/dist/components/OrganizationProfile/index.js +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherPopover.js +3 -6
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherPopover.js.map +1 -1
- package/dist/components/OrganizationSwitcher/OrganizationSwitcherTrigger.js +1 -1
- package/dist/components/OrganizationSwitcher/UserInvitationSuggestionList.js +1 -1
- package/dist/components/OrganizationSwitcher/UserMembershipList.js +1 -1
- package/dist/components/PaymentMethods/AddPaymentMethod.js +1 -1
- package/dist/components/PaymentMethods/PaymentMethods.js +1 -1
- package/dist/components/PricingTable/PricingTable.js +2 -3
- package/dist/components/PricingTable/PricingTable.js.map +1 -1
- package/dist/components/PricingTable/PricingTableDefault.js +1 -1
- package/dist/components/SessionTasks/index.js +1 -1
- package/dist/components/SessionTasks/tasks/TaskChooseOrganization/ChooseOrganizationScreen.js +1 -1
- package/dist/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.js +1 -1
- package/dist/components/SessionTasks/tasks/TaskChooseOrganization/index.js +1 -1
- package/dist/components/SessionTasks/tasks/TaskResetPassword/index.js +1 -1
- package/dist/components/SignIn/SignInFactorOne.js +1 -1
- package/dist/components/SignIn/SignInFactorOneAlternativeChannelCodeForm.js +1 -1
- package/dist/components/SignIn/SignInFactorOneCodeForm.js +1 -1
- package/dist/components/SignIn/SignInFactorOneEmailLinkCard.js +1 -1
- package/dist/components/SignIn/SignInFactorOnePasswordCard.js +1 -1
- package/dist/components/SignIn/SignInFactorTwoBackupCodeCard.js +1 -1
- package/dist/components/SignIn/SignInFactorTwoCodeForm.js +1 -1
- package/dist/components/SignIn/SignInFactorTwoEmailLinkCard.js +1 -1
- package/dist/components/SignIn/SignInSocialButtons.js +1 -1
- package/dist/components/SignIn/SignInStart.js +1 -1
- package/dist/components/SignIn/index.js +1 -1
- package/dist/components/SignIn/shared.js +1 -1
- package/dist/components/SignUp/SignUpContinue.js +1 -1
- package/dist/components/SignUp/SignUpEmailLinkCard.js +1 -1
- package/dist/components/SignUp/SignUpRestrictedAccess.js +1 -1
- package/dist/components/SignUp/SignUpSocialButtons.js +1 -1
- package/dist/components/SignUp/SignUpStart.js +1 -1
- package/dist/components/SignUp/SignUpVerificationCodeForm.js +1 -1
- package/dist/components/SignUp/index.js +1 -1
- package/dist/components/SubscriptionDetails/index.js +1 -1
- package/dist/components/UserButton/UserButtonPopover.js +1 -1
- package/dist/components/UserButton/UserButtonTopLevelIdentifier.js +1 -1
- package/dist/components/UserButton/UserButtonTrigger.js +1 -1
- package/dist/components/UserButton/useMultisessionActions.js +2 -7
- package/dist/components/UserButton/useMultisessionActions.js.map +1 -1
- package/dist/components/UserProfile/APIKeysPage.js +1 -1
- package/dist/components/UserProfile/AccountPage.js +1 -1
- package/dist/components/UserProfile/ActiveDevicesSection.js +1 -1
- package/dist/components/UserProfile/AddAuthenticatorApp.js +1 -1
- package/dist/components/UserProfile/ConnectedAccountsMenu.js +1 -1
- package/dist/components/UserProfile/ConnectedAccountsSection.js +1 -1
- package/dist/components/UserProfile/DeleteUserForm.js +1 -1
- package/dist/components/UserProfile/EmailForm.js +1 -1
- package/dist/components/UserProfile/EmailsSection.js +1 -1
- package/dist/components/UserProfile/EnterpriseAccountsSection.js +1 -1
- package/dist/components/UserProfile/MfaBackupCodeCreateForm.js +1 -1
- package/dist/components/UserProfile/MfaBackupCodeList.js +1 -1
- package/dist/components/UserProfile/MfaForm.js +1 -1
- package/dist/components/UserProfile/MfaPhoneCodeScreen.js +1 -1
- package/dist/components/UserProfile/MfaSection.js +1 -1
- package/dist/components/UserProfile/PasskeySection.js +1 -1
- package/dist/components/UserProfile/PasswordForm.js +1 -1
- package/dist/components/UserProfile/PasswordSection.js +1 -1
- package/dist/components/UserProfile/PhoneForm.js +1 -1
- package/dist/components/UserProfile/PhoneSection.js +1 -1
- package/dist/components/UserProfile/ProfileForm.js +1 -1
- package/dist/components/UserProfile/RemoveResourceForm.js +1 -1
- package/dist/components/UserProfile/SecurityPage.js +1 -1
- package/dist/components/UserProfile/UserProfileSection.js +1 -1
- package/dist/components/UserProfile/UsernameForm.js +1 -1
- package/dist/components/UserProfile/UsernameSection.js +1 -1
- package/dist/components/UserProfile/VerifyTOTP.js +1 -1
- package/dist/components/UserProfile/Web3Form.js +1 -1
- package/dist/components/UserProfile/Web3Section.js +1 -1
- package/dist/components/UserVerification/UVFactorOneCodeForm.js +1 -1
- package/dist/components/UserVerification/UVFactorOnePasskeysCard.js +1 -1
- package/dist/components/UserVerification/UVFactorTwoBackupCodeCard.js +1 -1
- package/dist/components/UserVerification/UVFactorTwoCodeForm.js +1 -1
- package/dist/components/UserVerification/UVFactorTwoPhoneCodeCard.js +1 -1
- package/dist/components/UserVerification/UserVerificationFactorOnePassword.js +1 -1
- package/dist/components/UserVerification/useUserVerificationSession.js +1 -1
- package/dist/components/Waitlist/WaitlistForm.js +1 -1
- package/dist/components/Waitlist/index.js +1 -1
- package/dist/components/devPrompts/EnableOrganizationsPrompt/index.js +1 -1
- package/dist/components/devPrompts/KeylessPrompt/index.js +1 -1
- package/dist/contexts/CoreClerkContextWrapper.js +1 -1
- package/dist/contexts/CoreSessionContext.js +1 -1
- package/dist/contexts/CoreUserContext.js +1 -1
- package/dist/{createorganization_ui_3321de_1.0.0-snapshot.v20251215212157.js → createorganization_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/customizables/AppearanceContext.js +1 -1
- package/dist/elements/Action/ActionRoot.js +1 -1
- package/dist/elements/CodeControl.js +1 -1
- package/dist/elements/Drawer.js +2 -8
- package/dist/elements/Drawer.js.map +1 -1
- package/dist/elements/Form.js +1 -1
- package/dist/elements/Menu.js +2 -3
- package/dist/elements/Menu.js.map +1 -1
- package/dist/elements/Modal.js +2 -3
- package/dist/elements/Modal.js.map +1 -1
- package/dist/elements/Navbar.js +1 -1
- package/dist/elements/PhoneInput/index.js +1 -1
- package/dist/elements/Popover.js +1 -4
- package/dist/elements/Popover.js.map +1 -1
- package/dist/elements/Select.js +1 -1
- package/dist/elements/SocialButtons.js +1 -1
- package/dist/elements/Tabs.js +1 -1
- package/dist/elements/TimerButton.js +1 -1
- package/dist/elements/Tooltip.js +24 -29
- package/dist/elements/Tooltip.js.map +1 -1
- package/dist/elements/contexts/index.js +1 -1
- package/dist/{enableOrganizationsPrompt_ui_3321de_1.0.0-snapshot.v20251215212157.js → enableOrganizationsPrompt_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/foundations/defaultFoundations.d.ts +153 -153
- package/dist/{impersonationfab_ui_3321de_1.0.0-snapshot.v20251215212157.js → impersonationfab_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/{keylessPrompt_ui_3321de_1.0.0-snapshot.v20251215212157.js → keylessPrompt_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/lazyModules/MountedCheckoutDrawer.js +1 -1
- package/dist/lazyModules/MountedPlanDetailDrawer.js +1 -1
- package/dist/lazyModules/MountedSubscriptionDetailDrawer.js +1 -1
- package/dist/lazyModules/components.d.ts +20 -20
- package/dist/lazyModules/providers.js +17 -24
- package/dist/lazyModules/providers.js.map +1 -1
- package/dist/{oauthConsent_ui_3321de_1.0.0-snapshot.v20251215212157.js → oauthConsent_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{onetap_ui_3321de_1.0.0-snapshot.v20251215212157.js → onetap_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{op-api-keys-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → op-api-keys-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{organizationlist_ui_3321de_1.0.0-snapshot.v20251215212157.js → organizationlist_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{organizationprofile_ui_3321de_1.0.0-snapshot.v20251215212157.js → organizationprofile_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/organizationswitcher_ui_338113_1.0.0-snapshot.v20251216175437.js +1 -0
- package/dist/{payment-attempt-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → payment-attempt-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{planDetails_ui_3321de_1.0.0-snapshot.v20251215212157.js → planDetails_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{prefetchorganizationlist_ui_3321de_1.0.0-snapshot.v20251215212157.js → prefetchorganizationlist_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{pricingTable_ui_3321de_1.0.0-snapshot.v20251215212157.js → pricingTable_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/primitives/hooks/useFormField.js +1 -1
- package/dist/{revoke-api-key-modal_ui_3321de_1.0.0-snapshot.v20251215212157.js → revoke-api-key-modal_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/router/BaseRouter.js +1 -1
- package/dist/router/PathRouter.js +1 -1
- package/dist/router/Route.js +1 -1
- package/dist/router/VirtualRouter.js +1 -1
- package/dist/{sessionTasks_ui_3321de_1.0.0-snapshot.v20251215212157.js → sessionTasks_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{signin_ui_3321de_1.0.0-snapshot.v20251215212157.js → signin_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{signup_ui_3321de_1.0.0-snapshot.v20251215212157.js → signup_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{statement-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → statement-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{subscriptionDetails_ui_3321de_1.0.0-snapshot.v20251215212157.js → subscriptionDetails_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{taskChooseOrganization_ui_3321de_1.0.0-snapshot.v20251215212157.js → taskChooseOrganization_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{taskResetPassword_ui_3321de_1.0.0-snapshot.v20251215212157.js → taskResetPassword_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/ui-common_ui_338113_1.0.0-snapshot.v20251216175437.js +139 -0
- package/dist/ui.browser.js +3 -20
- package/dist/{up-api-keys-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → up-api-keys-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{useravatar_ui_3321de_1.0.0-snapshot.v20251215212157.js → useravatar_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{userbutton_ui_3321de_1.0.0-snapshot.v20251215212157.js → userbutton_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/{userprofile_ui_3321de_1.0.0-snapshot.v20251215212157.js → userprofile_ui_338113_1.0.0-snapshot.v20251216175437.js} +2 -2
- package/dist/{userverification_ui_3321de_1.0.0-snapshot.v20251215212157.js → userverification_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/dist/vendors_ui_338113_1.0.0-snapshot.v20251216175437.js +20 -0
- package/dist/{waitlist_ui_3321de_1.0.0-snapshot.v20251215212157.js → waitlist_ui_338113_1.0.0-snapshot.v20251216175437.js} +1 -1
- package/package.json +3 -3
- package/dist/organizationswitcher_ui_3321de_1.0.0-snapshot.v20251215212157.js +0 -1
- package/dist/ui-common_ui_3321de_1.0.0-snapshot.v20251215212157.js +0 -122
- package/dist/vendors_ui_3321de_1.0.0-snapshot.v20251215212157.js +0 -20
- /package/dist/{blankcaptcha_ui_3321de_1.0.0-snapshot.v20251215212157.js → blankcaptcha_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{copy-api-key-modal_ui_3321de_1.0.0-snapshot.v20251215212157.js → copy-api-key-modal_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{framework_ui_3321de_1.0.0-snapshot.v20251215212157.js → framework_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{op-billing-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → op-billing-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{op-plans-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → op-plans-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{up-billing-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → up-billing-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
- /package/dist/{up-plans-page_ui_3321de_1.0.0-snapshot.v20251215212157.js → up-plans-page_ui_338113_1.0.0-snapshot.v20251216175437.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4308:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r5,UserProfileModal:()=>r4});var i=t(4518),n=t(5074),l=t(3269),o=t(9764),a=t(5396),s=t(1227),c=t(3264),d=t(5240),u=t(4607),h=t(2861),m=t(7831),f=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,d.B)(),n=r.routes.filter(e=>e.id!==s.j2.API_KEYS||!t?.hide);return(0,i.FD)(o.XM,{contentRef:e.contentRef,children:[(0,i.Y)(o.jq,{title:(0,h.G)("userProfile.navbar.title"),description:(0,h.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(9361),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),C=t(2660),F=t(3453),$=t(2513),w=t(2216),x=t(4964),I=t(6735);let k=e=>{let{strategy:r}=e,t=(0,l.f0)(),{user:n}=(0,v.Jd)(),{navigate:o}=(0,x.r)(),{strategyToDisplayData:a}=(0,w.k)(),{additionalOAuthScopes:s,componentName:c,mode:u}=(0,d.B)(),m="modal"===u,f=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=m?(0,_.j)({url:window.location.href,componentName:c,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=a[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(a[r].id),src:a[r].iconUrl,alt:`Connect ${a[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(C.T,{id:a[r].id,value:a[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:a[r].id,onClick:()=>{if(n)return t.setLoading(r),f().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,I.y)(2e3).then(()=>t.setIdle(r)),o(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,h.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:a[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,w.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,h.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(k,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:c}=(0,w.k)();return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:c[s.current]?.name||""}),messageLine2:(0,h.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:c[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},M=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,h.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},N=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,h.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,h.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},B=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},W=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,l.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,l.f0)(),o=!!r?.externalAccounts?.length,[a,s]=(0,n.useState)(null);if(!r||!e&&!o)return null;let c=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,h.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:c.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>s(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:o}=(0,d.B)(),{navigate:a}=(0,x.r)(),{user:s}=(0,v.Jd)(),c=(0,l.f0)(),u=e.id,m="modal"===o,f=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:f,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,w.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=W.includes(e.verification?.error?.code||"")||R,I=$?(0,h.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,k=async()=>{let r=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await a(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],c.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(C.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:I}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,h.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(F.r.Open,{value:`remove-${u}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(B,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,h.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function V(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function H(e,r){let t=V(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,h.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,l.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),o=e.id,a=t?.primaryEmailAddressId===o,s="verified"===e.verification.status,c=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:o})),d=[a&&!s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${o}`)}:null,!a&&s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{c().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!a&&!s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${o}`)}:null,{label:(0,h.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:d})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,h.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(C.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let em=(0,l.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(ef,{resourceRef:a,title:(0,h.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,h.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),ef=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:o,resourceRef:a}=e,s=(0,l.f0)(),{user:c}=(0,v.Jd)(),d=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),u=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,h.G)("formFieldLabel__phoneNumber"),isRequired:!0}),m=u.value.length>1&&c?.username!==u.value,f=!!c?.phoneNumbers?.length&&o,p=async e=>{if(e.preventDefault(),c)return d(c,{phoneNumber:u.value}).then(e=>{a.current=e,t()}).catch(e=>(0,G.H4)(e,[u],s.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:u.id,children:(0,i.Y)(ea.l.PhoneInput,{...u.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:f?"between":"end",children:[f&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,h.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:o}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,h.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(em,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,h.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,h.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,l.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),o=e.id,a=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let s=n.primaryPhoneNumberId===e.id,c="verified"===e.verification.status,d=[s&&!c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${o}`)}:null,!s&&c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>a(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!s&&!c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${o}`)}:null,{label:(0,h.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:d})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),o=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:a}=(0,Y.O)(),s=(0,l.f0)(),{t:c,locale:d}=(0,eS._)(),{usernameSettings:u}=a,m=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,h.G)("formFieldLabel__username"),placeholder:(0,h.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:c,locale:d,usernameSettings:u})});if(!n)return null;let f=a.attributes.username?.required,p=(!f||m.value.length>0)&&n.username!==m.value,g=async()=>{try{await o(m.value),r()}catch(e){(0,G.H4)(e,[m],s.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,h.G)("userProfile.usernamePage.title__update"):(0,h.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,autoFocus:!0,isRequired:f})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,h.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,h.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),eC=t(2421),eF=t(8225),e$=t(3817),ew=t(9538);let ex=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,h.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(ew.H,{size:e=>e.sizes.$12,...r})})},eI=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,l.f0)(),{user:o}=(0,v.Jd)();if(!o)return null;let{first_name:a,last_name:s}=(0,Y.O)().userSettings.attributes,c=a?.enabled,d=s?.enabled,u=o.firstName||"",m=o.lastName||"",f=(0,ed.tJ)("firstName",o.firstName||"",{type:"text",label:(0,h.G)("formFieldLabel__firstName"),placeholder:(0,h.G)("formFieldInputPlaceholder__firstName"),isRequired:s?.required}),p=(0,ed.tJ)("lastName",o.lastName||"",{type:"text",label:(0,h.G)("formFieldLabel__lastName"),placeholder:(0,h.G)("formFieldInputPlaceholder__lastName"),isRequired:s?.required}),g=c&&f.value!==u||d&&p.value!==m,P=c&&a.required||d&&s.required,b=P&&!!p.value&&!!f.value&&g,y=o.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?o.update({firstName:f.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[f,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(eC.k,{message:(0,h.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(ex,{user:o,onAvatarChange:e=>o.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eF.p)(o.imageUrl)?null:()=>{o.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(c||d)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[c&&(0,i.Y)(ea.l.PlainInput,{...f.props,isDisabled:y,autoFocus:!0}),d&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!c})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ek=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(eI,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,h.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ek,{})})})]})})};var ez=t(8099),eT=t(5243);let eE=(0,l.dm)(({onClick:e})=>{let r=(0,l.f0)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:o}=(0,w.k)(),a=(0,eT.R)(),s=n.filter(e=>e.startsWith("web3")),c=t?.verifiedWeb3Wallets.map(e=>e.verification.strategy),d=s.filter(e=>!c.includes(e)),u=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),m=async e=>{let i=(0,ez.U)(a),n=e.replace("web3_","").replace("_signature","");r.setError(void 0);try{r.setLoading(e);let l=await i.getWeb3Identifier({provider:n});if(!t)throw Error("user is not defined");let o=await u(l);o=await o?.prepareVerification({strategy:e});let a=o?.verification.message,s=await i.generateWeb3Signature({identifier:l,nonce:a,provider:n});await o?.attemptVerification({signature:s}),r.setIdle()}catch(t){r.setIdle();let e=(0,G.hG)(t);e?r.setError(e.longMessage):(0,G.H4)(t,[],r.setError)}};return 0===d.length?null:(0,i.FD)(i.FK,{children:[(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,h.G)("userProfile.start.web3WalletsSection.primaryButton"),onClick:e,children:d.map(e=>(0,i.Y)(D.rd.ActionMenuItem,{id:o[e].id,onClick:()=>{m(e)},isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,localizationKey:(0,h.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:o[e].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[e].id),isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,src:o[e].iconUrl,alt:`Connect ${o[e].name}`,sx:e=>({width:e.sizes.$5})})},e))}),r.error&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:e.sizes.$1x5,paddingLeft:e.sizes.$8x5}),children:r.error})]})}),eL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eO=(0,l.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,l.f0)(),{strategyToDisplayData:o}=(0,w.k)(),a=!!r?.web3Wallets?.length,[s,c]=(0,n.useState)(null);return e||a?(0,i.FD)(D.rd.Root,{title:(0,h.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:s,onChange:c,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let l=e.verification.strategy,a=e.id;return o[l]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[o[l].iconUrl&&(0,i.Y)(y._V,{src:o[l].iconUrl,alt:o[l].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[o[l].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]})})]}),(0,i.Y)(eK,{walletId:a})]},a),(0,i.Y)(F.r.Open,{value:`remove-${a}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eL,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eE,{onClick:()=>c(null)})]})]}):null}),eK=({walletId:e})=>{let r=(0,l.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),o=n?.primaryWeb3WalletId===e,a=(0,v.Wp)(()=>n?.update({primaryWeb3WalletId:e})),s=[!o?{label:(0,h.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{a().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,{label:(0,h.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:s})},eM=(0,l.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,l.f0)(),{user:o}=(0,v.Jd)(),{shouldAllowIdentificationCreation:a}=(0,d.B)(),s=e.username?.enabled,c=e.email_address?.enabled,u=e.phone_number?.enabled,m=r&&Object.values(r).filter(e=>e.enabled).length>0,f=o&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,h.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),c&&(0,i.Y)(er,{shouldAllowCreation:a}),u&&(0,i.Y)(ev,{shouldAllowCreation:a}),m&&(0,i.Y)(J,{shouldAllowCreation:a}),f&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eO,{shouldAllowCreation:a})]})})});var eN=t(2611),eB=t(7806),eW=t(7896),eJ=t(4901),eq=t(892),eU=t(8910);let ej=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,eW.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eN.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eV(e.status)?(0,i.Y)(eH,{session:e},e.id):null)})})},eV=e=>["active","pending"].includes(e),eH=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,eJ.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(eZ,{session:e}),!r&&(0,i.Y)(eX,{revoke:l})]})})},eZ=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:c,deviceType:d,ipAddress:u,isMobile:m}=e.session.latestActivity,f=`${s||""} ${c||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eq.A:eU.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:d||(m?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:f}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[u," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eB.T)(e.session.lastActiveAt))})]})]})},eX=({revoke:e})=>{let r=[{label:(0,h.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var eQ=t(9599),e0=t(8691);let e1=(0,l.dm)(e=>{let{onReset:r}=e,t=(0,l.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:o}=(0,eQ.g)(),{user:a}=(0,v.Jd)(),{t:s}=(0,eS._)(),{otherSessions:c}=(0,e0.z)({user:a}),{setActive:d}=(0,v.ho)(),u=(0,v.Wp)(()=>a?.delete()),m=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,h.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,h.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),f=m.value===(s((0,h.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(f)try{await u();let e=0===c.length?n:o;return await d({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,h.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!f,onReset:r})]})})}),e2=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e1,{onSuccess:e,onReset:e})},e5=()=>(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(F.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,h.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(F.r.Open,{value:"delete",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(e2,{})})})]})});var e4=t(1323),e3=t(5079),e6=t(6103),e8=t(2534),e9=t(3610),e7=t(8095),re=t(9126),rr=t(7782),rt=t(1072),ri=t(5976),rn=t(2405),rl=t(2852);let ro=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},ra=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,re.h)(),{onCopy:s,hasCopied:c}=(0,rr.i)(t?.join(",")||"");if(!l)return null;let d=(0,e7.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=d,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
|
|
1
|
+
"use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["718"],{4308:function(e,r,t){t.r(r),t.d(r,{UserProfile:()=>r5,UserProfileModal:()=>r4});var i=t(4518),n=t(5074),l=t(3269),o=t(9764),a=t(5396),s=t(1227),c=t(3264),d=t(5240),u=t(4607),h=t(2861),m=t(7831),f=t(2265);let p=e=>{let{pages:r,apiKeysProps:t}=(0,d.B)(),n=r.routes.filter(e=>e.id!==s.j2.API_KEYS||!t?.hide);return(0,i.FD)(o.XM,{contentRef:e.contentRef,children:[(0,i.Y)(o.jq,{title:(0,h.G)("userProfile.navbar.title"),description:(0,h.G)("userProfile.navbar.description"),routes:n,contentRef:e.contentRef}),e.children]})};var g=t(540),Y=t(7697),v=t(5543),P=t(6088),b=t(6153),y=t(8272),S=t(8920),_=t(1421),D=t(4003),R=t(8080),G=t(4468),C=t(2660),F=t(3453),$=t(2513),w=t(2216),x=t(4964),I=t(6735);let k=e=>{let{strategy:r}=e,t=(0,l.f0)(),{user:n}=(0,v.Jd)(),{navigate:o}=(0,x.r)(),{strategyToDisplayData:a}=(0,w.k)(),{additionalOAuthScopes:s,componentName:c,mode:u}=(0,d.B)(),m="modal"===u,f=(0,v.Wp)(()=>{let e=r.replace("oauth_",""),t=m?(0,_.j)({url:window.location.href,componentName:c,socialProvider:e}):window.location.href,i=s?s[e]:[];return n?.createExternalAccount({strategy:r,redirectUrl:t,additionalScopes:i})}),p=a[r].iconUrl?(0,i.Y)(y._V,{isLoading:t.loadingMetadata===r,isDisabled:t.isLoading,elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(a[r].id),src:a[r].iconUrl,alt:`Connect ${a[r].name} account`,sx:e=>({width:e.sizes.$4})}):(0,i.Y)(C.T,{id:a[r].id,value:a[r].name,isLoading:t.loadingMetadata===r,isDisabled:t.isLoading});return(0,i.Y)(D.rd.ActionMenuItem,{id:a[r].id,onClick:()=>{if(n)return t.setLoading(r),f().then(e=>{e&&e.verification?.externalVerificationRedirectURL&&((0,I.y)(2e3).then(()=>t.setIdle(r)),o(e.verification.externalVerificationRedirectURL.href))}).catch(e=>{(0,G.H4)(e,[],t.setError),t.setIdle(r)})},isDisabled:t.isLoading,variant:"ghost",isLoading:t.loadingMetadata===r,focusRing:!1,closeAfterClick:!1,localizationKey:(0,h.G)("userProfile.connectedAccountPage.socialButtonsBlockButton",{provider:a[r].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:p},r)},A=({onClick:e})=>{let{user:r}=(0,v.Jd)(),{strategies:t}=(0,w.k)(),n=t.filter(e=>e.startsWith("oauth")),l=r?.verifiedExternalAccounts.map(e=>`oauth_${e.provider}`),o=n.filter(e=>!l.includes(e));return 0===o.length?null:(0,i.Y)(D.rd.ActionMenu,{triggerLocalizationKey:(0,h.G)("userProfile.start.connectedAccountsSection.primaryButton"),id:"connectedAccounts",onClick:e,children:o.map(e=>(0,i.Y)(k,{strategy:e},e))})};var z=t(8046);let T=e=>{let{onSuccess:r,onReset:t}=e,{user:l}=(0,v.Jd)(),{emailId:o}=e,a=l?.emailAddresses.find(e=>e.id===o),s=n.useRef(a?.emailAddress),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.emailAddressPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.emailAddressPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.emailAddressPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.emailAddressPage.removeResource.successMessage",{emailAddress:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:r,onReset:t}):null},E=e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.phoneNumbers.find(e=>e.id===r),s=n.useRef(a?.phoneNumber),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.phoneNumberPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.phoneNumberPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.phoneNumberPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.phoneNumberPage.removeResource.successMessage",{phoneNumber:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},L=e=>{let{accountId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=o?.externalAccounts.find(e=>e.id===r),s=n.useRef(a?.provider),{providerToDisplayData:c}=(0,w.k)();return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.connectedAccountPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.connectedAccountPage.removeResource.messageLine1",{identifier:c[s.current]?.name||""}),messageLine2:(0,h.G)("userProfile.connectedAccountPage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.connectedAccountPage.removeResource.successMessage",{connectedAccount:c[s.current]?.name||""}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:t,onReset:l}):null},O=e=>{let{user:r}=(0,v.Jd)(),{walletId:t,onSuccess:l,onReset:o}=e,a=r?.web3Wallets.find(e=>e.id===t),s=n.useRef(a?.web3Wallet),c=a?.verification?.status==="verified"?(0,h.G)("userProfile.web3WalletPage.removeResource.messageLine2"):void 0;return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.web3WalletPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.web3WalletPage.removeResource.messageLine1",{identifier:s.current}),messageLine2:c,successMessage:(0,h.G)("userProfile.web3WalletPage.removeResource.successMessage",{web3Wallet:s.current}),deleteResource:()=>Promise.resolve(a?.destroy()),onSuccess:l,onReset:o}):null},K=e=>{let{user:r}=(0,v.Jd)(),{phoneId:t,onSuccess:l,onReset:o}=e,a=r?.phoneNumbers.find(e=>e.id===t),s=n.useRef(a?.phoneNumber);return s.current?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.title"),messageLine1:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine1",{identifier:s.current}),messageLine2:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.mfaPhoneCodePage.removeResource.successMessage",{mfaPhoneCode:s.current}),deleteResource:()=>Promise.resolve(a?.setReservedForSecondFactor({reserved:!1})),onSuccess:l,onReset:o}):null},M=e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)();return n?(0,i.Y)(z.P,{title:(0,h.G)("userProfile.mfaTOTPPage.removeResource.title"),messageLine1:(0,h.G)("userProfile.mfaTOTPPage.removeResource.messageLine1"),messageLine2:(0,h.G)("userProfile.mfaTOTPPage.removeResource.messageLine2"),successMessage:(0,h.G)("userProfile.mfaTOTPPage.removeResource.successMessage"),deleteResource:n.disableTOTP,onSuccess:r,onReset:t}):null},N=e=>{let{onSuccess:r,onReset:t,passkey:n}=e;return(0,i.Y)(z.P,{title:(0,h.G)("userProfile.passkeyScreen.removeResource.title"),messageLine1:(0,h.G)("userProfile.passkeyScreen.removeResource.messageLine1",{name:n.name||""}),deleteResource:n.delete,onSuccess:r,onReset:t})},B=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(L,{onSuccess:r,onReset:r,...e})},W=["external_account_missing_refresh_token","oauth_fetch_user_error","oauth_token_exchange_error","external_account_email_address_verification_required"],J=(0,l.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,l.f0)(),o=!!r?.externalAccounts?.length,[a,s]=(0,n.useState)(null);if(!r||!e&&!o)return null;let c=[...r.verifiedExternalAccounts,...r.unverifiedExternalAccounts.filter(e=>e.verification?.error)];return(0,i.FD)(D.rd.Root,{title:(0,h.G)("userProfile.start.connectedAccountsSection.title"),centered:!1,id:"connectedAccounts",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:a,onChange:s,children:[(0,i.Y)(D.rd.ItemList,{id:"connectedAccounts",children:c.map(e=>(0,i.Y)(q,{account:e},e.id))}),e&&(0,i.Y)(A,{onClick:()=>s(null)})]})]})}),q=({account:e})=>{let{additionalOAuthScopes:r,componentName:t,mode:o}=(0,d.B)(),{navigate:a}=(0,x.r)(),{user:s}=(0,v.Jd)(),c=(0,l.f0)(),u=e.id,m="modal"===o,f=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href,p=(0,v.Wp)(()=>s?.createExternalAccount({strategy:e.verification.strategy,redirectUrl:f,additionalScopes:b}));if(!s)return null;let{providerToDisplayData:g}=(0,w.k)(),Y=e.username||e.emailAddress,P=e.verification?.error?.longMessage,b=function(e,r){if(!r)return[];let t=r[e.provider]||[],i=e.approvedScopes.split(" ");return 0===t.filter(e=>!i.includes(e)).length?[]:t}(e,r),R=b.length>0&&""!=e.approvedScopes,$=W.includes(e.verification?.error?.code||"")||R,I=$?(0,h.G)("userProfile.start.connectedAccountsSection.subtitle__disconnected"):P,k=async()=>{let r=m?(0,_.j)({url:window.location.href,componentName:t}):window.location.href;try{let t;(t=R?await e.reauthorize({additionalScopes:b,redirectUrl:r}):await p())&&await a(t.verification.externalVerificationRedirectURL?.href||"")}catch(e){(0,G.H4)(e,[],c.setError)}};return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"connectedAccounts",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$2}),children:[(0,i.Y)(()=>g[e.provider].iconUrl?(0,i.Y)(y._V,{elementDescriptor:[S.$z.providerIcon],elementId:S.$z.socialButtonsProviderIcon.setId(e.provider),alt:g[e.provider].name,src:g[e.provider].iconUrl,sx:e=>({width:e.sizes.$4,flexShrink:0})}):(0,i.Y)(C.T,{id:e.provider,value:g[e.provider].name}),{}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:`${g[e.provider].name}`}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:Y?`• ${Y}`:""})]})})]}),(0,i.Y)(U,{account:e})]}),$&&(0,i.FD)(y.az,{sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:[(0,i.Y)(y.EY,{colorScheme:"secondary",sx:e=>({paddingRight:e.sizes.$1x5,display:"inline-block"}),localizationKey:I}),(0,i.Y)(y.$n,{sx:{display:"inline-block"},onClick:k,variant:"link",localizationKey:(0,h.G)("userProfile.start.connectedAccountsSection.actionLabel__connectionFailed")})]}),e.verification?.error?.code&&!$&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:`${e.sizes.$none} ${e.sizes.$1x5} ${e.sizes.$1x5} ${e.sizes.$8x5}`}),children:P}),(0,i.Y)(F.r.Open,{value:`remove-${u}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(B,{accountId:e.id})})})]},e.id)},U=({account:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,h.G)("userProfile.start.connectedAccountsSection.destructiveActionTitle"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:n})},j=e=>e.defaultSecondFactor?-1:1;function V(e){let r=[];return Object.entries(e).forEach(([,e])=>{e.used_for_second_factor&&r.push(...e.second_factors)}),r}function H(e,r){let t=V(e);return r.totpEnabled&&(t=t.filter(e=>"totp"!==e)),(r.backupCodeEnabled||!r.twoFactorEnabled)&&(t=t.filter(e=>"backup_code"!==e)),t}function Z(e,r){if(!e)return[];let t=e.filter(e=>e.id===r),i=e.filter(e=>e.id!==r),n=i.filter(e=>e.verification?.status==="verified"),l=i.filter(e=>!!e.verification?.status&&e.verification?.status!=="verified"),o=i.filter(e=>!e.verification.status);return n.sort((e,r)=>e.id.localeCompare(r.id)),l.sort((e,r)=>e.verification?.expireAt&&r.verification?.expireAt?e.verification.expireAt.getTime()-r.verification.expireAt.getTime():0),[...t,...n,...l,...o]}var X=t(2336);let Q=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(T,{onSuccess:r,onReset:r,...e})},ee=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(X.v,{onSuccess:r,onReset:r,...e})},er=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)();return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.emailAddressesSection.title"),centered:!1,id:"emailAddresses",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"emailAddresses",children:[Z(r?.emailAddresses,r?.primaryEmailAddressId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"emailAddresses",children:[(0,i.FD)(y.so,{sx:e=>({overflow:"hidden",gap:e.space.$1}),children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),truncate:!0,children:e.emailAddress}),r?.primaryEmailAddressId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]}),(0,i.Y)(et,{email:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(Q,{emailId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{emailId:t})})})]},e.emailAddress)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"emailAddresses",localizationKey:(0,h.G)("userProfile.start.emailAddressesSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ee,{})})})]})]})})})},et=({email:e})=>{let r=(0,l.f0)(),{user:t}=(0,v.Jd)(),{open:n}=(0,$.D5)(),o=e.id,a=t?.primaryEmailAddressId===o,s="verified"===e.verification.status,c=(0,v.Wp)(()=>t?.update({primaryEmailAddressId:o})),d=[a&&!s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__primary"),onClick:()=>n(`verify-${o}`)}:null,!a&&s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__nonPrimary"),onClick:()=>{c().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,!a&&!s?{label:(0,h.G)("userProfile.start.emailAddressesSection.detailsAction__unverified"),onClick:()=>n(`verify-${o}`)}:null,{label:(0,h.G)("userProfile.start.emailAddressesSection.destructiveAction"),isDestructive:!0,onClick:()=>n(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:d})},ei=()=>{let{user:e}=(0,v.Jd)(),r=e?.enterpriseAccounts.filter(({enterpriseConnection:e})=>e?.active);return r?.length?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.enterpriseAccountsSection.title"),id:"enterpriseAccounts",centered:!1,children:(0,i.Y)(D.rd.ItemList,{id:"enterpriseAccounts",children:r.map(e=>(0,i.Y)(en,{account:e},e.id))})}):null},en=({account:e})=>{let r=e.emailAddress,t=e?.enterpriseConnection?.name,n=e.verification?.error?.longMessage;return(0,i.FD)(D.rd.Item,{id:"enterpriseAccounts",sx:e=>({gap:e.space.$2,justifyContent:"start"}),children:[(0,i.Y)(el,{account:e}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:1,center:!0,children:[(0,i.Y)(y.EY,{truncate:!0,colorScheme:"body",children:t}),(0,i.Y)(y.EY,{truncate:!0,as:"span",colorScheme:"secondary",children:r?`• ${r}`:""}),n&&(0,i.Y)(y.Ex,{colorScheme:"danger",localizationKey:(0,h.G)("badge__requiresAction")})]})})]},e.id)},el=({account:e})=>{let{provider:r,enterpriseConnection:t}=e,n=r.replace(/(oauth_|saml_)/,"").trim(),l=t?.name??n,o={elementDescriptor:[S.$z.providerIcon],alt:l,sx:e=>({width:e.sizes.$4}),elementId:S.$z.enterpriseButtonsProviderIcon.setId(e.provider)};return t?.logoPublicUrl?(0,i.Y)(y._V,{...o,src:t.logoPublicUrl}):(0,i.Y)(C.T,{id:n,value:l,"aria-label":`${l}'s icon`,elementDescriptor:[S.$z.providerIcon,S.$z.providerInitialIcon],elementId:S.$z.providerInitialIcon.setId(n)})};var eo=t(7651),ea=t(2454),es=t(1475),ec=t(3549),ed=t(8640),eu=t(6245),eh=t(1282);let em=(0,l.dm)(e=>{let{phoneId:r,onSuccess:t,onReset:l}=e,{user:o}=(0,v.Jd)(),a=n.useRef(o?.phoneNumbers.find(e=>e.id===r)),s=(0,eu.X)({defaultStep:+!!a.current});return(0,i.FD)(eu.s,{...s.props,children:[(0,i.Y)(ef,{resourceRef:a,title:(0,h.G)("userProfile.phoneNumberPage.title"),onSuccess:s.nextStep,onReset:l}),(0,i.Y)(ep,{resourceRef:a,title:(0,h.G)("userProfile.phoneNumberPage.verifyTitle"),onSuccess:t,onReset:l})]})}),ef=e=>{let{title:r,onSuccess:t,onReset:n,onUseExistingNumberClick:o,resourceRef:a}=e,s=(0,l.f0)(),{user:c}=(0,v.Jd)(),d=(0,v.Wp)((e,r)=>e.createPhoneNumber(r)),u=(0,ed.tJ)("phoneNumber","",{type:"tel",label:(0,h.G)("formFieldLabel__phoneNumber"),isRequired:!0}),m=u.value.length>1&&c?.username!==u.value,f=!!c?.phoneNumbers?.length&&o,p=async e=>{if(e.preventDefault(),c)return d(c,{phoneNumber:u.value}).then(e=>{a.current=e,t()}).catch(e=>(0,G.H4)(e,[u],s.setError))};return(0,i.Y)(ec.M,{headerTitle:r,gap:1,children:(0,i.FD)(ea.l.Root,{gap:4,onSubmit:p,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.phoneNumberPage.infoText"),colorScheme:"secondary"}),(0,i.Y)(ea.l.ControlRow,{elementId:u.id,children:(0,i.Y)(ea.l.PhoneInput,{...u.props,autoFocus:!0})}),(0,i.FD)(y.so,{justify:f?"between":"end",children:[f&&(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,h.G)("userProfile.mfaPhoneCodePage.backButton"),onClick:o}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.formButtonPrimary__add"),isDisabled:!m,onReset:n})]})]})})},ep=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:l}=e;return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,h.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:t,identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:l})})},eg=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(E,{onSuccess:r,onReset:r,...e})},eY=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(em,{onSuccess:r,onReset:r,...e})},ev=({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=!!r?.phoneNumbers?.length;return e||t?(0,i.Y)(D.rd.Root,{centered:!1,title:(0,h.G)("userProfile.start.phoneNumbersSection.title"),id:"phoneNumbers",children:(0,i.Y)(F.r.Root,{children:(0,i.FD)(D.rd.ItemList,{id:"phoneNumbers",children:[Z(r?.phoneNumbers,r?.primaryPhoneNumberId).map(e=>{let t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"phoneNumbers",children:[(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,center:!0,children:[(0,i.Y)(y.EY,{sx:e=>({color:e.colors.$colorForeground}),children:(0,eo.Om)(e.phoneNumber)}),r?.primaryPhoneNumberId===t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]})}),(0,i.Y)(eP,{phone:e})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eg,{phoneId:t})})}),(0,i.Y)(F.r.Open,{value:`verify-${t}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{phoneId:t})})})]},t)}),e&&(0,i.FD)(i.FK,{children:[(0,i.Y)(F.r.Trigger,{value:"add",children:(0,i.Y)(D.rd.ArrowButton,{id:"phoneNumbers",localizationKey:(0,h.G)("userProfile.start.phoneNumbersSection.primaryButton")})}),(0,i.Y)(F.r.Open,{value:"add",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eY,{})})})]})]})})}):null},eP=({phone:e})=>{let r=(0,l.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),o=e.id,a=(0,v.Wp)(r=>r.update({primaryPhoneNumberId:e.id}));if(!n)return null;let s=n.primaryPhoneNumberId===e.id,c="verified"===e.verification.status,d=[s&&!c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__primary"),onClick:()=>t(`verify-${o}`)}:null,!s&&c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__nonPrimary"),onClick:()=>a(n).catch(e=>(0,G.H4)(e,[],r.setError))}:null,!s&&!c?{label:(0,h.G)("userProfile.start.phoneNumbersSection.detailsAction__unverified"),onClick:()=>t(`verify-${o}`)}:null,{label:(0,h.G)("userProfile.start.phoneNumbersSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:d})};var eb=t(7591),ey=t(4557),eS=t(78);let e_=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:n}=(0,v.Jd)(),o=(0,v.Wp)(e=>n?.update({username:e})),{userSettings:a}=(0,Y.O)(),s=(0,l.f0)(),{t:c,locale:d}=(0,eS._)(),{usernameSettings:u}=a,m=(0,ed.tJ)("username",n?.username||"",{type:"text",label:(0,h.G)("formFieldLabel__username"),placeholder:(0,h.G)("formFieldInputPlaceholder__username"),buildErrorMessage:e=>(0,ey.Z)(e,{t:c,locale:d,usernameSettings:u})});if(!n)return null;let f=a.attributes.username?.required,p=(!f||m.value.length>0)&&n.username!==m.value,g=async()=>{try{await o(m.value),r()}catch(e){(0,G.H4)(e,[m],s.setError)}};return(0,i.Y)(ec.M,{headerTitle:n.username?(0,h.G)("userProfile.usernamePage.title__update"):(0,h.G)("userProfile.usernamePage.title__set"),children:(0,i.FD)(ea.l.Root,{onSubmit:g,children:[(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,autoFocus:!0,isRequired:f})}),(0,i.Y)(es.G,{isDisabled:!p,onReset:t})]})})}),eD=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e_,{onSuccess:e,onReset:e})},eR=()=>{let{user:e}=(0,v.Jd)();return e?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.usernameSection.title"),id:"username",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"username",sx:{paddingLeft:e.username?void 0:"0"},children:[e.username&&(0,i.Y)(y.EY,{truncate:!0,sx:e=>({color:e.colors.$colorForeground}),children:e.username}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"username",localizationKey:e.username?(0,h.G)("userProfile.start.usernameSection.primaryButton__updateUsername"):(0,h.G)("userProfile.start.usernameSection.primaryButton__setUsername")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(eD,{})})})]})}):null};var eG=t(9345),eC=t(2421),eF=t(8225),e$=t(3817),ew=t(9538);let ex=e=>{let{user:r,...t}=e;return(0,i.Y)(e$.k,{...t,title:(0,h.G)("userProfile.profilePage.imageFormTitle"),avatarPreview:(0,i.Y)(ew.H,{size:e=>e.sizes.$12,...r})})},eI=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,l.f0)(),{user:o}=(0,v.Jd)();if(!o)return null;let{first_name:a,last_name:s}=(0,Y.O)().userSettings.attributes,c=a?.enabled,d=s?.enabled,u=o.firstName||"",m=o.lastName||"",f=(0,ed.tJ)("firstName",o.firstName||"",{type:"text",label:(0,h.G)("formFieldLabel__firstName"),placeholder:(0,h.G)("formFieldInputPlaceholder__firstName"),isRequired:s?.required}),p=(0,ed.tJ)("lastName",o.lastName||"",{type:"text",label:(0,h.G)("formFieldLabel__lastName"),placeholder:(0,h.G)("formFieldInputPlaceholder__lastName"),isRequired:s?.required}),g=c&&f.value!==u||d&&p.value!==m,P=c&&a.required||d&&s.required,b=P&&!!p.value&&!!f.value&&g,y=o.enterpriseAccounts.some(e=>e.active),S=async e=>(e.preventDefault(),(g?o.update({firstName:f.value,lastName:p.value}):Promise.resolve()).then(r).catch(e=>{(0,G.H4)(e,[f,p],n.setError)}));return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.profilePage.title"),children:[y&&(0,i.Y)(eC.k,{message:(0,h.G)("userProfile.profilePage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:S,sx:e=>({gap:e.space.$6}),children:[(0,i.Y)(ex,{user:o,onAvatarChange:e=>o.setProfileImage({file:e}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError)),onAvatarRemove:(0,eF.p)(o.imageUrl)?null:()=>{o.setProfileImage({file:null}).then(()=>{n.setIdle(),r?.()}).catch(e=>(0,G.H4)(e,[],n.setError))}}),(c||d)&&(0,i.FD)(ea.l.ControlRow,{elementId:"name",children:[c&&(0,i.Y)(ea.l.PlainInput,{...f.props,isDisabled:y,autoFocus:!0}),d&&(0,i.Y)(ea.l.PlainInput,{...p.props,isDisabled:y,autoFocus:!c})]}),(0,i.Y)(es.G,{isDisabled:P?!b:!g,onReset:t})]})]})}),ek=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(eI,{onSuccess:e,onReset:e})},eA=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{username:r,primaryEmailAddress:t,primaryPhoneNumber:n,primaryWeb3Wallet:l,...o}=e;return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.profileSection.title"),id:"profile",sx:{[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"profile",children:[(0,i.Y)(eG.c,{user:o,size:"lg",mainIdentifierVariant:"subtitle",sx:e=>({color:e.colors.$colorForeground})}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"profile",localizationKey:(0,h.G)("userProfile.start.profileSection.primaryButton")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(ek,{})})})]})})};var ez=t(8099),eT=t(5243);let eE=(0,l.dm)(({onClick:e})=>{let r=(0,l.f0)(),{user:t}=(0,v.Jd)(),{strategies:n,strategyToDisplayData:o}=(0,w.k)(),a=(0,eT.R)(),s=n.filter(e=>e.startsWith("web3")),c=t?.verifiedWeb3Wallets.map(e=>e.verification.strategy),d=s.filter(e=>!c.includes(e)),u=(0,v.Wp)(e=>t?.createWeb3Wallet({web3Wallet:e})),m=async e=>{let i=(0,ez.U)(a),n=e.replace("web3_","").replace("_signature","");r.setError(void 0);try{r.setLoading(e);let l=await i.getWeb3Identifier({provider:n});if(!t)throw Error("user is not defined");let o=await u(l);o=await o?.prepareVerification({strategy:e});let a=o?.verification.message,s=await i.generateWeb3Signature({identifier:l,nonce:a,provider:n});await o?.attemptVerification({signature:s}),r.setIdle()}catch(t){r.setIdle();let e=(0,G.hG)(t);e?r.setError(e.longMessage):(0,G.H4)(t,[],r.setError)}};return 0===d.length?null:(0,i.FD)(i.FK,{children:[(0,i.Y)(D.rd.ActionMenu,{id:"web3Wallets",triggerLocalizationKey:(0,h.G)("userProfile.start.web3WalletsSection.primaryButton"),onClick:e,children:d.map(e=>(0,i.Y)(D.rd.ActionMenuItem,{id:o[e].id,onClick:()=>{m(e)},isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,localizationKey:(0,h.G)("userProfile.web3WalletPage.web3WalletButtonsBlockButton",{provider:o[e].name}),sx:e=>({justifyContent:"start",gap:e.space.$2}),leftIcon:(0,i.Y)(y._V,{elementDescriptor:S.$z.providerIcon,elementId:S.$z.providerIcon.setId(o[e].id),isLoading:r.loadingMetadata===e,isDisabled:r.isLoading,src:o[e].iconUrl,alt:`Connect ${o[e].name}`,sx:e=>({width:e.sizes.$5})})},e))}),r.error&&(0,i.Y)(y.EY,{colorScheme:"danger",sx:e=>({padding:e.sizes.$1x5,paddingLeft:e.sizes.$8x5}),children:r.error})]})}),eL=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(O,{onSuccess:r,onReset:r,...e})},eO=(0,l.dm)(({shouldAllowCreation:e=!0})=>{let{user:r}=(0,v.Jd)(),t=(0,l.f0)(),{strategyToDisplayData:o}=(0,w.k)(),a=!!r?.web3Wallets?.length,[s,c]=(0,n.useState)(null);return e||a?(0,i.FD)(D.rd.Root,{title:(0,h.G)("userProfile.start.web3WalletsSection.title"),centered:!1,id:"web3Wallets",children:[(0,i.Y)(P.Z.Alert,{children:t.error}),(0,i.FD)(F.r.Root,{value:s,onChange:c,children:[(0,i.Y)(D.rd.ItemList,{id:"web3Wallets",children:Z(r?.web3Wallets,r?.primaryWeb3WalletId).map(e=>{var t;let l=e.verification.strategy,a=e.id;return o[l]&&(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"web3Wallets",align:"start",children:[(0,i.FD)(y.so,{sx:e=>({alignItems:"center",gap:e.space.$2,width:"100%"}),children:[o[l].iconUrl&&(0,i.Y)(y._V,{src:o[l].iconUrl,alt:o[l].name,sx:e=>({width:e.sizes.$4})}),(0,i.Y)(y.az,{sx:{whiteSpace:"nowrap",overflow:"hidden"},children:(0,i.FD)(y.so,{gap:2,justify:"start",children:[(0,i.FD)(y.EY,{children:[o[l].name," (",(t=e.web3Wallet).length<=10?t:t.slice(0,6)+"..."+t.slice(-4),")"]}),r?.primaryWeb3WalletId===a&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__primary")}),"verified"!==e.verification.status&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__unverified")})]})})]}),(0,i.Y)(eK,{walletId:a})]},a),(0,i.Y)(F.r.Open,{value:`remove-${a}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(eL,{walletId:e.id})})})]},e.id)})}),e&&(0,i.Y)(eE,{onClick:()=>c(null)})]})]}):null}),eK=({walletId:e})=>{let r=(0,l.f0)(),{open:t}=(0,$.D5)(),{user:n}=(0,v.Jd)(),o=n?.primaryWeb3WalletId===e,a=(0,v.Wp)(()=>n?.update({primaryWeb3WalletId:e})),s=[!o?{label:(0,h.G)("userProfile.start.web3WalletsSection.detailsAction__nonPrimary"),onClick:()=>{a().catch(e=>(0,G.H4)(e,[],r.setError))}}:null,{label:(0,h.G)("userProfile.start.web3WalletsSection.destructiveAction"),isDestructive:!0,onClick:()=>t(`remove-${e}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:s})},eM=(0,l.dm)(()=>{let{attributes:e,social:r,enterpriseSSO:t}=(0,Y.O)().userSettings,n=(0,l.f0)(),{user:o}=(0,v.Jd)(),{shouldAllowIdentificationCreation:a}=(0,d.B)(),s=e.username?.enabled,c=e.email_address?.enabled,u=e.phone_number?.enabled,m=r&&Object.values(r).filter(e=>e.enabled).length>0,f=o&&t.enabled,p=e.web3_wallet?.enabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8,color:e.colors.$colorForeground}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("account"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,h.G)("userProfile.start.headerTitle__account"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:n.error}),(0,i.Y)(eA,{}),s&&(0,i.Y)(eR,{}),c&&(0,i.Y)(er,{shouldAllowCreation:a}),u&&(0,i.Y)(ev,{shouldAllowCreation:a}),m&&(0,i.Y)(J,{shouldAllowCreation:a}),f&&(0,i.Y)(ei,{}),p&&(0,i.Y)(eO,{shouldAllowCreation:a})]})})});var eN=t(2611),eB=t(7806),eW=t(7896),eJ=t(4901),eq=t(892),eU=t(8910);let ej=()=>{let e,{user:r}=(0,v.Jd)(),{session:t}=(0,v.wV)(),{data:n,isLoading:l}=(0,eW.s)(r?.getSessions,"user-sessions");return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.activeDevicesSection.title"),centered:!1,id:"activeDevices",children:(0,i.Y)(D.rd.ItemList,{id:"activeDevices",disableAnimation:!0,children:l?(0,i.Y)(eN.K,{}):n?.sort((e=t.id,r=>r.id===e?-1:1)).map(e=>eV(e.status)?(0,i.Y)(eH,{session:e},e.id):null)})})},eV=e=>["active","pending"].includes(e),eH=({session:e})=>{let r=(0,v.wV)().session?.id===e.id,t=(0,eJ.m)(),n=(0,v.Wp)(e.revoke.bind(e)),l=async()=>{if(!r&&e)return t.setLoading(),n().catch(e=>(0,G.H4)(e,[],t.setError)).finally(()=>t.setIdle())};return(0,i.Y)(D.rd.Item,{id:"activeDevices",elementDescriptor:S.$z.activeDeviceListItem,elementId:r?S.$z.activeDeviceListItem.setId("current"):void 0,sx:{alignItems:"flex-start",opacity:t.isLoading?.5:1},isDisabled:t.isLoading,children:(0,i.FD)(i.FK,{children:[(0,i.Y)(eZ,{session:e}),!r&&(0,i.Y)(eX,{revoke:l})]})})},eZ=e=>{let{session:r}=(0,v.wV)(),t=r?.id===e.session.id,n=!!r?.actor,l=!!e.session.actor,{city:o,country:a,browserName:s,browserVersion:c,deviceType:d,ipAddress:u,isMobile:m}=e.session.latestActivity,f=`${s||""} ${c||""}`.trim()||"Web browser",p=[o||"",a||""].filter(Boolean).join(", ").trim()||null,{t:g}=(0,eS._)();return(0,i.FD)(y.so,{elementDescriptor:S.$z.activeDevice,elementId:t?S.$z.activeDevice.setId("current"):void 0,sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:[(0,i.Y)(y.so,{sx:e=>({[eb.g.sm]:{padding:"0"},borderRadius:e.radii.$md}),children:(0,i.Y)(y.In,{elementDescriptor:S.$z.activeDeviceIcon,elementId:S.$z.activeDeviceIcon.setId(m?"mobile":"desktop"),icon:m?eq.A:eU.A,sx:e=>({"--cl-chassis-bottom":"#444444","--cl-chassis-back":"#343434","--cl-chassis-screen":"#575757","--cl-screen":"#000000",width:e.space.$8,height:e.space.$8})})}),(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.FD)(y.so,{center:!0,gap:2,children:[(0,i.Y)(y.EY,{children:d||(m?"Mobile device":"Desktop device")}),t&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__thisDevice"),colorScheme:n?"danger":"primary"}),n&&!l&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__userDevice")}),!t&&l&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__otherImpersonatorDevice"),colorScheme:"danger"})]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:f}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:[u," (",p,")"]}),(0,i.Y)(y.EY,{colorScheme:"secondary",children:g((0,eB.T)(e.session.lastActiveAt))})]})]})},eX=({revoke:e})=>{let r=[{label:(0,h.G)("userProfile.start.activeDevicesSection.destructiveAction"),isDestructive:!0,onClick:e}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})};var eQ=t(9599),e0=t(8691);let e1=(0,l.dm)(e=>{let{onReset:r}=e,t=(0,l.f0)(),{afterSignOutUrl:n,afterMultiSessionSingleSignOutUrl:o}=(0,eQ.g)(),{user:a}=(0,v.Jd)(),{t:s}=(0,eS._)(),{otherSessions:c}=(0,e0.z)({user:a}),{setActive:d}=(0,v.ho)(),u=(0,v.Wp)(()=>a?.delete()),m=(0,ed.tJ)("deleteConfirmation","",{type:"text",label:(0,h.G)("userProfile.deletePage.actionDescription"),isRequired:!0,placeholder:(0,h.G)("formFieldInputPlaceholder__confirmDeletionUserAccount")}),f=m.value===(s((0,h.G)("formFieldInputPlaceholder__confirmDeletionUserAccount"))||"Delete account"),p=async()=>{if(f)try{await u();let e=0===c.length?n:o;return await d({session:null,redirectUrl:e})}catch(e){(0,G.H4)(e,[],t.setError)}};return(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.deletePage.title"),sx:e=>({gap:e.space.$0x5}),children:(0,i.FD)(ea.l.Root,{onSubmit:p,children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.deletePage.messageLine1")}),(0,i.Y)(y.EY,{colorScheme:"danger",localizationKey:(0,h.G)("userProfile.deletePage.messageLine2")})]}),(0,i.Y)(ea.l.ControlRow,{elementId:m.id,children:(0,i.Y)(ea.l.PlainInput,{...m.props,ignorePasswordManager:!0})}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.deletePage.confirm"),colorScheme:"danger",isDisabled:!f,onReset:r})]})})}),e2=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(e1,{onSuccess:e,onReset:e})},e5=()=>(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.dangerSection.title"),id:"danger",sx:{alignItems:"center",[eb.g.md]:{alignItems:"flex-start"}},children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"delete",children:(0,i.Y)(D.rd.Item,{id:"danger",sx:e=>({paddingLeft:e.space.$1}),children:(0,i.Y)(F.r.Trigger,{value:"delete",children:(0,i.Y)(D.rd.Button,{id:"danger",variant:"ghost",colorScheme:"danger",localizationKey:(0,h.G)("userProfile.start.dangerSection.deleteAccountButton")})})})}),(0,i.Y)(F.r.Open,{value:"delete",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(e2,{})})})]})});var e4=t(1323),e3=t(5079),e6=t(6103),e8=t(2534),e7=t(3610),e9=t(8095),re=t(9126),rr=t(7782),rt=t(1072),ri=t(5976),rn=t(2405),rl=t(2852);let ro=e=>{let{code:r}=e;return(0,i.Y)(y.so,{center:!0,sx:e=>({padding:`${e.space.$1} ${e.space.$4}`}),children:(0,i.Y)(y.EY,{children:r})})},ra=e=>{let{subtitle:r,backupCodes:t}=e,{applicationName:n}=(0,Y.O)().displayConfig,{user:l}=(0,v.Jd)(),{print:o,printableProps:a}=(0,re.h)(),{onCopy:s,hasCopied:c}=(0,rr.i)(t?.join(",")||"");if(!l)return null;let d=(0,e9.Cm)(l);return t?(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.title__codelist"),variant:"subtitle"}),(0,i.Y)(y.EY,{localizationKey:r,variant:"caption",colorScheme:"secondary"})]}),(0,i.FD)(y.az,{sx:e=>({borderWidth:e.borderWidths.$normal,borderStyle:e.borderStyles.$solid,borderColor:e.colors.$borderAlpha100,borderRadius:e.radii.$lg}),children:[(0,i.Y)(y.xA,{gap:2,sx:e=>({gridTemplateColumns:`repeat(2, minmax(${e.sizes.$12}, 1fr))`,padding:`${e.space.$4} ${e.space.$6}`}),children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))}),(0,i.FD)(y.xA,{sx:e=>({borderTopWidth:e.borderWidths.$normal,borderTopStyle:e.borderStyles.$solid,borderTopColor:e.colors.$borderAlpha100,gridTemplateColumns:"repeat(3, minmax(0, 1fr))",">:not([hidden])~:not([hidden])":{borderRightWidth:"0px",borderLeftWidth:"1px",borderStyle:"solid",borderColor:e.colors.$borderAlpha100},">:first-child":{borderBottomLeftRadius:e.radii.$lg},">:last-child":{borderBottomRightRadius:e.radii.$lg}}),children:[(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:()=>{var e,r,i;let l,o=document.createElement("a"),a=new Blob([(e=t,r=n,i=d,l=e?.join("\n"),`These are your backup codes for ${r} account ${i}.
|
|
2
2
|
Store them securely and keep them secret. Each code can only be used once.
|
|
3
3
|
|
|
4
|
-
${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rt.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:ri.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:c?rn.A:rl.A})})]})]}),(0,i.FD)(re.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",d,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))})]})]}):null},rs=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:o}=(0,v.Jd)(),a=(0,l.f0)(),s=(0,v.Wp)(()=>o?.createBackupCode()),[c,d]=n.useState(void 0);return(n.useEffect(()=>{!c&&o&&s().then(e=>d(e)).catch(e=>{if((0,e9.I3)(e))return t();(0,G.H4)(e,[],a.setError)})},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title"),children:c?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(ra,{subtitle:(0,h.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:c.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,h.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eN.K,{})})}),rc=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rd,{onContinue:n.nextStep}),(0,i.Y)(rs,{onSuccess:r,onReset:t})]})}),rd=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,h.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var ru=t(155),rh=t(6370),rm=t(9679);let rf=(0,l.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(ef,{title:(0,h.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rg,{title:(0,h.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rY,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,h.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rh.B,{title:(0,h.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,h.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,h.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,h.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(ra,{backupCodes:l.current?.backupCodes})})]})}),rp=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:o}=e,a=(0,l.f0)(),s=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:c}=(0,eo.Mz)(r.phoneNumber),d=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);a.setLoading(r.id);try{await s(),o.current=r,t()}catch(e){(0,G.H4)(e,[],a.setError)}finally{a.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:a.loadingMetadata===r.id,isDisabled:a.isLoading,children:[c.iso.toUpperCase()," ",d]},r.id)},rg=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:o}=e,a=(0,l.f0)(),s=n.current,c=(0,v.Wp)(()=>s?.setReservedForSecondFactor({reserved:!0})),d=async()=>{a.setLoading(s?.id);try{await c(),n.current=s,t()}catch(e){(0,G.H4)(e,[],a.setError)}finally{a.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,h.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{d()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:o})})},rY=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let c=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)(c.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),c.length>0&&(0,i.Y)(y.fv,{gap:2,children:c.map(e=>(0,i.Y)(rp,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(ru.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rm.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,h.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,h.G)("userProfile.formButtonReset"),onClick:t})]})]})};var rv=t(5559),rP=t(2094);let rb=(0,l.dm)(e=>{let{title:r,onSuccess:t,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,l.f0)(),c=(0,v.Wp)(()=>a?.createTOTP()),{close:d}=(0,$.D5)(),[u,m]=n.useState(void 0),[f,p]=n.useState("qr");return(n.useEffect(()=>{a&&c().then(e=>m(e)).catch(e=>(0,e9.Cm)(e)&&"reverification_cancelled"===e.code?d():(0,G.H4)(e,[],s.setError))},[]),s.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==f?(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!u&&(0,i.Y)(eN.K,{}),u&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==f&&(0,i.Y)(rP.r,{justify:"center",url:u.uri||""}),"uri"==f&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(rv.r,{value:u.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(rv.r,{value:u.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,h.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:o,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var ry=t(3356);let rS=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,ry.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,h.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,h.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),r_=(0,l.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(rb,{title:(0,h.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rS,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rh.B,{title:(0,h.G)("userProfile.mfaTOTPPage.title"),text:(0,h.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(ra,{subtitle:(0,h.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rD=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:o}=e,a=(0,l.f0)(),{userSettings:{attributes:s}}=(0,Y.O)(),{user:c}=(0,v.Jd)();if(!c)return null;let d=(0,h.G)("userProfile.mfaPage.title"),u=n.useMemo(()=>H(s,c),[]);return(n.useEffect(()=>{0===u.length&&a.setError("There are no second factors available to add")},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:d}):0!==u.length||o?(0,i.Y)(rR,{onSuccess:r,onReset:t,method:o||u[0]}):null}),rR=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rf,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(r_,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(rc,{onSuccess:t,onReset:n});default:return null}},rG=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(M,{onSuccess:e,onReset:e})},rC=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rF=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rs,{onSuccess:e,onReset:e})},r$=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rD,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rw=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=V(e),a=H(e,r),s=o.includes("totp")&&r.totpEnabled,c=o.includes("backup_code")&&r.backupCodeEnabled,d=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(F.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e3.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__default")})]}),(0,i.Y)(rk,{})]}),(0,i.Y)(F.r.Open,{value:"remove-totp",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rG,{})})})]}),o.includes("phone_code")&&d.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e6.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e4.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__default")})]}),(0,i.Y)(rx,{phone:e,showTOTP:s})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rC,{phoneId:t})})})]},t)}),c&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e8.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rI,{})]}),(0,i.Y)(F.r.Open,{value:"regenerate",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rF,{})})})]}),(0,i.Y)(rA,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rx=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,l.f0)(),o=e.id,a=[!r&&!e.defaultSecondFactor?{label:(0,h.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,h.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:a})},rI=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,h.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rk=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,h.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rA=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:e6.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e3.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:e8.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(F.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,h.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(F.r.Open,{value:"multi-factor",children:(0,i.Y)(F.r.Card,{children:o&&(0,i.Y)(r$,{selectedStrategy:o})})})]})},rz=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(N,{onSuccess:r,onReset:r,...e})},rT=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rE,{onSuccess:r,onReset:r,passkey:e.passkey})},rE=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,o=(0,l.f0)(),a=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,h.G)("formFieldLabel__passkeyName"),isRequired:!0}),s=a.value.length>1&&n.name!==a.value,c=async e=>(e.preventDefault(),n.update({name:a.value}).then(r).catch(e=>(0,G.H4)(e,[a],o.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,h.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:c,children:[(0,i.Y)(ea.l.ControlRow,{elementId:a.id,children:(0,i.Y)(ea.l.PlainInput,{...a.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.formButtonPrimary__save"),isDisabled:!s,onReset:t})]})})}),rL=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(F.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rO,{...e},r),(0,i.Y)(F.r.Open,{value:`remove-${r}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rz,{passkey:e})})}),(0,i.Y)(F.r.Open,{value:`rename-${r}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rT,{passkey:e})})})]},r)}),(0,i.Y)(rN,{onClick:()=>t(null)})]})})}):null},rO=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rK,{...e}),(0,i.Y)(rM,{passkey:e})]}),rK=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eB.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eB.T)(n))]})]})})},rM=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,h.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,h.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rN=({onClick:e})=>{let r=(0,l.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),o=(0,v.Wp)(()=>n?.createPasskey()),a=async()=>{if(e?.(),n)try{await o()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,h.G)("userProfile.start.passkeysSection.primaryButton"),onClick:a})};var rB=t(3990),rW=t(8282);let rJ=(0,l.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:o,onReset:a}=e,{user:s}=(0,v.Jd)(),c=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!s)return null;let{userSettings:{passwordSettings:d},authConfig:{reverification:u}}=(0,Y.O)(),{session:m}=(0,v.wV)(),f=s.passwordEnabled?(0,h.G)("userProfile.passwordPage.title__update"):(0,h.G)("userProfile.passwordPage.title__set"),p=(0,l.f0)(),g=s.enterpriseAccounts.some(e=>e.active),P=s.passwordEnabled&&!u,b=(0,n.useRef)({title:(0,h.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,h.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,h.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rB.C5)(e,{t:r,locale:t,passwordSettings:d})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,h.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,h.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:C}=(0,rW.Z)({passwordField:S,confirmPasswordField:_}),F=(P?y.value&&C:C)&&S.value&&_.value,$=async()=>{if(F)try{var e,r;let t;b.current={title:s.passwordEnabled?(0,h.G)("userProfile.passwordPage.title__update"):(0,h.G)("userProfile.passwordPage.title__set"),text:(e=s.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,h.G)("userProfile.passwordPage.successMessage__update")):t.push((0,h.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,h.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await c(s,[i]),o()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:f,children:[g&&(0,i.Y)(eC.k,{message:(0,h.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:m?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!s.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,h.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,h.G)("userProfile.formButtonReset"),block:!1,onClick:a})}):(0,i.Y)(es.G,{isDisabled:!F,onReset:a})]})]})}),rq=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rJ,{onSuccess:e,onReset:e})},rU=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,h.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,h.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,h.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rq,{})})})]})})},rj=(0,l.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,l.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,d.B)(),a=e.passkey?.enabled&&o,s=V(e).length>0,c=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,h.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rU,{}),a&&(0,i.Y)(rL,{}),s&&(0,i.Y)(rw,{}),(0,i.Y)(ej,{}),c&&(0,i.Y)(e5,{})]})})}),rV=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rH=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),rZ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),rX=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r0=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,d.B)(),{apiKeysSettings:l,commerceSettings:o}=(0,Y.O)(),a=e.routes[0].id===s.j2.ACCOUNT,c=e.routes[0].id===s.j2.SECURITY,u=e.routes[0].id===s.j2.BILLING,h=e.routes[0].id===s.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!a&&!c&&0===r;return(0,i.Y)(f.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(m.d,{children:[p,(0,i.FD)(f.q,{children:[(0,i.Y)(f.q,{path:a?void 0:"account",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(eM,{})})})}),(0,i.Y)(f.q,{path:c?void 0:"security",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(rj,{})})})}),o.billing.user.enabled&&r?(0,i.Y)(f.q,{path:u?void 0:"billing",children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rV,{})})}),o.billing.user.hasPaidPlans?(0,i.Y)(f.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rZ,{})})}):null,(0,i.Y)(f.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})}),(0,i.Y)(f.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})})]})}):null,l.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(f.q,{path:h?void 0:"api-keys",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rH,{})})})})})]})]})};var r1=t(393);let r2=(0,c.G)(()=>{let e=n.useRef(null);return(0,i.Y)(a.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(o.oT,{navbarTitleLocalizationKey:(0,h.G)("userProfile.navbar.title")}),(0,i.Y)(a.a.Content,{contentRef:e,scrollBoxId:s.AG,children:(0,i.Y)(r0,{})})]})})}),r5=(0,l.dm)(e=>(0,i.Y)(u.n.Root,{flow:"userProfile",children:(0,i.Y)(u.n.Part,{children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{path:"verify",children:(0,i.Y)(r1.G,{})}),(0,i.Y)(f.q,{children:(0,i.Y)(r2,{})})]})})})),r4=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(f.q,{path:"user",children:(0,i.Y)(d.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r5,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(9361),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
|
|
4
|
+
${l}`)],{type:"text/plain"});o.href=URL.createObjectURL(a),o.download=`${n}_backup_codes.txt`,document.body.appendChild(o),o.click()},children:(0,i.Y)(y.In,{icon:rt.A})}),(0,i.Y)(y.$n,{variant:"ghost",sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),onClick:o,children:(0,i.Y)(y.In,{icon:ri.A})}),(0,i.Y)(y.$n,{variant:"ghost",onClick:s,sx:e=>({width:"100%",padding:`${e.space.$2} 0`,borderRadius:0}),children:(0,i.Y)(y.In,{icon:c?rn.A:rl.A})})]})]}),(0,i.FD)(re.L,{...a,children:[(0,i.FD)(y.DZ,{children:["Your backup codes for ",n," account ",d,":"]}),(0,i.Y)(y.fv,{gap:2,children:t.map((e,r)=>(0,i.Y)(ro,{code:e},r))})]})]}):null},rs=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,{user:o}=(0,v.Jd)(),a=(0,l.f0)(),s=(0,v.Wp)(()=>o?.createBackupCode()),[c,d]=n.useState(void 0);return(n.useEffect(()=>{!c&&o&&s().then(e=>d(e)).catch(e=>{if((0,e7.I3)(e))return t();(0,G.H4)(e,[],a.setError)})},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title")}):(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title"),children:c?(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.successMessage")}),(0,i.Y)(ra,{subtitle:(0,h.G)("userProfile.backupCodePage.subtitle__codelist"),backupCodes:c.codes}),(0,i.Y)(es.c,{children:(0,i.Y)(y.$n,{autoFocus:!0,onClick:r,localizationKey:(0,h.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary})})]}):(0,i.Y)(eN.K,{})})}),rc=(0,l.dm)(e=>{let{onSuccess:r,onReset:t}=e,n=(0,eu.X)();return(0,i.FD)(eu.s,{...n.props,children:[(0,i.Y)(rd,{onContinue:n.nextStep}),(0,i.Y)(rs,{onSuccess:r,onReset:t})]})}),rd=e=>{let{onContinue:r}=e,{close:t}=(0,$.D5)();return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.backupCodePage.title"),children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.infoText1")}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.backupCodePage.infoText2")}),(0,i.FD)(es.c,{sx:{marginTop:0},children:[(0,i.Y)(y.$n,{textVariant:"buttonSmall",onClick:r,localizationKey:(0,h.G)("userProfile.formButtonPrimary__finish"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:t,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})};var ru=t(155),rh=t(6370),rm=t(9679);let rf=(0,l.dm)(e=>{let{onReset:r,onSuccess:t}=e,l=n.useRef(),o=(0,eu.X)({defaultStep:2}),a=(0,Y.O)().userSettings.attributes.backup_code?.enabled;return(0,i.FD)(eu.s,{...o.props,children:[(0,i.Y)(ef,{title:(0,h.G)("userProfile.phoneNumberPage.title"),resourceRef:l,onSuccess:o.nextStep,onUseExistingNumberClick:()=>o.goToStep(2),onReset:r}),(0,i.Y)(rg,{title:(0,h.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l,onSuccess:()=>a?o.goToStep(3):t(),onReset:()=>o.goToStep(2)}),(0,i.Y)(rY,{onSuccess:a?o.nextStep:t,onReset:r,onAddPhoneClick:()=>o.goToStep(0),onUnverifiedPhoneClick:e=>{l.current=e,o.goToStep(1)},title:(0,h.G)("userProfile.mfaPhoneCodePage.title"),resourceRef:l}),a&&(0,i.Y)(rh.B,{title:(0,h.G)("userProfile.mfaPhoneCodePage.successTitle"),text:l.current?.backupCodes&&l.current?.backupCodes.length>0?[(0,h.G)("userProfile.mfaPhoneCodePage.successMessage1"),(0,h.G)("userProfile.mfaPhoneCodePage.successMessage2")]:[(0,h.G)("userProfile.mfaPhoneCodePage.successMessage1")],onFinish:r,contents:(0,i.Y)(ra,{backupCodes:l.current?.backupCodes})})]})}),rp=e=>{let{phone:r,onSuccess:t,onUnverifiedPhoneClick:n,resourceRef:o}=e,a=(0,l.f0)(),s=(0,v.Wp)(()=>r.setReservedForSecondFactor({reserved:!0})),{country:c}=(0,eo.Mz)(r.phoneNumber),d=(0,eo.Om)(r.phoneNumber),u=async()=>{if("verified"!==r.verification.status)return n(r);a.setLoading(r.id);try{await s(),o.current=r,t()}catch(e){(0,G.H4)(e,[],a.setError)}finally{a.setIdle()}};return(0,i.FD)(y.$n,{variant:"outline",colorScheme:"neutral",sx:{justifyContent:"start"},onClick:u,isLoading:a.loadingMetadata===r.id,isDisabled:a.isLoading,children:[c.iso.toUpperCase()," ",d]},r.id)},rg=e=>{let{title:r,onSuccess:t,resourceRef:n,onReset:o}=e,a=(0,l.f0)(),s=n.current,c=(0,v.Wp)(()=>s?.setReservedForSecondFactor({reserved:!0})),d=async()=>{a.setLoading(s?.id);try{await c(),n.current=s,t()}catch(e){(0,G.H4)(e,[],a.setError)}finally{a.setIdle()}};return(0,i.Y)(ec.M,{headerTitle:r,headerSubtitle:(0,h.G)("userProfile.phoneNumberPage.verifySubtitle",{identifier:n.current?.phoneNumber||""}),children:(0,i.Y)(eh.j,{nextStep:()=>{d()},identification:n.current,identifier:n.current?.phoneNumber,prepareVerification:n.current?.prepareVerification,onReset:o})})},rY=e=>{let{onSuccess:r,onReset:t,title:n,onAddPhoneClick:l,onUnverifiedPhoneClick:o,resourceRef:a}=e,{user:s}=(0,v.Jd)();if(!s)return null;let c=s.phoneNumbers.filter(e=>!e.reservedForSecondFactor);return(0,i.FD)(ec.M,{headerTitle:n,gap:1,children:[(0,i.Y)(y.EY,{localizationKey:(0,h.G)(c.length?"userProfile.mfaPhoneCodePage.subtitle__availablePhoneNumbers":"userProfile.mfaPhoneCodePage.subtitle__unavailablePhoneNumbers"),colorScheme:"secondary"}),c.length>0&&(0,i.Y)(y.fv,{gap:2,children:c.map(e=>(0,i.Y)(rp,{onSuccess:r,phone:e,onUnverifiedPhoneClick:o,resourceRef:a},e.id))}),(0,i.FD)(es.c,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[(0,i.Y)(ru.K,{variant:"ghost","aria-label":"Add phone number",icon:(0,i.Y)(y.In,{icon:rm.A,sx:e=>({marginRight:e.space.$2})}),localizationKey:(0,h.G)("userProfile.mfaPhoneCodePage.primaryButton__addPhoneNumber"),onClick:l}),(0,i.Y)(y.$n,{variant:"ghost",localizationKey:(0,h.G)("userProfile.formButtonReset"),onClick:t})]})]})};var rv=t(5559),rP=t(2094);let rb=(0,l.dm)(e=>{let{title:r,onSuccess:t,onReset:o}=e,{user:a}=(0,v.Jd)(),s=(0,l.f0)(),c=(0,v.Wp)(()=>a?.createTOTP()),{close:d}=(0,$.D5)(),[u,m]=n.useState(void 0),[f,p]=n.useState("qr");return(n.useEffect(()=>{a&&c().then(e=>m(e)).catch(e=>(0,e7.Cm)(e)&&"reverification_cancelled"===e.code?d():(0,G.H4)(e,[],s.setError))},[]),s.error)?(0,i.Y)(ec.M,{headerTitle:r}):(0,i.FD)(ec.M,{headerTitle:r,headerSubtitle:"qr"==f?(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__ableToScan"):(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.infoText__unableToScan"),children:[!u&&(0,i.Y)(eN.K,{}),u&&(0,i.FD)(i.FK,{children:[(0,i.FD)(y.fv,{gap:4,children:["qr"==f&&(0,i.Y)(rP.r,{justify:"center",url:u.uri||""}),"uri"==f&&(0,i.FD)(i.FK,{children:[(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan1")}),(0,i.Y)(rv.r,{value:u.secret}),(0,i.Y)(y.EY,{colorScheme:"secondary",localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.inputLabel__unableToScan2")}),(0,i.Y)(rv.r,{value:u.uri})]})]}),(0,i.FD)(y.so,{justify:"between",align:"center",sx:{width:"100%"},children:["qr"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("uri"),localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonUnableToScan__nonPrimary")}),"uri"==f&&(0,i.Y)(y.$n,{variant:"link",textVariant:"buttonLarge",onClick:()=>p("qr"),localizationKey:(0,h.G)("userProfile.mfaTOTPPage.authenticatorApp.buttonAbleToScan__nonPrimary")}),(0,i.FD)(es.c,{children:[(0,i.Y)(y.$n,{onClick:t,localizationKey:(0,h.G)("userProfile.formButtonPrimary__continue"),elementDescriptor:S.$z.formButtonPrimary}),(0,i.Y)(y.$n,{variant:"ghost",onClick:o,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})]})]})]})]})});var ry=t(3356);let rS=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,resourceRef:n}=e,{user:l}=(0,v.Jd)(),o=(0,ry.xM)({onCodeEntryFinished:(e,r,t)=>{l?.verifyTOTP({code:e}).then(e=>r(e)).catch(t)},onResolve:e=>{n.current=e,r()}});return(0,i.FD)(ec.M,{headerTitle:(0,h.G)("userProfile.mfaTOTPPage.title"),children:[(0,i.Y)(y.fv,{children:(0,i.Y)(ea.l.OTPInput,{...o,label:(0,h.G)("userProfile.mfaTOTPPage.verifyTitle"),description:(0,h.G)("userProfile.mfaTOTPPage.verifySubtitle")})}),(0,i.Y)(es.c,{sx:{marginTop:0},children:(0,i.Y)(y.$n,{onClick:t,variant:"ghost",isDisabled:o.isLoading,localizationKey:(0,h.G)("userProfile.formButtonReset"),elementDescriptor:S.$z.formButtonReset})})]})}),r_=(0,l.dm)(e=>{let{onReset:r}=e,t=(0,eu.X)(),l=n.useRef();return(0,i.FD)(eu.s,{...t.props,children:[(0,i.Y)(rb,{title:(0,h.G)("userProfile.mfaTOTPPage.title"),onSuccess:t.nextStep,onReset:r}),(0,i.Y)(rS,{onSuccess:t.nextStep,onReset:r,resourceRef:l}),(0,i.Y)(rh.B,{title:(0,h.G)("userProfile.mfaTOTPPage.title"),text:(0,h.G)("userProfile.mfaTOTPPage.successMessage"),onFinish:r,contents:(0,i.Y)(ra,{subtitle:(0,h.G)("userProfile.backupCodePage.successSubtitle"),backupCodes:l.current?.backupCodes})})]})}),rD=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,selectedStrategy:o}=e,a=(0,l.f0)(),{userSettings:{attributes:s}}=(0,Y.O)(),{user:c}=(0,v.Jd)();if(!c)return null;let d=(0,h.G)("userProfile.mfaPage.title"),u=n.useMemo(()=>H(s,c),[]);return(n.useEffect(()=>{0===u.length&&a.setError("There are no second factors available to add")},[]),a.error)?(0,i.Y)(ec.M,{headerTitle:d}):0!==u.length||o?(0,i.Y)(rR,{onSuccess:r,onReset:t,method:o||u[0]}):null}),rR=e=>{let{method:r,onSuccess:t,onReset:n}=e;switch(r){case"phone_code":return(0,i.Y)(rf,{onSuccess:t,onReset:n});case"totp":return(0,i.Y)(r_,{onSuccess:t,onReset:n});case"backup_code":return(0,i.Y)(rc,{onSuccess:t,onReset:n});default:return null}},rG=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(M,{onSuccess:e,onReset:e})},rC=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(K,{onSuccess:r,onReset:r,...e})},rF=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rs,{onSuccess:e,onReset:e})},r$=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rD,{onSuccess:r,onReset:r,selectedStrategy:e.selectedStrategy})},rw=()=>{let{userSettings:{attributes:e}}=(0,Y.O)(),{user:r}=(0,v.Jd)(),[t,l]=(0,n.useState)(null);if(!r)return null;let o=V(e),a=H(e,r),s=o.includes("totp")&&r.totpEnabled,c=o.includes("backup_code")&&r.backupCodeEnabled,d=r.phoneNumbers.filter(e=>"verified"===e.verification.status).filter(e=>e.reservedForSecondFactor).sort(j);return(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.mfaSection.title"),centered:!1,id:"mfa",children:(0,i.Y)(F.r.Root,{value:t,onChange:l,children:(0,i.FD)(D.rd.ItemList,{id:"mfa",children:[s&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e3.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.start.mfaSection.totp.headerTitle")}),(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__default")})]}),(0,i.Y)(rk,{})]}),(0,i.Y)(F.r.Open,{value:"remove-totp",children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rG,{})})})]}),o.includes("phone_code")&&d.map(e=>{let r=!s&&e.defaultSecondFactor,t=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e6.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.FD)(y.EY,{children:["SMS Code ",(0,i.Y)(e4.R,{value:e.phoneNumber})]}),r&&(0,i.Y)(y.Ex,{localizationKey:(0,h.G)("badge__default")})]}),(0,i.Y)(rx,{phone:e,showTOTP:s})]}),(0,i.Y)(F.r.Open,{value:`remove-${t}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rC,{phoneId:t})})})]},t)}),c&&(0,i.FD)(i.FK,{children:[(0,i.FD)(D.rd.Item,{id:"mfa",hoverable:!0,children:[(0,i.FD)(y.so,{sx:e=>({gap:e.space.$2,alignItems:"center"}),children:[(0,i.Y)(y.In,{icon:e8.A,sx:e=>({color:e.colors.$neutralAlpha700})}),(0,i.Y)(y.EY,{localizationKey:(0,h.G)("userProfile.start.mfaSection.backupCodes.headerTitle")})]}),(0,i.Y)(rI,{})]}),(0,i.Y)(F.r.Open,{value:"regenerate",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rF,{})})})]}),(0,i.Y)(rA,{secondFactorsAvailableToAdd:a,onClick:()=>l(null)})]})})})},rx=({phone:e,showTOTP:r})=>{let{open:t}=(0,$.D5)(),n=(0,l.f0)(),o=e.id,a=[!r&&!e.defaultSecondFactor?{label:(0,h.G)("userProfile.start.mfaSection.phoneCode.actionLabel__setDefault"),onClick:()=>e.makeDefaultSecondFactor().catch(e=>(0,G.H4)(e,[],n.setError))}:null,{label:(0,h.G)("userProfile.start.mfaSection.phoneCode.destructiveActionLabel"),isDestructive:!0,onClick:()=>t(`remove-${o}`)}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:a})},rI=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,h.G)("userProfile.start.mfaSection.backupCodes.actionLabel__regenerate"),onClick:()=>e("regenerate")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rk=()=>{let{open:e}=(0,$.D5)(),r=[{label:(0,h.G)("userProfile.start.mfaSection.totp.destructiveActionTitle"),isDestructive:!0,onClick:()=>e("remove-totp")}].filter(e=>null!==e);return(0,i.Y)(R.o,{actions:r})},rA=e=>{let{open:r}=(0,$.D5)(),{secondFactorsAvailableToAdd:t,onClick:l}=e,[o,a]=(0,n.useState)(),s=n.useMemo(()=>t.map(e=>"phone_code"===e?{icon:e6.A,text:"SMS code",key:"phone_code"}:"totp"===e?{icon:e3.A,text:"Authenticator application",key:"totp"}:"backup_code"===e?{icon:e8.A,text:"Backup code",key:"backup_code"}:null).filter(e=>null!==e),[t]);return(0,i.FD)(i.FK,{children:[t.length>0&&(0,i.Y)(F.r.Closed,{value:"multi-factor",children:(0,i.Y)(D.rd.ActionMenu,{id:"mfa",triggerLocalizationKey:(0,h.G)("userProfile.start.mfaSection.primaryButton"),onClick:l,children:s.map(e=>e&&(0,i.Y)(D.rd.ActionMenuItem,{id:e.key,localizationKey:e.text,leftIcon:e.icon,onClick:()=>{a(e.key),r("multi-factor")}},e.key))})}),(0,i.Y)(F.r.Open,{value:"multi-factor",children:(0,i.Y)(F.r.Card,{children:o&&(0,i.Y)(r$,{selectedStrategy:o})})})]})},rz=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(N,{onSuccess:r,onReset:r,...e})},rT=e=>{let{close:r}=(0,$.D5)();return(0,i.Y)(rE,{onSuccess:r,onReset:r,passkey:e.passkey})},rE=(0,l.dm)(e=>{let{onSuccess:r,onReset:t,passkey:n}=e,o=(0,l.f0)(),a=(0,ed.tJ)("passkeyName",n.name||"",{type:"text",label:(0,h.G)("formFieldLabel__passkeyName"),isRequired:!0}),s=a.value.length>1&&n.name!==a.value,c=async e=>(e.preventDefault(),n.update({name:a.value}).then(r).catch(e=>(0,G.H4)(e,[a],o.setError)));return(0,i.Y)(ec.M,{headerTitle:(0,h.G)("userProfile.passkeyScreen.title__rename"),headerSubtitle:(0,h.G)("userProfile.passkeyScreen.subtitle__rename"),children:(0,i.FD)(ea.l.Root,{onSubmit:c,children:[(0,i.Y)(ea.l.ControlRow,{elementId:a.id,children:(0,i.Y)(ea.l.PlainInput,{...a.props,autoComplete:"off"})}),(0,i.Y)(es.G,{submitLabel:(0,h.G)("userProfile.formButtonPrimary__save"),isDisabled:!s,onReset:t})]})})}),rL=()=>{let{user:e}=(0,v.Jd)(),[r,t]=(0,n.useState)(null);return e?(0,i.Y)(D.rd.Root,{title:(0,h.G)("userProfile.start.passkeysSection.title"),centered:!1,id:"passkeys",children:(0,i.Y)(F.r.Root,{value:r,onChange:t,children:(0,i.FD)(D.rd.ItemList,{id:"passkeys",children:[e.passkeys.map(e=>{let r=e.id;return(0,i.FD)(n.Fragment,{children:[(0,i.Y)(rO,{...e},r),(0,i.Y)(F.r.Open,{value:`remove-${r}`,children:(0,i.Y)(F.r.Card,{variant:"destructive",children:(0,i.Y)(rz,{passkey:e})})}),(0,i.Y)(F.r.Open,{value:`rename-${r}`,children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rT,{passkey:e})})})]},r)}),(0,i.Y)(rN,{onClick:()=>t(null)})]})})}):null},rO=e=>(0,i.FD)(D.rd.Item,{id:"passkeys",hoverable:!0,sx:{alignItems:"flex-start"},children:[(0,i.Y)(rK,{...e}),(0,i.Y)(rM,{passkey:e})]}),rK=e=>{let{name:r,createdAt:t,lastUsedAt:n}=e,{t:l}=(0,eS._)();return(0,i.Y)(y.so,{sx:e=>({width:"100%",overflow:"hidden",gap:e.space.$4,[eb.g.sm]:{gap:e.space.$2}}),children:(0,i.FD)(y.fv,{align:"start",gap:1,children:[(0,i.Y)(y.EY,{children:r}),(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Created: ",l((0,eB.T)(t))]}),n&&(0,i.FD)(y.EY,{colorScheme:"secondary",children:["Last used: ",l((0,eB.T)(n))]})]})})},rM=({passkey:e})=>{let{open:r}=(0,$.D5)(),t=e.id,n=[{label:(0,h.G)("userProfile.start.passkeysSection.menuAction__rename"),onClick:()=>r(`rename-${t}`)},{label:(0,h.G)("userProfile.start.passkeysSection.menuAction__destructive"),isDestructive:!0,onClick:()=>r(`remove-${t}`)}];return(0,i.Y)(R.o,{actions:n})},rN=({onClick:e})=>{let r=(0,l.f0)(),{isSatellite:t}=(0,v.ho)(),{user:n}=(0,v.Jd)(),o=(0,v.Wp)(()=>n?.createPasskey()),a=async()=>{if(e?.(),n)try{await o()}catch(e){(0,G.H4)(e,[],r.setError)}};return t?null:(0,i.Y)(D.rd.ArrowButton,{id:"passkeys",localizationKey:(0,h.G)("userProfile.start.passkeysSection.primaryButton"),onClick:a})};var rB=t(3990),rW=t(8282);let rJ=(0,l.dm)(e=>{let{t:r,locale:t}=(0,eS._)(),{onSuccess:o,onReset:a}=e,{user:s}=(0,v.Jd)(),c=(0,v.Wp)((e,r)=>e.updatePassword(...r));if(!s)return null;let{userSettings:{passwordSettings:d},authConfig:{reverification:u}}=(0,Y.O)(),{session:m}=(0,v.wV)(),f=s.passwordEnabled?(0,h.G)("userProfile.passwordPage.title__update"):(0,h.G)("userProfile.passwordPage.title__set"),p=(0,l.f0)(),g=s.enterpriseAccounts.some(e=>e.active),P=s.passwordEnabled&&!u,b=(0,n.useRef)({title:(0,h.G)("userProfile.passwordPage.title__set")}),y=(0,ed.tJ)("currentPassword","",{type:"password",label:(0,h.G)("formFieldLabel__currentPassword"),isRequired:!0}),S=(0,ed.tJ)("newPassword","",{type:"password",label:(0,h.G)("formFieldLabel__newPassword"),isRequired:!0,validatePassword:!0,buildErrorMessage:e=>(0,rB.C5)(e,{t:r,locale:t,passwordSettings:d})}),_=(0,ed.tJ)("confirmPassword","",{type:"password",label:(0,h.G)("formFieldLabel__confirmPassword"),isRequired:!0}),D=(0,ed.tJ)("signOutOfOtherSessions","",{type:"checkbox",label:(0,h.G)("formFieldLabel__signOutOfOtherSessions"),defaultChecked:!0}),{setConfirmPasswordFeedback:R,isPasswordMatch:C}=(0,rW.Z)({passwordField:S,confirmPasswordField:_}),F=(P?y.value&&C:C)&&S.value&&_.value,$=async()=>{if(F)try{var e,r;let t;b.current={title:s.passwordEnabled?(0,h.G)("userProfile.passwordPage.title__update"):(0,h.G)("userProfile.passwordPage.title__set"),text:(e=s.passwordEnabled,r=!!D.checked,t=[],e?t.push((0,h.G)("userProfile.passwordPage.successMessage__update")):t.push((0,h.G)("userProfile.passwordPage.successMessage__set")),r&&t.push((0,h.G)("userProfile.passwordPage.successMessage__signOutOfOtherSessions")),t)};let i={newPassword:S.value,signOutOfOtherSessions:D.checked,currentPassword:P?y.value:void 0};await c(s,[i]),o()}catch(e){(0,G.H4)(e,[y,S,_],p.setError)}};return(0,i.FD)(ec.M,{headerTitle:f,children:[g&&(0,i.Y)(eC.k,{message:(0,h.G)("userProfile.passwordPage.readonly")}),(0,i.FD)(ea.l.Root,{onSubmit:$,onBlur:()=>{S.value&&R(_.value)},children:[(0,i.Y)("input",{readOnly:!0,"data-testid":"hidden-identifier",id:"identifier-field",name:"identifier",value:m?.publicUserData.identifier||"",style:{display:"none"}}),P&&(0,i.Y)(ea.l.ControlRow,{elementId:y.id,children:(0,i.Y)(ea.l.PasswordInput,{...y.props,minLength:6,isRequired:!0,autoFocus:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:S.id,children:(0,i.Y)(ea.l.PasswordInput,{...S.props,minLength:6,isRequired:!0,autoFocus:!s.passwordEnabled,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:_.id,children:(0,i.Y)(ea.l.PasswordInput,{..._.props,onChange:e=>(e.target.value&&R(e.target.value),_.props.onChange(e)),isRequired:!0,isDisabled:g})}),(0,i.Y)(ea.l.ControlRow,{elementId:D.id,children:(0,i.Y)(ea.l.Checkbox,{...D.props,description:(0,h.G)("userProfile.passwordPage.checkboxInfoText__signOutOfOtherSessions"),isDisabled:g})}),g?(0,i.Y)(es.c,{children:(0,i.Y)(ea.l.ResetButton,{localizationKey:(0,h.G)("userProfile.formButtonReset"),block:!1,onClick:a})}):(0,i.Y)(es.G,{isDisabled:!F,onReset:a})]})]})}),rq=()=>{let{close:e}=(0,$.D5)();return(0,i.Y)(rJ,{onSuccess:e,onReset:e})},rU=()=>{let{user:e}=(0,v.Jd)();if(!e)return null;let{passwordEnabled:r}=e;return(0,i.Y)(D.rd.Root,{centered:!1,title:(0,h.G)("userProfile.start.passwordSection.title"),id:"password",children:(0,i.FD)(F.r.Root,{children:[(0,i.Y)(F.r.Closed,{value:"edit",children:(0,i.FD)(D.rd.Item,{id:"password",sx:e=>({paddingLeft:r?void 0:"0",paddingTop:e.space.$0x25,paddingBottom:e.space.$0x25}),children:[r&&(0,i.Y)(y.EY,{variant:"h2",children:"••••••••••"}),(0,i.Y)(F.r.Trigger,{value:"edit",children:(0,i.Y)(D.rd.Button,{id:"password",localizationKey:r?(0,h.G)("userProfile.start.passwordSection.primaryButton__updatePassword"):(0,h.G)("userProfile.start.passwordSection.primaryButton__setPassword")})})]})}),(0,i.Y)(F.r.Open,{value:"edit",children:(0,i.Y)(F.r.Card,{children:(0,i.Y)(rq,{})})})]})})},rj=(0,l.dm)(()=>{let{attributes:e,instanceIsPasswordBased:r}=(0,Y.O)().userSettings,t=(0,l.f0)(),{user:n}=(0,v.Jd)(),{shouldAllowIdentificationCreation:o}=(0,d.B)(),a=e.passkey?.enabled&&o,s=V(e).length>0,c=n?.deleteSelfEnabled;return(0,i.Y)(y.fv,{elementDescriptor:S.$z.page,sx:e=>({gap:e.space.$8}),children:(0,i.FD)(y.fv,{elementDescriptor:S.$z.profilePage,elementId:S.$z.profilePage.setId("security"),children:[(0,i.Y)(b.Y.Root,{children:(0,i.Y)(b.Y.Title,{localizationKey:(0,h.G)("userProfile.start.headerTitle__security"),sx:e=>({marginBottom:e.space.$4}),textVariant:"h2"})}),(0,i.Y)(P.Z.Alert,{children:t.error}),r&&(0,i.Y)(rU,{}),a&&(0,i.Y)(rL,{}),s&&(0,i.Y)(rw,{}),(0,i.Y)(ej,{}),c&&(0,i.Y)(e5,{})]})})}),rV=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("207"),t.e("259")]).then(t.bind(t,1608)).then(e=>({default:e.BillingPage}))),rH=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("326"),t.e("817")]).then(t.bind(t,8201)).then(e=>({default:e.APIKeysPage}))),rZ=(0,n.lazy)(()=>Promise.all([t.e("666"),t.e("970"),t.e("110")]).then(t.bind(t,7437)).then(e=>({default:e.PlansPage}))),rX=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("627")]).then(t.bind(t,1666)).then(e=>({default:e.StatementPage}))),rQ=(0,n.lazy)(()=>Promise.all([t.e("545"),t.e("666"),t.e("122")]).then(t.bind(t,4856)).then(e=>({default:e.PaymentAttemptPage}))),r0=()=>{let{pages:e,shouldShowBilling:r,apiKeysProps:t}=(0,d.B)(),{apiKeysSettings:l,commerceSettings:o}=(0,Y.O)(),a=e.routes[0].id===s.j2.ACCOUNT,c=e.routes[0].id===s.j2.SECURITY,u=e.routes[0].id===s.j2.BILLING,h=e.routes[0].id===s.j2.API_KEYS,p=e.contents?.map((e,r)=>{let t=!a&&!c&&0===r;return(0,i.Y)(f.q,{index:t,path:t?void 0:e.url,children:(0,i.Y)(g.H,{mount:e.mount,unmount:e.unmount})},`custom-page-${e.url}`)});return(0,i.FD)(m.d,{children:[p,(0,i.FD)(f.q,{children:[(0,i.Y)(f.q,{path:a?void 0:"account",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(eM,{})})})}),(0,i.Y)(f.q,{path:c?void 0:"security",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(rj,{})})})}),o.billing.user.enabled&&r?(0,i.Y)(f.q,{path:u?void 0:"billing",children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rV,{})})}),o.billing.user.hasPaidPlans?(0,i.Y)(f.q,{path:"plans",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rZ,{})})}):null,(0,i.Y)(f.q,{path:"statement/:statementId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rX,{})})}),(0,i.Y)(f.q,{path:"payment-attempt/:paymentAttemptId",children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rQ,{})})})]})}):null,l.user_api_keys_enabled&&!t?.hide&&(0,i.Y)(f.q,{path:h?void 0:"api-keys",children:(0,i.Y)(m.d,{children:(0,i.Y)(f.q,{index:!0,children:(0,i.Y)(n.Suspense,{fallback:"",children:(0,i.Y)(rH,{})})})})})]})]})};var r1=t(393);let r2=(0,c.G)(()=>{let e=n.useRef(null);return(0,i.Y)(a.a.Root,{children:(0,i.FD)(p,{contentRef:e,children:[(0,i.Y)(o.oT,{navbarTitleLocalizationKey:(0,h.G)("userProfile.navbar.title")}),(0,i.Y)(a.a.Content,{contentRef:e,scrollBoxId:s.AG,children:(0,i.Y)(r0,{})})]})})}),r5=(0,l.dm)(e=>(0,i.Y)(u.n.Root,{flow:"userProfile",children:(0,i.Y)(u.n.Part,{children:(0,i.FD)(m.d,{children:[(0,i.Y)(f.q,{path:"verify",children:(0,i.Y)(r1.G,{})}),(0,i.Y)(f.q,{children:(0,i.Y)(r2,{})})]})})})),r4=e=>{let r={...e,routing:"virtual",componentName:"UserProfile",mode:"modal"};return(0,i.Y)(f.q,{path:"user",children:(0,i.Y)(d.M.Provider,{value:r,children:(0,i.Y)("div",{children:(0,i.Y)(r5,{...r})})})})}},9599:function(e,r,t){t.d(r,{g:()=>l});var i=t(5543),n=t(4964);let l=()=>{let{navigate:e}=(0,n.r)(),r=(0,i.ho)();return{navigateAfterSignOut:()=>e(r.buildAfterSignOutUrl()),navigateAfterMultiSessionSingleSignOutUrl:()=>e(r.buildAfterMultiSessionSingleSignOutUrl()),afterSignOutUrl:r.buildAfterSignOutUrl(),afterMultiSessionSingleSignOutUrl:r.buildAfterMultiSessionSingleSignOutUrl()}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["636"],{9090:function(e,t,r){r.d(t,{n:()=>a});var i=r(4518),o=r(5170),n=r(2861);let a=e=>{let{onBackLinkClick:t}=e;return(0,i.Y)(o.J,{cardTitle:(0,n.G)("signIn.alternativeMethods.getHelp.title"),cardSubtitle:(0,n.G)("signIn.alternativeMethods.getHelp.content"),onBackLinkClick:t})}},2690:function(e,t,r){r.d(t,{j:()=>a});var i=r(5074),o=r(5763);let n=e=>{if(!e)return"";let t=e.strategy;return"phoneNumberId"in e&&(t+=e.phoneNumberId),t};function a(e){let t=i.useRef(""),[r,a]=i.useState(()=>(0,o.R5)(e)),[l,c]=i.useState(!r),s=t.current===n(r);return{currentFactor:r,factorAlreadyPrepared:s,handleFactorPrepare:()=>{t.current=n(r)},selectFactor:e=>{a(e),c(!1)},showAllStrategies:l,toggleAllStrategies:()=>c(e=>!e)}}},5763:function(e,t,r){r.d(t,{Cm:()=>u,Kw:()=>p,R5:()=>h,UY:()=>v,iy:()=>m,oj:()=>k,xf:()=>s}),r(1044);var i=r(2620),o=r(7651),n=r(1959),a=r(8289);let l=e=>t=>"safeIdentifier"in t&&t.safeIdentifier===e;function c(e){if((0,i.Bz)()){let t=e.find(({strategy:e})=>"passkey"===e);if(t)return t}return null}function s(e,t,r){return e&&0!==e.length?r===n._o.Password?function(e,t){let r=c(e);if(r)return r;let i=e.sort(a.Kn)[0];return"password"===i.strategy?i:e.find(l(t))||i||null}(e,t):function(e,t){let r=c(e);if(r)return r;let i=e.sort(a.Ih),o=i.find(l(t));if(o)return o;let n=i[0];return"email_link"===n.strategy?n:e.find(l(t))||n||null}(e,t):null}let d=["passkey","email_code","password","phone_code","email_link"];function u(e){return!!e&&d.includes(e.strategy)}function h(e){if(!e||0===e.length)return null;let t=e.find(e=>"totp"===e.strategy);if(t)return t;let r=e.find(e=>"phone_code"===e.strategy);return r||e[0]}let f=["reset_password_phone_code","reset_password_email_code"],p=e=>!!e&&f.includes(e);function v(e){let t;return"tel"===e.type?"phoneNumber":(t=e.value,/^\S+@\S+\.\S+$/.test(t))?"emailAddress":"username"}let k=(e,t,r)=>{if(!t)return null;let i=e.find(e=>"strategy"===e.id)?.value;if(i&&"phone_code"!==i)return null;let n=e.find(e=>e.id===r)?.value;if(!n||!n?.startsWith("+"))return null;let a=(0,o.TV)(n,t);return"sms"===a?null:a},m=(e,t,r)=>{if(!e||!t||"phoneNumber"!==t||!r||!r?.startsWith("+"))return null;let i=(0,o.TV)(r,e);return"sms"===i?null:i}},9066:function(e,t,r){r.r(t),r.d(t,{UserVerification:()=>eh,UserVerificationModal:()=>ef});var i=r(4518),o=r(5074),n=r(5577),a=r(9078),l=r(4607),c=r(7831),s=r(2265),d=r(3269),u=r(5170),h=r(6980),f=r(7697),p=r(2861),v=r(4964),k=r(5763),m=r(8738),Y=r(29),y=r(6088),b=r(6153),g=r(9835),C=r(8272),w=r(8920),F=r(4421),M=r(1051),A=r(743),_=r(6889),S=r(9830),B=r(2620),G=r(8289);function D({filterOutFactor:e,supportedFirstFactors:t}){let r=t?t.filter(e=>!(0,k.Kw)(e.strategy)):[],i=r&&r.length>0,n=(0,o.useMemo)(()=>t?t.filter(e=>!e.strategy.startsWith("oauth_")).filter(e=>(0,k.Cm)(e)).filter(t=>!t||!e||("email_code"===t.strategy&&"email_code"===e.strategy?t.emailAddressId!==e.emailAddressId:"phone_code"===t.strategy&&"phone_code"===e.strategy?t.phoneNumberId!==e.phoneNumberId:t.strategy!==e.strategy)).filter(e=>"passkey"!==e.strategy||(0,B.Bz)()).sort(G.aR):[],[t,e]);return{hasAnyStrategy:i,hasFirstParty:n&&n.length>0,firstPartyFactors:n}}var L=r(9361),I=r(7896);let z=()=>{let{session:e}=(0,L.wV)(),t=(()=>{let{level:e}=(0,a.k)();return(0,o.useMemo)(()=>({level:e||"second_factor"}),[e])})();return{...(0,I.s)(e?e.startVerification:void 0,t,{throttleTime:300})}};function T(e){let t=t=>{let{isLoading:r,data:o}=z();return r||!o?(0,i.Y)(h.B,{}):(0,i.Y)(e,{...t})},r=e.displayName||e.name||"Component";return e.displayName=r,t.displayName=r,t}let Z=e=>{let{onBackLinkClick:t}=e;return(0,i.Y)(u.J,{cardTitle:(0,p.G)("reverification.alternativeMethods.getHelp.title"),cardSubtitle:(0,p.G)("reverification.alternativeMethods.getHelp.content"),onBackLinkClick:t})},P=e=>((e,t)=>{let[r,n]=o.useState(!1),a=o.useCallback(()=>n(e=>!e),[n]);return r?(0,i.Y)(Z,{onBackLinkClick:a}):(0,i.Y)(e,{...t,onHavingTroubleClick:a})})(V,{...e}),V=e=>{let{onBackLinkClick:t,onHavingTroubleClick:r,onFactorSelected:o}=e,n=(0,d.f0)(),{data:a}=z(),{firstPartyFactors:c,hasAnyStrategy:s}=D({filterOutFactor:e?.currentFactor,supportedFirstFactors:a?.supportedFirstFactors});return(0,i.Y)(l.n.Part,{part:"alternativeMethods",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.alternativeMethods.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.alternativeMethods.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:n.error}),(0,i.Y)(C.so,{direction:"col",elementDescriptor:w.$z.main,gap:6,children:(0,i.FD)(C.fv,{gap:4,children:[s&&(0,i.Y)(C.so,{elementDescriptor:w.$z.alternativeMethods,direction:"col",gap:2,children:c.map((e,t)=>{var r;return(0,i.Y)(m.X,{leftIcon:(r=e,({email_code:F.A,phone_code:M.A,password:A.A,passkey:_.A,enterprise_sso:S.A})[r.strategy]),textLocalizationKey:function(e){switch(e.strategy){case"email_code":return(0,p.G)("reverification.alternativeMethods.blockButton__emailCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"phone_code":return(0,p.G)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"password":return(0,p.G)("reverification.alternativeMethods.blockButton__password");case"passkey":return(0,p.G)("reverification.alternativeMethods.blockButton__passkey");default:throw Error(`Invalid sign in strategy: "${e.strategy}"`)}}(e),elementDescriptor:w.$z.alternativeMethodsBlockButton,textElementDescriptor:w.$z.alternativeMethodsBlockButtonText,arrowElementDescriptor:w.$z.alternativeMethodsBlockButtonArrow,textVariant:"buttonLarge",isDisabled:n.isLoading,onClick:()=>{n.setError(void 0),o(e)}},t)})}),t&&(0,i.Y)(Y.E,{boxElementDescriptor:w.$z.backRow,linkElementDescriptor:w.$z.backLink,onClick:t})]})})]}),(0,i.Y)(y.Z.Footer,{children:(0,i.FD)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.Y)(y.Z.ActionText,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionText")}),(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})};var R=r(2454),E=r(4468),K=r(8640),x=r(9090),$=r(2950),N=r(9426);let U=()=>{let{afterVerification:e}=(0,a.k)(),t=(0,N.p)(),{setActive:r}=(0,L.ho)(),{setCache:i}=z(),{navigate:n}=(0,v.r)();return{handleVerificationResponse:(0,o.useCallback)(async o=>{switch(i({data:o,isLoading:!1,isValidating:!1,error:null,cachedAt:Date.now()}),o.status){case"complete":return await r({session:o.session.id}),e?.();case"needs_second_factor":return n("./factor-two");default:return console.error((0,$.s)(o.status,t))}},[n,r,t])}};function H(e){let{onShowAlternativeMethodsClick:t}=e,{session:r}=(0,L.wV)(),{handleVerificationResponse:n}=U(),a=(0,d.f0)(),[c,s]=o.useState(!1),u=o.useCallback(()=>s(e=>!e),[s]),h=(0,K.tJ)("password","",{type:"password",label:(0,p.G)("formFieldLabel__password"),placeholder:(0,p.G)("formFieldInputPlaceholder__password")}),f=async e=>(e.preventDefault(),r?.attemptFirstFactorVerification({strategy:"password",password:h.value}).then(n).catch(e=>(0,E.H4)(e,[h],a.setError)));return c?(0,i.Y)(x.n,{onBackLinkClick:u}):(0,i.Y)(l.n.Part,{part:"password",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.password.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.password.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.FD)(C.fv,{elementDescriptor:w.$z.main,gap:4,children:[(0,i.FD)(R.l.Root,{onSubmit:f,gap:8,children:[(0,i.Y)(R.l.ControlRow,{elementId:h.id,children:(0,i.Y)(R.l.PasswordInput,{...h.props,autoFocus:!0})}),(0,i.Y)(R.l.SubmitButton,{hasArrow:!0})]}),(0,i.Y)(y.Z.Action,{elementId:t?"alternativeMethods":"havingTrouble",children:(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)(t?"reverification.password.actionLink":"reverification.alternativeMethods.actionLink"),onClick:t||u})})]})]}),(0,i.Y)(y.Z.Footer,{})]})})}function j(e,t){return"primary"in e&&e.primary&&!("primary"in t&&t.primary)?-1:"primary"in t&&t.primary&&!("primary"in e&&e.primary)?1:0}var J=r(7912);let W=e=>{let{session:t}=(0,L.wV)(),r=(0,d.f0)(),{handleVerificationResponse:n}=U();o.useEffect(()=>{e.factorAlreadyPrepared||a()},[]);let a=()=>{t.prepareFirstFactorVerification(e.factor).then(()=>e.onFactorPrepare()).catch(e=>(0,E.H4)(e,[],r.setError))};return(0,i.Y)(J.j,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,inputLabel:e.inputLabel,resendButton:e.resendButton,onCodeEntryFinishedAction:(r,i,o)=>{t.attemptFirstFactorVerification({strategy:e.factor.strategy,code:r}).then(async e=>(await i(),n(e))).catch(o)},onResendCodeClicked:a,safeIdentifier:e.factor.safeIdentifier,profileImageUrl:t?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods,onBackLinkClicked:e.onBackLinkClicked})},q=e=>(0,i.Y)(l.n.Part,{part:"emailCode",children:(0,i.Y)(W,{...e,cardTitle:(0,p.G)("reverification.emailCode.title"),cardSubtitle:(0,p.G)("reverification.emailCode.subtitle"),inputLabel:(0,p.G)("reverification.emailCode.formTitle"),resendButton:(0,p.G)("reverification.emailCode.resendButton")})}),O=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,L.wV)(),{__internal_isWebAuthnSupported:o}=(0,L.ho)(),{handleVerificationResponse:n}=U(),a=(0,d.f0)();return(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.passkey.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.passkey.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.Y)(C.fv,{elementDescriptor:w.$z.main,gap:8,children:(0,i.Y)(R.l.Root,{children:(0,i.FD)(C.fv,{gap:3,children:[(0,i.Y)(C.$n,{type:"button",onClick:e=>{e.preventDefault(),r?.verifyWithPasskey().then(e=>n(e)).catch(e=>(0,E.H4)(e,[],a.setError))},localizationKey:(0,p.G)("reverification.passkey.blockButton__passkey"),hasArrow:!0}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("footerActionLink__useAnotherMethod"),onClick:t})})]})})})]}),(0,i.Y)(y.Z.Footer,{})]})},X=e=>(0,i.Y)(l.n.Part,{part:"phoneCode",children:(0,i.Y)(W,{...e,cardTitle:(0,p.G)("reverification.phoneCode.title"),cardSubtitle:(0,p.G)("reverification.phoneCode.subtitle"),inputLabel:(0,p.G)("reverification.phoneCode.formTitle"),resendButton:(0,p.G)("reverification.phoneCode.resendButton"),showAlternativeMethods:e.showAlternativeMethods})}),Q=e=>{if(!e)return"";let t=e.strategy;return"emailAddressId"in e&&(t+=e.emailAddressId),"phoneNumberId"in e&&(t+=e.phoneNumberId),t},ee=["password","email_code","phone_code","passkey"],et=T((0,d.dm)(function(){let{data:e}=z(),t=(0,d.f0)(),{navigate:r}=(0,v.r)(),n=o.useRef(""),a=(0,o.useMemo)(()=>e.supportedFirstFactors?.filter(e=>ee.includes(e.strategy))?.sort(j)||null,[e.supportedFirstFactors]),{preferredSignInStrategy:l}=(0,f.O)().displayConfig,[{currentFactor:c},s]=o.useState(()=>({currentFactor:(0,k.xf)(a,null,l),prevCurrentFactor:void 0})),{hasAnyStrategy:m,hasFirstParty:Y}=D({filterOutFactor:c,supportedFirstFactors:a}),[y,b]=o.useState(()=>!c||!(0,k.Cm)(c)),g=m?()=>{t.setError(void 0),b(e=>!e)}:void 0,C=()=>{n.current=Q(c)};if((0,o.useEffect)(()=>{"needs_second_factor"===e.status&&r("factor-two")},[]),!c)return(0,i.Y)(u.J,{cardTitle:(0,p.G)("reverification.noAvailableMethods.title"),cardSubtitle:(0,p.G)("reverification.noAvailableMethods.subtitle"),message:(0,p.G)("reverification.noAvailableMethods.message"),shouldNavigateBack:!1});if(y){let e=(0,k.Cm)(c);return(0,i.Y)(P,{onBackLinkClick:e?()=>{t.setError(void 0),g?.()}:void 0,onFactorSelected:e=>{s(t=>({currentFactor:e,prevCurrentFactor:t.currentFactor})),g?.()},currentFactor:c})}switch(c?.strategy){case"password":return(0,i.Y)(H,{onShowAlternativeMethodsClick:g});case"email_code":return(0,i.Y)(q,{factorAlreadyPrepared:n.current===Q(c),onFactorPrepare:C,onShowAlternativeMethodsClicked:g,factor:c,showAlternativeMethods:Y});case"phone_code":return(0,i.Y)(X,{factorAlreadyPrepared:n.current===Q(c),onFactorPrepare:C,onShowAlternativeMethodsClicked:g,factor:c,showAlternativeMethods:Y});case"passkey":return(0,i.Y)(O,{onShowAlternativeMethodsClicked:g});default:return(0,i.Y)(h.B,{})}}));var er=r(2690);let ei=e=>{let t=(0,d.f0)(),{session:r}=(0,L.wV)(),{handleVerificationResponse:n}=U();o.useEffect(()=>{e.factorAlreadyPrepared||a?.()},[]);let a=e.prepare?()=>e.prepare?.().then(()=>e.onFactorPrepare()).catch(e=>(0,E.H4)(e,[],t.setError)):void 0;return(0,i.Y)(J.j,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,resendButton:e.resendButton,inputLabel:e.inputLabel,onCodeEntryFinishedAction:(t,i,o)=>{r.attemptSecondFactorVerification({strategy:e.factor.strategy,code:t}).then(async e=>(await i(),n(e))).catch(o)},onResendCodeClicked:a,safeIdentifier:"safeIdentifier"in e.factor?e.factor.safeIdentifier:void 0,profileImageUrl:r?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods})};function eo(e){return(0,i.Y)(l.n.Part,{part:"totp2Fa",children:(0,i.Y)(ei,{...e,cardTitle:(0,p.G)("reverification.totpMfa.title"),cardSubtitle:(0,p.G)("reverification.totpMfa.subtitle"),inputLabel:(0,p.G)("reverification.totpMfa.formTitle"),showAlternativeMethods:e.showAlternativeMethods})})}let en=e=>{let[t,r]=o.useState(!1),n=o.useCallback(()=>r(e=>!e),[r]);return t?(0,i.Y)(Z,{onBackLinkClick:n}):(0,i.Y)(ea,{supportedSecondFactors:e.supportedSecondFactors,onBackLinkClick:e.onBackLinkClick,onFactorSelected:e.onFactorSelected,onHavingTroubleClick:n})},ea=e=>{let{supportedSecondFactors:t,onHavingTroubleClick:r,onFactorSelected:o,onBackLinkClick:n}=e,a=(0,d.f0)();return(0,i.Y)(l.n.Part,{part:"alternativeMethods",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.alternativeMethods.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.alternativeMethods.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.FD)(C.fv,{elementDescriptor:w.$z.main,gap:3,children:[(0,i.Y)(C.fv,{gap:2,children:t?.sort(G.Wy).map((e,t)=>(0,i.Y)(m.X,{textLocalizationKey:function(e){switch(e.strategy){case"phone_code":return(0,p.G)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"totp":return(0,p.G)("reverification.alternativeMethods.blockButton__totp");case"backup_code":return(0,p.G)("reverification.alternativeMethods.blockButton__backupCode");default:throw Error(`Invalid verification strategy: "${e.strategy}"`)}}(e),elementDescriptor:w.$z.alternativeMethodsBlockButton,textElementDescriptor:w.$z.alternativeMethodsBlockButtonText,arrowElementDescriptor:w.$z.alternativeMethodsBlockButtonArrow,isDisabled:a.isLoading,onClick:()=>o(e)},t))}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:n&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("backButton"),onClick:e.onBackLinkClick})})]})]}),(0,i.Y)(y.Z.Footer,{children:(0,i.FD)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.Y)(y.Z.ActionText,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionText")}),(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})},el=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,L.wV)(),{handleVerificationResponse:o}=U(),n=(0,d.f0)(),a=(0,K.tJ)("code","",{type:"text",label:(0,p.G)("formFieldLabel__backupCode"),isRequired:!0});return(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.backupCodeMfa.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.backupCodeMfa.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:n.error}),(0,i.Y)(C.fv,{elementDescriptor:w.$z.main,gap:8,children:(0,i.FD)(R.l.Root,{onSubmit:e=>(e.preventDefault(),r.attemptSecondFactorVerification({strategy:"backup_code",code:a.value}).then(o).catch(e=>(0,E.H4)(e,[a],n.setError))),children:[(0,i.Y)(R.l.ControlRow,{elementId:a.id,children:(0,i.Y)(R.l.PlainInput,{...a.props,autoFocus:!0,onActionClicked:t})}),(0,i.FD)(C.fv,{gap:3,children:[(0,i.Y)(R.l.SubmitButton,{hasArrow:!0}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("footerActionLink__useAnotherMethod"),onClick:t})})]})]})})]}),(0,i.Y)(y.Z.Footer,{})]})},ec=e=>{let{session:t}=(0,L.wV)();return(0,i.Y)(l.n.Part,{part:"phoneCode2Fa",children:(0,i.Y)(ei,{...e,cardTitle:(0,p.G)("reverification.phoneCodeMfa.title"),cardSubtitle:(0,p.G)("reverification.phoneCodeMfa.subtitle"),inputLabel:(0,p.G)("reverification.phoneCodeMfa.formTitle"),resendButton:(0,p.G)("reverification.phoneCodeMfa.resendButton"),prepare:()=>{let{phoneNumberId:r,strategy:i}=e.factor;return t.prepareSecondFactorVerification({phoneNumberId:r,strategy:i})}})})},es=["phone_code","totp","backup_code"],ed=T((0,d.dm)(function(){let{navigate:e}=(0,v.r)(),{data:t}=z(),r=(0,o.useMemo)(()=>t.supportedSecondFactors?.filter(e=>es.includes(e.strategy))?.sort(j)||null,[t.supportedSecondFactors]),{currentFactor:n,factorAlreadyPrepared:a,handleFactorPrepare:l,selectFactor:c,showAllStrategies:s,toggleAllStrategies:d}=(0,er.j)(r),u=(0,o.useMemo)(()=>r?.filter(e=>!e||!n||("phone_code"===e.strategy&&"phone_code"===n.strategy?e.phoneNumberId!==n.phoneNumberId:e.strategy!==n.strategy)),[r,n]),f=(0,o.useMemo)(()=>u&&u.length>0||!1,[u]);if((0,o.useEffect)(()=>{"needs_first_factor"===t.status&&e("../")},[]),!n)return(0,i.Y)(h.B,{});if(s&&f)return(0,i.Y)(en,{supportedSecondFactors:u||null,onBackLinkClick:d,onFactorSelected:c});switch(n?.strategy){case"phone_code":return(0,i.Y)(ec,{factorAlreadyPrepared:a,onFactorPrepare:l,factor:n,onShowAlternativeMethodsClicked:d,showAlternativeMethods:f});case"totp":return(0,i.Y)(eo,{factorAlreadyPrepared:a,onFactorPrepare:l,factor:n,onShowAlternativeMethodsClicked:d,showAlternativeMethods:f});case"backup_code":return(0,i.Y)(el,{onShowAlternativeMethodsClicked:d});default:return(0,i.Y)(h.B,{})}}));function eu(){let{invalidate:e}=z();return(0,o.useEffect)(()=>()=>{e()},[]),(0,i.Y)(l.n.Root,{flow:"userVerification",children:(0,i.FD)(c.d,{children:[(0,i.Y)(s.q,{path:"factor-two",children:(0,i.Y)(ed,{})}),(0,i.Y)(s.q,{index:!0,children:(0,i.Y)(et,{})})]})})}eu.displayName="UserVerification";let eh=(0,n.Z)(eu),ef=e=>(0,i.Y)(s.q,{path:"user-verification",children:(0,i.Y)(a._.Provider,{value:{componentName:"UserVerification",...e,routing:"virtual"},children:(0,i.Y)("div",{children:(0,i.Y)(eh,{...e,routing:"virtual"})})})})},9078:function(e,t,r){r.d(t,{_:()=>o,k:()=>n});var i=r(5074);let o=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(o);if(!e||"UserVerification"!==e.componentName)throw Error("Clerk: useUserVerificationContext called outside of the mounted UserVerification component.");let{componentName:t,...r}=e;return{...r,componentName:t}}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_clerk_ui=globalThis.webpackChunk_clerk_ui||[]).push([["636"],{9090:function(e,t,r){r.d(t,{n:()=>a});var i=r(4518),o=r(5170),n=r(2861);let a=e=>{let{onBackLinkClick:t}=e;return(0,i.Y)(o.J,{cardTitle:(0,n.G)("signIn.alternativeMethods.getHelp.title"),cardSubtitle:(0,n.G)("signIn.alternativeMethods.getHelp.content"),onBackLinkClick:t})}},2690:function(e,t,r){r.d(t,{j:()=>a});var i=r(5074),o=r(5763);let n=e=>{if(!e)return"";let t=e.strategy;return"phoneNumberId"in e&&(t+=e.phoneNumberId),t};function a(e){let t=i.useRef(""),[r,a]=i.useState(()=>(0,o.R5)(e)),[l,c]=i.useState(!r),s=t.current===n(r);return{currentFactor:r,factorAlreadyPrepared:s,handleFactorPrepare:()=>{t.current=n(r)},selectFactor:e=>{a(e),c(!1)},showAllStrategies:l,toggleAllStrategies:()=>c(e=>!e)}}},5763:function(e,t,r){r.d(t,{Cm:()=>u,Kw:()=>p,R5:()=>h,UY:()=>v,iy:()=>m,oj:()=>k,xf:()=>s}),r(1044);var i=r(2620),o=r(7651),n=r(1959),a=r(8289);let l=e=>t=>"safeIdentifier"in t&&t.safeIdentifier===e;function c(e){if((0,i.Bz)()){let t=e.find(({strategy:e})=>"passkey"===e);if(t)return t}return null}function s(e,t,r){return e&&0!==e.length?r===n._o.Password?function(e,t){let r=c(e);if(r)return r;let i=e.sort(a.Kn)[0];return"password"===i.strategy?i:e.find(l(t))||i||null}(e,t):function(e,t){let r=c(e);if(r)return r;let i=e.sort(a.Ih),o=i.find(l(t));if(o)return o;let n=i[0];return"email_link"===n.strategy?n:e.find(l(t))||n||null}(e,t):null}let d=["passkey","email_code","password","phone_code","email_link"];function u(e){return!!e&&d.includes(e.strategy)}function h(e){if(!e||0===e.length)return null;let t=e.find(e=>"totp"===e.strategy);if(t)return t;let r=e.find(e=>"phone_code"===e.strategy);return r||e[0]}let f=["reset_password_phone_code","reset_password_email_code"],p=e=>!!e&&f.includes(e);function v(e){let t;return"tel"===e.type?"phoneNumber":(t=e.value,/^\S+@\S+\.\S+$/.test(t))?"emailAddress":"username"}let k=(e,t,r)=>{if(!t)return null;let i=e.find(e=>"strategy"===e.id)?.value;if(i&&"phone_code"!==i)return null;let n=e.find(e=>e.id===r)?.value;if(!n||!n?.startsWith("+"))return null;let a=(0,o.TV)(n,t);return"sms"===a?null:a},m=(e,t,r)=>{if(!e||!t||"phoneNumber"!==t||!r||!r?.startsWith("+"))return null;let i=(0,o.TV)(r,e);return"sms"===i?null:i}},9066:function(e,t,r){r.r(t),r.d(t,{UserVerification:()=>eh,UserVerificationModal:()=>ef});var i=r(4518),o=r(5074),n=r(5577),a=r(9078),l=r(4607),c=r(7831),s=r(2265),d=r(3269),u=r(5170),h=r(6980),f=r(7697),p=r(2861),v=r(4964),k=r(5763),m=r(8738),Y=r(29),y=r(6088),b=r(6153),g=r(9835),C=r(8272),w=r(8920),F=r(4421),M=r(1051),A=r(743),_=r(6889),S=r(9830),B=r(2620),G=r(8289);function D({filterOutFactor:e,supportedFirstFactors:t}){let r=t?t.filter(e=>!(0,k.Kw)(e.strategy)):[],i=r&&r.length>0,n=(0,o.useMemo)(()=>t?t.filter(e=>!e.strategy.startsWith("oauth_")).filter(e=>(0,k.Cm)(e)).filter(t=>!t||!e||("email_code"===t.strategy&&"email_code"===e.strategy?t.emailAddressId!==e.emailAddressId:"phone_code"===t.strategy&&"phone_code"===e.strategy?t.phoneNumberId!==e.phoneNumberId:t.strategy!==e.strategy)).filter(e=>"passkey"!==e.strategy||(0,B.Bz)()).sort(G.aR):[],[t,e]);return{hasAnyStrategy:i,hasFirstParty:n&&n.length>0,firstPartyFactors:n}}var L=r(5543),I=r(7896);let z=()=>{let{session:e}=(0,L.wV)(),t=(()=>{let{level:e}=(0,a.k)();return(0,o.useMemo)(()=>({level:e||"second_factor"}),[e])})();return{...(0,I.s)(e?e.startVerification:void 0,t,{throttleTime:300})}};function T(e){let t=t=>{let{isLoading:r,data:o}=z();return r||!o?(0,i.Y)(h.B,{}):(0,i.Y)(e,{...t})},r=e.displayName||e.name||"Component";return e.displayName=r,t.displayName=r,t}let Z=e=>{let{onBackLinkClick:t}=e;return(0,i.Y)(u.J,{cardTitle:(0,p.G)("reverification.alternativeMethods.getHelp.title"),cardSubtitle:(0,p.G)("reverification.alternativeMethods.getHelp.content"),onBackLinkClick:t})},P=e=>((e,t)=>{let[r,n]=o.useState(!1),a=o.useCallback(()=>n(e=>!e),[n]);return r?(0,i.Y)(Z,{onBackLinkClick:a}):(0,i.Y)(e,{...t,onHavingTroubleClick:a})})(V,{...e}),V=e=>{let{onBackLinkClick:t,onHavingTroubleClick:r,onFactorSelected:o}=e,n=(0,d.f0)(),{data:a}=z(),{firstPartyFactors:c,hasAnyStrategy:s}=D({filterOutFactor:e?.currentFactor,supportedFirstFactors:a?.supportedFirstFactors});return(0,i.Y)(l.n.Part,{part:"alternativeMethods",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.alternativeMethods.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.alternativeMethods.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:n.error}),(0,i.Y)(C.so,{direction:"col",elementDescriptor:w.$z.main,gap:6,children:(0,i.FD)(C.fv,{gap:4,children:[s&&(0,i.Y)(C.so,{elementDescriptor:w.$z.alternativeMethods,direction:"col",gap:2,children:c.map((e,t)=>{var r;return(0,i.Y)(m.X,{leftIcon:(r=e,({email_code:F.A,phone_code:M.A,password:A.A,passkey:_.A,enterprise_sso:S.A})[r.strategy]),textLocalizationKey:function(e){switch(e.strategy){case"email_code":return(0,p.G)("reverification.alternativeMethods.blockButton__emailCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"phone_code":return(0,p.G)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"password":return(0,p.G)("reverification.alternativeMethods.blockButton__password");case"passkey":return(0,p.G)("reverification.alternativeMethods.blockButton__passkey");default:throw Error(`Invalid sign in strategy: "${e.strategy}"`)}}(e),elementDescriptor:w.$z.alternativeMethodsBlockButton,textElementDescriptor:w.$z.alternativeMethodsBlockButtonText,arrowElementDescriptor:w.$z.alternativeMethodsBlockButtonArrow,textVariant:"buttonLarge",isDisabled:n.isLoading,onClick:()=>{n.setError(void 0),o(e)}},t)})}),t&&(0,i.Y)(Y.E,{boxElementDescriptor:w.$z.backRow,linkElementDescriptor:w.$z.backLink,onClick:t})]})})]}),(0,i.Y)(y.Z.Footer,{children:(0,i.FD)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.Y)(y.Z.ActionText,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionText")}),(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})};var R=r(2454),E=r(4468),K=r(8640),x=r(9090),$=r(2950),N=r(9426);let U=()=>{let{afterVerification:e}=(0,a.k)(),t=(0,N.p)(),{setActive:r}=(0,L.ho)(),{setCache:i}=z(),{navigate:n}=(0,v.r)();return{handleVerificationResponse:(0,o.useCallback)(async o=>{switch(i({data:o,isLoading:!1,isValidating:!1,error:null,cachedAt:Date.now()}),o.status){case"complete":return await r({session:o.session.id}),e?.();case"needs_second_factor":return n("./factor-two");default:return console.error((0,$.s)(o.status,t))}},[n,r,t])}};function H(e){let{onShowAlternativeMethodsClick:t}=e,{session:r}=(0,L.wV)(),{handleVerificationResponse:n}=U(),a=(0,d.f0)(),[c,s]=o.useState(!1),u=o.useCallback(()=>s(e=>!e),[s]),h=(0,K.tJ)("password","",{type:"password",label:(0,p.G)("formFieldLabel__password"),placeholder:(0,p.G)("formFieldInputPlaceholder__password")}),f=async e=>(e.preventDefault(),r?.attemptFirstFactorVerification({strategy:"password",password:h.value}).then(n).catch(e=>(0,E.H4)(e,[h],a.setError)));return c?(0,i.Y)(x.n,{onBackLinkClick:u}):(0,i.Y)(l.n.Part,{part:"password",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.password.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.password.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.FD)(C.fv,{elementDescriptor:w.$z.main,gap:4,children:[(0,i.FD)(R.l.Root,{onSubmit:f,gap:8,children:[(0,i.Y)(R.l.ControlRow,{elementId:h.id,children:(0,i.Y)(R.l.PasswordInput,{...h.props,autoFocus:!0})}),(0,i.Y)(R.l.SubmitButton,{hasArrow:!0})]}),(0,i.Y)(y.Z.Action,{elementId:t?"alternativeMethods":"havingTrouble",children:(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)(t?"reverification.password.actionLink":"reverification.alternativeMethods.actionLink"),onClick:t||u})})]})]}),(0,i.Y)(y.Z.Footer,{})]})})}function j(e,t){return"primary"in e&&e.primary&&!("primary"in t&&t.primary)?-1:"primary"in t&&t.primary&&!("primary"in e&&e.primary)?1:0}var J=r(7912);let W=e=>{let{session:t}=(0,L.wV)(),r=(0,d.f0)(),{handleVerificationResponse:n}=U();o.useEffect(()=>{e.factorAlreadyPrepared||a()},[]);let a=()=>{t.prepareFirstFactorVerification(e.factor).then(()=>e.onFactorPrepare()).catch(e=>(0,E.H4)(e,[],r.setError))};return(0,i.Y)(J.j,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,inputLabel:e.inputLabel,resendButton:e.resendButton,onCodeEntryFinishedAction:(r,i,o)=>{t.attemptFirstFactorVerification({strategy:e.factor.strategy,code:r}).then(async e=>(await i(),n(e))).catch(o)},onResendCodeClicked:a,safeIdentifier:e.factor.safeIdentifier,profileImageUrl:t?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods,onBackLinkClicked:e.onBackLinkClicked})},q=e=>(0,i.Y)(l.n.Part,{part:"emailCode",children:(0,i.Y)(W,{...e,cardTitle:(0,p.G)("reverification.emailCode.title"),cardSubtitle:(0,p.G)("reverification.emailCode.subtitle"),inputLabel:(0,p.G)("reverification.emailCode.formTitle"),resendButton:(0,p.G)("reverification.emailCode.resendButton")})}),O=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,L.wV)(),{__internal_isWebAuthnSupported:o}=(0,L.ho)(),{handleVerificationResponse:n}=U(),a=(0,d.f0)();return(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.passkey.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.passkey.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.Y)(C.fv,{elementDescriptor:w.$z.main,gap:8,children:(0,i.Y)(R.l.Root,{children:(0,i.FD)(C.fv,{gap:3,children:[(0,i.Y)(C.$n,{type:"button",onClick:e=>{e.preventDefault(),r?.verifyWithPasskey().then(e=>n(e)).catch(e=>(0,E.H4)(e,[],a.setError))},localizationKey:(0,p.G)("reverification.passkey.blockButton__passkey"),hasArrow:!0}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("footerActionLink__useAnotherMethod"),onClick:t})})]})})})]}),(0,i.Y)(y.Z.Footer,{})]})},X=e=>(0,i.Y)(l.n.Part,{part:"phoneCode",children:(0,i.Y)(W,{...e,cardTitle:(0,p.G)("reverification.phoneCode.title"),cardSubtitle:(0,p.G)("reverification.phoneCode.subtitle"),inputLabel:(0,p.G)("reverification.phoneCode.formTitle"),resendButton:(0,p.G)("reverification.phoneCode.resendButton"),showAlternativeMethods:e.showAlternativeMethods})}),Q=e=>{if(!e)return"";let t=e.strategy;return"emailAddressId"in e&&(t+=e.emailAddressId),"phoneNumberId"in e&&(t+=e.phoneNumberId),t},ee=["password","email_code","phone_code","passkey"],et=T((0,d.dm)(function(){let{data:e}=z(),t=(0,d.f0)(),{navigate:r}=(0,v.r)(),n=o.useRef(""),a=(0,o.useMemo)(()=>e.supportedFirstFactors?.filter(e=>ee.includes(e.strategy))?.sort(j)||null,[e.supportedFirstFactors]),{preferredSignInStrategy:l}=(0,f.O)().displayConfig,[{currentFactor:c},s]=o.useState(()=>({currentFactor:(0,k.xf)(a,null,l),prevCurrentFactor:void 0})),{hasAnyStrategy:m,hasFirstParty:Y}=D({filterOutFactor:c,supportedFirstFactors:a}),[y,b]=o.useState(()=>!c||!(0,k.Cm)(c)),g=m?()=>{t.setError(void 0),b(e=>!e)}:void 0,C=()=>{n.current=Q(c)};if((0,o.useEffect)(()=>{"needs_second_factor"===e.status&&r("factor-two")},[]),!c)return(0,i.Y)(u.J,{cardTitle:(0,p.G)("reverification.noAvailableMethods.title"),cardSubtitle:(0,p.G)("reverification.noAvailableMethods.subtitle"),message:(0,p.G)("reverification.noAvailableMethods.message"),shouldNavigateBack:!1});if(y){let e=(0,k.Cm)(c);return(0,i.Y)(P,{onBackLinkClick:e?()=>{t.setError(void 0),g?.()}:void 0,onFactorSelected:e=>{s(t=>({currentFactor:e,prevCurrentFactor:t.currentFactor})),g?.()},currentFactor:c})}switch(c?.strategy){case"password":return(0,i.Y)(H,{onShowAlternativeMethodsClick:g});case"email_code":return(0,i.Y)(q,{factorAlreadyPrepared:n.current===Q(c),onFactorPrepare:C,onShowAlternativeMethodsClicked:g,factor:c,showAlternativeMethods:Y});case"phone_code":return(0,i.Y)(X,{factorAlreadyPrepared:n.current===Q(c),onFactorPrepare:C,onShowAlternativeMethodsClicked:g,factor:c,showAlternativeMethods:Y});case"passkey":return(0,i.Y)(O,{onShowAlternativeMethodsClicked:g});default:return(0,i.Y)(h.B,{})}}));var er=r(2690);let ei=e=>{let t=(0,d.f0)(),{session:r}=(0,L.wV)(),{handleVerificationResponse:n}=U();o.useEffect(()=>{e.factorAlreadyPrepared||a?.()},[]);let a=e.prepare?()=>e.prepare?.().then(()=>e.onFactorPrepare()).catch(e=>(0,E.H4)(e,[],t.setError)):void 0;return(0,i.Y)(J.j,{cardTitle:e.cardTitle,cardSubtitle:e.cardSubtitle,resendButton:e.resendButton,inputLabel:e.inputLabel,onCodeEntryFinishedAction:(t,i,o)=>{r.attemptSecondFactorVerification({strategy:e.factor.strategy,code:t}).then(async e=>(await i(),n(e))).catch(o)},onResendCodeClicked:a,safeIdentifier:"safeIdentifier"in e.factor?e.factor.safeIdentifier:void 0,profileImageUrl:r?.user?.imageUrl,onShowAlternativeMethodsClicked:e.onShowAlternativeMethodsClicked,showAlternativeMethods:e.showAlternativeMethods})};function eo(e){return(0,i.Y)(l.n.Part,{part:"totp2Fa",children:(0,i.Y)(ei,{...e,cardTitle:(0,p.G)("reverification.totpMfa.title"),cardSubtitle:(0,p.G)("reverification.totpMfa.subtitle"),inputLabel:(0,p.G)("reverification.totpMfa.formTitle"),showAlternativeMethods:e.showAlternativeMethods})})}let en=e=>{let[t,r]=o.useState(!1),n=o.useCallback(()=>r(e=>!e),[r]);return t?(0,i.Y)(Z,{onBackLinkClick:n}):(0,i.Y)(ea,{supportedSecondFactors:e.supportedSecondFactors,onBackLinkClick:e.onBackLinkClick,onFactorSelected:e.onFactorSelected,onHavingTroubleClick:n})},ea=e=>{let{supportedSecondFactors:t,onHavingTroubleClick:r,onFactorSelected:o,onBackLinkClick:n}=e,a=(0,d.f0)();return(0,i.Y)(l.n.Part,{part:"alternativeMethods",children:(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.alternativeMethods.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.alternativeMethods.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:a.error}),(0,i.FD)(C.fv,{elementDescriptor:w.$z.main,gap:3,children:[(0,i.Y)(C.fv,{gap:2,children:t?.sort(G.Wy).map((e,t)=>(0,i.Y)(m.X,{textLocalizationKey:function(e){switch(e.strategy){case"phone_code":return(0,p.G)("reverification.alternativeMethods.blockButton__phoneCode",{identifier:(0,g.u)(e.safeIdentifier)||""});case"totp":return(0,p.G)("reverification.alternativeMethods.blockButton__totp");case"backup_code":return(0,p.G)("reverification.alternativeMethods.blockButton__backupCode");default:throw Error(`Invalid verification strategy: "${e.strategy}"`)}}(e),elementDescriptor:w.$z.alternativeMethodsBlockButton,textElementDescriptor:w.$z.alternativeMethodsBlockButtonText,arrowElementDescriptor:w.$z.alternativeMethodsBlockButtonArrow,isDisabled:a.isLoading,onClick:()=>o(e)},t))}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:n&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("backButton"),onClick:e.onBackLinkClick})})]})]}),(0,i.Y)(y.Z.Footer,{children:(0,i.FD)(y.Z.Action,{elementId:"havingTrouble",children:[(0,i.Y)(y.Z.ActionText,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionText")}),(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("reverification.alternativeMethods.actionLink"),onClick:r})]})})]})})},el=e=>{let{onShowAlternativeMethodsClicked:t}=e,{session:r}=(0,L.wV)(),{handleVerificationResponse:o}=U(),n=(0,d.f0)(),a=(0,K.tJ)("code","",{type:"text",label:(0,p.G)("formFieldLabel__backupCode"),isRequired:!0});return(0,i.FD)(y.Z.Root,{children:[(0,i.FD)(y.Z.Content,{children:[(0,i.FD)(b.Y.Root,{showLogo:!0,children:[(0,i.Y)(b.Y.Title,{localizationKey:(0,p.G)("reverification.backupCodeMfa.title")}),(0,i.Y)(b.Y.Subtitle,{localizationKey:(0,p.G)("reverification.backupCodeMfa.subtitle")})]}),(0,i.Y)(y.Z.Alert,{children:n.error}),(0,i.Y)(C.fv,{elementDescriptor:w.$z.main,gap:8,children:(0,i.FD)(R.l.Root,{onSubmit:e=>(e.preventDefault(),r.attemptSecondFactorVerification({strategy:"backup_code",code:a.value}).then(o).catch(e=>(0,E.H4)(e,[a],n.setError))),children:[(0,i.Y)(R.l.ControlRow,{elementId:a.id,children:(0,i.Y)(R.l.PlainInput,{...a.props,autoFocus:!0,onActionClicked:t})}),(0,i.FD)(C.fv,{gap:3,children:[(0,i.Y)(R.l.SubmitButton,{hasArrow:!0}),(0,i.Y)(y.Z.Action,{elementId:"alternativeMethods",children:t&&(0,i.Y)(y.Z.ActionLink,{localizationKey:(0,p.G)("footerActionLink__useAnotherMethod"),onClick:t})})]})]})})]}),(0,i.Y)(y.Z.Footer,{})]})},ec=e=>{let{session:t}=(0,L.wV)();return(0,i.Y)(l.n.Part,{part:"phoneCode2Fa",children:(0,i.Y)(ei,{...e,cardTitle:(0,p.G)("reverification.phoneCodeMfa.title"),cardSubtitle:(0,p.G)("reverification.phoneCodeMfa.subtitle"),inputLabel:(0,p.G)("reverification.phoneCodeMfa.formTitle"),resendButton:(0,p.G)("reverification.phoneCodeMfa.resendButton"),prepare:()=>{let{phoneNumberId:r,strategy:i}=e.factor;return t.prepareSecondFactorVerification({phoneNumberId:r,strategy:i})}})})},es=["phone_code","totp","backup_code"],ed=T((0,d.dm)(function(){let{navigate:e}=(0,v.r)(),{data:t}=z(),r=(0,o.useMemo)(()=>t.supportedSecondFactors?.filter(e=>es.includes(e.strategy))?.sort(j)||null,[t.supportedSecondFactors]),{currentFactor:n,factorAlreadyPrepared:a,handleFactorPrepare:l,selectFactor:c,showAllStrategies:s,toggleAllStrategies:d}=(0,er.j)(r),u=(0,o.useMemo)(()=>r?.filter(e=>!e||!n||("phone_code"===e.strategy&&"phone_code"===n.strategy?e.phoneNumberId!==n.phoneNumberId:e.strategy!==n.strategy)),[r,n]),f=(0,o.useMemo)(()=>u&&u.length>0||!1,[u]);if((0,o.useEffect)(()=>{"needs_first_factor"===t.status&&e("../")},[]),!n)return(0,i.Y)(h.B,{});if(s&&f)return(0,i.Y)(en,{supportedSecondFactors:u||null,onBackLinkClick:d,onFactorSelected:c});switch(n?.strategy){case"phone_code":return(0,i.Y)(ec,{factorAlreadyPrepared:a,onFactorPrepare:l,factor:n,onShowAlternativeMethodsClicked:d,showAlternativeMethods:f});case"totp":return(0,i.Y)(eo,{factorAlreadyPrepared:a,onFactorPrepare:l,factor:n,onShowAlternativeMethodsClicked:d,showAlternativeMethods:f});case"backup_code":return(0,i.Y)(el,{onShowAlternativeMethodsClicked:d});default:return(0,i.Y)(h.B,{})}}));function eu(){let{invalidate:e}=z();return(0,o.useEffect)(()=>()=>{e()},[]),(0,i.Y)(l.n.Root,{flow:"userVerification",children:(0,i.FD)(c.d,{children:[(0,i.Y)(s.q,{path:"factor-two",children:(0,i.Y)(ed,{})}),(0,i.Y)(s.q,{index:!0,children:(0,i.Y)(et,{})})]})})}eu.displayName="UserVerification";let eh=(0,n.Z)(eu),ef=e=>(0,i.Y)(s.q,{path:"user-verification",children:(0,i.Y)(a._.Provider,{value:{componentName:"UserVerification",...e,routing:"virtual"},children:(0,i.Y)("div",{children:(0,i.Y)(eh,{...e,routing:"virtual"})})})})},9078:function(e,t,r){r.d(t,{_:()=>o,k:()=>n});var i=r(5074);let o=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(o);if(!e||"UserVerification"!==e.componentName)throw Error("Clerk: useUserVerificationContext called outside of the mounted UserVerification component.");let{componentName:t,...r}=e;return{...r,componentName:t}}}}]);
|