@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 22.6 kB
JavaScript
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import{styled as o}from"styled-components";import i from"@heroicons/react/24/outline/ChevronRightIcon";import n from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import s from"@heroicons/react/24/outline/FingerPrintIcon";import a from"@heroicons/react/24/outline/MinusCircleIcon";import l from"@heroicons/react/24/outline/PhoneIcon";import C from"@heroicons/react/24/outline/ShieldCheckIcon";import{U as c,L as d}from"./useActiveWallet-Bsy5GTCV.mjs";import{M as h,a as m}from"./ModalHeader-BLGC-7ev.mjs";import{C as p}from"./Chip-Bsgj4Yc-.mjs";import{I as f,T as y,S as u,E as g,M as k,d as w,e as v,f as b,g as M,R as x,a as I,A as S,F as Z,L as j,b as L,c as E,C as P,N as T}from"./PinInput-C3_MNxMt.mjs";import R from"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import A from"@heroicons/react/24/outline/ClockIcon";import{useState as W,useMemo as N}from"react";import{P as B}from"./Button-B8mqatRx.mjs";import{u as F}from"./context-Bycd1SKV.mjs";import{u as z}from"./internal-context-e-Eni5bG.mjs";import{u as U}from"./get-is-unified-wallet-DvKS5IUO.mjs";import{ErrorScreenView as $}from"./ErrorScreen-BdxNEgU1.mjs";import{DoubleIconWrapper as D}from"./LinkPasskeyScreen-yKY5ebtx.mjs";import{C as O}from"./CopyToClipboard-DatKc59_.mjs";import{C as V}from"./Layouts-Bmf8DxNP.mjs";import{C as Y}from"./Column-DQ5Vw9t1.mjs";import{L as _}from"./LabelXs-BOisBtqT.mjs";import{S as H}from"./Subtitle-DkvfP2Ev.mjs";import{T as Q}from"./Title-D0pfZff-.mjs";import{B as q}from"./shared-CtYf3O54.mjs";import{f as K,g as X,h as G,i as J}from"./index-CCyaupaz.mjs";import ee from"@heroicons/react/24/solid/ShieldCheckIcon";import{Q as te}from"./QrCode-DR5LogOp.mjs";const re=r=>/*#__PURE__*/e(oe,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...r,children:[/*#__PURE__*/t("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),/*#__PURE__*/t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]});let oe=/*#__PURE__*/o.svg.withConfig({displayName:"StyledSvg",componentId:"sc-59fa943f-0"})(["height:90px;width:90px;> rect{","}> path{fill:white;}"],(e=>"success"===e.color?"fill: var(--privy-color-success);":"fill: var(--privy-color-accent);"));const ie=({showIntro:o,userMfaMethods:p,appMfaMethods:I,userHasAuthSms:S,isTotpLoading:Z,isPasskeyLoading:j,error:L,onClose:E,backFn:P,handleSelectMethod:T,setRemovingMfaMethod:R})=>{let A=p.reduce(((e,t)=>({...e,[t]:!0})),{}),W=I.reduce(((e,t)=>({...e,[t]:!0})),{});/*#__PURE__*/return e(r,{children:[/*#__PURE__*/t(h,{backFn:o?P:void 0,onClose:E},"header"),/*#__PURE__*/t(f,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(C,{})}),/*#__PURE__*/t(y,{children:"Choose a verification method"}),p.length>0?/*#__PURE__*/t(u,{children:"To add or delete verification methods, verification is required."}):/*#__PURE__*/t(u,{children:"How would you like to verify your identity?"}),L&&/*#__PURE__*/t(g,{style:{marginTop:"1.25rem"},children:L.message}),/*#__PURE__*/e(k,{children:[(W.passkey||A.passkey)&&/*#__PURE__*/e(w,{children:[/*#__PURE__*/t(c,{style:{justifyContent:"center"},onClick:()=>T("passkey"),disabled:A.passkey||j,children:j?/*#__PURE__*/t(d,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(v,{children:[/*#__PURE__*/e(b,{children:[/*#__PURE__*/t(s,{}),"Passkey"]}),A.passkey?/*#__PURE__*/t(ne,{color:"green",children:"Enabled"}):/*#__PURE__*/t(M,{$isAccent:!0,children:/*#__PURE__*/t(i,{})})]})}),A.passkey&&/*#__PURE__*/t(x,{style:{position:"absolute",right:0},onClick:()=>R("passkey"),children:/*#__PURE__*/t(a,{})})]},"passkey"),(W.totp||A.totp)&&/*#__PURE__*/e(w,{children:[/*#__PURE__*/t(c,{style:{justifyContent:"center"},disabled:A.totp||Z,onClick:()=>T("totp"),children:Z?/*#__PURE__*/t(d,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):/*#__PURE__*/e(v,{children:[/*#__PURE__*/e(b,{children:[/*#__PURE__*/t(n,{}),"Authenticator app"]}),A.totp&&/*#__PURE__*/t(ne,{color:"green",children:"Enabled"})]})}),A.totp&&/*#__PURE__*/t(x,{style:{position:"absolute",right:0},onClick:()=>R("totp"),children:/*#__PURE__*/t(a,{})})]},"totp"),(W.sms||A.sms)&&/*#__PURE__*/e(w,{children:[/*#__PURE__*/t(c,{disabled:A.sms||S,onClick:()=>T("sms"),children:/*#__PURE__*/e(v,{children:[/*#__PURE__*/e(b,{children:[/*#__PURE__*/t(l,{}),"SMS"]}),A.sms&&/*#__PURE__*/t(ne,{color:"green",children:"Enabled"}),S&&/*#__PURE__*/t(M,{children:"Disabled"})]})}),A.sms&&/*#__PURE__*/t(x,{style:{position:"absolute",right:0},onClick:()=>R("sms"),children:/*#__PURE__*/t(a,{})})]},"sms")]}),/*#__PURE__*/t(se,{children:"You can always change your selection later"}),/*#__PURE__*/t(m,{})]})};let ne=/*#__PURE__*/o(p).withConfig({displayName:"StyledChip",componentId:"sc-5f06df7f-0"})(["margin-right:1.5rem;"]),se=/*#__PURE__*/o(I).withConfig({displayName:"StyledTerms",componentId:"sc-5f06df7f-1"})(["&&{margin-top:1rem;}text-align:center;"]);const ae=({style:r,...o})=>/*#__PURE__*/e("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...r},xmlns:"http://www.w3.org/2000/svg",...o,children:[/*#__PURE__*/e("g",{clipPath:"url(#clip0_113_33841)",children:[/*#__PURE__*/t("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),/*#__PURE__*/t("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),/*#__PURE__*/t("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),/*#__PURE__*/t("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),/*#__PURE__*/t("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),/*#__PURE__*/t("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),/*#__PURE__*/t("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),/*#__PURE__*/t("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),/*#__PURE__*/t("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),/*#__PURE__*/t("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),/*#__PURE__*/t("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),/*#__PURE__*/t("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),/*#__PURE__*/t("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),/*#__PURE__*/t("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),/*#__PURE__*/t("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),/*#__PURE__*/t("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),/*#__PURE__*/t("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),/*#__PURE__*/t("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),/*#__PURE__*/t("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),/*#__PURE__*/t("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),/*#__PURE__*/t("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),/*#__PURE__*/t("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),/*#__PURE__*/t("defs",{children:/*#__PURE__*/t("clipPath",{id:"clip0_113_33841",children:/*#__PURE__*/t("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]}),le=({onClose:e,onReset:r,submitEnrollmentWithPasskey:o})=>{let{user:i}=U(),{initLinkWithPasskey:n,linkWithPasskey:s}=z(),a=F(),[l,C]=W(!1),[c,d]=W(!1),[h,m]=W(null),p=N((()=>i?.linkedAccounts.filter((e=>"passkey"===e.type))??[]),[i]),f=async e=>{C(!0);try{await o(e)}catch(e){m(e)}finally{C(!1)}},y=async()=>{d(!0),m(null);try{await n();let e=await s(),t=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];await f(t)}catch(e){m(e)}finally{d(!1)}};return 0===p.length||c?/*#__PURE__*/t(Ce,{onReset:r,onClose:e,onClick:y,isCreating:c}):h?/*#__PURE__*/t($,{allowlistConfig:a.allowlistConfig,error:h,onBack:()=>m(null),onRetry:()=>m(null)}):/*#__PURE__*/t(ce,{passkeys:p,isSubmitting:l,isCreating:c,onReset:r,onClose:e,onSubmitEnrollment:()=>f(p.map((e=>e.credentialId))),onAddPasskey:y})};let Ce=({onReset:o,onClose:i,onClick:n,isCreating:s})=>/*#__PURE__*/e(r,{children:[/*#__PURE__*/t(h,{backFn:o,onClose:i},"header"),/*#__PURE__*/t(S,{children:/*#__PURE__*/e(D,{children:[/*#__PURE__*/t(Z,{}),/*#__PURE__*/t(ae,{})]})}),/*#__PURE__*/t(y,{children:"Set up passkey verification"}),/*#__PURE__*/e(j,{children:[/*#__PURE__*/e(L,{children:[/*#__PURE__*/t(E,{children:/*#__PURE__*/t(C,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),/*#__PURE__*/e(L,{children:[/*#__PURE__*/t(E,{children:/*#__PURE__*/t(A,{})}),"Takes seconds to set up and use"]}),/*#__PURE__*/e(L,{children:[/*#__PURE__*/t(E,{children:/*#__PURE__*/t(R,{})}),"Use your passkey to verify transactions and login to your account"]})]}),/*#__PURE__*/t(B,{style:{marginTop:"2.25rem"},onClick:n,loading:s,children:"Add a new passkey"}),/*#__PURE__*/t(m,{})]}),ce=({onReset:o,onClose:i,onAddPasskey:n,onSubmitEnrollment:s,passkeys:a,isSubmitting:l,isCreating:C})=>{let[c,p]=W(!1),f=c?a.length:a.length>3?2:3;/*#__PURE__*/return e(r,{children:[/*#__PURE__*/t(h,{backFn:c?()=>p(!1):o,onClose:i},"header"),!c&&/*#__PURE__*/t(S,{children:/*#__PURE__*/e(D,{children:[/*#__PURE__*/t(Z,{}),/*#__PURE__*/t(ae,{})]})}),/*#__PURE__*/t(y,{children:"Enable your passkeys for verification"}),/*#__PURE__*/e(j,{children:[a.slice(0,f).map((r=>/*#__PURE__*/e(de,{children:[/*#__PURE__*/t(he,{children:pe(r)}),/*#__PURE__*/e(me,{children:["Last used: ",r.latestVerifiedAt?.toLocaleString()]})]},r.credentialId))),!c&&a.length>3&&/*#__PURE__*/t(fe,{onClick:()=>p(!0),children:"View All"})]}),/*#__PURE__*/t(B,{style:{marginTop:"1.5rem"},onClick:s,loading:l,children:"Enable passkeys"}),a.length<5&&/*#__PURE__*/t(fe,{style:{marginTop:"0.5rem"},onClick:n,disabled:C,children:C?/*#__PURE__*/t(d,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),/*#__PURE__*/t(m,{})]})},de=/*#__PURE__*/o.div.withConfig({displayName:"PasskeyItem",componentId:"sc-23451ce2-0"})(["&&{padding:0.75rem 1rem;text-align:left;border-radius:0.5rem;border:1px solid var(--privy-color-foreground-4);width:100%;}"]),he=/*#__PURE__*/o.div.withConfig({displayName:"PasskeyItemTitle",componentId:"sc-23451ce2-1"})(["font-size:0.875rem;line-height:1.375rem;font-weight:500;color:var(--privy-color-foreground-1);"]),me=/*#__PURE__*/o.div.withConfig({displayName:"PasskeyItemSubtitle",componentId:"sc-23451ce2-2"})(["font-size:0.75rem;font-weight:400;line-height:1.125rem;color:var(--privy-color-foreground-2);"]),pe=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device";const fe=/*#__PURE__*/o.button.withConfig({displayName:"StyledLink",componentId:"sc-23451ce2-3"})(["&&{width:100%;font-size:0.875rem;line-height:1rem;@media (min-width:440px){font-size:14px;}display:flex;gap:12px;justify-content:center;padding:0.75rem 1rem;background-color:var(--privy-color-background);transition:background-color 200ms ease;color:var(--privy-color-accent);:focus{outline:none;box-shadow:none;}}"]),ye=({size:e,authUrl:r})=>/*#__PURE__*/t(te,{url:r,squareLogoElement:ee,size:e,fgColor:"#1F1F1F"}),ue=({onClose:o,onReset:i,totpInfo:s,submitEnrollmentWithTotp:a,error:l})=>{let[C,c]=W("enroll");/*#__PURE__*/return e(r,"enroll"===C?{children:[/*#__PURE__*/t(h,{backFn:i,onClose:o},"header"),/*#__PURE__*/t(Q,{children:"Scan QR code"}),/*#__PURE__*/t(H,{children:"Open your authenticator app and scan this code to continue"}),/*#__PURE__*/t(V,{children:/*#__PURE__*/t(ye,{authUrl:s.authUrl,size:240})}),/*#__PURE__*/t(_,{style:{textAlign:"left"},children:"Setup key"}),/*#__PURE__*/e(q,{style:{marginTop:"0.25rem"},children:[/*#__PURE__*/t(Y,{children:"•".repeat(16)}),/*#__PURE__*/t(O,{itemName:" ",text:s.secret})]}),/*#__PURE__*/t(B,{style:{marginTop:"1rem"},onClick:function(){c("verify")},children:"Continue"}),/*#__PURE__*/t(m,{})]}:{children:[/*#__PURE__*/t(h,{backFn:function(){"verify"===C?c("enroll"):i()},onClose:o},"header"),/*#__PURE__*/t(f,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/t(n,{})}),/*#__PURE__*/t(Q,{children:"Enter enrollment code"}),/*#__PURE__*/t(H,{children:"To continue, enter the 6-digit code generated from your authenticator app"}),/*#__PURE__*/t(P,{children:/*#__PURE__*/t(T,{onChange:async function(e){try{if(!e)return;await a({mfaCode:e})}catch(e){if(K(e))throw Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.");if(X(e))throw Error("The code you entered is not valid");if(G(e))throw Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.");throw J(e)?Error("Verification canceled"):Error("Unknown error")}},errorReasonOverride:l?.message})}),/*#__PURE__*/t(m,{})]})};export{ue as E,re as M,le as a,ie as b};