@getpara/react-sdk 1.3.1 → 1.4.0
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 +7 -7
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@getpara/react-components";import{forwardRef as Du,useEffect as Wt,useImperativeHandle as Uu,useRef as bi,useState as Pu}from"react";import{entityToWallet as Fu,OnRampProvider as ku,OnRampAsset as fe,Network as _t,EnabledFlow as He}from"@getpara/web-sdk";import{create as Bi}from"zustand";import{persist as Hi,createJSONStorage as Gi}from"zustand/middleware";var Ve=(M=>(M.AUTH_MAIN="AUTH_MAIN",M.AUTH_MORE="AUTH_MORE",M.EX_WALLET_MORE="EX_WALLET_MORE",M.EX_WALLET_SELECTED="EX_WALLET_SELECTED",M.VERIFICATIONS="VERIFICATIONS",M.AWAITING_OAUTH="AWAITING_OAUTH",M.FARCASTER_OAUTH="FARCASTER_OAUTH",M.BIOMETRIC_CREATION="BIOMETRIC_CREATION",M.AWAITING_BIOMETRIC_CREATION="AWAITING_BIOMETRIC_CREATION",M.PASSWORD_CREATION="PASSWORD_CREATION",M.AWAITING_PASSWORD_CREATION="AWAITING_PASSWORD_CREATION",M.AWAITING_WALLET_CREATION="AWAITING_WALLET_CREATION",M.TELEGRAM_OAUTH="TELEGRAM_OAUTH",M.WALLET_CREATION_DONE="WALLET_CREATION_DONE",M.SECRET="SECRET",M.BIOMETRIC_LOGIN="BIOMETRIC_LOGIN",M.AWAITING_BIOMETRIC_LOGIN="AWAITING_BIOMETRIC_LOGIN",M.AWAITING_PASSWORD_LOGIN="AWAITING_PASSWORD_LOGIN",M.LOGIN_DONE="LOGIN_DONE",M.SETUP_2FA="SETUP_2FA",M.VERIFY_2FA="VERIFY_2FA",M.TWO_FACTOR_DONE="TWO_FACTOR_DONE",M.ADD_FUNDS_BUY="ADD_FUNDS_BUY",M.ADD_FUNDS_RECEIVE="ADD_FUNDS_RECEIVE",M.ADD_FUNDS_WITHDRAW="ADD_FUNDS_WITHDRAW",M.ADD_FUNDS_AWAITING="ADD_FUNDS_AWAITING",M.ADD_FUNDS_SUCCESS="ADD_FUNDS_SUCCESS",M.ADD_FUNDS_FAILURE="ADD_FUNDS_FAILURE",M.ACCOUNT_MAIN="ACCOUNT_MAIN",M.CHAIN_SWITCH="CHAIN_SWITCH",M))(Ve||{});var Xn=["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"],zn=["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_SUCCESS","ADD_FUNDS_FAILURE","CHAIN_SWITCH"],Go={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 Vo={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 $o={AUTH_MAIN:void 0,AUTH_MORE:"AUTH_MAIN",EX_WALLET_MORE:"AUTH_MAIN",EX_WALLET_SELECTED:"AUTH_MAIN",TELEGRAM_OAUTH:"AUTH_MAIN",AWAITING_OAUTH:"AUTH_MAIN",FARCASTER_OAUTH:"AUTH_MAIN",BIOMETRIC_LOGIN:"AUTH_MAIN",AWAITING_BIOMETRIC_LOGIN:"BIOMETRIC_LOGIN",AWAITING_PASSWORD_LOGIN:"BIOMETRIC_LOGIN",AWAITING_WALLET_CREATION:void 0,WALLET_CREATION_DONE:void 0,SECRET:void 0,SETUP_2FA:void 0,VERIFY_2FA:"SETUP_2FA",TWO_FACTOR_DONE:void 0,LOGIN_DONE:void 0,ADD_FUNDS_BUY:"LOGIN_DONE",ADD_FUNDS_RECEIVE:"LOGIN_DONE",ADD_FUNDS_WITHDRAW:"LOGIN_DONE",ADD_FUNDS_AWAITING:"ADD_FUNDS_BUY",ADD_FUNDS_SUCCESS:void 0,ADD_FUNDS_FAILURE:void 0},Qn=e=>{switch(e){case"AUTH_MAIN":case"AUTH_MORE":case"EX_WALLET_MORE":case"EX_WALLET_SELECTED":case"VERIFICATIONS":return!0;default:return!1}};function ut(e){switch(e){case"BUY":return"ADD_FUNDS_BUY";case"RECEIVE":return"ADD_FUNDS_RECEIVE";case"WITHDRAW":default:return"ADD_FUNDS_WITHDRAW"}}var Lt=["PASSWORD_CREATION"];var qn=(e,t)=>({resetState:()=>e(Ko),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",i=t().step,l=t().webAuthURLForCreate,r=t().iFrameUrl,c=(n?Go:a?$o:Vo)[i];i==="PASSWORD_CREATION"&&r&&!l&&(c="AUTH_MAIN"),i==="EX_WALLET_SELECTED"&&e({selectedExternalWalletId:void 0,isExternalWalletConnecting:!1,externalWalletError:void 0}),c&&(e({step:c,stepDirection:-1}),o?.({previousStep:i,currentStep:c,canGoBack:t().hasPreviousStep()}))},hasPreviousStep:()=>{let o=t().flow==="login",a=t().flow==="account",n=t().step;return!!(a?Go[n]:o?$o[n]:Vo[n])},setPopupWindow:o=>{e({popupWindow:o})},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})});var Ko={flow:void 0,stepDirection:1,webAuthURLForLogin:void 0,webAuthURLForCreate:void 0,passwordUrlForLogin:void 0,supportedAuthMethods:new Set,onModalStepChange:void 0,onRampPurchase:void 0,popupWindow: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},s=Bi()(Hi((e,t)=>({step:"AUTH_MAIN",onRampConfig:void 0,activeWallet:void 0,...Ko,...qn(e,t)}),{version:1,name:"@
|
|
2
|
+
import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@getpara/react-components";import{forwardRef as Du,useEffect as Wt,useImperativeHandle as Uu,useRef as bi,useState as Pu}from"react";import{entityToWallet as Fu,OnRampProvider as ku,OnRampAsset as fe,Network as _t,EnabledFlow as He}from"@getpara/web-sdk";import{create as Bi}from"zustand";import{persist as Hi,createJSONStorage as Gi}from"zustand/middleware";var Ve=(M=>(M.AUTH_MAIN="AUTH_MAIN",M.AUTH_MORE="AUTH_MORE",M.EX_WALLET_MORE="EX_WALLET_MORE",M.EX_WALLET_SELECTED="EX_WALLET_SELECTED",M.VERIFICATIONS="VERIFICATIONS",M.AWAITING_OAUTH="AWAITING_OAUTH",M.FARCASTER_OAUTH="FARCASTER_OAUTH",M.BIOMETRIC_CREATION="BIOMETRIC_CREATION",M.AWAITING_BIOMETRIC_CREATION="AWAITING_BIOMETRIC_CREATION",M.PASSWORD_CREATION="PASSWORD_CREATION",M.AWAITING_PASSWORD_CREATION="AWAITING_PASSWORD_CREATION",M.AWAITING_WALLET_CREATION="AWAITING_WALLET_CREATION",M.TELEGRAM_OAUTH="TELEGRAM_OAUTH",M.WALLET_CREATION_DONE="WALLET_CREATION_DONE",M.SECRET="SECRET",M.BIOMETRIC_LOGIN="BIOMETRIC_LOGIN",M.AWAITING_BIOMETRIC_LOGIN="AWAITING_BIOMETRIC_LOGIN",M.AWAITING_PASSWORD_LOGIN="AWAITING_PASSWORD_LOGIN",M.LOGIN_DONE="LOGIN_DONE",M.SETUP_2FA="SETUP_2FA",M.VERIFY_2FA="VERIFY_2FA",M.TWO_FACTOR_DONE="TWO_FACTOR_DONE",M.ADD_FUNDS_BUY="ADD_FUNDS_BUY",M.ADD_FUNDS_RECEIVE="ADD_FUNDS_RECEIVE",M.ADD_FUNDS_WITHDRAW="ADD_FUNDS_WITHDRAW",M.ADD_FUNDS_AWAITING="ADD_FUNDS_AWAITING",M.ADD_FUNDS_SUCCESS="ADD_FUNDS_SUCCESS",M.ADD_FUNDS_FAILURE="ADD_FUNDS_FAILURE",M.ACCOUNT_MAIN="ACCOUNT_MAIN",M.CHAIN_SWITCH="CHAIN_SWITCH",M))(Ve||{});var Xn=["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"],zn=["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_SUCCESS","ADD_FUNDS_FAILURE","CHAIN_SWITCH"],Go={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 Vo={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 $o={AUTH_MAIN:void 0,AUTH_MORE:"AUTH_MAIN",EX_WALLET_MORE:"AUTH_MAIN",EX_WALLET_SELECTED:"AUTH_MAIN",TELEGRAM_OAUTH:"AUTH_MAIN",AWAITING_OAUTH:"AUTH_MAIN",FARCASTER_OAUTH:"AUTH_MAIN",BIOMETRIC_LOGIN:"AUTH_MAIN",AWAITING_BIOMETRIC_LOGIN:"BIOMETRIC_LOGIN",AWAITING_PASSWORD_LOGIN:"BIOMETRIC_LOGIN",AWAITING_WALLET_CREATION:void 0,WALLET_CREATION_DONE:void 0,SECRET:void 0,SETUP_2FA:void 0,VERIFY_2FA:"SETUP_2FA",TWO_FACTOR_DONE:void 0,LOGIN_DONE:void 0,ADD_FUNDS_BUY:"LOGIN_DONE",ADD_FUNDS_RECEIVE:"LOGIN_DONE",ADD_FUNDS_WITHDRAW:"LOGIN_DONE",ADD_FUNDS_AWAITING:"ADD_FUNDS_BUY",ADD_FUNDS_SUCCESS:void 0,ADD_FUNDS_FAILURE:void 0},Qn=e=>{switch(e){case"AUTH_MAIN":case"AUTH_MORE":case"EX_WALLET_MORE":case"EX_WALLET_SELECTED":case"VERIFICATIONS":return!0;default:return!1}};function ut(e){switch(e){case"BUY":return"ADD_FUNDS_BUY";case"RECEIVE":return"ADD_FUNDS_RECEIVE";case"WITHDRAW":default:return"ADD_FUNDS_WITHDRAW"}}var Lt=["PASSWORD_CREATION"];var qn=(e,t)=>({resetState:()=>e(Ko),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",i=t().step,l=t().webAuthURLForCreate,r=t().iFrameUrl,c=(n?Go:a?$o:Vo)[i];i==="PASSWORD_CREATION"&&r&&!l&&(c="AUTH_MAIN"),i==="EX_WALLET_SELECTED"&&e({selectedExternalWalletId:void 0,isExternalWalletConnecting:!1,externalWalletError:void 0}),c&&(e({step:c,stepDirection:-1}),o?.({previousStep:i,currentStep:c,canGoBack:t().hasPreviousStep()}))},hasPreviousStep:()=>{let o=t().flow==="login",a=t().flow==="account",n=t().step;return!!(a?Go[n]:o?$o[n]:Vo[n])},setPopupWindow:o=>{e({popupWindow:o})},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})});var Ko={flow:void 0,stepDirection:1,webAuthURLForLogin:void 0,webAuthURLForCreate:void 0,passwordUrlForLogin:void 0,supportedAuthMethods:new Set,onModalStepChange:void 0,onRampPurchase:void 0,popupWindow: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},s=Bi()(Hi((e,t)=>({step:"AUTH_MAIN",onRampConfig:void 0,activeWallet:void 0,...Ko,...qn(e,t)}),{version:1,name:"@PARA/modalState",storage:Gi(()=>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 $i}from"zustand";import{extractAuthInfo as Vi}from"@getpara/user-management-client";var Zn=(e,t)=>({resetState:()=>{e(Yo)},setAuthInfo:({pfpUrl:o,displayName:a,...n})=>{e({auth:n,pfpUrl:o||null,displayName:a||null})},getAuthInfo:()=>{try{return t().auth?{...Vi(t().auth,{isRequired:!0}),pfpUrl:t().pfpUrl,displayName:t().displayName}:null}catch{return null}},setRecoveryShare:o=>{e({recoveryShare:o})}});var Yo={auth:null,recoveryShare:null,pfpUrl:null,displayName:null},V=$i((e,t)=>({...Yo,...Zn(e,t)}));import{create as Ki}from"zustand";var Jn=(e,t)=>({updateState:o=>{e(o)},getLogo:()=>t().logo??void 0,setAuthLayout:o=>{let a=[],n=[];o.map(i=>{let l=i.split(":")[0];a.includes(l)?console.warn(`${i} is a duplicate ${l} layout type. Please remove the duplicate type from your config.`):(n.push(i),a.push(l))}),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 Yi={isDark:!1,logo:void 0,appName:void 0,bareModal:!1,embeddedModal:!1,oAuthLogoVariant:void 0,authLayout:["AUTH:FULL","EXTERNAL:FULL"],hideWallets:!1},_=Ki((e,t)=>({...Yi,...Jn(e,t)}));import{styled as ct}from"styled-components";import{CpslAlert as lu,CpslIcon as cu}from"@getpara/react-components";import{CpslCodeInput as os,CpslSpinner as ns,CpslText as rs}from"@getpara/react-components";import{useEffect as Xo,useRef as as,useState as Ct}from"react";import{styled as Qo}from"styled-components";import{CpslIcon as Xi,CpslInput as zi,CpslText as Qi,CpslTileButton as qi}from"@getpara/react-components";import{styled as Ae}from"styled-components";var er=Ae.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
@@ -52,7 +52,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
52
52
|
--height: 80px;
|
|
53
53
|
--width: 80px;
|
|
54
54
|
--icon-color: var(--cpsl-color-text-primary);
|
|
55
|
-
`;import{AuthMethod as zo}from"@getpara/core-sdk";import{createStore as Zi,useStore as Ji}from"zustand";var nr=e=>({client:void 0,setClient:t=>e({client:t})});var rr=e=>({isOpen:!1,setIsOpen:t=>e({isOpen:t})});var ar=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 ji,persist as es}from"zustand/middleware";var mt=Zi()(es((...e)=>({...nr(...e),...rr(...e),...ar(...e)}),{version:1,name:"@PARA/web-state",storage:ji(()=>
|
|
55
|
+
`;import{AuthMethod as zo}from"@getpara/core-sdk";import{createStore as Zi,useStore as Ji}from"zustand";var nr=e=>({client:void 0,setClient:t=>e({client:t})});var rr=e=>({isOpen:!1,setIsOpen:t=>e({isOpen:t})});var ar=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 ji,persist as es}from"zustand/middleware";var mt=Zi()(es((...e)=>({...nr(...e),...rr(...e),...ar(...e)}),{version:1,name:"@PARA/web-state",storage:ji(()=>localStorage),partialize:e=>({selectedWalletId:e.selectedWalletId,selectedWalletType:e.selectedWalletType})})),ts=e=>t=>Ji(e,t),Z=ts(mt);var b=()=>Z(t=>t.client);import{Fragment as ls,jsx as At,jsxs as ft}from"react/jsx-runtime";var ir=()=>{let e=_(g=>g.theme),t=V(g=>g.getAuthInfo()),o=s(g=>g.setStep),a=s(g=>g.setWebAuthURLForCreate),n=s(g=>g.setIFrameUrl),i=s(g=>g.setIsIFrameReady),l=s(g=>g.isIFrameReady),r=b(),c=as(null),[p,d]=Ct(""),[u,A]=Ct(""),[m,f]=Ct("Resend."),[S,y]=Ct(!1),[D,W]=Ct(!1),[E,h]=Ct(),R=t?.authType==="email";Xo(()=>{setTimeout(()=>{c.current.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[]),Xo(()=>{E&&l&&setTimeout(()=>{o(E),W(!1)},200)},[E,l]),Xo(()=>{p.length===6&&T()},[p]);let C=async()=>{S||(f("Resent!"),y(!0),R?await r.resendVerificationCode():await r.resendVerificationCodeByPhone(),setTimeout(()=>{f("Resend."),y(!1)},3e3))},L=g=>{u&&A(""),d(g.detail.value.trim())},T=async()=>{if(W(!0),p.length===6&&/^\d+$/.test(p))try{let g=await r.getSupportedCreateAuthMethods();if(g.has(zo.PASSWORD)&&g.has(zo.PASSKEY)){i(!1);let U=R?await r.verifyEmail({verificationCode:p}):await r.verifyPhone({verificationCode:p}),x=await r.getSetupPasswordURL({authType:t?.authType,theme:e});a(await r.shortenLoginLink(U)),n(await r.shortenLoginLink(x)),h("BIOMETRIC_CREATION");return}else if(g.has(zo.PASSWORD)){i(!1),R?await r.verifyEmail({verificationCode:p}):await r.verifyPhone({verificationCode:p});let U=await r.getSetupPasswordURL({authType:t?.authType,theme:e});n(await r.shortenLoginLink(U)),h("PASSWORD_CREATION");return}else{let U=R?await r.verifyEmail({verificationCode:p}):await r.verifyPhone({verificationCode:p});a(await r.shortenLoginLink(U)),o("BIOMETRIC_CREATION")}}catch(g){g.message.includes("429")?A("Too many incorrect attempts. Please try again in 10 minutes."):A("Incorrect code.")}else A("Incorrect code.");W(!1)};return ft(F,{$wide:!0,children:[ft(O,{children:[ft(X,{variant:"headingS",weight:"bold",children:["Verify ",R?"Email":"Phone Number"]}),ft(Yt,{variant:"bodyS",color:"secondary",children:["Please enter the code we sent to ",At(Yt,{variant:"bodyS",children:t.identifier})]})]}),At(O,{children:D?At(ns,{}):ft(ls,{children:[At("form",{onSubmit:async g=>{g.preventDefault(),await T()},children:At(is,{ref:c,length:6,type:"number",code:p,onCpslInput:L,errorText:u,onKeyDown:async g=>g.key==="Enter"&&await T()})}),ft(Yt,{variant:"bodyS",color:"secondary",children:["Didn\u2019t receive a code?"," ",At(ss,{variant:"bodyS",style:{cursor:S?"default":"pointer"},onClick:C,children:m})]})]})})]})},is=Qo(os)`
|
|
56
56
|
align-self: center;
|
|
57
57
|
`,Yt=Qo(rs)`
|
|
58
58
|
text-align: center;
|
|
@@ -68,7 +68,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
68
68
|
`,Ls=pr(jo)`
|
|
69
69
|
margin-top: 8px;
|
|
70
70
|
text-decoration: underline;
|
|
71
|
-
`;import{useEffect as Al}from"react";import ht from"styled-components";import{CpslButton as dl,CpslIdenticon as pl,CpslText as Rr}from"@getpara/react-components";import{truncateAddress as Lr}from"@getpara/web-sdk";import{useEffect as il}from"react";import{useEffect as el,useRef as tl}from"react";var B=()=>Z(t=>t.client);var qt=()=>{let e=Z(n=>n.isOpen),t=Z(n=>n.setIsOpen);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};var Ce=()=>{let e=B(),t=Z(l=>l.selectedWalletId),o=Z(l=>l.selectedWalletType),a=Z(l=>l.setSelectedWallet),n=Z(l=>l.clearSelectedWallet);return{selectedWallet:{id:t,type:o},setSelectedWallet:({id:l,type:r})=>{try{e.findWalletId(l,{type:[r]})!==l?n():a(l,r)}catch{n()}}}};import{useQuery as Ms}from"@tanstack/react-query";var mr=async e=>{let o={isConnected:!!await e?.isFullyLoggedIn(),email:void 0,phone:void 0,wallets:void 0};return e&&o.isConnected&&(o.email=e.getEmail(),o.phone=e.getPhoneNumber(),o.wallets=e.getWallets()),o};var Ee="PARA_ACCOUNT",en=()=>{let e=B();return Ms({queryKey:[Ee,e?.getUserId()],queryFn:async()=>await mr(e)})};import{useQuery as Os}from"@tanstack/react-query";var Cr=async(e,t)=>{let o=await e?.isFullyLoggedIn();return!e||!o?null:e.findWallet(t?.id,t?.type)};var ye="PARA_WALLET",Nt=()=>{let e=B(),{selectedWallet:t}=Ce();return Os({queryKey:[ye,e?.getUserId(),t.id,t.type],queryFn:async()=>await Cr(e,t)})};import{useMutation as Ns,useQueryClient as vs}from"@tanstack/react-query";var fr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to waitForLoginAndSetup");try{let o=await e.waitForLoginAndSetup(t);if(o.isError)throw new Error("error during waitForLoginAndSetup");return o}catch(o){throw new Error(o)}};function J(e,t){let{mutate:o,mutateAsync:a,...n}=e;return{...{[t]:e.mutate,[`${t}Async`]:e.mutateAsync},...n}}var bs=()=>{let e=B(),t=vs(),o=Ns({mutationFn:async a=>await fr(e,a),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForLoginAndSetup")};import{useMutation as Ds,useQueryClient as Us}from"@tanstack/react-query";var Ar=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForAccountCreation();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Ps=()=>{let e=B(),t=Us(),o=Ds({mutationFn:async()=>await Ar(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForAccountCreation")};import{useMutation as Fs,useQueryClient as ks}from"@tanstack/react-query";var Sr=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForPasskeyAndCreateWallet();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Bs=()=>{let e=B(),t=ks(),o=Fs({mutationFn:async()=>await Sr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForPasskeyAndCreateWallet")};import{useMutation as Hs}from"@tanstack/react-query";var Er=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to createUser");try{await(t.type==="EMAIL"?e.createUser({email:t.identifier}):e.createUserByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var Gs=()=>{let e=B(),t=Hs({mutationFn:async o=>await Er(e,o)});return J(t,"createUser")};import{useMutation as Vs}from"@tanstack/react-query";var hr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to checkIfUserExists");try{return await(t.type==="EMAIL"?e.checkIfUserExists({email:t.identifier}):e.checkIfUserExistsByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var $s=()=>{let e=B(),t=Vs({mutationFn:async o=>await hr(e,o)});return J(t,"checkIfUserExists")};import{useMutation as Ks}from"@tanstack/react-query";var Tr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to initiateLogin");try{return await e.initiateUserLoginV2(t)}catch(o){throw new Error(o)}};var Ys=()=>{let e=B(),t=Ks({mutationFn:async o=>await Tr(e,o)});return J(t,"initiateLogin")};import{useMutation as Xs,useQueryClient as zs}from"@tanstack/react-query";var Ir=async e=>{if(!e)throw new Error("no para instance");try{await e.logout()}catch(t){throw new Error(t)}};var tn=()=>{let e=B(),t=zs(),o=Z(n=>n.clearSelectedWallet),a=Xs({mutationFn:async()=>await Ir(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1}),o()}});return J(a,"logout")};import{useMutation as Qs}from"@tanstack/react-query";var gr=async e=>{if(!e)throw new Error("no para instance");try{if(!await e.keepSessionAlive())throw new Error("session expired")}catch(t){throw new Error(t)}};var on=()=>{let e=B(),t=Qs({mutationFn:async()=>await gr(e)});return J(t,"keepSessionAlive")};import{useMutation as qs}from"@tanstack/react-query";var yr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signMessage");try{return await e.signMessage(t)}catch(o){throw new Error(o)}};var Zs=()=>{let e=B(),{data:t}=Nt(),o=qs({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await yr(e,{...a,walletId:n})}});return J(o,"signMessage")};import{useMutation as Js}from"@tanstack/react-query";var xr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signTransaction");try{return await e.signTransaction(t)}catch(o){throw new Error(o)}};var js=()=>{let e=B(),{data:t}=Nt(),o=Js({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await xr(e,{...a,walletId:n})}});return J(o,"signTransaction")};var ol=6e4,nl=3e5,wr=({disabled:e})=>{let t=B(),{data:o}=en(),{logoutAsync:a}=tn(),{keepSessionAliveAsync:n}=on(),i=tl(null);el(()=>{if(!t||e){c();return}return o?.isConnected?r():c(),()=>c()},[t,o,e]);let l=async()=>{try{let p=await t.retrieveSessionCookie();if(!p)return null;let d=p.match(/Expires=([^;]+)/);return d?new Date(d[1]):null}catch{return null}},r=()=>{c(),i.current=setInterval(async()=>{let p=await l();if(!p){await a(),c();return}let d=p.getTime()-Date.now();if(d<=0){await a(),c();return}if(d<=nl){try{await n(),r()}catch(u){console.error("Failed to keep session alive:",u),await a(),c()}return}},ol)},c=()=>{i.current&&clearInterval(i.current)}};import{useQueryClient as rl}from"@tanstack/react-query";import{useEffect as al}from"react";import{ParaEvent as j}from"@getpara/web-sdk";var Wr=({onLogin:e,onLogout:t,onAccountSetup:o,onAccountCreation:a,onSignMessage:n,onSignTransaction:i,onWalletCreated:l,onPregenWalletClaimed:r,onExternalWalletChange:c,onWalletsChange:p}={})=>{let d=rl(),u=B(),A=Z(x=>x.clearSelectedWallet),{selectedWallet:m,setSelectedWallet:f}=Ce(),S=x=>{D(),e?.(x)},y=x=>{D(),o?.(x)},D=()=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),d.invalidateQueries({queryKey:[ye],exact:!1})},W=x=>{a?.(x)},E=x=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),A(),t?.(x)},h=x=>{n?.(x)},R=x=>{i?.(x)},C=x=>{U(),p?.(x)},L=x=>{U(),c?.(x)},T=x=>{l?.(x)},g=x=>{r?.(x)},U=()=>{if(!u){A();return}if(!m?.id||!u.findWallet(m?.id)){let x=u.findWallet(void 0,void 0,{forbidPregen:!0});f({id:x?.id,type:x?.type})}};al(()=>(window.addEventListener(j.LOGIN_EVENT,S),window.addEventListener(j.ACCOUNT_SETUP_EVENT,y),window.addEventListener(j.ACCOUNT_CREATION_EVENT,W),window.addEventListener(j.LOGOUT_EVENT,E),window.addEventListener(j.SIGN_MESSAGE_EVENT,h),window.addEventListener(j.SIGN_TRANSACTION_EVENT,R),window.addEventListener(j.WALLETS_CHANGE_EVENT,C),window.addEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.addEventListener(j.WALLET_CREATED,T),window.addEventListener(j.PREGEN_WALLET_CLAIMED,g),()=>{window.removeEventListener(j.LOGIN_EVENT,S),window.removeEventListener(j.ACCOUNT_SETUP_EVENT,y),window.removeEventListener(j.ACCOUNT_CREATION_EVENT,W),window.removeEventListener(j.LOGOUT_EVENT,E),window.removeEventListener(j.SIGN_MESSAGE_EVENT,h),window.removeEventListener(j.SIGN_TRANSACTION_EVENT,R),window.removeEventListener(j.WALLETS_CHANGE_EVENT,C),window.removeEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.removeEventListener(j.WALLET_CREATED,T),window.removeEventListener(j.PREGEN_WALLET_CLAIMED,g)}),[u])};import{ParaInternal as sl}from"@getpara/react-common";var ll={disableAutoSessionKeepAlive:!1},cl=({children:e,paraClientConfig:t,callbacks:o,config:a=ll})=>{Wr(o),wr({disabled:a.disableAutoSessionKeepAlive});let n=Z(i=>i.setClient);return il(()=>{let i=a.paraClientOverride??new sl(t.env,t.apiKey,t.opts);n(i)},[t,a.paraClientOverride]),e};var RS=()=>mt.getState().client,LS=()=>mt.getState().isOpen,MS=()=>mt.getState().selectedWalletId,OS=()=>mt.getState().selectedWalletType;import{jsx as et,jsxs as nn}from"react/jsx-runtime";var Mr=({address:e,showAddFunds:t})=>{let o=b(),a=o.externalWallets[e];return a?et(Or,{address:Lr(a.address,a.type),identiconHash:o.getIdenticonHash(a.id,a.type),showAddFunds:t}):null},Zt=({id:e,type:t,showAddFunds:o})=>{let a=b(),n=_(r=>r.appName),i=a.findWallet(e,t);if(!i)return null;let l=a.getDisplayAddress(i.id,{addressType:t});return et(Or,{id:i.id,type:i.type,address:Lr(l,t,{prefix:a.cosmosPrefix}),name:i.name??`${n?`${n} `:""}Wallet`,identiconHash:a.getIdenticonHash(i.id,t),showAddFunds:o})},Or=({address:e,name:t,identiconHash:o,showAddFunds:a,id:n,type:i})=>{let l=s(u=>u.onRampConfig),{setSelectedWallet:r}=Ce(),c=s(u=>u.setStep),p=l.isBuyEnabled||l.isReceiveEnabled;return nn(ul,{children:[nn(ml,{children:[et(pl,{size:"48px",hash:o}),nn(Cl,{children:[!!t&&et(_r,{color:"contrast",variant:"bodyL",weight:"semiBold",children:t}),et(_r,{color:"secondary",variant:"bodyS",weight:"medium",children:e})]})]}),a&&p&&et(fl,{onClick:()=>{n&&i&&(r({id:n,type:i}),p&&c(l.isBuyEnabled?"ADD_FUNDS_BUY":"ADD_FUNDS_RECEIVE"))},children:et(Rr,{variant:"bodyXS",color:"contrast",weight:"medium",children:"Add Funds"})})]})},Jt=ht.div`
|
|
71
|
+
`;import{useEffect as Al}from"react";import ht from"styled-components";import{CpslButton as dl,CpslIdenticon as pl,CpslText as Rr}from"@getpara/react-components";import{truncateAddress as Lr}from"@getpara/web-sdk";import{useEffect as il}from"react";import{useEffect as el,useRef as tl}from"react";var G=()=>Z(t=>t.client);var qt=()=>{let e=Z(n=>n.isOpen),t=Z(n=>n.setIsOpen);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)}}};var Ce=()=>{let e=G(),t=Z(l=>l.selectedWalletId),o=Z(l=>l.selectedWalletType),a=Z(l=>l.setSelectedWallet),n=Z(l=>l.clearSelectedWallet);return{selectedWallet:{id:t,type:o},setSelectedWallet:({id:l,type:r})=>{try{e.findWalletId(l,{type:[r]})!==l?n():a(l,r)}catch{n()}}}};import{useQuery as Ms}from"@tanstack/react-query";var mr=async e=>{let o={isConnected:!!await e?.isFullyLoggedIn(),email:void 0,phone:void 0,wallets:void 0};return e&&o.isConnected&&(o.email=e.getEmail(),o.phone=e.getPhoneNumber(),o.wallets=e.getWallets()),o};var Ee="PARA_ACCOUNT",en=()=>{let e=G();return Ms({queryKey:[Ee,e?.getUserId()],queryFn:async()=>await mr(e)})};import{useQuery as Os}from"@tanstack/react-query";var Cr=async(e,t)=>{let o=await e?.isFullyLoggedIn();return!e||!o?null:e.findWallet(t?.id,t?.type)};var ye="PARA_WALLET",Nt=()=>{let e=G(),{selectedWallet:t}=Ce();return Os({queryKey:[ye,e?.getUserId(),t.id,t.type],queryFn:async()=>await Cr(e,t)})};import{useMutation as Ns,useQueryClient as vs}from"@tanstack/react-query";var fr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to waitForLoginAndSetup");try{let o=await e.waitForLoginAndSetup(t);if(o.isError)throw new Error("error during waitForLoginAndSetup");return o}catch(o){throw new Error(o)}};function J(e,t){let{mutate:o,mutateAsync:a,...n}=e;return{...{[t]:e.mutate,[`${t}Async`]:e.mutateAsync},...n}}var bs=()=>{let e=G(),t=vs(),o=Ns({mutationFn:async a=>await fr(e,a),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForLoginAndSetup")};import{useMutation as Ds,useQueryClient as Us}from"@tanstack/react-query";var Ar=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForAccountCreation();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Ps=()=>{let e=G(),t=Us(),o=Ds({mutationFn:async()=>await Ar(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForAccountCreation")};import{useMutation as Fs,useQueryClient as ks}from"@tanstack/react-query";var Sr=async e=>{if(!e)throw new Error("no para instance");try{let t=await e.waitForPasskeyAndCreateWallet();if(!t)throw new Error("error during waitForAccountCreation");return t}catch(t){throw new Error(t)}};var Bs=()=>{let e=G(),t=ks(),o=Fs({mutationFn:async()=>await Sr(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1})}});return J(o,"waitForPasskeyAndCreateWallet")};import{useMutation as Hs}from"@tanstack/react-query";var Er=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to createUser");try{await(t.type==="EMAIL"?e.createUser({email:t.identifier}):e.createUserByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var Gs=()=>{let e=G(),t=Hs({mutationFn:async o=>await Er(e,o)});return J(t,"createUser")};import{useMutation as Vs}from"@tanstack/react-query";var hr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to checkIfUserExists");try{return await(t.type==="EMAIL"?e.checkIfUserExists({email:t.identifier}):e.checkIfUserExistsByPhone({phone:t.identifier,countryCode:t.countryCode}))}catch(o){throw new Error(o)}};var $s=()=>{let e=G(),t=Vs({mutationFn:async o=>await hr(e,o)});return J(t,"checkIfUserExists")};import{useMutation as Ks}from"@tanstack/react-query";var Tr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to initiateLogin");try{return await e.initiateUserLoginV2(t)}catch(o){throw new Error(o)}};var Ys=()=>{let e=G(),t=Ks({mutationFn:async o=>await Tr(e,o)});return J(t,"initiateLogin")};import{useMutation as Xs,useQueryClient as zs}from"@tanstack/react-query";var Ir=async e=>{if(!e)throw new Error("no para instance");try{await e.logout()}catch(t){throw new Error(t)}};var tn=()=>{let e=G(),t=zs(),o=Z(n=>n.clearSelectedWallet),a=Xs({mutationFn:async()=>await Ir(e),onSettled:async()=>{await t.invalidateQueries({queryKey:[Ee],exact:!1}),await t.invalidateQueries({queryKey:[ye],exact:!1}),o()}});return J(a,"logout")};import{useMutation as Qs}from"@tanstack/react-query";var gr=async e=>{if(!e)throw new Error("no para instance");try{if(!await e.keepSessionAlive())throw new Error("session expired")}catch(t){throw new Error(t)}};var on=()=>{let e=G(),t=Qs({mutationFn:async()=>await gr(e)});return J(t,"keepSessionAlive")};import{useMutation as qs}from"@tanstack/react-query";var yr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signMessage");try{return await e.signMessage(t)}catch(o){throw new Error(o)}};var Zs=()=>{let e=G(),{data:t}=Nt(),o=qs({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await yr(e,{...a,walletId:n})}});return J(o,"signMessage")};import{useMutation as Js}from"@tanstack/react-query";var xr=async(e,t)=>{if(!e)throw new Error("no para instance");if(!t)throw new Error("no valid args passed to signTransaction");try{return await e.signTransaction(t)}catch(o){throw new Error(o)}};var js=()=>{let e=G(),{data:t}=Nt(),o=Js({mutationFn:async a=>{let n=a?.walletId;if(n||(n=t?.id),!n)throw Error("no wallet id found");return await xr(e,{...a,walletId:n})}});return J(o,"signTransaction")};var ol=6e4,nl=3e5,wr=({disabled:e})=>{let t=b(),{data:o}=en(),{logoutAsync:a}=tn(),{keepSessionAliveAsync:n}=on(),i=tl(null);el(()=>{if(!t||e){c();return}return o?.isConnected&&!t.isUsingExternalWallet()?r():c(),()=>c()},[t,o,e]);let l=async()=>{try{let p=await t.retrieveSessionCookie();if(!p)return null;let d=p.match(/Expires=([^;]+)/);return d?new Date(d[1]):null}catch{return null}},r=()=>{c(),i.current=setInterval(async()=>{let p=await l();if(!p){await a(),c();return}let d=p.getTime()-Date.now();if(d<=0){await a(),c();return}if(d<=nl){try{await n(),r()}catch(u){console.error("Failed to keep session alive:",u),await a(),c()}return}},ol)},c=()=>{i.current&&clearInterval(i.current)}};import{useQueryClient as rl}from"@tanstack/react-query";import{useEffect as al}from"react";import{ParaEvent as j}from"@getpara/web-sdk";var Wr=({onLogin:e,onLogout:t,onAccountSetup:o,onAccountCreation:a,onSignMessage:n,onSignTransaction:i,onWalletCreated:l,onPregenWalletClaimed:r,onExternalWalletChange:c,onWalletsChange:p}={})=>{let d=rl(),u=G(),A=Z(x=>x.clearSelectedWallet),{selectedWallet:m,setSelectedWallet:f}=Ce(),S=x=>{D(),e?.(x)},y=x=>{D(),o?.(x)},D=()=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),d.invalidateQueries({queryKey:[ye],exact:!1})},W=x=>{a?.(x)},E=x=>{d.invalidateQueries({queryKey:[Ee],exact:!1}),A(),t?.(x)},h=x=>{n?.(x)},R=x=>{i?.(x)},C=x=>{U(),p?.(x)},L=x=>{U(),c?.(x)},T=x=>{l?.(x)},g=x=>{r?.(x)},U=()=>{if(!u){A();return}if(!m?.id||!u.findWallet(m?.id)){let x=u.findWallet(void 0,void 0,{forbidPregen:!0});f({id:x?.id,type:x?.type})}};al(()=>(window.addEventListener(j.LOGIN_EVENT,S),window.addEventListener(j.ACCOUNT_SETUP_EVENT,y),window.addEventListener(j.ACCOUNT_CREATION_EVENT,W),window.addEventListener(j.LOGOUT_EVENT,E),window.addEventListener(j.SIGN_MESSAGE_EVENT,h),window.addEventListener(j.SIGN_TRANSACTION_EVENT,R),window.addEventListener(j.WALLETS_CHANGE_EVENT,C),window.addEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.addEventListener(j.WALLET_CREATED,T),window.addEventListener(j.PREGEN_WALLET_CLAIMED,g),()=>{window.removeEventListener(j.LOGIN_EVENT,S),window.removeEventListener(j.ACCOUNT_SETUP_EVENT,y),window.removeEventListener(j.ACCOUNT_CREATION_EVENT,W),window.removeEventListener(j.LOGOUT_EVENT,E),window.removeEventListener(j.SIGN_MESSAGE_EVENT,h),window.removeEventListener(j.SIGN_TRANSACTION_EVENT,R),window.removeEventListener(j.WALLETS_CHANGE_EVENT,C),window.removeEventListener(j.EXTERNAL_WALLET_CHANGE_EVENT,L),window.removeEventListener(j.WALLET_CREATED,T),window.removeEventListener(j.PREGEN_WALLET_CLAIMED,g)}),[u])};import{ParaInternal as sl}from"@getpara/react-common";var ll={disableAutoSessionKeepAlive:!1},cl=({children:e,paraClientConfig:t,callbacks:o,config:a=ll})=>{Wr(o),wr({disabled:a.disableAutoSessionKeepAlive});let n=Z(i=>i.setClient);return il(()=>{let i=a.paraClientOverride??new sl(t.env,t.apiKey,t.opts);n(i)},[t,a.paraClientOverride]),e};var LS=()=>mt.getState().client,MS=()=>mt.getState().isOpen,OS=()=>mt.getState().selectedWalletId,NS=()=>mt.getState().selectedWalletType;import{jsx as et,jsxs as nn}from"react/jsx-runtime";var Mr=({address:e,showAddFunds:t})=>{let o=b(),a=o.externalWallets[e];return a?et(Or,{address:Lr(a.address,a.type),identiconHash:o.getIdenticonHash(a.id,a.type),showAddFunds:t}):null},Zt=({id:e,type:t,showAddFunds:o})=>{let a=b(),n=_(r=>r.appName),i=a.findWallet(e,t);if(!i)return null;let l=a.getDisplayAddress(i.id,{addressType:t});return et(Or,{id:i.id,type:i.type,address:Lr(l,t,{prefix:a.cosmosPrefix}),name:i.name??`${n?`${n} `:""}Wallet`,identiconHash:a.getIdenticonHash(i.id,t),showAddFunds:o})},Or=({address:e,name:t,identiconHash:o,showAddFunds:a,id:n,type:i})=>{let l=s(u=>u.onRampConfig),{setSelectedWallet:r}=Ce(),c=s(u=>u.setStep),p=l.isBuyEnabled||l.isReceiveEnabled;return nn(ul,{children:[nn(ml,{children:[et(pl,{size:"48px",hash:o}),nn(Cl,{children:[!!t&&et(_r,{color:"contrast",variant:"bodyL",weight:"semiBold",children:t}),et(_r,{color:"secondary",variant:"bodyS",weight:"medium",children:e})]})]}),a&&p&&et(fl,{onClick:()=>{n&&i&&(r({id:n,type:i}),p&&c(l.isBuyEnabled?"ADD_FUNDS_BUY":"ADD_FUNDS_RECEIVE"))},children:et(Rr,{variant:"bodyXS",color:"contrast",weight:"medium",children:"Add Funds"})})]})},Jt=ht.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
flex-direction: column;
|
|
74
74
|
gap: 8px;
|
|
@@ -169,7 +169,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
169
169
|
`,nc=ot(Jr)`
|
|
170
170
|
transform: rotate(90deg);
|
|
171
171
|
--icon-color: #fff;
|
|
172
|
-
`;import{isMobile as Ic}from"@getpara/web-sdk";import{useMemo as rc}from"react";function nt(){let e=b(),{selectedWallet:t}=Ce();return rc(()=>e.findWallet(t.id,t.type,{forbidPregen:!0}),[e,t])}import{motion as gc,AnimatePresence as yc}from"framer-motion";import{createContext as ac,useCallback as ea,useContext as so,useEffect as ic,useMemo as It,useState as ta}from"react";import{WalletType as we,isIOS as sc,isIOSWebview as lc,isMobile as io,truncateAddress as oa}from"@getpara/web-sdk";import{jsx as dc}from"react/jsx-runtime";var cc={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:()=>{}},na=ac(cc);function ra({children:e,evmContext:t,solanaContext:o,cosmosContext:a,walletSort:n}){let{wallets:i,disconnect:l,chains:r,chainId:c,switchChain:p,username:d,avatar:u}=so(t),{wallets:A,disconnect:m}=so(o),{wallets:f,disconnect:S,chains:y,chainId:D,switchChain:W}=so(a),E=s(I=>I.setStep),h=s(I=>I.setStepDirection),R=s(I=>I.setIsExternalWalletConnecting),C=s(I=>I.isExternalWalletConnecting),L=s(I=>I.setSelectedExternalWalletId),T=s(I=>I.selectedExternalWalletId),g=s(I=>I.setExternalWalletError),U=s(I=>I.setIsUsingMobileConnector),x=s(I=>I.isUsingMobileConnector),P=b(),[K,M]=ta(),[ne,ae]=ta(),ce=[...i,...A,...f].filter(I=>n.includes(I.id.toUpperCase())).sort((I,
|
|
172
|
+
`;import{isMobile as Ic}from"@getpara/web-sdk";import{useMemo as rc}from"react";function nt(){let e=b(),{selectedWallet:t}=Ce();return rc(()=>e.findWallet(t.id,t.type,{forbidPregen:!0}),[e,t])}import{motion as gc,AnimatePresence as yc}from"framer-motion";import{createContext as ac,useCallback as ea,useContext as so,useEffect as ic,useMemo as It,useState as ta}from"react";import{WalletType as we,isIOS as sc,isIOSWebview as lc,isMobile as io,truncateAddress as oa}from"@getpara/web-sdk";import{jsx as dc}from"react/jsx-runtime";var cc={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:()=>{}},na=ac(cc);function ra({children:e,evmContext:t,solanaContext:o,cosmosContext:a,walletSort:n}){let{wallets:i,disconnect:l,chains:r,chainId:c,switchChain:p,username:d,avatar:u}=so(t),{wallets:A,disconnect:m}=so(o),{wallets:f,disconnect:S,chains:y,chainId:D,switchChain:W}=so(a),E=s(I=>I.setStep),h=s(I=>I.setStepDirection),R=s(I=>I.setIsExternalWalletConnecting),C=s(I=>I.isExternalWalletConnecting),L=s(I=>I.setSelectedExternalWalletId),T=s(I=>I.selectedExternalWalletId),g=s(I=>I.setExternalWalletError),U=s(I=>I.setIsUsingMobileConnector),x=s(I=>I.isUsingMobileConnector),P=b(),[K,M]=ta(),[ne,ae]=ta(),ce=[...i,...A,...f].filter(I=>n.includes(I.id.toUpperCase())).sort((I,B)=>n.indexOf(I.id.toUpperCase())-n.indexOf(B.id.toUpperCase())).sort((I,B)=>I.installed===B.installed?0:I.installed?-1:1),Y=It(()=>ce.find(I=>I.id===T),[ce,T]),N=async()=>{let I=await Y?.getQrUri?.();M(I)};ic(()=>{Y?K||N():K&&M(void 0)},[Y]);let Q=It(()=>{switch(P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type){case we.COSMOS:return y;case we.EVM:return r;default:return[]}},[y,r,T]),te=It(()=>{switch(P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type){case we.COSMOS:return D;case we.EVM:return c?.toString();default:return}},[y,r,T]),H=ea(async I=>{let B=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type;if(B){let q;switch(g(),ae(I),B){case we.COSMOS:{E("CHAIN_SWITCH"),q=await W(I);break}case we.EVM:{E("CHAIN_SWITCH"),q=await p(parseInt(I));break}default:break}q.error?g(q.error):(ae(void 0),h(-1),E("ACCOUNT_MAIN"))}},[p,W]),de=ea(async(I,B,q,pe)=>{if(C&&q&&(await l(),await m(),await S(),M(void 0),R(!1)),pe||q||!C){g(),R(!0),U(B);let{address:ue,error:me}=await(B?I.connectMobile(q):I.connect());if(me){if(g([me]),U(),q&&me==="Connection request rejected"){g(),await de(I,!1,!1,!0),await N();return}}else ue&&E("LOGIN_DONE");R(!1)}},[C]),De=async()=>{await l(),await m(),await S(),L()},pt={showExtension:!io()&&(Y?.isExtension&&Y?.installed||!Y?.isMobile||Y?.type===we.SOLANA),showMobile:io()&&Y?.isMobile||!io()&&!Y?.installed,isSolanaMobileIOS:sc()&&io()&&!lc()&&Y?.type===we.SOLANA,isCosmosMobileWallet:Y?.type===we.COSMOS&&x},Ue=It(()=>{let I,B=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""];if(B)switch(B?.type){case we.EVM:{I=d?d.startsWith("0x")?oa(d,"EVM"):d:void 0;break}default:{I=B.address?oa(B.address,B.type):void 0;break}}return I},[d,Y]),w=It(()=>{let I=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type;if(I)switch(I){case we.EVM:return u;default:return}},[u,Y]);return dc(na.Provider,{value:It(()=>({wallets:ce,chains:Q,chainId:te,wallet:Y,qrUri:K,walletDisplayHelpers:pt,chainIdSwitchingTo:ne,username:Ue,avatar:w,connectExternalWallet:de,disconnectExternalWallet:De,switchChain:H,setChainIdSwitchingTo:ae}),[ce,Q,te,Y,K,pt,ne,Ue,w,De,de,H,ae]),children:e})}var $=()=>so(na);import{getNetworkFromChainId as xc,getNetworkOrMainNetEquivalent as wc,useCopyToClipboard as Wc}from"@getpara/react-common";import{format as Eh}from"date-fns";var aa=e=>e.length===1?bt(e[0]):`${e.map(t=>bt(t)).slice(0,-1).join(", ")}${e.length>2?",":""} and ${bt(e[e.length-1])}`;import En from"styled-components";import{Fragment as co,jsx as ee,jsxs as We}from"react/jsx-runtime";var ca=[[rt.BUY,"isBuyEnabled","creditCard","Buy"],[rt.RECEIVE,"isReceiveEnabled","qrCode","Receive"],[rt.WITHDRAW,"isWithdrawEnabled","arrowCircleBrokenDownLeft","Withdraw"]],_c={[An.EVM]:"Ethereum or EVM-based L2s",[An.SOLANA]:"Solana",[An.COSMOS]:"Cosmos"},pa=()=>{let[e,t]=Wc(),o=b(),a=_(h=>h.appName),n=s(h=>h.onRampConfig),i=_(h=>h.hideWallets),l=s(h=>h.accountAddFundTab),r=s(h=>h.setStep),c=s(h=>h.setOnRampPurchase),{chainId:p}=$(),d=nt(),u=ca.filter(([,h])=>!!n[h]),A=u.length>1,m=l??u[0][0],f=la(()=>d?o.getDisplayAddress(d.id,{addressType:d.type}):"",[o,d?.id,d?.type]),S=h=>{r(ut(h.detail.tab))},y=()=>{t(f)},[D,W,E]=la(()=>{if(!n||!d)return[[],[],{}];let h=m===rt.BUY?lo.BUY:lo.SELL,R=xc(p),L=d.isExternal&&!!R?[wc(R,n.testMode)]:uc(n.assetInfo,{walletType:d.type,allowed:n.allowedAssets?Object.keys(n.allowedAssets):void 0}),T=L.reduce((U,x)=>{let P=n.allowedAssets?.[x],K=P===!0?void 0:P;return{...U,[x]:pc(n.assetInfo,{walletType:d.type,network:x,allowed:K})}},{}),g=n.providers.reduce((U,x)=>{let P=Cc(n.assetInfo).some(([K,M,ne,ae])=>K===d.type&&L.includes(M)&&(!T[M]||T[M].includes(ne))&&!!ae[x]?.[1]?.[h]);return{...U,[x]:P}},{});return[L,[...new Set(Object.values(T).flat())],g]},[d?.type,d?.isExternal,m,n.assetInfo,n.allowedAssets,p]);return Sn(()=>{c(void 0)},[]),Sn(()=>{c(void 0)},[]),!n||!d?ee(Rc,{children:ee(sa,{})}):(Sn(()=>{c(void 0)},[]),We(F,{children:[A&&ee(O,{children:ee(Tc,{selectedTab:m,onCpslTabsChanged:S,children:ca.map(([h,R,C,L])=>We(hc,{tab:h,children:[ee(ia,{slot:"start",icon:C}),L]},h))})}),ee(co,{children:[rt.BUY,rt.WITHDRAW].includes(m)?We(co,{children:[ee(X,{variant:"headingS",weight:"bold",children:"Choose Provider"}),We(Lc,{children:[We(Mc,{isHidden:Object.values(E).some(h=>!!h),variant:"bodyM",children:["No providers are available for this ",i?"account":"wallet"]}),ee(yc,{children:n.providers.map((h,R)=>E[h]?ee(gc.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:ee(jr,{config:n,index:R,onClick:async()=>{if(!d?.type)return;let C=h!==mc.RAMP,{onRampPurchase:L}=await o.initiateOnRampTransaction({walletId:d.isExternal?void 0:d.id,externalWalletAddress:d.isExternal?d.id:void 0,shouldOpenPopup:C,params:{type:m===rt.BUY?lo.BUY:lo.SELL,walletType:d.type,provider:h,networks:D,assets:W,defaultNetwork:n.defaultOnRampNetwork,defaultAsset:n.defaultOnRampAsset,fiatQuantity:n.defaultBuyAmount?.[0],testMode:n.testMode}});c({...L,fiat:"USD"}),!C&&r("ADD_FUNDS_AWAITING")}},h)},h):null)})]})]}):We(co,{children:[ee(O,{children:We(Mt,{noAutoDisable:!0,readonly:!0,placeholder:f,children:[ee(Sc,{slot:"start",size:"32px",hash:o.getIdenticonHash(d.id,d.type)}),ee(fc,{slot:"end",variant:"ghost",onClick:y,children:ee(ia,{icon:e?"check":"copy"})})]},f)}),!Ic()&&We(co,{children:[ee(Ac,{children:"or"}),We(O,{children:[ee(Se,{children:f?ee(Ec,{url:f},f):ee(sa,{size:100})}),ee(da,{weight:"semiBold",color:"secondary",children:"Scan with your crypto wallet"})]})]}),We(O,{children:[We(ie,{weight:"semiBold",children:[n.allowedAssets&&D.length>0||i?a??"This App":"This Wallet"," ","Only Supports:"]}),ee(ie,{weight:"medium",color:"secondary",children:n.allowedAssets&&D.length>0?aa(D):_c[d.type]})]})]})})]}))},Rc=En(F)`
|
|
173
173
|
margin: 50% 0;
|
|
174
174
|
`,Lc=En(O)`
|
|
175
175
|
position: relative;
|
|
@@ -282,7 +282,7 @@ import{CpslAuthModal as nm,defineCustomElements as rm,generateTheme as am}from"@
|
|
|
282
282
|
flex: ${({$index:e,$totalItems:t})=>ya(e,t)};
|
|
283
283
|
|
|
284
284
|
--button-icon-color: ${({$isDark:e})=>e?"white":"black"};
|
|
285
|
-
`;import{CpslButton as wd,CpslIcon as _n,CpslInput as Wd,CpslSelect as _d,CpslSelectItem as Rd,CpslSpinner as Ld,CpslText as Eo}from"@getpara/react-components";import{useRef as Md,useState as it}from"react";import Ht from"styled-components";import{getCountries as hd,getCountryCallingCode as Td}from"libphonenumber-js";var Id=["AC","CG","CI","CV","GF","GP","MF","NC","PM","RE","SD","SH","SJ","TA","VA","WF","XK","YT"],gd=()=>hd().filter(o=>!Id.includes(o)).map(o=>{let a=Td(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)),yd=gd(),Ft=yd;import{useEffect as xd,useState as Wn}from"react";var kt=e=>{let[t,o]=Wn(),[a,n]=Wn(),[i,l]=Wn(),r=()=>{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),l(e?.current?.getBoundingClientRect().height)}};return e.current&&!t&&r(),xd(()=>(typeof window<"u"&&window.addEventListener("resize",r),()=>{typeof window<"u"&&window.removeEventListener("resize",r)}),[]),{dropdownMaxHeight:t,dropdownWidth:a,mobileAnchor:i,resize:r}};var La="#################",Ma={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 Oa}from"@getpara/web-sdk";import{jsx as Oe,jsxs as Bt}from"react/jsx-runtime";var Od={label:"United States",value:"+1",selectedLabel:"US",icon:"US"},Na=({disableEmailLogin:e,disablePhoneLogin:t})=>{let o=Md(null),{dropdownMaxHeight:a,dropdownWidth:n}=kt(o),i=b(),l=V(N=>N.setAuthInfo),r=V(N=>N.getAuthInfo()),c=s(N=>N.setFlow),p=s(N=>N.setStep),d=s(N=>N.setSupportedAuthMethods),u=s(N=>N.setBiometricLocationHints),[A,m]=it(r?.authType==="phone"?r.auth.countryCode:"+1"),[f,S]=it(!r||["telegramUserId","farcasterUsername"].includes(r.authType)?"":r.authType!=="phone"?r.identifier:r.auth.phone),[y,D]=it(r&&(r.authType==="email"||r.authType==="phone")?r.authType:void 0),[W,E]=it(Od),[h,R]=it(!1),[C,L]=it(""),[T,g]=it(""),U=y==="email",x=y==="phone",P=!y,K=T?Ft.filter(N=>N.selectedLabel.toLowerCase().includes(T.toLowerCase())||N.label.toLowerCase().includes(T.toLowerCase())||N.value.toLowerCase().includes(T.toLowerCase())):Ft,M=N=>{g(N.detail)},ne=N=>{let Q=N.detail.value,te=!1,
|
|
285
|
+
`;import{CpslButton as wd,CpslIcon as _n,CpslInput as Wd,CpslSelect as _d,CpslSelectItem as Rd,CpslSpinner as Ld,CpslText as Eo}from"@getpara/react-components";import{useRef as Md,useState as it}from"react";import Ht from"styled-components";import{getCountries as hd,getCountryCallingCode as Td}from"libphonenumber-js";var Id=["AC","CG","CI","CV","GF","GP","MF","NC","PM","RE","SD","SH","SJ","TA","VA","WF","XK","YT"],gd=()=>hd().filter(o=>!Id.includes(o)).map(o=>{let a=Td(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)),yd=gd(),Ft=yd;import{useEffect as xd,useState as Wn}from"react";var kt=e=>{let[t,o]=Wn(),[a,n]=Wn(),[i,l]=Wn(),r=()=>{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),l(e?.current?.getBoundingClientRect().height)}};return e.current&&!t&&r(),xd(()=>(typeof window<"u"&&window.addEventListener("resize",r),()=>{typeof window<"u"&&window.removeEventListener("resize",r)}),[]),{dropdownMaxHeight:t,dropdownWidth:a,mobileAnchor:i,resize:r}};var La="#################",Ma={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 Oa}from"@getpara/web-sdk";import{jsx as Oe,jsxs as Bt}from"react/jsx-runtime";var Od={label:"United States",value:"+1",selectedLabel:"US",icon:"US"},Na=({disableEmailLogin:e,disablePhoneLogin:t})=>{let o=Md(null),{dropdownMaxHeight:a,dropdownWidth:n}=kt(o),i=b(),l=V(N=>N.setAuthInfo),r=V(N=>N.getAuthInfo()),c=s(N=>N.setFlow),p=s(N=>N.setStep),d=s(N=>N.setSupportedAuthMethods),u=s(N=>N.setBiometricLocationHints),[A,m]=it(r?.authType==="phone"?r.auth.countryCode:"+1"),[f,S]=it(!r||["telegramUserId","farcasterUsername"].includes(r.authType)?"":r.authType!=="phone"?r.identifier:r.auth.phone),[y,D]=it(r&&(r.authType==="email"||r.authType==="phone")?r.authType:void 0),[W,E]=it(Od),[h,R]=it(!1),[C,L]=it(""),[T,g]=it(""),U=y==="email",x=y==="phone",P=!y,K=T?Ft.filter(N=>N.selectedLabel.toLowerCase().includes(T.toLowerCase())||N.label.toLowerCase().includes(T.toLowerCase())||N.value.toLowerCase().includes(T.toLowerCase())):Ft,M=N=>{g(N.detail)},ne=N=>{let Q=N.detail.value,te=!1,H=!1;if(!t){let de=Ft.find(De=>De.value===Q);if(de){m(de.value),E(de),D("phone"),S("");return}te=!U&&x?/\d+$/.test(Q):/\d\d\d+$/.test(Q)}e||(H=/\D.*$/.test(Q)),D(H?"email":te?"phone":void 0),S(Q)},ae=N=>{let Q=Ft.find(te=>te.selectedLabel===N.detail);m(Q.value),E(Q)},ce=async()=>{if(L(""),P){L("Please enter a valid email or phone number!");return}let N;if(U){if(!Qr.test(f)){L("Please enter a valid email!");return}if(await i.logout(),N={email:f},l(N),await i.checkIfUserExists({email:f})){let te=await i.initiateUserLoginV2(N),H=te.has(Oa.PASSKEY)?await i.getUserBiometricLocationHints():[];c("login"),p("BIOMETRIC_LOGIN"),d(te),u(H);return}await i.createUser(N),c("signUp"),p("VERIFICATIONS");return}if(x){await i.logout();let Q=!1;try{Q=await i.checkIfUserExistsByPhone({phone:f,countryCode:A})}catch{L("Please enter a valid phone number!");return}if(N={phone:f,countryCode:A},l(N),Q){let te=await i.initiateUserLoginV2(N),H=te.has(Oa.PASSKEY)?await i.getUserBiometricLocationHints():[];c("login"),p("BIOMETRIC_LOGIN"),d(te),u(H);return}await i.createUserByPhone(N),c("signUp"),p("VERIFICATIONS");return}},Y=async()=>{R(!0),await ce(),R(!1)};return e&&t?null:Oe("form",{onSubmit:async N=>{N.preventDefault(),await Y()},children:Bt(Ud,{ref:o,id:"authInput",placeholder:U||t?"Enter email":x||e?"Enter phone":"Enter email or phone",onCpslInput:ne,value:f,errorText:C,autofocus:!0,inputMode:"email",onKeyDown:async N=>N.key==="Enter"&&Y(),contrastText:!0,isPhone:x,mask:y==="phone"?Ma[W.selectedLabel]??La:void 0,enterkeyhint:"go",noAutoDisable:!0,disabled:h,"data-testid":"auth-input",children:[Bt(Nd,{slot:"start",children:[!e&&(P||U)&&Oe(_n,{"aria-label":"email",icon:"mail"}),!t&&P&&Oe(_n,{"aria-label":"phone",icon:"phone"}),x&&Bt(vd,{selectedValue:W.selectedLabel,onCpslSelectValueChange:ae,showFormattedSelectedItem:!0,autoWidth:!0,dropdownMaxHeight:a,anchorElId:"authInput",$width:n,showSearch:!0,searchPlaceholder:"Search Countries",onCpslSearchChange:M,"data-testid":"country-code-select",children:[W&&Bt(Dd,{slot:"selected-item",children:[Oe(Eo,{children:W.selectedLabel}),Oe(Eo,{children:W.value})]}),K.map(N=>Bt(bd,{slot:"items",value:N.selectedLabel,children:[Oe(Eo,{children:N.label}),Oe(Eo,{children:N.value})]},N.selectedLabel))]})]}),f&&Oe(wd,{slot:"end",size:"small",fullWidth:!0,disabled:h,onClick:Y,children:h?Oe(Ld,{size:16}):Oe(_n,{icon:"arrowNarrow"})})]},"email")})},Nd=Ht.div`
|
|
286
286
|
height: 100%;
|
|
287
287
|
display: flex;
|
|
288
288
|
align-items: center;
|
|
@@ -661,7 +661,7 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
661
661
|
--icon-color: var(--cpsl-color-text-secondary);
|
|
662
662
|
--width: 49px;
|
|
663
663
|
--height: auto;
|
|
664
|
-
`;var dt={LOGGIN_POLLING_DELAY_MS:5e3,POLLING_INTERVAL_MS:2e3,ANIMATION_DURATION:.15};import{create as vu}from"zustand";var Ni=e=>({updateState:t=>{e(t)}});var bu={EvmProvider:void 0,evmContext:void 0,SolanaProvider:void 0,solanaContext:void 0,CosmosProvider:void 0,cosmosContext:void 0,connectParaEvmWallet:void 0,connectParaCosmosWallet:void 0},se=vu(e=>({...bu,...Ni(e)}));var vi=()=>{let e=se(r=>r.connectParaEvmWallet),t=se(r=>r.EvmProvider),o=se(r=>r.evmContext),a=se(r=>r.connectParaCosmosWallet),n=se(r=>r.CosmosProvider),i=se(r=>r.cosmosContext);return async()=>{if(o&&t&&e)try{let{error:r}=await e();r&&console.warn("Failed to connect Para EVM wallet to Wagmi:",r)}catch(r){console.warn("Error calling connectParaEvmWallet:",r)}if(i&&n&&a)try{let{error:r}=await a();r&&console.warn("Failed to connect Para Cosmos wallet to Graz:",r)}catch(r){console.warn("Error calling connectParaCosmosWallet:",r)}}};import{Fragment as Gu,jsx as Di,jsxs as Vu}from"react/jsx-runtime";function Bu(e){return"hostApiKey"in e}var Hu={[fe.SOLANA]:_t.SOLANA,[fe.ATOM]:_t.COSMOS,[fe.CELO]:_t.CELO,[fe.POLYGON]:_t.POLYGON},Vn={SOLANA:fe.SOLANA,SOL:fe.SOLANA,ATOM:fe.ATOM,CELO:fe.CELO,POLYGON:fe.POLYGON,MATIC:fe.POLYGON,USDC:fe.USDC,ETH:fe.ETHEREUM,ETHEREUM:fe.ETHEREUM},Ui=Du(({onRampConfig:e,twoFactorAuthEnabled:t=!1,recoverySecretStepEnabled:o=!1,oAuthMethods:a,disableEmailLogin:n,disablePhoneLogin:i,onClose:l,onRampTestMode:r,loginTransitionOverride:c,createWalletOverride:p},d)=>{let u=b(),A=s(w=>w.step),m=s(w=>w.webAuthURLForLogin),f=s(w=>w.webAuthURLForCreate),S=s(w=>w.passwordUrlForLogin),y=s(w=>w.isLogin()),D=s(w=>w.popupWindow),W=s(w=>w.onRampConfig),E=s(w=>w.setStep),h=s(w=>w.setBiometricLocationHints),R=s(w=>w.setWebAuthURLForLogin),C=s(w=>w.setWebAuthURLForCreate),L=s(w=>w.setPopupWindow),T=s(w=>w.setIFrameUrl),g=s(w=>w.setPasswordUrlForLogin),U=s(w=>w.setSupportedAuthMethods),x=s(w=>w.setOnRampConfig),P=s(w=>w.accountAddFundTab),K=s(w=>w.setAccountAddFundTab),M=V(w=>w.setRecoveryShare),ne=Me(),ae=bi(),ce=bi(),[Y,N]=Pu(!1),Q=vi();Uu(d,()=>({handleModalClose(){Ue()}}),[]);let te=async()=>{if(!t)return!0;try{let{isSetup:w}=await u.check2FAStatus();return w}catch(w){return console.error("An error occurred while checking 2FA:",w),!1}};async function G(){let{isComplete:w,isError:I,needsWallet:H}=await u.waitForLoginAndSetup({popupWindow:D});if(L(void 0),I){ne();return}w&&(R(""),g(""),U(new Set),h(),H?E("AWAITING_WALLET_CREATION"):(await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")))}async function de(){await u.waitForAccountCreation()&&(C(""),T(""),E("AWAITING_WALLET_CREATION"))}Wt(()=>{if(A!=="AWAITING_WALLET_CREATION"||Y)return;async function w(){N(!0);let I,H;if(p){let q=await p(u),pe=(await u.fetchWallets()).filter(me=>!!me.address),ue={};for(let me of pe)ue[me.id]={...Fu(me),signer:""};u.setWallets(ue),I=q.recoverySecret,H=q.walletIds}else{let q=await u.waitForPasskeyAndCreateWallet();I=q.recoverySecret,H=q.walletIds}await u.setCurrentWalletIds(H),o&&M(I),N(!1),E(!I||!o?"WALLET_CREATION_DONE":"SECRET")}w()},[y,A]);async function De(){E("PASSWORD_CREATION")}async function pt(){typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS),je(f,"ParaPasskey","CREATE_PASSKEY"),E("AWAITING_BIOMETRIC_CREATION"))}Wt(()=>{if(m||S){if(c){async function w(){await c(u),R(""),g(""),h(),await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")}w();return}typeof window<"u"&&(ae.current=window.setTimeout(G,dt.LOGGIN_POLLING_DELAY_MS))}return()=>{typeof window<"u"&&window.clearTimeout(ae.current),u.exitLogin()}},[m,S,D]);let Ue=()=>{l()};return Wt(()=>{["BIOMETRIC_CREATION","AWAITING_BIOMETRIC_CREATION"].includes(A)||u.exitAccountCreation(),["BIOMETRIC_LOGIN","AWAITING_BIOMETRIC_LOGIN"].includes(A)||u.exitLogin(),["AWAITING_OAUTH","FARCASTER_OAUTH"].includes(A)||u.exitOAuth(),A==="PASSWORD_CREATION"&&typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS))},[A]),Wt(()=>{W||u.ctx.client.getOnRampConfig().then(w=>{let I;if(e){let{enabledFlows:H,network:q,asset:pe,providers:ue,testMode:me}=e,Ho=ue.find(ge=>Bu(ge));I={isBuyEnabled:!H||H.some(ge=>He[ge]===He.BUY),isReceiveEnabled:!H||H.some(ge=>He[ge]===He.RECEIVE),isWithdrawEnabled:!H||H.some(ge=>He[ge]===He.WITHDRAW),allowedAssets:q?{[_t[q]]:pe?[Vn[pe]]:!0}:pe?{[Hu[Vn[pe]]??_t.ETHEREUM]:[Vn[pe]]}:w.allowedAssets,assetInfo:w.assetInfo,providers:ue.map(({id:ge})=>ku[ge]),rampApiKey:Ho?.hostApiKey??w.rampApiKey,testMode:me??r}}else I={...w,testMode:r};x(I),P||K(I.isBuyEnabled?He.BUY:I.isReceiveEnabled?He.RECEIVE:I.isWithdrawEnabled?He.WITHDRAW:void 0)}).catch()},[]),Wt(()=>{W&&x({...W,testMode:r})},[r]),Wt(()=>()=>{u.exitLoops()},[]),Vu(Gu,{children:[Di(Ri,{oAuthMethods:a,twoFactorAuthEnabled:t,disableEmailLogin:n,disablePhoneLogin:i,onClose:Ue,createAccountWithPasskey:pt,createAccountWithPassword:De}),Di(Oi,{})]})});import{forwardRef as Fi,useEffect as be,useImperativeHandle as im,useRef as sm,useState as Fo}from"react";import{ParaEvent as Po}from"@getpara/web-sdk";import{useEffect as om,useState as Rt}from"react";import{createContext as $u,useMemo as Ku}from"react";import{jsx as Xu}from"react/jsx-runtime";var Yu={wallets:[],chains:[],chainId:void 0,username:void 0,avatar:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Mo=$u(Yu);function $n({children:e}){let t=[],o=[],l=()=>Promise.resolve(),r=()=>Promise.resolve({});return Xu(Mo.Provider,{value:Ku(()=>({wallets:t,chains:o,chainId:void 0,username:void 0,avatar:void 0,disconnect:l,switchChain:r}),[t,o,void 0,void 0,void 0,l,r]),children:e})}var Oo=(l=>(l.METAMASK="METAMASK",l.RAINBOW="RAINBOW",l.COINBASE="COINBASE",l.WALLETCONNECT="WALLETCONNECT",l.ZERION="ZERION",l.RABBY="RABBY",l))(Oo||{}),No=(a=>(a.PHANTOM="PHANTOM",a.GLOW="GLOW",a.BACKPACK="BACKPACK",a))(No||{}),vo=(o=>(o.KEPLR="KEPLR",o.LEAP="LEAP",o))(vo||{}),ew={...Oo,...No,...vo};import{createContext as zu,useMemo as Qu}from"react";import{jsx as Zu}from"react/jsx-runtime";var qu={wallets:[],disconnect:()=>Promise.resolve()},bo=zu(qu);function Kn({children:e}){let t=[],o=()=>Promise.resolve();return Zu(bo.Provider,{value:Qu(()=>({wallets:t,disconnect:o}),[t,o]),children:e})}import{createContext as Ju,useMemo as ju}from"react";import{jsx as tm}from"react/jsx-runtime";var em={wallets:[],chains:[],chainId:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Do=Ju(em);function Yn({children:e}){let t=[],o=[],n=()=>Promise.resolve(),i=()=>Promise.resolve({});return tm(Do.Provider,{value:ju(()=>({wallets:t,chains:o,chainId:void 0,disconnect:n,switchChain:i}),[t,o,void 0,n,i]),children:e})}import{jsx as Uo}from"react/jsx-runtime";var Pi=({children:e,wallets:t})=>{let o=b(),a=s(T=>T.resetState),n=V(T=>T.resetState),i=se(T=>T.EvmProvider),l=se(T=>T.evmContext),r=se(T=>T.SolanaProvider),c=se(T=>T.solanaContext),p=se(T=>T.CosmosProvider),d=se(T=>T.cosmosContext),[u,A]=Rt(null),[m,f]=Rt(null),[S,y]=Rt(null),[D,W]=Rt(null),[E,h]=Rt(null),[R,C]=Rt(null);om(()=>{(async()=>{let g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;if(!t?.length)g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;else for(let ne=0;ne<t.length;ne++){let ae=t[ne];if(ae in Oo){if(!i||!l)throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");g=l,U=i}if(ae in No){if(!r||!c)throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");x=c,P=r}if(ae in vo){if(!p||!d)throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");K=d,M=p}}f(g),A(()=>U),W(x),y(()=>P),C(K),h(()=>M)})()},[t,l,i,c,r,d,p]);let L=({address:T,error:g})=>{(g||!T)&&(a(),n())};return!o||!u||!S||!E?null:Uo(u,{para:o,onSwitchWallet:L,children:Uo(S,{para:o,onSwitchWallet:L,children:Uo(E,{para:o,onSwitchWallet:L,children:Uo(ra,{evmContext:m,solanaContext:D,cosmosContext:R,walletSort:t,children:e})})})})};import lm from"styled-components";import{jsx as ko}from"react/jsx-runtime";rm();var Xw=Fi(({para:e,isOpen:t,...o},a)=>{let[n,i]=Fo(!1),l=Z(d=>d.setClient),r=Z(d=>d.client),{closeModal:c,openModal:p}=qt();return be(()=>{r||l(e),i(!0)},[]),be(()=>{t||c(),t&&p()},[t]),n?ko(cm,{ref:a,para:e,...o}):null}),cm=Fi(({theme:e,appName:t,logo:o,disableEmailLogin:a=!1,disablePhoneLogin:n=!1,oAuthMethods:i,bareModal:l=!1,className:r,currentStepOverride:c,externalWallets:p,authLayout:d=["AUTH:FULL","EXTERNAL:FULL"],embeddedModal:u,onModalStepChange:A,hideWallets:m=!1,onClose:f,...S},y)=>{let D=sm(null),W=_(v=>v.updateState),E=s(v=>v.setWebAuthURLForLogin),h=s(v=>v.setWebAuthURLForCreate),R=s(v=>v.setBiometricLocationHints),C=s(v=>v.step),L=s(v=>v.setOnModalStepChange),T=s(v=>v.setStep),g=V(v=>v.setAuthInfo),U=s(v=>v.hasPreviousStep()),x=s(v=>v.setFlow),P=s(v=>v.setIsFullyLoggedIn),K=Me(),M=_(v=>v.setAuthLayout),ne=_(v=>v.authLayout),ae=s(v=>v.resetState),ce=V(v=>v.resetState),Y=V(v=>v.setRecoveryShare),{disconnectExternalWallet:N}=$(),{isOpen:Q,closeModal:te}=qt(),G=b(),{selectedWallet:de,setSelectedWallet:De}=Ce(),[pt,Ue]=Fo(!1),[w,I]=Fo(!1),[H,q]=Fo(!1);im(y,()=>({goBack(){K()},canGoBack(){return U},currentStep(){return C},handleModalClose(){D?.current?.handleModalClose()}}),[U,C]);let pe=async()=>{let v=await G.isFullyLoggedIn();switch(c?T(Ve[c.toUpperCase()]):v?(x("account"),T("ACCOUNT_MAIN"),P(!0)):(C!=="AUTH_MAIN"&&C!=="SECRET"&&(T("AUTH_MAIN"),x(),E(),h(),R()),await N(),De({id:void 0,type:void 0}),P(!1)),!0){case G.isEmail:g({email:G.getEmail()});break;case G.isPhone:{let{phone:Ge,countryCode:ki}=G.getPhone();g({phone:Ge,countryCode:ki})}break;case G.isFarcaster:g({farcasterUsername:G.getFarcasterUsername()});break;case G.isTelegram:g({telegramUserId:G.telegramUserId}),v||T("TELEGRAM_OAUTH");break}I(!0)};be(()=>{let v=d;!p?.length&&yn(d)&&(v=v.filter(Ge=>!Ge.includes("EXTERNAL"))),a&&n&&!i?.length&&Dt(d)&&(v=v.filter(Ge=>!Ge.includes("AUTH"))),JSON.stringify(ne)!==JSON.stringify(v)&&M(v)},[a,n,i,p,d]),be(()=>{L(A)},[A]),be(()=>{W({logo:o,appName:t,oAuthLogoVariant:e?.oAuthLogoVariant??"default",bareModal:l,embeddedModal:u,hideWallets:m})},[o,t,e?.oAuthLogoVariant,l,u,m]),be(()=>{e&&(am(e),W({isDark:e.mode==="dark",theme:e}))},[e]),be(()=>{G?(pe(),l&&Ue(!0)):console.error("A Para instance must be provided.")},[]),be(()=>{Q&&G&&pe()},[Q]);let ue=()=>{if(!de?.id||!G.findWallet(de?.id)){let v=G.findWallet(void 0,void 0,{forbidPregen:!0});De({id:v?.id,type:v?.type})}};be(()=>{ue()},[G]),be(()=>(typeof window<"u"&&window.addEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.addEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue),q(!0),()=>{typeof window<"u"&&window.removeEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.removeEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue)}),[]);let me=()=>{te(),f?.()},Ho=()=>{Ue(!0)},ge=async()=>{Ue(!1),Xn.includes(C)?(ae(),ce(),Y(null)):zn.includes(C)&&T("LOGIN_DONE"),G&&(await pe(),G.exitLoops()),I(!1)};if(!H)return null;if(!G)return console.error("A Para instance is required."),null;if(!ne?.length){let v=!p?.length&&yn(d),Ge=a&&n&&!i?.length&&Dt(d);return v||Ge?(v&&console.error("At least one external wallet must be provided if external wallet auth is enabled."),Ge&&console.error("At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled.")):console.error("At least one auth layout selection is required."),null}return ko(Pi,{wallets:p,children:ko(dm,{enterTransitionDuration:dt.ANIMATION_DURATION,exitTransitionDuration:dt.ANIMATION_DURATION,open:Q,onCpslModalExited:ge,onCpslModalEntering:Ho,onCpslModalRequestClose:me,noOverlay:l,className:r,"data-testid":"modal",$embeddedModal:u,children:pt&&(w&&u||!u)&&ko(Ui,{oAuthMethods:i,disableEmailLogin:a,disablePhoneLogin:n,onClose:me,...S})})})}),dm=lm(nm)`
|
|
664
|
+
`;var dt={LOGGIN_POLLING_DELAY_MS:5e3,POLLING_INTERVAL_MS:2e3,ANIMATION_DURATION:.15};import{create as vu}from"zustand";var Ni=e=>({updateState:t=>{e(t)}});var bu={EvmProvider:void 0,evmContext:void 0,SolanaProvider:void 0,solanaContext:void 0,CosmosProvider:void 0,cosmosContext:void 0,connectParaEvmWallet:void 0,connectParaCosmosWallet:void 0},se=vu(e=>({...bu,...Ni(e)}));var vi=()=>{let e=se(r=>r.connectParaEvmWallet),t=se(r=>r.EvmProvider),o=se(r=>r.evmContext),a=se(r=>r.connectParaCosmosWallet),n=se(r=>r.CosmosProvider),i=se(r=>r.cosmosContext);return async()=>{if(o&&t&&e)try{let{error:r}=await e();r&&console.warn("Failed to connect Para EVM wallet to Wagmi:",r)}catch(r){console.warn("Error calling connectParaEvmWallet:",r)}if(i&&n&&a)try{let{error:r}=await a();r&&console.warn("Failed to connect Para Cosmos wallet to Graz:",r)}catch(r){console.warn("Error calling connectParaCosmosWallet:",r)}}};import{Fragment as Gu,jsx as Di,jsxs as Vu}from"react/jsx-runtime";function Bu(e){return"hostApiKey"in e}var Hu={[fe.SOLANA]:_t.SOLANA,[fe.ATOM]:_t.COSMOS,[fe.CELO]:_t.CELO,[fe.POLYGON]:_t.POLYGON},Vn={SOLANA:fe.SOLANA,SOL:fe.SOLANA,ATOM:fe.ATOM,CELO:fe.CELO,POLYGON:fe.POLYGON,MATIC:fe.POLYGON,USDC:fe.USDC,ETH:fe.ETHEREUM,ETHEREUM:fe.ETHEREUM},Ui=Du(({onRampConfig:e,twoFactorAuthEnabled:t=!1,recoverySecretStepEnabled:o=!1,oAuthMethods:a,disableEmailLogin:n,disablePhoneLogin:i,onClose:l,onRampTestMode:r,loginTransitionOverride:c,createWalletOverride:p},d)=>{let u=b(),A=s(w=>w.step),m=s(w=>w.webAuthURLForLogin),f=s(w=>w.webAuthURLForCreate),S=s(w=>w.passwordUrlForLogin),y=s(w=>w.isLogin()),D=s(w=>w.popupWindow),W=s(w=>w.onRampConfig),E=s(w=>w.setStep),h=s(w=>w.setBiometricLocationHints),R=s(w=>w.setWebAuthURLForLogin),C=s(w=>w.setWebAuthURLForCreate),L=s(w=>w.setPopupWindow),T=s(w=>w.setIFrameUrl),g=s(w=>w.setPasswordUrlForLogin),U=s(w=>w.setSupportedAuthMethods),x=s(w=>w.setOnRampConfig),P=s(w=>w.accountAddFundTab),K=s(w=>w.setAccountAddFundTab),M=V(w=>w.setRecoveryShare),ne=Me(),ae=bi(),ce=bi(),[Y,N]=Pu(!1),Q=vi();Uu(d,()=>({handleModalClose(){Ue()}}),[]);let te=async()=>{if(!t)return!0;try{let{isSetup:w}=await u.check2FAStatus();return w}catch(w){return console.error("An error occurred while checking 2FA:",w),!1}};async function H(){let{isComplete:w,isError:I,needsWallet:B}=await u.waitForLoginAndSetup({popupWindow:D});if(L(void 0),I){ne();return}w&&(R(""),g(""),U(new Set),h(),B?E("AWAITING_WALLET_CREATION"):(await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")))}async function de(){await u.waitForAccountCreation()&&(C(""),T(""),E("AWAITING_WALLET_CREATION"))}Wt(()=>{if(A!=="AWAITING_WALLET_CREATION"||Y)return;async function w(){N(!0);let I,B;if(p){let q=await p(u),pe=(await u.fetchWallets()).filter(me=>!!me.address),ue={};for(let me of pe)ue[me.id]={...Fu(me),signer:""};u.setWallets(ue),I=q.recoverySecret,B=q.walletIds}else{let q=await u.waitForPasskeyAndCreateWallet();I=q.recoverySecret,B=q.walletIds}await u.setCurrentWalletIds(B),o&&M(I),N(!1),E(!I||!o?"WALLET_CREATION_DONE":"SECRET")}w()},[y,A]);async function De(){E("PASSWORD_CREATION")}async function pt(){typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS),je(f,"ParaPasskey","CREATE_PASSKEY"),E("AWAITING_BIOMETRIC_CREATION"))}Wt(()=>{if(m||S){if(c){async function w(){await c(u),R(""),g(""),h(),await Q(),await te()?E("LOGIN_DONE"):E("SETUP_2FA")}w();return}typeof window<"u"&&(ae.current=window.setTimeout(H,dt.LOGGIN_POLLING_DELAY_MS))}return()=>{typeof window<"u"&&window.clearTimeout(ae.current),u.exitLogin()}},[m,S,D]);let Ue=()=>{l()};return Wt(()=>{["BIOMETRIC_CREATION","AWAITING_BIOMETRIC_CREATION"].includes(A)||u.exitAccountCreation(),["BIOMETRIC_LOGIN","AWAITING_BIOMETRIC_LOGIN"].includes(A)||u.exitLogin(),["AWAITING_OAUTH","FARCASTER_OAUTH"].includes(A)||u.exitOAuth(),A==="PASSWORD_CREATION"&&typeof window<"u"&&(clearTimeout(ce.current),ce.current=window.setTimeout(de,dt.POLLING_INTERVAL_MS))},[A]),Wt(()=>{W||u.ctx.client.getOnRampConfig().then(w=>{let I;if(e){let{enabledFlows:B,network:q,asset:pe,providers:ue,testMode:me}=e,Ho=ue.find(ge=>Bu(ge));I={isBuyEnabled:!B||B.some(ge=>He[ge]===He.BUY),isReceiveEnabled:!B||B.some(ge=>He[ge]===He.RECEIVE),isWithdrawEnabled:!B||B.some(ge=>He[ge]===He.WITHDRAW),allowedAssets:q?{[_t[q]]:pe?[Vn[pe]]:!0}:pe?{[Hu[Vn[pe]]??_t.ETHEREUM]:[Vn[pe]]}:w.allowedAssets,assetInfo:w.assetInfo,providers:ue.map(({id:ge})=>ku[ge]),rampApiKey:Ho?.hostApiKey??w.rampApiKey,testMode:me??r}}else I={...w,testMode:r};x(I),P||K(I.isBuyEnabled?He.BUY:I.isReceiveEnabled?He.RECEIVE:I.isWithdrawEnabled?He.WITHDRAW:void 0)}).catch()},[]),Wt(()=>{W&&x({...W,testMode:r})},[r]),Wt(()=>()=>{u.exitLoops()},[]),Vu(Gu,{children:[Di(Ri,{oAuthMethods:a,twoFactorAuthEnabled:t,disableEmailLogin:n,disablePhoneLogin:i,onClose:Ue,createAccountWithPasskey:pt,createAccountWithPassword:De}),Di(Oi,{})]})});import{forwardRef as Fi,useEffect as be,useImperativeHandle as im,useRef as sm,useState as Fo}from"react";import{ParaEvent as Po}from"@getpara/web-sdk";import{useEffect as om,useState as Rt}from"react";import{createContext as $u,useMemo as Ku}from"react";import{jsx as Xu}from"react/jsx-runtime";var Yu={wallets:[],chains:[],chainId:void 0,username:void 0,avatar:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Mo=$u(Yu);function $n({children:e}){let t=[],o=[],l=()=>Promise.resolve(),r=()=>Promise.resolve({});return Xu(Mo.Provider,{value:Ku(()=>({wallets:t,chains:o,chainId:void 0,username:void 0,avatar:void 0,disconnect:l,switchChain:r}),[t,o,void 0,void 0,void 0,l,r]),children:e})}var Oo=(l=>(l.METAMASK="METAMASK",l.RAINBOW="RAINBOW",l.COINBASE="COINBASE",l.WALLETCONNECT="WALLETCONNECT",l.ZERION="ZERION",l.RABBY="RABBY",l))(Oo||{}),No=(a=>(a.PHANTOM="PHANTOM",a.GLOW="GLOW",a.BACKPACK="BACKPACK",a))(No||{}),vo=(o=>(o.KEPLR="KEPLR",o.LEAP="LEAP",o))(vo||{}),tw={...Oo,...No,...vo};import{createContext as zu,useMemo as Qu}from"react";import{jsx as Zu}from"react/jsx-runtime";var qu={wallets:[],disconnect:()=>Promise.resolve()},bo=zu(qu);function Kn({children:e}){let t=[],o=()=>Promise.resolve();return Zu(bo.Provider,{value:Qu(()=>({wallets:t,disconnect:o}),[t,o]),children:e})}import{createContext as Ju,useMemo as ju}from"react";import{jsx as tm}from"react/jsx-runtime";var em={wallets:[],chains:[],chainId:void 0,disconnect:()=>Promise.resolve(),switchChain:()=>Promise.resolve({})},Do=Ju(em);function Yn({children:e}){let t=[],o=[],n=()=>Promise.resolve(),i=()=>Promise.resolve({});return tm(Do.Provider,{value:ju(()=>({wallets:t,chains:o,chainId:void 0,disconnect:n,switchChain:i}),[t,o,void 0,n,i]),children:e})}import{jsx as Uo}from"react/jsx-runtime";var Pi=({children:e,wallets:t})=>{let o=b(),a=s(T=>T.resetState),n=V(T=>T.resetState),i=se(T=>T.EvmProvider),l=se(T=>T.evmContext),r=se(T=>T.SolanaProvider),c=se(T=>T.solanaContext),p=se(T=>T.CosmosProvider),d=se(T=>T.cosmosContext),[u,A]=Rt(null),[m,f]=Rt(null),[S,y]=Rt(null),[D,W]=Rt(null),[E,h]=Rt(null),[R,C]=Rt(null);om(()=>{(async()=>{let g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;if(!t?.length)g=Mo,U=$n,x=bo,P=Kn,K=Do,M=Yn;else for(let ne=0;ne<t.length;ne++){let ae=t[ne];if(ae in Oo){if(!i||!l)throw new Error("@getpara/evm-wallet-connectors is required to use an external EVM wallet.");g=l,U=i}if(ae in No){if(!r||!c)throw new Error("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");x=c,P=r}if(ae in vo){if(!p||!d)throw new Error("@getpara/cosmos-wallet-connectors is required to use an external Cosmos wallet.");K=d,M=p}}f(g),A(()=>U),W(x),y(()=>P),C(K),h(()=>M)})()},[t,l,i,c,r,d,p]);let L=({address:T,error:g})=>{(g||!T)&&(a(),n())};return!o||!u||!S||!E?null:Uo(u,{para:o,onSwitchWallet:L,children:Uo(S,{para:o,onSwitchWallet:L,children:Uo(E,{para:o,onSwitchWallet:L,children:Uo(ra,{evmContext:m,solanaContext:D,cosmosContext:R,walletSort:t,children:e})})})})};import lm from"styled-components";import{jsx as ko}from"react/jsx-runtime";rm();var zw=Fi(({para:e,isOpen:t,...o},a)=>{let[n,i]=Fo(!1),l=Z(d=>d.setClient),r=Z(d=>d.client),{closeModal:c,openModal:p}=qt();return be(()=>{r||l(e),i(!0)},[]),be(()=>{t||c(),t&&p()},[t]),n?ko(cm,{ref:a,para:e,...o}):null}),cm=Fi(({theme:e,appName:t,logo:o,disableEmailLogin:a=!1,disablePhoneLogin:n=!1,oAuthMethods:i,bareModal:l=!1,className:r,currentStepOverride:c,externalWallets:p,authLayout:d=["AUTH:FULL","EXTERNAL:FULL"],embeddedModal:u,onModalStepChange:A,hideWallets:m=!1,onClose:f,...S},y)=>{let D=sm(null),W=_(v=>v.updateState),E=s(v=>v.setWebAuthURLForLogin),h=s(v=>v.setWebAuthURLForCreate),R=s(v=>v.setBiometricLocationHints),C=s(v=>v.step),L=s(v=>v.setOnModalStepChange),T=s(v=>v.setStep),g=V(v=>v.setAuthInfo),U=s(v=>v.hasPreviousStep()),x=s(v=>v.setFlow),P=s(v=>v.setIsFullyLoggedIn),K=Me(),M=_(v=>v.setAuthLayout),ne=_(v=>v.authLayout),ae=s(v=>v.resetState),ce=V(v=>v.resetState),Y=V(v=>v.setRecoveryShare),{disconnectExternalWallet:N}=$(),{isOpen:Q,closeModal:te}=qt(),H=b(),{selectedWallet:de,setSelectedWallet:De}=Ce(),[pt,Ue]=Fo(!1),[w,I]=Fo(!1),[B,q]=Fo(!1);im(y,()=>({goBack(){K()},canGoBack(){return U},currentStep(){return C},handleModalClose(){D?.current?.handleModalClose()}}),[U,C]);let pe=async()=>{let v=await H.isFullyLoggedIn();switch(c?T(Ve[c.toUpperCase()]):v?(x("account"),T("ACCOUNT_MAIN"),P(!0)):(C!=="AUTH_MAIN"&&C!=="SECRET"&&(T("AUTH_MAIN"),x(),E(),h(),R()),await N(),De({id:void 0,type:void 0}),P(!1)),!0){case H.isEmail:g({email:H.getEmail()});break;case H.isPhone:{let{phone:Ge,countryCode:ki}=H.getPhone();g({phone:Ge,countryCode:ki})}break;case H.isFarcaster:g({farcasterUsername:H.getFarcasterUsername()});break;case H.isTelegram:g({telegramUserId:H.telegramUserId}),v||T("TELEGRAM_OAUTH");break}I(!0)};be(()=>{let v=d;!p?.length&&yn(d)&&(v=v.filter(Ge=>!Ge.includes("EXTERNAL"))),a&&n&&!i?.length&&Dt(d)&&(v=v.filter(Ge=>!Ge.includes("AUTH"))),JSON.stringify(ne)!==JSON.stringify(v)&&M(v)},[a,n,i,p,d]),be(()=>{L(A)},[A]),be(()=>{W({logo:o,appName:t,oAuthLogoVariant:e?.oAuthLogoVariant??"default",bareModal:l,embeddedModal:u,hideWallets:m})},[o,t,e?.oAuthLogoVariant,l,u,m]),be(()=>{e&&(am(e),W({isDark:e.mode==="dark",theme:e}))},[e]),be(()=>{H?(pe(),l&&Ue(!0)):console.error("A Para instance must be provided.")},[]),be(()=>{Q&&H&&pe()},[Q]);let ue=()=>{if(!de?.id||!H.findWallet(de?.id)){let v=H.findWallet(void 0,void 0,{forbidPregen:!0});De({id:v?.id,type:v?.type})}};be(()=>{ue()},[H]),be(()=>(typeof window<"u"&&window.addEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.addEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue),q(!0),()=>{typeof window<"u"&&window.removeEventListener(Po.WALLETS_CHANGE_EVENT,ue),typeof window<"u"&&window.removeEventListener(Po.EXTERNAL_WALLET_CHANGE_EVENT,ue)}),[]);let me=()=>{te(),f?.()},Ho=()=>{Ue(!0)},ge=async()=>{Ue(!1),Xn.includes(C)?(ae(),ce(),Y(null)):zn.includes(C)&&T("LOGIN_DONE"),H&&(await pe(),H.exitLoops()),I(!1)};if(!B)return null;if(!H)return console.error("A Para instance is required."),null;if(!ne?.length){let v=!p?.length&&yn(d),Ge=a&&n&&!i?.length&&Dt(d);return v||Ge?(v&&console.error("At least one external wallet must be provided if external wallet auth is enabled."),Ge&&console.error("At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled.")):console.error("At least one auth layout selection is required."),null}return ko(Pi,{wallets:p,children:ko(dm,{enterTransitionDuration:dt.ANIMATION_DURATION,exitTransitionDuration:dt.ANIMATION_DURATION,open:Q,onCpslModalExited:ge,onCpslModalEntering:Ho,onCpslModalRequestClose:me,noOverlay:l,className:r,"data-testid":"modal",$embeddedModal:u,children:pt&&(w&&u||!u)&&ko(Ui,{oAuthMethods:i,disableEmailLogin:a,disablePhoneLogin:n,onClose:me,...S})})})}),dm=lm(nm)`
|
|
665
665
|
${({$embeddedModal:e})=>e&&`
|
|
666
666
|
&::part(modal-body-card) {
|
|
667
667
|
--card-box-shadow: none;
|
|
@@ -672,4 +672,4 @@ Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,
|
|
|
672
672
|
--card-box-shadow: none;
|
|
673
673
|
--card-border-width: 0px;
|
|
674
674
|
};`}
|
|
675
|
-
`;var Bo=class extends Error{constructor(t){super(`On-ramp configuration error: ${t}.`),this.name="OnRampConfigError"}};function pm({providers:e}){if(!e||e.length<1)throw new Bo("No providers are configured")}function um({providers:e}){e.forEach((t,o)=>{if(e.findIndex(a=>a===t)!==o)throw new Bo(`Provider ${t} is configured more than once`)})}function
|
|
675
|
+
`;var Bo=class extends Error{constructor(t){super(`On-ramp configuration error: ${t}.`),this.name="OnRampConfigError"}};function pm({providers:e}){if(!e||e.length<1)throw new Bo("No providers are configured")}function um({providers:e}){e.forEach((t,o)=>{if(e.findIndex(a=>a===t)!==o)throw new Bo(`Provider ${t} is configured more than once`)})}function Zw(e){return e?(pm(e),um(e),!0):!1}export*from"@getpara/web-sdk";import mm from"@getpara/web-sdk";var dW=mm;export{jn as AuthLayout,vo as CosmosWallet,Oo as EvmWallet,tw as ExternalWallet,Ve as ModalStep,Cn as NETWORKS,fn as ON_RAMP_ASSETS,mn as ON_RAMP_PROVIDERS,Bo as OnRampConfigError,zw as ParaModal,cl as ParaProvider,Hr as SaveRecoverySecret,No as SolanaWallet,dW as default,Yl as getAssetIcon,Kl as getAssetName,LS as getClient,MS as getIsOpen,$l as getNetworkIcon,bt as getNetworkName,OS as getSelectedWalletId,NS as getSelectedWalletType,je as openPopup,en as useAccount,$s as useCheckIfUserExists,G as useClient,Gs as useCreateUser,se as useExternalWalletProviderStore,Ys as useInitiateLogin,on as useKeepSessionAlive,tn as useLogout,qt as useModal,Zs as useSignMessage,js as useSignTransaction,Ps as useWaitForAccountCreation,bs as useWaitForLoginAndSetup,Bs as useWaitForPasskeyAndCreateWallet,Nt as useWallet,Ce as useWalletState,Zw as validateOnRampConfig};
|
package/dist/index.js.br
CHANGED
|
Binary file
|
package/dist/index.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,16 +12,17 @@
|
|
|
12
12
|
"*.css"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getpara/react-common": "1.
|
|
16
|
-
"@getpara/react-components": "1.
|
|
17
|
-
"@getpara/web-sdk": "1.
|
|
15
|
+
"@getpara/react-common": "1.4.0",
|
|
16
|
+
"@getpara/react-components": "1.4.0",
|
|
17
|
+
"@getpara/web-sdk": "1.4.0",
|
|
18
18
|
"@tanstack/react-query": "^5.0.0",
|
|
19
19
|
"date-fns": "^3.6.0",
|
|
20
20
|
"detect-browser": "^5.3.0",
|
|
21
21
|
"framer-motion": "11.3.28",
|
|
22
22
|
"libphonenumber-js": "^1.11.1",
|
|
23
23
|
"styled-components": "^6.1.8",
|
|
24
|
-
"zustand": "^4.5.2"
|
|
24
|
+
"zustand": "^4.5.2",
|
|
25
|
+
"zustand-sync-tabs": "^0.2.2"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"post-build": "./scripts/post-build.sh",
|
|
@@ -49,5 +50,5 @@
|
|
|
49
50
|
"resolutions": {
|
|
50
51
|
"styled-components": "^6"
|
|
51
52
|
},
|
|
52
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b7610939d5a0121729be24c38d418eb45760258a"
|
|
53
54
|
}
|