@getpara/react-sdk 1.4.1 → 1.4.3
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
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{CpslAuthModal as
|
|
2
|
+
import{CpslAuthModal as rm,defineCustomElements as am,generateTheme as im}from"@getpara/react-components";import{forwardRef as Uu,useEffect as ct,useImperativeHandle as Pu,useState as Fu}from"react";import{entityToWallet as ku,OnRampProvider as Bu,OnRampAsset as me,Network as yt,EnabledFlow as ke}from"@getpara/web-sdk";import{create as Hi}from"zustand";import{persist as Gi,createJSONStorage as Vi}from"zustand/middleware";var He=(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))(He||{});var Yn=["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"],Xn=["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_SUCCESS","ADD_FUNDS_FAILURE","CHAIN_SWITCH"],Bo={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 Ho={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 Go={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},zn=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 pt(e){switch(e){case"BUY":return"ADD_FUNDS_BUY";case"RECEIVE":return"ADD_FUNDS_RECEIVE";case"WITHDRAW":default:return"ADD_FUNDS_WITHDRAW"}}var Wt=["PASSWORD_CREATION"];var Qn=(e,t)=>({resetState:()=>e(Vo),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,s=t().webAuthURLForCreate,l=t().iFrameUrl,c=t().refs,u=(n?Bo:a?Go:Ho)[r];r==="PASSWORD_CREATION"&&l&&!s&&(u="AUTH_MAIN"),r==="EX_WALLET_SELECTED"&&e({selectedExternalWalletId:void 0,isExternalWalletConnecting:!1,externalWalletError:void 0}),u&&(e({step:u,stepDirection:-1}),o?.({previousStep:r,currentStep:u,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?Bo[n]:o?Go[n]:Ho[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}),setAuthStepRoute:o=>e({authStepRoute:o})});import{createRef as $o}from"react";var Vo={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:$o(),poll:$o(),currentStep:$o()},authStepRoute:void 0},i=Hi()(Gi((e,t)=>({step:"AUTH_MAIN",onRampConfig:void 0,activeWallet:void 0,...Vo,...Qn(e,t)}),{version:1,name:"@PARA/modalState",storage:Vi(()=>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 Ki}from"zustand";import{extractAuthInfo as $i}from"@getpara/user-management-client";var qn=(e,t)=>({resetState:()=>{e(Ko)},setAuthInfo:({pfpUrl:o,displayName:a,...n})=>{e({auth:n,pfpUrl:o||null,displayName:a||null})},getAuthInfo:()=>{try{return t().auth?{...$i(t().auth,{isRequired:!0}),pfpUrl:t().pfpUrl,displayName:t().displayName}:null}catch{return null}},setRecoveryShare:o=>{e({recoveryShare:o})}});var Ko={auth:null,recoveryShare:null,pfpUrl:null,displayName:null},$=Ki((e,t)=>({...Ko,...qn(e,t)}));import{create as Yi}from"zustand";var Zn=(e,t)=>({updateState:o=>{e(o)},getLogo:()=>t().logo??void 0,setAuthLayout:o=>{let a=[],n=[];o.map(r=>{let s=r.split(":")[0];a.includes(s)?console.warn(`${r} is a duplicate ${s} layout type. Please remove the duplicate type from your config.`):(n.push(r),a.push(s))}),e({authLayout:n})}});var Jn=(n=>(n.AUTH_FULL="AUTH:FULL",n.AUTH_CONDENSED="AUTH:CONDENSED",n.EXTERNAL_FULL="EXTERNAL:FULL",n.EXTERNAL_CONDENSED="EXTERNAL:CONDENSED",n))(Jn||{});var Xi={isDark:!1,logo:void 0,appName:void 0,bareModal:!1,embeddedModal:!1,oAuthLogoVariant:void 0,authLayout:["AUTH:FULL","EXTERNAL:FULL"],hideWallets:!1},y=Yi((e,t)=>({...Xi,...Zn(e,t)}));import{styled as lt}from"styled-components";import{CpslAlert as cu,CpslIcon as pu}from"@getpara/react-components";import{CpslCodeInput as ns,CpslSpinner as rs,CpslText as as}from"@getpara/react-components";import{useEffect as ar,useRef as is,useState as Rt}from"react";import{styled as Xo}from"styled-components";import{CpslIcon as zi,CpslInput as Qi,CpslText as qi,CpslTileButton as Zi}from"@getpara/react-components";import{styled as fe}from"styled-components";var jn=fe.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
6
|
-
`,fe
|
|
6
|
+
`,Ae=fe.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
|
+
`,er=fe.div`
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
gap: 8px;
|
|
16
|
-
`,
|
|
16
|
+
`,tr=fe.div`
|
|
17
17
|
display: flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
gap: 4px;
|
|
@@ -22,18 +22,18 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
22
22
|
--height: 20px;
|
|
23
23
|
--width: 20px;
|
|
24
24
|
}
|
|
25
|
-
`,
|
|
25
|
+
`,_t=fe(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
|
+
`,Gm=fe(_t)`
|
|
32
32
|
width: 100%;
|
|
33
|
-
`,ae=
|
|
33
|
+
`,ae=fe(qi)`
|
|
34
34
|
width: 100%;
|
|
35
35
|
text-align: center;
|
|
36
|
-
`,
|
|
36
|
+
`,_=fe.div`
|
|
37
37
|
width: 100%;
|
|
38
38
|
height: 100%;
|
|
39
39
|
align-self: center;
|
|
@@ -41,39 +41,39 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
align-items: center;
|
|
43
43
|
gap: 8px;
|
|
44
|
-
`,
|
|
44
|
+
`,k=fe(_)`
|
|
45
45
|
gap: ${({$wide:e})=>e?"32px":"24px"};
|
|
46
|
-
`,
|
|
46
|
+
`,z=fe(ae)``,Ge=fe(Zi)`
|
|
47
47
|
--button-width: 100%;
|
|
48
48
|
--button-height: 87px;
|
|
49
49
|
--button-icon-height: 32px;
|
|
50
50
|
--button-icon-width: 32px;
|
|
51
|
-
`,
|
|
51
|
+
`,Ve=fe(zi)`
|
|
52
52
|
--height: 80px;
|
|
53
53
|
--width: 80px;
|
|
54
54
|
--icon-color: var(--cpsl-color-text-primary);
|
|
55
|
-
`;import{AuthMethod as
|
|
55
|
+
`;import{AuthMethod as Yo}from"@getpara/core-sdk";import{createStore as Ji,useStore as ji}from"zustand";var or=e=>({client:void 0,setClient:t=>e({client:t})});var nr=e=>({isOpen:!1,setIsOpen:t=>e({isOpen:t})});var rr=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 es,persist as ts}from"zustand/middleware";var dt=Ji()(ts((...e)=>({...or(...e),...nr(...e),...rr(...e)}),{version:1,name:"@PARA/web-state",storage:es(()=>localStorage),partialize:e=>({selectedWalletId:e.selectedWalletId,selectedWalletType:e.selectedWalletType})})),os=e=>t=>ji(e,t),Z=os(dt);var N=()=>Z(t=>t.client);import{Fragment as cs,jsx as mt,jsxs as ut}from"react/jsx-runtime";var ir=()=>{let e=y(S=>S.theme),t=$(S=>S.getAuthInfo()),o=i(S=>S.setStep),a=i(S=>S.setWebAuthURLForCreate),n=i(S=>S.setIFrameUrl),r=i(S=>S.setIsIFrameReady),s=i(S=>S.setAuthStepRoute),l=N(),c=is(null),[u,d]=Rt(""),[m,C]=Rt(""),[p,f]=Rt("Resend."),[w,T]=Rt(!1),[D,I]=Rt(!1),O=t?.authType==="email";ar(()=>{setTimeout(()=>{c.current.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[]),ar(()=>{u.length===6&&b()},[u]);let A=async()=>{w||(f("Resent!"),T(!0),O?await l.resendVerificationCode():await l.resendVerificationCodeByPhone(),setTimeout(()=>{f("Resend."),T(!1)},3e3))},v=S=>{m&&C(""),d(S.detail.value.trim())},b=async()=>{if(I(!0),u.length===6&&/^\d+$/.test(u))try{let S=await l.getSupportedCreateAuthMethods();if(S.has(Yo.PASSWORD)&&S.has(Yo.PASSKEY)){r(!1);let x=O?await l.verifyEmail({verificationCode:u}):await l.verifyPhone({verificationCode:u}),F=await l.getSetupPasswordURL({authType:t?.authType,theme:e});a(await l.shortenLoginLink(x)),n(await l.shortenLoginLink(F)),s("BIOMETRIC_CREATION");return}else if(S.has(Yo.PASSWORD)){r(!1),O?await l.verifyEmail({verificationCode:u}):await l.verifyPhone({verificationCode:u});let x=await l.getSetupPasswordURL({authType:t?.authType,theme:e});n(await l.shortenLoginLink(x)),s("PASSWORD_CREATION");return}else{let x=O?await l.verifyEmail({verificationCode:u}):await l.verifyPhone({verificationCode:u});a(await l.shortenLoginLink(x)),o("BIOMETRIC_CREATION")}}catch(S){S.message.includes("429")?C("Too many incorrect attempts. Please try again in 10 minutes."):C("Incorrect code.")}else C("Incorrect code.");I(!1)};return ut(k,{$wide:!0,children:[ut(_,{children:[ut(z,{variant:"headingS",weight:"bold",children:["Verify ",O?"Email":"Phone Number"]}),ut(Vt,{variant:"bodyS",color:"secondary",children:["Please enter the code we sent to ",mt(Vt,{variant:"bodyS",children:t?.identifier})]})]}),mt(_,{children:D?mt(rs,{}):ut(cs,{children:[mt("form",{onSubmit:async S=>{S.preventDefault(),await b()},children:mt(ss,{ref:c,length:6,type:"number",code:u,onCpslInput:v,errorText:m,onKeyDown:async S=>S.key==="Enter"&&await b()})}),ut(Vt,{variant:"bodyS",color:"secondary",children:["Didn\u2019t receive a code?"," ",mt(ls,{variant:"bodyS",style:{cursor:w?"default":"pointer"},onClick:A,children:p})]})]})})]})},ss=Xo(ns)`
|
|
56
56
|
align-self: center;
|
|
57
|
-
|
|
57
|
+
`,Vt=Xo(as)`
|
|
58
58
|
text-align: center;
|
|
59
59
|
display: inline-block;
|
|
60
|
-
`,
|
|
60
|
+
`,ls=Xo(Vt)`
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
display: inline-block;
|
|
63
|
-
`;import{CpslButton as
|
|
64
|
-
height=${r}, top=${m}, left=${
|
|
63
|
+
`;import{CpslButton as sr,CpslDivider as ps,CpslIcon as ds}from"@getpara/react-components";import{useEffect as us,useMemo as ms,useState as Cs}from"react";function Je({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 s=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,u=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,d=(c-n)/2+s,m=(u-r)/2+l,C=`toolbar=no, menubar=no, width=${n},
|
|
64
|
+
height=${r}, top=${m}, left=${d}`,p=window.open(e,t,C);return p||setTimeout(()=>{p=window.open(e,"_blank")},0),p}import fs from"styled-components";import{AuthMethod as Ct,getPublicKeyHex as $t,isPasskeySupported as As}from"@getpara/web-sdk";import{formatBiometricHints as Ss,KnownDevices as Es,UserIdentifier as hs}from"@getpara/react-common";import{Fragment as zo,jsx as De,jsxs as ft}from"react/jsx-runtime";var lr=()=>{let e=i(I=>I.refs),t=i(I=>I.supportedAuthMethods),o=i(I=>I.passwordUrlForLogin),a=i(I=>I.webAuthURLForLogin),n=i(I=>I.setStep),r=i(I=>I.biometricLocationHints),s=N(),l=$(I=>I.getAuthInfo()),c=i(I=>I.setWebAuthURLForLogin),u=i(I=>I.setPasswordUrlForLogin),d=As(),m=ms(()=>Ss(r),[r]),C=i(I=>I.setSupportedAuthMethods),[p,f]=Cs();us(()=>{async function I(){if(!t?.size&&s.getUserId()){let E=await s.supportedAuthMethods({userId:s.getUserId()});E?.size&&C(E);return}if(!s.isEmail&&!s.isPhone&&!s.isFarcaster&&!s.isTelegram||!s.loginEncryptionKeyPair)return;let O=s.isEmail?"email":s.isPhone?"phone":s.isFarcaster?"farcaster":"telegram",A=await s.touchSession(),v=t?.has&&t.has(Ct.PASSKEY)?await s.getWebAuthURLForLogin({sessionId:A.data.sessionId,loginEncryptionPublicKey:$t(s.loginEncryptionKeyPair),partnerId:A.data.partnerId,authType:O,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,b=t?.has&&t.has(Ct.PASSKEY)?await s.getWebAuthURLForLogin({sessionId:A.data.sessionId,loginEncryptionPublicKey:$t(s.loginEncryptionKeyPair),partnerId:A.data.partnerId,newDeviceSessionId:A.data.sessionLookupId,newDeviceEncryptionKey:$t(s.loginEncryptionKeyPair),authType:O,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,S=t?.has&&t.has(Ct.PASSWORD)?await s.getPasswordURLForLogin({sessionId:A.data.sessionId,loginEncryptionPublicKey:$t(s.loginEncryptionKeyPair),partnerId:A.data.partnerId,authType:O,displayName:l.displayName,pfpUrl:l.pfpUrl}):void 0,x=v?await s.shortenLoginLink(v):void 0,F=b?await s.shortenLoginLink(b):void 0;f(F),c(x),u(S)}I()},[t,s]);let w=()=>{e.popupWindow.current=Je({url:a,target:"ParaPasskey",type:"LOGIN_PASSKEY",current:e.popupWindow.current}),n("AWAITING_BIOMETRIC_LOGIN")},T=()=>{e.popupWindow.current=Je({url:o,target:"ParaPassword",type:"LOGIN_PASSWORD",current:e.popupWindow.current}),n("AWAITING_PASSWORD_LOGIN")};function D(){return!r?.length||d&&m.isOnKnownDevice||t?.has&&t.has(Ct.PASSWORD)}return ft(k,{$wide:!0,children:[ft(_,{children:[D()&&De(z,{variant:"headingS",weight:"bold",children:"Welcome back,"}),De(hs,{...l})]}),ft(gs,{children:[t?.has&&t.has(Ct.PASSWORD)&&o&&De(Ts,{handlePasswordClick:T}),t?.has&&t.has(Ct.PASSKEY)&&a&&p&&De(Is,{handlePasskeyClick:w,formattedHints:m,shortLoginLink:p,passkeysSupported:d,biometricLocationHints:r})]})]})},Ts=({handlePasswordClick:e})=>De(sr,{fullWidth:!0,onClick:e,children:"Login"}),Is=({handlePasskeyClick:e,formattedHints:t,shortLoginLink:o,passkeysSupported:a,biometricLocationHints:n=[]})=>{let[r,s]=[n.length>0,t.isOnKnownDevice];return ft(zo,{children:[(r&&!s||!a)&&De(Es,{hints:t,link:o}),a&&ft(zo,{children:[r&&!s&&De(ps,{children:"or"}),De(sr,{fullWidth:!0,onClick:e,children:!r||s?ft(zo,{children:[De(ds,{slot:"start",icon:"key"}),"Login with passkey"]}):"Continue anyway"})]})]})},gs=fs(_)`
|
|
65
65
|
gap: 16px;
|
|
66
|
-
`;import{CpslButton as
|
|
66
|
+
`;import{CpslButton as Zo,CpslCodeInput as ys,CpslDivider as xs,CpslIcon as ws,CpslQrCode as Ws,CpslSpinner as cr,CpslText as pr}from"@getpara/react-components";import{useEffect as Qo,useRef as _s,useState as Kt}from"react";import{styled as dr}from"styled-components";import{useCopyToClipboard as Rs}from"@getpara/react-common";import{Fragment as qo,jsx as oe,jsxs as Lt}from"react/jsx-runtime";var ur=({onClose:e})=>{let t=i(S=>S.isLogin()),o=i(S=>S.setStep),a=N(),n=i(S=>S.step==="VERIFY_2FA"),[r,s]=Rs(),l=_s(null),[c,u]=Kt(null),[d,m]=Kt(""),[C,p]=Kt(""),[f,w]=Kt(!1),D=(c?new URL(c).searchParams:void 0)?.get("secret");Qo(()=>{async function S(){try{let{uri:x}=await a.setup2FA();u(x)}catch(x){console.error("Error fetching OTPAuth URL:",x)}}S()},[]),Qo(()=>{setTimeout(()=>{l?.current?.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[n]),Qo(()=>{d.length===6&&v()},[d]);let I=()=>{o("VERIFY_2FA")},O=()=>{t?o("LOGIN_DONE"):e()},A=S=>{C&&p(""),m(S.detail.value.trim())},v=async()=>{if(w(!0),d.length===6&&/^\d+$/.test(d))try{await a.enable2FA({verificationCode:d}),o("TWO_FACTOR_DONE")}catch{p("Incorrect Code")}else p("Incorrect Code");w(!1)};return Lt(k,{children:[Lt(_,{children:[oe(z,{variant:"headingS",weight:"bold",children:"Turn on Two-Factor authentication"}),n&&oe(pr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Please enter the code from your authenticator app."})]}),oe(_,{children:n?oe(qo,{children:f?oe(cr,{}):oe("form",{onSubmit:async S=>{S.preventDefault(),await v()},children:oe(Ls,{ref:l,code:d,onCpslInput:A,errorText:C,length:6,onKeyDown:async S=>S.key==="Enter"&&await v()})})}):Lt(qo,{children:[oe(pr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan with your preferred authenticator app."}),oe(Ae,{children:c?oe(Ws,{url:c}):oe(cr,{size:100})})]})}),!n&&Lt(qo,{children:[oe(_,{children:oe(xs,{children:"or enter the code manually"})}),oe(_,{children:oe(_t,{disabled:!0,value:D,noAutoDisable:!0,children:oe(Zo,{slot:"end",variant:"ghost",onClick:()=>{s(D)},children:oe(ws,{icon:r?"check":"copy"})})})}),Lt(_,{children:[oe(Zo,{fullWidth:!0,onClick:I,children:"Continue"}),oe(Ms,{variant:"ghost",onClick:O,children:"Skip"})]})]})]})},Ls=dr(ys)`
|
|
67
67
|
align-self: center;
|
|
68
|
-
`,
|
|
68
|
+
`,Ms=dr(Zo)`
|
|
69
69
|
margin-top: 8px;
|
|
70
70
|
text-decoration: underline;
|
|
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`
|
|
71
|
+
`;import{useEffect as Sl}from"react";import At from"styled-components";import{CpslButton as dl,CpslIdenticon as ul,CpslText as Rr}from"@getpara/react-components";import{truncateAddress as Lr}from"@getpara/web-sdk";import{useEffect as sl}from"react";import{useEffect as tl,useRef as ol}from"react";var H=()=>Z(t=>t.client);var Yt=()=>{let e=Z(n=>n.isOpen),t=Z(n=>n.setIsOpen);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};var ue=()=>{let e=H(),t=Z(s=>s.selectedWalletId),o=Z(s=>s.selectedWalletType),a=Z(s=>s.setSelectedWallet),n=Z(s=>s.clearSelectedWallet);return{selectedWallet:{id:t,type:o},setSelectedWallet:({id:s,type:l})=>{try{e.findWalletId(s,{type:[l]})!==s?n():a(s,l)}catch{n()}}}};import{useQuery as Os}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 Se="PARA_ACCOUNT",Jo=()=>{let e=H();return Os({queryKey:[Se,e?.getUserId()],queryFn:async()=>await mr(e)})};import{useQuery as Ns}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 ge="PARA_WALLET",Mt=()=>{let e=H(),{selectedWallet:t}=ue();return Ns({queryKey:[ge,e?.getUserId(),t.id,t.type],queryFn:async()=>await Cr(e,t)})};import{useMutation as vs,useQueryClient as bs}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 Ds=()=>{let e=H(),t=bs(),o=vs({mutationFn:async a=>await fr(e,a),onSettled:async()=>{await t.invalidateQueries({queryKey:[Se],exact:!1}),await t.invalidateQueries({queryKey:[ge],exact:!1})}});return j(o,"waitForLoginAndSetup")};import{useMutation as Us,useQueryClient as Ps}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 Fs=()=>{let e=H(),t=Ps(),o=Us({mutationFn:async()=>await Ar(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Se],exact:!1}),await t.invalidateQueries({queryKey:[ge],exact:!1})}});return j(o,"waitForAccountCreation")};import{useMutation as ks,useQueryClient as Bs}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 Hs=()=>{let e=H(),t=Bs(),o=ks({mutationFn:async()=>await Sr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Se],exact:!1}),await t.invalidateQueries({queryKey:[ge],exact:!1})}});return j(o,"waitForPasskeyAndCreateWallet")};import{useMutation as Gs}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 Vs=()=>{let e=H(),t=Gs({mutationFn:async o=>await Er(e,o)});return j(t,"createUser")};import{useMutation as $s}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 Ks=()=>{let e=H(),t=$s({mutationFn:async o=>await hr(e,o)});return j(t,"checkIfUserExists")};import{useMutation as Ys}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 Xs=()=>{let e=H(),t=Ys({mutationFn:async o=>await Tr(e,o)});return j(t,"initiateLogin")};import{useMutation as zs,useQueryClient as Qs}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 jo=()=>{let e=H(),t=Qs(),o=Z(n=>n.clearSelectedWallet),a=zs({mutationFn:async()=>await Ir(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Se],exact:!1}),await t.invalidateQueries({queryKey:[ge],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 en=()=>{let e=H(),t=qs({mutationFn:async()=>await gr(e)});return j(t,"keepSessionAlive")};import{useMutation as Zs}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 Js=()=>{let e=H(),{data:t}=Mt(),o=Zs({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 el=()=>{let e=H(),{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 j(o,"signTransaction")};var nl=6e4,rl=3e5,wr=({disabled:e})=>{let t=N(),{data:o}=Jo(),{logoutAsync:a}=jo(),{keepSessionAliveAsync:n}=en(),r=ol(null);tl(()=>{if(!t||e){c();return}return o?.isConnected&&!t.isUsingExternalWallet()?l():c(),()=>c()},[t,o,e]);let s=async()=>{try{let u=await t.retrieveSessionCookie();if(!u)return null;let d=u.match(/Expires=([^;]+)/);return d?new Date(d[1]):null}catch{return null}},l=()=>{c(),r.current=setInterval(async()=>{let u=await s();if(!u){await a(),c();return}let d=u.getTime()-Date.now();if(d<=0){await a(),c();return}if(d<=rl){try{await n(),l()}catch(m){console.error("Failed to keep session alive:",m),await a(),c()}return}},nl)},c=()=>{r.current&&clearInterval(r.current)}};import{useQueryClient as al}from"@tanstack/react-query";import{useEffect as il}from"react";import{ParaEvent as ee}from"@getpara/web-sdk";var Wr=({onLogin:e,onLogout:t,onAccountSetup:o,onAccountCreation:a,onSignMessage:n,onSignTransaction:r,onWalletCreated:s,onPregenWalletClaimed:l,onExternalWalletChange:c,onWalletsChange:u}={})=>{let d=al(),m=H(),C=Z(g=>g.clearSelectedWallet),{selectedWallet:p,setSelectedWallet:f}=ue(),w=g=>{D(),e?.(g)},T=g=>{D(),o?.(g)},D=()=>{d.invalidateQueries({queryKey:[Se],exact:!1}),d.invalidateQueries({queryKey:[ge],exact:!1})},I=g=>{a?.(g)},O=g=>{d.invalidateQueries({queryKey:[Se],exact:!1}),C(),t?.(g)},A=g=>{n?.(g)},v=g=>{r?.(g)},b=g=>{E(),u?.(g)},S=g=>{E(),c?.(g)},x=g=>{s?.(g)},F=g=>{l?.(g)},E=()=>{if(!m){C();return}if(!p?.id||!m.findWallet(p?.id)){let g=m.findWallet(void 0,void 0,{forbidPregen:!0});f({id:g?.id,type:g?.type})}};il(()=>(window.addEventListener(ee.LOGIN_EVENT,w),window.addEventListener(ee.ACCOUNT_SETUP_EVENT,T),window.addEventListener(ee.ACCOUNT_CREATION_EVENT,I),window.addEventListener(ee.LOGOUT_EVENT,O),window.addEventListener(ee.SIGN_MESSAGE_EVENT,A),window.addEventListener(ee.SIGN_TRANSACTION_EVENT,v),window.addEventListener(ee.WALLETS_CHANGE_EVENT,b),window.addEventListener(ee.EXTERNAL_WALLET_CHANGE_EVENT,S),window.addEventListener(ee.WALLET_CREATED,x),window.addEventListener(ee.PREGEN_WALLET_CLAIMED,F),()=>{window.removeEventListener(ee.LOGIN_EVENT,w),window.removeEventListener(ee.ACCOUNT_SETUP_EVENT,T),window.removeEventListener(ee.ACCOUNT_CREATION_EVENT,I),window.removeEventListener(ee.LOGOUT_EVENT,O),window.removeEventListener(ee.SIGN_MESSAGE_EVENT,A),window.removeEventListener(ee.SIGN_TRANSACTION_EVENT,v),window.removeEventListener(ee.WALLETS_CHANGE_EVENT,b),window.removeEventListener(ee.EXTERNAL_WALLET_CHANGE_EVENT,S),window.removeEventListener(ee.WALLET_CREATED,x),window.removeEventListener(ee.PREGEN_WALLET_CLAIMED,F)}),[m])};import{ParaInternal as ll}from"@getpara/react-common";var cl={disableAutoSessionKeepAlive:!1},pl=({children:e,paraClientConfig:t,callbacks:o,config:a=cl})=>{Wr(o),wr({disabled:a.disableAutoSessionKeepAlive});let n=Z(r=>r.setClient);return sl(()=>{let r=a.paraClientOverride??new ll(t.env,t.apiKey,t.opts);n(r)},[t,a.paraClientOverride]),e};var LS=()=>dt.getState().client,MS=()=>dt.getState().isOpen,OS=()=>dt.getState().selectedWalletId,NS=()=>dt.getState().selectedWalletType;import{jsx as je,jsxs as tn}from"react/jsx-runtime";var Mr=({address:e,showAddFunds:t})=>{let o=N(),a=o.externalWallets[e];return a?je(Or,{address:Lr(a.address,a.type),identiconHash:o.getIdenticonHash(a.id,a.type),showAddFunds:t}):null},Xt=({id:e,type:t,showAddFunds:o})=>{let a=N(),n=y(l=>l.appName),r=a.findWallet(e,t);if(!r)return null;let s=a.getDisplayAddress(r.id,{addressType:t});return je(Or,{id:r.id,type:r.type,address:Lr(s,t,{prefix:a.cosmosPrefix}),name:r.name??`${n?`${n} `:""}Wallet`,identiconHash:a.getIdenticonHash(r.id,t),showAddFunds:o})},Or=({address:e,name:t,identiconHash:o,showAddFunds:a,id:n,type:r})=>{let s=i(m=>m.onRampConfig),{setSelectedWallet:l}=ue(),c=i(m=>m.setStep),u=s.isBuyEnabled||s.isReceiveEnabled;return tn(ml,{children:[tn(Cl,{children:[je(ul,{size:"48px",hash:o}),tn(fl,{children:[!!t&&je(_r,{color:"contrast",variant:"bodyL",weight:"semiBold",children:t}),je(_r,{color:"secondary",variant:"bodyS",weight:"medium",children:e})]})]}),a&&u&&je(Al,{onClick:()=>{n&&r&&(l({id:n,type:r}),u&&c(s.isBuyEnabled?"ADD_FUNDS_BUY":"ADD_FUNDS_RECEIVE"))},children:je(Rr,{variant:"bodyXS",color:"contrast",weight:"medium",children:"Add Funds"})})]})},zt=At.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
flex-direction: column;
|
|
74
74
|
gap: 8px;
|
|
75
75
|
width: 100%;
|
|
76
|
-
`,
|
|
76
|
+
`,ml=At.div`
|
|
77
77
|
width: 100%;
|
|
78
78
|
padding: 24px;
|
|
79
79
|
display: flex;
|
|
@@ -82,13 +82,13 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
82
82
|
gap: 16px;
|
|
83
83
|
background-color: var(--cpsl-color-background-8);
|
|
84
84
|
border-radius: 16px;
|
|
85
|
-
`,
|
|
85
|
+
`,Cl=At.div`
|
|
86
86
|
display: flex;
|
|
87
87
|
justify-content: flex-start;
|
|
88
88
|
gap: 8px;
|
|
89
89
|
align-items: center;
|
|
90
90
|
overflow: hidden;
|
|
91
|
-
`,
|
|
91
|
+
`,fl=At.div`
|
|
92
92
|
flex: 1;
|
|
93
93
|
display: flex;
|
|
94
94
|
flex-direction: column;
|
|
@@ -96,7 +96,7 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
96
96
|
align-items: flex-start;
|
|
97
97
|
justify-content: center;
|
|
98
98
|
overflow: hidden;
|
|
99
|
-
`,
|
|
99
|
+
`,_r=At(Rr)`
|
|
100
100
|
width: 100%;
|
|
101
101
|
&::part(text-element) {
|
|
102
102
|
line-height: 100%;
|
|
@@ -104,7 +104,7 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
104
104
|
overflow: hidden;
|
|
105
105
|
white-space: nowrap;
|
|
106
106
|
}
|
|
107
|
-
`,
|
|
107
|
+
`,Al=At(dl)`
|
|
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 am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
115
115
|
--button-padding-top: 8px;
|
|
116
116
|
--button-padding-bottom: 8px;
|
|
117
117
|
--button-border-radius: 8px;
|
|
118
|
-
`;import{jsx as Ot,jsxs as
|
|
118
|
+
`;import{jsx as Ot,jsxs as El}from"react/jsx-runtime";var Nr=({onClose:e})=>{let t=N(),o=y(a=>a.hideWallets);return Sl(()=>{setTimeout(()=>{e()},1600)},[]),El(k,{children:[Ot(Ve,{icon:"checkCircleFilled"}),Ot(z,{variant:"headingS",weight:"bold",children:"Connected"}),!o&&Ot(zt,{children:t.isUsingExternalWallet()?Ot(Mr,{address:t.currentExternalWalletAddresses?.[0]}):t.currentWalletIdsArray.map(([a,n])=>Ot(Xt,{id:a,type:n},`${a}-${n}`))})]})};import{EnabledFlow as Wo}from"@getpara/web-sdk";import{CpslSpinner as hl,CpslText as Tl}from"@getpara/react-components";import{jsx as Qt,jsxs as vr}from"react/jsx-runtime";var $e=({heading:e,subheading:t})=>vr(k,{$wide:!0,children:[Qt(jn,{children:Qt(hl,{size:100})}),vr(_,{children:[Qt(z,{variant:"headingS",weight:"bold",children:e}),Qt(Tl,{variant:"bodyS",color:"secondary",weight:"medium",children:t})]})]});import{jsx as Il}from"react/jsx-runtime";var br=()=>{let e=i(t=>t.isLogin());return Il($e,{heading:e?"Waiting for Passkey":"Creating Passkey",subheading:"Follow the prompts presented by your browser."})};import{CpslIcon as gl,CpslInfoBox as yl,CpslText as Dr}from"@getpara/react-components";import{useEffect as xl,useRef as wl,useState as Wl}from"react";import{jsx as qt,jsxs as Zt}from"react/jsx-runtime";var Ur=()=>{let e=y(n=>n.hideWallets),[t,o]=Wl(!1),a=wl();return xl(()=>(typeof window<"u"&&(a.current=window.setTimeout(()=>{o(!0)},4e3)),()=>clearTimeout(a.current)),[]),Zt(k,{$wide:!0,children:[qt($e,{heading:e?"Creating Your Account":"Creating Your Wallet",subheading:"This should only take a couple of seconds."}),t&&qt(yl,{children:Zt(er,{children:[Zt(tr,{children:[qt(gl,{icon:"clock"}),qt(Dr,{weight:"medium",children:"Hang on"})]}),Zt(Dr,{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 _l,CpslText as Rl}from"@getpara/react-components";import Ll from"styled-components";import{Fragment as Ol,jsx as et,jsxs as Pr}from"react/jsx-runtime";var Fr=({twoFactorAuthEnabled:e,onClose:t})=>{let o=y(u=>u.hideWallets),a=i(u=>u.setStep),n=i(u=>u.isLogin()),r=i(u=>u.onRampConfig),s=N(),l=r?.isBuyEnabled||r?.isReceiveEnabled||r?.isWithdrawEnabled,c=async()=>{if(n){if(!e){a("LOGIN_DONE");return}let u=await s.check2FAStatus();a(u?"LOGIN_DONE":"SETUP_2FA")}else e?a("SETUP_2FA"):t()};return Pr(k,{$wide:!0,children:[et(Ml,{children:o?Pr(Ol,{children:[et(Ve,{icon:"checkCircleFilled"}),et(Rl,{variant:"bodyM",color:"secondary",weight:"medium",style:{marginTop:"16px"},children:"Your account has been created."})]}):et(zt,{children:s.currentWalletIdsArray.map(([u,d])=>et(Xt,{id:u,type:d,showAddFunds:l},u))})}),et(_,{children:et(_l,{fullWidth:!0,onClick:c,children:e?"Continue":"Done"})})]})},Ml=Ll(_)`
|
|
119
119
|
min-height: 196px;
|
|
120
120
|
justify-content: center;
|
|
121
|
-
`;import{CpslButton as
|
|
121
|
+
`;import{CpslButton as Nl,CpslText as Jt}from"@getpara/react-components";import{styled as nn}from"styled-components";import{useCopyToClipboard as vl}from"@getpara/react-common";function kr(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 bl}from"react";import{Fragment as Ul,jsx as Ee,jsxs as St}from"react/jsx-runtime";var Hr=({email:e,value:t,onComplete:o})=>{let[a,n]=bl(!1),[r,s]=vl();return St(Ul,{children:[St(_,{children:[Ee(z,{variant:"headingXS",weight:"semiBold",children:"Save your Recovery Secret"}),St(Dl,{children:[Ee(on,{icon:"download",onClick:()=>{let d=document.createElement("a"),m=new Blob([t],{type:"text/plain"});d.href=URL.createObjectURL(m),d.download="recovery.txt",document.body.appendChild(d),d.click(),n(!0)},children:Ee(Jt,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Download"})}),Ee(on,{icon:r?"check":"copy",onClick:()=>{s(t),n(!0)},children:Ee(Jt,{variant:"bodyXS",color:"secondary",weight:"medium",children:r?"Copied!":"Copy"})}),Ee(on,{icon:"send",onClick:()=>{typeof window<"u"&&window.open(kr(e,t),"_self"),n(!0)},children:Ee(Jt,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Email"})})]})]}),Ee(_,{children:Ee(Nl,{fullWidth:!0,onClick:o,disabled:!a,children:a?"I\u2019ve saved my recovery secret":"Choose an option above to continue"})})]})},Gr=()=>{let e=y(s=>s.hideWallets),t=i(s=>s.setStep),o=$(s=>s.getAuthInfo()),a=$(s=>s.recoveryShare),n=JSON.parse(a||"{}").backupDecryptionKey,r=async()=>{t("WALLET_CREATION_DONE")};return St(k,{children:[St(_,{children:[Ee(z,{variant:"headingS",weight:"bold",children:e?"Don't lose access":"Don't lose your wallet"}),St(Br,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your"," ",Ee(Br,{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."]})]}),Ee(Hr,{email:o?.authType==="email"?o.identifier:void 0,value:n,onComplete:r})]})},on=nn(Ge)`
|
|
122
122
|
flex: 1;
|
|
123
123
|
|
|
124
124
|
--button-icon-color: var(--cpsl-color-text-primary);
|
|
125
|
-
`,
|
|
125
|
+
`,Dl=nn.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
|
+
`,Br=nn(Jt)`
|
|
132
132
|
text-align: center;
|
|
133
133
|
display: inline-block;
|
|
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)`
|
|
134
|
+
`;import{CpslButton as Pl,CpslText as Fl}from"@getpara/react-components";import{jsx as rn,jsxs as an}from"react/jsx-runtime";var Vr=({onClose:e})=>{let t=y(o=>o.hideWallets);return an(k,{children:[rn(Ve,{icon:"checkCircleFilled"}),an(_,{children:[rn(z,{variant:"headingXS",weight:"semiBold",children:"Success"}),an(Fl,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your ",t?"account":"wallet"," is now protected by 2FA"]})]}),rn(Pl,{fullWidth:!0,onClick:e,children:"Done"})]})};import{CpslButton as sn,CpslDivider as Kl,CpslIcon as ln,CpslQrCode as Yl,CpslSpinner as Xl,CpslText as Qr}from"@getpara/react-components";import{useCopyToClipboard as zl,UserIdentifier as Ql}from"@getpara/react-common";var Ke={LOGGIN_POLLING_DELAY_MS:5e3,POLLING_INTERVAL_MS:2e3,ANIMATION_DURATION:.15};import{createContext as kl,useCallback as $r,useContext as eo,useEffect as Bl,useMemo as Et,useState as Kr}from"react";import{WalletType as ye,isIOS as Hl,isIOSWebview as Gl,isMobile as jt,truncateAddress as Yr}from"@getpara/web-sdk";import{jsx as $l}from"react/jsx-runtime";var Vl={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:()=>{}},Xr=kl(Vl);function zr({children:e,evmContext:t,solanaContext:o,cosmosContext:a,walletSort:n}){let{wallets:r,disconnect:s,chains:l,chainId:c,switchChain:u,username:d,avatar:m}=eo(t),{wallets:C,disconnect:p}=eo(o),{wallets:f,disconnect:w,chains:T,chainId:D,switchChain:I}=eo(a),O=i(L=>L.setStep),A=i(L=>L.setStepDirection),v=i(L=>L.setIsExternalWalletConnecting),b=i(L=>L.isExternalWalletConnecting),S=i(L=>L.setSelectedExternalWalletId),x=i(L=>L.selectedExternalWalletId),F=i(L=>L.setExternalWalletError),E=i(L=>L.setIsUsingMobileConnector),g=i(L=>L.isUsingMobileConnector),P=N(),[Y,R]=Kr(),[re,q]=Kr(),le=[...r,...C,...f].filter(L=>n.includes(L.id.toUpperCase())).sort((L,V)=>n.indexOf(L.id.toUpperCase())-n.indexOf(V.id.toUpperCase())).sort((L,V)=>L.installed===V.installed?0:L.installed?-1:1),G=Et(()=>le.find(L=>L.id===x),[le,x]),M=async()=>{let L=await G?.getQrUri?.();R(L)};Bl(()=>{G?Y||M():Y&&R(void 0)},[G]);let J=Et(()=>{switch(P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type){case ye.COSMOS:return T;case ye.EVM:return l;default:return[]}},[T,l,x]),h=Et(()=>{switch(P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type){case ye.COSMOS:return D;case ye.EVM:return c?.toString();default:return}},[T,l,x]),K=$r(async L=>{let V=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type;if(V){let Ce;switch(F(),q(L),V){case ye.COSMOS:{O("CHAIN_SWITCH"),Ce=await I(L);break}case ye.EVM:{O("CHAIN_SWITCH"),Ce=await u(parseInt(L));break}default:break}Ce.error?F(Ce.error):(q(void 0),A(-1),O("ACCOUNT_MAIN"))}},[u,I]),U=$r(async(L,V,Ce,ko)=>{if(b&&Ce&&(await s(),await p(),await w(),R(void 0),v(!1)),ko||Ce||!b){F(),v(!0),E(V);let{address:wt,error:be}=await(V?L.connectMobile(Ce):L.connect());if(be){if(F([be]),E(),Ce&&be==="Connection request rejected"){F(),await U(L,!1,!1,!0),await M();return}}else wt&&O("LOGIN_DONE");v(!1)}},[b]),ie=async()=>{await s(),await p(),await w(),S()},pe={showExtension:!jt()&&(G?.isExtension&&G?.installed||!G?.isMobile||G?.type===ye.SOLANA),showMobile:jt()&&G?.isMobile||!jt()&&!G?.installed,isSolanaMobileIOS:Hl()&&jt()&&!Gl()&&G?.type===ye.SOLANA,isCosmosMobileWallet:G?.type===ye.COSMOS&&g},_e=Et(()=>{let L,V=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""];if(V)switch(V?.type){case ye.EVM:{L=d?d.startsWith("0x")?Yr(d,"EVM"):d:void 0;break}default:{L=V.address?Yr(V.address,V.type):void 0;break}}return L},[d,G]),de=Et(()=>{let L=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type;if(L)switch(L){case ye.EVM:return m;default:return}},[m,G]);return $l(Xr.Provider,{value:Et(()=>({wallets:le,chains:J,chainId:h,wallet:G,qrUri:Y,walletDisplayHelpers:pe,chainIdSwitchingTo:re,username:_e,avatar:de,connectExternalWallet:U,disconnectExternalWallet:ie,switchChain:K,setChainIdSwitchingTo:q}),[le,J,h,G,Y,pe,re,_e,de,ie,U,K,q]),children:e})}var X=()=>eo(Xr);var he=()=>{let e=i(l=>l.step),t=i(l=>l.setStep),o=i(l=>l.accountAddFundTab),a=i(l=>l.decrementStep),n=i(l=>l.resetState),{setChainIdSwitchingTo:r}=X();return()=>{switch(e==="ADD_FUNDS_AWAITING"?t(pt(o)):a(),e){case"AUTH_MAIN":case"AUTH_MORE":{n();break}case"CHAIN_SWITCH":{r();break}}}};function to(){let e=N(),t=he(),o=i(c=>c.refs),a=i(c=>c.setStep),n=i(c=>c.webAuthURLForCreate),r=i(c=>c.setWebAuthURLForCreate),s=i(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(""),s(""),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=Je({url:n,target:"ParaPasskey",type:"CREATE_PASSKEY",current:o.popupWindow.current}),o.poll.current={action:"createPasskey",timeout:window.setTimeout(l,Ke.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,Ke.POLLING_INTERVAL_MS)},o.currentStep.current!=="PASSWORD_CREATION"&&a("PASSWORD_CREATION"))}}}import{isPasskeySupported as ql}from"@getpara/web-sdk";import{Fragment as qr,jsx as xe,jsxs as Ye}from"react/jsx-runtime";var Zr=()=>{let e=to(),t=i(c=>c.webAuthURLForCreate),o=i(c=>c.iFrameUrl),a=$(c=>c.getAuthInfo()),[n,r]=zl(),s=()=>{r(t)},l=!!t&&!!o;return Ye(k,{$wide:!0,children:[Ye(_,{children:[xe(z,{variant:"headingS",weight:"bold",children:l?"Secure Your Account":"Create Passkey"}),xe(Ql,{...a}),xe(Qr,{variant:"bodyS",color:"secondary",weight:"medium",children:l?"Choose a password or set up a passkey":"Your Passkey keeps your account safe."})]}),Ye(_,{children:[ql()?Ye(sn,{fullWidth:!0,onClick:e.withPasskey,children:[xe(ln,{slot:"start",icon:"key"}),l?"Create Passkey":"Create"]}):Ye(qr,{children:[xe(Qr,{weight:"semiBold",children:"Scan with your mobile device"}),xe(Ae,{children:t?xe(Yl,{url:t}):xe(Xl,{size:100})}),Ye(sn,{size:"small",variant:"ghost",onClick:s,children:[xe(ln,{slot:"start",icon:n?"check":"copy"}),n?"Copied":"Copy Link"]})]}),l&&Ye(qr,{children:[xe(Kl,{children:"or"}),Ye(sn,{fullWidth:!0,onClick:e.withPassword,children:[xe(ln,{slot:"start",icon:"passcode"}),"Choose Password"]})]})]})]})};import{jsx as Zl}from"react/jsx-runtime";var Jr=()=>Zl($e,{heading:"Complete Login",subheading:"Follow the prompts presented by your browser."});import{EnabledFlow as nt,getOnRampAssets as mc,getOnRampNetworks as Cc,OnRampProvider as fc,OnRampPurchaseType as ao,toAssetInfoArray as Ac,WalletType as Cn}from"@getpara/web-sdk";import{CpslButton as Sc,CpslDivider as Ec,CpslIcon as ia,CpslIdenticon as hc,CpslQrCode as Tc,CpslSpinner as sa,CpslTab as Ic,CpslTabs as gc,CpslText as pa}from"@getpara/react-components";import{useEffect as fn,useMemo as la}from"react";import{useState as tc}from"react";import{Network as Re,OnRampAsset as Le,OnRampMethod as Ue,OnRampProvider as cn}from"@getpara/core-sdk";var pn="https://connect.getpara.com/",jr="https://getpara.com/terms",dn={[cn.STRIPE]:{name:"Stripe",feeLower:.99,feeUpper:4.49,methods:[Ue.ACH,Ue.DEBIT,Ue.CREDIT],icon:"stripeBrand",backgroundColors:["#6772E5","#808AF4"]},[cn.RAMP]:{name:"Ramp",feeLower:.99,feeUpper:4.49,methods:[Ue.ACH,Ue.DEBIT,Ue.CREDIT],icon:"rampNetworkBrand",backgroundColors:["#21BF73","#3AE492"]},[cn.MOONPAY]:{name:"MoonPay",feeLower:1,feeUpper:4.5,methods:[Ue.ACH,Ue.DEBIT,Ue.CREDIT],icon:"moonpayBrand",backgroundColors:["#7715F5","#9647fd"]}},un={[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"}},mn={[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 Nt(e){return un[e]?.name??`${e[0]}${e.slice(1).toLowerCase()}`}function Jl(e){return un[e]?.icon??"globe"}function jl(e){return mn[e]?.code??e}function ec(e){return mn[e]?.icon??"emptyCircle"}var Xe=480,oo="network not supported",ea=/^(([^<>()[\]\\.,;:\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,}))$/,no={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})},ro={duration:.2};import tt from"styled-components";import{CpslButton as oc,CpslIcon as na,CpslSpinner as nc,CpslText as rc}from"@getpara/react-components";import{motion as ac}from"framer-motion";import{jsx as ze,jsxs as oa}from"react/jsx-runtime";var ra=({config:e,index:t,onClick:o})=>{let[a,n]=tc(!1),r=e.providers[t],{feeLower:s,feeUpper:l,name:c,icon:u,backgroundColors:d}=dn[r],m=`Fee ${s}% - ${l}%`;return ze(ic,{$gradientColors:d,fullWidth:!0,onClick:async()=>{n(!0),await o(),n(!1)},children:oa(sc,{$backgroundColor:d[1],children:[ze(pc,{children:ze(na,{icon:u})}),oa(lc,{children:[ze(ta,{variant:"bodyL",weight:"medium",children:c}),ze(cc,{children:ze(ta,{variant:"bodyXS",weight:"medium",children:m})})]}),a?ze(nc,{size:16}):ze(dc,{icon:"chevronUp"})]})})},ic=tt(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
|
-
`,sc=
|
|
139
|
+
`,sc=tt(ac.div)`
|
|
140
140
|
display: flex;
|
|
141
141
|
gap: 8px;
|
|
142
142
|
flex: 1;
|
|
@@ -145,16 +145,16 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
145
145
|
& cpsl-spinner {
|
|
146
146
|
--background-color: ${({$backgroundColor:e})=>`${e}`};
|
|
147
147
|
}
|
|
148
|
-
`,lc=
|
|
148
|
+
`,lc=tt.div`
|
|
149
149
|
flex: 1;
|
|
150
150
|
display: flex;
|
|
151
151
|
flex-direction: column;
|
|
152
152
|
align-items: start;
|
|
153
153
|
gap: 2px;
|
|
154
|
-
`,cc=
|
|
154
|
+
`,cc=tt.div`
|
|
155
155
|
display: flex;
|
|
156
156
|
gap: 16px;
|
|
157
|
-
`,pc=
|
|
157
|
+
`,pc=tt.span`
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: center;
|
|
160
160
|
justify-content: center;
|
|
@@ -162,19 +162,19 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
162
162
|
border-radius: 100%;
|
|
163
163
|
height: 48px;
|
|
164
164
|
width: 48px;
|
|
165
|
-
`,
|
|
165
|
+
`,ta=tt(rc)`
|
|
166
166
|
&::part(text-element) {
|
|
167
167
|
color: #fff;
|
|
168
168
|
}
|
|
169
|
-
`,dc=
|
|
169
|
+
`,dc=tt(na)`
|
|
170
170
|
transform: rotate(90deg);
|
|
171
171
|
--icon-color: #fff;
|
|
172
|
-
`;import{isMobile as yc}from"@getpara/web-sdk";import{useMemo as uc}from"react";function
|
|
172
|
+
`;import{isMobile as yc}from"@getpara/web-sdk";import{useMemo as uc}from"react";function ot(){let e=N(),{selectedWallet:t}=ue();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 Mh}from"date-fns";var aa=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 An from"styled-components";import{Fragment as io,jsx as te,jsxs as we}from"react/jsx-runtime";var ca=[[nt.BUY,"isBuyEnabled","creditCard","Buy"],[nt.RECEIVE,"isReceiveEnabled","qrCode","Receive"],[nt.WITHDRAW,"isWithdrawEnabled","arrowCircleBrokenDownLeft","Withdraw"]],Lc={[Cn.EVM]:"Ethereum or EVM-based L2s",[Cn.SOLANA]:"Solana",[Cn.COSMOS]:"Cosmos"},da=()=>{let[e,t]=Rc(),o=N(),a=y(A=>A.appName),n=i(A=>A.onRampConfig),r=y(A=>A.hideWallets),s=i(A=>A.accountAddFundTab),l=i(A=>A.setStep),c=i(A=>A.setOnRampPurchase),{chainId:u}=X(),d=ot(),m=ca.filter(([,A])=>!!n[A]),C=m.length>1,p=s??m[0][0],f=la(()=>d?o.getDisplayAddress(d.id,{addressType:d.type}):"",[o,d?.id,d?.type]),w=A=>{l(pt(A.detail.tab))},T=()=>{t(f)},[D,I,O]=la(()=>{if(!n||!d)return[[],[],{}];let A=p===nt.BUY?ao.BUY:ao.SELL,v=Wc(u),S=d.isExternal&&!!v?[_c(v,n.testMode)]:Cc(n.assetInfo,{walletType:d.type,allowed:n.allowedAssets?Object.keys(n.allowedAssets):void 0}),x=S.reduce((E,g)=>{let P=n.allowedAssets?.[g],Y=P===!0?void 0:P;return{...E,[g]:mc(n.assetInfo,{walletType:d.type,network:g,allowed:Y})}},{}),F=n.providers.reduce((E,g)=>{let P=Ac(n.assetInfo).some(([Y,R,re,q])=>Y===d.type&&S.includes(R)&&(!x[R]||x[R].includes(re))&&!!q[g]?.[1]?.[A]);return{...E,[g]:P}},{});return[S,[...new Set(Object.values(x).flat())],F]},[d?.type,d?.isExternal,p,n.assetInfo,n.allowedAssets,u]);return fn(()=>{c(void 0)},[]),fn(()=>{c(void 0)},[]),!n||!d?te(Mc,{children:te(sa,{})}):(fn(()=>{c(void 0)},[]),we(k,{children:[C&&te(_,{children:te(gc,{selectedTab:p,onCpslTabsChanged:w,children:ca.map(([A,v,b,S])=>we(Ic,{tab:A,children:[te(ia,{slot:"start",icon:b}),S]},A))})}),te(io,{children:[nt.BUY,nt.WITHDRAW].includes(p)?we(io,{children:[te(z,{variant:"headingS",weight:"bold",children:"Choose Provider"}),we(Oc,{children:[we(Nc,{isHidden:Object.values(O).some(A=>!!A),variant:"bodyM",children:["No providers are available for this ",r?"account":"wallet"]}),te(wc,{children:n.providers.map((A,v)=>O[A]?te(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:te(ra,{config:n,index:v,onClick:async()=>{if(!d?.type)return;let b=A!==fc.RAMP,{onRampPurchase:S}=await o.initiateOnRampTransaction({walletId:d.isExternal?void 0:d.id,externalWalletAddress:d.isExternal?d.id:void 0,shouldOpenPopup:b,params:{type:p===nt.BUY?ao.BUY:ao.SELL,walletType:d.type,provider:A,networks:D,assets:I,defaultNetwork:n.defaultOnRampNetwork,defaultAsset:n.defaultOnRampAsset,fiatQuantity:n.defaultBuyAmount?.[0],testMode:n.testMode}});c({...S,fiat:"USD"}),!b&&l("ADD_FUNDS_AWAITING")}},A)},A):null)})]})]}):we(io,{children:[te(_,{children:we(_t,{noAutoDisable:!0,readonly:!0,placeholder:f,children:[te(hc,{slot:"start",size:"32px",hash:o.getIdenticonHash(d.id,d.type)}),te(Sc,{slot:"end",variant:"ghost",onClick:T,children:te(ia,{icon:e?"check":"copy"})})]},f)}),!yc()&&we(io,{children:[te(Ec,{children:"or"}),we(_,{children:[te(Ae,{children:f?te(Tc,{url:f},f):te(sa,{size:100})}),te(pa,{weight:"semiBold",color:"secondary",children:"Scan with your crypto wallet"})]})]}),we(_,{children:[we(ae,{weight:"semiBold",children:[n.allowedAssets&&D.length>0||r?a??"This App":"This Wallet"," ","Only Supports:"]}),te(ae,{weight:"medium",color:"secondary",children:n.allowedAssets&&D.length>0?aa(D):Lc[d.type]})]})]})})]}))},Mc=An(k)`
|
|
173
173
|
margin: 50% 0;
|
|
174
|
-
`,Oc=
|
|
174
|
+
`,Oc=An(_)`
|
|
175
175
|
position: relative;
|
|
176
176
|
min-height: 270px;
|
|
177
|
-
`,Nc=
|
|
177
|
+
`,Nc=An(pa)`
|
|
178
178
|
width: 100%;
|
|
179
179
|
text-align: center;
|
|
180
180
|
visibility: ${({isHidden:e})=>e?"hidden":"visible"};
|
|
@@ -183,9 +183,9 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
183
183
|
left: 0;
|
|
184
184
|
right: 0;
|
|
185
185
|
transition: visibility 0.2s;
|
|
186
|
-
`;import{OnRampProvider as
|
|
186
|
+
`;import{OnRampProvider as Sn}from"@getpara/web-sdk";import{lazy as vc,useEffect as ua,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 so}from"react/jsx-runtime";var kc={CANCELLED:"ADD_FUNDS_FAILURE",FINISHED:"ADD_FUNDS_SUCCESS"},ma=()=>{let e=i(C=>C.setStep),t=he(),o=i(C=>C.onRampConfig),a=i(C=>C.onRampPurchase),n=i(C=>C.setOnRampPurchase),r=N(),s=y(C=>C.appName),l=y(C=>C.isDark),[c,u]=Dc(null),d={para:r,appName:s,onRampConfig:o,onRampPurchase:a,isDark:l,isEmbedded:!0,setOnRampPurchase:n,onClose:t};ua(()=>{let C=vc(()=>import("./MoonPayEmbed-GAWXP6V7.js"));u(C)},[]);let m=bc(()=>{if(!a.id)return null;switch(a?.provider){case Sn.STRIPE:return so(Pc,{...d});case Sn.MOONPAY:return!c||typeof window>"u"?null:so(c,{...d});case Sn.RAMP:return so(Uc,{apiKey:o.rampApiKey,...d})}},[a?.provider,c]);return ua(()=>{let C;return a?.status&&["CANCELLED","FINISHED"].includes(a.status)&&(C=setTimeout(()=>{e(kc[a.status])},5e3)),()=>clearTimeout(C)},[a?.status]),so(Bc,{$wide:!0,children:m})},Bc=Fc(k)`
|
|
187
187
|
flex: 1;
|
|
188
|
-
`;import{useMemo as Hc}from"react";import{CpslButton as Gc,CpslText as Vc}from"@getpara/react-components";import{jsx as
|
|
188
|
+
`;import{useMemo as Hc}from"react";import{CpslButton as Gc,CpslText as Vc}from"@getpara/react-components";import{jsx as lo,jsxs as Ca}from"react/jsx-runtime";var En=({isSuccess:e,onClose:t})=>{let o=y(d=>d.hideWallets),a=i(d=>d.setStep),n=i(d=>d.onRampPurchase),r=i(d=>d.accountAddFundTab),s=Hc(()=>new Intl.NumberFormat("en-US",{style:"currency",currency:n?.fiat||"USD"}),[n?.fiat]),l=e?"Transaction Successful":"Something Went Wrong",c=e?`${s.format(parseFloat(n?.fiatQuantity))} is now available in your ${o?"account":"wallet"}.`:`No funds were added to your ${o?"account":"wallet"}.`;return Ca(k,{children:[lo(Ve,{icon:"checkCircleFilled"}),Ca(_,{children:[lo(z,{variant:"headingS",weight:"bold",children:l}),lo(Vc,{variant:"bodyS",color:"secondary",children:c})]}),lo(Gc,{fullWidth:!0,onClick:()=>{e?t():a(pt(r))},children:e?"Done":"Try Again"})]})};import{useEffect 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 hn,isMobile as qc}from"@getpara/web-sdk";import{Fragment as Jc,jsx as Qe,jsxs as co}from"react/jsx-runtime";var Zc=()=>{let e=$(p=>p.setAuthInfo),t=i(p=>p.setStep),o=i(p=>p.setWebAuthURLForCreate),a=i(p=>p.setIFrameUrl),n=i(p=>p.setIsIFrameReady),r=i(p=>p.setAuthStepRoute),s=i(p=>p.setSupportedAuthMethods),l=i(p=>p.setBiometricLocationHints),c=N(),u=i(p=>p.setFlow),d=i(p=>p.farcasterConnectUri),m=i(p=>p.setFarcasterConnectUri),C=y(p=>p.theme);return $c(()=>{if(d)return(async()=>{let{userExists:f,username:w,pfpUrl:T}=await c.waitForFarcasterStatus();if(e({farcasterUsername:w,pfpUrl:T}),f){let O=await c.initiateUserLoginV2({farcasterUsername:w});if(O.size>0){s(O);let A=O.has(hn.PASSKEY)?await c.getUserBiometricLocationHints():[];u("login"),t("BIOMETRIC_LOGIN"),l(A);return}}let D=await c.getSupportedCreateAuthMethods();n(!1),u("signUp");let I=D.has(hn.PASSKEY);I&&(o(await c.shortenLoginLink(await c.getSetUpBiometricsURL({authType:"farcaster"}))),t("BIOMETRIC_CREATION")),D.has(hn.PASSWORD)&&(a(await c.shortenLoginLink(await c.getSetupPasswordURL({authType:"farcaster",theme:C}))),r(I?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))})(),()=>{m(void 0)}},[d]),Qe(k,{$wide:!0,children:qc()?co(_,{children:[Qe(Qc,{weight:"medium",color:"secondary",children:"Don\u2019t have Farcaster"}),co(Kc,{as:"a",href:"https://link.warpcast.com/download-qr",target:"_blank",variant:"secondary",children:[Qe(Yc,{slot:"start",icon:"linkExternal"}),"Get Farcaster"]})]}):co(Jc,{children:[Qe(z,{variant:"headingS",weight:"bold",children:"Sign in using Farcaster"}),co(_,{children:[Qe(ae,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan the QR code with your phone's camera to proceed."}),Qe(Ae,{children:d?Qe(Xc,{url:d}):Qe(zc,{size:100})})]})]})})},fa=Zc;import{styled as ep}from"styled-components";import{useMemo as jc}from"react";var Aa=()=>{let e=y(r=>r.hideWallets),t=i(r=>r.isLogin()),o=i(r=>r.step),{chainId:a}=X();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 Tn}from"react/jsx-runtime";var Sa=()=>{let{title:e}=Aa(),t=i(a=>a.stepDirection),o=i(a=>a.step);return Tn(tp,{mode:"popLayout",initial:!1,custom:t,children:Tn(np,{custom:t,variants:no,initial:"enter",animate:"center",exit:"exit",transition:ro,slot:"header",id:"header",children:Tn(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 am,defineCustomElements as im,generateTheme as sm}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 Gp,useMemo as Vp}from"react";import{CpslButton as $p,CpslDivider as Kp,CpslIconGroup as Yp}from"@getpara/react-components";import Eo from"styled-components";import We from"styled-components";import{CpslButton as gn,CpslIcon as po,CpslInput as rp,CpslText as bt}from"@getpara/react-components";import{useState as ap}from"react";var In=e=>e.find(t=>t.includes("EXTERNAL")),vt=e=>e.find(t=>t.includes("AUTH"));import{Fragment as Cp,jsx as ne,jsxs as qe}from"react/jsx-runtime";var Ea=3,uo=()=>{let{wallets:e,connectExternalWallet:t}=X(),o=i(f=>f.setSelectedExternalWalletId),a=i(f=>f.setStep),n=i(f=>f.step==="EX_WALLET_MORE"),r=y(f=>f.authLayout),[s,l]=ap(""),c=e.length>Ea,u=n||!c?s?e.filter(f=>f.name.toLowerCase().includes(s.toLowerCase())):e:e.slice(0,Ea),d=!n&&c,m=()=>{a("EX_WALLET_MORE")},C=()=>{a("AUTH_MORE")},p=f=>()=>{o(f.id),a("EX_WALLET_SELECTED"),f.installed?t(f):f.isMobile&&t(f,!0)};return qe(ip,{$maxHeight:n,children:[n&&qe(Cp,{children:[ne(dp,{children:ne(up,{placeholder:"Search for your wallet",onCpslInput:async f=>{l(f.target.value)},value:s,style:{width:"100%"},children:ne(pp,{slot:"start",icon:"search"})})}),vt(r)&&ne(gn,{fullWidth:!0,variant:"tertiary",onClick:C,children:qe(ha,{children:[qe(Ta,{children:[ne(po,{slot:"start",icon:"paraIcon"}),ne(bt,{weight:"medium",children:"Para"})]}),ne(Ia,{$show:!0,$variant:"installed",children:ne(bt,{variant:"body2XS",weight:"medium",children:"Available"})})]})})]}),u.map(f=>n?ne(gn,{fullWidth:!0,variant:"tertiary",onClick:p(f),children:qe(ha,{children:[qe(Ta,{children:[ne(po,{slot:"start",src:f.iconUrl}),ne(bt,{weight:"medium",children:f.name})]}),ne(Ia,{$show:f.isMobile||f.installed,$variant:f.installed?"installed":"mobile",children:ne(bt,{variant:"body2XS",weight:"medium",children:f.installed?"Installed":"Mobile"})})]})},f.id):ne(sp,{src:f.iconUrl,onClick:p(f),children:qe(cp,{children:[f.installed&&ne(lp,{}),ne(bt,{variant:"bodyXS",color:"secondary",weight:"medium",children:f.name})]})},f.id)),d&&qe(gn,{variant:"tertiary",fullWidth:!0,onClick:m,children:[ne(po,{slot:"start",icon:"wallet"}),"More Wallets"]}),n&&ne(mp,{})]})},ip=We.div`
|
|
199
199
|
position: relative;
|
|
200
200
|
display: flex;
|
|
201
201
|
justify-content: center;
|
|
@@ -210,15 +210,15 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
210
210
|
}
|
|
211
211
|
-ms-overflow-style: none;
|
|
212
212
|
scrollbar-width: none;
|
|
213
|
-
`,sp=
|
|
213
|
+
`,sp=We(Ge)`
|
|
214
214
|
flex: 1;
|
|
215
|
-
`,
|
|
215
|
+
`,ha=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
|
+
`,Ta=We.div`
|
|
222
222
|
display: flex;
|
|
223
223
|
align-items: center;
|
|
224
224
|
gap: 8px;
|
|
@@ -231,7 +231,7 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
231
231
|
color: var(--cpsl-color-contrast);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
`,
|
|
234
|
+
`,Ia=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 am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
242
242
|
color: ${({$variant:e})=>e==="installed"?"var(--cpsl-color-utility-green)":"var(--cpsl-color-text-primary)"};
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
`,lp=
|
|
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
|
-
`,cp=
|
|
250
|
+
`,cp=We.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
gap: 4px;
|
|
253
253
|
align-items: center;
|
|
254
|
-
`,pp=
|
|
254
|
+
`,pp=We(po)`
|
|
255
255
|
--icon-color: var(--cpsl-color-contrast);
|
|
256
|
-
`,dp=
|
|
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 am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
261
261
|
top: 0;
|
|
262
262
|
padding-bottom: 4px;
|
|
263
263
|
margin-bottom: -4px;
|
|
264
|
-
`,up=
|
|
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
|
-
`,mp=
|
|
268
|
+
`,mp=We.div`
|
|
269
269
|
position: sticky;
|
|
270
270
|
height: 56px;
|
|
271
271
|
width: 100%;
|
|
@@ -273,16 +273,16 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}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 mo={GOOGLE:"googleBrand",TWITTER:"twitter",APPLE:"apple",DISCORD:"discordBrand",FACEBOOK:"facebookBrand",FARCASTER:"farcasterBrand",TELEGRAM:"telegramBrand"},Co={GOOGLE:"google",TWITTER:"twitter",APPLE:"apple",DISCORD:"discord",FACEBOOK:"facebook",FARCASTER:"farcaster",TELEGRAM:"telegram"};import{useMemo as Fp}from"react";import kp from"styled-components";import{AuthMethod as yn,OAuthMethod as xn}from"@getpara/web-sdk";import{styled as Wa}from"styled-components";var ga=(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 Sp}from"react";import{isAndroid as fp,isMobile as Ap,isTelegram as ya}from"@getpara/web-sdk";var rt=e=>{if(!(typeof window>"u")&&Ap()){if(!e)return;if(!ya()&&e.startsWith("http")){let t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noreferrer noopener",t.click()}else if(ya()){let t=e;fp()&&(t=encodeURI(e)),window.open(t,"_blank","noreferrer noopener")}else window.location.href=e}};import{jsx as wa,jsxs as hp}from"react/jsx-runtime";var Dt=3,_a=({methods:e})=>{let t=he(),o=y(E=>E.oAuthLogoVariant),a=y(E=>E.isDark),n=N(),r=i(E=>E.refs),s=i(E=>E.setFlow),l=i(E=>E.setStep),c=$(E=>E.setAuthInfo),u=i(E=>E.setSupportedAuthMethods),d=i(E=>E.setBiometricLocationHints),m=i(E=>E.setFarcasterConnectUri),C=i(E=>E.farcasterConnectUri),p=i(E=>E.step==="AUTH_MORE"),f=i(E=>E.setIFrameUrl),w=i(E=>E.setIsIFrameReady),T=i(E=>E.setAuthStepRoute),D=i(E=>E.setWebAuthURLForCreate),I=y(E=>E.theme);Sp(()=>{(async()=>{if(!e.includes(xn.FARCASTER))return;let g=await n.getFarcasterConnectURL();m(g)})()},[]);let O=e.length>Dt,A=p||!O?e:e.slice(0,Dt-1),v=()=>{l("AUTH_MORE")},b=E=>async()=>{switch(E){case xn.FARCASTER:if(!C)return;rt(C),l("FARCASTER_OAUTH");break;case xn.TELEGRAM:l("TELEGRAM_OAUTH");break;default:l("AWAITING_OAUTH");let g=await n.getOAuthURL({method:E});r.popupWindow.current=Je({url:g,target:`${E}AuthPopup`,type:"OAUTH",current:r.popupWindow.current});let{email:P,isError:Y,userExists:R}=await n.waitForOAuth({popupWindow:r.popupWindow.current});if(r.popupWindow.current=void 0,(Y||!P)&&r.currentStep.current==="AWAITING_OAUTH"){t();return}if(c({email:P}),R){let G=await n.initiateUserLoginV2({email:P});if(G.size>0){let M=G.has(yn.PASSKEY)?await n.getUserBiometricLocationHints():[];s("login"),l("BIOMETRIC_LOGIN"),u(G),d(M);return}}let re=await n.getSupportedCreateAuthMethods();w(!1),s("signUp");let q=re.has(yn.PASSKEY),le=re.has(yn.PASSWORD);if(q&&(D(await n.shortenLoginLink(await n.getSetUpBiometricsURL({authType:"email"}))),!le)){l("BIOMETRIC_CREATION");return}le&&f(await n.shortenLoginLink(await n.getSetupPasswordURL({authType:"email",theme:I}))),T(q?"BIOMETRIC_CREATION":"PASSWORD_CREATION");break}},S=o==="default",x=S?a:o!=="dark",F=!p&&O;return hp(Ep,{children:[A.map((E,g)=>wa(xa,{$isDark:x,icon:S?mo[E]:Co[E],onClick:b(E),$index:g,$totalItems:F?Dt:A.length},E)),F&&wa(xa,{$isDark:x,icon:"moreLoginOptions",onClick:v,$index:Dt-1,$totalItems:Dt})]})},Ep=Wa.div`
|
|
277
277
|
display: flex;
|
|
278
278
|
justify-content: center;
|
|
279
279
|
gap: 8px;
|
|
280
280
|
flex-wrap: wrap;
|
|
281
|
-
`,Wa
|
|
282
|
-
flex: ${({$index:e,$totalItems:t})=>
|
|
281
|
+
`,xa=Wa(Ge)`
|
|
282
|
+
flex: ${({$index:e,$totalItems:t})=>ga(e,t)};
|
|
283
283
|
|
|
284
284
|
--button-icon-color: ${({$isDark:e})=>e?"white":"black"};
|
|
285
|
-
`;import{CpslButton as
|
|
285
|
+
`;import{CpslButton as Wp,CpslIcon as Wn,CpslInput as _p,CpslSelect as Rp,CpslSelectItem as Lp,CpslSpinner as Mp,CpslText as fo}from"@getpara/react-components";import{useRef as Op,useState as at}from"react";import kt from"styled-components";import{getCountries as Tp,getCountryCallingCode as Ip}from"libphonenumber-js";var gp=["AC","CG","CI","CV","GF","GP","MF","NC","PM","RE","SD","SH","SJ","TA","VA","WF","XK","YT"],yp=()=>Tp().filter(o=>!gp.includes(o)).map(o=>{let a=Ip(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)),xp=yp(),Ut=xp;import{useEffect as wp,useState as wn}from"react";var Pt=e=>{let[t,o]=wn(),[a,n]=wn(),[r,s]=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),s(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 Ra="#################",La={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 Ma}from"@getpara/web-sdk";import{jsx as Me,jsxs as Ft}from"react/jsx-runtime";var Np={label:"United States",value:"+1",selectedLabel:"US",icon:"US"},Oa=({disableEmailLogin:e,disablePhoneLogin:t})=>{let o=Op(null),{dropdownMaxHeight:a,dropdownWidth:n}=Pt(o),r=N(),s=$(M=>M.setAuthInfo),l=$(M=>M.getAuthInfo()),c=i(M=>M.setFlow),u=i(M=>M.setStep),d=i(M=>M.setSupportedAuthMethods),m=i(M=>M.setBiometricLocationHints),[C,p]=at(l?.authType==="phone"?l.auth.countryCode:"+1"),[f,w]=at(!l||["telegram","farcaster"].includes(l.authType)?"":l.authType!=="phone"?l.identifier:l.auth.phone),[T,D]=at(l&&(l.authType==="email"||l.authType==="phone")?l.authType:void 0),[I,O]=at(Np),[A,v]=at(!1),[b,S]=at(""),[x,F]=at(""),E=T==="email",g=T==="phone",P=!T,Y=x?Ut.filter(M=>M.selectedLabel.toLowerCase().includes(x.toLowerCase())||M.label.toLowerCase().includes(x.toLowerCase())||M.value.toLowerCase().includes(x.toLowerCase())):Ut,R=M=>{F(M.detail)},re=M=>{let J=M.detail.value,h=!1,K=!1;if(!t){let U=Ut.find(ie=>ie.value===J);if(U){p(U.value),O(U),D("phone"),w("");return}h=!E&&g?/\d+$/.test(J):/\d\d\d+$/.test(J)}e||(K=/\D.*$/.test(J)),D(K?"email":h?"phone":void 0),w(J)},q=M=>{let J=Ut.find(h=>h.selectedLabel===M.detail);p(J.value),O(J)},le=async()=>{if(S(""),P){S("Please enter a valid email or phone number!");return}let M;if(E){if(!ea.test(f)){S("Please enter a valid email!");return}if(await r.logout(),M={email:f},s(M),await r.checkIfUserExists({email:f})){let h=await r.initiateUserLoginV2(M),K=h.has(Ma.PASSKEY)?await r.getUserBiometricLocationHints():[];c("login"),u("BIOMETRIC_LOGIN"),d(h),m(K);return}await r.createUser(M),c("signUp"),u("VERIFICATIONS");return}if(g){await r.logout();let J=!1;try{J=await r.checkIfUserExistsByPhone({phone:f,countryCode:C})}catch{S("Please enter a valid phone number!");return}if(M={phone:f,countryCode:C},s(M),J){let h=await r.initiateUserLoginV2(M),K=h.has(Ma.PASSKEY)?await r.getUserBiometricLocationHints():[];c("login"),u("BIOMETRIC_LOGIN"),d(h),m(K);return}await r.createUserByPhone(M),c("signUp"),u("VERIFICATIONS");return}},G=async()=>{v(!0),await le(),v(!1)};return e&&t?null:Me("form",{onSubmit:async M=>{M.preventDefault(),await G()},children:Ft(Pp,{ref:o,id:"authInput",placeholder:E||t?"Enter email":g||e?"Enter phone":"Enter email or phone",onCpslInput:re,value:f,errorText:b,autofocus:!0,inputMode:"email",onKeyDown:async M=>M.key==="Enter"&&G(),contrastText:!0,isPhone:g,mask:T==="phone"?La[I.selectedLabel]??Ra:void 0,enterkeyhint:"go",noAutoDisable:!0,disabled:A,"data-testid":"auth-input",children:[Ft(vp,{slot:"start",children:[!e&&(P||E)&&Me(Wn,{"aria-label":"email",icon:"mail"}),!t&&P&&Me(Wn,{"aria-label":"phone",icon:"phone"}),g&&Ft(bp,{selectedValue:I.selectedLabel,onCpslSelectValueChange:q,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(Up,{slot:"selected-item",children:[Me(fo,{children:I.selectedLabel}),Me(fo,{children:I.value})]}),Y.map(M=>Ft(Dp,{slot:"items",value:M.selectedLabel,children:[Me(fo,{children:M.label}),Me(fo,{children:M.value})]},M.selectedLabel))]})]}),f&&Me(Wp,{slot:"end",size:"small",fullWidth:!0,disabled:A,onClick:G,children:A?Me(Mp,{size:16}):Me(Wn,{icon:"arrowNarrow"})})]},"email")})},vp=kt.div`
|
|
286
286
|
height: 100%;
|
|
287
287
|
display: flex;
|
|
288
288
|
align-items: center;
|
|
@@ -293,7 +293,7 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
293
293
|
& cpsl-icon {
|
|
294
294
|
--icon-color: var(--cpsl-color-contrast);
|
|
295
295
|
}
|
|
296
|
-
`,
|
|
296
|
+
`,bp=kt(Rp)`
|
|
297
297
|
--container-height: 100%;
|
|
298
298
|
--container-padding-start: 0px;
|
|
299
299
|
--container-padding-end: 0px;
|
|
@@ -307,7 +307,7 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
&::part(popover) {
|
|
310
|
-
@media (max-width: ${
|
|
310
|
+
@media (max-width: ${Xe}px) {
|
|
311
311
|
top: unset !important;
|
|
312
312
|
bottom: 16px;
|
|
313
313
|
}
|
|
@@ -317,76 +317,76 @@ import{CpslAuthModal as am,defineCustomElements as im,generateTheme as sm}from"@
|
|
|
317
317
|
bottom: 16px;
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
`,
|
|
320
|
+
`,Dp=kt(Lp)`
|
|
321
321
|
&::part(inner-container) {
|
|
322
322
|
justify-content: space-between;
|
|
323
323
|
}
|
|
324
|
-
`,
|
|
324
|
+
`,Up=kt.div`
|
|
325
325
|
display: flex;
|
|
326
326
|
gap: 4px;
|
|
327
327
|
align-items: center;
|
|
328
|
-
`,
|
|
328
|
+
`,Pp=kt(_p)`
|
|
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 Hp,jsx as Ao}from"react/jsx-runtime";var So=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=X(),n=i(s=>s.step==="AUTH_MORE"),r=Fp(()=>{let s=[];return e?.length&&s.push(Ao(_a,{methods:e},"oAuth")),(!t||!o)&&s.push(Ao(Oa,{disableEmailLogin:t,disablePhoneLogin:o},"input")),Ao(Hp,{children:s})},[n,e,t,o,a]);return Ao(Bp,{children:r})},Bp=kp.div`
|
|
333
333
|
display: flex;
|
|
334
334
|
flex-direction: column;
|
|
335
335
|
gap: 8px;
|
|
336
|
-
`;import{Fragment as
|
|
336
|
+
`;import{Fragment as zp,jsx as Pe,jsxs as _n}from"react/jsx-runtime";var ba=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=X(),n=y(p=>p.authLayout),r=i(p=>p.setStep),s=y(p=>p.oAuthLogoVariant),l=y(p=>p.isDark),c=s==="default",u=c?l:s!=="dark",d=()=>{r("AUTH_MORE")},m=()=>{r("EX_WALLET_MORE")},C=Vp(()=>{let p=[];return n.forEach(f=>{switch(f){case"AUTH:FULL":{p.push([Pe(So,{oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o},"authFull"),f]);break}case"AUTH:CONDENSED":{let w=[];e?.forEach(T=>w.push(c?mo[T]:Co[T])),p.push([_n(va,{onClick:d,variant:"tertiary",fullWidth:!0,children:[Pe(Na,{slot:"start",icons:[],$isDark:u}),"Sign Up or Login",Pe(Rn,{slot:"end",icons:w.splice(0,3),$isDark:u})]},"authCondensed"),f]);break}case"EXTERNAL:FULL":{a.length&&p.push([Pe(uo,{},"externalWallets"),f]);break}case"EXTERNAL:CONDENSED":{let w=[];a?.forEach(T=>w.push(T.iconUrl)),p.push([_n(va,{onClick:m,variant:"tertiary",fullWidth:!0,children:[Pe(Na,{slot:"start",icons:[],$isDark:u}),"Connect Wallet",Pe(Rn,{slot:"end",icons:w.splice(0,3),$isDark:u})]},"authCondensed"),f]);break}default:break}}),Pe(zp,{children:p.map(([f,w],T)=>_n(Gp,{children:[f,p.length>1&&T<p.length-1&&Pe(Kp,{children:"or"},"or")]},w))})},[e,t,o,a,n]);return Pe(Xp,{"data-testid":"main-auth-step-content",children:C})},Xp=Eo.div`
|
|
337
337
|
display: flex;
|
|
338
338
|
flex-direction: column;
|
|
339
339
|
gap: 8px;
|
|
340
|
-
`,
|
|
340
|
+
`,Rn=Eo(Yp)`
|
|
341
341
|
--icon-item-color: ${({$isDark:e})=>e?"white":"black"};
|
|
342
342
|
flex: 1;
|
|
343
343
|
justify-content: flex-end;
|
|
344
|
-
`,
|
|
344
|
+
`,Na=Eo(Rn)`
|
|
345
345
|
visibility: hidden;
|
|
346
|
-
`,
|
|
346
|
+
`,va=Eo($p)`
|
|
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 Zp,jsx as Ln,jsxs as Jp}from"react/jsx-runtime";var Da=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let a=y(u=>u.getLogo()),n=y(u=>u.appName),r=y(u=>u.authLayout),s=y(u=>u.embeddedModal),c=r[0].split(":")[0]==="AUTH"?"Sign Up or Login":"Connect Wallet";return Jp(Zp,{children:[a&&Ln(qp,{src:a,alt:`${n?`${n} -`:""}logo`}),!s&&Ln(ae,{variant:a?"bodyM":"headingS",weight:"semiBold",children:c}),Ln(ba,{disableEmailLogin:t,disablePhoneLogin:o,oAuthMethods:e})]})},qp=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
|
|
358
|
+
`;import vn from"styled-components";import{CpslButton as jp,CpslIcon as ed,CpslSpinner as Ua,CpslText as Mn}from"@getpara/react-components";import{useState as td}from"react";import{Fragment as Pa,jsx as Te,jsxs as Nn}from"react/jsx-runtime";var Fa=({onClose:e})=>{let t=i(p=>p.onRampConfig),o=i(p=>p.setStep),a=y(p=>p.hideWallets),{disconnectExternalWallet:n}=X(),r=N(),[s,l]=td(!1),c=!!t,u=()=>{o("ADD_FUNDS_BUY")},d=()=>{o("ADD_FUNDS_RECEIVE")},m=()=>{o("ADD_FUNDS_WITHDRAW")},C=async()=>{l(!0),await r.logout(),await n(),e(),o("AUTH_MAIN"),l(!1)};return Te(k,{$wide:!0,children:Nn(_,{children:[Te(od,{children:c?Nn(Pa,{children:[t.isBuyEnabled&&Te(On,{icon:"creditCard",onClick:u,children:Te(Mn,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Buy Crypto"})}),t.isReceiveEnabled&&Te(On,{icon:"qrCode02",onClick:d,children:Te(Mn,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Receive"})}),t.isWithdrawEnabled&&Te(On,{icon:"arrowCircleBrokenDownLeft",onClick:m,children:Te(Mn,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Withdraw"})})]}):Te(Ua,{})}),Te(nd,{variant:"destructive",fullWidth:!0,onClick:C,disabled:s,children:s?Te(Ua,{size:16}):Nn(Pa,{children:[a?"Logout":"Disconnect Wallet",Te(ed,{icon:"logOut",slot:"end"})]})})]})})},od=vn.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
|
-
`,
|
|
365
|
+
`,On=vn(Ge)`
|
|
366
366
|
flex: 1;
|
|
367
367
|
|
|
368
368
|
--button-icon-color: var(--cpsl-color-text-primary);
|
|
369
|
-
`,
|
|
369
|
+
`,nd=vn(jp)`
|
|
370
370
|
--button-border-width: 0px;
|
|
371
|
-
`;import{CpslButton as
|
|
371
|
+
`;import{CpslButton as ho,CpslIcon as To,CpslQrCode as rd,CpslSpinner as ad,CpslText as bn}from"@getpara/react-components";import{useEffect as ka,useMemo as id}from"react";import it from"styled-components";import{useCopyToClipboard as sd}from"@getpara/react-common";import{isMobile as Ba,isTablet as ld,WalletType as Ha}from"@getpara/web-sdk";import{Fragment as Dn,jsx as Q,jsxs as Oe}from"react/jsx-runtime";var Ya=()=>{let[e,t]=sd(),o=i(m=>m.externalWalletError),a=i(m=>m.setStep),{connectExternalWallet:n,wallet:r,qrUri:s,walletDisplayHelpers:l}=X();ka(()=>{rt(s)},[s]);let c=async()=>{await n(r)},u=()=>{t(s)},d=id(()=>{if(!r)return null;let m=r.id==="walletConnect";Ba()&&m&&_;let{showExtension:p,showMobile:f,isSolanaMobileIOS:w}=l;if(!f&&!p||w&&!r.installed){let T=w?`Solana wallets aren't available on mobile IOS browsers.
|
|
372
372
|
|
|
373
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 Q(_,{children:Q(Ga,{weight:"semiBold",children:T})})}if(p){let T=r.installed;return Oe(_,{children:[T&&!o?.length?Q(ae,{color:"contrast",weight:"semiBold",children:`Confirm connection request in the ${r.name} browser extension.`}):Oe(pd,{children:[Q(dd,{icon:"alertCircle"}),Q(bn,{weight:"semiBold",color:"error",children:T?o?.[0]:`${r.name} not detected`})]}),Oe(ho,{as:T?"button":"a",href:r.downloadUrl??"",target:"_blank",variant:"secondary",onClick:c,children:[Q(To,{slot:"start",icon:T?"refresh":"linkExternal"}),T?"Try Again":`Get ${r.name}`]})]})}if(f){if(r.type===Ha.SOLANA||Ba()&&!ld()){let I=r.type!==Ha.SOLANA||r.installed;return Oe(Dn,{children:[Q(_,{children:!I&&Q(bn,{weight:"semiBold",color:"error",children:`${r.name} not detected`})}),r.id!=="walletConnect"&&Oe(_,{children:[Q(ho,{onClick:()=>rt(s),fullWidth:!0,children:"Connect Wallet"}),Q(Ka,{href:r.downloadUrl??"",target:"_blank",children:Oe(Va,{variant:"secondary",children:[`Get ${r.name}`,Q($a,{icon:"linkExternal"})]})})]})]})}let D=Oe(Va,{variant:"secondary",onClick:m?async()=>{await n(r,!0,!0)}:void 0,children:[`${m?"Open":"Get"} ${r.name}`,Q($a,{icon:"linkExternal"})]});return Oe(Dn,{children:[Oe(_,{children:[Q(bn,{weight:"semiBold",children:"Scan with your mobile device"}),Q(Ae,{children:s?Q(rd,{url:s,imageSrc:r.iconUrl}):Q(ad,{size:100})}),Oe(ho,{size:"small",variant:"ghost",onClick:u,children:[Q(To,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]}),Q(_,{children:m?Q(Dn,{children:D}):Q(Ka,{href:r.downloadUrl??"",target:"_blank",children:D})})]})}},[r,l,o,s]);return ka(()=>{r||a("AUTH_MAIN")},[r]),r?Q(cd,{children:d}):null},cd=it(k)`
|
|
376
376
|
flex: 1;
|
|
377
377
|
justify-content: space-between;
|
|
378
|
-
`,
|
|
378
|
+
`,pd=it.div`
|
|
379
379
|
display: flex;
|
|
380
380
|
align-items: center;
|
|
381
381
|
justify-content: center;
|
|
382
382
|
gap: 4px;
|
|
383
|
-
`,
|
|
383
|
+
`,dd=it(To)`
|
|
384
384
|
--height: 16px;
|
|
385
385
|
--width: 16px;
|
|
386
386
|
--icon-color: var(--cpsl-color-text-error);
|
|
387
|
-
|
|
387
|
+
`,Ga=it(ae)`
|
|
388
388
|
white-space: pre-line;
|
|
389
|
-
`,
|
|
389
|
+
`,Va=it(ho)`
|
|
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 X(M,{children:X($a,
|
|
|
395
395
|
cursor: pointer;
|
|
396
396
|
margin-top: 8px;
|
|
397
397
|
text-decoration: none;
|
|
398
|
-
|
|
398
|
+
`,$a=it(To)`
|
|
399
399
|
--height: 20px;
|
|
400
400
|
--width: 20px;
|
|
401
|
-
`,
|
|
401
|
+
`,Ka=it.a`
|
|
402
402
|
text-decoration: none;
|
|
403
|
-
`;import{CpslHero as
|
|
403
|
+
`;import{CpslHero as ud,CpslIcon as md,CpslIdenticon as Cd}from"@getpara/react-components";import Tt from"styled-components";import{useEffect as fd,useState as Ad}from"react";import{isMobile as Un}from"@getpara/web-sdk";import{Fragment as gd,jsx as ht,jsxs as za}from"react/jsx-runtime";var Pn=({externalWalletError:e})=>({EX_WALLET_SELECTED:{variant:"externalWalletConnection",topOffset:40,spacerHeight:158,hideFadeOut:!0},CHAIN_SWITCH:{variant:e?.[0]?.toLowerCase()===oo?"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}}),Qa=()=>{let e=N(),{wallet:t,walletDisplayHelpers:o,avatar:a}=X(),n=i(v=>v.step),r=i(v=>v.externalWalletError),s=ot(),[l,c]=Ad(n),u=Pn({externalWalletError:r})[l];fd(()=>{let v=Pn({externalWalletError:r})[l],b=Pn({externalWalletError:r})[n];setTimeout(()=>{c(n)},b&&v||b&&!v?0:200)},[n]);let d=l==="EX_WALLET_SELECTED",m=l==="CHAIN_SWITCH",C=l==="ACCOUNT_MAIN",p=l==="FARCASTER_OAUTH",{showExtension:f,isCosmosMobileWallet:w}=o,T=!u||!Un()&&d&&!f||!Un()&&m&&w||!Un()&&p,{variant:D,topOffset:I,spacerHeight:O,hideFadeOut:A}=u??{};return za(gd,{children:[ht(Sd,{$top:-45+I,children:T?null:za(Id,{$isAccount:C,hideFadeOut:A,variant:D,height:480,withDefaultTheme:!0,children:[(d||m)&&ht(Xa,{slot:"connectionLeft",src:t?.iconUrl}),p&&ht(Xa,{slot:"connectionLeft",icon:"farcasterBrand"}),C&&(a?ht(hd,{slot:"image",src:a}):s?ht(Td,{slot:"image",size:"100%",hash:e.getIdenticonHash(s.id,s.type)}):null)]})}),!T&&ht(Ed,{$height:O})]})},Sd=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 X(M,{children:X($a,
|
|
|
408
408
|
width: 100%;
|
|
409
409
|
|
|
410
410
|
top: ${({$top:e})=>`${e}px`};
|
|
411
|
-
`,
|
|
411
|
+
`,Ed=Tt.div`
|
|
412
412
|
height: ${({$height:e})=>`${e}px`};
|
|
413
|
-
`,
|
|
413
|
+
`,Xa=Tt(md)`
|
|
414
414
|
--height: 60px;
|
|
415
415
|
--width: 60px;
|
|
416
|
-
`,
|
|
416
|
+
`,hd=Tt.img`
|
|
417
417
|
width: 100%;
|
|
418
418
|
height: 100%;
|
|
419
419
|
object-fit: contain;
|
|
420
|
-
`,
|
|
420
|
+
`,Td=Tt(Cd)`
|
|
421
421
|
border-radius: 1000px;
|
|
422
|
-
`,
|
|
422
|
+
`,Id=Tt(ud)`
|
|
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 X(M,{children:X($a,
|
|
|
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 yd}from"framer-motion";import{useEffect as xd,useRef as wd,useState as Wd}from"react";import _d from"styled-components";import{jsx as qa}from"react/jsx-runtime";var Za=({children:e,className:t})=>{let o=wd(null),[a,n]=Wd("auto");return xd(()=>{if(o.current){let r=new ResizeObserver(s=>{let l=s[0].contentRect.height;n(l)});return r.observe(o.current),()=>{r.disconnect()}}},[]),qa(Rd,{className:t,style:{height:a},animate:{height:a},transition:{duration:.2},children:qa("div",{ref:o,children:e})})},Rd=_d(yd.div)`
|
|
435
435
|
overflow: hidden;
|
|
436
|
-
`;import{CpslButton as
|
|
436
|
+
`;import{CpslButton as Ja,CpslIcon as Fn,CpslQrCode as Ld,CpslSpinner as Md,CpslText as Od}from"@getpara/react-components";import{useEffect as ja,useMemo as Nd}from"react";import kn from"styled-components";import{useCopyToClipboard as vd}from"@getpara/react-common";import{WalletType as bd}from"@getpara/web-sdk";import{Fragment as ei,jsx as Ie,jsxs as It}from"react/jsx-runtime";var ti=()=>{let[e,t]=vd(),o=i(p=>p.externalWalletError),a=i(p=>p.setStep),n=i(p=>p.setStepDirection),{switchChain:r,wallet:s,qrUri:l,chainIdSwitchingTo:c,walletDisplayHelpers:u}=X();ja(()=>{s?.type===bd.COSMOS&&rt(l)},[l,s]),ja(()=>{s||(n(-1),a("ACCOUNT_MAIN"))},[s]);let d=async()=>{c&&await r(c)},m=()=>{t(l)},C=Nd(()=>{if(!s)return null;let{isCosmosMobileWallet:p}=u;return p?Ie(ei,{children:It(_,{children:[Ie(Od,{weight:"semiBold",children:"Scan with your mobile device to switch networks"}),Ie(Ae,{children:l?Ie(Ld,{url:l,imageSrc:s.iconUrl}):Ie(Md,{size:100})}),It(Ja,{size:"small",variant:"ghost",onClick:m,children:[Ie(Fn,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]})}):It(_,{children:[o?.length?It(ei,{children:[It(Ud,{children:[Ie(Pd,{icon:"alertCircle"}),Ie(ae,{weight:"semiBold",color:"error",children:o[0]})]}),o[1]&&Ie(ae,{color:"secondary",weight:"medium",children:o[1]})]}):Ie(ae,{color:"contrast",weight:"semiBold",children:`Confirm the request to change networks in your ${s.name} wallet.`}),o?.[0]?.toLowerCase()!==oo&&It(Ja,{variant:"secondary",onClick:d,children:[Ie(Fn,{slot:"start",icon:"refresh"}),"Try Again"]})]})},[s,u,o,l]);return s?Ie(Dd,{children:C}):null},Dd=kn(k)`
|
|
437
437
|
flex: 1;
|
|
438
438
|
justify-content: space-between;
|
|
439
|
-
`,
|
|
439
|
+
`,Ud=kn.div`
|
|
440
440
|
display: flex;
|
|
441
441
|
align-items: center;
|
|
442
442
|
justify-content: center;
|
|
443
443
|
gap: 4px;
|
|
444
|
-
`,
|
|
444
|
+
`,Pd=kn(Fn)`
|
|
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 du,AnimatePresence as uu}from"framer-motion";import{CpslIcon as fi}from"@getpara/react-components";import{styled as go}from"styled-components";import{CpslIdenticon as oi,CpslSelect as Fd,CpslSelectItem as kd,CpslText as Ht}from"@getpara/react-components";import Ze from"styled-components";import{truncateAddress as Bd,WalletType as Io}from"@getpara/web-sdk";import{useEffect as si,useRef as li}from"react";import{jsx as ce,jsxs as Bt}from"react/jsx-runtime";var ni=(e,t)=>e&&t?`${e}~${t}`:void 0,Hd={[Io.EVM]:"EVM",[Io.SOLANA]:"Solana",[Io.COSMOS]:"Cosmos"},ci=()=>{let e=li(null),{dropdownMaxHeight:t,dropdownWidth:o,mobileAnchor:a,resize:n}=Pt(e),r=ot(),{switchChain:s,chainId:l,chains:c,chainIdSwitchingTo:u}=X();si(()=>{t&&l&&n()},[l,u,t]);let d=async p=>{await s(p)};if(!r||!r.isExternal||r.type===Io.SOLANA)return null;let m=u??l,C=c.find(p=>p.id.toString()===m)?.name;return ce(di,{children:ce(ui,{ref:e,id:"inputContainer",children:Bt(mi,{selectedValue:m?.toString()??"",onCpslSelectValueChange:p=>{d(p.detail)},showFormattedSelectedItem:!0,placeholder:"Choose chain...",anchorElId:"inputContainer",dropdownMaxHeight:t,$width:o,$top:a+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[m&&ce(ii,{variant:"bodyXS",color:"contrast",slot:"selected-item",children:C}),c?.map(p=>ce(Ci,{slot:"items",value:p.id.toString(),children:ce(ii,{variant:"bodyXS",color:"contrast",children:p.name})},p.id))]})})})};function ri(e,{type:t,isExternal:o,name:a,isMenu:n=!1,hideWallets:r=!1}){return e.isMultiWallet?a??`${o?"External ":""}${Hd[t]}${!r&&(n||o)?" Wallet":""}`:r?"My Account":a||"My Wallet"}var pi=()=>{let e=y(d=>d.hideWallets),t=N(),o=li(null),{dropdownMaxHeight:a,dropdownWidth:n,mobileAnchor:r,resize:s}=Pt(o),{setSelectedWallet:l}=ue(),c=ot(),u=c?Bt(ai,{slot:"selected-item",children:[ce(oi,{variant:"avatar",size:"14px",hash:t.getIdenticonHash(c.id,c.type)}),ce(Vd,{variant:"bodyXS",color:"contrast",children:ri(t,{...c,hideWallets:e})}),!e&&ce(Ht,{variant:"bodyXS",color:"secondary",children:t.getDisplayAddress(c.id,{truncate:!0,addressType:c.type})})]}):null;return si(()=>{a&&c?.address&&s()},[c,t.availableWallets,a]),ce(di,{children:ce(ui,{ref:o,id:"addressInputContainer",children:t.availableWallets.length>1?Bt(mi,{selectedValue:ni(c?.id,c?.type),onCpslSelectValueChange:d=>{let[m,C]=d.detail.split("~");l({id:m,type:C})},showFormattedSelectedItem:!0,placeholder:"Choose wallet...",anchorElId:"addressInputContainer",dropdownMaxHeight:a,$width:n,$top:r+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[c&&u,t.availableWallets.map(({address:d,name:m,id:C,type:p,isExternal:f})=>{let w=ni(C,p),T=m??ri(t,{type:p,isExternal:f,isMenu:!0,hideWallets:e});return ce(Ci,{slot:"items",value:w,children:Bt(ai,{children:[ce(oi,{size:"40px",hash:t.getIdenticonHash(C,p)}),Bt(Gd,{children:[T&&ce(Ht,{variant:"bodyS",color:"contrast",children:T}),!e&&ce(Ht,{variant:"bodyXS",color:"secondary",children:Bd(d,p,{prefix:t.cosmosPrefix})})]})]})},w)})]}):u})})},di=Ze.div`
|
|
449
449
|
flex: 0;
|
|
450
450
|
width: 100%;
|
|
451
451
|
display: flex;
|
|
452
452
|
justify-content: center;
|
|
453
|
-
`,
|
|
453
|
+
`,ai=Ze.div`
|
|
454
454
|
display: flex;
|
|
455
455
|
align-items: center;
|
|
456
456
|
gap: 8px;
|
|
457
|
-
`,
|
|
457
|
+
`,Gd=Ze.div`
|
|
458
458
|
display: flex;
|
|
459
459
|
flex-direction: column;
|
|
460
460
|
align-items: flex-start;
|
|
461
|
-
|
|
461
|
+
`,Vd=Ze(Ht)`
|
|
462
462
|
white-space: nowrap;
|
|
463
|
-
`,
|
|
463
|
+
`,ui=Ze.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 X(M,{children:X($a,
|
|
|
468
468
|
border-radius: 1000px;
|
|
469
469
|
background-color: var(--cpsl-color-background-8);
|
|
470
470
|
padding: 8px;
|
|
471
|
-
`,
|
|
471
|
+
`,ii=Ze(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 X(M,{children:X($a,
|
|
|
477
477
|
text-overflow: ellipsis;
|
|
478
478
|
overflow: hidden;
|
|
479
479
|
}
|
|
480
|
-
`,
|
|
480
|
+
`,mi=Ze(Fd)`
|
|
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 X(M,{children:X($a,
|
|
|
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: ${Xe}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 X(M,{children:X($a,
|
|
|
511
511
|
&::part(icon) {
|
|
512
512
|
--icon-color: var(--cpsl-color-contrast);
|
|
513
513
|
}
|
|
514
|
-
`,
|
|
514
|
+
`,Ci=Ze(kd)`
|
|
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 Si}from"@getpara/react-common";import{Fragment as zd,jsx as st,jsxs as Ai}from"react/jsx-runtime";var Ei=({onClose:e})=>{let t=y(c=>c.bareModal),o=i(c=>c.hasPreviousStep()),a=i(c=>c.step),n=i(c=>c.isFullyLoggedIn),r=he(),s=["ACCOUNT_MAIN","CHAIN_SWITCH","ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(a);return Ai($d,{children:[st(Xd,{variant:"ghost",style:{visibility:o?"visible":"hidden"},onClick:()=>{r()},children:st(fi,{icon:"arrow"})}),st(Kd,{children:s&&n&&Ai(zd,{children:[st(ci,{}),st(pi,{})]})}),st(Yd,{bareModal:t,variant:"ghost",onClick:e,children:st(fi,{icon:"close"})})]})},$d=go.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 X(M,{children:X($a,
|
|
|
526
526
|
align-items: center;
|
|
527
527
|
justify-content: space-between;
|
|
528
528
|
gap: 8px;
|
|
529
|
-
`,
|
|
529
|
+
`,Kd=go.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
|
+
`,Yd=go(Si)`
|
|
536
536
|
transform: rotate(180deg);
|
|
537
537
|
visibility: ${({bareModal:e})=>e?"hidden":"visible"};
|
|
538
|
-
`,
|
|
538
|
+
`,Xd=go(Si)`
|
|
539
539
|
transform: rotate(180deg);
|
|
540
|
-
`;import{useEffect as
|
|
540
|
+
`;import{useEffect as wi,useState as mu}from"react";import{AuthMethod as hi,OAuthMethod as Qd}from"@getpara/web-sdk";import Bn from"styled-components";import{useEffect as Ti,useRef as qd,useState as yo}from"react";import{HeroSpinner as Zd}from"@getpara/react-common";import{CpslSpinner as Jd}from"@getpara/react-components";import{jsx as xo,jsxs as ou}from"react/jsx-runtime";function Ii(){let e=qd(),t=N(),o=i(A=>A.setFlow),a=i(A=>A.setStep),n=$(A=>A.setAuthInfo),r=i(A=>A.setBiometricLocationHints),s=i(A=>A.setSupportedAuthMethods),l=i(A=>A.setIFrameUrl),c=i(A=>A.setIsIFrameReady),u=i(A=>A.setAuthStepRoute),d=i(A=>A.setWebAuthURLForCreate),m=y(A=>A.theme),[C,p]=yo(void 0),[f,w]=yo(!1),[T,D]=yo(!1),[I,O]=yo(!1);return Ti(()=>{C||t.getOAuthURL({method:Qd.TELEGRAM}).then(A=>{p(A)})},[C]),Ti(()=>{let A=async v=>{switch(v.data.type){case"TELEGRAM_LOGIN":w(!0),O(!1);break;case"TELEGRAM_FAILED":w(!1),O(!0);break;case"TELEGRAM_SUCCESS":if(v.data.payload){let b=v.data.payload,S=await t.verifyTelegram(b);if(!S.isValid){w(!1),O(!0),e.current&&e.current.contentWindow.postMessage({type:"TELEGRAM_FAILED"},"*");return}let{telegramUserId:x,isNewUser:F,supportedAuthMethods:E,biometricHints:g}=S;if(n({telegramUserId:x,pfpUrl:b.photo_url,displayName:b.username?`@${b.username}`:b.first_name?`${b.first_name}${b.last_name?` ${b.last_name}`:""}`:`Telegram User @${x}`}),F){let P=await t.getSupportedCreateAuthMethods();c(!1),o("signUp");let Y=P.has(hi.PASSKEY);Y&&(d(await t.shortenLoginLink(await t.getSetUpBiometricsURL({authType:"telegram"}))),a("BIOMETRIC_CREATION")),P.has(hi.PASSWORD)&&(l(await t.shortenLoginLink(await t.getSetupPasswordURL({authType:"telegram",theme:m}))),u(Y?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))}else o("login"),E&&s(new Set(E)),g&&r(g),a("BIOMETRIC_LOGIN")}break}};return window?.addEventListener("message",A,!1),()=>{window?.removeEventListener("message",A,!1)}},[]),ou(jd,{children:[xo(eu,{children:xo(Zd,{icon:"telegramBrand",status:f?"loading":I?"error":"inactive",text:f?"Follow the on-screen prompts.":I?"Login Failed":void 0})}),C&&xo(tu,{ref:e,style:{display:T?"block":"none"},src:C,onLoad:()=>D(!0)}),(!C||!T)&&xo(Jd,{})]})}var jd=Bn.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
|
+
`,eu=Bn.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
|
+
`,tu=Bn.iframe`
|
|
554
554
|
width: 100%;
|
|
555
555
|
height: 52px;
|
|
556
556
|
border: none;
|
|
557
|
-
`;import{jsx as
|
|
557
|
+
`;import{jsx as nu}from"react/jsx-runtime";var gi=()=>{let e=i(t=>t.isLogin());return nu($e,{heading:e?"Waiting for Password":"Creating Password",subheading:"Follow the prompts presented by your browser."})};import yi from"styled-components";import{SpinnerContainer as ru}from"@getpara/react-common";import{CpslSpinner as au}from"@getpara/react-components";import{jsx as wo,jsxs as lu}from"react/jsx-runtime";var xi=()=>{let e=i(r=>r.iFrameUrl),t=i(r=>r.setIsIFrameReady),o=i(r=>r.isIFrameReady),a=i(r=>r.step),n=y(r=>r.embeddedModal);return lu(iu,{$isVisible:Wt.includes(a),$embeddedModal:n,children:[wo(su,{$isReady:o,children:wo("iframe",{src:e,onLoad:()=>{t(!0)}})}),!o&&wo(ru,{style:{width:"100%",height:"100%",flex:1},children:wo(au,{size:100})})]})},iu=yi.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 X(M,{children:X($a,
|
|
|
563
563
|
align-items: center;
|
|
564
564
|
justify-content: center;
|
|
565
565
|
|
|
566
|
-
@media (max-width: ${
|
|
566
|
+
@media (max-width: ${Xe}px) {
|
|
567
567
|
padding: ${({$embeddedModal:e,$isVisible:t})=>t?e?"12px 0px 0px":"72px 16px 0px":"0px"};
|
|
568
568
|
}
|
|
569
|
-
`,
|
|
569
|
+
`,su=yi.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 X(M,{children:X($a,
|
|
|
576
576
|
width: 100%;
|
|
577
577
|
border: none;
|
|
578
578
|
}
|
|
579
|
-
`;import{Fragment as
|
|
579
|
+
`;import{Fragment as gu,jsx as B,jsxs as gt}from"react/jsx-runtime";var Wi={ADD_FUNDS_AWAITING:"680px"},_i={TELEGRAM_OAUTH:"36px"},Cu={TELEGRAM_OAUTH:"16px"},Ri=({oAuthMethods:e,twoFactorAuthEnabled:t,disableEmailLogin:o,disablePhoneLogin:a,onClose:n})=>{let r=i(T=>T.step),s=i(T=>T.onRampConfig),l=i(T=>T.stepDirection),c=i(T=>T.setStepDirection),u=i(T=>T.accountAddFundTab),d=i(T=>T.setAccountAddFundTab),m=y(T=>T.appName),C=y(T=>T.embeddedModal),[p,f]=mu(s?.testMode),w=()=>{switch(r){case"AUTH_MAIN":return B(Da,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"EX_WALLET_MORE":return B(uo,{});case"AUTH_MORE":return B(So,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"VERIFICATIONS":return B(ir,{});case"BIOMETRIC_LOGIN":return B(lr,{});case"SETUP_2FA":case"VERIFY_2FA":return B(ur,{onClose:n});case"LOGIN_DONE":return B(Nr,{onClose:n});case"AWAITING_BIOMETRIC_LOGIN":case"AWAITING_BIOMETRIC_CREATION":return B(br,{});case"AWAITING_PASSWORD_LOGIN":case"AWAITING_PASSWORD_CREATION":return B(gi,{});case"AWAITING_WALLET_CREATION":return B(Ur,{});case"WALLET_CREATION_DONE":return B(Fr,{twoFactorAuthEnabled:t,onClose:n});case"SECRET":return B(Gr,{});case"TWO_FACTOR_DONE":return B(Vr,{onClose:n});case"BIOMETRIC_CREATION":return B(Zr,{});case"AWAITING_OAUTH":return B(Jr,{});case"FARCASTER_OAUTH":return B(fa,{});case"TELEGRAM_OAUTH":return B(Ii,{});case"ADD_FUNDS_BUY":case"ADD_FUNDS_RECEIVE":case"ADD_FUNDS_WITHDRAW":return B(da,{});case"ADD_FUNDS_AWAITING":return B(ma,{});case"ADD_FUNDS_SUCCESS":return B(En,{isSuccess:!0,onClose:n});case"ADD_FUNDS_FAILURE":return B(En,{onClose:n});case"ACCOUNT_MAIN":return B(Fa,{onClose:n});case"EX_WALLET_SELECTED":return B(Ya,{});case"CHAIN_SWITCH":return B(ti,{});default:if(Wt.includes(r))return null}};return wi(()=>{!p&&s?.testMode&&f(!0)},[s?.testMode]),wi(()=>{switch(r){case"ADD_FUNDS_BUY":d(Wo.BUY);break;case"ADD_FUNDS_RECEIVE":d(Wo.RECEIVE);break;case"ADD_FUNDS_WITHDRAW":d(Wo.WITHDRAW);break;default:break}},[r]),gt(fu,{slot:"body","data-testid":"modal-content",children:[!C&>(gu,{children:[B(Ei,{onClose:n}),B(Sa,{})]}),gt(Au,{children:[B(uu,{mode:"popLayout",initial:!1,onExitComplete:()=>{c(1)},custom:l,children:gt(Su,{custom:l,variants:no,initial:"enter",animate:"center",exit:"exit",transition:ro,children:[B(Qa,{}),gt(Eu,{$embeddedModal:C,$step:r,$isIFrameStep:Wt.includes(r),children:[w(),s?.testMode&&["ADD_FUNDS_BUY","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_FAILURE","ADD_FUNDS_SUCCESS"].includes(r)&&p&&u!==Wo.RECEIVE&&B(hu,{children:gt("div",{style:{fontSize:"14px"},children:["This Para Modal is configured to run on-ramp services in ",B("b",{children:"test mode"})," only, for development purposes. If you are a user of ",m,", please contact support.",B(Tu,{onClick:()=>f(!1),children:B(Iu,{icon:"x"})})]})})]})]},["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(r)?"ADD_FUNDS":r)}),B(xi,{})]})]})},fu=lt.div`
|
|
580
580
|
position: relative;
|
|
581
|
-
`,
|
|
581
|
+
`,Au=lt(Za)`
|
|
582
582
|
margin-top: -16px;
|
|
583
|
-
`,
|
|
583
|
+
`,Su=lt(du.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
|
+
`,Eu=lt.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":`${_i[t]??"72px"} 72px ${Cu[t]??"32px"}`};
|
|
597
|
+
min-height: ${({$step:e})=>Wi[e]??"auto"};
|
|
598
|
+
height: ${({$step:e})=>Wi[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: ${Xe}px) {
|
|
601
|
+
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${_i[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
|
+
`,hu=lt(cu)`
|
|
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
|
+
`,Tu=lt.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 X(M,{children:X($a,
|
|
|
619
619
|
position: absolute;
|
|
620
620
|
top: 0;
|
|
621
621
|
right: 0;
|
|
622
|
-
`,
|
|
622
|
+
`,Iu=lt(pu)`
|
|
623
623
|
--icon-color: var(--cpsl-color-foreground-0);
|
|
624
|
-
`;import{styled as
|
|
624
|
+
`;import{styled as Fe}from"styled-components";import{CpslButton as yu,CpslIcon as Mi,CpslText as xu}from"@getpara/react-components";import{useMemo as wu}from"react";import{Fragment as vu,jsx as Ne,jsxs as Gt}from"react/jsx-runtime";var Oi=()=>{let e=i(n=>n.isAccount()),t=i(n=>n.step),o=e||zn(t),a=wu(()=>e?Gt(Lu,{children:[Gt(Ou,{variant:"bodyS",color:"secondary",weight:"medium",children:["Access all your wallet\u2019s features at"," ",Ne("a",{href:pn,target:"blank",children:Ne(Li,{variant:"bodyS",weight:"medium",children:"Para Connect"})})]}),Ne(yu,{as:"a",href:pn,target:"blank",variant:"ghost",children:Ne(Mu,{icon:"chevronUp"})})]}):Gt(vu,{children:[Gt(_o,{variant:"body2XS",color:"secondary",weight:"medium",children:["By logging in you agree to our"," ",Ne("a",{href:jr,target:"blank",children:Ne(Li,{variant:"body2XS",weight:"medium",children:"Terms & Conditions"})})]}),Gt(Ru,{children:[Ne(_o,{variant:"bodyS",color:"secondary",weight:"medium",children:"Powered by"}),Ne(Nu,{icon:"para"})]})]}),[e]);return o?Ne(Wu,{slot:"footer",children:Ne(_u,{children:a})}):null},Wu=Fe.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
|
+
`,_u=Fe.div`
|
|
631
631
|
display: flex;
|
|
632
632
|
flex-direction: column;
|
|
633
633
|
align-items: center;
|
|
634
634
|
gap: 8px;
|
|
635
|
-
`,
|
|
635
|
+
`,Ru=Fe.div`
|
|
636
636
|
display: flex;
|
|
637
637
|
gap: 5px;
|
|
638
638
|
align-items: center;
|
|
639
639
|
justify-content: center;
|
|
640
|
-
`,
|
|
640
|
+
`,Lu=Fe.div`
|
|
641
641
|
display: flex;
|
|
642
642
|
gap: 8px;
|
|
643
643
|
align-items: center;
|
|
644
644
|
justify-content: center;
|
|
645
|
-
`,
|
|
645
|
+
`,Mu=Fe(Mi)`
|
|
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
|
+
`,_o=Fe(xu)`
|
|
652
652
|
text-align: center;
|
|
653
653
|
display: inline-block;
|
|
654
|
-
`,
|
|
654
|
+
`,Ou=Fe(_o)`
|
|
655
655
|
line-height: 20px;
|
|
656
|
-
`,
|
|
656
|
+
`,Li=Fe(_o)`
|
|
657
657
|
cursor: pointer;
|
|
658
658
|
display: inline-block;
|
|
659
|
-
`,
|
|
659
|
+
`,Nu=Fe(Mi)`
|
|
660
660
|
display: inline-block;
|
|
661
661
|
--icon-color: var(--cpsl-color-text-secondary);
|
|
662
662
|
--width: 49px;
|
|
663
663
|
--height: auto;
|
|
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)`
|
|
664
|
+
`;import{create as bu}from"zustand";var Ni=e=>({updateState:t=>{e(t)}});var Du={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=bu(e=>({...Du,...Ni(e)}));var vi=()=>{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 Vu,jsx as bi,jsxs as $u}from"react/jsx-runtime";function Hu(e){return"hostApiKey"in e}var Gu={[me.SOLANA]:yt.SOLANA,[me.ATOM]:yt.COSMOS,[me.CELO]:yt.CELO,[me.POLYGON]:yt.POLYGON},Hn={SOLANA:me.SOLANA,SOL:me.SOLANA,ATOM:me.ATOM,CELO:me.CELO,POLYGON:me.POLYGON,MATIC:me.POLYGON,USDC:me.USDC,ETH:me.ETHEREUM,ETHEREUM:me.ETHEREUM},Di=Uu(({onRampConfig:e,twoFactorAuthEnabled:t=!1,recoverySecretStepEnabled:o=!1,oAuthMethods:a,disableEmailLogin:n,disablePhoneLogin:r,onClose:s,onRampTestMode:l,loginTransitionOverride:c,createWalletOverride:u},d)=>{let m=N(),C=i(h=>h.refs),p=i(h=>h.step),f=i(h=>h.webAuthURLForLogin),w=i(h=>h.passwordUrlForLogin),T=i(h=>h.isLogin()),D=i(h=>h.onRampConfig),I=i(h=>h.setStep),O=i(h=>h.setBiometricLocationHints),A=i(h=>h.setWebAuthURLForLogin),v=i(h=>h.setPasswordUrlForLogin),b=i(h=>h.setSupportedAuthMethods),S=i(h=>h.setOnRampConfig),x=i(h=>h.accountAddFundTab),F=i(h=>h.setAccountAddFundTab),E=$(h=>h.setRecoveryShare),g=i(h=>h.authStepRoute),P=i(h=>h.isIFrameReady),Y=he(),R=to(),[re,q]=Fu(!1),le=vi();ct(()=>{g&&P&&setTimeout(()=>{I(g)},200)},[g,P]),Pu(d,()=>({handleModalClose(){J()}}),[]);let G=async()=>{if(!t)return!0;try{let{isSetup:h}=await m.check2FAStatus();return h}catch(h){return console.error("An error occurred while checking 2FA:",h),!1}};async function M(){let{isComplete:h,isError:K,needsWallet:U}=await m.waitForLoginAndSetup({popupWindow:C.popupWindow.current});if(window.clearTimeout(C.poll.current?.timeout),C.poll.current=void 0,C.popupWindow.current=void 0,K){["AWAITING_BIOMETRIC_LOGIN","AWAITING_PASSWORD_LOGIN"].includes(C.currentStep.current)&&Y();return}h&&(A(""),v(""),b(new Set),O(),U?I("AWAITING_WALLET_CREATION"):(await le(),await G()?I("LOGIN_DONE"):I("SETUP_2FA")))}ct(()=>{if(p!=="AWAITING_WALLET_CREATION"||re)return;async function h(){q(!0);let K,U;if(u){let ie=await u(m),pe=(await m.fetchWallets()).filter(de=>!!de.address),_e={};for(let de of pe)_e[de.id]={...ku(de),signer:""};m.setWallets(_e),K=ie.recoverySecret,U=ie.walletIds}else{let ie=await m.waitForPasskeyAndCreateWallet();K=ie.recoverySecret,U=ie.walletIds}await m.setCurrentWalletIds(U),o&&E(K),q(!1),I(!K||!o?"WALLET_CREATION_DONE":"SECRET")}h()},[T,p]),ct(()=>{if(["AWAITING_BIOMETRIC_LOGIN","AWAITING_PASSWORD_LOGIN"].includes(p)&&(f||w)){if(c){async function h(){await c(m),A(""),v(""),O(),await le(),await G()?I("LOGIN_DONE"):I("SETUP_2FA")}h();return}return typeof window<"u"&&(C.poll.current={action:"login",timeout:window.setTimeout(M,Ke.LOGGIN_POLLING_DELAY_MS)}),()=>{typeof window<"u"&&C.poll.current&&window.clearTimeout(C.poll.current?.timeout),m.exitLogin()}}},[p,f,w]);let J=()=>{s()};return ct(()=>{C.currentStep.current=p;let h=!1;["AWAITING_BIOMETRIC_CREATION","PASSWORD_CREATION"].includes(p)||(m.exitAccountCreation(),h=["createPassword","createPasskey"].includes(C.poll.current?.action)),["AWAITING_PASSWORD_LOGIN","AWAITING_BIOMETRIC_LOGIN"].includes(p)||(m.exitLogin(),h=C.poll.current?.action==="login"),["AWAITING_OAUTH","FARCASTER_OAUTH"].includes(p)||m.exitOAuth(),p==="PASSWORD_CREATION"&&R.withPassword(),h&&typeof window<"u"&&(window.clearTimeout(C.poll.current?.timeout),C.poll.current=void 0)},[p]),ct(()=>{D||m.ctx.client.getOnRampConfig().then(h=>{let K;if(e){let{enabledFlows:U,network:ie,asset:pe,providers:_e,testMode:de}=e,L=_e.find(V=>Hu(V));K={isBuyEnabled:!U||U.some(V=>ke[V]===ke.BUY),isReceiveEnabled:!U||U.some(V=>ke[V]===ke.RECEIVE),isWithdrawEnabled:!U||U.some(V=>ke[V]===ke.WITHDRAW),allowedAssets:ie?{[yt[ie]]:pe?[Hn[pe]]:!0}:pe?{[Gu[Hn[pe]]??yt.ETHEREUM]:[Hn[pe]]}:h.allowedAssets,assetInfo:h.assetInfo,providers:_e.map(({id:V})=>Bu[V]),rampApiKey:L?.hostApiKey??h.rampApiKey,testMode:de??l}}else K={...h,testMode:l};S(K),x||F(K.isBuyEnabled?ke.BUY:K.isReceiveEnabled?ke.RECEIVE:K.isWithdrawEnabled?ke.WITHDRAW:void 0)}).catch()},[]),ct(()=>{D&&S({...D,testMode:l})},[l]),ct(()=>()=>{window.clearTimeout(C.poll.current?.timeout),m.exitLoops()},[]),$u(Vu,{children:[bi(Ri,{oAuthMethods:a,twoFactorAuthEnabled:t,disableEmailLogin:n,disablePhoneLogin:r,onClose:J}),bi(Oi,{})]})});import{forwardRef as Pi,useEffect as ve,useImperativeHandle as sm,useRef as lm,useState as Uo}from"react";import{ParaEvent as Do}from"@getpara/web-sdk";import{useEffect as nm,useState as xt}from"react";import{createContext as Ku,useMemo as Yu}from"react";import{jsx as zu}from"react/jsx-runtime";var Xu={wallets:[],chains:[],chainId:void 0,username:void 0,avatar:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Ro=Ku(Xu);function Gn({children:e}){let t=[],o=[],s=()=>Promise.resolve(),l=()=>Promise.resolve({});return zu(Ro.Provider,{value:Yu(()=>({wallets:t,chains:o,chainId:void 0,username:void 0,avatar:void 0,disconnect:s,switchChain:l}),[t,o,void 0,void 0,void 0,s,l]),children:e})}var Lo=(s=>(s.METAMASK="METAMASK",s.RAINBOW="RAINBOW",s.COINBASE="COINBASE",s.WALLETCONNECT="WALLETCONNECT",s.ZERION="ZERION",s.RABBY="RABBY",s))(Lo||{}),Mo=(a=>(a.PHANTOM="PHANTOM",a.GLOW="GLOW",a.BACKPACK="BACKPACK",a))(Mo||{}),Oo=(o=>(o.KEPLR="KEPLR",o.LEAP="LEAP",o))(Oo||{}),lw={...Lo,...Mo,...Oo};import{createContext as Qu,useMemo as qu}from"react";import{jsx as Ju}from"react/jsx-runtime";var Zu={wallets:[],disconnect:()=>Promise.resolve()},No=Qu(Zu);function Vn({children:e}){let t=[],o=()=>Promise.resolve();return Ju(No.Provider,{value:qu(()=>({wallets:t,disconnect:o}),[t,o]),children:e})}import{createContext as ju,useMemo as em}from"react";import{jsx as om}from"react/jsx-runtime";var tm={wallets:[],chains:[],chainId:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},vo=ju(tm);function $n({children:e}){let t=[],o=[],n=()=>Promise.resolve(),r=()=>Promise.resolve({});return om(vo.Provider,{value:em(()=>({wallets:t,chains:o,chainId:void 0,disconnect:n,switchChain:r}),[t,o,void 0,n,r]),children:e})}import{jsx as bo}from"react/jsx-runtime";var Ui=({children:e,wallets:t})=>{let o=N(),a=i(x=>x.resetState),n=$(x=>x.resetState),r=se(x=>x.EvmProvider),s=se(x=>x.evmContext),l=se(x=>x.SolanaProvider),c=se(x=>x.solanaContext),u=se(x=>x.CosmosProvider),d=se(x=>x.cosmosContext),[m,C]=xt(null),[p,f]=xt(null),[w,T]=xt(null),[D,I]=xt(null),[O,A]=xt(null),[v,b]=xt(null);nm(()=>{(async()=>{let F=Ro,E=Gn,g=No,P=Vn,Y=vo,R=$n;if(!t?.length)F=Ro,E=Gn,g=No,P=Vn,Y=vo,R=$n;else for(let re=0;re<t.length;re++){let q=t[re];if(q in Lo){if(!r||!s)throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");F=s,E=r}if(q in Mo){if(!l||!c)throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");g=c,P=l}if(q in Oo){if(!u||!d)throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");Y=d,R=u}}f(F),C(()=>E),I(g),T(()=>P),b(Y),A(()=>R)})()},[t,s,r,c,l,d,u]);let S=({address:x,error:F})=>{(F||!x)&&(a(),n())};return!o||!m||!w||!O?null:bo(m,{para:o,onSwitchWallet:S,children:bo(w,{para:o,onSwitchWallet:S,children:bo(O,{para:o,onSwitchWallet:S,children:bo(zr,{evmContext:p,solanaContext:D,cosmosContext:v,walletSort:t,children:e})})})})};import cm from"styled-components";import{jsx as Po}from"react/jsx-runtime";am();var tW=Pi(({para:e,isOpen:t,...o},a)=>{let[n,r]=Uo(!1),s=Z(d=>d.setClient),l=Z(d=>d.client),{closeModal:c,openModal:u}=Yt();return ve(()=>{l||s(e),r(!0)},[]),ve(()=>{t||c(),t&&u()},[t]),n?Po(pm,{ref:a,para:e,...o}):null}),pm=Pi(({theme:e,appName:t,logo:o,disableEmailLogin:a=!1,disablePhoneLogin:n=!1,oAuthMethods:r,bareModal:s=!1,className:l,currentStepOverride:c,externalWallets:u,authLayout:d=["AUTH:FULL","EXTERNAL:FULL"],embeddedModal:m,onModalStepChange:C,hideWallets:p=!1,onClose:f,...w},T)=>{let D=lm(null),I=y(W=>W.updateState),O=i(W=>W.refs),A=i(W=>W.setWebAuthURLForLogin),v=i(W=>W.setWebAuthURLForCreate),b=i(W=>W.setBiometricLocationHints),S=i(W=>W.step),x=i(W=>W.setOnModalStepChange),F=i(W=>W.setStep),E=$(W=>W.setAuthInfo),g=i(W=>W.hasPreviousStep()),P=i(W=>W.setFlow),Y=i(W=>W.setIsFullyLoggedIn),R=he(),re=y(W=>W.setAuthLayout),q=y(W=>W.authLayout),le=i(W=>W.resetState),G=$(W=>W.resetState),M=$(W=>W.setRecoveryShare),{disconnectExternalWallet:J}=X(),{isOpen:h,closeModal:K}=Yt(),U=N(),{selectedWallet:ie,setSelectedWallet:pe}=ue(),[_e,de]=Uo(!1),[L,V]=Uo(!1),[Ce,ko]=Uo(!1);sm(T,()=>({goBack(){R()},canGoBack(){return g},currentStep(){return S},handleModalClose(){D?.current?.handleModalClose()}}),[g,S]);let wt=async()=>{let W=await U.isFullyLoggedIn();switch(c?F(He[c.toUpperCase()]):W?(P("account"),F("ACCOUNT_MAIN"),Y(!0)):(S!=="AUTH_MAIN"&&S!=="SECRET"&&(F("AUTH_MAIN"),P(),A(),v(),b()),await J(),pe({id:void 0,type:void 0}),Y(!1)),!0){case U.isEmail:E({email:U.getEmail()});break;case U.isPhone:{let{phone:Be,countryCode:Bi}=U.getPhone();E({phone:Be,countryCode:Bi})}break;case U.isFarcaster:E({farcasterUsername:U.getFarcasterUsername()});break;case U.isTelegram:E({telegramUserId:U.telegramUserId}),W||F("TELEGRAM_OAUTH");break}V(!0)};ve(()=>{let W=d;!u?.length&&In(d)&&(W=W.filter(Be=>!Be.includes("EXTERNAL"))),a&&n&&!r?.length&&vt(d)&&(W=W.filter(Be=>!Be.includes("AUTH"))),JSON.stringify(q)!==JSON.stringify(W)&&re(W)},[a,n,r,u,d]),ve(()=>{x(C)},[C]),ve(()=>{I({logo:o,appName:t,oAuthLogoVariant:e?.oAuthLogoVariant??"default",bareModal:s,embeddedModal:m,hideWallets:p})},[o,t,e?.oAuthLogoVariant,s,m,p]),ve(()=>{e&&(im(e),I({isDark:e.mode==="dark",theme:e}))},[e]),ve(()=>{U?(wt(),s&&de(!0)):console.error("A Para instance must be provided.")},[]),ve(()=>{h&&U&&wt()},[h]);let be=()=>{if(!ie?.id||!U.findWallet(ie?.id)){let W=U.findWallet(void 0,void 0,{forbidPregen:!0});pe({id:W?.id,type:W?.type})}};ve(()=>{be()},[U]),ve(()=>{let W=()=>{O.popupWindow.current?.close()};return typeof window<"u"&&(window.addEventListener(Do.WALLETS_CHANGE_EVENT,be),window.addEventListener(Do.EXTERNAL_WALLET_CHANGE_EVENT,be),window.addEventListener("beforeunload",W)),ko(!0),()=>{typeof window<"u"&&(window.removeEventListener(Do.WALLETS_CHANGE_EVENT,be),window.removeEventListener(Do.EXTERNAL_WALLET_CHANGE_EVENT,be),window.removeEventListener("beforeunload",W))}},[]);let Kn=()=>{K(),f?.()},Fi=()=>{de(!0)},ki=async()=>{s||de(!1),Yn.includes(S)?(le(),G(),M(null)):Xn.includes(S)&&F("LOGIN_DONE"),U&&(await wt(),U.exitLoops()),s||V(!1)};if(!Ce)return null;if(!U)return console.error("A Para instance is required."),null;if(!q?.length){let W=!u?.length&&In(d),Be=a&&n&&!r?.length&&vt(d);return W||Be?(W&&console.error("At least one external wallet must be provided if external wallet auth is enabled."),Be&&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 Po(Ui,{wallets:u,children:Po(dm,{enterTransitionDuration:Ke.ANIMATION_DURATION,exitTransitionDuration:Ke.ANIMATION_DURATION,open:h,onCpslModalExited:ki,onCpslModalEntering:Fi,onCpslModalRequestClose:Kn,noOverlay:s,className:l,"data-testid":"modal",$embeddedModal:m,children:_e&&(L&&m||!m)&&Po(Di,{oAuthMethods:r,disableEmailLogin:a,disablePhoneLogin:n,onClose:Kn,...w})})})}),dm=cm(rm)`
|
|
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 X(M,{children:X($a,
|
|
|
672
672
|
--card-box-shadow: none;
|
|
673
673
|
--card-border-width: 0px;
|
|
674
674
|
};`}
|
|
675
|
-
`;var
|
|
675
|
+
`;var Fo=class extends Error{constructor(t){super(`On-ramp configuration error: ${t}.`),this.name="OnRampConfigError"}};function um({providers:e}){if(!e||e.length<1)throw new Fo("No providers are configured")}function mm({providers:e}){e.forEach((t,o)=>{if(e.findIndex(a=>a===t)!==o)throw new Fo(`Provider ${t} is configured more than once`)})}function rW(e){return e?(um(e),mm(e),!0):!1}export*from"@getpara/web-sdk";import Cm from"@getpara/web-sdk";var SW=Cm;export{Jn as AuthLayout,Oo as CosmosWallet,Lo as EvmWallet,lw as ExternalWallet,He as ModalStep,un as NETWORKS,mn as ON_RAMP_ASSETS,dn as ON_RAMP_PROVIDERS,Fo as OnRampConfigError,tW as ParaModal,pl as ParaProvider,Hr as SaveRecoverySecret,Mo as SolanaWallet,SW as default,ec as getAssetIcon,jl as getAssetName,LS as getClient,MS as getIsOpen,Jl as getNetworkIcon,Nt as getNetworkName,OS as getSelectedWalletId,NS as getSelectedWalletType,Je as openPopup,Jo as useAccount,Ks as useCheckIfUserExists,H as useClient,Vs as useCreateUser,se as useExternalWalletProviderStore,Xs as useInitiateLogin,en as useKeepSessionAlive,jo as useLogout,Yt as useModal,Js as useSignMessage,el as useSignTransaction,Fs as useWaitForAccountCreation,Ds as useWaitForLoginAndSetup,Hs as useWaitForPasskeyAndCreateWallet,Mt as useWallet,ue as useWalletState,rW as validateOnRampConfig};
|