@getpara/react-sdk 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MoonPayEmbed-GAWXP6V7.js +2 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.br +0 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.gz +0 -0
- package/dist/index.js +675 -5
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/package.json +8 -7
- package/dist/modal/ParaModal.js +0 -281
- package/dist/modal/components/Account/Account.js +0 -60
- package/dist/modal/components/AddFunds/AddFunds.js +0 -147
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
- package/dist/modal/components/AddFunds/index.js +0 -3
- package/dist/modal/components/AuthInput/AuthInput.js +0 -221
- package/dist/modal/components/AuthInput/countryCodes.js +0 -40
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
- package/dist/modal/components/Body/Body.js +0 -232
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
- package/dist/modal/components/ChainSwitch/config.js +0 -11
- package/dist/modal/components/Controls/Controls.js +0 -54
- package/dist/modal/components/Controls/Selects.js +0 -159
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
- package/dist/modal/components/ExternalWalletStep/config.js +0 -11
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
- package/dist/modal/components/Footer/Footer.js +0 -71
- package/dist/modal/components/Header/Header.js +0 -24
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
- package/dist/modal/components/Hero/Hero.js +0 -119
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
- package/dist/modal/components/ModalContent/ModalContent.js +0 -282
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
- package/dist/modal/components/OAuth/OAuth.js +0 -125
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
- package/dist/modal/components/Waiting/Waiting.js +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
- package/dist/modal/components/WalletCard/WalletCard.js +0 -93
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
- package/dist/modal/components/common.js +0 -67
- package/dist/modal/components/index.js +0 -1
- package/dist/modal/constants/constants.js +0 -93
- package/dist/modal/constants/defaults.js +0 -5
- package/dist/modal/constants/oAuthLogos.js +0 -18
- package/dist/modal/hooks/useActiveWallet.js +0 -11
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
- package/dist/modal/hooks/useGoBack.js +0 -34
- package/dist/modal/index.js +0 -9
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
- package/dist/modal/providers/ExternalWalletContext.js +0 -253
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
- package/dist/modal/stores/index.js +0 -3
- package/dist/modal/stores/modal/actions.js +0 -64
- package/dist/modal/stores/modal/useModalStore.js +0 -41
- package/dist/modal/stores/para/actions.js +0 -5
- package/dist/modal/stores/para/useParaStore.js +0 -3
- package/dist/modal/stores/theme/actions.js +0 -24
- package/dist/modal/stores/theme/useThemeStore.js +0 -14
- package/dist/modal/stores/userInfo/actions.js +0 -34
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -21
- package/dist/modal/types/modalProps.js +0 -7
- package/dist/modal/utils/authLayoutHelpers.js +0 -2
- package/dist/modal/utils/getMailtoLink.js +0 -5
- package/dist/modal/utils/getTileButtonFlex.js +0 -15
- package/dist/modal/utils/isPasskeySupported.js +0 -10
- package/dist/modal/utils/openPopup.js +0 -55
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
- package/dist/modal/utils/steps.js +0 -215
- package/dist/modal/utils/stringFormatters.js +0 -12
- package/dist/modal/utils/validateOnRampConfig.js +0 -26
- package/dist/provider/ParaProvider.js +0 -17
- package/dist/provider/actions/checkIfUserExists.js +0 -26
- package/dist/provider/actions/createUser.js +0 -30
- package/dist/provider/actions/getAccount.js +0 -24
- package/dist/provider/actions/getWallet.js +0 -16
- package/dist/provider/actions/initiateLogin.js +0 -23
- package/dist/provider/actions/keepSessionAlive.js +0 -23
- package/dist/provider/actions/logout.js +0 -20
- package/dist/provider/actions/signMessage.js +0 -23
- package/dist/provider/actions/signTransaction.js +0 -23
- package/dist/provider/actions/waitForAccountCreation.js +0 -24
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
- package/dist/provider/hooks/index.js +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -10
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
- package/dist/provider/hooks/mutations/useLogout.js +0 -33
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -2
- package/dist/provider/hooks/queries/useAccount.js +0 -23
- package/dist/provider/hooks/queries/useWallet.js +0 -24
- package/dist/provider/hooks/utils/index.js +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
- package/dist/provider/hooks/utils/useClient.js +0 -8
- package/dist/provider/hooks/utils/useEventListeners.js +0 -87
- package/dist/provider/hooks/utils/useInternalClient.js +0 -9
- package/dist/provider/hooks/utils/useModal.js +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -3
- package/dist/provider/stores/getters.js +0 -5
- package/dist/provider/stores/slices/client.js +0 -4
- package/dist/provider/stores/slices/index.js +0 -3
- package/dist/provider/stores/slices/modal.js +0 -4
- package/dist/provider/stores/slices/wallet.js +0 -6
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -14
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/renameMutations.js +0 -19
- /package/dist/{modal/css → css}/modal.css +0 -0
- /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,675 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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:"@CAPSULE/modalState",storage:Gi(()=>sessionStorage),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
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
`,Se=Ae.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
width: 286px;
|
|
11
|
+
height: 286px;
|
|
12
|
+
`,tr=Ae.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
`,or=Ae.div`
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 4px;
|
|
20
|
+
|
|
21
|
+
cpsl-icon {
|
|
22
|
+
--height: 20px;
|
|
23
|
+
--width: 20px;
|
|
24
|
+
}
|
|
25
|
+
`,Mt=Ae(zi)`
|
|
26
|
+
--container-border-color: var(--cpsl-color-input-border-placeholder);
|
|
27
|
+
--container-background-color: var(--cpsl-color-background-0);
|
|
28
|
+
--input-background-color: transparent;
|
|
29
|
+
--input-font-weight: 500;
|
|
30
|
+
--input-color: var(--cpsl-color-text-secondary);
|
|
31
|
+
`,km=Ae(Mt)`
|
|
32
|
+
width: 100%;
|
|
33
|
+
`,ie=Ae(Qi)`
|
|
34
|
+
width: 100%;
|
|
35
|
+
text-align: center;
|
|
36
|
+
`,O=Ae.div`
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
align-self: center;
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
`,F=Ae(O)`
|
|
45
|
+
gap: ${({$wide:e})=>e?"32px":"24px"};
|
|
46
|
+
`,X=Ae(ie)``,$e=Ae(qi)`
|
|
47
|
+
--button-width: 100%;
|
|
48
|
+
--button-height: 87px;
|
|
49
|
+
--button-icon-height: 32px;
|
|
50
|
+
--button-icon-width: 32px;
|
|
51
|
+
`,Ke=Ae(Xi)`
|
|
52
|
+
--height: 80px;
|
|
53
|
+
--width: 80px;
|
|
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(()=>sessionStorage),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
|
+
align-self: center;
|
|
57
|
+
`,Yt=Qo(rs)`
|
|
58
|
+
text-align: center;
|
|
59
|
+
display: inline-block;
|
|
60
|
+
`,ss=Qo(Yt)`
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
display: inline-block;
|
|
63
|
+
`;import{CpslButton as sr,CpslDivider as ds,CpslIcon as ps}from"@getpara/react-components";import{useEffect as us,useMemo as ms,useState as Cs}from"react";function je(e,t,o){if(typeof window>"u")return;let a=560,n;switch(o){case"LOGIN_PASSWORD":{n=460;break}case"LOGIN_PASSKEY":{n=798;break}case"CREATE_PASSWORD":{n=400;break}case"CREATE_PASSKEY":{n=464;break}case"TRANSACTION_REVIEW":{n=480;break}case"OAUTH":default:{n=768;break}}let i=window.screenLeft!==void 0?window.screenLeft:window.screenX,l=window.screenTop!==void 0?window.screenTop:window.screenY,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,c=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,p=(r-a)/2+i,d=(c-n)/2+l,u=`toolbar=no, menubar=no, width=${a},
|
|
64
|
+
height=${n}, top=${d}, left=${p}`,A=window.open(e,t,u);return A||setTimeout(()=>{A=window.open(e,"_blank")},0),A}import fs from"styled-components";import{AuthMethod as St,getPublicKeyHex as zt}from"@getpara/web-sdk";import{detect as cs}from"detect-browser";var Xt=()=>{switch(cs().os){case"linux":case"Chrome OS":return!1}return!0};import{formatBiometricHints as As,KnownDevices as Ss,UserIdentifier as Es}from"@getpara/react-common";import{Fragment as qo,jsx as Pe,jsxs as Et}from"react/jsx-runtime";var lr=()=>{let e=s(E=>E.popupWindow),t=s(E=>E.supportedAuthMethods),o=s(E=>E.passwordUrlForLogin),a=s(E=>E.webAuthURLForLogin),n=s(E=>E.setStep),i=s(E=>E.setPopupWindow),l=s(E=>E.biometricLocationHints),r=b(),c=V(E=>E.getAuthInfo()),p=s(E=>E.setWebAuthURLForLogin),d=s(E=>E.setPasswordUrlForLogin),u=Xt(),A=ms(()=>As(l),[l]),m=s(E=>E.setSupportedAuthMethods),[f,S]=Cs();us(()=>{async function E(){if(!t?.size&&r.getUserId()){let x=await r.supportedAuthMethods({userId:r.getUserId()});x?.size&&m(x);return}if(!r.isEmail&&!r.isPhone&&!r.isFarcaster&&!r.isTelegram||!r.loginEncryptionKeyPair)return;let h=r.isEmail?"email":r.isPhone?"phone":r.isFarcaster?"farcaster":"telegram",R=await r.touchSession(),C=t?.has&&t.has(St.PASSKEY)?await r.getWebAuthURLForLogin({sessionId:R.data.sessionId,loginEncryptionPublicKey:zt(r.loginEncryptionKeyPair),partnerId:R.data.partnerId,authType:h,displayName:c.displayName,pfpUrl:c.pfpUrl}):void 0,L=t?.has&&t.has(St.PASSKEY)?await r.getWebAuthURLForLogin({sessionId:R.data.sessionId,loginEncryptionPublicKey:zt(r.loginEncryptionKeyPair),partnerId:R.data.partnerId,newDeviceSessionId:R.data.sessionLookupId,newDeviceEncryptionKey:zt(r.loginEncryptionKeyPair),authType:h,displayName:c.displayName,pfpUrl:c.pfpUrl}):void 0,T=t?.has&&t.has(St.PASSWORD)?await r.getPasswordURLForLogin({sessionId:R.data.sessionId,loginEncryptionPublicKey:zt(r.loginEncryptionKeyPair),partnerId:R.data.partnerId,authType:h,displayName:c.displayName,pfpUrl:c.pfpUrl}):void 0,g=C?await r.shortenLoginLink(C):void 0,U=L?await r.shortenLoginLink(L):void 0;S(U),p(g),d(T)}E()},[t,r]);let y=()=>{if(e)return;let E=je(a,"ParaPasskey","LOGIN_PASSKEY");i(E),n("AWAITING_BIOMETRIC_LOGIN")},D=()=>{let E=je(o,"ParaPassword","LOGIN_PASSWORD");i(E),n("AWAITING_PASSWORD_LOGIN")};function W(){return!l?.length||u&&A.isOnKnownDevice||t?.has&&t.has(St.PASSWORD)}return Et(F,{$wide:!0,children:[Et(O,{children:[W()&&Pe(X,{variant:"headingS",weight:"bold",children:"Welcome back,"}),Pe(Es,{...c})]}),Et(Is,{children:[t?.has&&t.has(St.PASSWORD)&&o&&Pe(hs,{handlePasswordClick:D}),t?.has&&t.has(St.PASSKEY)&&a&&f&&Pe(Ts,{handlePasskeyClick:y,formattedHints:A,shortLoginLink:f,passkeysSupported:u,biometricLocationHints:l})]})]})},hs=({handlePasswordClick:e})=>Pe(sr,{fullWidth:!0,onClick:e,children:"Login"}),Ts=({handlePasskeyClick:e,formattedHints:t,shortLoginLink:o,passkeysSupported:a,biometricLocationHints:n=[]})=>{let[i,l]=[n.length>0,t.isOnKnownDevice];return Et(qo,{children:[(i&&!l||!a)&&Pe(Ss,{hints:t,link:o}),a&&Et(qo,{children:[i&&!l&&Pe(ds,{children:"or"}),Pe(sr,{fullWidth:!0,onClick:e,children:!i||l?Et(qo,{children:[Pe(ps,{slot:"start",icon:"key"}),"Login with passkey"]}):"Continue anyway"})]})]})},Is=fs(O)`
|
|
65
|
+
gap: 16px;
|
|
66
|
+
`;import{CpslButton as jo,CpslCodeInput as gs,CpslDivider as ys,CpslIcon as xs,CpslQrCode as ws,CpslSpinner as cr,CpslText as dr}from"@getpara/react-components";import{useEffect as Zo,useRef as Ws,useState as Qt}from"react";import{styled as pr}from"styled-components";import{useCopyToClipboard as _s}from"@getpara/react-common";import{Fragment as Jo,jsx as oe,jsxs as Ot}from"react/jsx-runtime";var ur=({onClose:e})=>{let t=s(L=>L.isLogin()),o=s(L=>L.setStep),a=b(),n=s(L=>L.step==="VERIFY_2FA"),[i,l]=_s(),r=Ws(null),[c,p]=Qt(null),[d,u]=Qt(""),[A,m]=Qt(""),[f,S]=Qt(!1),D=(c?new URL(c).searchParams:void 0)?.get("secret");Zo(()=>{async function L(){try{let{uri:T}=await a.setup2FA();p(T)}catch(T){console.error("Error fetching OTPAuth URL:",T)}}L()},[]),Zo(()=>{setTimeout(()=>{r?.current?.shadowRoot.querySelectorAll("input")?.[0]?.focus()},10)},[n]),Zo(()=>{d.length===6&&R()},[d]);let W=()=>{o("VERIFY_2FA")},E=()=>{t?o("LOGIN_DONE"):e()},h=L=>{A&&m(""),u(L.detail.value.trim())},R=async()=>{if(S(!0),d.length===6&&/^\d+$/.test(d))try{await a.enable2FA({verificationCode:d}),o("TWO_FACTOR_DONE")}catch{m("Incorrect Code")}else m("Incorrect Code");S(!1)};return Ot(F,{children:[Ot(O,{children:[oe(X,{variant:"headingS",weight:"bold",children:"Turn on Two-Factor authentication"}),n&&oe(dr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Please enter the code from your authenticator app."})]}),oe(O,{children:n?oe(Jo,{children:f?oe(cr,{}):oe("form",{onSubmit:async L=>{L.preventDefault(),await R()},children:oe(Rs,{ref:r,code:d,onCpslInput:h,errorText:A,length:6,onKeyDown:async L=>L.key==="Enter"&&await R()})})}):Ot(Jo,{children:[oe(dr,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan with your preferred authenticator app."}),oe(Se,{children:c?oe(ws,{url:c}):oe(cr,{size:100})})]})}),!n&&Ot(Jo,{children:[oe(O,{children:oe(ys,{children:"or enter the code manually"})}),oe(O,{children:oe(Mt,{disabled:!0,value:D,noAutoDisable:!0,children:oe(jo,{slot:"end",variant:"ghost",onClick:()=>{l(D)},children:oe(xs,{icon:i?"check":"copy"})})})}),Ot(O,{children:[oe(jo,{fullWidth:!0,onClick:W,children:"Continue"}),oe(Ls,{variant:"ghost",onClick:E,children:"Skip"})]})]})]})},Rs=pr(gs)`
|
|
67
|
+
align-self: center;
|
|
68
|
+
`,Ls=pr(jo)`
|
|
69
|
+
margin-top: 8px;
|
|
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`
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 8px;
|
|
75
|
+
width: 100%;
|
|
76
|
+
`,ul=ht.div`
|
|
77
|
+
width: 100%;
|
|
78
|
+
padding: 24px;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: 16px;
|
|
83
|
+
background-color: var(--cpsl-color-background-8);
|
|
84
|
+
border-radius: 16px;
|
|
85
|
+
`,ml=ht.div`
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: flex-start;
|
|
88
|
+
gap: 4px;
|
|
89
|
+
align-items: center;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
`,Cl=ht.div`
|
|
92
|
+
flex: 1;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 4px;
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
`,_r=ht(Rr)`
|
|
100
|
+
width: 100%;
|
|
101
|
+
&::part(text-element) {
|
|
102
|
+
line-height: 100%;
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
}
|
|
107
|
+
`,fl=ht(dl)`
|
|
108
|
+
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
109
|
+
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
110
|
+
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
111
|
+
--button-primary-hover-color: var(--cpsl-color-text-contrast);
|
|
112
|
+
--button-primary-active-color: var(--cpsl-color-text-contrast);
|
|
113
|
+
--button-padding-start: 8px;
|
|
114
|
+
--button-padding-end: 8px;
|
|
115
|
+
--button-padding-top: 8px;
|
|
116
|
+
--button-padding-bottom: 8px;
|
|
117
|
+
--button-border-radius: 8px;
|
|
118
|
+
`;import{jsx as vt,jsxs as Sl}from"react/jsx-runtime";var Nr=({onClose:e})=>{let t=b(),o=_(a=>a.hideWallets);return Al(()=>{setTimeout(()=>{e()},1600)},[]),Sl(F,{children:[vt(Ke,{icon:"checkCircleFilled"}),vt(X,{variant:"headingS",weight:"bold",children:"Connected"}),!o&&vt(Jt,{children:t.isUsingExternalWallet()?vt(Mr,{address:t.currentExternalWalletAddresses?.[0]}):t.currentWalletIdsArray.map(([a,n])=>vt(Zt,{id:a,type:n},`${a}-${n}`))})]})};import{EnabledFlow as Ro}from"@getpara/web-sdk";import{CpslSpinner as El,CpslText as hl}from"@getpara/react-components";import{jsx as jt,jsxs as vr}from"react/jsx-runtime";var Ye=({heading:e,subheading:t})=>vr(F,{$wide:!0,children:[jt(er,{children:jt(El,{size:100})}),vr(O,{children:[jt(X,{variant:"headingS",weight:"bold",children:e}),jt(hl,{variant:"bodyS",color:"secondary",weight:"medium",children:t})]})]});import{jsx as Tl}from"react/jsx-runtime";var br=()=>{let e=s(t=>t.isLogin());return Tl(Ye,{heading:e?"Waiting for Passkey":"Creating Passkey",subheading:"Follow the prompts presented by your browser."})};import{CpslIcon as Il,CpslInfoBox as gl,CpslText as Dr}from"@getpara/react-components";import{useEffect as yl,useRef as xl,useState as wl}from"react";import{jsx as eo,jsxs as to}from"react/jsx-runtime";var Ur=()=>{let e=_(n=>n.hideWallets),[t,o]=wl(!1),a=xl();return yl(()=>(typeof window<"u"&&(a.current=window.setTimeout(()=>{o(!0)},4e3)),()=>clearTimeout(a.current)),[]),to(F,{$wide:!0,children:[eo(Ye,{heading:e?"Creating Your Account":"Creating Your Wallet",subheading:"This should only take a couple of seconds."}),t&&eo(gl,{children:to(tr,{children:[to(or,{children:[eo(Il,{icon:"clock"}),eo(Dr,{weight:"medium",children:"Hang on"})]}),to(Dr,{variant:"bodyS",weight:"medium",color:"secondary",children:["Creating your ",e?"account":"wallet"," is taking a little longer than expected, but we're working on it!"]})]})})]})};import{CpslButton as Wl,CpslText as _l}from"@getpara/react-components";import Rl from"styled-components";import{Fragment as Ml,jsx as tt,jsxs as Pr}from"react/jsx-runtime";var Fr=({twoFactorAuthEnabled:e,onClose:t})=>{let o=_(p=>p.hideWallets),a=s(p=>p.setStep),n=s(p=>p.isLogin()),i=s(p=>p.onRampConfig),l=b(),r=i?.isBuyEnabled||i?.isReceiveEnabled||i?.isWithdrawEnabled,c=async()=>{if(n){if(!e){a("LOGIN_DONE");return}let p=await l.check2FAStatus();a(p?"LOGIN_DONE":"SETUP_2FA")}else e?a("SETUP_2FA"):t()};return Pr(F,{$wide:!0,children:[tt(Ll,{children:o?Pr(Ml,{children:[tt(Ke,{icon:"checkCircleFilled"}),tt(_l,{variant:"bodyM",color:"secondary",weight:"medium",style:{marginTop:"16px"},children:"Your account has been created."})]}):tt(Jt,{children:l.currentWalletIdsArray.map(([p,d])=>tt(Zt,{id:p,type:d,showAddFunds:r},p))})}),tt(O,{children:tt(Wl,{fullWidth:!0,onClick:c,children:e?"Continue":"Done"})})]})},Ll=Rl(O)`
|
|
119
|
+
min-height: 196px;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
`;import{CpslButton as Ol,CpslText as oo}from"@getpara/react-components";import{styled as an}from"styled-components";import{useCopyToClipboard as Nl}from"@getpara/react-common";function kr(e,t){let o=`Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${t}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;return`mailto:${e}?subject=Para%20Recovery%20Secret&body=${o}`}import{useState as vl}from"react";import{Fragment as Dl,jsx as he,jsxs as Tt}from"react/jsx-runtime";var Hr=({email:e,value:t,onComplete:o})=>{let[a,n]=vl(!1),[i,l]=Nl();return Tt(Dl,{children:[Tt(O,{children:[he(X,{variant:"headingXS",weight:"semiBold",children:"Save your Recovery Secret"}),Tt(bl,{children:[he(rn,{icon:"download",onClick:()=>{let d=document.createElement("a"),u=new Blob([t],{type:"text/plain"});d.href=URL.createObjectURL(u),d.download="recovery.txt",document.body.appendChild(d),d.click(),n(!0)},children:he(oo,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Download"})}),he(rn,{icon:i?"check":"copy",onClick:()=>{l(t),n(!0)},children:he(oo,{variant:"bodyXS",color:"secondary",weight:"medium",children:i?"Copied!":"Copy"})}),he(rn,{icon:"send",onClick:()=>{typeof window<"u"&&window.open(kr(e,t),"_self"),n(!0)},children:he(oo,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Email"})})]})]}),he(O,{children:he(Ol,{fullWidth:!0,onClick:o,disabled:!a,children:a?"I\u2019ve saved my recovery secret":"Choose an option above to continue"})})]})},Gr=()=>{let e=_(l=>l.hideWallets),t=s(l=>l.setStep),o=V(l=>l.getAuthInfo()),a=V(l=>l.recoveryShare),n=JSON.parse(a||"{}").backupDecryptionKey,i=async()=>{t("WALLET_CREATION_DONE")};return Tt(F,{children:[Tt(O,{children:[he(X,{variant:"headingS",weight:"bold",children:e?"Don't lose access":"Don't lose your wallet"}),Tt(Br,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your"," ",he(Br,{variant:"bodyS",weight:"medium",children:"Recovery Secret"})," ","ensures you will be able to regain access to your ",e?"account":"wallet"," if you lose your Passkey or Password."]})]}),he(Hr,{email:o?.authType==="email"?o.identifier:void 0,value:n,onComplete:i})]})},rn=an($e)`
|
|
122
|
+
flex: 1;
|
|
123
|
+
|
|
124
|
+
--button-icon-color: var(--cpsl-color-text-primary);
|
|
125
|
+
`,bl=an.div`
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
width: 100%;
|
|
131
|
+
`,Br=an(oo)`
|
|
132
|
+
text-align: center;
|
|
133
|
+
display: inline-block;
|
|
134
|
+
`;import{CpslButton as Ul,CpslText as Pl}from"@getpara/react-components";import{jsx as sn,jsxs as ln}from"react/jsx-runtime";var Vr=({onClose:e})=>{let t=_(o=>o.hideWallets);return ln(F,{children:[sn(Ke,{icon:"checkCircleFilled"}),ln(O,{children:[sn(X,{variant:"headingXS",weight:"semiBold",children:"Success"}),ln(Pl,{variant:"bodyS",color:"secondary",weight:"medium",children:["Your ",t?"account":"wallet"," is now protected by 2FA"]})]}),sn(Ul,{fullWidth:!0,onClick:e,children:"Done"})]})};import{CpslButton as cn,CpslDivider as Fl,CpslIcon as dn,CpslQrCode as kl,CpslSpinner as Bl,CpslText as $r}from"@getpara/react-components";import{useCopyToClipboard as Hl,UserIdentifier as Gl}from"@getpara/react-common";import{Fragment as Kr,jsx as xe,jsxs as Xe}from"react/jsx-runtime";var Yr=({handlePasswordClick:e,handlePasskeyClick:t})=>{let o=s(p=>p.webAuthURLForCreate),a=s(p=>p.iFrameUrl),n=V(p=>p.getAuthInfo()),[i,l]=Hl(),r=()=>{l(o)},c=!!o&&!!a;return Xe(F,{$wide:!0,children:[Xe(O,{children:[xe(X,{variant:"headingS",weight:"bold",children:c?"Secure Your Account":"Create Passkey"}),xe(Gl,{...n}),xe($r,{variant:"bodyS",color:"secondary",weight:"medium",children:c?"Choose a password or set up a passkey":"Your Passkey keeps your account safe."})]}),Xe(O,{children:[Xt()?Xe(cn,{fullWidth:!0,onClick:t,children:[xe(dn,{slot:"start",icon:"key"}),c?"Create Passkey":"Create"]}):Xe(Kr,{children:[xe($r,{weight:"semiBold",children:"Scan with your mobile device"}),xe(Se,{children:o?xe(kl,{url:o}):xe(Bl,{size:100})}),Xe(cn,{size:"small",variant:"ghost",onClick:r,children:[xe(dn,{slot:"start",icon:i?"check":"copy"}),i?"Copied":"Copy Link"]})]}),c&&Xe(Kr,{children:[xe(Fl,{children:"or"}),Xe(cn,{fullWidth:!0,onClick:e,children:[xe(dn,{slot:"start",icon:"passcode"}),"Choose Password"]})]})]})]})};import{jsx as Vl}from"react/jsx-runtime";var Xr=()=>Vl(Ye,{heading:"Complete Login",subheading:"Follow the prompts presented by your browser."});import{EnabledFlow as rt,getOnRampAssets as pc,getOnRampNetworks as uc,OnRampProvider as mc,OnRampPurchaseType as lo,toAssetInfoArray as Cc,WalletType as An}from"@getpara/web-sdk";import{CpslButton as fc,CpslDivider as Ac,CpslIcon as ia,CpslIdenticon as Sc,CpslQrCode as Ec,CpslSpinner as sa,CpslTab as hc,CpslTabs as Tc,CpslText as da}from"@getpara/react-components";import{useEffect as Sn,useMemo as la}from"react";import{useState as Xl}from"react";import{Network as Re,OnRampAsset as Le,OnRampMethod as Fe,OnRampProvider as pn}from"@getpara/core-sdk";var un="https://connect.getpara.com/",zr="https://getpara.com/terms",mn={[pn.STRIPE]:{name:"Stripe",feeLower:.99,feeUpper:4.49,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"stripeBrand",backgroundColors:["#6772E5","#808AF4"]},[pn.RAMP]:{name:"Ramp",feeLower:.99,feeUpper:4.49,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"rampNetworkBrand",backgroundColors:["#21BF73","#3AE492"]},[pn.MOONPAY]:{name:"MoonPay",feeLower:1,feeUpper:4.5,methods:[Fe.ACH,Fe.DEBIT,Fe.CREDIT],icon:"moonpayBrand",backgroundColors:["#7715F5","#9647fd"]}},Cn={[Re.ETHEREUM]:{name:"Ethereum",icon:"ethereum"},[Re.SEPOLIA]:{name:"Sepolia",icon:"ethereum"},[Re.ARBITRUM]:{name:"Arbitrum",icon:"arbitrumBrand"},[Re.BASE]:{name:"Base",icon:"baseBrand"},[Re.OPTIMISM]:{name:"Optimism",icon:"optimismBrand"},[Re.POLYGON]:{name:"Polygon",icon:"polygonBrand"},[Re.SOLANA]:{name:"Solana",icon:"solana"},[Re.COSMOS]:{name:"Cosmos",icon:"cosmos"},[Re.CELO]:{name:"Celo",icon:"celoBrand"},[Re.NOBLE]:{name:"Noble",icon:"nobleBrand"}},fn={[Le.ETHEREUM]:{name:"Ethereum",code:"ETH",icon:"ethereum"},[Le.USDC]:{name:"USDC",code:"USDC",icon:"usdcBrand"},[Le.POLYGON]:{name:"Polygon",code:"MATIC",icon:"polygonBrand"},[Le.SOLANA]:{name:"Solana",code:"SOL",icon:"solana"},[Le.ATOM]:{name:"Atom",code:"ATOM",icon:"cosmos"},[Le.CELO]:{name:"Celo",code:"CELO",icon:"celoBrand"},[Le.TETHER]:{name:"Tether",code:"USDT",icon:"tetherBrand"},[Le.CUSD]:{name:"Celo Dollar",code:"CUSD",icon:"celoBrand"},[Le.CEUR]:{name:"Celo Euro",code:"CEUR",icon:"celoBrand"},[Le.CREAL]:{name:"Celo Real",code:"CREAL",icon:"celoBrand"}};function bt(e){return Cn[e]?.name??`${e[0]}${e.slice(1).toLowerCase()}`}function $l(e){return Cn[e]?.icon??"globe"}function Kl(e){return fn[e]?.code??e}function Yl(e){return fn[e]?.icon??"emptyCircle"}var ze=480,no="network not supported",Qr=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,ro={enter:e=>({scale:e>0?.9:1.1,opacity:0}),center:{scale:1,opacity:1},exit:e=>({scale:e<0?.9:1.1,opacity:0})},ao={duration:.2};import ot from"styled-components";import{CpslButton as zl,CpslIcon as Jr,CpslSpinner as Ql,CpslText as ql}from"@getpara/react-components";import{motion as Zl}from"framer-motion";import{jsx as Qe,jsxs as Zr}from"react/jsx-runtime";var jr=({config:e,index:t,onClick:o})=>{let[a,n]=Xl(!1),i=e.providers[t],{feeLower:l,feeUpper:r,name:c,icon:p,backgroundColors:d}=mn[i],u=`Fee ${l}% - ${r}%`;return Qe(Jl,{$gradientColors:d,fullWidth:!0,onClick:async()=>{n(!0),await o(),n(!1)},children:Zr(jl,{$backgroundColor:d[1],children:[Qe(oc,{children:Qe(Jr,{icon:p})}),Zr(ec,{children:[Qe(qr,{variant:"bodyL",weight:"medium",children:c}),Qe(tc,{children:Qe(qr,{variant:"bodyXS",weight:"medium",children:u})})]}),a?Qe(Ql,{size:16}):Qe(nc,{icon:"chevronUp"})]})})},Jl=ot(zl)`
|
|
135
|
+
width: 100%;
|
|
136
|
+
--button-primary-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[1]} 100%)`};
|
|
137
|
+
--button-primary-hover-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[0]} 100%)`};
|
|
138
|
+
--button-primary-active-background-color: ${({$gradientColors:e})=>`linear-gradient(90deg, ${e[0]} 0%, ${e[0]} 100%)`};
|
|
139
|
+
`,jl=ot(Zl.div)`
|
|
140
|
+
display: flex;
|
|
141
|
+
gap: 8px;
|
|
142
|
+
flex: 1;
|
|
143
|
+
align-items: center;
|
|
144
|
+
|
|
145
|
+
& cpsl-spinner {
|
|
146
|
+
--background-color: ${({$backgroundColor:e})=>`${e}`};
|
|
147
|
+
}
|
|
148
|
+
`,ec=ot.div`
|
|
149
|
+
flex: 1;
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
align-items: start;
|
|
153
|
+
gap: 2px;
|
|
154
|
+
`,tc=ot.div`
|
|
155
|
+
display: flex;
|
|
156
|
+
gap: 16px;
|
|
157
|
+
`,oc=ot.span`
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
background-color: #fff;
|
|
162
|
+
border-radius: 100%;
|
|
163
|
+
height: 48px;
|
|
164
|
+
width: 48px;
|
|
165
|
+
`,qr=ot(ql)`
|
|
166
|
+
&::part(text-element) {
|
|
167
|
+
color: #fff;
|
|
168
|
+
}
|
|
169
|
+
`,nc=ot(Jr)`
|
|
170
|
+
transform: rotate(90deg);
|
|
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,H)=>n.indexOf(I.id.toUpperCase())-n.indexOf(H.id.toUpperCase())).sort((I,H)=>I.installed===H.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]),G=ea(async I=>{let H=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""]?.type;if(H){let q;switch(g(),ae(I),H){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,H,q,pe)=>{if(C&&q&&(await l(),await m(),await S(),M(void 0),R(!1)),pe||q||!C){g(),R(!0),U(H);let{address:ue,error:me}=await(H?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,H=P.externalWallets[P.currentExternalWalletAddresses?.[0]??""];if(H)switch(H?.type){case we.EVM:{I=d?d.startsWith("0x")?oa(d,"EVM"):d:void 0;break}default:{I=H.address?oa(H.address,H.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:G,setChainIdSwitchingTo:ae}),[ce,Q,te,Y,K,pt,ne,Ue,w,De,de,G,ae]),children:e})}var $=()=>so(na);import{getNetworkFromChainId as xc,getNetworkOrMainNetEquivalent as wc,useCopyToClipboard as Wc}from"@getpara/react-common";import{format as Sh}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
|
+
margin: 50% 0;
|
|
174
|
+
`,Lc=En(O)`
|
|
175
|
+
position: relative;
|
|
176
|
+
min-height: 270px;
|
|
177
|
+
`,Mc=En(da)`
|
|
178
|
+
width: 100%;
|
|
179
|
+
text-align: center;
|
|
180
|
+
visibility: ${({isHidden:e})=>e?"hidden":"visible"};
|
|
181
|
+
position: absolute;
|
|
182
|
+
top: 0;
|
|
183
|
+
left: 0;
|
|
184
|
+
right: 0;
|
|
185
|
+
transition: visibility 0.2s;
|
|
186
|
+
`;import{OnRampProvider as hn}from"@getpara/web-sdk";import{lazy as Oc,useEffect as ua,useMemo as Nc,useState as vc}from"react";import{RampEmbed as bc,StripeEmbed as Dc}from"@getpara/react-common";import Uc from"styled-components";var Me=()=>{let e=s(r=>r.step),t=s(r=>r.setStep),o=s(r=>r.accountAddFundTab),a=s(r=>r.decrementStep),n=s(r=>r.resetState),{setChainIdSwitchingTo:i}=$();return()=>{switch(e==="ADD_FUNDS_AWAITING"?t(ut(o)):a(),e){case"VERIFY_2FA":case"BIOMETRIC_CREATION":case"BIOMETRIC_LOGIN":{n();break}}switch(e){case"CHAIN_SWITCH":{i();break}}}};import{jsx as po}from"react/jsx-runtime";var Pc={CANCELLED:"ADD_FUNDS_FAILURE",FINISHED:"ADD_FUNDS_SUCCESS"},ma=()=>{let e=s(A=>A.setStep),t=Me(),o=s(A=>A.onRampConfig),a=s(A=>A.onRampPurchase),n=s(A=>A.setOnRampPurchase),i=b(),l=_(A=>A.appName),r=_(A=>A.isDark),[c,p]=vc(null),d={para:i,appName:l,onRampConfig:o,onRampPurchase:a,isDark:r,isEmbedded:!0,setOnRampPurchase:n,onClose:t};ua(()=>{let A=Oc(()=>import("./MoonPayEmbed-GAWXP6V7.js"));p(A)},[]);let u=Nc(()=>{if(!a.id)return null;switch(a?.provider){case hn.STRIPE:return po(Dc,{...d});case hn.MOONPAY:return!c||typeof window>"u"?null:po(c,{...d});case hn.RAMP:return po(bc,{apiKey:o.rampApiKey,...d})}},[a?.provider,c]);return ua(()=>{let A;return a?.status&&["CANCELLED","FINISHED"].includes(a.status)&&(A=setTimeout(()=>{e(Pc[a.status])},5e3)),()=>clearTimeout(A)},[a?.status]),po(Fc,{$wide:!0,children:u})},Fc=Uc(F)`
|
|
187
|
+
flex: 1;
|
|
188
|
+
`;import{useMemo as kc}from"react";import{CpslButton as Bc,CpslText as Hc}from"@getpara/react-components";import{jsx as uo,jsxs as Ca}from"react/jsx-runtime";var Tn=({isSuccess:e,onClose:t})=>{let o=_(d=>d.hideWallets),a=s(d=>d.setStep),n=s(d=>d.onRampPurchase),i=s(d=>d.accountAddFundTab),l=kc(()=>new Intl.NumberFormat("en-US",{style:"currency",currency:n?.fiat||"USD"}),[n?.fiat]),r=e?"Transaction Successful":"Something Went Wrong",c=e?`${l.format(parseFloat(n?.fiatQuantity))} is now available in your ${o?"account":"wallet"}.`:`No funds were added to your ${o?"account":"wallet"}.`;return Ca(F,{children:[uo(Ke,{icon:"checkCircleFilled"}),Ca(O,{children:[uo(X,{variant:"headingS",weight:"bold",children:r}),uo(Hc,{variant:"bodyS",color:"secondary",children:c})]}),uo(Bc,{fullWidth:!0,onClick:()=>{e?t():a(ut(i))},children:e?"Done":"Try Again"})]})};import{useEffect as fa,useState as Gc}from"react";import{CpslButton as Vc,CpslIcon as $c,CpslQrCode as Kc,CpslSpinner as Yc,CpslText as Xc}from"@getpara/react-components";import{AuthMethod as In,isMobile as zc}from"@getpara/web-sdk";import{Fragment as qc,jsx as qe,jsxs as mo}from"react/jsx-runtime";var Qc=()=>{let e=V(S=>S.setAuthInfo),t=s(S=>S.setStep),o=s(S=>S.setWebAuthURLForCreate),a=s(S=>S.setIFrameUrl),n=s(S=>S.setIsIFrameReady),i=s(S=>S.isIFrameReady),l=s(S=>S.setSupportedAuthMethods),r=s(S=>S.setBiometricLocationHints),c=b(),p=s(S=>S.setFlow),d=s(S=>S.farcasterConnectUri),u=s(S=>S.setFarcasterConnectUri),A=_(S=>S.theme),[m,f]=Gc();return fa(()=>{m&&i&&setTimeout(()=>{t(m)},200)},[m,i]),fa(()=>{if(d)return(async()=>{let{userExists:y,username:D,pfpUrl:W}=await c.waitForFarcasterStatus();if(e({farcasterUsername:D,pfpUrl:W}),y){let R=await c.initiateUserLoginV2({farcasterUsername:D});if(R.size>0){l(R);let C=R.has(In.PASSKEY)?await c.getUserBiometricLocationHints():[];p("login"),t("BIOMETRIC_LOGIN"),r(C);return}}let E=await c.getSupportedCreateAuthMethods();n(!1),p("signUp");let h=E.has(In.PASSKEY);h&&(o(await c.shortenLoginLink(await c.getSetUpBiometricsURL({authType:"farcaster"}))),t("BIOMETRIC_CREATION")),E.has(In.PASSWORD)&&(a(await c.shortenLoginLink(await c.getSetupPasswordURL({authType:"farcaster",theme:A}))),f(h?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))})(),()=>{u(void 0)}},[d]),qe(F,{$wide:!0,children:zc()?mo(O,{children:[qe(Xc,{weight:"medium",color:"secondary",children:"Don\u2019t have Farcaster"}),mo(Vc,{as:"a",href:"https://link.warpcast.com/download-qr",target:"_blank",variant:"secondary",children:[qe($c,{slot:"start",icon:"linkExternal"}),"Get Farcaster"]})]}):mo(qc,{children:[qe(X,{variant:"headingS",weight:"bold",children:"Sign in using Farcaster"}),mo(O,{children:[qe(ie,{variant:"bodyS",color:"secondary",weight:"medium",children:"Scan the QR code with your phone's camera to proceed."}),qe(Se,{children:d?qe(Kc,{url:d}):qe(Yc,{size:100})})]})]})})},Aa=Qc;import{styled as Jc}from"styled-components";import{useMemo as Zc}from"react";var Sa=()=>{let e=_(i=>i.hideWallets),t=s(i=>i.isLogin()),o=s(i=>i.step),{chainId:a}=$();return{title:Zc(()=>({AUTH_MAIN:"",AUTH_MORE:"Sign Up or Log In",EX_WALLET_MORE:"Connect Wallet",VERIFICATIONS:"Sign Up",AWAITING_OAUTH:t?"Login":"Sign Up",FARCASTER_OAUTH:t?"Login":"Sign Up",BIOMETRIC_CREATION:"Sign Up",PASSWORD_CREATION:"Sign Up",AWAITING_BIOMETRIC_CREATION:"Sign Up",AWAITING_WALLET_CREATION:t?"Login":"Sign Up",AWAITING_PASSWORD_CREATION:"Sign Up",WALLET_CREATION_DONE:e?"Account Created":"Wallet Created",SECRET:t?"Login":"Sign Up",BIOMETRIC_LOGIN:"Login",AWAITING_PASSWORD_LOGIN:"Login",AWAITING_BIOMETRIC_LOGIN:"Login",LOGIN_DONE:"",SETUP_2FA:"2FA",VERIFY_2FA:"2FA",TWO_FACTOR_DONE:"2FA",ADD_FUNDS_BUY:"",ADD_FUNDS_RECEIVE:"",ADD_FUNDS_WITHDRAW:"",ADD_FUNDS_AWAITING:"",ADD_FUNDS_SUCCESS:"",ADD_FUNDS_FAILURE:"",ACCOUNT_MAIN:"",CHAIN_SWITCH:""}),[t,a,e])[o]}};import{AnimatePresence as jc,motion as ed}from"framer-motion";import{jsx as gn}from"react/jsx-runtime";var Ea=()=>{let{title:e}=Sa(),t=s(a=>a.stepDirection),o=s(a=>a.step);return gn(jc,{mode:"popLayout",initial:!1,custom:t,children:gn(td,{custom:t,variants:ro,initial:"enter",animate:"center",exit:"exit",transition:ao,slot:"header",id:"header",children:gn(ie,{weight:"semiBold",color:"secondary",children:e})},["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(o)?"ADD_FUNDS":o)})},td=Jc(ed.div)`
|
|
189
|
+
position: absolute;
|
|
190
|
+
top: 16px;
|
|
191
|
+
width: 100%;
|
|
192
|
+
z-index: 2;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: space-between;
|
|
196
|
+
gap: 8px;
|
|
197
|
+
flex-wrap: wrap;
|
|
198
|
+
`;import zd from"styled-components";import{Fragment as Hd,useMemo as Gd}from"react";import{CpslButton as Vd,CpslDivider as $d,CpslIconGroup as Kd}from"@getpara/react-components";import Io from"styled-components";import _e from"styled-components";import{CpslButton as xn,CpslIcon as Co,CpslInput as od,CpslText as Ut}from"@getpara/react-components";import{useState as nd}from"react";var yn=e=>e.find(t=>t.includes("EXTERNAL")),Dt=e=>e.find(t=>t.includes("AUTH"));import{Fragment as ud,jsx as re,jsxs as Ze}from"react/jsx-runtime";var ha=3,fo=()=>{let{wallets:e,connectExternalWallet:t}=$(),o=s(f=>f.setSelectedExternalWalletId),a=s(f=>f.setStep),n=s(f=>f.step==="EX_WALLET_MORE"),i=_(f=>f.authLayout),[l,r]=nd(""),c=e.length>ha,p=n||!c?l?e.filter(f=>f.name.toLowerCase().includes(l.toLowerCase())):e:e.slice(0,ha),d=!n&&c,u=()=>{a("EX_WALLET_MORE")},A=()=>{a("AUTH_MORE")},m=f=>()=>{o(f.id),a("EX_WALLET_SELECTED"),f.installed?t(f):f.isMobile&&t(f,!0)};return Ze(rd,{$maxHeight:n,children:[n&&Ze(ud,{children:[re(cd,{children:re(dd,{placeholder:"Search for your wallet",onCpslInput:async f=>{r(f.target.value)},value:l,style:{width:"100%"},children:re(ld,{slot:"start",icon:"search"})})}),Dt(i)&&re(xn,{fullWidth:!0,variant:"tertiary",onClick:A,children:Ze(Ta,{children:[Ze(Ia,{children:[re(Co,{slot:"start",icon:"paraIcon"}),re(Ut,{weight:"medium",children:"Para"})]}),re(ga,{$show:!0,$variant:"installed",children:re(Ut,{variant:"body2XS",weight:"medium",children:"Available"})})]})})]}),p.map(f=>n?re(xn,{fullWidth:!0,variant:"tertiary",onClick:m(f),children:Ze(Ta,{children:[Ze(Ia,{children:[re(Co,{slot:"start",src:f.iconUrl}),re(Ut,{weight:"medium",children:f.name})]}),re(ga,{$show:f.isMobile||f.installed,$variant:f.installed?"installed":"mobile",children:re(Ut,{variant:"body2XS",weight:"medium",children:f.installed?"Installed":"Mobile"})})]})},f.id):re(ad,{src:f.iconUrl,onClick:m(f),children:Ze(sd,{children:[f.installed&&re(id,{}),re(Ut,{variant:"bodyXS",color:"secondary",weight:"medium",children:f.name})]})},f.id)),d&&Ze(xn,{variant:"tertiary",fullWidth:!0,onClick:u,children:[re(Co,{slot:"start",icon:"wallet"}),"More Wallets"]}),n&&re(pd,{})]})},rd=_e.div`
|
|
199
|
+
position: relative;
|
|
200
|
+
display: flex;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
gap: 8px;
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
|
|
205
|
+
max-height: ${({$maxHeight:e})=>e?"348px":"none"};
|
|
206
|
+
overflow-y: auto;
|
|
207
|
+
|
|
208
|
+
&::-webkit-scrollbar {
|
|
209
|
+
display: none;
|
|
210
|
+
}
|
|
211
|
+
-ms-overflow-style: none;
|
|
212
|
+
scrollbar-width: none;
|
|
213
|
+
`,ad=_e($e)`
|
|
214
|
+
flex: 1;
|
|
215
|
+
`,Ta=_e.div`
|
|
216
|
+
width: 100%;
|
|
217
|
+
display: flex;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 8px;
|
|
220
|
+
justify-content: space-between;
|
|
221
|
+
`,Ia=_e.div`
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
gap: 8px;
|
|
225
|
+
|
|
226
|
+
cpsl-icon {
|
|
227
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
228
|
+
}
|
|
229
|
+
cpsl-text {
|
|
230
|
+
&::part(text-element) {
|
|
231
|
+
color: var(--cpsl-color-contrast);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
`,ga=_e.div`
|
|
235
|
+
visibility: ${({$show:e})=>e?"visible":"hidden"};
|
|
236
|
+
padding: 2px 4px;
|
|
237
|
+
border-radius: 4px;
|
|
238
|
+
border: 1px solid;
|
|
239
|
+
border-color: ${({$variant:e})=>e==="installed"?"var(--cpsl-color-utility-green)":"var(--cpsl-color-text-primary)"};
|
|
240
|
+
cpsl-text {
|
|
241
|
+
&::part(text-element) {
|
|
242
|
+
color: ${({$variant:e})=>e==="installed"?"var(--cpsl-color-utility-green)":"var(--cpsl-color-text-primary)"};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
`,id=_e.span`
|
|
246
|
+
width: 8px;
|
|
247
|
+
height: 8px;
|
|
248
|
+
border-radius: 100%;
|
|
249
|
+
background-color: var(--cpsl-color-utility-green);
|
|
250
|
+
`,sd=_e.div`
|
|
251
|
+
display: flex;
|
|
252
|
+
gap: 4px;
|
|
253
|
+
align-items: center;
|
|
254
|
+
`,ld=_e(Co)`
|
|
255
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
256
|
+
`,cd=_e.div`
|
|
257
|
+
width: 100%;
|
|
258
|
+
background-color: var(--cpsl-color-background-0);
|
|
259
|
+
|
|
260
|
+
position: sticky;
|
|
261
|
+
top: 0;
|
|
262
|
+
padding-bottom: 4px;
|
|
263
|
+
margin-bottom: -4px;
|
|
264
|
+
`,dd=_e(od)`
|
|
265
|
+
width: 100%;
|
|
266
|
+
--container-background-color: var(--cpsl-color-background-8);
|
|
267
|
+
--input-background-color: var(--cpsl-color-background-8);
|
|
268
|
+
`,pd=_e.div`
|
|
269
|
+
position: sticky;
|
|
270
|
+
height: 56px;
|
|
271
|
+
width: 100%;
|
|
272
|
+
bottom: 0;
|
|
273
|
+
|
|
274
|
+
background: linear-gradient(0deg, var(--cpsl-color-background-0) 0%, rgba(234, 239, 211, 0) 100%);
|
|
275
|
+
pointer-events: none;
|
|
276
|
+
`;var Ao={GOOGLE:"googleBrand",TWITTER:"twitter",APPLE:"apple",DISCORD:"discordBrand",FACEBOOK:"facebookBrand",FARCASTER:"farcasterBrand",TELEGRAM:"telegramBrand"},So={GOOGLE:"google",TWITTER:"twitter",APPLE:"apple",DISCORD:"discord",FACEBOOK:"facebook",FARCASTER:"farcaster",TELEGRAM:"telegram"};import{useMemo as Pd}from"react";import Fd from"styled-components";import{AuthMethod as fd,OAuthMethod as wn}from"@getpara/web-sdk";import{styled as _a}from"styled-components";var ya=(e,t)=>{if(t<2)return"1 1 auto";if(t%3===0)return`0 0 calc(33.333333% - ${5.336}px)`;if(t%3===1)return e<4?"0 0 calc(50% - 4px)":`0 0 calc(33.333333% - ${5.336}px)`;if(t%3===2)return e<2?"0 0 calc(50% - 4px)":`0 0 calc(33.333333% - ${5.336}px)`};import{useEffect as Ad}from"react";import{isAndroid as md,isMobile as Cd,isTelegram as xa}from"@getpara/web-sdk";var at=e=>{if(!(typeof window>"u")&&Cd()){if(!e)return;if(!xa()&&e.startsWith("http")){let t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noreferrer noopener",t.click()}else if(xa()){let t=e;md()&&(t=encodeURI(e)),window.open(t,"_blank","noreferrer noopener")}else window.location.href=e}};import{jsx as Wa,jsxs as Ed}from"react/jsx-runtime";var Pt=3,Ra=({methods:e})=>{let t=Me(),o=_(C=>C.oAuthLogoVariant),a=_(C=>C.isDark),n=b(),i=s(C=>C.popupWindow),l=s(C=>C.setFlow),r=s(C=>C.setStep),c=s(C=>C.setPopupWindow),p=V(C=>C.setAuthInfo),d=s(C=>C.setSupportedAuthMethods),u=s(C=>C.setBiometricLocationHints),A=s(C=>C.setFarcasterConnectUri),m=s(C=>C.farcasterConnectUri),f=s(C=>C.step==="AUTH_MORE");Ad(()=>{(async()=>{if(!e.includes(wn.FARCASTER))return;let L=await n.getFarcasterConnectURL();A(L)})()},[]);let S=e.length>Pt,y=f||!S?e:e.slice(0,Pt-1),D=()=>{r("AUTH_MORE")},W=C=>async()=>{if(!i)switch(C){case wn.FARCASTER:if(!m)return;at(m),r("FARCASTER_OAUTH");break;case wn.TELEGRAM:r("TELEGRAM_OAUTH");break;default:r("AWAITING_OAUTH");let L=await n.getOAuthURL({method:C}),T=je(L,`${C}AuthPopup`,"OAUTH");c(T);let{email:g,isError:U,userExists:x}=await n.waitForOAuth({popupWindow:T});if(c(void 0),U){t();return}if(!g)throw r("AUTH_MAIN"),new Error("email is required");if(p({email:g}),x){let P=await n.initiateUserLoginV2({email:g});if(P.size>0){let K=P.has(fd.PASSKEY)?await n.getUserBiometricLocationHints():[];l("login"),r("BIOMETRIC_LOGIN"),d(P),u(K);return}}l("signUp"),r("BIOMETRIC_CREATION");break}},E=o==="default",h=E?a:o!=="dark",R=!f&&S;return Ed(Sd,{children:[y.map((C,L)=>Wa(wa,{$isDark:h,icon:E?Ao[C]:So[C],onClick:W(C),$index:L,$totalItems:R?Pt:y.length},C)),R&&Wa(wa,{$isDark:h,icon:"moreLoginOptions",onClick:D,$index:Pt-1,$totalItems:Pt})]})},Sd=_a.div`
|
|
277
|
+
display: flex;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
gap: 8px;
|
|
280
|
+
flex-wrap: wrap;
|
|
281
|
+
`,wa=_a($e)`
|
|
282
|
+
flex: ${({$index:e,$totalItems:t})=>ya(e,t)};
|
|
283
|
+
|
|
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,G=!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||(G=/\D.*$/.test(Q)),D(G?"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),G=te.has(Oa.PASSKEY)?await i.getUserBiometricLocationHints():[];c("login"),p("BIOMETRIC_LOGIN"),d(te),u(G);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),G=te.has(Oa.PASSKEY)?await i.getUserBiometricLocationHints():[];c("login"),p("BIOMETRIC_LOGIN"),d(te),u(G);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
|
+
height: 100%;
|
|
287
|
+
display: flex;
|
|
288
|
+
align-items: center;
|
|
289
|
+
gap: 8px;
|
|
290
|
+
padding-right: 12px;
|
|
291
|
+
border-right: 1px solid var(--cpsl-color-background-16);
|
|
292
|
+
|
|
293
|
+
& cpsl-icon {
|
|
294
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
295
|
+
}
|
|
296
|
+
`,vd=Ht(_d)`
|
|
297
|
+
--container-height: 100%;
|
|
298
|
+
--container-padding-start: 0px;
|
|
299
|
+
--container-padding-end: 0px;
|
|
300
|
+
--container-border-width: 0px;
|
|
301
|
+
--container-gap: 4px;
|
|
302
|
+
--container-background-color: transparent;
|
|
303
|
+
--container-box-shadow: none;
|
|
304
|
+
|
|
305
|
+
&::part(dropdown) {
|
|
306
|
+
width: ${({$width:e})=>`${e-2}px`};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
&::part(popover) {
|
|
310
|
+
@media (max-width: ${ze}px) {
|
|
311
|
+
top: unset !important;
|
|
312
|
+
bottom: 16px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
cpsl-auth-modal.force-mobile-media & {
|
|
316
|
+
top: unset !important;
|
|
317
|
+
bottom: 16px;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
`,bd=Ht(Rd)`
|
|
321
|
+
&::part(inner-container) {
|
|
322
|
+
justify-content: space-between;
|
|
323
|
+
}
|
|
324
|
+
`,Dd=Ht.div`
|
|
325
|
+
display: flex;
|
|
326
|
+
gap: 4px;
|
|
327
|
+
align-items: center;
|
|
328
|
+
`,Ud=Ht(Wd)`
|
|
329
|
+
--container-background-color: var(--cpsl-color-background-8);
|
|
330
|
+
--input-background-color: var(--cpsl-color-background-8);
|
|
331
|
+
--container-padding-end: 8px;
|
|
332
|
+
`;import{Fragment as Bd,jsx as ho}from"react/jsx-runtime";var To=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=$(),n=s(l=>l.step==="AUTH_MORE"),i=Pd(()=>{let l=[];return e?.length&&l.push(ho(Ra,{methods:e},"oAuth")),(!t||!o)&&l.push(ho(Na,{disableEmailLogin:t,disablePhoneLogin:o},"input")),ho(Bd,{children:l})},[n,e,t,o,a]);return ho(kd,{children:i})},kd=Fd.div`
|
|
333
|
+
display: flex;
|
|
334
|
+
flex-direction: column;
|
|
335
|
+
gap: 8px;
|
|
336
|
+
`;import{Fragment as Xd,jsx as ke,jsxs as Rn}from"react/jsx-runtime";var Da=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let{wallets:a}=$(),n=_(m=>m.authLayout),i=s(m=>m.setStep),l=_(m=>m.oAuthLogoVariant),r=_(m=>m.isDark),c=l==="default",p=c?r:l!=="dark",d=()=>{i("AUTH_MORE")},u=()=>{i("EX_WALLET_MORE")},A=Gd(()=>{let m=[];return n.forEach(f=>{switch(f){case"AUTH:FULL":{m.push([ke(To,{oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o},"authFull"),f]);break}case"AUTH:CONDENSED":{let S=[];e?.forEach(y=>S.push(c?Ao[y]:So[y])),m.push([Rn(ba,{onClick:d,variant:"tertiary",fullWidth:!0,children:[ke(va,{slot:"start",icons:[],$isDark:p}),"Sign Up or Login",ke(Ln,{slot:"end",icons:S.splice(0,3),$isDark:p})]},"authCondensed"),f]);break}case"EXTERNAL:FULL":{a.length&&m.push([ke(fo,{},"externalWallets"),f]);break}case"EXTERNAL:CONDENSED":{let S=[];a?.forEach(y=>S.push(y.iconUrl)),m.push([Rn(ba,{onClick:u,variant:"tertiary",fullWidth:!0,children:[ke(va,{slot:"start",icons:[],$isDark:p}),"Connect Wallet",ke(Ln,{slot:"end",icons:S.splice(0,3),$isDark:p})]},"authCondensed"),f]);break}default:break}}),ke(Xd,{children:m.map(([f,S],y)=>Rn(Hd,{children:[f,m.length>1&&y<m.length-1&&ke($d,{children:"or"},"or")]},S))})},[e,t,o,a,n]);return ke(Yd,{"data-testid":"main-auth-step-content",children:A})},Yd=Io.div`
|
|
337
|
+
display: flex;
|
|
338
|
+
flex-direction: column;
|
|
339
|
+
gap: 8px;
|
|
340
|
+
`,Ln=Io(Kd)`
|
|
341
|
+
--icon-item-color: ${({$isDark:e})=>e?"white":"black"};
|
|
342
|
+
flex: 1;
|
|
343
|
+
justify-content: flex-end;
|
|
344
|
+
`,va=Io(Ln)`
|
|
345
|
+
visibility: hidden;
|
|
346
|
+
`,ba=Io(Vd)`
|
|
347
|
+
--button-justify-content: space-between;
|
|
348
|
+
|
|
349
|
+
&::part(button-native) {
|
|
350
|
+
max-height: 50px;
|
|
351
|
+
}
|
|
352
|
+
`;import{Fragment as qd,jsx as Mn,jsxs as Zd}from"react/jsx-runtime";var Ua=({oAuthMethods:e,disableEmailLogin:t,disablePhoneLogin:o})=>{let a=_(p=>p.getLogo()),n=_(p=>p.appName),i=_(p=>p.authLayout),l=_(p=>p.embeddedModal),c=i[0].split(":")[0]==="AUTH"?"Sign Up or Login":"Connect Wallet";return Zd(qd,{children:[a&&Mn(Qd,{src:a,alt:`${n?`${n} -`:""}logo`}),!l&&Mn(ie,{variant:a?"bodyM":"headingS",weight:"semiBold",children:c}),Mn(Da,{disableEmailLogin:t,disablePhoneLogin:o,oAuthMethods:e})]})},Qd=zd.img`
|
|
353
|
+
height: 100px;
|
|
354
|
+
max-width: 260px;
|
|
355
|
+
object-fit: contain;
|
|
356
|
+
box-sizing: content-box;
|
|
357
|
+
align-self: center;
|
|
358
|
+
`;import bn from"styled-components";import{CpslButton as Jd,CpslIcon as jd,CpslSpinner as Pa,CpslText as On}from"@getpara/react-components";import{useState as ep}from"react";import{Fragment as Fa,jsx as Te,jsxs as vn}from"react/jsx-runtime";var ka=({onClose:e})=>{let t=s(m=>m.onRampConfig),o=s(m=>m.setStep),a=_(m=>m.hideWallets),{disconnectExternalWallet:n}=$(),i=b(),[l,r]=ep(!1),c=!!t,p=()=>{o("ADD_FUNDS_BUY")},d=()=>{o("ADD_FUNDS_RECEIVE")},u=()=>{o("ADD_FUNDS_WITHDRAW")},A=async()=>{r(!0),await i.logout(),await n(),e(),r(!1)};return Te(F,{$wide:!0,children:vn(O,{children:[Te(tp,{children:c?vn(Fa,{children:[t.isBuyEnabled&&Te(Nn,{icon:"creditCard",onClick:p,children:Te(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Buy Crypto"})}),t.isReceiveEnabled&&Te(Nn,{icon:"qrCode02",onClick:d,children:Te(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Receive"})}),t.isWithdrawEnabled&&Te(Nn,{icon:"arrowCircleBrokenDownLeft",onClick:u,children:Te(On,{variant:"bodyXS",color:"secondary",weight:"medium",children:"Withdraw"})})]}):Te(Pa,{})}),Te(op,{variant:"destructive",fullWidth:!0,onClick:A,disabled:l,children:l?Te(Pa,{size:16}):vn(Fa,{children:[a?"Logout":"Disconnect Wallet",Te(jd,{icon:"logOut",slot:"end"})]})})]})})},tp=bn.div`
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
justify-content: center;
|
|
362
|
+
gap: 8px;
|
|
363
|
+
width: 100%;
|
|
364
|
+
height: 88px;
|
|
365
|
+
`,Nn=bn($e)`
|
|
366
|
+
flex: 1;
|
|
367
|
+
|
|
368
|
+
--button-icon-color: var(--cpsl-color-text-primary);
|
|
369
|
+
`,op=bn(Jd)`
|
|
370
|
+
--button-border-width: 0px;
|
|
371
|
+
`;import{CpslButton as go,CpslIcon as yo,CpslQrCode as np,CpslSpinner as rp,CpslText as Dn}from"@getpara/react-components";import{useEffect as Ba,useMemo as ap}from"react";import st from"styled-components";import{useCopyToClipboard as ip}from"@getpara/react-common";import{isMobile as Ha,isTablet as sp,WalletType as Ga}from"@getpara/web-sdk";import{Fragment as Un,jsx as z,jsxs as Ne}from"react/jsx-runtime";var Xa=()=>{let[e,t]=ip(),o=s(u=>u.externalWalletError),a=s(u=>u.setStep),{connectExternalWallet:n,wallet:i,qrUri:l,walletDisplayHelpers:r}=$();Ba(()=>{at(l)},[l]);let c=async()=>{await n(i)},p=()=>{t(l)},d=ap(()=>{if(!i)return null;let u=i.id==="walletConnect";Ha()&&u&&O;let{showExtension:m,showMobile:f,isSolanaMobileIOS:S}=r;if(!f&&!m||S&&!i.installed){let y=S?`Solana wallets aren't available on mobile IOS browsers.
|
|
372
|
+
|
|
373
|
+
Please continue in the wallet app.`:`${i.name} isn't supported on mobile devices.
|
|
374
|
+
|
|
375
|
+
Please choose another wallet or continue on desktop.`;return z(O,{children:z(Va,{weight:"semiBold",children:y})})}if(m){let y=i.installed;return Ne(O,{children:[y&&!o?.length?z(ie,{color:"contrast",weight:"semiBold",children:`Confirm connection request in the ${i.name} browser extension.`}):Ne(cp,{children:[z(dp,{icon:"alertCircle"}),z(Dn,{weight:"semiBold",color:"error",children:y?o?.[0]:`${i.name} not detected`})]}),Ne(go,{as:y?"button":"a",href:i.downloadUrl??"",target:"_blank",variant:"secondary",onClick:c,children:[z(yo,{slot:"start",icon:y?"refresh":"linkExternal"}),y?"Try Again":`Get ${i.name}`]})]})}if(f){if(i.type===Ga.SOLANA||Ha()&&!sp()){let W=i.type!==Ga.SOLANA||i.installed;return Ne(Un,{children:[z(O,{children:!W&&z(Dn,{weight:"semiBold",color:"error",children:`${i.name} not detected`})}),i.id!=="walletConnect"&&Ne(O,{children:[z(go,{onClick:()=>at(l),fullWidth:!0,children:"Connect Wallet"}),z(Ya,{href:i.downloadUrl??"",target:"_blank",children:Ne($a,{variant:"secondary",children:[`Get ${i.name}`,z(Ka,{icon:"linkExternal"})]})})]})]})}let D=Ne($a,{variant:"secondary",onClick:u?async()=>{await n(i,!0,!0)}:void 0,children:[`${u?"Open":"Get"} ${i.name}`,z(Ka,{icon:"linkExternal"})]});return Ne(Un,{children:[Ne(O,{children:[z(Dn,{weight:"semiBold",children:"Scan with your mobile device"}),z(Se,{children:l?z(np,{url:l,imageSrc:i.iconUrl}):z(rp,{size:100})}),Ne(go,{size:"small",variant:"ghost",onClick:p,children:[z(yo,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]}),z(O,{children:u?z(Un,{children:D}):z(Ya,{href:i.downloadUrl??"",target:"_blank",children:D})})]})}},[i,r,o,l]);return Ba(()=>{i||a("AUTH_MAIN")},[i]),i?z(lp,{children:d}):null},lp=st(F)`
|
|
376
|
+
flex: 1;
|
|
377
|
+
justify-content: space-between;
|
|
378
|
+
`,cp=st.div`
|
|
379
|
+
display: flex;
|
|
380
|
+
align-items: center;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
gap: 4px;
|
|
383
|
+
`,dp=st(yo)`
|
|
384
|
+
--height: 16px;
|
|
385
|
+
--width: 16px;
|
|
386
|
+
--icon-color: var(--cpsl-color-text-error);
|
|
387
|
+
`,Va=st(ie)`
|
|
388
|
+
white-space: pre-line;
|
|
389
|
+
`,$a=st(go)`
|
|
390
|
+
display: flex;
|
|
391
|
+
gap: 8px;
|
|
392
|
+
align-items: center;
|
|
393
|
+
justify-content: center;
|
|
394
|
+
width: 100%;
|
|
395
|
+
cursor: pointer;
|
|
396
|
+
margin-top: 8px;
|
|
397
|
+
text-decoration: none;
|
|
398
|
+
`,Ka=st(yo)`
|
|
399
|
+
--height: 20px;
|
|
400
|
+
--width: 20px;
|
|
401
|
+
`,Ya=st.a`
|
|
402
|
+
text-decoration: none;
|
|
403
|
+
`;import{CpslHero as pp,CpslIcon as up,CpslIdenticon as mp}from"@getpara/react-components";import yt from"styled-components";import{useEffect as Cp,useState as fp}from"react";import{isMobile as Pn}from"@getpara/web-sdk";import{Fragment as Ip,jsx as gt,jsxs as Qa}from"react/jsx-runtime";var Fn=({externalWalletError:e})=>({EX_WALLET_SELECTED:{variant:"externalWalletConnection",topOffset:40,spacerHeight:158,hideFadeOut:!0},CHAIN_SWITCH:{variant:e?.[0]?.toLowerCase()===no?"failed":"externalWalletConnection",topOffset:20,spacerHeight:158,hideFadeOut:!0},ACCOUNT_MAIN:{variant:"customContent",topOffset:0,spacerHeight:104,hideFadeOut:!0},FARCASTER_OAUTH:{variant:"externalWalletConnection",topOffset:40,spacerHeight:158,hideFadeOut:!0}}),qa=()=>{let e=b(),{wallet:t,walletDisplayHelpers:o,avatar:a}=$(),n=s(R=>R.step),i=s(R=>R.externalWalletError),l=nt(),[r,c]=fp(n),p=Fn({externalWalletError:i})[r];Cp(()=>{let R=Fn({externalWalletError:i})[r],C=Fn({externalWalletError:i})[n];setTimeout(()=>{c(n)},C&&R||C&&!R?0:200)},[n]);let d=r==="EX_WALLET_SELECTED",u=r==="CHAIN_SWITCH",A=r==="ACCOUNT_MAIN",m=r==="FARCASTER_OAUTH",{showExtension:f,isCosmosMobileWallet:S}=o,y=!p||!Pn()&&d&&!f||!Pn()&&u&&S||!Pn()&&m,{variant:D,topOffset:W,spacerHeight:E,hideFadeOut:h}=p??{};return Qa(Ip,{children:[gt(Ap,{$top:-45+W,children:y?null:Qa(Tp,{$isAccount:A,hideFadeOut:h,variant:D,height:480,withDefaultTheme:!0,children:[(d||u)&>(za,{slot:"connectionLeft",src:t?.iconUrl}),m&>(za,{slot:"connectionLeft",icon:"farcasterBrand"}),A&&(a?gt(Ep,{slot:"image",src:a}):l?gt(hp,{slot:"image",size:"100%",hash:e.getIdenticonHash(l.id,l.type)}):null)]})}),!y&>(Sp,{$height:E})]})},Ap=yt.div`
|
|
404
|
+
display: flex;
|
|
405
|
+
position: absolute;
|
|
406
|
+
justify-content: center;
|
|
407
|
+
align-items: center;
|
|
408
|
+
width: 100%;
|
|
409
|
+
|
|
410
|
+
top: ${({$top:e})=>`${e}px`};
|
|
411
|
+
`,Sp=yt.div`
|
|
412
|
+
height: ${({$height:e})=>`${e}px`};
|
|
413
|
+
`,za=yt(up)`
|
|
414
|
+
--height: 60px;
|
|
415
|
+
--width: 60px;
|
|
416
|
+
`,Ep=yt.img`
|
|
417
|
+
width: 100%;
|
|
418
|
+
height: 100%;
|
|
419
|
+
object-fit: contain;
|
|
420
|
+
`,hp=yt(mp)`
|
|
421
|
+
border-radius: 1000px;
|
|
422
|
+
`,Tp=yt(pp)`
|
|
423
|
+
${({$isAccount:e})=>e&&`
|
|
424
|
+
--ring-3-size: 560px;
|
|
425
|
+
--ring-2-size: 402px;
|
|
426
|
+
--ring-1-size: 228px;
|
|
427
|
+
--ring-0-size: 104px;
|
|
428
|
+
|
|
429
|
+
--default-theme-ring-3-opacity: 0.02;
|
|
430
|
+
--default-theme-ring-2-opacity: 0.04;
|
|
431
|
+
--default-theme-ring-1-opacity: 0.06;
|
|
432
|
+
--default-theme-ring-0-opacity: 0.1;
|
|
433
|
+
`}
|
|
434
|
+
`;import{motion as gp}from"framer-motion";import{useEffect as yp,useRef as xp,useState as wp}from"react";import Wp from"styled-components";import{jsx as Za}from"react/jsx-runtime";var Ja=({children:e,className:t})=>{let o=xp(null),[a,n]=wp("auto");return yp(()=>{if(o.current){let i=new ResizeObserver(l=>{let r=l[0].contentRect.height;n(r)});return i.observe(o.current),()=>{i.disconnect()}}},[]),Za(_p,{className:t,style:{height:a},animate:{height:a},transition:{duration:.2},children:Za("div",{ref:o,children:e})})},_p=Wp(gp.div)`
|
|
435
|
+
overflow: hidden;
|
|
436
|
+
`;import{CpslButton as ja,CpslIcon as kn,CpslQrCode as Rp,CpslSpinner as Lp,CpslText as Mp}from"@getpara/react-components";import{useEffect as ei,useMemo as Op}from"react";import Bn from"styled-components";import{useCopyToClipboard as Np}from"@getpara/react-common";import{WalletType as vp}from"@getpara/web-sdk";import{Fragment as ti,jsx as Ie,jsxs as xt}from"react/jsx-runtime";var oi=()=>{let[e,t]=Np(),o=s(m=>m.externalWalletError),a=s(m=>m.setStep),n=s(m=>m.setStepDirection),{switchChain:i,wallet:l,qrUri:r,chainIdSwitchingTo:c,walletDisplayHelpers:p}=$();ei(()=>{l?.type===vp.COSMOS&&at(r)},[r,l]),ei(()=>{l||(n(-1),a("ACCOUNT_MAIN"))},[l]);let d=async()=>{c&&await i(c)},u=()=>{t(r)},A=Op(()=>{if(!l)return null;let{isCosmosMobileWallet:m}=p;return m?Ie(ti,{children:xt(O,{children:[Ie(Mp,{weight:"semiBold",children:"Scan with your mobile device to switch networks"}),Ie(Se,{children:r?Ie(Rp,{url:r,imageSrc:l.iconUrl}):Ie(Lp,{size:100})}),xt(ja,{size:"small",variant:"ghost",onClick:u,children:[Ie(kn,{slot:"start",icon:e?"check":"copy"}),e?"Copied":"Copy Link"]})]})}):xt(O,{children:[o?.length?xt(ti,{children:[xt(Dp,{children:[Ie(Up,{icon:"alertCircle"}),Ie(ie,{weight:"semiBold",color:"error",children:o[0]})]}),o[1]&&Ie(ie,{color:"secondary",weight:"medium",children:o[1]})]}):Ie(ie,{color:"contrast",weight:"semiBold",children:`Confirm the request to change networks in your ${l.name} wallet.`}),o?.[0]?.toLowerCase()!==no&&xt(ja,{variant:"secondary",onClick:d,children:[Ie(kn,{slot:"start",icon:"refresh"}),"Try Again"]})]})},[l,p,o,r]);return l?Ie(bp,{children:A}):null},bp=Bn(F)`
|
|
437
|
+
flex: 1;
|
|
438
|
+
justify-content: space-between;
|
|
439
|
+
`,Dp=Bn.div`
|
|
440
|
+
display: flex;
|
|
441
|
+
align-items: center;
|
|
442
|
+
justify-content: center;
|
|
443
|
+
gap: 4px;
|
|
444
|
+
`,Up=Bn(kn)`
|
|
445
|
+
--height: 16px;
|
|
446
|
+
--width: 16px;
|
|
447
|
+
--icon-color: var(--cpsl-color-text-error);
|
|
448
|
+
`;import{motion as du,AnimatePresence as pu}from"framer-motion";import{CpslIcon as Ai}from"@getpara/react-components";import{styled as wo}from"styled-components";import{CpslIdenticon as ni,CpslSelect as Pp,CpslSelectItem as Fp,CpslText as Vt}from"@getpara/react-components";import Je from"styled-components";import{truncateAddress as kp,WalletType as xo}from"@getpara/web-sdk";import{useEffect as li,useRef as ci}from"react";import{jsx as le,jsxs as Gt}from"react/jsx-runtime";var ri=(e,t)=>e&&t?`${e}~${t}`:void 0,Bp={[xo.EVM]:"EVM",[xo.SOLANA]:"Solana",[xo.COSMOS]:"Cosmos"},di=()=>{let e=ci(null),{dropdownMaxHeight:t,dropdownWidth:o,mobileAnchor:a,resize:n}=kt(e),i=nt(),{switchChain:l,chainId:r,chains:c,chainIdSwitchingTo:p}=$();li(()=>{t&&r&&n()},[r,p,t]);let d=async m=>{await l(m)};if(!i||!i.isExternal||i.type===xo.SOLANA)return null;let u=p??r,A=c.find(m=>m.id.toString()===u)?.name;return le(ui,{children:le(mi,{ref:e,id:"inputContainer",children:Gt(Ci,{selectedValue:u?.toString()??"",onCpslSelectValueChange:m=>{d(m.detail)},showFormattedSelectedItem:!0,placeholder:"Choose chain...",anchorElId:"inputContainer",dropdownMaxHeight:t,$width:o,$top:a+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[u&&le(si,{variant:"bodyXS",color:"contrast",slot:"selected-item",children:A}),c?.map(m=>le(fi,{slot:"items",value:m.id.toString(),children:le(si,{variant:"bodyXS",color:"contrast",children:m.name})},m.id))]})})})};function ai(e,{type:t,isExternal:o,name:a,isMenu:n=!1,hideWallets:i=!1}){return e.isMultiWallet?a??`${o?"External ":""}${Bp[t]}${!i&&(n||o)?" Wallet":""}`:i?"My Account":a||"My Wallet"}var pi=()=>{let e=_(d=>d.hideWallets),t=b(),o=ci(null),{dropdownMaxHeight:a,dropdownWidth:n,mobileAnchor:i,resize:l}=kt(o),{setSelectedWallet:r}=Ce(),c=nt(),p=c?Gt(ii,{slot:"selected-item",children:[le(ni,{variant:"avatar",size:"14px",hash:t.getIdenticonHash(c.id,c.type)}),le(Gp,{variant:"bodyXS",color:"contrast",children:ai(t,{...c,hideWallets:e})}),!e&&le(Vt,{variant:"bodyXS",color:"secondary",children:t.getDisplayAddress(c.id,{truncate:!0,addressType:c.type})})]}):null;return li(()=>{a&&c?.address&&l()},[c,t.availableWallets,a]),le(ui,{children:le(mi,{ref:o,id:"addressInputContainer",children:t.availableWallets.length>1?Gt(Ci,{selectedValue:ri(c?.id,c?.type),onCpslSelectValueChange:d=>{let[u,A]=d.detail.split("~");r({id:u,type:A})},showFormattedSelectedItem:!0,placeholder:"Choose wallet...",anchorElId:"addressInputContainer",dropdownMaxHeight:a,$width:n,$top:i+16+1,autoWidth:!0,selectedItemVariant:"bodyXS",children:[c&&p,t.availableWallets.map(({address:d,name:u,id:A,type:m,isExternal:f})=>{let S=ri(A,m),y=u??ai(t,{type:m,isExternal:f,isMenu:!0,hideWallets:e});return le(fi,{slot:"items",value:S,children:Gt(ii,{children:[le(ni,{size:"40px",hash:t.getIdenticonHash(A,m)}),Gt(Hp,{children:[y&&le(Vt,{variant:"bodyS",color:"contrast",children:y}),!e&&le(Vt,{variant:"bodyXS",color:"secondary",children:kp(d,m,{prefix:t.cosmosPrefix})})]})]})},S)})]}):p})})},ui=Je.div`
|
|
449
|
+
flex: 0;
|
|
450
|
+
width: 100%;
|
|
451
|
+
display: flex;
|
|
452
|
+
justify-content: center;
|
|
453
|
+
`,ii=Je.div`
|
|
454
|
+
display: flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
gap: 8px;
|
|
457
|
+
`,Hp=Je.div`
|
|
458
|
+
display: flex;
|
|
459
|
+
flex-direction: column;
|
|
460
|
+
align-items: flex-start;
|
|
461
|
+
`,Gp=Je(Vt)`
|
|
462
|
+
white-space: nowrap;
|
|
463
|
+
`,mi=Je.div`
|
|
464
|
+
position: relative;
|
|
465
|
+
display: flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
gap: 8px;
|
|
468
|
+
border-radius: 1000px;
|
|
469
|
+
background-color: var(--cpsl-color-background-8);
|
|
470
|
+
padding: 8px;
|
|
471
|
+
`,si=Je(Vt)`
|
|
472
|
+
max-width: 150px;
|
|
473
|
+
text-transform: capitalize;
|
|
474
|
+
|
|
475
|
+
&::part(text-element) {
|
|
476
|
+
white-space: nowrap;
|
|
477
|
+
text-overflow: ellipsis;
|
|
478
|
+
overflow: hidden;
|
|
479
|
+
}
|
|
480
|
+
`,Ci=Je(Pp)`
|
|
481
|
+
--container-height: auto;
|
|
482
|
+
--container-border-width: 0px;
|
|
483
|
+
--container-padding-end: 0px;
|
|
484
|
+
--container-padding-start: 0px;
|
|
485
|
+
--container-background-color: transparent;
|
|
486
|
+
--container-box-shadow: none;
|
|
487
|
+
--container-gap: 2px;
|
|
488
|
+
--icon-width: 16px;
|
|
489
|
+
--icon-height: 16px;
|
|
490
|
+
|
|
491
|
+
&::part(selected-text) {
|
|
492
|
+
white-space: nowrap;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
&::part(dropdown) {
|
|
496
|
+
min-width: ${({$width:e})=>`${e-2}px`};
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
&::part(popover) {
|
|
500
|
+
/* Have to adjust the top of the popover here since we're using a transform on the modal which causes fixed position items to not be relative to the viewport */
|
|
501
|
+
@media (max-width: ${ze}px) {
|
|
502
|
+
top: ${({$top:e})=>e?`${e}px`:"0px"};
|
|
503
|
+
bottom: 16px;
|
|
504
|
+
}
|
|
505
|
+
cpsl-auth-modal.force-mobile-media & {
|
|
506
|
+
top: ${({$top:e})=>e?`${e}px`:"0px"};
|
|
507
|
+
bottom: 16px;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
&::part(icon) {
|
|
512
|
+
--icon-color: var(--cpsl-color-contrast);
|
|
513
|
+
}
|
|
514
|
+
`,fi=Je(Fp)`
|
|
515
|
+
--outer-container-padding-start: 4px;
|
|
516
|
+
--outer-container-padding-end: 4px;
|
|
517
|
+
--outer-container-padding-top: 4px;
|
|
518
|
+
--outer-container-padding-bottom: 4px;
|
|
519
|
+
`;import{HeaderButton as Ei}from"@getpara/react-common";import{Fragment as Xp,jsx as lt,jsxs as Si}from"react/jsx-runtime";var hi=({onClose:e})=>{let t=_(c=>c.bareModal),o=s(c=>c.hasPreviousStep()),a=s(c=>c.step),n=s(c=>c.isFullyLoggedIn),i=Me(),l=["ACCOUNT_MAIN","CHAIN_SWITCH","ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(a);return Si(Vp,{children:[lt(Yp,{variant:"ghost",style:{visibility:o?"visible":"hidden"},onClick:()=>{i()},children:lt(Ai,{icon:"arrow"})}),lt($p,{children:l&&n&&Si(Xp,{children:[lt(di,{}),lt(pi,{})]})}),lt(Kp,{bareModal:t,variant:"ghost",onClick:e,children:lt(Ai,{icon:"close"})})]})},Vp=wo.div`
|
|
520
|
+
position: absolute;
|
|
521
|
+
width: 100%;
|
|
522
|
+
top: 16px;
|
|
523
|
+
|
|
524
|
+
z-index: 3;
|
|
525
|
+
display: flex;
|
|
526
|
+
align-items: center;
|
|
527
|
+
justify-content: space-between;
|
|
528
|
+
gap: 8px;
|
|
529
|
+
`,$p=wo.div`
|
|
530
|
+
flex: 1;
|
|
531
|
+
display: flex;
|
|
532
|
+
align-items: center;
|
|
533
|
+
justify-content: center;
|
|
534
|
+
gap: 4px;
|
|
535
|
+
`,Kp=wo(Ei)`
|
|
536
|
+
transform: rotate(180deg);
|
|
537
|
+
visibility: ${({bareModal:e})=>e?"hidden":"visible"};
|
|
538
|
+
`,Yp=wo(Ei)`
|
|
539
|
+
transform: rotate(180deg);
|
|
540
|
+
`;import{useEffect as wi,useState as uu}from"react";import{AuthMethod as Ti,OAuthMethod as zp}from"@getpara/web-sdk";import Gn from"styled-components";import{useEffect as Hn,useRef as Qp,useState as $t}from"react";import{HeroSpinner as qp}from"@getpara/react-common";import{CpslSpinner as Zp}from"@getpara/react-components";import{jsx as Wo,jsxs as tu}from"react/jsx-runtime";function Ii(){let e=Qp(),t=b(),o=s(C=>C.setFlow),a=s(C=>C.setStep),n=V(C=>C.setAuthInfo),i=s(C=>C.setBiometricLocationHints),l=s(C=>C.setSupportedAuthMethods),r=s(C=>C.setIFrameUrl),c=s(C=>C.setIsIFrameReady),p=s(C=>C.isIFrameReady),d=s(C=>C.setWebAuthURLForCreate),u=_(C=>C.theme),[A,m]=$t(void 0),[f,S]=$t(!1),[y,D]=$t(!1),[W,E]=$t(!1),[h,R]=$t();return Hn(()=>{h&&p&&setTimeout(()=>{a(h)},200)},[h,p]),Hn(()=>{A||t.getOAuthURL({method:zp.TELEGRAM}).then(C=>{m(C)})},[A]),Hn(()=>{let C=async L=>{switch(L.data.type){case"TELEGRAM_LOGIN":S(!0),E(!1);break;case"TELEGRAM_FAILED":S(!1),E(!0);break;case"TELEGRAM_SUCCESS":if(L.data.payload){let T=L.data.payload,g=await t.verifyTelegram(T);if(!g.isValid){S(!1),E(!0),e.current&&e.current.contentWindow.postMessage({type:"TELEGRAM_FAILED"},"*");return}let{telegramUserId:U,isNewUser:x,supportedAuthMethods:P,biometricHints:K}=g;if(n({telegramUserId:U,pfpUrl:T.photo_url,displayName:T.username?`@${T.username}`:T.first_name?`${T.first_name}${T.last_name?` ${T.last_name}`:""}`:`Telegram User @${U}`}),x){let M=await t.getSupportedCreateAuthMethods();c(!1),o("signUp");let ne=M.has(Ti.PASSKEY);ne&&(d(await t.shortenLoginLink(await t.getSetUpBiometricsURL({authType:"telegram"}))),a("BIOMETRIC_CREATION")),M.has(Ti.PASSWORD)&&(r(await t.shortenLoginLink(await t.getSetupPasswordURL({authType:"telegram",theme:u}))),R(ne?"BIOMETRIC_CREATION":"PASSWORD_CREATION"))}else o("login"),P&&l(new Set(P)),K&&i(K),a("BIOMETRIC_LOGIN")}break}};return window?.addEventListener("message",C,!1),()=>{window?.removeEventListener("message",C,!1)}},[]),tu(Jp,{children:[Wo(jp,{children:Wo(qp,{icon:"telegramBrand",status:f?"loading":W?"error":"inactive",text:f?"Follow the on-screen prompts.":W?"Login Failed":void 0})}),A&&Wo(eu,{ref:e,style:{display:y?"block":"none"},src:A,onLoad:()=>D(!0)}),(!A||!y)&&Wo(Zp,{})]})}var Jp=Gn.div`
|
|
541
|
+
display: flex;
|
|
542
|
+
flex-direction: column;
|
|
543
|
+
align-items: center;
|
|
544
|
+
justify-content: center;
|
|
545
|
+
width: 100%;
|
|
546
|
+
`,jp=Gn.div`
|
|
547
|
+
display: flex;
|
|
548
|
+
min-height: 276px;
|
|
549
|
+
flex-direction: column;
|
|
550
|
+
align-items: center;
|
|
551
|
+
gap: 16px;
|
|
552
|
+
flex: 1;
|
|
553
|
+
`,eu=Gn.iframe`
|
|
554
|
+
width: 100%;
|
|
555
|
+
height: 52px;
|
|
556
|
+
border: none;
|
|
557
|
+
`;import{jsx as ou}from"react/jsx-runtime";var gi=()=>{let e=s(t=>t.isLogin());return ou(Ye,{heading:e?"Waiting for Password":"Creating Password",subheading:"Follow the prompts presented by your browser."})};import yi from"styled-components";import{SpinnerContainer as nu}from"@getpara/react-common";import{CpslSpinner as ru}from"@getpara/react-components";import{jsx as _o,jsxs as su}from"react/jsx-runtime";var xi=()=>{let e=s(i=>i.iFrameUrl),t=s(i=>i.setIsIFrameReady),o=s(i=>i.isIFrameReady),a=s(i=>i.step),n=_(i=>i.embeddedModal);return su(au,{$isVisible:Lt.includes(a),$embeddedModal:n,children:[_o(iu,{$isReady:o,children:_o("iframe",{src:e,onLoad:()=>{t(!0)}})}),!o&&_o(nu,{style:{width:"100%",height:"100%",flex:1},children:_o(ru,{size:100})})]})},au=yi.div`
|
|
558
|
+
height: ${({$isVisible:e})=>e?"100%":"0px"};
|
|
559
|
+
width: ${({$isVisible:e})=>e?"100%":"0px"};
|
|
560
|
+
flex: ${({$isVisible:e})=>e?1:"auto"};
|
|
561
|
+
padding: ${({$embeddedModal:e,$isVisible:t})=>t?e?"12px 0px 0px":"72px 72px 32px":"0px"};
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
justify-content: center;
|
|
565
|
+
|
|
566
|
+
@media (max-width: ${ze}px) {
|
|
567
|
+
padding: ${({$embeddedModal:e,$isVisible:t})=>t?e?"12px 0px 0px":"72px 16px 0px":"0px"};
|
|
568
|
+
}
|
|
569
|
+
`,iu=yi.div`
|
|
570
|
+
height: 100%;
|
|
571
|
+
width: 100%;
|
|
572
|
+
display: ${({$isReady:e})=>e?"block":"none"};
|
|
573
|
+
|
|
574
|
+
& > iframe {
|
|
575
|
+
height: 360px;
|
|
576
|
+
width: 100%;
|
|
577
|
+
border: none;
|
|
578
|
+
}
|
|
579
|
+
`;import{Fragment as Iu,jsx as k,jsxs as wt}from"react/jsx-runtime";var Wi={ADD_FUNDS_AWAITING:"680px"},_i={TELEGRAM_OAUTH:"36px"},mu={TELEGRAM_OAUTH:"16px"},Ri=({oAuthMethods:e,twoFactorAuthEnabled:t,disableEmailLogin:o,disablePhoneLogin:a,onClose:n,createAccountWithPasskey:i,createAccountWithPassword:l})=>{let r=s(W=>W.step),c=s(W=>W.onRampConfig),p=s(W=>W.stepDirection),d=s(W=>W.setStepDirection),u=s(W=>W.accountAddFundTab),A=s(W=>W.setAccountAddFundTab),m=_(W=>W.appName),f=_(W=>W.embeddedModal),[S,y]=uu(c?.testMode),D=()=>{switch(r){case"AUTH_MAIN":return k(Ua,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"EX_WALLET_MORE":return k(fo,{});case"AUTH_MORE":return k(To,{oAuthMethods:e,disableEmailLogin:o,disablePhoneLogin:a});case"VERIFICATIONS":return k(ir,{});case"BIOMETRIC_LOGIN":return k(lr,{});case"SETUP_2FA":case"VERIFY_2FA":return k(ur,{onClose:n});case"LOGIN_DONE":return k(Nr,{onClose:n});case"AWAITING_BIOMETRIC_LOGIN":case"AWAITING_BIOMETRIC_CREATION":return k(br,{});case"AWAITING_PASSWORD_LOGIN":case"AWAITING_PASSWORD_CREATION":return k(gi,{});case"AWAITING_WALLET_CREATION":return k(Ur,{});case"WALLET_CREATION_DONE":return k(Fr,{twoFactorAuthEnabled:t,onClose:n});case"SECRET":return k(Gr,{});case"TWO_FACTOR_DONE":return k(Vr,{onClose:n});case"BIOMETRIC_CREATION":return k(Yr,{handlePasswordClick:l,handlePasskeyClick:i});case"AWAITING_OAUTH":return k(Xr,{});case"FARCASTER_OAUTH":return k(Aa,{});case"TELEGRAM_OAUTH":return k(Ii,{});case"ADD_FUNDS_BUY":case"ADD_FUNDS_RECEIVE":case"ADD_FUNDS_WITHDRAW":return k(pa,{});case"ADD_FUNDS_AWAITING":return k(ma,{});case"ADD_FUNDS_SUCCESS":return k(Tn,{isSuccess:!0,onClose:n});case"ADD_FUNDS_FAILURE":return k(Tn,{onClose:n});case"ACCOUNT_MAIN":return k(ka,{onClose:n});case"EX_WALLET_SELECTED":return k(Xa,{});case"CHAIN_SWITCH":return k(oi,{});default:if(Lt.includes(r))return null}};return wi(()=>{!S&&c?.testMode&&y(!0)},[c?.testMode]),wi(()=>{switch(r){case"ADD_FUNDS_BUY":A(Ro.BUY);break;case"ADD_FUNDS_RECEIVE":A(Ro.RECEIVE);break;case"ADD_FUNDS_WITHDRAW":A(Ro.WITHDRAW);break;default:break}},[r]),wt(Cu,{slot:"body","data-testid":"modal-content",children:[!f&&wt(Iu,{children:[k(hi,{onClose:n}),k(Ea,{})]}),wt(fu,{children:[k(pu,{mode:"popLayout",initial:!1,onExitComplete:()=>{d(1)},custom:p,children:wt(Au,{custom:p,variants:ro,initial:"enter",animate:"center",exit:"exit",transition:ao,children:[k(qa,{}),wt(Su,{$embeddedModal:f,$step:r,$isIFrameStep:Lt.includes(r),children:[D(),c?.testMode&&["ADD_FUNDS_BUY","ADD_FUNDS_WITHDRAW","ADD_FUNDS_AWAITING","ADD_FUNDS_FAILURE","ADD_FUNDS_SUCCESS"].includes(r)&&S&&u!==Ro.RECEIVE&&k(Eu,{children:wt("div",{style:{fontSize:"14px"},children:["This Para Modal is configured to run on-ramp services in ",k("b",{children:"test mode"})," only, for development purposes. If you are a user of ",m,", please contact support.",k(hu,{onClick:()=>y(!1),children:k(Tu,{icon:"x"})})]})})]})]},["ADD_FUNDS_BUY","ADD_FUNDS_RECEIVE","ADD_FUNDS_WITHDRAW"].includes(r)?"ADD_FUNDS":r)}),k(xi,{})]})]})},Cu=ct.div`
|
|
580
|
+
position: relative;
|
|
581
|
+
`,fu=ct(Ja)`
|
|
582
|
+
margin-top: -16px;
|
|
583
|
+
`,Au=ct(du.div)`
|
|
584
|
+
position: relative;
|
|
585
|
+
display: flex;
|
|
586
|
+
flex-direction: column;
|
|
587
|
+
gap: 24px;
|
|
588
|
+
will-change: auto !important;
|
|
589
|
+
`,Su=ct.div`
|
|
590
|
+
z-index: 1;
|
|
591
|
+
flex: 1;
|
|
592
|
+
display: flex;
|
|
593
|
+
flex-direction: column;
|
|
594
|
+
justify-content: flex-start;
|
|
595
|
+
gap: 24px;
|
|
596
|
+
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${_i[t]??"72px"} 72px ${mu[t]??"32px"}`};
|
|
597
|
+
min-height: ${({$step:e})=>Wi[e]??"auto"};
|
|
598
|
+
height: ${({$step:e})=>Wi[e]??"auto"};
|
|
599
|
+
|
|
600
|
+
@media (max-width: ${ze}px) {
|
|
601
|
+
padding: ${({$embeddedModal:e,$step:t,$isIFrameStep:o})=>o?"0px":e?"12px 0px 0px":`${_i[t]??"72px"} 16px 0px`};
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
cpsl-auth-modal.force-mobile-media & {
|
|
605
|
+
padding: 72px 16px 0px;
|
|
606
|
+
}
|
|
607
|
+
`,Eu=ct(lu)`
|
|
608
|
+
--container-padding-end: 40px;
|
|
609
|
+
position: absolute;
|
|
610
|
+
bottom: 16px;
|
|
611
|
+
left: 16px;
|
|
612
|
+
right: 16px;
|
|
613
|
+
z-index: 1000;
|
|
614
|
+
`,hu=ct.button`
|
|
615
|
+
background-color: transparent;
|
|
616
|
+
border: none;
|
|
617
|
+
padding: 4px;
|
|
618
|
+
cursor: pointer;
|
|
619
|
+
position: absolute;
|
|
620
|
+
top: 0;
|
|
621
|
+
right: 0;
|
|
622
|
+
`,Tu=ct(cu)`
|
|
623
|
+
--icon-color: var(--cpsl-color-foreground-0);
|
|
624
|
+
`;import{styled as Be}from"styled-components";import{CpslButton as gu,CpslIcon as Mi,CpslText as yu}from"@getpara/react-components";import{useMemo as xu}from"react";import{Fragment as Nu,jsx as ve,jsxs as Kt}from"react/jsx-runtime";var Oi=()=>{let e=s(n=>n.isAccount()),t=s(n=>n.step),o=e||Qn(t),a=xu(()=>e?Kt(Ru,{children:[Kt(Mu,{variant:"bodyS",color:"secondary",weight:"medium",children:["Access all your wallet\u2019s features at"," ",ve("a",{href:un,target:"blank",children:ve(Li,{variant:"bodyS",weight:"medium",children:"Para Connect"})})]}),ve(gu,{as:"a",href:un,target:"blank",variant:"ghost",children:ve(Lu,{icon:"chevronUp"})})]}):Kt(Nu,{children:[Kt(Lo,{variant:"body2XS",color:"secondary",weight:"medium",children:["By logging in you agree to our"," ",ve("a",{href:zr,target:"blank",children:ve(Li,{variant:"body2XS",weight:"medium",children:"Terms & Conditions"})})]}),Kt(_u,{children:[ve(Lo,{variant:"bodyS",color:"secondary",weight:"medium",children:"Powered by"}),ve(Ou,{icon:"para"})]})]}),[e]);return o?ve(wu,{slot:"footer",children:ve(Wu,{children:a})}):null},wu=Be.div`
|
|
625
|
+
display: flex;
|
|
626
|
+
flex-direction: column;
|
|
627
|
+
align-items: center;
|
|
628
|
+
gap: 16px;
|
|
629
|
+
padding: 8px 0px;
|
|
630
|
+
`,Wu=Be.div`
|
|
631
|
+
display: flex;
|
|
632
|
+
flex-direction: column;
|
|
633
|
+
align-items: center;
|
|
634
|
+
gap: 8px;
|
|
635
|
+
`,_u=Be.div`
|
|
636
|
+
display: flex;
|
|
637
|
+
gap: 5px;
|
|
638
|
+
align-items: center;
|
|
639
|
+
justify-content: center;
|
|
640
|
+
`,Ru=Be.div`
|
|
641
|
+
display: flex;
|
|
642
|
+
gap: 8px;
|
|
643
|
+
align-items: center;
|
|
644
|
+
justify-content: center;
|
|
645
|
+
`,Lu=Be(Mi)`
|
|
646
|
+
transform: rotate(90deg);
|
|
647
|
+
|
|
648
|
+
/* --icon-color: var(--cpsl-color-text-tertiary); */
|
|
649
|
+
--height: 24px;
|
|
650
|
+
--width: 24px;
|
|
651
|
+
`,Lo=Be(yu)`
|
|
652
|
+
text-align: center;
|
|
653
|
+
display: inline-block;
|
|
654
|
+
`,Mu=Be(Lo)`
|
|
655
|
+
line-height: 20px;
|
|
656
|
+
`,Li=Be(Lo)`
|
|
657
|
+
cursor: pointer;
|
|
658
|
+
display: inline-block;
|
|
659
|
+
`,Ou=Be(Mi)`
|
|
660
|
+
display: inline-block;
|
|
661
|
+
--icon-color: var(--cpsl-color-text-secondary);
|
|
662
|
+
--width: 49px;
|
|
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)`
|
|
665
|
+
${({$embeddedModal:e})=>e&&`
|
|
666
|
+
&::part(modal-body-card) {
|
|
667
|
+
--card-box-shadow: none;
|
|
668
|
+
--card-border-width: 0px;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
&::part(modal-footer) {
|
|
672
|
+
--card-box-shadow: none;
|
|
673
|
+
--card-border-width: 0px;
|
|
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 qw(e){return e?(pm(e),um(e),!0):!1}export*from"@getpara/web-sdk";import mm from"@getpara/web-sdk";var cW=mm;export{jn as AuthLayout,vo as CosmosWallet,Oo as EvmWallet,ew as ExternalWallet,Ve as ModalStep,Cn as NETWORKS,fn as ON_RAMP_ASSETS,mn as ON_RAMP_PROVIDERS,Bo as OnRampConfigError,Xw as ParaModal,cl as ParaProvider,Hr as SaveRecoverySecret,No as SolanaWallet,cW as default,Yl as getAssetIcon,Kl as getAssetName,RS as getClient,LS as getIsOpen,$l as getNetworkIcon,bt as getNetworkName,MS as getSelectedWalletId,OS as getSelectedWalletType,je as openPopup,en as useAccount,$s as useCheckIfUserExists,B 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,qw as validateOnRampConfig};
|