1import{b1 as oe,dl as Q,P as X,s as z,I as se,dm as ae,j as e,b$ as le,dd as ie,de as ce,df as me,dg as de,dn as ue}from"./privy-C70SmBOt.js";import{T as d,g as u,F as N,m as v,$ as he}from"./ModalHeader-D7u2VQIH-DmAvoeoM.js";import{F as D}from"./ShieldCheckIcon-DMfhPdWE.js";import{r as n}from"./vendor-BhTrWUXb.js";import{t as fe,f as xe,l as je,i as pe}from"./EnrollTotp-pUaRLUdv-D5T8FAOa.js";import{F as ye}from"./CheckCircleIcon-om0KJOaH.js";import{F as Y}from"./PhoneIcon-nSgnga2N.js";import{w as we}from"./ConnectPhoneForm-DkcHfk-h-DScUGKKX.js";import{a as ve,d as O,w as x,l as j,p,m as g,s as ge,x as q,c as K,C as Ce,T as Fe}from"./PinInput-3SLvbnQa-BgkV1MXA.js";import{ErrorScreenView as ke}from"./ErrorScreen-qMDZAqv7-Dt3dcgCb.js";import"./browser-1FmHklo7.js";import"./FingerPrintIcon-DFN8uE2S.js";import"./Chip-D2-wZOHJ-yDcyDSvq.js";import"./LoadingSkeleton-U6-3yFwI-BXalaFCS.js";import"./LinkPasskeyScreen-CsScqlvK-BpLJ6Y89.js";import"./TodoList-CgrU7uwu-vfc0O1L9.js";import"./createLucideIcon-CXLgQO5a.js";import"./check-SBXy7oYs.js";import"./ScreenLayout-BgwOsyLd-B2abtQKQ.js";import"./Screen-yabWN6I5-CKn-9o50.js";import"./index-Dq_xe9dz-C35b9bEG.js";import"./circle-check-big-C9n71dFt.js";import"./fingerprint-pattern-Diyu56P-.js";import"./CopyToClipboard-DSTf_eKU-6iI8IQsV.js";import"./Layouts-BlFm53ED-B-gBonds.js";import"./LabelXs-oqZNqbm_-Cn1yU-cS.js";import"./Subtitle-CV-2yKE4-D9LZ_aII.js";import"./Title-BnzYV3Is-CdVvWR2u.js";import"./shared-FM0rljBt-DFoasxX8.js";import"./QrCode-CiR-JXcV-B58JuoW7.js";import"./reservoir-CdRaFexZ-DQlPOpJn.js";import"./triangle-alert-1R6KT96_.js";import"./lock-BtreBm0t.js";import"./dijkstra-COg3n3zL.js";function be({title:r,titleId:m,...h},a){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":m},h),r?n.createElement("title",{id:m},r):null,n.createElement("path",{fillRule:"evenodd",d:"M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))}const Ee=n.forwardRef(be);function Se({title:r,titleId:m,...h},a){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":m},h),r?n.createElement("title",{id:m},r):null,n.createElement("path",{fillRule:"evenodd",d:"M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z",clipRule:"evenodd"}))}const Me=n.forwardRef(Se),Re=({appName:r,onComplete:m,onReset:h,onClose:a})=>{let[s,P]=n.useState(""),[T,W]=n.useState(!1),[b,C]=n.useState(null),[E,S]=n.useState("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:A}=Q(),{data:l}=X(),M=z();function F(){l?.mfaEnrollmentFlow?.onSuccess(),m()}return b?e.jsx(ke,{allowlistConfig:M.allowlistConfig,error:b,onBack:()=>C(null),onRetry:()=>C(null)}):e.jsxs(e.Fragment,E==="enroll"?{children:[e.jsx(d,{backFn:h,onClose:a},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(Y,{})}),e.jsx(j,{children:"Set up SMS verification"}),e.jsxs(p,{children:["We'll text a verification code to this mobile device whenever you use your ",r," ","wallet."]}
1),e.jsxs(O,{children:[e.jsx(we,{onSubmit:async function({qualifiedPhoneNumber:y}){try{await f({phoneNumber:y}),P(y),S("verify")}catch(i){C(i)}},hideRecent:!0}),e.jsxs(Ce,{children:["By providing your mobile number, you agree to receive text messages from ",M?.name,". Some carrier charges may apply"]})]}),e.jsx(u,{})]}:T?{children:[e.jsx(d,{onClose:F},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(ye,{})}),e.jsx(j,{children:"SMS verification added"}),e.jsxs(p,{children:["From now on, you'll enter the verification code sent to your mobile device whenever you use your ",r," wallet."]}),e.jsx(g,{children:e.jsx(v,{onClick:F,children:"Done"})}),e.jsx(u,{})]}:{children:[e.jsx(d,{backFn:function(){E==="verify"?S("enroll"):h()},onClose:a},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(Y,{})}),e.jsx(j,{children:"Enter enrollment code"}),e.jsxs(O,{children:[e.jsx(Fe,{onChange:async function(y){try{if(!y)return;await A({phoneNumber:s,mfaCode:y}),W(!0)}catch(i){throw ie(i)?Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):ce(i)?Error("The code you entered is not valid"):me(i)?Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):de(i)?Error("Verification canceled"):Error("Unknown error")}}}),e.jsxs(p,{children:["To continue, enter the 6-digit code sent to ",e.jsx("strong",{children:ue(s)})]})]}),e.jsx(u,{})]})},dn={component:()=>{let{user:r,enrollInMfa:m,ready:h}=oe(),[a,s]=n.useState(null),{unenrollWithSms:P,unenrollWithTotp:T,unenrollWithPasskey:W,submitEnrollmentWithTotp:b,initEnrollmentWithPasskey:C,submitEnrollmentWithPasskey:E,initEnrollmentWithTotp:S}=Q(),{data:f,onUserCloseViaDialogOrKeybindRef:A}=X(),l=z(),{closePrivyModal:M}=se(),{promptMfa:F}=ae(),[y,i]=n.useState(!1),[R,$]=n.useState(null),[Z,I]=n.useState(null),o=()=>{M({shouldCallAuthOnSuccess:!0}),m(!1),setTimeout((()=>{s(null),$(null)}),500)},[G,U]=n.useState(!1),[J,k]=n.useState();A.current=o;let _=r?.mfaMethods.includes("sms"),ee=!!r?.phone,ne=r?.mfaMethods.includes("totp"),te=r?.mfaMethods.includes("passkey"),B=_||ne||te,H=r?.linkedAccounts.filter((t=>t.type==="passkey")).map((t=>t.credentialId))??[];function w(){s(null),$(null)}async function L(t=H){U(!0);try{return await C(),await E({credentialIds:t},{removeForLogin:f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa}),f?.mfaEnrollmentFlow?.onSuccess(),o()}catch(c){k(c)}finally{U(!1)}}if(n.useEffect((()=>{B&&i(!0)}),[B]),!h||!r||!l)return e.jsxs(e.Fragment,{children:[e.jsx(d,{onClose:o},"header"),e.jsx(ve,{children:e.jsx(fe,{})}),e.jsx(O,{children:e.jsx(le,{})}),e.jsx(u,{})]});if(a==="sms")return e.jsxs(e.Fragment,{children:[e.jsx(d,{backFn:w,onClose:o},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(N,{})}),e.jsx(j,{children:"Remove SMS verification?"}),e.jsxs(p,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(g,{children:e.jsx(v,{$warn:!0,onClick:async function(){s(null);try{await P()}catch{s(null)}},children:"Remove"})}),e.jsx(u,{})]});if(a==="totp")return e.jsxs(e.Fragment,{children:[e.jsx(d,{backFn:w,onClose:o},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(N,{})}),e.jsx(j,{children:"Remove authenticator app verification?"}),e.jsxs(p,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),e.jsx(g,{children:e.jsx(v,{$warn:!0,onClick:async function(){s(null);try{await T()}catch{s(null)}},children:"Remove"})}),e.jsx(u,{})]});if(a==="passkey"){let t=f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa??!0;return e.jsxs(e.Fragment,{children:[e.jsx(d,{backFn:w,onClose:o},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(N,{})}),e.jsx(j,{children:"Are you sure you want to remove this passkey?"}),e.jsx(p,{children:t?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),e.jsx(g,{children:e.jsx(v,{$warn:!0,onClick:async function(){s(null);try{await W({removeForLogin:f?.mfaEnrollmentFlow?.shouldUnlinkOnUnenrollMfa})}catch{s(null)}},children:"Remove"})}),e.jsx(u,{})]})}if(f.mfaEnrollmentFlow.mfaMethods.length===0&&!B)return e.jsxs(e.Fragment,{children:[e.jsx(d,{onClose:o},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(D,{})}),e.jsx(j,{children:"Add more security"}),e.jsxs(p,{children:[l?.name," does not have any verification methods enabled."]}),e.jsx(g,{children:e.jsx(v,{onClick:o,children:"Close"})}),e.jsx(u,{})]});let V=!B&&!y;return V?e.jsxs(e.Fragment,{children:[e.jsx(d,{onClose:o},"header"),e.jsx(x,{style:{marginBottom:"1.5rem"},children:e.jsx(D,{})}),e.jsx(j,{children:"Transaction Protection"}),e.jsx(p,{children:"Set up transaction protection to add an extra layer of security to your account"}),e.jsxs(ge,{children:[e.jsxs(q,{children:[e.jsx(K,{children:e.jsx(Ee,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}
1),e.jsxs(q,{children:[e.jsx(K,{children:e.jsx(Me,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),e.jsxs(g,{children:[e.jsx(v,{onClick:()=>i(!0),children:"Continue"}),e.jsx(he,{onClick:o,children:"Not now"})]}),e.jsx(u,{})]}):R==="sms"?e.jsx(Re,{appName:l?.name||"Privy",onComplete:o,onReset:w,onClose:o}):R==="totp"&&Z?e.jsx(xe,{onClose:o,onReset:w,submitEnrollmentWithTotp:({mfaCode:t})=>(async function(c){try{return k(void 0),await b({mfaCode:c}),f?.mfaEnrollmentFlow?.onSuccess(),o()}catch(re){k(re)}finally{s(null)}})(t),totpInfo:{...Z,appName:l?.name||"Privy"}}):R==="passkey"?e.jsx(je,{onReset:w,onClose:o,submitEnrollmentWithPasskey:L}):e.jsx(pe,{showIntro:V,userMfaMethods:r.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:ee,backFn:function(){i(!1)},handleSelectMethod:async function(t){try{await F()}catch(c){return void k(c)}return t==="totp"?($(t),I(null),void S().then((c=>{I(c)})).catch((()=>{I(null),w()}))):t==="passkey"&&H.length===1?await L():void $(t)},isTotpLoading:R==="totp"&&!Z,isPasskeyLoading:G,error:J,onClose:o,setRemovingMfaMethod:async t=>{try{await F()}catch(c){return void k(c)}s(t)}})}};export{dn as MfaEnrollmentFlowScreen,dn as default}; 2//# sourceMappingURL=MfaEnrollmentFlowScreen-DY40IplD-CWWsYzTk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.