@getpara/react-sdk 1.3.1 → 1.4.1
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/index.js +131 -131
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -4
- package/dist/modal/components/Body/Body.d.ts +1 -3
- package/dist/modal/hooks/useCreateAccount.d.ts +4 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +9 -2
- package/dist/modal/utils/openPopup.d.ts +6 -1
- package/package.json +7 -6
- package/dist/modal/stores/para/actions.d.ts +0 -3
- package/dist/modal/stores/para/useParaStore.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{CpslAuthModal as
|
|
2
|
+
import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@getpara/react-components";import{forwardRef as Pu,useEffect as yt,useImperativeHandle as Fu,useState as ku}from"react";import{entityToWallet as Bu,OnRampProvider as Hu,OnRampAsset as de,Network as xt,EnabledFlow as Fe}from"@getpara/web-sdk";import{create as Gi}from"zustand";import{persist as Vi,createJSONStorage as $i}from"zustand/middleware";var Be=(R=>(R.AUTH_MAIN="AUTH_MAIN",R.AUTH_MORE="AUTH_MORE",R.EX_WALLET_MORE="EX_WALLET_MORE",R.EX_WALLET_SELECTED="EX_WALLET_SELECTED",R.VERIFICATIONS="VERIFICATIONS",R.AWAITING_OAUTH="AWAITING_OAUTH",R.FARCASTER_OAUTH="FARCASTER_OAUTH",R.BIOMETRIC_CREATION="BIOMETRIC_CREATION",R.AWAITING_BIOMETRIC_CREATION="AWAITING_BIOMETRIC_CREATION",R.PASSWORD_CREATION="PASSWORD_CREATION",R.AWAITING_PASSWORD_CREATION="AWAITING_PASSWORD_CREATION",R.AWAITING_WALLET_CREATION="AWAITING_WALLET_CREATION",R.TELEGRAM_OAUTH="TELEGRAM_OAUTH",R.WALLET_CREATION_DONE="WALLET_CREATION_DONE",R.SECRET="SECRET",R.BIOMETRIC_LOGIN="BIOMETRIC_LOGIN",R.AWAITING_BIOMETRIC_LOGIN="AWAITING_BIOMETRIC_LOGIN",R.AWAITING_PASSWORD_LOGIN="AWAITING_PASSWORD_LOGIN",R.LOGIN_DONE="LOGIN_DONE",R.SETUP_2FA="SETUP_2FA",R.VERIFY_2FA="VERIFY_2FA",R.TWO_FACTOR_DONE="TWO_FACTOR_DONE",R.ADD_FUNDS_BUY="ADD_FUNDS_BUY",R.ADD_FUNDS_RECEIVE="ADD_FUNDS_RECEIVE",R.ADD_FUNDS_WITHDRAW="ADD_FUNDS_WITHDRAW",R.ADD_FUNDS_AWAITING="ADD_FUNDS_AWAITING",R.ADD_FUNDS_SUCCESS="ADD_FUNDS_SUCCESS",R.ADD_FUNDS_FAILURE="ADD_FUNDS_FAILURE",R.ACCOUNT_MAIN="ACCOUNT_MAIN",R.CHAIN_SWITCH="CHAIN_SWITCH",R))(Be||{});var zn=["EX_WALLET_MORE","EX_WALLET_SELECTED","VERIFICATIONS","AWAITING_OAUTH","FARCASTER_OAUTH","TELEGRAM_OAUTH","BIOMETRIC_CREATION","AWAITING_BIOMETRIC_CREATION","PASSWORD_CREATION","AWAITING_PASSWORD_CREATION","BIOMETRIC_LOGIN","AWAITING_BIOMETRIC_LOGIN","AWAITING_PASSWORD_LOGIN","AWAITING_WALLET_CREATION","AWAITING_WALLET_CREATION","WALLET_CREATION_DONE","SETUP_2FA","VERIFY_2FA","TWO_FACTOR_DONE","LOGIN_DONE"],Qn=["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_SUCCESS","ADD_FUNDS_FAILURE","CHAIN_SWITCH"],Ho={ACCOUNT_MAIN:void 0,ADD_FUNDS_BUY:"ACCOUNT_MAIN",ADD_FUNDS_WITHDRAW:"ACCOUNT_MAIN",ADD_FUNDS_RECEIVE:"ACCOUNT_MAIN",ADD_FUNDS_AWAITING:"ADD_FUNDS_BUY",ADD_FUNDS_SUCCESS:"ACCOUNT_MAIN",ADD_FUNDS_FAILURE:"ACCOUNT_MAIN",CHAIN_SWITCH:"ACCOUNT_MAIN"};var Go={AUTH_MAIN:void 0,AUTH_MORE:"AUTH_MAIN",EX_WALLET_MORE:"AUTH_MAIN",EX_WALLET_SELECTED:"AUTH_MAIN",VERIFICATIONS:"AUTH_MAIN",AWAITING_OAUTH:"AUTH_MAIN",TELEGRAM_OAUTH:"AUTH_MAIN",FARCASTER_OAUTH:"AUTH_MAIN",BIOMETRIC_CREATION:"AUTH_MAIN",AWAITING_BIOMETRIC_CREATION:"BIOMETRIC_CREATION",PASSWORD_CREATION:"BIOMETRIC_CREATION",AWAITING_PASSWORD_CREATION:"BIOMETRIC_CREATION",AWAITING_WALLET_CREATION:void 0,WALLET_CREATION_DONE:void 0,SECRET:void 0,SETUP_2FA:"SECRET",VERIFY_2FA:"SETUP_2FA",TWO_FACTOR_DONE:void 0,ADD_FUNDS_BUY:"WALLET_CREATION_DONE",ADD_FUNDS_RECEIVE:"WALLET_CREATION_DONE",ADD_FUNDS_WITHDRAW:"WALLET_CREATION_DONE",ADD_FUNDS_AWAITING:"ADD_FUNDS_BUY",ADD_FUNDS_SUCCESS:void 0,ADD_FUNDS_FAILURE:void 0};var Vo={AUTH_MAIN:void 0,AUTH_MORE:"AUTH_MAIN",EX_WALLET_MORE:"AUTH_MAIN",EX_WALLET_SELECTED:"AUTH_MAIN",TELEGRAM_OAUTH:"AUTH_MAIN",AWAITING_OAUTH:"AUTH_MAIN",FARCASTER_OAUTH:"AUTH_MAIN",BIOMETRIC_LOGIN:"AUTH_MAIN",AWAITING_BIOMETRIC_LOGIN:"BIOMETRIC_LOGIN",AWAITING_PASSWORD_LOGIN:"BIOMETRIC_LOGIN",AWAITING_WALLET_CREATION:void 0,WALLET_CREATION_DONE:void 0,SECRET:void 0,SETUP_2FA:void 0,VERIFY_2FA:"SETUP_2FA",TWO_FACTOR_DONE:void 0,LOGIN_DONE:void 0,ADD_FUNDS_BUY:"LOGIN_DONE",ADD_FUNDS_RECEIVE:"LOGIN_DONE",ADD_FUNDS_WITHDRAW:"LOGIN_DONE",ADD_FUNDS_AWAITING:"ADD_FUNDS_BUY",ADD_FUNDS_SUCCESS:void 0,ADD_FUNDS_FAILURE:void 0},qn=e=>{switch(e){case"AUTH_MAIN":case"AUTH_MORE":case"EX_WALLET_MORE":case"EX_WALLET_SELECTED":case"VERIFICATIONS":return!0;default:return!1}};function ct(e){switch(e){case"BUY":return"ADD_FUNDS_BUY";case"RECEIVE":return"ADD_FUNDS_RECEIVE";case"WITHDRAW":default:return"ADD_FUNDS_WITHDRAW"}}var _t=["PASSWORD_CREATION"];var Zn=(e,t)=>({resetState:()=>e($o),setOnModalStepChange:o=>e({onModalStepChange:o}),setStep:o=>{let a=t().onModalStepChange,n=t().step;e({step:o}),a?.({previousStep:n,currentStep:o,canGoBack:t().hasPreviousStep()})},decrementStep:()=>{let o=t().onModalStepChange,a=t().flow==="login",n=t().flow==="account",r=t().step,i=t().webAuthURLForCreate,l=t().iFrameUrl,c=t().refs,d=(n?Ho:a?Vo:Go)[r];r==="PASSWORD_CREATION"&&l&&!i&&(d="AUTH_MAIN"),r==="EX_WALLET_SELECTED"&&e({selectedExternalWalletId:void 0,isExternalWalletConnecting:!1,externalWalletError:void 0}),d&&(e({step:d,stepDirection:-1}),o?.({previousStep:r,currentStep:d,canGoBack:t().hasPreviousStep()})),c.popupWindow.current?.close(),c.popupWindow.current=void 0},hasPreviousStep:()=>{let o=t().flow==="login",a=t().flow==="account",n=t().step;return!!(a?Ho[n]:o?Vo[n]:Go[n])},setFlow:o=>e({flow:o}),isLogin:()=>t().flow==="login",isAccount:()=>t().flow==="account",setWebAuthURLForLogin:o=>e({webAuthURLForLogin:o}),setWebAuthURLForCreate:o=>e({webAuthURLForCreate:o}),setPasswordUrlForLogin:o=>e({passwordUrlForLogin:o}),setSupportedAuthMethods:o=>e({supportedAuthMethods:o}),setOnRampPurchase:o=>e(a=>({onRampPurchase:{...a.onRampPurchase||{},...o}})),setOnRampConfig:o=>e({onRampConfig:o}),setIsFullyLoggedIn:o=>e({isFullyLoggedIn:o}),setAccountAddFundTab:o=>e({accountAddFundTab:o}),setSelectedExternalWalletId:o=>e({selectedExternalWalletId:o}),setIsExternalWalletConnecting:o=>e({isExternalWalletConnecting:o}),setExternalWalletError:o=>e({externalWalletError:o}),setIsUsingMobileConnector:o=>e({isUsingMobileConnector:o}),setStepDirection:o=>e({stepDirection:o}),setFarcasterConnectUri:o=>e({farcasterConnectUri:o}),setBiometricLocationHints:o=>e({biometricLocationHints:o}),setIFrameUrl:o=>e({iFrameUrl:o}),setIsIFrameReady:o=>e({isIFrameReady:o})});import{createRef as Ko}from"react";var $o={flow:void 0,stepDirection:1,webAuthURLForLogin:void 0,webAuthURLForCreate:void 0,passwordUrlForLogin:void 0,supportedAuthMethods:new Set,onModalStepChange:void 0,onRampPurchase:void 0,isFullyLoggedIn:!1,accountAddFundTab:void 0,isExternalWalletConnecting:!1,externalWalletError:void 0,activeWallet:[void 0,void 0],farcasterConnectUri:void 0,biometricLocationHints:void 0,iFrameUrl:void 0,isIFrameReady:void 0,refs:{popupWindow:Ko(),poll:Ko(),currentStep:Ko()}},s=Gi()(Vi((e,t)=>({step:"AUTH_MAIN",onRampConfig:void 0,activeWallet:void 0,...$o,...Zn(e,t)}),{version:1,name:"@PARA/modalState",storage:$i(()=>localStorage),partialize:e=>({step:e.step,webAuthURLForLogin:e.webAuthURLForLogin,webAuthURLForCreate:e.webAuthURLForCreate,passwordUrlForLogin:e.passwordUrlForLogin,biometricLocationHints:e.biometricLocationHints,onRampPurchase:e.onRampPurchase,selectedExternalWalletId:e.selectedExternalWalletId,isUsingMobileConnector:e.isUsingMobileConnector,supportedAuthMethods:e.supportedAuthMethods})}));import{create as Yi}from"zustand";import{extractAuthInfo as Ki}from"@getpara/user-management-client";var Jn=(e,t)=>({resetState:()=>{e(Yo)},setAuthInfo:({pfpUrl:o,displayName:a,...n})=>{e({auth:n,pfpUrl:o||null,displayName:a||null})},getAuthInfo:()=>{try{return t().auth?{...Ki(t().auth,{isRequired:!0}),pfpUrl:t().pfpUrl,displayName:t().displayName}:null}catch{return null}},setRecoveryShare:o=>{e({recoveryShare:o})}});var Yo={auth:null,recoveryShare:null,pfpUrl:null,displayName:null},V=Yi((e,t)=>({...Yo,...Jn(e,t)}));import{create as Xi}from"zustand";var jn=(e,t)=>({updateState:o=>{e(o)},getLogo:()=>t().logo??void 0,setAuthLayout:o=>{let a=[],n=[];o.map(r=>{let i=r.split(":")[0];a.includes(i)?console.warn(`${r} is a duplicate ${i} layout type. Please remove the duplicate type from your config.`):(n.push(r),a.push(i))}),e({authLayout:n})}});var er=(n=>(n.AUTH_FULL="AUTH:FULL",n.AUTH_CONDENSED="AUTH:CONDENSED",n.EXTERNAL_FULL="EXTERNAL:FULL",n.EXTERNAL_CONDENSED="EXTERNAL:CONDENSED",n))(er||{});var zi={isDark:!1,logo:void 0,appName:void 0,bareModal:!1,embeddedModal:!1,oAuthLogoVariant:void 0,authLayout:["AUTH:FULL","EXTERNAL:FULL"],hideWallets:!1},W=Xi((e,t)=>({...zi,...jn(e,t)}));import{styled as st}from"styled-components";import{CpslAlert as pu,CpslIcon as du}from"@getpara/react-components";import{CpslCodeInput as rs,CpslSpinner as as,CpslText as is}from"@getpara/react-components";import{useEffect as Xo,useRef as ss,useState as dt}from"react";import{styled as Qo}from"styled-components";import{CpslIcon as Qi,CpslInput as qi,CpslText as Zi,CpslTileButton as Ji}from"@getpara/react-components";import{styled as Ce}from"styled-components";var tr=Ce.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
6
|
-
`,
|
|
6
|
+
`,fe=Ce.div`
|
|
7
7
|
display: flex;
|
|
8
8
|
justify-content: center;
|
|
9
9
|
align-items: center;
|
|
10
10
|
width: 286px;
|
|
11
11
|
height: 286px;
|
|
12
|
-
`,
|
|
12
|
+
`,or=Ce.div`
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
gap: 8px;
|
|
16
|
-
`,
|
|
16
|
+
`,nr=Ce.div`
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
gap: 4px;
|
|
@@ -22,18 +22,18 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
22
22
|
--height: 20px;
|
|
23
23
|
--width: 20px;
|
|
24
24
|
}
|
|
25
|
-
`,
|
|
25
|
+
`,Rt=Ce(qi)`
|
|
26
26
|
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
27
27
|
--container-background-color: var(--cpsl-color-background-0);
|
|
28
28
|
--input-background-color: transparent;
|
|
29
29
|
--input-font-weight: 500;
|
|
30
30
|
--input-color: var(--cpsl-color-text-secondary);
|
|
31
|
-
`,
|
|
31
|
+
`,Vm=Ce(Rt)`
|
|
32
32
|
width: 100%;
|
|
33
|
-
`,
|
|
33
|
+
`,ae=Ce(Zi)`
|
|
34
34
|
width: 100%;
|
|
35
35
|
text-align: center;
|
|
36
|
-
`,
|
|
36
|
+
`,M=Ce.div`
|
|
37
37
|
width: 100%;
|
|
38
38
|
height: 100%;
|
|
39
39
|
align-self: center;
|
|
@@ -41,39 +41,39 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
align-items: center;
|
|
43
43
|
gap: 8px;
|
|
44
|
-
`,
|
|
44
|
+
`,U=Ce(M)`
|
|
45
45
|
gap: ${({$wide:e})=>e?"32px":"24px"};
|
|
46
|
-
`,
|
|
46
|
+
`,Y=Ce(ae)``,He=Ce(Ji)`
|
|
47
47
|
--button-width: 100%;
|
|
48
48
|
--button-height: 87px;
|
|
49
49
|
--button-icon-height: 32px;
|
|
50
50
|
--button-icon-width: 32px;
|
|
51
|
-
`,
|
|
51
|
+
`,Ge=Ce(Qi)`
|
|
52
52
|
--height: 80px;
|
|
53
53
|
--width: 80px;
|
|
54
54
|
--icon-color: var(--cpsl-color-text-primary);
|
|
55
|
-
`;import{AuthMethod as zo}from"@getpara/core-sdk";import{createStore as
|
|
55
|
+
`;import{AuthMethod as zo}from"@getpara/core-sdk";import{createStore as ji,useStore as es}from"zustand";var rr=e=>({client:void 0,setClient:t=>e({client:t})});var ar=e=>({isOpen:!1,setIsOpen:t=>e({isOpen:t})});var ir=e=>({selectedWalletId:void 0,selectedWalletType:void 0,setSelectedWallet:(t,o)=>e({selectedWalletId:t,selectedWalletType:o}),clearSelectedWallet:()=>e({selectedWalletId:void 0,selectedWalletType:void 0})});import{createJSONStorage as ts,persist as os}from"zustand/middleware";var pt=ji()(os((...e)=>({...rr(...e),...ar(...e),...ir(...e)}),{version:1,name:"@PARA/web-state",storage:ts(()=>localStorage),partialize:e=>({selectedWalletId:e.selectedWalletId,selectedWalletType:e.selectedWalletType})})),ns=e=>t=>es(e,t),Q=ns(pt);var N=()=>Q(t=>t.client);import{Fragment as ps,jsx as mt,jsxs as ut}from"react/jsx-runtime";var sr=()=>{let e=W(w=>w.theme),t=V(w=>w.getAuthInfo()),o=s(w=>w.setStep),a=s(w=>w.setWebAuthURLForCreate),n=s(w=>w.setIFrameUrl),r=s(w=>w.setIsIFrameReady),i=s(w=>w.isIFrameReady),l=N(),c=ss(null),[d,p]=dt(""),[m,f]=dt(""),[u,A]=dt("Resend."),[E,h]=dt(!1),[D,I]=dt(!1),[v,T]=dt(),S=t?.authType==="email";Xo(()=>{setTimeout(()=>{c.current.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[]),Xo(()=>{v&&i&&setTimeout(()=>{o(v),I(!1)},200)},[v,i]),Xo(()=>{d.length===6&&y()},[d]);let g=async()=>{E||(A("Resent!"),h(!0),S?await l.resendVerificationCode():await l.resendVerificationCodeByPhone(),setTimeout(()=>{A("Resend."),h(!1)},3e3))},x=w=>{m&&f(""),p(w.detail.value.trim())},y=async()=>{if(I(!0),d.length===6&&/^\d+$/.test(d))try{let w=await l.getSupportedCreateAuthMethods();if(w.has(zo.PASSWORD)&&w.has(zo.PASSKEY)){r(!1);let b=S?await l.verifyEmail({verificationCode:d}):await l.verifyPhone({verificationCode:d}),_=await l.getSetupPasswordURL({authType:t?.authType,theme:e});a(await l.shortenLoginLink(b)),n(await l.shortenLoginLink(_)),T("BIOMETRIC_CREATION");return}else if(w.has(zo.PASSWORD)){r(!1),S?await l.verifyEmail({verificationCode:d}):await l.verifyPhone({verificationCode:d});let b=await l.getSetupPasswordURL({authType:t?.authType,theme:e});n(await l.shortenLoginLink(b)),T("PASSWORD_CREATION");return}else{let b=S?await l.verifyEmail({verificationCode:d}):await l.verifyPhone({verificationCode:d});a(await l.shortenLoginLink(b)),o("BIOMETRIC_CREATION")}}catch(w){w.message.includes("429")?f("Too many incorrect attempts. Please try again in 10 minutes."):f("Incorrect code.")}else f("Incorrect code.");I(!1)};return ut(U,{$wide:!0,children:[ut(M,{children:[ut(Y,{variant:"headingS",weight:"bold",children:["Verify ",S?"Email":"Phone Number"]}),ut($t,{variant:"bodyS",color:"secondary",children:["Please enter the code we sent to ",mt($t,{variant:"bodyS",children:t?.identifier})]})]}),mt(M,{children:D?mt(as,{}):ut(ps,{children:[mt("form",{onSubmit:async w=>{w.preventDefault(),await y()},children:mt(ls,{ref:c,length:6,type:"number",code:d,onCpslInput:x,errorText:m,onKeyDown:async w=>w.key==="Enter"&&await y()})}),ut($t,{variant:"bodyS",color:"secondary",children:["Didn\u2019t receive a code?"," ",mt(cs,{variant:"bodyS",style:{cursor:E?"default":"pointer"},onClick:g,children:u})]})]})})]})},ls=Qo(rs)`
|
|
56
56
|
align-self: center;
|
|
57
|
-
|
|
57
|
+
`,$t=Qo(is)`
|
|
58
58
|
text-align: center;
|
|
59
59
|
display: inline-block;
|
|
60
|
-
`,
|
|
60
|
+
`,cs=Qo($t)`
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
display: inline-block;
|
|
63
|
-
`;import{CpslButton as
|
|
64
|
-
height=${
|
|
63
|
+
`;import{CpslButton as lr,CpslDivider as us,CpslIcon as ms}from"@getpara/react-components";import{useEffect as Cs,useMemo as fs,useState as As}from"react";function Ze({url:e,target:t,type:o,current:a}){if(typeof window>"u")return;a?.close();let n=560,r;switch(o){case"LOGIN_PASSWORD":{r=460;break}case"LOGIN_PASSKEY":{r=798;break}case"CREATE_PASSWORD":{r=400;break}case"CREATE_PASSKEY":{r=464;break}case"TRANSACTION_REVIEW":{r=480;break}case"OAUTH":default:{r=768;break}}let i=window.screenLeft!==void 0?window.screenLeft:window.screenX,l=window.screenTop!==void 0?window.screenTop:window.screenY,c=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,d=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,p=(c-n)/2+i,m=(d-r)/2+l,f=`toolbar=no, menubar=no, width=${n},
|
|
64
|
+
height=${r}, top=${m}, left=${p}`,u=window.open(e,t,f);return u||setTimeout(()=>{u=window.open(e,"_blank")},0),u}import Ss from"styled-components";import{AuthMethod as Ct,getPublicKeyHex as Yt}from"@getpara/web-sdk";import{detect as ds}from"detect-browser";var Kt=()=>{switch(ds().os){case"linux":case"Chrome OS":return!1}return!0};import{formatBiometricHints as Es,KnownDevices as hs,UserIdentifier as Ts}from"@getpara/react-common";import{Fragment as qo,jsx as be,jsxs as ft}from"react/jsx-runtime";var cr=()=>{let e=s(I=>I.refs),t=s(I=>I.supportedAuthMethods),o=s(I=>I.passwordUrlForLogin),a=s(I=>I.webAuthURLForLogin),n=s(I=>I.setStep),r=s(I=>I.biometricLocationHints),i=N(),l=V(I=>I.getAuthInfo()),c=s(I=>I.setWebAuthURLForLogin),d=s(I=>I.setPasswordUrlForLogin),p=Kt(),m=fs(()=>Es(r),[r]),f=s(I=>I.setSupportedAuthMethods),[u,A]=As();Cs(()=>{async function I(){if(!t?.size&&i.getUserId()){let b=await i.supportedAuthMethods({userId:i.getUserId()});b?.size&&f(b);return}if(!i.isEmail&&!i.isPhone&&!i.isFarcaster&&!i.isTelegram||!i.loginEncryptionKeyPair)return;let v=i.isEmail?"email":i.isPhone?"phone":i.isFarcaster?"farcaster":"telegram",T=await i.touchSession(),S=t?.has&&t.has(Ct.PASSKEY)?await i.getWebAuthURLForLogin({sessionId:T.data.sessionId,loginEncryptionPublicKey:Yt(i.loginEncryptionKeyPair),partnerId:T.data.partnerId,authType:v,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,g=t?.has&&t.has(Ct.PASSKEY)?await i.getWebAuthURLForLogin({sessionId:T.data.sessionId,loginEncryptionPublicKey:Yt(i.loginEncryptionKeyPair),partnerId:T.data.partnerId,newDeviceSessionId:T.data.sessionLookupId,newDeviceEncryptionKey:Yt(i.loginEncryptionKeyPair),authType:v,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,x=t?.has&&t.has(Ct.PASSWORD)?await i.getPasswordURLForLogin({sessionId:T.data.sessionId,loginEncryptionPublicKey:Yt(i.loginEncryptionKeyPair),partnerId:T.data.partnerId,authType:v,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,y=S?await i.shortenLoginLink(S):void 0,w=g?await i.shortenLoginLink(g):void 0;A(w),c(y),d(x)}I()},[t,i]);let E=()=>{e.popupWindow.current=Ze({url:a,target:"ParaPasskey",type:"LOGIN_PASSKEY",current:e.popupWindow.current}),n("AWAITING_BIOMETRIC_LOGIN")},h=()=>{e.popupWindow.current=Ze({url:o,target:"ParaPassword",type:"LOGIN_PASSWORD",current:e.popupWindow.current}),n("AWAITING_PASSWORD_LOGIN")};function D(){return!r?.length||p&&m.isOnKnownDevice||t?.has&&t.has(Ct.PASSWORD)}return ft(U,{$wide:!0,children:[ft(M,{children:[D()&&be(Y,{variant:"headingS",weight:"bold",children:"Welcome back,"}),be(Ts,{...l})]}),ft(ys,{children:[t?.has&&t.has(Ct.PASSWORD)&&o&&be(Is,{handlePasswordClick:h}),t?.has&&t.has(Ct.PASSKEY)&&a&&u&&be(gs,{handlePasskeyClick:E,formattedHints:m,shortLoginLink:u,passkeysSupported:p,biometricLocationHints:r})]})]})},Is=({handlePasswordClick:e})=>be(lr,{fullWidth:!0,onClick:e,children:"Login"}),gs=({handlePasskeyClick:e,formattedHints:t,shortLoginLink:o,passkeysSupported:a,biometricLocationHints:n=[]})=>{let[r,i]=[n.length>0,t.isOnKnownDevice];return ft(qo,{children:[(r&&!i||!a)&&be(hs,{hints:t,link:o}),a&&ft(qo,{children:[r&&!i&&be(us,{children:"or"}),be(lr,{fullWidth:!0,onClick:e,children:!r||i?ft(qo,{children:[be(ms,{slot:"start",icon:"key"}),"Login with passkey"]}):"Continue anyway"})]})]})},ys=Ss(M)`
|
|
65
65
|
gap: 16px;
|
|
66
|
-
`;import{CpslButton as jo,CpslCodeInput as
|
|
66
|
+
`;import{CpslButton as jo,CpslCodeInput as xs,CpslDivider as ws,CpslIcon as Ws,CpslQrCode as _s,CpslSpinner as pr,CpslText as dr}from"@getpara/react-components";import{useEffect as Zo,useRef as Rs,useState as Xt}from"react";import{styled as ur}from"styled-components";import{useCopyToClipboard as Ls}from"@getpara/react-common";import{Fragment as Jo,jsx as ee,jsxs as Lt}from"react/jsx-runtime";var mr=({onClose:e})=>{let t=s(x=>x.isLogin()),o=s(x=>x.setStep),a=N(),n=s(x=>x.step==="VERIFY_2FA"),[r,i]=Ls(),l=Rs(null),[c,d]=Xt(null),[p,m]=Xt(""),[f,u]=Xt(""),[A,E]=Xt(!1),D=(c?new URL(c).searchParams:void 0)?.get("secret");Zo(()=>{async function x(){try{let{uri:y}=await a.setup2FA();d(y)}catch(y){console.error("Error fetching OTPAuth URL:",y)}}x()},[]),Zo(()=>{setTimeout(()=>{l?.current?.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[n]),Zo(()=>{p.length===6&&S()},[p]);let I=()=>{o("VERIFY_2FA")},v=()=>{t?o("LOGIN_DONE"):e()},T=x=>{f&&u(""),m(x.detail.value.trim())},S=async()=>{if(E(!0),p.length===6&&/^\d+$/.test(p))try{await a.enable2FA({verificationCode:p}),o("TWO_FACTOR_DONE")}catch{u("Incorrect Code")}else u("Incorrect Code");E(!1)};return Lt(U,{children:[Lt(M,{children:[ee(Y,{variant:"headingS",weight:"bold",children:"Turn on Two-Factor authentication"}),n&&ee(dr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Please enter the code from your authenticator app."})]}),ee(M,{children:n?ee(Jo,{children:A?ee(pr,{}):ee("form",{onSubmit:async x=>{x.preventDefault(),await S()},children:ee(Ms,{ref:l,code:p,onCpslInput:T,errorText:f,length:6,onKeyDown:async x=>x.key==="Enter"&&await S()})})}):Lt(Jo,{children:[ee(dr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan with your preferred authenticator app."}),ee(fe,{children:c?ee(_s,{url:c}):ee(pr,{size:100})})]})}),!n&&Lt(Jo,{children:[ee(M,{children:ee(ws,{children:"or enter the code manually"})}),ee(M,{children:ee(Rt,{disabled:!0,value:D,noAutoDisable:!0,children:ee(jo,{slot:"end",variant:"ghost",onClick:()=>{i(D)},children:ee(Ws,{icon:r?"check":"copy"})})})}),Lt(M,{children:[ee(jo,{fullWidth:!0,onClick:I,children:"Continue"}),ee(Os,{variant:"ghost",onClick:v,children:"Skip"})]})]})]})},Ms=ur(xs)`
|
|
67
67
|
align-self: center;
|
|
68
|
-
`,
|
|
68
|
+
`,Os=ur(jo)`
|
|
69
69
|
margin-top: 8px;
|
|
70
70
|
text-decoration: underline;
|
|
71
|
-
`;import{useEffect as Al}from"react";import ht from"styled-components";import{CpslButton as dl,CpslIdenticon as pl,CpslText as Rr}from"@getpara/react-components";import{truncateAddress as Lr}from"@getpara/web-sdk";import{useEffect as il}from"react";import{useEffect as el,useRef as tl}from"react";var B=()=>Z(t=>t.client);var qt=()=>{let e=Z(n=>n.isOpen),t=Z(n=>n.setIsOpen);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};var Ce=()=>{let e=B(),t=Z(l=>l.selectedWalletId),o=Z(l=>l.selectedWalletType),a=Z(l=>l.setSelectedWallet),n=Z(l=>l.clearSelectedWallet);return{selectedWallet:{id:t,type:o},setSelectedWallet:({id:l,type:r})=>{try{e.findWalletId(l,{type:[r]})!==l?n():a(l,r)}catch{n()}}}};import{useQuery as Ms}from"@tanstack/react-query";var mr=async e=>{let o={isConnected:!!await e?.isFullyLoggedIn(),email:void 0,phone:void 0,wallets:void 0};return e&&o.isConnected&&(o.email=e.getEmail(),o.phone=e.getPhoneNumber(),o.wallets=e.getWallets()),o};var Ee="PARA_ACCOUNT",en=()=>{let e=B();return Ms({queryKey:[Ee,e?.getUserId()],queryFn:async()=>await mr(e)})};import{useQuery as Os}from"@tanstack/react-query";var Cr=async(e,t)=>{let o=await e?.isFullyLoggedIn();return!e||!o?null:e.findWallet(t?.id,t?.type)};var ye="PARA_WALLET",Nt=()=>{let e=B(),{selectedWallet:t}=Ce();return Os({queryKey:[ye,e?.getUserId(),t.id,t.type],queryFn:async()=>await Cr(e,t)})};import{useMutation as Ns,useQueryClient as vs}from"@tanstack/react-query";var fr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to waitForLoginAndSetup");try{let o=await e.waitForLoginAndSetup(t);if(o.isError)throw new Error("error during waitForLoginAndSetup");return o}catch(o){throw new Error(o)}};function J(e,t){let{mutate:o,mutateAsync:a,...n}=e;return{...{[t]:e.mutate,[`${t}Async`]:e.mutateAsync},...n}}var bs=()=>{let e=B(),t=vs(),o=Ns({mutationFn:async a=>await fr(e,a),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForLoginAndSetup")};import{useMutation as Ds,useQueryClient as Us}from"@tanstack/react-query";var Ar=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForAccountCreation();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Ps=()=>{let e=B(),t=Us(),o=Ds({mutationFn:async()=>await Ar(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForAccountCreation")};import{useMutation as Fs,useQueryClient as ks}from"@tanstack/react-query";var Sr=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForPasskeyAndCreateWallet();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Bs=()=>{let e=B(),t=ks(),o=Fs({mutationFn:async()=>await Sr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForPasskeyAndCreateWallet")};import{useMutation as Hs}from"@tanstack/react-query";var Er=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to createUser");try{await(t.type==="EMAIL"?e.createUser({email:t.identifier}):e.createUserByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var Gs=()=>{let e=B(),t=Hs({mutationFn:async o=>await Er(e,o)});return J(t,"createUser")};import{useMutation as Vs}from"@tanstack/react-query";var hr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to checkIfUserExists");try{return await(t.type==="EMAIL"?e.checkIfUserExists({email:t.identifier}):e.checkIfUserExistsByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var $s=()=>{let e=B(),t=Vs({mutationFn:async o=>await hr(e,o)});return J(t,"checkIfUserExists")};import{useMutation as Ks}from"@tanstack/react-query";var Tr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to initiateLogin");try{return await e.initiateUserLoginV2(t)}catch(o){throw new Error(o)}};var Ys=()=>{let e=B(),t=Ks({mutationFn:async o=>await Tr(e,o)});return J(t,"initiateLogin")};import{useMutation as Xs,useQueryClient as zs}from"@tanstack/react-query";var Ir=async e=>{if(!e)throw new Error("no para instance");try{await e.logout()}catch(t){throw new Error(t)}};var tn=()=>{let e=B(),t=zs(),o=Z(n=>n.clearSelectedWallet),a=Xs({mutationFn:async()=>await Ir(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1}),o()}});return J(a,"logout")};import{useMutation as Qs}from"@tanstack/react-query";var gr=async e=>{if(!e)throw new Error("no para instance");try{if(!await e.keepSessionAlive())throw new Error("session expired")}catch(t){throw new Error(t)}};var on=()=>{let e=B(),t=Qs({mutationFn:async()=>await gr(e)});return J(t,"keepSessionAlive")};import{useMutation as qs}from"@tanstack/react-query";var yr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signMessage");try{return await e.signMessage(t)}catch(o){throw new Error(o)}};var Zs=()=>{let e=B(),{data:t}=Nt(),o=qs({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await yr(e,{...a,walletId:n})}});return J(o,"signMessage")};import{useMutation as Js}from"@tanstack/react-query";var xr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signTransaction");try{return await e.signTransaction(t)}catch(o){throw new Error(o)}};var js=()=>{let e=B(),{data:t}=Nt(),o=Js({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await xr(e,{...a,walletId:n})}});return J(o,"signTransaction")};var ol=6e4,nl=3e5,wr=({disabled:e})=>{let t=B(),{data:o}=en(),{logoutAsync:a}=tn(),{keepSessionAliveAsync:n}=on(),i=tl(null);el(()=>{if(!t||e){c();return}return o?.isConnected?r():c(),()=>c()},[t,o,e]);let l=async()=>{try{let p=await t.retrieveSessionCookie();if(!p)return null;let d=p.match(/Expires=([^;]+)/);return d?new Date(d[1]):null}catch{return null}},r=()=>{c(),i.current=setInterval(async()=>{let p=await l();if(!p){await a(),c();return}let d=p.getTime()-Date.now();if(d<=0){await a(),c();return}if(d<=nl){try{await n(),r()}catch(u){console.error("Failed to keep session alive:",u),await a(),c()}return}},ol)},c=()=>{i.current&&clearInterval(i.current)}};import{useQueryClient as rl}from"@tanstack/react-query";import{useEffect as al}from"react";import{ParaEvent as j}from"@getpara/web-sdk";var Wr=({onLogin:e,onLogout:t,onAccountSetup:o,onAccountCreation:a,onSignMessage:n,onSignTransaction:i,onWalletCreated:l,onPregenWalletClaimed:r,onExternalWalletChange:c,onWalletsChange:p}={})=>{let d=rl(),u=B(),A=Z(x=>x.clearSelectedWallet),{selectedWallet:m,setSelectedWallet:f}=Ce(),S=x=>{D(),e?.(x)},y=x=>{D(),o?.(x)},D=()=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),d.invalidateQueries({queryKey:[ye],exact:!1})},W=x=>{a?.(x)},E=x=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),A(),t?.(x)},h=x=>{n?.(x)},R=x=>{i?.(x)},C=x=>{U(),p?.(x)},L=x=>{U(),c?.(x)},T=x=>{l?.(x)},g=x=>{r?.(x)},U=()=>{if(!u){A();return}if(!m?.id||!u.findWallet(m?.id)){let x=u.findWallet(void 0,void 0,{forbidPregen:!0});f({id:x?.id,type:x?.type})}};al(()=>(window.addEventListener(j.LOGIN_EVENT,S),window.addEventListener(j.ACCOUNT_SETUP_EVENT,y),window.addEventListener(j.ACCOUNT_CREATION_EVENT,W),window.addEventListener(j.LOGOUT_EVENT,E),window.addEventListener(j.SIGN_MESSAGE_EVENT,h),window.addEventListener(j.SIGN_TRANSACTION_EVENT,R),window.addEventListener(j.WALLETS_CHANGE_EVENT,C),window.addEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.addEventListener(j.WALLET_CREATED,T),window.addEventListener(j.PREGEN_WALLET_CLAIMED,g),()=>{window.removeEventListener(j.LOGIN_EVENT,S),window.removeEventListener(j.ACCOUNT_SETUP_EVENT,y),window.removeEventListener(j.ACCOUNT_CREATION_EVENT,W),window.removeEventListener(j.LOGOUT_EVENT,E),window.removeEventListener(j.SIGN_MESSAGE_EVENT,h),window.removeEventListener(j.SIGN_TRANSACTION_EVENT,R),window.removeEventListener(j.WALLETS_CHANGE_EVENT,C),window.removeEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.removeEventListener(j.WALLET_CREATED,T),window.removeEventListener(j.PREGEN_WALLET_CLAIMED,g)}),[u])};import{ParaInternal as sl}from"@getpara/react-common";var ll={disableAutoSessionKeepAlive:!1},cl=({children:e,paraClientConfig:t,callbacks:o,config:a=ll})=>{Wr(o),wr({disabled:a.disableAutoSessionKeepAlive});let n=Z(i=>i.setClient);return il(()=>{let i=a.paraClientOverride??new sl(t.env,t.apiKey,t.opts);n(i)},[t,a.paraClientOverride]),e};var RS=()=>mt.getState().client,LS=()=>mt.getState().isOpen,MS=()=>mt.getState().selectedWalletId,OS=()=>mt.getState().selectedWalletType;import{jsx as et,jsxs as nn}from"react/jsx-runtime";var Mr=({address:e,showAddFunds:t})=>{let o=b(),a=o.externalWallets[e];return a?et(Or,{address:Lr(a.address,a.type),identiconHash:o.getIdenticonHash(a.id,a.type),showAddFunds:t}):null},Zt=({id:e,type:t,showAddFunds:o})=>{let a=b(),n=_(r=>r.appName),i=a.findWallet(e,t);if(!i)return null;let l=a.getDisplayAddress(i.id,{addressType:t});return et(Or,{id:i.id,type:i.type,address:Lr(l,t,{prefix:a.cosmosPrefix}),name:i.name??`${n?`${n} `:""}Wallet`,identiconHash:a.getIdenticonHash(i.id,t),showAddFunds:o})},Or=({address:e,name:t,identiconHash:o,showAddFunds:a,id:n,type:i})=>{let l=s(u=>u.onRampConfig),{setSelectedWallet:r}=Ce(),c=s(u=>u.setStep),p=l.isBuyEnabled||l.isReceiveEnabled;return nn(ul,{children:[nn(ml,{children:[et(pl,{size:"48px",hash:o}),nn(Cl,{children:[!!t&&et(_r,{color:"contrast",variant:"bodyL",weight:"semiBold",children:t}),et(_r,{color:"secondary",variant:"bodyS",weight:"medium",children:e})]})]}),a&&p&&et(fl,{onClick:()=>{n&&i&&(r({id:n,type:i}),p&&c(l.isBuyEnabled?"ADD_FUNDS_BUY":"ADD_FUNDS_RECEIVE"))},children:et(Rr,{variant:"bodyXS",color:"contrast",weight:"medium",children:"Add Funds"})})]})},Jt=ht.div`
|
|
71
|
+
`;import{useEffect as El}from"react";import At from"styled-components";import{CpslButton as ul,CpslIdenticon as ml,CpslText as Lr}from"@getpara/react-components";import{truncateAddress as Mr}from"@getpara/web-sdk";import{useEffect as ll}from"react";import{useEffect as ol,useRef as nl}from"react";var G=()=>Q(t=>t.client);var zt=()=>{let e=Q(n=>n.isOpen),t=Q(n=>n.setIsOpen);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};var pe=()=>{let e=G(),t=Q(i=>i.selectedWalletId),o=Q(i=>i.selectedWalletType),a=Q(i=>i.setSelectedWallet),n=Q(i=>i.clearSelectedWallet);return{selectedWallet:{id:t,type:o},setSelectedWallet:({id:i,type:l})=>{try{e.findWalletId(i,{type:[l]})!==i?n():a(i,l)}catch{n()}}}};import{useQuery as Ns}from"@tanstack/react-query";var Cr=async e=>{let o={isConnected:!!await e?.isFullyLoggedIn(),email:void 0,phone:void 0,wallets:void 0};return e&&o.isConnected&&(o.email=e.getEmail(),o.phone=e.getPhoneNumber(),o.wallets=e.getWallets()),o};var Ae="PARA_ACCOUNT",en=()=>{let e=G();return Ns({queryKey:[Ae,e?.getUserId()],queryFn:async()=>await Cr(e)})};import{useQuery as vs}from"@tanstack/react-query";var fr=async(e,t)=>{let o=await e?.isFullyLoggedIn();return!e||!o?null:e.findWallet(t?.id,t?.type)};var Ie="PARA_WALLET",Mt=()=>{let e=G(),{selectedWallet:t}=pe();return vs({queryKey:[Ie,e?.getUserId(),t.id,t.type],queryFn:async()=>await fr(e,t)})};import{useMutation as bs,useQueryClient as Ds}from"@tanstack/react-query";var Ar=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to waitForLoginAndSetup");try{let o=await e.waitForLoginAndSetup(t);if(o.isError)throw new Error("error during waitForLoginAndSetup");return o}catch(o){throw new Error(o)}};function Z(e,t){let{mutate:o,mutateAsync:a,...n}=e;return{...{[t]:e.mutate,[`${t}Async`]:e.mutateAsync},...n}}var Us=()=>{let e=G(),t=Ds(),o=bs({mutationFn:async a=>await Ar(e,a),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ae],exact:!1}),await t.invalidateQueries({queryKey:[Ie],exact:!1})}});return Z(o,"waitForLoginAndSetup")};import{useMutation as Ps,useQueryClient as Fs}from"@tanstack/react-query";var Sr=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForAccountCreation();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var ks=()=>{let e=G(),t=Fs(),o=Ps({mutationFn:async()=>await Sr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ae],exact:!1}),await t.invalidateQueries({queryKey:[Ie],exact:!1})}});return Z(o,"waitForAccountCreation")};import{useMutation as Bs,useQueryClient as Hs}from"@tanstack/react-query";var Er=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForPasskeyAndCreateWallet();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Gs=()=>{let e=G(),t=Hs(),o=Bs({mutationFn:async()=>await Er(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ae],exact:!1}),await t.invalidateQueries({queryKey:[Ie],exact:!1})}});return Z(o,"waitForPasskeyAndCreateWallet")};import{useMutation as Vs}from"@tanstack/react-query";var hr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to createUser");try{await(t.type==="EMAIL"?e.createUser({email:t.identifier}):e.createUserByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var $s=()=>{let e=G(),t=Vs({mutationFn:async o=>await hr(e,o)});return Z(t,"createUser")};import{useMutation as Ks}from"@tanstack/react-query";var Tr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to checkIfUserExists");try{return await(t.type==="EMAIL"?e.checkIfUserExists({email:t.identifier}):e.checkIfUserExistsByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var Ys=()=>{let e=G(),t=Ks({mutationFn:async o=>await Tr(e,o)});return Z(t,"checkIfUserExists")};import{useMutation as Xs}from"@tanstack/react-query";var Ir=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to initiateLogin");try{return await e.initiateUserLoginV2(t)}catch(o){throw new Error(o)}};var zs=()=>{let e=G(),t=Xs({mutationFn:async o=>await Ir(e,o)});return Z(t,"initiateLogin")};import{useMutation as Qs,useQueryClient as qs}from"@tanstack/react-query";var gr=async e=>{if(!e)throw new Error("no para instance");try{await e.logout()}catch(t){throw new Error(t)}};var tn=()=>{let e=G(),t=qs(),o=Q(n=>n.clearSelectedWallet),a=Qs({mutationFn:async()=>await gr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ae],exact:!1}),await t.invalidateQueries({queryKey:[Ie],exact:!1}),o()}});return Z(a,"logout")};import{useMutation as Zs}from"@tanstack/react-query";var yr=async e=>{if(!e)throw new Error("no para instance");try{if(!await e.keepSessionAlive())throw new Error("session expired")}catch(t){throw new Error(t)}};var on=()=>{let e=G(),t=Zs({mutationFn:async()=>await yr(e)});return Z(t,"keepSessionAlive")};import{useMutation as Js}from"@tanstack/react-query";var xr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signMessage");try{return await e.signMessage(t)}catch(o){throw new Error(o)}};var js=()=>{let e=G(),{data:t}=Mt(),o=Js({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await xr(e,{...a,walletId:n})}});return Z(o,"signMessage")};import{useMutation as el}from"@tanstack/react-query";var wr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signTransaction");try{return await e.signTransaction(t)}catch(o){throw new Error(o)}};var tl=()=>{let e=G(),{data:t}=Mt(),o=el({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await wr(e,{...a,walletId:n})}});return Z(o,"signTransaction")};var rl=6e4,al=3e5,Wr=({disabled:e})=>{let t=N(),{data:o}=en(),{logoutAsync:a}=tn(),{keepSessionAliveAsync:n}=on(),r=nl(null);ol(()=>{if(!t||e){c();return}return o?.isConnected&&!t.isUsingExternalWallet()?l():c(),()=>c()},[t,o,e]);let i=async()=>{try{let d=await t.retrieveSessionCookie();if(!d)return null;let p=d.match(/Expires=([^;]+)/);return p?new Date(p[1]):null}catch{return null}},l=()=>{c(),r.current=setInterval(async()=>{let d=await i();if(!d){await a(),c();return}let p=d.getTime()-Date.now();if(p<=0){await a(),c();return}if(p<=al){try{await n(),l()}catch(m){console.error("Failed to keep session alive:",m),await a(),c()}return}},rl)},c=()=>{r.current&&clearInterval(r.current)}};import{useQueryClient as il}from"@tanstack/react-query";import{useEffect as sl}from"react";import{ParaEvent as J}from"@getpara/web-sdk";var _r=({onLogin:e,onLogout:t,onAccountSetup:o,onAccountCreation:a,onSignMessage:n,onSignTransaction:r,onWalletCreated:i,onPregenWalletClaimed:l,onExternalWalletChange:c,onWalletsChange:d}={})=>{let p=il(),m=G(),f=Q(_=>_.clearSelectedWallet),{selectedWallet:u,setSelectedWallet:A}=pe(),E=_=>{D(),e?.(_)},h=_=>{D(),o?.(_)},D=()=>{p.invalidateQueries({queryKey:[Ae],exact:!1}),p.invalidateQueries({queryKey:[Ie],exact:!1})},I=_=>{a?.(_)},v=_=>{p.invalidateQueries({queryKey:[Ae],exact:!1}),f(),t?.(_)},T=_=>{n?.(_)},S=_=>{r?.(_)},g=_=>{b(),d?.(_)},x=_=>{b(),c?.(_)},y=_=>{i?.(_)},w=_=>{l?.(_)},b=()=>{if(!m){f();return}if(!u?.id||!m.findWallet(u?.id)){let _=m.findWallet(void 0,void 0,{forbidPregen:!0});A({id:_?.id,type:_?.type})}};sl(()=>(window.addEventListener(J.LOGIN_EVENT,E),window.addEventListener(J.ACCOUNT_SETUP_EVENT,h),window.addEventListener(J.ACCOUNT_CREATION_EVENT,I),window.addEventListener(J.LOGOUT_EVENT,v),window.addEventListener(J.SIGN_MESSAGE_EVENT,T),window.addEventListener(J.SIGN_TRANSACTION_EVENT,S),window.addEventListener(J.WALLETS_CHANGE_EVENT,g),window.addEventListener(J.EXTERNAL_WALLET_CHANGE_EVENT,x),window.addEventListener(J.WALLET_CREATED,y),window.addEventListener(J.PREGEN_WALLET_CLAIMED,w),()=>{window.removeEventListener(J.LOGIN_EVENT,E),window.removeEventListener(J.ACCOUNT_SETUP_EVENT,h),window.removeEventListener(J.ACCOUNT_CREATION_EVENT,I),window.removeEventListener(J.LOGOUT_EVENT,v),window.removeEventListener(J.SIGN_MESSAGE_EVENT,T),window.removeEventListener(J.SIGN_TRANSACTION_EVENT,S),window.removeEventListener(J.WALLETS_CHANGE_EVENT,g),window.removeEventListener(J.EXTERNAL_WALLET_CHANGE_EVENT,x),window.removeEventListener(J.WALLET_CREATED,y),window.removeEventListener(J.PREGEN_WALLET_CLAIMED,w)}),[m])};import{ParaInternal as cl}from"@getpara/react-common";var pl={disableAutoSessionKeepAlive:!1},dl=({children:e,paraClientConfig:t,callbacks:o,config:a=pl})=>{_r(o),Wr({disabled:a.disableAutoSessionKeepAlive});let n=Q(r=>r.setClient);return ll(()=>{let r=a.paraClientOverride??new cl(t.env,t.apiKey,t.opts);n(r)},[t,a.paraClientOverride]),e};var vS=()=>pt.getState().client,bS=()=>pt.getState().isOpen,DS=()=>pt.getState().selectedWalletId,US=()=>pt.getState().selectedWalletType;import{jsx as Je,jsxs as nn}from"react/jsx-runtime";var Or=({address:e,showAddFunds:t})=>{let o=N(),a=o.externalWallets[e];return a?Je(Nr,{address:Mr(a.address,a.type),identiconHash:o.getIdenticonHash(a.id,a.type),showAddFunds:t}):null},Qt=({id:e,type:t,showAddFunds:o})=>{let a=N(),n=W(l=>l.appName),r=a.findWallet(e,t);if(!r)return null;let i=a.getDisplayAddress(r.id,{addressType:t});return Je(Nr,{id:r.id,type:r.type,address:Mr(i,t,{prefix:a.cosmosPrefix}),name:r.name??`${n?`${n} `:""}Wallet`,identiconHash:a.getIdenticonHash(r.id,t),showAddFunds:o})},Nr=({address:e,name:t,identiconHash:o,showAddFunds:a,id:n,type:r})=>{let i=s(m=>m.onRampConfig),{setSelectedWallet:l}=pe(),c=s(m=>m.setStep),d=i.isBuyEnabled||i.isReceiveEnabled;return nn(Cl,{children:[nn(fl,{children:[Je(ml,{size:"48px",hash:o}),nn(Al,{children:[!!t&&Je(Rr,{color:"contrast",variant:"bodyL",weight:"semiBold",children:t}),Je(Rr,{color:"secondary",variant:"bodyS",weight:"medium",children:e})]})]}),a&&d&&Je(Sl,{onClick:()=>{n&&r&&(l({id:n,type:r}),d&&c(i.isBuyEnabled?"ADD_FUNDS_BUY":"ADD_FUNDS_RECEIVE"))},children:Je(Lr,{variant:"bodyXS",color:"contrast",weight:"medium",children:"Add Funds"})})]})},qt=At.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
flex-direction: column;
|
|
74
74
|
gap: 8px;
|
|
75
75
|
width: 100%;
|
|
76
|
-
`,
|
|
76
|
+
`,Cl=At.div`
|
|
77
77
|
width: 100%;
|
|
78
78
|
padding: 24px;
|
|
79
79
|
display: flex;
|
|
@@ -82,13 +82,13 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
82
82
|
gap: 16px;
|
|
83
83
|
background-color: var(--cpsl-color-background-8);
|
|
84
84
|
border-radius: 16px;
|
|
85
|
-
`,
|
|
85
|
+
`,fl=At.div`
|
|
86
86
|
display: flex;
|
|
87
87
|
justify-content: flex-start;
|
|
88
|
-
gap:
|
|
88
|
+
gap: 8px;
|
|
89
89
|
align-items: center;
|
|
90
90
|
overflow: hidden;
|
|
91
|
-
`,
|
|
91
|
+
`,Al=At.div`
|
|
92
92
|
flex: 1;
|
|
93
93
|
display: flex;
|
|
94
94
|
flex-direction: column;
|
|
@@ -96,7 +96,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
96
96
|
align-items: flex-start;
|
|
97
97
|
justify-content: center;
|
|
98
98
|
overflow: hidden;
|
|
99
|
-
`,
|
|
99
|
+
`,Rr=At(Lr)`
|
|
100
100
|
width: 100%;
|
|
101
101
|
&::part(text-element) {
|
|
102
102
|
line-height: 100%;
|
|
@@ -104,7 +104,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
104
104
|
overflow: hidden;
|
|
105
105
|
white-space: nowrap;
|
|
106
106
|
}
|
|
107
|
-
`,
|
|
107
|
+
`,Sl=At(ul)`
|
|
108
108
|
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
109
109
|
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
110
110
|
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
@@ -115,28 +115,28 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
115
115
|
--button-padding-top: 8px;
|
|
116
116
|
--button-padding-bottom: 8px;
|
|
117
117
|
--button-border-radius: 8px;
|
|
118
|
-
`;import{jsx as
|
|
118
|
+
`;import{jsx as Ot,jsxs as hl}from"react/jsx-runtime";var vr=({onClose:e})=>{let t=N(),o=W(a=>a.hideWallets);return El(()=>{setTimeout(()=>{e()},1600)},[]),hl(U,{children:[Ot(Ge,{icon:"checkCircleFilled"}),Ot(Y,{variant:"headingS",weight:"bold",children:"Connected"}),!o&&Ot(qt,{children:t.isUsingExternalWallet()?Ot(Or,{address:t.currentExternalWalletAddresses?.[0]}):t.currentWalletIdsArray.map(([a,n])=>Ot(Qt,{id:a,type:n},`${a}-${n}`))})]})};import{EnabledFlow as _o}from"@getpara/web-sdk";import{CpslSpinner as Tl,CpslText as Il}from"@getpara/react-components";import{jsx as Zt,jsxs as br}from"react/jsx-runtime";var Ve=({heading:e,subheading:t})=>br(U,{$wide:!0,children:[Zt(tr,{children:Zt(Tl,{size:100})}),br(M,{children:[Zt(Y,{variant:"headingS",weight:"bold",children:e}),Zt(Il,{variant:"bodyS",color:"secondary",weight:"medium",children:t})]})]});import{jsx as gl}from"react/jsx-runtime";var Dr=()=>{let e=s(t=>t.isLogin());return gl(Ve,{heading:e?"Waiting for Passkey":"Creating Passkey",subheading:"Follow the prompts presented by your browser."})};import{CpslIcon as yl,CpslInfoBox as xl,CpslText as Ur}from"@getpara/react-components";import{useEffect as wl,useRef as Wl,useState as _l}from"react";import{jsx as Jt,jsxs as jt}from"react/jsx-runtime";var Pr=()=>{let e=W(n=>n.hideWallets),[t,o]=_l(!1),a=Wl();return wl(()=>(typeof window<"u"&&(a.current=window.setTimeout(()=>{o(!0)},4e3)),()=>clearTimeout(a.current)),[]),jt(U,{$wide:!0,children:[Jt(Ve,{heading:e?"Creating Your Account":"Creating Your Wallet",subheading:"This should only take a couple of seconds."}),t&&Jt(xl,{children:jt(or,{children:[jt(nr,{children:[Jt(yl,{icon:"clock"}),Jt(Ur,{weight:"medium",children:"Hang on"})]}),jt(Ur,{variant:"bodyS",weight:"medium",color:"secondary",children:["Creating your ",e?"account":"wallet"," is taking a little longer than expected, but we're working on it!"]})]})})]})};import{CpslButton as Rl,CpslText as Ll}from"@getpara/react-components";import Ml from"styled-components";import{Fragment as Nl,jsx as je,jsxs as Fr}from"react/jsx-runtime";var kr=({twoFactorAuthEnabled:e,onClose:t})=>{let o=W(d=>d.hideWallets),a=s(d=>d.setStep),n=s(d=>d.isLogin()),r=s(d=>d.onRampConfig),i=N(),l=r?.isBuyEnabled||r?.isReceiveEnabled||r?.isWithdrawEnabled,c=async()=>{if(n){if(!e){a("LOGIN_DONE");return}let d=await i.check2FAStatus();a(d?"LOGIN_DONE":"SETUP_2FA")}else e?a("SETUP_2FA"):t()};return Fr(U,{$wide:!0,children:[je(Ol,{children:o?Fr(Nl,{children:[je(Ge,{icon:"checkCircleFilled"}),je(Ll,{variant:"bodyM",color:"secondary",weight:"medium",style:{marginTop:"16px"},children:"Your account has been created."})]}):je(qt,{children:i.currentWalletIdsArray.map(([d,p])=>je(Qt,{id:d,type:p,showAddFunds:l},d))})}),je(M,{children:je(Rl,{fullWidth:!0,onClick:c,children:e?"Continue":"Done"})})]})},Ol=Ml(M)`
|
|
119
119
|
min-height: 196px;
|
|
120
120
|
justify-content: center;
|
|
121
|
-
`;import{CpslButton as
|
|
121
|
+
`;import{CpslButton as vl,CpslText as eo}from"@getpara/react-components";import{styled as an}from"styled-components";import{useCopyToClipboard as bl}from"@getpara/react-common";function Br(e,t){let o=`Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${t}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;return`mailto:${e}?subject=Para%20Recovery%20Secret&body=${o}`}import{useState as Dl}from"react";import{Fragment as Pl,jsx as Se,jsxs as St}from"react/jsx-runtime";var Gr=({email:e,value:t,onComplete:o})=>{let[a,n]=Dl(!1),[r,i]=bl();return St(Pl,{children:[St(M,{children:[Se(Y,{variant:"headingXS",weight:"semiBold",children:"Save your Recovery Secret"}),St(Ul,{children:[Se(rn,{icon:"download",onClick:()=>{let p=document.createElement("a"),m=new Blob([t],{type:"text/plain"});p.href=URL.createObjectURL(m),p.download="recovery.txt",document.body.appendChild(p),p.click(),n(!0)},children:Se(eo,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Download"})}),Se(rn,{icon:r?"check":"copy",onClick:()=>{i(t),n(!0)},children:Se(eo,{variant:"bodyXS",color:"secondary",weight:"medium",children:r?"Copied!":"Copy"})}),Se(rn,{icon:"send",onClick:()=>{typeof window<"u"&&window.open(Br(e,t),"_self"),n(!0)},children:Se(eo,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Email"})})]})]}),Se(M,{children:Se(vl,{fullWidth:!0,onClick:o,disabled:!a,children:a?"I\u2019ve saved my recovery secret":"Choose an option above to continue"})})]})},Vr=()=>{let e=W(i=>i.hideWallets),t=s(i=>i.setStep),o=V(i=>i.getAuthInfo()),a=V(i=>i.recoveryShare),n=JSON.parse(a||"{}").backupDecryptionKey,r=async()=>{t("WALLET_CREATION_DONE")};return St(U,{children:[St(M,{children:[Se(Y,{variant:"headingS",weight:"bold",children:e?"Don't lose access":"Don't lose your wallet"}),St(Hr,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your"," ",Se(Hr,{variant:"bodyS",weight:"medium",children:"Recovery Secret"})," ","ensures you will be able to regain access to your ",e?"account":"wallet"," if you lose your Passkey or Password."]})]}),Se(Gr,{email:o?.authType==="email"?o.identifier:void 0,value:n,onComplete:r})]})},rn=an(He)`
|
|
122
122
|
flex: 1;
|
|
123
123
|
|
|
124
124
|
--button-icon-color: var(--cpsl-color-text-primary);
|
|
125
|
-
`,
|
|
125
|
+
`,Ul=an.div`
|
|
126
126
|
display: flex;
|
|
127
127
|
align-items: center;
|
|
128
128
|
justify-content: center;
|
|
129
129
|
gap: 8px;
|
|
130
130
|
width: 100%;
|
|
131
|
-
`,
|
|
131
|
+
`,Hr=an(eo)`
|
|
132
132
|
text-align: center;
|
|
133
133
|
display: inline-block;
|
|
134
|
-
`;import{CpslButton as Ul,CpslText as Pl}from"@getpara/react-components";import{jsx as sn,jsxs as ln}from"react/jsx-runtime";var Vr=({onClose:e})=>{let t=_(o=>o.hideWallets);return ln(F,{children:[sn(Ke,{icon:"checkCircleFilled"}),ln(O,{children:[sn(X,{variant:"headingXS",weight:"semiBold",children:"Success"}),ln(Pl,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your ",t?"account":"wallet"," is now protected by 2FA"]})]}),sn(Ul,{fullWidth:!0,onClick:e,children:"Done"})]})};import{CpslButton as cn,CpslDivider as Fl,CpslIcon as dn,CpslQrCode as kl,CpslSpinner as Bl,CpslText as $r}from"@getpara/react-components";import{useCopyToClipboard as Hl,UserIdentifier as Gl}from"@getpara/react-common";import{Fragment as Kr,jsx as xe,jsxs as Xe}from"react/jsx-runtime";var Yr=({handlePasswordClick:e,handlePasskeyClick:t})=>{let o=s(p=>p.webAuthURLForCreate),a=s(p=>p.iFrameUrl),n=V(p=>p.getAuthInfo()),[i,l]=Hl(),r=()=>{l(o)},c=!!o&&!!a;return Xe(F,{$wide:!0,children:[Xe(O,{children:[xe(X,{variant:"headingS",weight:"bold",children:c?"Secure Your Account":"Create Passkey"}),xe(Gl,{...n}),xe($r,{variant:"bodyS",color:"secondary",weight:"medium",children:c?"Choose a password or set up a passkey":"Your Passkey keeps your account safe."})]}),Xe(O,{children:[Xt()?Xe(cn,{fullWidth:!0,onClick:t,children:[xe(dn,{slot:"start",icon:"key"}),c?"Create Passkey":"Create"]}):Xe(Kr,{children:[xe($r,{weight:"semiBold",children:"Scan with your mobile device"}),xe(Se,{children:o?xe(kl,{url:o}):xe(Bl,{size:100})}),Xe(cn,{size:"small",variant:"ghost",onClick:r,children:[xe(dn,{slot:"start",icon:i?"check":"copy"}),i?"Copied":"Copy Link"]})]}),c&&Xe(Kr,{children:[xe(Fl,{children:"or"}),Xe(cn,{fullWidth:!0,onClick:e,children:[xe(dn,{slot:"start",icon:"passcode"}),"Choose Password"]})]})]})]})};import{jsx as Vl}from"react/jsx-runtime";var Xr=()=>Vl(Ye,{heading:"Complete Login",subheading:"Follow the prompts presented by your browser."});import{EnabledFlow as rt,getOnRampAssets as pc,getOnRampNetworks as uc,OnRampProvider as mc,OnRampPurchaseType as lo,toAssetInfoArray as Cc,WalletType as An}from"@getpara/web-sdk";import{CpslButton as fc,CpslDivider as Ac,CpslIcon as ia,CpslIdenticon as Sc,CpslQrCode as Ec,CpslSpinner as sa,CpslTab as hc,CpslTabs as Tc,CpslText as da}from"@getpara/react-components";import{useEffect as Sn,useMemo as la}from"react";import{useState as Xl}from"react";import{Network as Re,OnRampAsset as Le,OnRampMethod as Fe,OnRampProvider as pn}from"@getpara/core-sdk";var un="https://connect.getpara.com/",zr="https://getpara.com/terms",mn={[pn.STRIPE]:{name:"Stripe",feeLower:.99,feeUpper:4.49,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"stripeBrand",backgroundColors:["#6772E5","#808AF4"]},[pn.RAMP]:{name:"Ramp",feeLower:.99,feeUpper:4.49,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"rampNetworkBrand",backgroundColors:["#21BF73","#3AE492"]},[pn.MOONPAY]:{name:"MoonPay",feeLower:1,feeUpper:4.5,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"moonpayBrand",backgroundColors:["#7715F5","#9647fd"]}},Cn={[Re.ETHEREUM]:{name:"Ethereum",icon:"ethereum"},[Re.SEPOLIA]:{name:"Sepolia",icon:"ethereum"},[Re.ARBITRUM]:{name:"Arbitrum",icon:"arbitrumBrand"},[Re.BASE]:{name:"Base",icon:"baseBrand"},[Re.OPTIMISM]:{name:"Optimism",icon:"optimismBrand"},[Re.POLYGON]:{name:"Polygon",icon:"polygonBrand"},[Re.SOLANA]:{name:"Solana",icon:"solana"},[Re.COSMOS]:{name:"Cosmos",icon:"cosmos"},[Re.CELO]:{name:"Celo",icon:"celoBrand"},[Re.NOBLE]:{name:"Noble",icon:"nobleBrand"}},fn={[Le.ETHEREUM]:{name:"Ethereum",code:"ETH",icon:"ethereum"},[Le.USDC]:{name:"USDC",code:"USDC",icon:"usdcBrand"},[Le.POLYGON]:{name:"Polygon",code:"MATIC",icon:"polygonBrand"},[Le.SOLANA]:{name:"Solana",code:"SOL",icon:"solana"},[Le.ATOM]:{name:"Atom",code:"ATOM",icon:"cosmos"},[Le.CELO]:{name:"Celo",code:"CELO",icon:"celoBrand"},[Le.TETHER]:{name:"Tether",code:"USDT",icon:"tetherBrand"},[Le.CUSD]:{name:"Celo Dollar",code:"CUSD",icon:"celoBrand"},[Le.CEUR]:{name:"Celo Euro",code:"CEUR",icon:"celoBrand"},[Le.CREAL]:{name:"Celo Real",code:"CREAL",icon:"celoBrand"}};function bt(e){return Cn[e]?.name??`${e[0]}${e.slice(1).toLowerCase()}`}function $l(e){return Cn[e]?.icon??"globe"}function Kl(e){return fn[e]?.code??e}function Yl(e){return fn[e]?.icon??"emptyCircle"}var ze=480,no="network not supported",Qr=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ro={enter:e=>({scale:e>0?.9:1.1,opacity:0}),center:{scale:1,opacity:1},exit:e=>({scale:e<0?.9:1.1,opacity:0})},ao={duration:.2};import ot from"styled-components";import{CpslButton as zl,CpslIcon as Jr,CpslSpinner as Ql,CpslText as ql}from"@getpara/react-components";import{motion as Zl}from"framer-motion";import{jsx as Qe,jsxs as Zr}from"react/jsx-runtime";var jr=({config:e,index:t,onClick:o})=>{let[a,n]=Xl(!1),i=e.providers[t],{feeLower:l,feeUpper:r,name:c,icon:p,backgroundColors:d}=mn[i],u=`Fee ${l}% - ${r}%`;return Qe(Jl,{$gradientColors:d,fullWidth:!0,onClick:async()=>{n(!0),await o(),n(!1)},children:Zr(jl,{$backgroundColor:d[1],children:[Qe(oc,{children:Qe(Jr,{icon:p})}),Zr(ec,{children:[Qe(qr,{variant:"bodyL",weight:"medium",children:c}),Qe(tc,{children:Qe(qr,{variant:"bodyXS",weight:"medium",children:u})})]}),a?Qe(Ql,{size:16}):Qe(nc,{icon:"chevronUp"})]})})},Jl=ot(zl)`
|
|
134
|
+
`;import{CpslButton as Fl,CpslText as kl}from"@getpara/react-components";import{jsx as sn,jsxs as ln}from"react/jsx-runtime";var $r=({onClose:e})=>{let t=W(o=>o.hideWallets);return ln(U,{children:[sn(Ge,{icon:"checkCircleFilled"}),ln(M,{children:[sn(Y,{variant:"headingXS",weight:"semiBold",children:"Success"}),ln(kl,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your ",t?"account":"wallet"," is now protected by 2FA"]})]}),sn(Fl,{fullWidth:!0,onClick:e,children:"Done"})]})};import{CpslButton as cn,CpslDivider as Yl,CpslIcon as pn,CpslQrCode as Xl,CpslSpinner as zl,CpslText as qr}from"@getpara/react-components";import{useCopyToClipboard as Ql,UserIdentifier as ql}from"@getpara/react-common";var $e={LOGGIN_POLLING_DELAY_MS:5e3,POLLING_INTERVAL_MS:2e3,ANIMATION_DURATION:.15};import{createContext as Bl,useCallback as Kr,useContext as oo,useEffect as Hl,useMemo as Et,useState as Yr}from"react";import{WalletType as ge,isIOS as Gl,isIOSWebview as Vl,isMobile as to,truncateAddress as Xr}from"@getpara/web-sdk";import{jsx as Kl}from"react/jsx-runtime";var $l={wallets:[],chains:[],chainId:void 0,wallet:void 0,qrUri:void 0,chainIdSwitchingTo:void 0,walletDisplayHelpers:{showExtension:!1,showMobile:!1,isSolanaMobileIOS:!1,isCosmosMobileWallet:!1},username:void 0,avatar:void 0,connectExternalWallet:()=>{},disconnectExternalWallet:()=>Promise.resolve(),switchChain:()=>Promise.resolve(),setChainIdSwitchingTo:()=>{}},zr=Bl($l);function Qr({children:e,evmContext:t,solanaContext:o,cosmosContext:a,walletSort:n}){let{wallets:r,disconnect:i,chains:l,chainId:c,switchChain:d,username:p,avatar:m}=oo(t),{wallets:f,disconnect:u}=oo(o),{wallets:A,disconnect:E,chains:h,chainId:D,switchChain:I}=oo(a),v=s(O=>O.setStep),T=s(O=>O.setStepDirection),S=s(O=>O.setIsExternalWalletConnecting),g=s(O=>O.isExternalWalletConnecting),x=s(O=>O.setSelectedExternalWalletId),y=s(O=>O.selectedExternalWalletId),w=s(O=>O.setExternalWalletError),b=s(O=>O.setIsUsingMobileConnector),_=s(O=>O.isUsingMobileConnector),k=N(),[z,R]=Yr(),[te,oe]=Yr(),We=[...r,...f,...A].filter(O=>n.includes(O.id.toUpperCase())).sort((O,ne)=>n.indexOf(O.id.toUpperCase())-n.indexOf(ne.id.toUpperCase())).sort((O,ne)=>O.installed===ne.installed?0:O.installed?-1:1),$=Et(()=>We.find(O=>O.id===y),[We,y]),C=async()=>{let O=await $?.getQrUri?.();R(O)};Hl(()=>{$?z||C():z&&R(void 0)},[$]);let B=Et(()=>{switch(k.externalWallets[k.currentExternalWalletAddresses?.[0]??""]?.type){case ge.COSMOS:return h;case ge.EVM:return l;default:return[]}},[h,l,y]),H=Et(()=>{switch(k.externalWallets[k.currentExternalWalletAddresses?.[0]??""]?.type){case ge.COSMOS:return D;case ge.EVM:return c?.toString();default:return}},[h,l,y]),q=Kr(async O=>{let ne=k.externalWallets[k.currentExternalWalletAddresses?.[0]??""]?.type;if(ne){let me;switch(w(),oe(O),ne){case ge.COSMOS:{v("CHAIN_SWITCH"),me=await I(O);break}case ge.EVM:{v("CHAIN_SWITCH"),me=await d(parseInt(O));break}default:break}me.error?w(me.error):(oe(void 0),T(-1),v("ACCOUNT_MAIN"))}},[d,I]),P=Kr(async(O,ne,me,Bo)=>{if(g&&me&&(await i(),await u(),await E(),R(void 0),S(!1)),Bo||me||!g){w(),S(!0),b(ne);let{address:Wt,error:ve}=await(ne?O.connectMobile(me):O.connect());if(ve){if(w([ve]),b(),me&&ve==="Connection request rejected"){w(),await P(O,!1,!1,!0),await C();return}}else Wt&&v("LOGIN_DONE");S(!1)}},[g]),ce=async()=>{await i(),await u(),await E(),x()},ue={showExtension:!to()&&($?.isExtension&&$?.installed||!$?.isMobile||$?.type===ge.SOLANA),showMobile:to()&&$?.isMobile||!to()&&!$?.installed,isSolanaMobileIOS:Gl()&&to()&&!Vl()&&$?.type===ge.SOLANA,isCosmosMobileWallet:$?.type===ge.COSMOS&&_},lt=Et(()=>{let O,ne=k.externalWallets[k.currentExternalWalletAddresses?.[0]??""];if(ne)switch(ne?.type){case ge.EVM:{O=p?p.startsWith("0x")?Xr(p,"EVM"):p:void 0;break}default:{O=ne.address?Xr(ne.address,ne.type):void 0;break}}return O},[p,$]),ie=Et(()=>{let O=k.externalWallets[k.currentExternalWalletAddresses?.[0]??""]?.type;if(O)switch(O){case ge.EVM:return m;default:return}},[m,$]);return Kl(zr.Provider,{value:Et(()=>({wallets:We,chains:B,chainId:H,wallet:$,qrUri:z,walletDisplayHelpers:ue,chainIdSwitchingTo:te,username:lt,avatar:ie,connectExternalWallet:P,disconnectExternalWallet:ce,switchChain:q,setChainIdSwitchingTo:oe}),[We,B,H,$,z,ue,te,lt,ie,ce,P,q,oe]),children:e})}var K=()=>oo(zr);var Ee=()=>{let e=s(l=>l.step),t=s(l=>l.setStep),o=s(l=>l.accountAddFundTab),a=s(l=>l.decrementStep),n=s(l=>l.resetState),{setChainIdSwitchingTo:r}=K();return()=>{switch(e==="ADD_FUNDS_AWAITING"?t(ct(o)):a(),e){case"AUTH_MAIN":case"AUTH_MORE":{n();break}case"CHAIN_SWITCH":{r();break}}}};function no(){let e=N(),t=Ee(),o=s(c=>c.refs),a=s(c=>c.setStep),n=s(c=>c.webAuthURLForCreate),r=s(c=>c.setWebAuthURLForCreate),i=s(c=>c.setIFrameUrl),l=async()=>{let c=await e.waitForAccountCreation({popupWindow:o.popupWindow.current});window.clearTimeout(o.poll.current?.timeout),o.poll.current=void 0,o.popupWindow.current=void 0,c?(r(""),i(""),a("AWAITING_WALLET_CREATION")):o.currentStep.current==="AWAITING_BIOMETRIC_CREATION"&&t()};return{withPasskey:()=>{o.poll.current?.action!=="createPasskey"&&(clearTimeout(o.poll.current?.timeout),o.popupWindow.current=Ze({url:n,target:"ParaPasskey",type:"CREATE_PASSKEY",current:o.popupWindow.current}),o.poll.current={action:"createPasskey",timeout:window.setTimeout(l,$e.POLLING_INTERVAL_MS)},o.currentStep.current!=="AWAITING_BIOMETRIC_CREATION"&&a("AWAITING_BIOMETRIC_CREATION"))},withPassword:()=>{o.poll.current?.action!=="createPassword"&&(clearTimeout(o.poll.current?.timeout),o.poll.current={action:"createPassword",timeout:window.setTimeout(l,$e.POLLING_INTERVAL_MS)},o.currentStep.current!=="PASSWORD_CREATION"&&a("PASSWORD_CREATION"))}}}import{Fragment as Zr,jsx as ye,jsxs as Ke}from"react/jsx-runtime";var Jr=()=>{let e=no(),t=s(c=>c.webAuthURLForCreate),o=s(c=>c.iFrameUrl),a=V(c=>c.getAuthInfo()),[n,r]=Ql(),i=()=>{r(t)},l=!!t&&!!o;return Ke(U,{$wide:!0,children:[Ke(M,{children:[ye(Y,{variant:"headingS",weight:"bold",children:l?"Secure Your Account":"Create Passkey"}),ye(ql,{...a}),ye(qr,{variant:"bodyS",color:"secondary",weight:"medium",children:l?"Choose a password or set up a passkey":"Your Passkey keeps your account safe."})]}),Ke(M,{children:[Kt()?Ke(cn,{fullWidth:!0,onClick:e.withPasskey,children:[ye(pn,{slot:"start",icon:"key"}),l?"Create Passkey":"Create"]}):Ke(Zr,{children:[ye(qr,{weight:"semiBold",children:"Scan with your mobile device"}),ye(fe,{children:t?ye(Xl,{url:t}):ye(zl,{size:100})}),Ke(cn,{size:"small",variant:"ghost",onClick:i,children:[ye(pn,{slot:"start",icon:n?"check":"copy"}),n?"Copied":"Copy Link"]})]}),l&&Ke(Zr,{children:[ye(Yl,{children:"or"}),Ke(cn,{fullWidth:!0,onClick:e.withPassword,children:[ye(pn,{slot:"start",icon:"passcode"}),"Choose Password"]})]})]})]})};import{jsx as Zl}from"react/jsx-runtime";var jr=()=>Zl(Ve,{heading:"Complete Login",subheading:"Follow the prompts presented by your browser."});import{EnabledFlow as ot,getOnRampAssets as mc,getOnRampNetworks as Cc,OnRampProvider as fc,OnRampPurchaseType as so,toAssetInfoArray as Ac,WalletType as An}from"@getpara/web-sdk";import{CpslButton as Sc,CpslDivider as Ec,CpslIcon as sa,CpslIdenticon as hc,CpslQrCode as Tc,CpslSpinner as la,CpslTab as Ic,CpslTabs as gc,CpslText as da}from"@getpara/react-components";import{useEffect as Sn,useMemo as ca}from"react";import{useState as tc}from"react";import{Network as _e,OnRampAsset as Re,OnRampMethod as De,OnRampProvider as dn}from"@getpara/core-sdk";var un="https://connect.getpara.com/",ea="https://getpara.com/terms",mn={[dn.STRIPE]:{name:"Stripe",feeLower:.99,feeUpper:4.49,methods:[De.ACH,De.DEBIT,De.CREDIT],icon:"stripeBrand",backgroundColors:["#6772E5","#808AF4"]},[dn.RAMP]:{name:"Ramp",feeLower:.99,feeUpper:4.49,methods:[De.ACH,De.DEBIT,De.CREDIT],icon:"rampNetworkBrand",backgroundColors:["#21BF73","#3AE492"]},[dn.MOONPAY]:{name:"MoonPay",feeLower:1,feeUpper:4.5,methods:[De.ACH,De.DEBIT,De.CREDIT],icon:"moonpayBrand",backgroundColors:["#7715F5","#9647fd"]}},Cn={[_e.ETHEREUM]:{name:"Ethereum",icon:"ethereum"},[_e.SEPOLIA]:{name:"Sepolia",icon:"ethereum"},[_e.ARBITRUM]:{name:"Arbitrum",icon:"arbitrumBrand"},[_e.BASE]:{name:"Base",icon:"baseBrand"},[_e.OPTIMISM]:{name:"Optimism",icon:"optimismBrand"},[_e.POLYGON]:{name:"Polygon",icon:"polygonBrand"},[_e.SOLANA]:{name:"Solana",icon:"solana"},[_e.COSMOS]:{name:"Cosmos",icon:"cosmos"},[_e.CELO]:{name:"Celo",icon:"celoBrand"},[_e.NOBLE]:{name:"Noble",icon:"nobleBrand"}},fn={[Re.ETHEREUM]:{name:"Ethereum",code:"ETH",icon:"ethereum"},[Re.USDC]:{name:"USDC",code:"USDC",icon:"usdcBrand"},[Re.POLYGON]:{name:"Polygon",code:"MATIC",icon:"polygonBrand"},[Re.SOLANA]:{name:"Solana",code:"SOL",icon:"solana"},[Re.ATOM]:{name:"Atom",code:"ATOM",icon:"cosmos"},[Re.CELO]:{name:"Celo",code:"CELO",icon:"celoBrand"},[Re.TETHER]:{name:"Tether",code:"USDT",icon:"tetherBrand"},[Re.CUSD]:{name:"Celo Dollar",code:"CUSD",icon:"celoBrand"},[Re.CEUR]:{name:"Celo Euro",code:"CEUR",icon:"celoBrand"},[Re.CREAL]:{name:"Celo Real",code:"CREAL",icon:"celoBrand"}};function Nt(e){return Cn[e]?.name??`${e[0]}${e.slice(1).toLowerCase()}`}function Jl(e){return Cn[e]?.icon??"globe"}function jl(e){return fn[e]?.code??e}function ec(e){return fn[e]?.icon??"emptyCircle"}var Ye=480,ro="network not supported",ta=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ao={enter:e=>({scale:e>0?.9:1.1,opacity:0}),center:{scale:1,opacity:1},exit:e=>({scale:e<0?.9:1.1,opacity:0})},io={duration:.2};import et from"styled-components";import{CpslButton as oc,CpslIcon as ra,CpslSpinner as nc,CpslText as rc}from"@getpara/react-components";import{motion as ac}from"framer-motion";import{jsx as Xe,jsxs as na}from"react/jsx-runtime";var aa=({config:e,index:t,onClick:o})=>{let[a,n]=tc(!1),r=e.providers[t],{feeLower:i,feeUpper:l,name:c,icon:d,backgroundColors:p}=mn[r],m=`Fee ${i}% - ${l}%`;return Xe(ic,{$gradientColors:p,fullWidth:!0,onClick:async()=>{n(!0),await o(),n(!1)},children:na(sc,{$backgroundColor:p[1],children:[Xe(pc,{children:Xe(ra,{icon:d})}),na(lc,{children:[Xe(oa,{variant:"bodyL",weight:"medium",children:c}),Xe(cc,{children:Xe(oa,{variant:"bodyXS",weight:"medium",children:m})})]}),a?Xe(nc,{size:16}):Xe(dc,{icon:"chevronUp"})]})})},ic=et(oc)`
|
|
135
135
|
width: 100%;
|
|
136
136
|
--button-primary-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[1]} 100%)`};
|
|
137
137
|
--button-primary-hover-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[0]} 100%)`};
|
|
138
138
|
--button-primary-active-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[0]} 100%)`};
|
|
139
|
-
`,
|
|
139
|
+
`,sc=et(ac.div)`
|
|
140
140
|
display: flex;
|
|
141
141
|
gap: 8px;
|
|
142
142
|
flex: 1;
|
|
@@ -145,16 +145,16 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
145
145
|
& cpsl-spinner {
|
|
146
146
|
--background-color: ${({$backgroundColor:e})=>`${e}`};
|
|
147
147
|
}
|
|
148
|
-
`,
|
|
148
|
+
`,lc=et.div`
|
|
149
149
|
flex: 1;
|
|
150
150
|
display: flex;
|
|
151
151
|
flex-direction: column;
|
|
152
152
|
align-items: start;
|
|
153
153
|
gap: 2px;
|
|
154
|
-
`,
|
|
154
|
+
`,cc=et.div`
|
|
155
155
|
display: flex;
|
|
156
156
|
gap: 16px;
|
|
157
|
-
`,
|
|
157
|
+
`,pc=et.span`
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: center;
|
|
160
160
|
justify-content: center;
|
|
@@ -162,19 +162,19 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
162
162
|
border-radius: 100%;
|
|
163
163
|
height: 48px;
|
|
164
164
|
width: 48px;
|
|
165
|
-
`,
|
|
165
|
+
`,oa=et(rc)`
|
|
166
166
|
&::part(text-element) {
|
|
167
167
|
color: #fff;
|
|
168
168
|
}
|
|
169
|
-
`,
|
|
169
|
+
`,dc=et(ra)`
|
|
170
170
|
transform: rotate(90deg);
|
|
171
171
|
--icon-color: #fff;
|
|
172
|
-
`;import{isMobile as
|
|
172
|
+
`;import{isMobile as yc}from"@getpara/web-sdk";import{useMemo as uc}from"react";function tt(){let e=N(),{selectedWallet:t}=pe();return uc(()=>e.findWallet(t.id,t.type,{forbidPregen:!0}),[e,t])}import{motion as xc,AnimatePresence as wc}from"framer-motion";import{getNetworkFromChainId as Wc,getNetworkOrMainNetEquivalent as _c,useCopyToClipboard as Rc}from"@getpara/react-common";import{format as bh}from"date-fns";var ia=e=>e.length===1?Nt(e[0]):`${e.map(t=>Nt(t)).slice(0,-1).join(", ")}${e.length>2?",":""} and ${Nt(e[e.length-1])}`;import En from"styled-components";import{Fragment as lo,jsx as j,jsxs as xe}from"react/jsx-runtime";var pa=[[ot.BUY,"isBuyEnabled","creditCard","Buy"],[ot.RECEIVE,"isReceiveEnabled","qrCode","Receive"],[ot.WITHDRAW,"isWithdrawEnabled","arrowCircleBrokenDownLeft","Withdraw"]],Lc={[An.EVM]:"Ethereum or EVM-based L2s",[An.SOLANA]:"Solana",[An.COSMOS]:"Cosmos"},ua=()=>{let[e,t]=Rc(),o=N(),a=W(T=>T.appName),n=s(T=>T.onRampConfig),r=W(T=>T.hideWallets),i=s(T=>T.accountAddFundTab),l=s(T=>T.setStep),c=s(T=>T.setOnRampPurchase),{chainId:d}=K(),p=tt(),m=pa.filter(([,T])=>!!n[T]),f=m.length>1,u=i??m[0][0],A=ca(()=>p?o.getDisplayAddress(p.id,{addressType:p.type}):"",[o,p?.id,p?.type]),E=T=>{l(ct(T.detail.tab))},h=()=>{t(A)},[D,I,v]=ca(()=>{if(!n||!p)return[[],[],{}];let T=u===ot.BUY?so.BUY:so.SELL,S=Wc(d),x=p.isExternal&&!!S?[_c(S,n.testMode)]:Cc(n.assetInfo,{walletType:p.type,allowed:n.allowedAssets?Object.keys(n.allowedAssets):void 0}),y=x.reduce((b,_)=>{let k=n.allowedAssets?.[_],z=k===!0?void 0:k;return{...b,[_]:mc(n.assetInfo,{walletType:p.type,network:_,allowed:z})}},{}),w=n.providers.reduce((b,_)=>{let k=Ac(n.assetInfo).some(([z,R,te,oe])=>z===p.type&&x.includes(R)&&(!y[R]||y[R].includes(te))&&!!oe[_]?.[1]?.[T]);return{...b,[_]:k}},{});return[x,[...new Set(Object.values(y).flat())],w]},[p?.type,p?.isExternal,u,n.assetInfo,n.allowedAssets,d]);return Sn(()=>{c(void 0)},[]),Sn(()=>{c(void 0)},[]),!n||!p?j(Mc,{children:j(la,{})}):(Sn(()=>{c(void 0)},[]),xe(U,{children:[f&&j(M,{children:j(gc,{selectedTab:u,onCpslTabsChanged:E,children:pa.map(([T,S,g,x])=>xe(Ic,{tab:T,children:[j(sa,{slot:"start",icon:g}),x]},T))})}),j(lo,{children:[ot.BUY,ot.WITHDRAW].includes(u)?xe(lo,{children:[j(Y,{variant:"headingS",weight:"bold",children:"Choose Provider"}),xe(Oc,{children:[xe(Nc,{isHidden:Object.values(v).some(T=>!!T),variant:"bodyM",children:["No providers are available for this ",r?"account":"wallet"]}),j(wc,{children:n.providers.map((T,S)=>v[T]?j(xc.div,{style:{width:"100%"},layout:!0,initial:{opacity:0,transform:"translateX(25px)"},animate:{opacity:1,transform:"none"},exit:{opacity:0,transform:"translateX(-25px)"},transition:{duration:.2},children:j(aa,{config:n,index:S,onClick:async()=>{if(!p?.type)return;let g=T!==fc.RAMP,{onRampPurchase:x}=await o.initiateOnRampTransaction({walletId:p.isExternal?void 0:p.id,externalWalletAddress:p.isExternal?p.id:void 0,shouldOpenPopup:g,params:{type:u===ot.BUY?so.BUY:so.SELL,walletType:p.type,provider:T,networks:D,assets:I,defaultNetwork:n.defaultOnRampNetwork,defaultAsset:n.defaultOnRampAsset,fiatQuantity:n.defaultBuyAmount?.[0],testMode:n.testMode}});c({...x,fiat:"USD"}),!g&&l("ADD_FUNDS_AWAITING")}},T)},T):null)})]})]}):xe(lo,{children:[j(M,{children:xe(Rt,{noAutoDisable:!0,readonly:!0,placeholder:A,children:[j(hc,{slot:"start",size:"32px",hash:o.getIdenticonHash(p.id,p.type)}),j(Sc,{slot:"end",variant:"ghost",onClick:h,children:j(sa,{icon:e?"check":"copy"})})]},A)}),!yc()&&xe(lo,{children:[j(Ec,{children:"or"}),xe(M,{children:[j(fe,{children:A?j(Tc,{url:A},A):j(la,{size:100})}),j(da,{weight:"semiBold",color:"secondary",children:"Scan with your crypto wallet"})]})]}),xe(M,{children:[xe(ae,{weight:"semiBold",children:[n.allowedAssets&&D.length>0||r?a??"This App":"This Wallet"," ","Only Supports:"]}),j(ae,{weight:"medium",color:"secondary",children:n.allowedAssets&&D.length>0?ia(D):Lc[p.type]})]})]})})]}))},Mc=En(U)`
|
|
173
173
|
margin: 50% 0;
|
|
174
|
-
`,
|
|
174
|
+
`,Oc=En(M)`
|
|
175
175
|
position: relative;
|
|
176
176
|
min-height: 270px;
|
|
177
|
-
`,
|
|
177
|
+
`,Nc=En(da)`
|
|
178
178
|
width: 100%;
|
|
179
179
|
text-align: center;
|
|
180
180
|
visibility: ${({isHidden:e})=>e?"hidden":"visible"};
|
|
@@ -183,9 +183,9 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
183
183
|
left: 0;
|
|
184
184
|
right: 0;
|
|
185
185
|
transition: visibility 0.2s;
|
|
186
|
-
`;import{OnRampProvider as hn}from"@getpara/web-sdk";import{lazy as
|
|
186
|
+
`;import{OnRampProvider as hn}from"@getpara/web-sdk";import{lazy as vc,useEffect as ma,useMemo as bc,useState as Dc}from"react";import{RampEmbed as Uc,StripeEmbed as Pc}from"@getpara/react-common";import Fc from"styled-components";import{jsx as co}from"react/jsx-runtime";var kc={CANCELLED:"ADD_FUNDS_FAILURE",FINISHED:"ADD_FUNDS_SUCCESS"},Ca=()=>{let e=s(f=>f.setStep),t=Ee(),o=s(f=>f.onRampConfig),a=s(f=>f.onRampPurchase),n=s(f=>f.setOnRampPurchase),r=N(),i=W(f=>f.appName),l=W(f=>f.isDark),[c,d]=Dc(null),p={para:r,appName:i,onRampConfig:o,onRampPurchase:a,isDark:l,isEmbedded:!0,setOnRampPurchase:n,onClose:t};ma(()=>{let f=vc(()=>import("./MoonPayEmbed-GAWXP6V7.js"));d(f)},[]);let m=bc(()=>{if(!a.id)return null;switch(a?.provider){case hn.STRIPE:return co(Pc,{...p});case hn.MOONPAY:return!c||typeof window>"u"?null:co(c,{...p});case hn.RAMP:return co(Uc,{apiKey:o.rampApiKey,...p})}},[a?.provider,c]);return ma(()=>{let f;return a?.status&&["CANCELLED","FINISHED"].includes(a.status)&&(f=setTimeout(()=>{e(kc[a.status])},5e3)),()=>clearTimeout(f)},[a?.status]),co(Bc,{$wide:!0,children:m})},Bc=Fc(U)`
|
|
187
187
|
flex: 1;
|
|
188
|
-
`;import{useMemo as
|
|
188
|
+
`;import{useMemo as Hc}from"react";import{CpslButton as Gc,CpslText as Vc}from"@getpara/react-components";import{jsx as po,jsxs as fa}from"react/jsx-runtime";var Tn=({isSuccess:e,onClose:t})=>{let o=W(p=>p.hideWallets),a=s(p=>p.setStep),n=s(p=>p.onRampPurchase),r=s(p=>p.accountAddFundTab),i=Hc(()=>new Intl.NumberFormat("en-US",{style:"currency",currency:n?.fiat||"USD"}),[n?.fiat]),l=e?"Transaction Successful":"Something Went Wrong",c=e?`${i.format(parseFloat(n?.fiatQuantity))} is now available in your ${o?"account":"wallet"}.`:`No funds were added to your ${o?"account":"wallet"}.`;return fa(U,{children:[po(Ge,{icon:"checkCircleFilled"}),fa(M,{children:[po(Y,{variant:"headingS",weight:"bold",children:l}),po(Vc,{variant:"bodyS",color:"secondary",children:c})]}),po(Gc,{fullWidth:!0,onClick:()=>{e?t():a(ct(r))},children:e?"Done":"Try Again"})]})};import{useEffect as Aa,useState as $c}from"react";import{CpslButton as Kc,CpslIcon as Yc,CpslQrCode as Xc,CpslSpinner as zc,CpslText as Qc}from"@getpara/react-components";import{AuthMethod as In,isMobile as qc}from"@getpara/web-sdk";import{Fragment as Jc,jsx as ze,jsxs as uo}from"react/jsx-runtime";var Zc=()=>{let e=V(E=>E.setAuthInfo),t=s(E=>E.setStep),o=s(E=>E.setWebAuthURLForCreate),a=s(E=>E.setIFrameUrl),n=s(E=>E.setIsIFrameReady),r=s(E=>E.isIFrameReady),i=s(E=>E.setSupportedAuthMethods),l=s(E=>E.setBiometricLocationHints),c=N(),d=s(E=>E.setFlow),p=s(E=>E.farcasterConnectUri),m=s(E=>E.setFarcasterConnectUri),f=W(E=>E.theme),[u,A]=$c();return Aa(()=>{u&&r&&setTimeout(()=>{t(u)},200)},[u,r]),Aa(()=>{if(p)return(async()=>{let{userExists:h,username:D,pfpUrl:I}=await c.waitForFarcasterStatus();if(e({farcasterUsername:D,pfpUrl:I}),h){let S=await c.initiateUserLoginV2({farcasterUsername:D});if(S.size>0){i(S);let g=S.has(In.PASSKEY)?await c.getUserBiometricLocationHints():[];d("login"),t("BIOMETRIC_LOGIN"),l(g);return}}let v=await c.getSupportedCreateAuthMethods();n(!1),d("signUp");let T=v.has(In.PASSKEY);T&&(o(await c.shortenLoginLink(await c.getSetUpBiometricsURL({authType:"farcaster"}))),t("BIOMETRIC_CREATION")),v.has(In.PASSWORD)&&(a(await c.shortenLoginLink(await c.getSetupPasswordURL({authType:"farcaster",theme:f}))),A(T?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))})(),()=>{m(void 0)}},[p]),ze(U,{$wide:!0,children:qc()?uo(M,{children:[ze(Qc,{weight:"medium",color:"secondary",children:"Don\u2019t have Farcaster"}),uo(Kc,{as:"a",href:"https://link.warpcast.com/download-qr",target:"_blank",variant:"secondary",children:[ze(Yc,{slot:"start",icon:"linkExternal"}),"Get Farcaster"]})]}):uo(Jc,{children:[ze(Y,{variant:"headingS",weight:"bold",children:"Sign in using Farcaster"}),uo(M,{children:[ze(ae,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan the QR code with your phone's camera to proceed."}),ze(fe,{children:p?ze(Xc,{url:p}):ze(zc,{size:100})})]})]})})},Sa=Zc;import{styled as ep}from"styled-components";import{useMemo as jc}from"react";var Ea=()=>{let e=W(r=>r.hideWallets),t=s(r=>r.isLogin()),o=s(r=>r.step),{chainId:a}=K();return{title:jc(()=>({AUTH_MAIN:"",AUTH_MORE:"Sign Up or Log In",EX_WALLET_MORE:"Connect Wallet",VERIFICATIONS:"Sign Up",AWAITING_OAUTH:t?"Login":"Sign Up",FARCASTER_OAUTH:t?"Login":"Sign Up",BIOMETRIC_CREATION:"Sign Up",PASSWORD_CREATION:"Sign Up",AWAITING_BIOMETRIC_CREATION:"Sign Up",AWAITING_WALLET_CREATION:t?"Login":"Sign Up",AWAITING_PASSWORD_CREATION:"Sign Up",WALLET_CREATION_DONE:e?"Account Created":"Wallet Created",SECRET:t?"Login":"Sign Up",BIOMETRIC_LOGIN:"Login",AWAITING_PASSWORD_LOGIN:"Login",AWAITING_BIOMETRIC_LOGIN:"Login",LOGIN_DONE:"",SETUP_2FA:"2FA",VERIFY_2FA:"2FA",TWO_FACTOR_DONE:"2FA",ADD_FUNDS_BUY:"",ADD_FUNDS_RECEIVE:"",ADD_FUNDS_WITHDRAW:"",ADD_FUNDS_AWAITING:"",ADD_FUNDS_SUCCESS:"",ADD_FUNDS_FAILURE:"",ACCOUNT_MAIN:"",CHAIN_SWITCH:""}),[t,a,e])[o]}};import{AnimatePresence as tp,motion as op}from"framer-motion";import{jsx as gn}from"react/jsx-runtime";var ha=()=>{let{title:e}=Ea(),t=s(a=>a.stepDirection),o=s(a=>a.step);return gn(tp,{mode:"popLayout",initial:!1,custom:t,children:gn(np,{custom:t,variants:ao,initial:"enter",animate:"center",exit:"exit",transition:io,slot:"header",id:"header",children:gn(ae,{weight:"semiBold",color:"secondary",children:e})},["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(o)?"ADD_FUNDS":o)})},np=ep(op.div)`
|
|
189
189
|
position: absolute;
|
|
190
190
|
top: 16px;
|
|
191
191
|
width: 100%;
|
|
@@ -195,7 +195,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
195
195
|
justify-content: space-between;
|
|
196
196
|
gap: 8px;
|
|
197
197
|
flex-wrap: wrap;
|
|
198
|
-
`;import
|
|
198
|
+
`;import qp from"styled-components";import{Fragment as Vp,useMemo as $p}from"react";import{CpslButton as Kp,CpslDivider as Yp,CpslIconGroup as Xp}from"@getpara/react-components";import To from"styled-components";import we from"styled-components";import{CpslButton as xn,CpslIcon as mo,CpslInput as rp,CpslText as bt}from"@getpara/react-components";import{useState as ap}from"react";var yn=e=>e.find(t=>t.includes("EXTERNAL")),vt=e=>e.find(t=>t.includes("AUTH"));import{Fragment as Cp,jsx as re,jsxs as Qe}from"react/jsx-runtime";var Ta=3,Co=()=>{let{wallets:e,connectExternalWallet:t}=K(),o=s(A=>A.setSelectedExternalWalletId),a=s(A=>A.setStep),n=s(A=>A.step==="EX_WALLET_MORE"),r=W(A=>A.authLayout),[i,l]=ap(""),c=e.length>Ta,d=n||!c?i?e.filter(A=>A.name.toLowerCase().includes(i.toLowerCase())):e:e.slice(0,Ta),p=!n&&c,m=()=>{a("EX_WALLET_MORE")},f=()=>{a("AUTH_MORE")},u=A=>()=>{o(A.id),a("EX_WALLET_SELECTED"),A.installed?t(A):A.isMobile&&t(A,!0)};return Qe(ip,{$maxHeight:n,children:[n&&Qe(Cp,{children:[re(dp,{children:re(up,{placeholder:"Search for your wallet",onCpslInput:async A=>{l(A.target.value)},value:i,style:{width:"100%"},children:re(pp,{slot:"start",icon:"search"})})}),vt(r)&&re(xn,{fullWidth:!0,variant:"tertiary",onClick:f,children:Qe(Ia,{children:[Qe(ga,{children:[re(mo,{slot:"start",icon:"paraIcon"}),re(bt,{weight:"medium",children:"Para"})]}),re(ya,{$show:!0,$variant:"installed",children:re(bt,{variant:"body2XS",weight:"medium",children:"Available"})})]})})]}),d.map(A=>n?re(xn,{fullWidth:!0,variant:"tertiary",onClick:u(A),children:Qe(Ia,{children:[Qe(ga,{children:[re(mo,{slot:"start",src:A.iconUrl}),re(bt,{weight:"medium",children:A.name})]}),re(ya,{$show:A.isMobile||A.installed,$variant:A.installed?"installed":"mobile",children:re(bt,{variant:"body2XS",weight:"medium",children:A.installed?"Installed":"Mobile"})})]})},A.id):re(sp,{src:A.iconUrl,onClick:u(A),children:Qe(cp,{children:[A.installed&&re(lp,{}),re(bt,{variant:"bodyXS",color:"secondary",weight:"medium",children:A.name})]})},A.id)),p&&Qe(xn,{variant:"tertiary",fullWidth:!0,onClick:m,children:[re(mo,{slot:"start",icon:"wallet"}),"More Wallets"]}),n&&re(mp,{})]})},ip=we.div`
|
|
199
199
|
position: relative;
|
|
200
200
|
display: flex;
|
|
201
201
|
justify-content: center;
|
|
@@ -210,15 +210,15 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
210
210
|
}
|
|
211
211
|
-ms-overflow-style: none;
|
|
212
212
|
scrollbar-width: none;
|
|
213
|
-
`,
|
|
213
|
+
`,sp=we(He)`
|
|
214
214
|
flex: 1;
|
|
215
|
-
`,
|
|
215
|
+
`,Ia=we.div`
|
|
216
216
|
width: 100%;
|
|
217
217
|
display: flex;
|
|
218
218
|
align-items: center;
|
|
219
219
|
gap: 8px;
|
|
220
220
|
justify-content: space-between;
|
|
221
|
-
`,
|
|
221
|
+
`,ga=we.div`
|
|
222
222
|
display: flex;
|
|
223
223
|
align-items: center;
|
|
224
224
|
gap: 8px;
|
|
@@ -231,7 +231,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
231
231
|
color: var(--cpsl-color-contrast);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
`,
|
|
234
|
+
`,ya=we.div`
|
|
235
235
|
visibility: ${({$show:e})=>e?"visible":"hidden"};
|
|
236
236
|
padding: 2px 4px;
|
|
237
237
|
border-radius: 4px;
|
|
@@ -242,18 +242,18 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
242
242
|
color: ${({$variant:e})=>e==="installed"?"var(--cpsl-color-utility-green)":"var(--cpsl-color-text-primary)"};
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
`,
|
|
245
|
+
`,lp=we.span`
|
|
246
246
|
width: 8px;
|
|
247
247
|
height: 8px;
|
|
248
248
|
border-radius: 100%;
|
|
249
249
|
background-color: var(--cpsl-color-utility-green);
|
|
250
|
-
`,
|
|
250
|
+
`,cp=we.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
gap: 4px;
|
|
253
253
|
align-items: center;
|
|
254
|
-
`,
|
|
254
|
+
`,pp=we(mo)`
|
|
255
255
|
--icon-color: var(--cpsl-color-contrast);
|
|
256
|
-
`,
|
|
256
|
+
`,dp=we.div`
|
|
257
257
|
width: 100%;
|
|
258
258
|
background-color: var(--cpsl-color-background-0);
|
|
259
259
|
|
|
@@ -261,11 +261,11 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
261
261
|
top: 0;
|
|
262
262
|
padding-bottom: 4px;
|
|
263
263
|
margin-bottom: -4px;
|
|
264
|
-
`,
|
|
264
|
+
`,up=we(rp)`
|
|
265
265
|
width: 100%;
|
|
266
266
|
--container-background-color: var(--cpsl-color-background-8);
|
|
267
267
|
--input-background-color: var(--cpsl-color-background-8);
|
|
268
|
-
`,
|
|
268
|
+
`,mp=we.div`
|
|
269
269
|
position: sticky;
|
|
270
270
|
height: 56px;
|
|
271
271
|
width: 100%;
|
|
@@ -273,16 +273,16 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
273
273
|
|
|
274
274
|
background: linear-gradient(0deg, var(--cpsl-color-background-0) 0%, rgba(234, 239, 211, 0) 100%);
|
|
275
275
|
pointer-events: none;
|
|
276
|
-
`;var
|
|
276
|
+
`;var fo={GOOGLE:"googleBrand",TWITTER:"twitter",APPLE:"apple",DISCORD:"discordBrand",FACEBOOK:"facebookBrand",FARCASTER:"farcasterBrand",TELEGRAM:"telegramBrand"},Ao={GOOGLE:"google",TWITTER:"twitter",APPLE:"apple",DISCORD:"discord",FACEBOOK:"facebook",FARCASTER:"farcaster",TELEGRAM:"telegram"};import{useMemo as kp}from"react";import Bp from"styled-components";import{AuthMethod as Sp,OAuthMethod as wn}from"@getpara/web-sdk";import{styled as Ra}from"styled-components";var xa=(e,t)=>{if(t<2)return"1 1 auto";if(t%3===0)return`0 0 calc(33.333333% - ${5.336}px)`;if(t%3===1)return e<4?"0 0 calc(50% - 4px)":`0 0 calc(33.333333% - ${5.336}px)`;if(t%3===2)return e<2?"0 0 calc(50% - 4px)":`0 0 calc(33.333333% - ${5.336}px)`};import{useEffect as Ep}from"react";import{isAndroid as fp,isMobile as Ap,isTelegram as wa}from"@getpara/web-sdk";var nt=e=>{if(!(typeof window>"u")&&Ap()){if(!e)return;if(!wa()&&e.startsWith("http")){let t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noreferrer noopener",t.click()}else if(wa()){let t=e;fp()&&(t=encodeURI(e)),window.open(t,"_blank","noreferrer noopener")}else window.location.href=e}};import{jsx as _a,jsxs as Tp}from"react/jsx-runtime";var Dt=3,La=({methods:e})=>{let t=Ee(),o=W(S=>S.oAuthLogoVariant),a=W(S=>S.isDark),n=N(),r=s(S=>S.refs),i=s(S=>S.setFlow),l=s(S=>S.setStep),c=V(S=>S.setAuthInfo),d=s(S=>S.setSupportedAuthMethods),p=s(S=>S.setBiometricLocationHints),m=s(S=>S.setFarcasterConnectUri),f=s(S=>S.farcasterConnectUri),u=s(S=>S.step==="AUTH_MORE");Ep(()=>{(async()=>{if(!e.includes(wn.FARCASTER))return;let g=await n.getFarcasterConnectURL();m(g)})()},[]);let A=e.length>Dt,E=u||!A?e:e.slice(0,Dt-1),h=()=>{l("AUTH_MORE")},D=S=>async()=>{switch(S){case wn.FARCASTER:if(!f)return;nt(f),l("FARCASTER_OAUTH");break;case wn.TELEGRAM:l("TELEGRAM_OAUTH");break;default:l("AWAITING_OAUTH");let g=await n.getOAuthURL({method:S});r.popupWindow.current=Ze({url:g,target:`${S}AuthPopup`,type:"OAUTH",current:r.popupWindow.current});let{email:x,isError:y,userExists:w}=await n.waitForOAuth({popupWindow:r.popupWindow.current});if(r.popupWindow.current=void 0,(y||!x)&&r.currentStep.current==="AWAITING_OAUTH"){t();return}if(c({email:x}),w){let b=await n.initiateUserLoginV2({email:x});if(b.size>0){let _=b.has(Sp.PASSKEY)?await n.getUserBiometricLocationHints():[];i("login"),l("BIOMETRIC_LOGIN"),d(b),p(_);return}}i("signUp"),l("BIOMETRIC_CREATION");break}},I=o==="default",v=I?a:o!=="dark",T=!u&&A;return Tp(hp,{children:[E.map((S,g)=>_a(Wa,{$isDark:v,icon:I?fo[S]:Ao[S],onClick:D(S),$index:g,$totalItems:T?Dt:E.length},S)),T&&_a(Wa,{$isDark:v,icon:"moreLoginOptions",onClick:h,$index:Dt-1,$totalItems:Dt})]})},hp=Ra.div`
|
|
277
277
|
display: flex;
|
|
278
278
|
justify-content: center;
|
|
279
279
|
gap: 8px;
|
|
280
280
|
flex-wrap: wrap;
|
|
281
|
-
`,
|
|
282
|
-
flex: ${({$index:e,$totalItems:t})=>
|
|
281
|
+
`,Wa=Ra(He)`
|
|
282
|
+
flex: ${({$index:e,$totalItems:t})=>xa(e,t)};
|
|
283
283
|
|
|
284
284
|
--button-icon-color: ${({$isDark:e})=>e?"white":"black"};
|
|
285
|
-
`;import{CpslButton as
|
|
285
|
+
`;import{CpslButton as _p,CpslIcon as _n,CpslInput as Rp,CpslSelect as Lp,CpslSelectItem as Mp,CpslSpinner as Op,CpslText as So}from"@getpara/react-components";import{useRef as Np,useState as rt}from"react";import kt from"styled-components";import{getCountries as Ip,getCountryCallingCode as gp}from"libphonenumber-js";var yp=["AC","CG","CI","CV","GF","GP","MF","NC","PM","RE","SD","SH","SJ","TA","VA","WF","XK","YT"],xp=()=>Ip().filter(o=>!yp.includes(o)).map(o=>{let a=gp(o);return{label:new Intl.DisplayNames(["en"],{type:"region"}).of(o),value:`+${a}`,selectedLabel:o,icon:o}}).sort((o,a)=>o.label.localeCompare(a.label)),wp=xp(),Ut=wp;import{useEffect as Wp,useState as Wn}from"react";var Pt=e=>{let[t,o]=Wn(),[a,n]=Wn(),[r,i]=Wn(),l=()=>{if(typeof window<"u"){let c=Math.max(window.innerHeight-e?.current?.getBoundingClientRect().bottom-20,window.innerHeight*.25);o(c),n(e?.current?.getBoundingClientRect().width),i(e?.current?.getBoundingClientRect().height)}};return e.current&&!t&&l(),Wp(()=>(typeof window<"u"&&window.addEventListener("resize",l),()=>{typeof window<"u"&&window.removeEventListener("resize",l)}),[]),{dropdownMaxHeight:t,dropdownWidth:a,mobileAnchor:r,resize:l}};var Ma="#################",Oa={AF:"### ### ####",AX:"## ### ####",AL:"(###) ### ###",DZ:"(###) ### ###",AS:"(###) ###-####",AD:"### ###",AO:"(###) ### ###",AI:"(###) ###-####",AG:"(###) ###-####",AR:"(###) ###-####",AM:"## ### ###",AW:"### ####",AU:"# #### ####",AT:"(###) ### ####",AZ:"(###) ### ## ##",BS:"(###) ###-####",BH:"#### ####",BD:"# ### ###",BB:"(###) ###-####",BY:"(##) ###-##-##",BE:"(###) ### ###",BZ:"###-####",BJ:"##-##-####",BM:"(###) ###-####",BT:"# ### ###",BO:"# ### ####",BA:"## ###-###",BW:"## ### ###",BR:"(##) ####-####",IO:"### ####",BN:"### ####",BG:"(###) ### ###",BF:"## ## ####",BI:"## ## ####",KH:"## ### ###",CM:"#### ####",CA:"(###) ###-####",CV:"(###) ## ##",KY:"(###) ###-####",CF:"## ## ####",TD:"## ## ## ##",CL:"# #### ####",CN:"(###) #### ####",CX:"# ## ## ##",CC:"# ## ## ##",CO:"(###) ### ####",KM:"## ## ## ##",CG:"## ### ####",CK:"## ###",CR:"#### ####",HR:"## #### ###",CU:"# ### ####",CY:"## ### ###",CZ:"### ### ###",CD:"### ### ###",DK:"## ## ## ##",DJ:"## ## ## ##",DM:"(###) ###-####",DO:"(###) ###-####",EC:"## ### ####",EG:"# #### ####",SV:"#### ####",GQ:"## ### ####",ER:"# ### ###",EE:"#### ####",SZ:"#### ####",ET:"## ### ####",FK:"#####",FO:"######",FJ:"### ####",FI:"## ### ####",FR:"## ## ## ## ##",GF:"### ## ## ##",PF:"## ## ##",GA:"# ## ## ##",GM:"### ####",GE:"(###) ## ## ##",DE:"(###) ### ####",GH:"## ### ####",GI:"### #####",GR:"(###) ### ####",GL:"## ## ##",GD:"(###) ###-####",GP:"### ## ## ##",GU:"(###) ###-####",GT:"# ### ####",GG:"(####) ### ###",GN:"## ### ###",GW:"# #######",GY:"### ####",HT:"## ## ####",VA:"### ####",HN:"####-####",HK:"#### ####",HU:"(##) ### ####",IS:"### ####",IN:"####### ###",ID:"(###) ###-####",IR:"(###) ### ####",IQ:"(###) ### ####",IE:"(###) ### ###",IM:"(####) ### ###",IL:"#-###-####",IT:"(###) #### ###",CI:"## ## ## ##",JM:"(###) ###-####",JP:"(###) ###-####",JE:"(####) ### ###",JO:"# #### ####",KZ:"(###) ###-##-##",KE:"### ######",KI:"## ###",KP:"###-###-####",KR:"(###) ####-####",XK:"## ### ###",KW:"#### ####",KG:"(###) ###-###",LA:"## ## ####",LV:"## ### ###",LB:"## ### ###",LS:"# ### ####",LR:"## ### ###",LY:"##-#######",LI:"(###) ###-####",LT:"(###) ## ###",LU:"### ### ###",MO:"#### ####",MG:"## ## ### ##",MW:"# #### ####",MY:"(###) ###-###",MV:"###-####",ML:"## ## ####",MT:"#### ####",MH:"###-####",MQ:"### ## ## ##",MR:"## ## ####",MU:"### ####",YT:"### ## ## ##",MX:"(###) ###-####",FM:"### ####",MD:"#### ####",MC:"(###) ###-###",MN:"## ## ####",ME:"## ### ###",MS:"(###) ###-####",MA:"#-####-####",MZ:"## ### ####",MM:"# ### ####",NA:"## ### ####",NR:"### ####",NP:"#-######",NL:"## ### ####",NC:"##.##.##",NZ:"## ### ###",NI:"#### ####",NE:"## ## ## ##",NG:"## ### ####",NU:"####",NF:"### ###",MK:"## ### ###",MP:"(###) ###-####",NO:"### ## ###",OM:"#### ####",PK:"(###) #######",PW:"### ####",PS:"## ### ####",PA:"####-####",PG:"(###) ## ###",PY:"## ### ####",PE:"(###) ### ###",PH:"(###) ###-####",PN:"### ####",PL:"### ### ###",PT:"## ### ####",PR:"(###) ###-####",QA:"#### ####",RE:"##### ####",RO:"## ### ####",RU:"(###) ###-##-##",RW:"(###) ### ###",BL:"### ## ## ##",SH:"####",KN:"(###) ###-####",LC:"(###) ###-####",MF:"### ## ## ##",PM:"## ## ##",VC:"(###) ###-####",WS:"####",SM:"(####) ######",ST:"## ####",SA:"# ### ####",SN:"## ### ####",RS:"## ### ####",SC:"# ### ###",SL:"## ######",SG:"#### ####",SX:"(###) ###-####",SK:"(###) ### ###",SI:"## ### ###",SB:"### ####",SO:"# ### ###",ZA:"## ### ####",GS:"####",SS:"# ### ####",ES:"### ### ###",LK:"## ### ####",SD:"## ### ####",SR:"###-####",SJ:"### ## ###",SE:"## ### ####",CH:"## ### ####",SY:"## #### ###",TW:"#### ####",TJ:"## ### ####",TZ:"## ### ####",TH:"# #### ####",TL:"#### ####",TG:"## ## ## ##",TK:"####",TO:"####",TT:"(###) ###-####",TN:"## ### ###",TR:"(###) ### ####",TM:"# ### ###",TC:"(###) ###-####",TV:"####",UG:"## ### ####",UA:"## ### ####",AE:"# ### ####",GB:"#### ### ###",US:"(###) ###-####",UM:"(###) ###-####",UY:"# ### ## ##",UZ:"## ### ####",VU:"## ####",VE:"###-###-####",VN:"## #### ###",VG:"(###) ###-####",VI:"(###) ###-####",WF:"## ####",EH:"###-###-###",YE:"# ### ###",ZM:"## ### ####",ZW:"# #######"};import{AuthMethod as Na}from"@getpara/web-sdk";import{jsx as Le,jsxs as Ft}from"react/jsx-runtime";var vp={label:"United States",value:"+1",selectedLabel:"US",icon:"US"},va=({disableEmailLogin:e,disablePhoneLogin:t})=>{let o=Np(null),{dropdownMaxHeight:a,dropdownWidth:n}=Pt(o),r=N(),i=V(C=>C.setAuthInfo),l=V(C=>C.getAuthInfo()),c=s(C=>C.setFlow),d=s(C=>C.setStep),p=s(C=>C.setSupportedAuthMethods),m=s(C=>C.setBiometricLocationHints),[f,u]=rt(l?.authType==="phone"?l.auth.countryCode:"+1"),[A,E]=rt(!l||["telegram","farcaster"].includes(l.authType)?"":l.authType!=="phone"?l.identifier:l.auth.phone),[h,D]=rt(l&&(l.authType==="email"||l.authType==="phone")?l.authType:void 0),[I,v]=rt(vp),[T,S]=rt(!1),[g,x]=rt(""),[y,w]=rt(""),b=h==="email",_=h==="phone",k=!h,z=y?Ut.filter(C=>C.selectedLabel.toLowerCase().includes(y.toLowerCase())||C.label.toLowerCase().includes(y.toLowerCase())||C.value.toLowerCase().includes(y.toLowerCase())):Ut,R=C=>{w(C.detail)},te=C=>{let B=C.detail.value,H=!1,q=!1;if(!t){let P=Ut.find(ce=>ce.value===B);if(P){u(P.value),v(P),D("phone"),E("");return}H=!b&&_?/\d+$/.test(B):/\d\d\d+$/.test(B)}e||(q=/\D.*$/.test(B)),D(q?"email":H?"phone":void 0),E(B)},oe=C=>{let B=Ut.find(H=>H.selectedLabel===C.detail);u(B.value),v(B)},We=async()=>{if(x(""),k){x("Please enter a valid email or phone number!");return}let C;if(b){if(!ta.test(A)){x("Please enter a valid email!");return}if(await r.logout(),C={email:A},i(C),await r.checkIfUserExists({email:A})){let H=await r.initiateUserLoginV2(C),q=H.has(Na.PASSKEY)?await r.getUserBiometricLocationHints():[];c("login"),d("BIOMETRIC_LOGIN"),p(H),m(q);return}await r.createUser(C),c("signUp"),d("VERIFICATIONS");return}if(_){await r.logout();let B=!1;try{B=await r.checkIfUserExistsByPhone({phone:A,countryCode:f})}catch{x("Please enter a valid phone number!");return}if(C={phone:A,countryCode:f},i(C),B){let H=await r.initiateUserLoginV2(C),q=H.has(Na.PASSKEY)?await r.getUserBiometricLocationHints():[];c("login"),d("BIOMETRIC_LOGIN"),p(H),m(q);return}await r.createUserByPhone(C),c("signUp"),d("VERIFICATIONS");return}},$=async()=>{S(!0),await We(),S(!1)};return e&&t?null:Le("form",{onSubmit:async C=>{C.preventDefault(),await $()},children:Ft(Fp,{ref:o,id:"authInput",placeholder:b||t?"Enter email":_||e?"Enter phone":"Enter email or phone",onCpslInput:te,value:A,errorText:g,autofocus:!0,inputMode:"email",onKeyDown:async C=>C.key==="Enter"&&$(),contrastText:!0,isPhone:_,mask:h==="phone"?Oa[I.selectedLabel]??Ma:void 0,enterkeyhint:"go",noAutoDisable:!0,disabled:T,"data-testid":"auth-input",children:[Ft(bp,{slot:"start",children:[!e&&(k||b)&&Le(_n,{"aria-label":"email",icon:"mail"}),!t&&k&&Le(_n,{"aria-label":"phone",icon:"phone"}),_&&Ft(Dp,{selectedValue:I.selectedLabel,onCpslSelectValueChange:oe,showFormattedSelectedItem:!0,autoWidth:!0,dropdownMaxHeight:a,anchorElId:"authInput",$width:n,showSearch:!0,searchPlaceholder:"Search Countries",onCpslSearchChange:R,"data-testid":"country-code-select",children:[I&&Ft(Pp,{slot:"selected-item",children:[Le(So,{children:I.selectedLabel}),Le(So,{children:I.value})]}),z.map(C=>Ft(Up,{slot:"items",value:C.selectedLabel,children:[Le(So,{children:C.label}),Le(So,{children:C.value})]},C.selectedLabel))]})]}),A&&Le(_p,{slot:"end",size:"small",fullWidth:!0,disabled:T,onClick:$,children:T?Le(Op,{size:16}):Le(_n,{icon:"arrowNarrow"})})]},"email")})},bp=kt.div`
|
|
286
286
|
height: 100%;
|
|
287
287
|
display: flex;
|
|
288
288
|
align-items: center;
|
|
@@ -293,7 +293,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
293
293
|
& cpsl-icon {
|
|
294
294
|
--icon-color: var(--cpsl-color-contrast);
|
|
295
295
|
}
|
|
296
|
-
`,
|
|
296
|
+
`,Dp=kt(Lp)`
|
|
297
297
|
--container-height: 100%;
|
|
298
298
|
--container-padding-start: 0px;
|
|
299
299
|
--container-padding-end: 0px;
|
|
@@ -307,7 +307,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
&::part(popover) {
|
|
310
|
-
@media (max-width: ${
|
|
310
|
+
@media (max-width: ${Ye}px) {
|
|
311
311
|
top: unset !important;
|
|
312
312
|
bottom: 16px;
|
|
313
313
|
}
|
|
@@ -317,76 +317,76 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
317
317
|
bottom: 16px;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
`,
|
|
320
|
+
`,Up=kt(Mp)`
|
|
321
321
|
&::part(inner-container) {
|
|
322
322
|
justify-content: space-between;
|
|
323
323
|
}
|
|
324
|
-
`,
|
|
324
|
+
`,Pp=kt.div`
|
|
325
325
|
display: flex;
|
|
326
326
|
gap: 4px;
|
|
327
327
|
align-items: center;
|
|
328
|
-
`,
|
|
328
|
+
`,Fp=kt(Rp)`
|
|
329
329
|
--container-background-color: var(--cpsl-color-background-8);
|
|
330
330
|
--input-background-color: var(--cpsl-color-background-8);
|
|
331
331
|
--container-padding-end: 8px;
|
|
332
|
-
`;import{Fragment as
|
|
332
|
+
`;import{Fragment as Gp,jsx as Eo}from"react/jsx-runtime";var ho=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=K(),n=s(i=>i.step==="AUTH_MORE"),r=kp(()=>{let i=[];return e?.length&&i.push(Eo(La,{methods:e},"oAuth")),(!t||!o)&&i.push(Eo(va,{disableEmailLogin:t,disablePhoneLogin:o},"input")),Eo(Gp,{children:i})},[n,e,t,o,a]);return Eo(Hp,{children:r})},Hp=Bp.div`
|
|
333
333
|
display: flex;
|
|
334
334
|
flex-direction: column;
|
|
335
335
|
gap: 8px;
|
|
336
|
-
`;import{Fragment as
|
|
336
|
+
`;import{Fragment as Qp,jsx as Ue,jsxs as Rn}from"react/jsx-runtime";var Ua=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=K(),n=W(u=>u.authLayout),r=s(u=>u.setStep),i=W(u=>u.oAuthLogoVariant),l=W(u=>u.isDark),c=i==="default",d=c?l:i!=="dark",p=()=>{r("AUTH_MORE")},m=()=>{r("EX_WALLET_MORE")},f=$p(()=>{let u=[];return n.forEach(A=>{switch(A){case"AUTH:FULL":{u.push([Ue(ho,{oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o},"authFull"),A]);break}case"AUTH:CONDENSED":{let E=[];e?.forEach(h=>E.push(c?fo[h]:Ao[h])),u.push([Rn(Da,{onClick:p,variant:"tertiary",fullWidth:!0,children:[Ue(ba,{slot:"start",icons:[],$isDark:d}),"Sign Up or Login",Ue(Ln,{slot:"end",icons:E.splice(0,3),$isDark:d})]},"authCondensed"),A]);break}case"EXTERNAL:FULL":{a.length&&u.push([Ue(Co,{},"externalWallets"),A]);break}case"EXTERNAL:CONDENSED":{let E=[];a?.forEach(h=>E.push(h.iconUrl)),u.push([Rn(Da,{onClick:m,variant:"tertiary",fullWidth:!0,children:[Ue(ba,{slot:"start",icons:[],$isDark:d}),"Connect Wallet",Ue(Ln,{slot:"end",icons:E.splice(0,3),$isDark:d})]},"authCondensed"),A]);break}default:break}}),Ue(Qp,{children:u.map(([A,E],h)=>Rn(Vp,{children:[A,u.length>1&&h<u.length-1&&Ue(Yp,{children:"or"},"or")]},E))})},[e,t,o,a,n]);return Ue(zp,{"data-testid":"main-auth-step-content",children:f})},zp=To.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 8px;
|
|
340
|
-
`,Ln=
|
|
340
|
+
`,Ln=To(Xp)`
|
|
341
341
|
--icon-item-color: ${({$isDark:e})=>e?"white":"black"};
|
|
342
342
|
flex: 1;
|
|
343
343
|
justify-content: flex-end;
|
|
344
|
-
`,
|
|
344
|
+
`,ba=To(Ln)`
|
|
345
345
|
visibility: hidden;
|
|
346
|
-
`,
|
|
346
|
+
`,Da=To(Kp)`
|
|
347
347
|
--button-justify-content: space-between;
|
|
348
348
|
|
|
349
349
|
&::part(button-native) {
|
|
350
350
|
max-height: 50px;
|
|
351
351
|
}
|
|
352
|
-
`;import{Fragment as
|
|
352
|
+
`;import{Fragment as Jp,jsx as Mn,jsxs as jp}from"react/jsx-runtime";var Pa=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let a=W(d=>d.getLogo()),n=W(d=>d.appName),r=W(d=>d.authLayout),i=W(d=>d.embeddedModal),c=r[0].split(":")[0]==="AUTH"?"Sign Up or Login":"Connect Wallet";return jp(Jp,{children:[a&&Mn(Zp,{src:a,alt:`${n?`${n} -`:""}logo`}),!i&&Mn(ae,{variant:a?"bodyM":"headingS",weight:"semiBold",children:c}),Mn(Ua,{disableEmailLogin:t,disablePhoneLogin:o,oAuthMethods:e})]})},Zp=qp.img`
|
|
353
353
|
height: 100px;
|
|
354
354
|
max-width: 260px;
|
|
355
355
|
object-fit: contain;
|
|
356
356
|
box-sizing: content-box;
|
|
357
357
|
align-self: center;
|
|
358
|
-
`;import bn from"styled-components";import{CpslButton as
|
|
358
|
+
`;import bn from"styled-components";import{CpslButton as ed,CpslIcon as td,CpslSpinner as Fa,CpslText as On}from"@getpara/react-components";import{useState as od}from"react";import{Fragment as ka,jsx as he,jsxs as vn}from"react/jsx-runtime";var Ba=({onClose:e})=>{let t=s(u=>u.onRampConfig),o=s(u=>u.setStep),a=W(u=>u.hideWallets),{disconnectExternalWallet:n}=K(),r=N(),[i,l]=od(!1),c=!!t,d=()=>{o("ADD_FUNDS_BUY")},p=()=>{o("ADD_FUNDS_RECEIVE")},m=()=>{o("ADD_FUNDS_WITHDRAW")},f=async()=>{l(!0),await r.logout(),await n(),e(),o("AUTH_MAIN"),l(!1)};return he(U,{$wide:!0,children:vn(M,{children:[he(nd,{children:c?vn(ka,{children:[t.isBuyEnabled&&he(Nn,{icon:"creditCard",onClick:d,children:he(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Buy Crypto"})}),t.isReceiveEnabled&&he(Nn,{icon:"qrCode02",onClick:p,children:he(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Receive"})}),t.isWithdrawEnabled&&he(Nn,{icon:"arrowCircleBrokenDownLeft",onClick:m,children:he(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Withdraw"})})]}):he(Fa,{})}),he(rd,{variant:"destructive",fullWidth:!0,onClick:f,disabled:i,children:i?he(Fa,{size:16}):vn(ka,{children:[a?"Logout":"Disconnect Wallet",he(td,{icon:"logOut",slot:"end"})]})})]})})},nd=bn.div`
|
|
359
359
|
display: flex;
|
|
360
360
|
align-items: center;
|
|
361
361
|
justify-content: center;
|
|
362
362
|
gap: 8px;
|
|
363
363
|
width: 100%;
|
|
364
364
|
height: 88px;
|
|
365
|
-
`,Nn=bn(
|
|
365
|
+
`,Nn=bn(He)`
|
|
366
366
|
flex: 1;
|
|
367
367
|
|
|
368
368
|
--button-icon-color: var(--cpsl-color-text-primary);
|
|
369
|
-
`,
|
|
369
|
+
`,rd=bn(ed)`
|
|
370
370
|
--button-border-width: 0px;
|
|
371
|
-
`;import{CpslButton as
|
|
371
|
+
`;import{CpslButton as Io,CpslIcon as go,CpslQrCode as ad,CpslSpinner as id,CpslText as Dn}from"@getpara/react-components";import{useEffect as Ha,useMemo as sd}from"react";import at from"styled-components";import{useCopyToClipboard as ld}from"@getpara/react-common";import{isMobile as Ga,isTablet as cd,WalletType as Va}from"@getpara/web-sdk";import{Fragment as Un,jsx as X,jsxs as Me}from"react/jsx-runtime";var za=()=>{let[e,t]=ld(),o=s(m=>m.externalWalletError),a=s(m=>m.setStep),{connectExternalWallet:n,wallet:r,qrUri:i,walletDisplayHelpers:l}=K();Ha(()=>{nt(i)},[i]);let c=async()=>{await n(r)},d=()=>{t(i)},p=sd(()=>{if(!r)return null;let m=r.id==="walletConnect";Ga()&&m&&M;let{showExtension:u,showMobile:A,isSolanaMobileIOS:E}=l;if(!A&&!u||E&&!r.installed){let h=E?`Solana wallets aren't available on mobile IOS browsers.
|
|
372
372
|
|
|
373
|
-
Please continue in the wallet app.`:`${
|
|
373
|
+
Please continue in the wallet app.`:`${r.name} isn't supported on mobile devices.
|
|
374
374
|
|
|
375
|
-
Please choose another wallet or continue on desktop.`;return
|
|
375
|
+
Please choose another wallet or continue on desktop.`;return X(M,{children:X($a,{weight:"semiBold",children:h})})}if(u){let h=r.installed;return Me(M,{children:[h&&!o?.length?X(ae,{color:"contrast",weight:"semiBold",children:`Confirm connection request in the ${r.name} browser extension.`}):Me(dd,{children:[X(ud,{icon:"alertCircle"}),X(Dn,{weight:"semiBold",color:"error",children:h?o?.[0]:`${r.name} not detected`})]}),Me(Io,{as:h?"button":"a",href:r.downloadUrl??"",target:"_blank",variant:"secondary",onClick:c,children:[X(go,{slot:"start",icon:h?"refresh":"linkExternal"}),h?"Try Again":`Get ${r.name}`]})]})}if(A){if(r.type===Va.SOLANA||Ga()&&!cd()){let I=r.type!==Va.SOLANA||r.installed;return Me(Un,{children:[X(M,{children:!I&&X(Dn,{weight:"semiBold",color:"error",children:`${r.name} not detected`})}),r.id!=="walletConnect"&&Me(M,{children:[X(Io,{onClick:()=>nt(i),fullWidth:!0,children:"Connect Wallet"}),X(Xa,{href:r.downloadUrl??"",target:"_blank",children:Me(Ka,{variant:"secondary",children:[`Get ${r.name}`,X(Ya,{icon:"linkExternal"})]})})]})]})}let D=Me(Ka,{variant:"secondary",onClick:m?async()=>{await n(r,!0,!0)}:void 0,children:[`${m?"Open":"Get"} ${r.name}`,X(Ya,{icon:"linkExternal"})]});return Me(Un,{children:[Me(M,{children:[X(Dn,{weight:"semiBold",children:"Scan with your mobile device"}),X(fe,{children:i?X(ad,{url:i,imageSrc:r.iconUrl}):X(id,{size:100})}),Me(Io,{size:"small",variant:"ghost",onClick:d,children:[X(go,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]}),X(M,{children:m?X(Un,{children:D}):X(Xa,{href:r.downloadUrl??"",target:"_blank",children:D})})]})}},[r,l,o,i]);return Ha(()=>{r||a("AUTH_MAIN")},[r]),r?X(pd,{children:p}):null},pd=at(U)`
|
|
376
376
|
flex: 1;
|
|
377
377
|
justify-content: space-between;
|
|
378
|
-
`,
|
|
378
|
+
`,dd=at.div`
|
|
379
379
|
display: flex;
|
|
380
380
|
align-items: center;
|
|
381
381
|
justify-content: center;
|
|
382
382
|
gap: 4px;
|
|
383
|
-
`,
|
|
383
|
+
`,ud=at(go)`
|
|
384
384
|
--height: 16px;
|
|
385
385
|
--width: 16px;
|
|
386
386
|
--icon-color: var(--cpsl-color-text-error);
|
|
387
|
-
|
|
387
|
+
`,$a=at(ae)`
|
|
388
388
|
white-space: pre-line;
|
|
389
|
-
|
|
389
|
+
`,Ka=at(Io)`
|
|
390
390
|
display: flex;
|
|
391
391
|
gap: 8px;
|
|
392
392
|
align-items: center;
|
|
@@ -395,12 +395,12 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
395
395
|
cursor: pointer;
|
|
396
396
|
margin-top: 8px;
|
|
397
397
|
text-decoration: none;
|
|
398
|
-
`,
|
|
398
|
+
`,Ya=at(go)`
|
|
399
399
|
--height: 20px;
|
|
400
400
|
--width: 20px;
|
|
401
|
-
`,
|
|
401
|
+
`,Xa=at.a`
|
|
402
402
|
text-decoration: none;
|
|
403
|
-
`;import{CpslHero as
|
|
403
|
+
`;import{CpslHero as md,CpslIcon as Cd,CpslIdenticon as fd}from"@getpara/react-components";import Tt from"styled-components";import{useEffect as Ad,useState as Sd}from"react";import{isMobile as Pn}from"@getpara/web-sdk";import{Fragment as yd,jsx as ht,jsxs as qa}from"react/jsx-runtime";var Fn=({externalWalletError:e})=>({EX_WALLET_SELECTED:{variant:"externalWalletConnection",topOffset:40,spacerHeight:158,hideFadeOut:!0},CHAIN_SWITCH:{variant:e?.[0]?.toLowerCase()===ro?"failed":"externalWalletConnection",topOffset:20,spacerHeight:158,hideFadeOut:!0},ACCOUNT_MAIN:{variant:"customContent",topOffset:0,spacerHeight:104,hideFadeOut:!0},FARCASTER_OAUTH:{variant:"externalWalletConnection",topOffset:40,spacerHeight:158,hideFadeOut:!0}}),Za=()=>{let e=N(),{wallet:t,walletDisplayHelpers:o,avatar:a}=K(),n=s(S=>S.step),r=s(S=>S.externalWalletError),i=tt(),[l,c]=Sd(n),d=Fn({externalWalletError:r})[l];Ad(()=>{let S=Fn({externalWalletError:r})[l],g=Fn({externalWalletError:r})[n];setTimeout(()=>{c(n)},g&&S||g&&!S?0:200)},[n]);let p=l==="EX_WALLET_SELECTED",m=l==="CHAIN_SWITCH",f=l==="ACCOUNT_MAIN",u=l==="FARCASTER_OAUTH",{showExtension:A,isCosmosMobileWallet:E}=o,h=!d||!Pn()&&p&&!A||!Pn()&&m&&E||!Pn()&&u,{variant:D,topOffset:I,spacerHeight:v,hideFadeOut:T}=d??{};return qa(yd,{children:[ht(Ed,{$top:-45+I,children:h?null:qa(gd,{$isAccount:f,hideFadeOut:T,variant:D,height:480,withDefaultTheme:!0,children:[(p||m)&&ht(Qa,{slot:"connectionLeft",src:t?.iconUrl}),u&&ht(Qa,{slot:"connectionLeft",icon:"farcasterBrand"}),f&&(a?ht(Td,{slot:"image",src:a}):i?ht(Id,{slot:"image",size:"100%",hash:e.getIdenticonHash(i.id,i.type)}):null)]})}),!h&&ht(hd,{$height:v})]})},Ed=Tt.div`
|
|
404
404
|
display: flex;
|
|
405
405
|
position: absolute;
|
|
406
406
|
justify-content: center;
|
|
@@ -408,18 +408,18 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
408
408
|
width: 100%;
|
|
409
409
|
|
|
410
410
|
top: ${({$top:e})=>`${e}px`};
|
|
411
|
-
`,
|
|
411
|
+
`,hd=Tt.div`
|
|
412
412
|
height: ${({$height:e})=>`${e}px`};
|
|
413
|
-
`,
|
|
413
|
+
`,Qa=Tt(Cd)`
|
|
414
414
|
--height: 60px;
|
|
415
415
|
--width: 60px;
|
|
416
|
-
`,
|
|
416
|
+
`,Td=Tt.img`
|
|
417
417
|
width: 100%;
|
|
418
418
|
height: 100%;
|
|
419
419
|
object-fit: contain;
|
|
420
|
-
`,
|
|
420
|
+
`,Id=Tt(fd)`
|
|
421
421
|
border-radius: 1000px;
|
|
422
|
-
`,
|
|
422
|
+
`,gd=Tt(md)`
|
|
423
423
|
${({$isAccount:e})=>e&&`
|
|
424
424
|
--ring-3-size: 560px;
|
|
425
425
|
--ring-2-size: 402px;
|
|
@@ -431,36 +431,36 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
431
431
|
--default-theme-ring-1-opacity: 0.06;
|
|
432
432
|
--default-theme-ring-0-opacity: 0.1;
|
|
433
433
|
`}
|
|
434
|
-
`;import{motion as
|
|
434
|
+
`;import{motion as xd}from"framer-motion";import{useEffect as wd,useRef as Wd,useState as _d}from"react";import Rd from"styled-components";import{jsx as Ja}from"react/jsx-runtime";var ja=({children:e,className:t})=>{let o=Wd(null),[a,n]=_d("auto");return wd(()=>{if(o.current){let r=new ResizeObserver(i=>{let l=i[0].contentRect.height;n(l)});return r.observe(o.current),()=>{r.disconnect()}}},[]),Ja(Ld,{className:t,style:{height:a},animate:{height:a},transition:{duration:.2},children:Ja("div",{ref:o,children:e})})},Ld=Rd(xd.div)`
|
|
435
435
|
overflow: hidden;
|
|
436
|
-
`;import{CpslButton as
|
|
436
|
+
`;import{CpslButton as ei,CpslIcon as kn,CpslQrCode as Md,CpslSpinner as Od,CpslText as Nd}from"@getpara/react-components";import{useEffect as ti,useMemo as vd}from"react";import Bn from"styled-components";import{useCopyToClipboard as bd}from"@getpara/react-common";import{WalletType as Dd}from"@getpara/web-sdk";import{Fragment as oi,jsx as Te,jsxs as It}from"react/jsx-runtime";var ni=()=>{let[e,t]=bd(),o=s(u=>u.externalWalletError),a=s(u=>u.setStep),n=s(u=>u.setStepDirection),{switchChain:r,wallet:i,qrUri:l,chainIdSwitchingTo:c,walletDisplayHelpers:d}=K();ti(()=>{i?.type===Dd.COSMOS&&nt(l)},[l,i]),ti(()=>{i||(n(-1),a("ACCOUNT_MAIN"))},[i]);let p=async()=>{c&&await r(c)},m=()=>{t(l)},f=vd(()=>{if(!i)return null;let{isCosmosMobileWallet:u}=d;return u?Te(oi,{children:It(M,{children:[Te(Nd,{weight:"semiBold",children:"Scan with your mobile device to switch networks"}),Te(fe,{children:l?Te(Md,{url:l,imageSrc:i.iconUrl}):Te(Od,{size:100})}),It(ei,{size:"small",variant:"ghost",onClick:m,children:[Te(kn,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]})}):It(M,{children:[o?.length?It(oi,{children:[It(Pd,{children:[Te(Fd,{icon:"alertCircle"}),Te(ae,{weight:"semiBold",color:"error",children:o[0]})]}),o[1]&&Te(ae,{color:"secondary",weight:"medium",children:o[1]})]}):Te(ae,{color:"contrast",weight:"semiBold",children:`Confirm the request to change networks in your ${i.name} wallet.`}),o?.[0]?.toLowerCase()!==ro&&It(ei,{variant:"secondary",onClick:p,children:[Te(kn,{slot:"start",icon:"refresh"}),"Try Again"]})]})},[i,d,o,l]);return i?Te(Ud,{children:f}):null},Ud=Bn(U)`
|
|
437
437
|
flex: 1;
|
|
438
438
|
justify-content: space-between;
|
|
439
|
-
`,
|
|
439
|
+
`,Pd=Bn.div`
|
|
440
440
|
display: flex;
|
|
441
441
|
align-items: center;
|
|
442
442
|
justify-content: center;
|
|
443
443
|
gap: 4px;
|
|
444
|
-
`,
|
|
444
|
+
`,Fd=Bn(kn)`
|
|
445
445
|
--height: 16px;
|
|
446
446
|
--width: 16px;
|
|
447
447
|
--icon-color: var(--cpsl-color-text-error);
|
|
448
|
-
`;import{motion as
|
|
448
|
+
`;import{motion as uu,AnimatePresence as mu}from"framer-motion";import{CpslIcon as Si}from"@getpara/react-components";import{styled as xo}from"styled-components";import{CpslIdenticon as ri,CpslSelect as kd,CpslSelectItem as Bd,CpslText as Ht}from"@getpara/react-components";import qe from"styled-components";import{truncateAddress as Hd,WalletType as yo}from"@getpara/web-sdk";import{useEffect as ci,useRef as pi}from"react";import{jsx as le,jsxs as Bt}from"react/jsx-runtime";var ai=(e,t)=>e&&t?`${e}~${t}`:void 0,Gd={[yo.EVM]:"EVM",[yo.SOLANA]:"Solana",[yo.COSMOS]:"Cosmos"},di=()=>{let e=pi(null),{dropdownMaxHeight:t,dropdownWidth:o,mobileAnchor:a,resize:n}=Pt(e),r=tt(),{switchChain:i,chainId:l,chains:c,chainIdSwitchingTo:d}=K();ci(()=>{t&&l&&n()},[l,d,t]);let p=async u=>{await i(u)};if(!r||!r.isExternal||r.type===yo.SOLANA)return null;let m=d??l,f=c.find(u=>u.id.toString()===m)?.name;return le(mi,{children:le(Ci,{ref:e,id:"inputContainer",children:Bt(fi,{selectedValue:m?.toString()??"",onCpslSelectValueChange:u=>{p(u.detail)},showFormattedSelectedItem:!0,placeholder:"Choose chain...",anchorElId:"inputContainer",dropdownMaxHeight:t,$width:o,$top:a+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[m&&le(li,{variant:"bodyXS",color:"contrast",slot:"selected-item",children:f}),c?.map(u=>le(Ai,{slot:"items",value:u.id.toString(),children:le(li,{variant:"bodyXS",color:"contrast",children:u.name})},u.id))]})})})};function ii(e,{type:t,isExternal:o,name:a,isMenu:n=!1,hideWallets:r=!1}){return e.isMultiWallet?a??`${o?"External ":""}${Gd[t]}${!r&&(n||o)?" Wallet":""}`:r?"My Account":a||"My Wallet"}var ui=()=>{let e=W(p=>p.hideWallets),t=N(),o=pi(null),{dropdownMaxHeight:a,dropdownWidth:n,mobileAnchor:r,resize:i}=Pt(o),{setSelectedWallet:l}=pe(),c=tt(),d=c?Bt(si,{slot:"selected-item",children:[le(ri,{variant:"avatar",size:"14px",hash:t.getIdenticonHash(c.id,c.type)}),le($d,{variant:"bodyXS",color:"contrast",children:ii(t,{...c,hideWallets:e})}),!e&&le(Ht,{variant:"bodyXS",color:"secondary",children:t.getDisplayAddress(c.id,{truncate:!0,addressType:c.type})})]}):null;return ci(()=>{a&&c?.address&&i()},[c,t.availableWallets,a]),le(mi,{children:le(Ci,{ref:o,id:"addressInputContainer",children:t.availableWallets.length>1?Bt(fi,{selectedValue:ai(c?.id,c?.type),onCpslSelectValueChange:p=>{let[m,f]=p.detail.split("~");l({id:m,type:f})},showFormattedSelectedItem:!0,placeholder:"Choose wallet...",anchorElId:"addressInputContainer",dropdownMaxHeight:a,$width:n,$top:r+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[c&&d,t.availableWallets.map(({address:p,name:m,id:f,type:u,isExternal:A})=>{let E=ai(f,u),h=m??ii(t,{type:u,isExternal:A,isMenu:!0,hideWallets:e});return le(Ai,{slot:"items",value:E,children:Bt(si,{children:[le(ri,{size:"40px",hash:t.getIdenticonHash(f,u)}),Bt(Vd,{children:[h&&le(Ht,{variant:"bodyS",color:"contrast",children:h}),!e&&le(Ht,{variant:"bodyXS",color:"secondary",children:Hd(p,u,{prefix:t.cosmosPrefix})})]})]})},E)})]}):d})})},mi=qe.div`
|
|
449
449
|
flex: 0;
|
|
450
450
|
width: 100%;
|
|
451
451
|
display: flex;
|
|
452
452
|
justify-content: center;
|
|
453
|
-
`,
|
|
453
|
+
`,si=qe.div`
|
|
454
454
|
display: flex;
|
|
455
455
|
align-items: center;
|
|
456
456
|
gap: 8px;
|
|
457
|
-
`,
|
|
457
|
+
`,Vd=qe.div`
|
|
458
458
|
display: flex;
|
|
459
459
|
flex-direction: column;
|
|
460
460
|
align-items: flex-start;
|
|
461
|
-
|
|
461
|
+
`,$d=qe(Ht)`
|
|
462
462
|
white-space: nowrap;
|
|
463
|
-
`,
|
|
463
|
+
`,Ci=qe.div`
|
|
464
464
|
position: relative;
|
|
465
465
|
display: flex;
|
|
466
466
|
align-items: center;
|
|
@@ -468,7 +468,7 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
468
468
|
border-radius: 1000px;
|
|
469
469
|
background-color: var(--cpsl-color-background-8);
|
|
470
470
|
padding: 8px;
|
|
471
|
-
`,
|
|
471
|
+
`,li=qe(Ht)`
|
|
472
472
|
max-width: 150px;
|
|
473
473
|
text-transform: capitalize;
|
|
474
474
|
|
|
@@ -477,7 +477,7 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
477
477
|
text-overflow: ellipsis;
|
|
478
478
|
overflow: hidden;
|
|
479
479
|
}
|
|
480
|
-
`,
|
|
480
|
+
`,fi=qe(kd)`
|
|
481
481
|
--container-height: auto;
|
|
482
482
|
--container-border-width: 0px;
|
|
483
483
|
--container-padding-end: 0px;
|
|
@@ -498,7 +498,7 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
498
498
|
|
|
499
499
|
&::part(popover) {
|
|
500
500
|
/* Have to adjust the top of the popover here since we're using a transform on the modal which causes fixed position items to not be relative to the viewport */
|
|
501
|
-
@media (max-width: ${
|
|
501
|
+
@media (max-width: ${Ye}px) {
|
|
502
502
|
top: ${({$top:e})=>e?`${e}px`:"0px"};
|
|
503
503
|
bottom: 16px;
|
|
504
504
|
}
|
|
@@ -511,12 +511,12 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
511
511
|
&::part(icon) {
|
|
512
512
|
--icon-color: var(--cpsl-color-contrast);
|
|
513
513
|
}
|
|
514
|
-
`,
|
|
514
|
+
`,Ai=qe(Bd)`
|
|
515
515
|
--outer-container-padding-start: 4px;
|
|
516
516
|
--outer-container-padding-end: 4px;
|
|
517
517
|
--outer-container-padding-top: 4px;
|
|
518
518
|
--outer-container-padding-bottom: 4px;
|
|
519
|
-
`;import{HeaderButton as
|
|
519
|
+
`;import{HeaderButton as hi}from"@getpara/react-common";import{Fragment as Qd,jsx as it,jsxs as Ei}from"react/jsx-runtime";var Ti=({onClose:e})=>{let t=W(c=>c.bareModal),o=s(c=>c.hasPreviousStep()),a=s(c=>c.step),n=s(c=>c.isFullyLoggedIn),r=Ee(),i=["ACCOUNT_MAIN","CHAIN_SWITCH","ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(a);return Ei(Kd,{children:[it(zd,{variant:"ghost",style:{visibility:o?"visible":"hidden"},onClick:()=>{r()},children:it(Si,{icon:"arrow"})}),it(Yd,{children:i&&n&&Ei(Qd,{children:[it(di,{}),it(ui,{})]})}),it(Xd,{bareModal:t,variant:"ghost",onClick:e,children:it(Si,{icon:"close"})})]})},Kd=xo.div`
|
|
520
520
|
position: absolute;
|
|
521
521
|
width: 100%;
|
|
522
522
|
top: 16px;
|
|
@@ -526,35 +526,35 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
526
526
|
align-items: center;
|
|
527
527
|
justify-content: space-between;
|
|
528
528
|
gap: 8px;
|
|
529
|
-
|
|
529
|
+
`,Yd=xo.div`
|
|
530
530
|
flex: 1;
|
|
531
531
|
display: flex;
|
|
532
532
|
align-items: center;
|
|
533
533
|
justify-content: center;
|
|
534
534
|
gap: 4px;
|
|
535
|
-
`,
|
|
535
|
+
`,Xd=xo(hi)`
|
|
536
536
|
transform: rotate(180deg);
|
|
537
537
|
visibility: ${({bareModal:e})=>e?"hidden":"visible"};
|
|
538
|
-
`,
|
|
538
|
+
`,zd=xo(hi)`
|
|
539
539
|
transform: rotate(180deg);
|
|
540
|
-
`;import{useEffect as
|
|
540
|
+
`;import{useEffect as Wi,useState as Cu}from"react";import{AuthMethod as Ii,OAuthMethod as qd}from"@getpara/web-sdk";import Gn from"styled-components";import{useEffect as Hn,useRef as Zd,useState as Gt}from"react";import{HeroSpinner as Jd}from"@getpara/react-common";import{CpslSpinner as jd}from"@getpara/react-components";import{jsx as wo,jsxs as nu}from"react/jsx-runtime";function gi(){let e=Zd(),t=N(),o=s(g=>g.setFlow),a=s(g=>g.setStep),n=V(g=>g.setAuthInfo),r=s(g=>g.setBiometricLocationHints),i=s(g=>g.setSupportedAuthMethods),l=s(g=>g.setIFrameUrl),c=s(g=>g.setIsIFrameReady),d=s(g=>g.isIFrameReady),p=s(g=>g.setWebAuthURLForCreate),m=W(g=>g.theme),[f,u]=Gt(void 0),[A,E]=Gt(!1),[h,D]=Gt(!1),[I,v]=Gt(!1),[T,S]=Gt();return Hn(()=>{T&&d&&setTimeout(()=>{a(T)},200)},[T,d]),Hn(()=>{f||t.getOAuthURL({method:qd.TELEGRAM}).then(g=>{u(g)})},[f]),Hn(()=>{let g=async x=>{switch(x.data.type){case"TELEGRAM_LOGIN":E(!0),v(!1);break;case"TELEGRAM_FAILED":E(!1),v(!0);break;case"TELEGRAM_SUCCESS":if(x.data.payload){let y=x.data.payload,w=await t.verifyTelegram(y);if(!w.isValid){E(!1),v(!0),e.current&&e.current.contentWindow.postMessage({type:"TELEGRAM_FAILED"},"*");return}let{telegramUserId:b,isNewUser:_,supportedAuthMethods:k,biometricHints:z}=w;if(n({telegramUserId:b,pfpUrl:y.photo_url,displayName:y.username?`@${y.username}`:y.first_name?`${y.first_name}${y.last_name?` ${y.last_name}`:""}`:`Telegram User @${b}`}),_){let R=await t.getSupportedCreateAuthMethods();c(!1),o("signUp");let te=R.has(Ii.PASSKEY);te&&(p(await t.shortenLoginLink(await t.getSetUpBiometricsURL({authType:"telegram"}))),a("BIOMETRIC_CREATION")),R.has(Ii.PASSWORD)&&(l(await t.shortenLoginLink(await t.getSetupPasswordURL({authType:"telegram",theme:m}))),S(te?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))}else o("login"),k&&i(new Set(k)),z&&r(z),a("BIOMETRIC_LOGIN")}break}};return window?.addEventListener("message",g,!1),()=>{window?.removeEventListener("message",g,!1)}},[]),nu(eu,{children:[wo(tu,{children:wo(Jd,{icon:"telegramBrand",status:A?"loading":I?"error":"inactive",text:A?"Follow the on-screen prompts.":I?"Login Failed":void 0})}),f&&wo(ou,{ref:e,style:{display:h?"block":"none"},src:f,onLoad:()=>D(!0)}),(!f||!h)&&wo(jd,{})]})}var eu=Gn.div`
|
|
541
541
|
display: flex;
|
|
542
542
|
flex-direction: column;
|
|
543
543
|
align-items: center;
|
|
544
544
|
justify-content: center;
|
|
545
545
|
width: 100%;
|
|
546
|
-
`,
|
|
546
|
+
`,tu=Gn.div`
|
|
547
547
|
display: flex;
|
|
548
548
|
min-height: 276px;
|
|
549
549
|
flex-direction: column;
|
|
550
550
|
align-items: center;
|
|
551
551
|
gap: 16px;
|
|
552
552
|
flex: 1;
|
|
553
|
-
`,
|
|
553
|
+
`,ou=Gn.iframe`
|
|
554
554
|
width: 100%;
|
|
555
555
|
height: 52px;
|
|
556
556
|
border: none;
|
|
557
|
-
`;import{jsx as
|
|
557
|
+
`;import{jsx as ru}from"react/jsx-runtime";var yi=()=>{let e=s(t=>t.isLogin());return ru(Ve,{heading:e?"Waiting for Password":"Creating Password",subheading:"Follow the prompts presented by your browser."})};import xi from"styled-components";import{SpinnerContainer as au}from"@getpara/react-common";import{CpslSpinner as iu}from"@getpara/react-components";import{jsx as Wo,jsxs as cu}from"react/jsx-runtime";var wi=()=>{let e=s(r=>r.iFrameUrl),t=s(r=>r.setIsIFrameReady),o=s(r=>r.isIFrameReady),a=s(r=>r.step),n=W(r=>r.embeddedModal);return cu(su,{$isVisible:_t.includes(a),$embeddedModal:n,children:[Wo(lu,{$isReady:o,children:Wo("iframe",{src:e,onLoad:()=>{t(!0)}})}),!o&&Wo(au,{style:{width:"100%",height:"100%",flex:1},children:Wo(iu,{size:100})})]})},su=xi.div`
|
|
558
558
|
height: ${({$isVisible:e})=>e?"100%":"0px"};
|
|
559
559
|
width: ${({$isVisible:e})=>e?"100%":"0px"};
|
|
560
560
|
flex: ${({$isVisible:e})=>e?1:"auto"};
|
|
@@ -563,10 +563,10 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
563
563
|
align-items: center;
|
|
564
564
|
justify-content: center;
|
|
565
565
|
|
|
566
|
-
@media (max-width: ${
|
|
566
|
+
@media (max-width: ${Ye}px) {
|
|
567
567
|
padding: ${({$embeddedModal:e,$isVisible:t})=>t?e?"12px 0px 0px":"72px 16px 0px":"0px"};
|
|
568
568
|
}
|
|
569
|
-
`,
|
|
569
|
+
`,lu=xi.div`
|
|
570
570
|
height: 100%;
|
|
571
571
|
width: 100%;
|
|
572
572
|
display: ${({$isReady:e})=>e?"block":"none"};
|
|
@@ -576,42 +576,42 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
576
576
|
width: 100%;
|
|
577
577
|
border: none;
|
|
578
578
|
}
|
|
579
|
-
`;import{Fragment as
|
|
579
|
+
`;import{Fragment as yu,jsx as F,jsxs as gt}from"react/jsx-runtime";var _i={ADD_FUNDS_AWAITING:"680px"},Ri={TELEGRAM_OAUTH:"36px"},fu={TELEGRAM_OAUTH:"16px"},Li=({oAuthMethods:e,twoFactorAuthEnabled:t,disableEmailLogin:o,disablePhoneLogin:a,onClose:n})=>{let r=s(h=>h.step),i=s(h=>h.onRampConfig),l=s(h=>h.stepDirection),c=s(h=>h.setStepDirection),d=s(h=>h.accountAddFundTab),p=s(h=>h.setAccountAddFundTab),m=W(h=>h.appName),f=W(h=>h.embeddedModal),[u,A]=Cu(i?.testMode),E=()=>{switch(r){case"AUTH_MAIN":return F(Pa,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"EX_WALLET_MORE":return F(Co,{});case"AUTH_MORE":return F(ho,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"VERIFICATIONS":return F(sr,{});case"BIOMETRIC_LOGIN":return F(cr,{});case"SETUP_2FA":case"VERIFY_2FA":return F(mr,{onClose:n});case"LOGIN_DONE":return F(vr,{onClose:n});case"AWAITING_BIOMETRIC_LOGIN":case"AWAITING_BIOMETRIC_CREATION":return F(Dr,{});case"AWAITING_PASSWORD_LOGIN":case"AWAITING_PASSWORD_CREATION":return F(yi,{});case"AWAITING_WALLET_CREATION":return F(Pr,{});case"WALLET_CREATION_DONE":return F(kr,{twoFactorAuthEnabled:t,onClose:n});case"SECRET":return F(Vr,{});case"TWO_FACTOR_DONE":return F($r,{onClose:n});case"BIOMETRIC_CREATION":return F(Jr,{});case"AWAITING_OAUTH":return F(jr,{});case"FARCASTER_OAUTH":return F(Sa,{});case"TELEGRAM_OAUTH":return F(gi,{});case"ADD_FUNDS_BUY":case"ADD_FUNDS_RECEIVE":case"ADD_FUNDS_WITHDRAW":return F(ua,{});case"ADD_FUNDS_AWAITING":return F(Ca,{});case"ADD_FUNDS_SUCCESS":return F(Tn,{isSuccess:!0,onClose:n});case"ADD_FUNDS_FAILURE":return F(Tn,{onClose:n});case"ACCOUNT_MAIN":return F(Ba,{onClose:n});case"EX_WALLET_SELECTED":return F(za,{});case"CHAIN_SWITCH":return F(ni,{});default:if(_t.includes(r))return null}};return Wi(()=>{!u&&i?.testMode&&A(!0)},[i?.testMode]),Wi(()=>{switch(r){case"ADD_FUNDS_BUY":p(_o.BUY);break;case"ADD_FUNDS_RECEIVE":p(_o.RECEIVE);break;case"ADD_FUNDS_WITHDRAW":p(_o.WITHDRAW);break;default:break}},[r]),gt(Au,{slot:"body","data-testid":"modal-content",children:[!f&>(yu,{children:[F(Ti,{onClose:n}),F(ha,{})]}),gt(Su,{children:[F(mu,{mode:"popLayout",initial:!1,onExitComplete:()=>{c(1)},custom:l,children:gt(Eu,{custom:l,variants:ao,initial:"enter",animate:"center",exit:"exit",transition:io,children:[F(Za,{}),gt(hu,{$embeddedModal:f,$step:r,$isIFrameStep:_t.includes(r),children:[E(),i?.testMode&&["ADD_FUNDS_BUY","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_FAILURE","ADD_FUNDS_SUCCESS"].includes(r)&&u&&d!==_o.RECEIVE&&F(Tu,{children:gt("div",{style:{fontSize:"14px"},children:["This Para Modal is configured to run on-ramp services in ",F("b",{children:"test mode"})," only, for development purposes. If you are a user of ",m,", please contact support.",F(Iu,{onClick:()=>A(!1),children:F(gu,{icon:"x"})})]})})]})]},["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(r)?"ADD_FUNDS":r)}),F(wi,{})]})]})},Au=st.div`
|
|
580
580
|
position: relative;
|
|
581
|
-
`,
|
|
581
|
+
`,Su=st(ja)`
|
|
582
582
|
margin-top: -16px;
|
|
583
|
-
`,
|
|
583
|
+
`,Eu=st(uu.div)`
|
|
584
584
|
position: relative;
|
|
585
585
|
display: flex;
|
|
586
586
|
flex-direction: column;
|
|
587
587
|
gap: 24px;
|
|
588
588
|
will-change: auto !important;
|
|
589
|
-
`,
|
|
589
|
+
`,hu=st.div`
|
|
590
590
|
z-index: 1;
|
|
591
591
|
flex: 1;
|
|
592
592
|
display: flex;
|
|
593
593
|
flex-direction: column;
|
|
594
594
|
justify-content: flex-start;
|
|
595
595
|
gap: 24px;
|
|
596
|
-
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${
|
|
597
|
-
min-height: ${({$step:e})=>
|
|
598
|
-
height: ${({$step:e})=>
|
|
596
|
+
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${Ri[t]??"72px"} 72px ${fu[t]??"32px"}`};
|
|
597
|
+
min-height: ${({$step:e})=>_i[e]??"auto"};
|
|
598
|
+
height: ${({$step:e})=>_i[e]??"auto"};
|
|
599
599
|
|
|
600
|
-
@media (max-width: ${
|
|
601
|
-
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${
|
|
600
|
+
@media (max-width: ${Ye}px) {
|
|
601
|
+
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${Ri[t]??"72px"} 16px 0px`};
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
cpsl-auth-modal.force-mobile-media & {
|
|
605
605
|
padding: 72px 16px 0px;
|
|
606
606
|
}
|
|
607
|
-
`,
|
|
607
|
+
`,Tu=st(pu)`
|
|
608
608
|
--container-padding-end: 40px;
|
|
609
609
|
position: absolute;
|
|
610
610
|
bottom: 16px;
|
|
611
611
|
left: 16px;
|
|
612
612
|
right: 16px;
|
|
613
613
|
z-index: 1000;
|
|
614
|
-
`,
|
|
614
|
+
`,Iu=st.button`
|
|
615
615
|
background-color: transparent;
|
|
616
616
|
border: none;
|
|
617
617
|
padding: 4px;
|
|
@@ -619,49 +619,49 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
619
619
|
position: absolute;
|
|
620
620
|
top: 0;
|
|
621
621
|
right: 0;
|
|
622
|
-
`,
|
|
622
|
+
`,gu=st(du)`
|
|
623
623
|
--icon-color: var(--cpsl-color-foreground-0);
|
|
624
|
-
`;import{styled as
|
|
624
|
+
`;import{styled as Pe}from"styled-components";import{CpslButton as xu,CpslIcon as Oi,CpslText as wu}from"@getpara/react-components";import{useMemo as Wu}from"react";import{Fragment as bu,jsx as Oe,jsxs as Vt}from"react/jsx-runtime";var Ni=()=>{let e=s(n=>n.isAccount()),t=s(n=>n.step),o=e||qn(t),a=Wu(()=>e?Vt(Mu,{children:[Vt(Nu,{variant:"bodyS",color:"secondary",weight:"medium",children:["Access all your wallet\u2019s features at"," ",Oe("a",{href:un,target:"blank",children:Oe(Mi,{variant:"bodyS",weight:"medium",children:"Para Connect"})})]}),Oe(xu,{as:"a",href:un,target:"blank",variant:"ghost",children:Oe(Ou,{icon:"chevronUp"})})]}):Vt(bu,{children:[Vt(Ro,{variant:"body2XS",color:"secondary",weight:"medium",children:["By logging in you agree to our"," ",Oe("a",{href:ea,target:"blank",children:Oe(Mi,{variant:"body2XS",weight:"medium",children:"Terms & Conditions"})})]}),Vt(Lu,{children:[Oe(Ro,{variant:"bodyS",color:"secondary",weight:"medium",children:"Powered by"}),Oe(vu,{icon:"para"})]})]}),[e]);return o?Oe(_u,{slot:"footer",children:Oe(Ru,{children:a})}):null},_u=Pe.div`
|
|
625
625
|
display: flex;
|
|
626
626
|
flex-direction: column;
|
|
627
627
|
align-items: center;
|
|
628
628
|
gap: 16px;
|
|
629
629
|
padding: 8px 0px;
|
|
630
|
-
`,
|
|
630
|
+
`,Ru=Pe.div`
|
|
631
631
|
display: flex;
|
|
632
632
|
flex-direction: column;
|
|
633
633
|
align-items: center;
|
|
634
634
|
gap: 8px;
|
|
635
|
-
`,
|
|
635
|
+
`,Lu=Pe.div`
|
|
636
636
|
display: flex;
|
|
637
637
|
gap: 5px;
|
|
638
638
|
align-items: center;
|
|
639
639
|
justify-content: center;
|
|
640
|
-
`,
|
|
640
|
+
`,Mu=Pe.div`
|
|
641
641
|
display: flex;
|
|
642
642
|
gap: 8px;
|
|
643
643
|
align-items: center;
|
|
644
644
|
justify-content: center;
|
|
645
|
-
`,
|
|
645
|
+
`,Ou=Pe(Oi)`
|
|
646
646
|
transform: rotate(90deg);
|
|
647
647
|
|
|
648
648
|
/* --icon-color: var(--cpsl-color-text-tertiary); */
|
|
649
649
|
--height: 24px;
|
|
650
650
|
--width: 24px;
|
|
651
|
-
`,
|
|
651
|
+
`,Ro=Pe(wu)`
|
|
652
652
|
text-align: center;
|
|
653
653
|
display: inline-block;
|
|
654
|
-
`,
|
|
654
|
+
`,Nu=Pe(Ro)`
|
|
655
655
|
line-height: 20px;
|
|
656
|
-
`,
|
|
656
|
+
`,Mi=Pe(Ro)`
|
|
657
657
|
cursor: pointer;
|
|
658
658
|
display: inline-block;
|
|
659
|
-
`,
|
|
659
|
+
`,vu=Pe(Oi)`
|
|
660
660
|
display: inline-block;
|
|
661
661
|
--icon-color: var(--cpsl-color-text-secondary);
|
|
662
662
|
--width: 49px;
|
|
663
663
|
--height: auto;
|
|
664
|
-
`;var dt={LOGGIN_POLLING_DELAY_MS:5e3,POLLING_INTERVAL_MS:2e3,ANIMATION_DURATION:.15};import{create as vu}from"zustand";var Ni=e=>({updateState:t=>{e(t)}});var bu={EvmProvider:void 0,evmContext:void 0,SolanaProvider:void 0,solanaContext:void 0,CosmosProvider:void 0,cosmosContext:void 0,connectParaEvmWallet:void 0,connectParaCosmosWallet:void 0},se=vu(e=>({...bu,...Ni(e)}));var vi=()=>{let e=se(r=>r.connectParaEvmWallet),t=se(r=>r.EvmProvider),o=se(r=>r.evmContext),a=se(r=>r.connectParaCosmosWallet),n=se(r=>r.CosmosProvider),i=se(r=>r.cosmosContext);return async()=>{if(o&&t&&e)try{let{error:r}=await e();r&&console.warn("Failed to connect Para EVM wallet to Wagmi:",r)}catch(r){console.warn("Error calling connectParaEvmWallet:",r)}if(i&&n&&a)try{let{error:r}=await a();r&&console.warn("Failed to connect Para Cosmos wallet to Graz:",r)}catch(r){console.warn("Error calling connectParaCosmosWallet:",r)}}};import{Fragment as Gu,jsx as Di,jsxs as Vu}from"react/jsx-runtime";function Bu(e){return"hostApiKey"in e}var Hu={[fe.SOLANA]:_t.SOLANA,[fe.ATOM]:_t.COSMOS,[fe.CELO]:_t.CELO,[fe.POLYGON]:_t.POLYGON},Vn={SOLANA:fe.SOLANA,SOL:fe.SOLANA,ATOM:fe.ATOM,CELO:fe.CELO,POLYGON:fe.POLYGON,MATIC:fe.POLYGON,USDC:fe.USDC,ETH:fe.ETHEREUM,ETHEREUM:fe.ETHEREUM},Ui=Du(({onRampConfig:e,twoFactorAuthEnabled:t=!1,recoverySecretStepEnabled:o=!1,oAuthMethods:a,disableEmailLogin:n,disablePhoneLogin:i,onClose:l,onRampTestMode:r,loginTransitionOverride:c,createWalletOverride:p},d)=>{let u=b(),A=s(w=>w.step),m=s(w=>w.webAuthURLForLogin),f=s(w=>w.webAuthURLForCreate),S=s(w=>w.passwordUrlForLogin),y=s(w=>w.isLogin()),D=s(w=>w.popupWindow),W=s(w=>w.onRampConfig),E=s(w=>w.setStep),h=s(w=>w.setBiometricLocationHints),R=s(w=>w.setWebAuthURLForLogin),C=s(w=>w.setWebAuthURLForCreate),L=s(w=>w.setPopupWindow),T=s(w=>w.setIFrameUrl),g=s(w=>w.setPasswordUrlForLogin),U=s(w=>w.setSupportedAuthMethods),x=s(w=>w.setOnRampConfig),P=s(w=>w.accountAddFundTab),K=s(w=>w.setAccountAddFundTab),M=V(w=>w.setRecoveryShare),ne=Me(),ae=bi(),ce=bi(),[Y,N]=Pu(!1),Q=vi();Uu(d,()=>({handleModalClose(){Ue()}}),[]);let te=async()=>{if(!t)return!0;try{let{isSetup:w}=await u.check2FAStatus();return w}catch(w){return console.error("An error occurred while checking 2FA:",w),!1}};async function G(){let{isComplete:w,isError:I,needsWallet:H}=await u.waitForLoginAndSetup({popupWindow:D});if(L(void 0),I){ne();return}w&&(R(""),g(""),U(new Set),h(),H?E("AWAITING_WALLET_CREATION"):(await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")))}async function de(){await u.waitForAccountCreation()&&(C(""),T(""),E("AWAITING_WALLET_CREATION"))}Wt(()=>{if(A!=="AWAITING_WALLET_CREATION"||Y)return;async function w(){N(!0);let I,H;if(p){let q=await p(u),pe=(await u.fetchWallets()).filter(me=>!!me.address),ue={};for(let me of pe)ue[me.id]={...Fu(me),signer:""};u.setWallets(ue),I=q.recoverySecret,H=q.walletIds}else{let q=await u.waitForPasskeyAndCreateWallet();I=q.recoverySecret,H=q.walletIds}await u.setCurrentWalletIds(H),o&&M(I),N(!1),E(!I||!o?"WALLET_CREATION_DONE":"SECRET")}w()},[y,A]);async function De(){E("PASSWORD_CREATION")}async function pt(){typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS),je(f,"ParaPasskey","CREATE_PASSKEY"),E("AWAITING_BIOMETRIC_CREATION"))}Wt(()=>{if(m||S){if(c){async function w(){await c(u),R(""),g(""),h(),await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")}w();return}typeof window<"u"&&(ae.current=window.setTimeout(G,dt.LOGGIN_POLLING_DELAY_MS))}return()=>{typeof window<"u"&&window.clearTimeout(ae.current),u.exitLogin()}},[m,S,D]);let Ue=()=>{l()};return Wt(()=>{["BIOMETRIC_CREATION","AWAITING_BIOMETRIC_CREATION"].includes(A)||u.exitAccountCreation(),["BIOMETRIC_LOGIN","AWAITING_BIOMETRIC_LOGIN"].includes(A)||u.exitLogin(),["AWAITING_OAUTH","FARCASTER_OAUTH"].includes(A)||u.exitOAuth(),A==="PASSWORD_CREATION"&&typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS))},[A]),Wt(()=>{W||u.ctx.client.getOnRampConfig().then(w=>{let I;if(e){let{enabledFlows:H,network:q,asset:pe,providers:ue,testMode:me}=e,Ho=ue.find(ge=>Bu(ge));I={isBuyEnabled:!H||H.some(ge=>He[ge]===He.BUY),isReceiveEnabled:!H||H.some(ge=>He[ge]===He.RECEIVE),isWithdrawEnabled:!H||H.some(ge=>He[ge]===He.WITHDRAW),allowedAssets:q?{[_t[q]]:pe?[Vn[pe]]:!0}:pe?{[Hu[Vn[pe]]??_t.ETHEREUM]:[Vn[pe]]}:w.allowedAssets,assetInfo:w.assetInfo,providers:ue.map(({id:ge})=>ku[ge]),rampApiKey:Ho?.hostApiKey??w.rampApiKey,testMode:me??r}}else I={...w,testMode:r};x(I),P||K(I.isBuyEnabled?He.BUY:I.isReceiveEnabled?He.RECEIVE:I.isWithdrawEnabled?He.WITHDRAW:void 0)}).catch()},[]),Wt(()=>{W&&x({...W,testMode:r})},[r]),Wt(()=>()=>{u.exitLoops()},[]),Vu(Gu,{children:[Di(Ri,{oAuthMethods:a,twoFactorAuthEnabled:t,disableEmailLogin:n,disablePhoneLogin:i,onClose:Ue,createAccountWithPasskey:pt,createAccountWithPassword:De}),Di(Oi,{})]})});import{forwardRef as Fi,useEffect as be,useImperativeHandle as im,useRef as sm,useState as Fo}from"react";import{ParaEvent as Po}from"@getpara/web-sdk";import{useEffect as om,useState as Rt}from"react";import{createContext as $u,useMemo as Ku}from"react";import{jsx as Xu}from"react/jsx-runtime";var Yu={wallets:[],chains:[],chainId:void 0,username:void 0,avatar:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Mo=$u(Yu);function $n({children:e}){let t=[],o=[],l=()=>Promise.resolve(),r=()=>Promise.resolve({});return Xu(Mo.Provider,{value:Ku(()=>({wallets:t,chains:o,chainId:void 0,username:void 0,avatar:void 0,disconnect:l,switchChain:r}),[t,o,void 0,void 0,void 0,l,r]),children:e})}var Oo=(l=>(l.METAMASK="METAMASK",l.RAINBOW="RAINBOW",l.COINBASE="COINBASE",l.WALLETCONNECT="WALLETCONNECT",l.ZERION="ZERION",l.RABBY="RABBY",l))(Oo||{}),No=(a=>(a.PHANTOM="PHANTOM",a.GLOW="GLOW",a.BACKPACK="BACKPACK",a))(No||{}),vo=(o=>(o.KEPLR="KEPLR",o.LEAP="LEAP",o))(vo||{}),ew={...Oo,...No,...vo};import{createContext as zu,useMemo as Qu}from"react";import{jsx as Zu}from"react/jsx-runtime";var qu={wallets:[],disconnect:()=>Promise.resolve()},bo=zu(qu);function Kn({children:e}){let t=[],o=()=>Promise.resolve();return Zu(bo.Provider,{value:Qu(()=>({wallets:t,disconnect:o}),[t,o]),children:e})}import{createContext as Ju,useMemo as ju}from"react";import{jsx as tm}from"react/jsx-runtime";var em={wallets:[],chains:[],chainId:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Do=Ju(em);function Yn({children:e}){let t=[],o=[],n=()=>Promise.resolve(),i=()=>Promise.resolve({});return tm(Do.Provider,{value:ju(()=>({wallets:t,chains:o,chainId:void 0,disconnect:n,switchChain:i}),[t,o,void 0,n,i]),children:e})}import{jsx as Uo}from"react/jsx-runtime";var Pi=({children:e,wallets:t})=>{let o=b(),a=s(T=>T.resetState),n=V(T=>T.resetState),i=se(T=>T.EvmProvider),l=se(T=>T.evmContext),r=se(T=>T.SolanaProvider),c=se(T=>T.solanaContext),p=se(T=>T.CosmosProvider),d=se(T=>T.cosmosContext),[u,A]=Rt(null),[m,f]=Rt(null),[S,y]=Rt(null),[D,W]=Rt(null),[E,h]=Rt(null),[R,C]=Rt(null);om(()=>{(async()=>{let g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;if(!t?.length)g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;else for(let ne=0;ne<t.length;ne++){let ae=t[ne];if(ae in Oo){if(!i||!l)throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");g=l,U=i}if(ae in No){if(!r||!c)throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");x=c,P=r}if(ae in vo){if(!p||!d)throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");K=d,M=p}}f(g),A(()=>U),W(x),y(()=>P),C(K),h(()=>M)})()},[t,l,i,c,r,d,p]);let L=({address:T,error:g})=>{(g||!T)&&(a(),n())};return!o||!u||!S||!E?null:Uo(u,{para:o,onSwitchWallet:L,children:Uo(S,{para:o,onSwitchWallet:L,children:Uo(E,{para:o,onSwitchWallet:L,children:Uo(ra,{evmContext:m,solanaContext:D,cosmosContext:R,walletSort:t,children:e})})})})};import lm from"styled-components";import{jsx as ko}from"react/jsx-runtime";rm();var Xw=Fi(({para:e,isOpen:t,...o},a)=>{let[n,i]=Fo(!1),l=Z(d=>d.setClient),r=Z(d=>d.client),{closeModal:c,openModal:p}=qt();return be(()=>{r||l(e),i(!0)},[]),be(()=>{t||c(),t&&p()},[t]),n?ko(cm,{ref:a,para:e,...o}):null}),cm=Fi(({theme:e,appName:t,logo:o,disableEmailLogin:a=!1,disablePhoneLogin:n=!1,oAuthMethods:i,bareModal:l=!1,className:r,currentStepOverride:c,externalWallets:p,authLayout:d=["AUTH:FULL","EXTERNAL:FULL"],embeddedModal:u,onModalStepChange:A,hideWallets:m=!1,onClose:f,...S},y)=>{let D=sm(null),W=_(v=>v.updateState),E=s(v=>v.setWebAuthURLForLogin),h=s(v=>v.setWebAuthURLForCreate),R=s(v=>v.setBiometricLocationHints),C=s(v=>v.step),L=s(v=>v.setOnModalStepChange),T=s(v=>v.setStep),g=V(v=>v.setAuthInfo),U=s(v=>v.hasPreviousStep()),x=s(v=>v.setFlow),P=s(v=>v.setIsFullyLoggedIn),K=Me(),M=_(v=>v.setAuthLayout),ne=_(v=>v.authLayout),ae=s(v=>v.resetState),ce=V(v=>v.resetState),Y=V(v=>v.setRecoveryShare),{disconnectExternalWallet:N}=$(),{isOpen:Q,closeModal:te}=qt(),G=b(),{selectedWallet:de,setSelectedWallet:De}=Ce(),[pt,Ue]=Fo(!1),[w,I]=Fo(!1),[H,q]=Fo(!1);im(y,()=>({goBack(){K()},canGoBack(){return U},currentStep(){return C},handleModalClose(){D?.current?.handleModalClose()}}),[U,C]);let pe=async()=>{let v=await G.isFullyLoggedIn();switch(c?T(Ve[c.toUpperCase()]):v?(x("account"),T("ACCOUNT_MAIN"),P(!0)):(C!=="AUTH_MAIN"&&C!=="SECRET"&&(T("AUTH_MAIN"),x(),E(),h(),R()),await N(),De({id:void 0,type:void 0}),P(!1)),!0){case G.isEmail:g({email:G.getEmail()});break;case G.isPhone:{let{phone:Ge,countryCode:ki}=G.getPhone();g({phone:Ge,countryCode:ki})}break;case G.isFarcaster:g({farcasterUsername:G.getFarcasterUsername()});break;case G.isTelegram:g({telegramUserId:G.telegramUserId}),v||T("TELEGRAM_OAUTH");break}I(!0)};be(()=>{let v=d;!p?.length&&yn(d)&&(v=v.filter(Ge=>!Ge.includes("EXTERNAL"))),a&&n&&!i?.length&&Dt(d)&&(v=v.filter(Ge=>!Ge.includes("AUTH"))),JSON.stringify(ne)!==JSON.stringify(v)&&M(v)},[a,n,i,p,d]),be(()=>{L(A)},[A]),be(()=>{W({logo:o,appName:t,oAuthLogoVariant:e?.oAuthLogoVariant??"default",bareModal:l,embeddedModal:u,hideWallets:m})},[o,t,e?.oAuthLogoVariant,l,u,m]),be(()=>{e&&(am(e),W({isDark:e.mode==="dark",theme:e}))},[e]),be(()=>{G?(pe(),l&&Ue(!0)):console.error("A Para instance must be provided.")},[]),be(()=>{Q&&G&&pe()},[Q]);let ue=()=>{if(!de?.id||!G.findWallet(de?.id)){let v=G.findWallet(void 0,void 0,{forbidPregen:!0});De({id:v?.id,type:v?.type})}};be(()=>{ue()},[G]),be(()=>(typeof window<"u"&&window.addEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.addEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue),q(!0),()=>{typeof window<"u"&&window.removeEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.removeEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue)}),[]);let me=()=>{te(),f?.()},Ho=()=>{Ue(!0)},ge=async()=>{Ue(!1),Xn.includes(C)?(ae(),ce(),Y(null)):zn.includes(C)&&T("LOGIN_DONE"),G&&(await pe(),G.exitLoops()),I(!1)};if(!H)return null;if(!G)return console.error("A Para instance is required."),null;if(!ne?.length){let v=!p?.length&&yn(d),Ge=a&&n&&!i?.length&&Dt(d);return v||Ge?(v&&console.error("At least one external wallet must be provided if external wallet auth is enabled."),Ge&&console.error("At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled.")):console.error("At least one auth layout selection is required."),null}return ko(Pi,{wallets:p,children:ko(dm,{enterTransitionDuration:dt.ANIMATION_DURATION,exitTransitionDuration:dt.ANIMATION_DURATION,open:Q,onCpslModalExited:ge,onCpslModalEntering:Ho,onCpslModalRequestClose:me,noOverlay:l,className:r,"data-testid":"modal",$embeddedModal:u,children:pt&&(w&&u||!u)&&ko(Ui,{oAuthMethods:i,disableEmailLogin:a,disablePhoneLogin:n,onClose:me,...S})})})}),dm=lm(nm)`
|
|
664
|
+
`;import{create as Du}from"zustand";var vi=e=>({updateState:t=>{e(t)}});var Uu={EvmProvider:void 0,evmContext:void 0,SolanaProvider:void 0,solanaContext:void 0,CosmosProvider:void 0,cosmosContext:void 0,connectParaEvmWallet:void 0,connectParaCosmosWallet:void 0},se=Du(e=>({...Uu,...vi(e)}));var bi=()=>{let e=se(l=>l.connectParaEvmWallet),t=se(l=>l.EvmProvider),o=se(l=>l.evmContext),a=se(l=>l.connectParaCosmosWallet),n=se(l=>l.CosmosProvider),r=se(l=>l.cosmosContext);return async()=>{if(o&&t&&e)try{let{error:l}=await e();l&&console.warn("Failed to connect Para EVM wallet to Wagmi:",l)}catch(l){console.warn("Error calling connectParaEvmWallet:",l)}if(r&&n&&a)try{let{error:l}=await a();l&&console.warn("Failed to connect Para Cosmos wallet to Graz:",l)}catch(l){console.warn("Error calling connectParaCosmosWallet:",l)}}};import{Fragment as $u,jsx as Di,jsxs as Ku}from"react/jsx-runtime";function Gu(e){return"hostApiKey"in e}var Vu={[de.SOLANA]:xt.SOLANA,[de.ATOM]:xt.COSMOS,[de.CELO]:xt.CELO,[de.POLYGON]:xt.POLYGON},Vn={SOLANA:de.SOLANA,SOL:de.SOLANA,ATOM:de.ATOM,CELO:de.CELO,POLYGON:de.POLYGON,MATIC:de.POLYGON,USDC:de.USDC,ETH:de.ETHEREUM,ETHEREUM:de.ETHEREUM},Ui=Pu(({onRampConfig:e,twoFactorAuthEnabled:t=!1,recoverySecretStepEnabled:o=!1,oAuthMethods:a,disableEmailLogin:n,disablePhoneLogin:r,onClose:i,onRampTestMode:l,loginTransitionOverride:c,createWalletOverride:d},p)=>{let m=N(),f=s(C=>C.refs),u=s(C=>C.step),A=s(C=>C.webAuthURLForLogin),E=s(C=>C.passwordUrlForLogin),h=s(C=>C.isLogin()),D=s(C=>C.onRampConfig),I=s(C=>C.setStep),v=s(C=>C.setBiometricLocationHints),T=s(C=>C.setWebAuthURLForLogin),S=s(C=>C.setPasswordUrlForLogin),g=s(C=>C.setSupportedAuthMethods),x=s(C=>C.setOnRampConfig),y=s(C=>C.accountAddFundTab),w=s(C=>C.setAccountAddFundTab),b=V(C=>C.setRecoveryShare),_=Ee(),k=no(),[z,R]=ku(!1),te=bi();Fu(p,()=>({handleModalClose(){$()}}),[]);let oe=async()=>{if(!t)return!0;try{let{isSetup:C}=await m.check2FAStatus();return C}catch(C){return console.error("An error occurred while checking 2FA:",C),!1}};async function We(){let{isComplete:C,isError:B,needsWallet:H}=await m.waitForLoginAndSetup({popupWindow:f.popupWindow.current});if(window.clearTimeout(f.poll.current?.timeout),f.poll.current=void 0,f.popupWindow.current=void 0,B){["AWAITING_BIOMETRIC_LOGIN","AWAITING_PASSWORD_LOGIN"].includes(f.currentStep.current)&&_();return}C&&(T(""),S(""),g(new Set),v(),H?I("AWAITING_WALLET_CREATION"):(await te(),await oe()?I("LOGIN_DONE"):I("SETUP_2FA")))}yt(()=>{if(u!=="AWAITING_WALLET_CREATION"||z)return;async function C(){R(!0);let B,H;if(d){let q=await d(m),P=(await m.fetchWallets()).filter(ue=>!!ue.address),ce={};for(let ue of P)ce[ue.id]={...Bu(ue),signer:""};m.setWallets(ce),B=q.recoverySecret,H=q.walletIds}else{let q=await m.waitForPasskeyAndCreateWallet();B=q.recoverySecret,H=q.walletIds}await m.setCurrentWalletIds(H),o&&b(B),R(!1),I(!B||!o?"WALLET_CREATION_DONE":"SECRET")}C()},[h,u]),yt(()=>{if(["AWAITING_BIOMETRIC_LOGIN","AWAITING_PASSWORD_LOGIN"].includes(u)&&(A||E)){if(c){async function C(){await c(m),T(""),S(""),v(),await te(),await oe()?I("LOGIN_DONE"):I("SETUP_2FA")}C();return}return typeof window<"u"&&(f.poll.current={action:"login",timeout:window.setTimeout(We,$e.LOGGIN_POLLING_DELAY_MS)}),()=>{typeof window<"u"&&f.poll.current&&window.clearTimeout(f.poll.current?.timeout),m.exitLogin()}}},[u,A,E]);let $=()=>{i()};return yt(()=>{f.currentStep.current=u;let C=!1;["AWAITING_BIOMETRIC_CREATION","PASSWORD_CREATION"].includes(u)||(m.exitAccountCreation(),C=["createPassword","createPasskey"].includes(f.poll.current?.action)),["AWAITING_PASSWORD_LOGIN","AWAITING_BIOMETRIC_LOGIN"].includes(u)||(m.exitLogin(),C=f.poll.current?.action==="login"),["AWAITING_OAUTH","FARCASTER_OAUTH"].includes(u)||m.exitOAuth(),u==="PASSWORD_CREATION"&&k.withPassword(),C&&typeof window<"u"&&(window.clearTimeout(f.poll.current?.timeout),f.poll.current=void 0)},[u]),yt(()=>{D||m.ctx.client.getOnRampConfig().then(C=>{let B;if(e){let{enabledFlows:H,network:q,asset:P,providers:ce,testMode:ue}=e,lt=ce.find(ie=>Gu(ie));B={isBuyEnabled:!H||H.some(ie=>Fe[ie]===Fe.BUY),isReceiveEnabled:!H||H.some(ie=>Fe[ie]===Fe.RECEIVE),isWithdrawEnabled:!H||H.some(ie=>Fe[ie]===Fe.WITHDRAW),allowedAssets:q?{[xt[q]]:P?[Vn[P]]:!0}:P?{[Vu[Vn[P]]??xt.ETHEREUM]:[Vn[P]]}:C.allowedAssets,assetInfo:C.assetInfo,providers:ce.map(({id:ie})=>Hu[ie]),rampApiKey:lt?.hostApiKey??C.rampApiKey,testMode:ue??l}}else B={...C,testMode:l};x(B),y||w(B.isBuyEnabled?Fe.BUY:B.isReceiveEnabled?Fe.RECEIVE:B.isWithdrawEnabled?Fe.WITHDRAW:void 0)}).catch()},[]),yt(()=>{D&&x({...D,testMode:l})},[l]),yt(()=>()=>{window.clearTimeout(f.poll.current?.timeout),m.exitLoops()},[]),Ku($u,{children:[Di(Li,{oAuthMethods:a,twoFactorAuthEnabled:t,disableEmailLogin:n,disablePhoneLogin:r,onClose:$}),Di(Ni,{})]})});import{forwardRef as Fi,useEffect as Ne,useImperativeHandle as lm,useRef as cm,useState as Po}from"react";import{ParaEvent as Uo}from"@getpara/web-sdk";import{useEffect as rm,useState as wt}from"react";import{createContext as Yu,useMemo as Xu}from"react";import{jsx as Qu}from"react/jsx-runtime";var zu={wallets:[],chains:[],chainId:void 0,username:void 0,avatar:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Lo=Yu(zu);function $n({children:e}){let t=[],o=[],i=()=>Promise.resolve(),l=()=>Promise.resolve({});return Qu(Lo.Provider,{value:Xu(()=>({wallets:t,chains:o,chainId:void 0,username:void 0,avatar:void 0,disconnect:i,switchChain:l}),[t,o,void 0,void 0,void 0,i,l]),children:e})}var Mo=(i=>(i.METAMASK="METAMASK",i.RAINBOW="RAINBOW",i.COINBASE="COINBASE",i.WALLETCONNECT="WALLETCONNECT",i.ZERION="ZERION",i.RABBY="RABBY",i))(Mo||{}),Oo=(a=>(a.PHANTOM="PHANTOM",a.GLOW="GLOW",a.BACKPACK="BACKPACK",a))(Oo||{}),No=(o=>(o.KEPLR="KEPLR",o.LEAP="LEAP",o))(No||{}),uw={...Mo,...Oo,...No};import{createContext as qu,useMemo as Zu}from"react";import{jsx as ju}from"react/jsx-runtime";var Ju={wallets:[],disconnect:()=>Promise.resolve()},vo=qu(Ju);function Kn({children:e}){let t=[],o=()=>Promise.resolve();return ju(vo.Provider,{value:Zu(()=>({wallets:t,disconnect:o}),[t,o]),children:e})}import{createContext as em,useMemo as tm}from"react";import{jsx as nm}from"react/jsx-runtime";var om={wallets:[],chains:[],chainId:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},bo=em(om);function Yn({children:e}){let t=[],o=[],n=()=>Promise.resolve(),r=()=>Promise.resolve({});return nm(bo.Provider,{value:tm(()=>({wallets:t,chains:o,chainId:void 0,disconnect:n,switchChain:r}),[t,o,void 0,n,r]),children:e})}import{jsx as Do}from"react/jsx-runtime";var Pi=({children:e,wallets:t})=>{let o=N(),a=s(y=>y.resetState),n=V(y=>y.resetState),r=se(y=>y.EvmProvider),i=se(y=>y.evmContext),l=se(y=>y.SolanaProvider),c=se(y=>y.solanaContext),d=se(y=>y.CosmosProvider),p=se(y=>y.cosmosContext),[m,f]=wt(null),[u,A]=wt(null),[E,h]=wt(null),[D,I]=wt(null),[v,T]=wt(null),[S,g]=wt(null);rm(()=>{(async()=>{let w=Lo,b=$n,_=vo,k=Kn,z=bo,R=Yn;if(!t?.length)w=Lo,b=$n,_=vo,k=Kn,z=bo,R=Yn;else for(let te=0;te<t.length;te++){let oe=t[te];if(oe in Mo){if(!r||!i)throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");w=i,b=r}if(oe in Oo){if(!l||!c)throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");_=c,k=l}if(oe in No){if(!d||!p)throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");z=p,R=d}}A(w),f(()=>b),I(_),h(()=>k),g(z),T(()=>R)})()},[t,i,r,c,l,p,d]);let x=({address:y,error:w})=>{(w||!y)&&(a(),n())};return!o||!m||!E||!v?null:Do(m,{para:o,onSwitchWallet:x,children:Do(E,{para:o,onSwitchWallet:x,children:Do(v,{para:o,onSwitchWallet:x,children:Do(Qr,{evmContext:u,solanaContext:D,cosmosContext:S,walletSort:t,children:e})})})})};import pm from"styled-components";import{jsx as Fo}from"react/jsx-runtime";im();var aW=Fi(({para:e,isOpen:t,...o},a)=>{let[n,r]=Po(!1),i=Q(p=>p.setClient),l=Q(p=>p.client),{closeModal:c,openModal:d}=zt();return Ne(()=>{l||i(e),r(!0)},[]),Ne(()=>{t||c(),t&&d()},[t]),n?Fo(dm,{ref:a,para:e,...o}):null}),dm=Fi(({theme:e,appName:t,logo:o,disableEmailLogin:a=!1,disablePhoneLogin:n=!1,oAuthMethods:r,bareModal:i=!1,className:l,currentStepOverride:c,externalWallets:d,authLayout:p=["AUTH:FULL","EXTERNAL:FULL"],embeddedModal:m,onModalStepChange:f,hideWallets:u=!1,onClose:A,...E},h)=>{let D=cm(null),I=W(L=>L.updateState),v=s(L=>L.refs),T=s(L=>L.setWebAuthURLForLogin),S=s(L=>L.setWebAuthURLForCreate),g=s(L=>L.setBiometricLocationHints),x=s(L=>L.step),y=s(L=>L.setOnModalStepChange),w=s(L=>L.setStep),b=V(L=>L.setAuthInfo),_=s(L=>L.hasPreviousStep()),k=s(L=>L.setFlow),z=s(L=>L.setIsFullyLoggedIn),R=Ee(),te=W(L=>L.setAuthLayout),oe=W(L=>L.authLayout),We=s(L=>L.resetState),$=V(L=>L.resetState),C=V(L=>L.setRecoveryShare),{disconnectExternalWallet:B}=K(),{isOpen:H,closeModal:q}=zt(),P=N(),{selectedWallet:ce,setSelectedWallet:ue}=pe(),[lt,ie]=Po(!1),[O,ne]=Po(!1),[me,Bo]=Po(!1);lm(h,()=>({goBack(){R()},canGoBack(){return _},currentStep(){return x},handleModalClose(){D?.current?.handleModalClose()}}),[_,x]);let Wt=async()=>{let L=await P.isFullyLoggedIn();switch(c?w(Be[c.toUpperCase()]):L?(k("account"),w("ACCOUNT_MAIN"),z(!0)):(x!=="AUTH_MAIN"&&x!=="SECRET"&&(w("AUTH_MAIN"),k(),T(),S(),g()),await B(),ue({id:void 0,type:void 0}),z(!1)),!0){case P.isEmail:b({email:P.getEmail()});break;case P.isPhone:{let{phone:ke,countryCode:Hi}=P.getPhone();b({phone:ke,countryCode:Hi})}break;case P.isFarcaster:b({farcasterUsername:P.getFarcasterUsername()});break;case P.isTelegram:b({telegramUserId:P.telegramUserId}),L||w("TELEGRAM_OAUTH");break}ne(!0)};Ne(()=>{let L=p;!d?.length&&yn(p)&&(L=L.filter(ke=>!ke.includes("EXTERNAL"))),a&&n&&!r?.length&&vt(p)&&(L=L.filter(ke=>!ke.includes("AUTH"))),JSON.stringify(oe)!==JSON.stringify(L)&&te(L)},[a,n,r,d,p]),Ne(()=>{y(f)},[f]),Ne(()=>{I({logo:o,appName:t,oAuthLogoVariant:e?.oAuthLogoVariant??"default",bareModal:i,embeddedModal:m,hideWallets:u})},[o,t,e?.oAuthLogoVariant,i,m,u]),Ne(()=>{e&&(sm(e),I({isDark:e.mode==="dark",theme:e}))},[e]),Ne(()=>{P?(Wt(),i&&ie(!0)):console.error("A Para instance must be provided.")},[]),Ne(()=>{H&&P&&Wt()},[H]);let ve=()=>{if(!ce?.id||!P.findWallet(ce?.id)){let L=P.findWallet(void 0,void 0,{forbidPregen:!0});ue({id:L?.id,type:L?.type})}};Ne(()=>{ve()},[P]),Ne(()=>{let L=()=>{v.popupWindow.current?.close()};return typeof window<"u"&&(window.addEventListener(Uo.WALLETS_CHANGE_EVENT,ve),window.addEventListener(Uo.EXTERNAL_WALLET_CHANGE_EVENT,ve),window.addEventListener("beforeunload",L)),Bo(!0),()=>{typeof window<"u"&&(window.removeEventListener(Uo.WALLETS_CHANGE_EVENT,ve),window.removeEventListener(Uo.EXTERNAL_WALLET_CHANGE_EVENT,ve),window.removeEventListener("beforeunload",L))}},[]);let Xn=()=>{q(),A?.()},ki=()=>{ie(!0)},Bi=async()=>{i||ie(!1),zn.includes(x)?(We(),$(),C(null)):Qn.includes(x)&&w("LOGIN_DONE"),P&&(await Wt(),P.exitLoops()),i||ne(!1)};if(!me)return null;if(!P)return console.error("A Para instance is required."),null;if(!oe?.length){let L=!d?.length&&yn(p),ke=a&&n&&!r?.length&&vt(p);return L||ke?(L&&console.error("At least one external wallet must be provided if external wallet auth is enabled."),ke&&console.error("At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled.")):console.error("At least one auth layout selection is required."),null}return Fo(Pi,{wallets:d,children:Fo(um,{enterTransitionDuration:$e.ANIMATION_DURATION,exitTransitionDuration:$e.ANIMATION_DURATION,open:H,onCpslModalExited:Bi,onCpslModalEntering:ki,onCpslModalRequestClose:Xn,noOverlay:i,className:l,"data-testid":"modal",$embeddedModal:m,children:lt&&(O&&m||!m)&&Fo(Ui,{oAuthMethods:r,disableEmailLogin:a,disablePhoneLogin:n,onClose:Xn,...E})})})}),um=pm(am)`
|
|
665
665
|
${({$embeddedModal:e})=>e&&`
|
|
666
666
|
&::part(modal-body-card) {
|
|
667
667
|
--card-box-shadow: none;
|
|
@@ -672,4 +672,4 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
672
672
|
--card-box-shadow: none;
|
|
673
673
|
--card-border-width: 0px;
|
|
674
674
|
};`}
|
|
675
|
-
`;var
|
|
675
|
+
`;var ko=class extends Error{constructor(t){super(`On-ramp configuration error: ${t}.`),this.name="OnRampConfigError"}};function mm({providers:e}){if(!e||e.length<1)throw new ko("No providers are configured")}function Cm({providers:e}){e.forEach((t,o)=>{if(e.findIndex(a=>a===t)!==o)throw new ko(`Provider ${t} is configured more than once`)})}function lW(e){return e?(mm(e),Cm(e),!0):!1}export*from"@getpara/web-sdk";import fm from"@getpara/web-sdk";var IW=fm;export{er as AuthLayout,No as CosmosWallet,Mo as EvmWallet,uw as ExternalWallet,Be as ModalStep,Cn as NETWORKS,fn as ON_RAMP_ASSETS,mn as ON_RAMP_PROVIDERS,ko as OnRampConfigError,aW as ParaModal,dl as ParaProvider,Gr as SaveRecoverySecret,Oo as SolanaWallet,IW as default,ec as getAssetIcon,jl as getAssetName,vS as getClient,bS as getIsOpen,Jl as getNetworkIcon,Nt as getNetworkName,DS as getSelectedWalletId,US as getSelectedWalletType,Ze as openPopup,en as useAccount,Ys as useCheckIfUserExists,G as useClient,$s as useCreateUser,se as useExternalWalletProviderStore,zs as useInitiateLogin,on as useKeepSessionAlive,tn as useLogout,zt as useModal,js as useSignMessage,tl as useSignTransaction,ks as useWaitForAccountCreation,Us as useWaitForLoginAndSetup,Gs as useWaitForPasskeyAndCreateWallet,Mt as useWallet,pe as useWalletState,lW as validateOnRampConfig};
|