@getpara/react-sdk-lite 2.11.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/modal.css +0 -3
- package/dist/index.d.ts +1 -0
- package/dist/modal/ParaModal.js +57 -98
- package/dist/modal/components/Body/Body.d.ts +1 -2
- package/dist/modal/components/Body/Body.js +119 -231
- package/dist/modal/components/Controls/ChainSelect.js +3 -4
- package/dist/modal/components/Controls/Controls.js +2 -4
- package/dist/modal/components/Footer/Footer.js +3 -12
- package/dist/modal/components/Header/Header.js +13 -14
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +1 -1
- package/dist/modal/components/Header/hooks/useStepTitle.js +88 -71
- package/dist/modal/components/ModalContent/ModalContent.d.ts +1 -1
- package/dist/modal/components/ModalContent/ModalContent.js +6 -14
- package/dist/modal/components/OnRampComponents/AddingFunds.js +2 -2
- package/dist/modal/components/WalletCard/WalletCard.js +9 -9
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +13 -18
- package/dist/modal/components/common.d.ts +5 -0
- package/dist/modal/components/common.js +17 -10
- package/dist/modal/components/{Account → flows/account/Account}/Account.js +30 -27
- package/dist/modal/components/{Account/AccountHeader.d.ts → flows/account/Account/Header.d.ts} +1 -1
- package/dist/modal/components/{Account/AccountHeader.js → flows/account/Account/Header.js} +8 -8
- package/dist/modal/components/{Account/AccountWalletSelect.d.ts → flows/account/Account/WalletSelect.d.ts} +1 -1
- package/dist/modal/components/{Account/AccountWalletSelect.js → flows/account/Account/WalletSelect.js} +17 -22
- package/dist/modal/components/flows/account/AccountFlow/AccountFlow.d.ts +12 -0
- package/dist/modal/components/flows/account/AccountFlow/AccountFlow.js +126 -0
- package/dist/modal/components/flows/account/AccountProvider/AccountContext.d.ts +11 -0
- package/dist/modal/components/flows/account/AccountProvider/AccountContext.js +42 -0
- package/dist/modal/components/flows/account/AccountProvider/AccountProvider.d.ts +4 -0
- package/dist/modal/components/flows/account/AccountProvider/AccountProvider.js +110 -0
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFunds.js +12 -12
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsAsset.js +3 -3
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsAwaiting.js +7 -8
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsContext.d.ts +1 -1
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsContext.js +11 -11
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsDone.js +8 -9
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsNetwork.js +2 -2
- package/dist/modal/components/flows/account/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsProvider.js +13 -12
- package/dist/modal/components/flows/account/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsReceive.js +10 -10
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsSettings.js +10 -10
- package/dist/modal/components/{AddFunds → flows/account/AddFunds}/MoonPayEmbed.js +1 -1
- package/dist/modal/components/flows/account/AddFunds/utils.d.ts +3 -0
- package/dist/modal/components/flows/account/AddFunds/utils.js +16 -0
- package/dist/modal/components/{ChainSwitch → flows/account/ChainSwitch}/ChainSwitch.js +7 -10
- package/dist/modal/components/{ChainSwitch → flows/account/ChainSwitch}/config.js +1 -1
- package/dist/modal/components/{Account → flows/account/Profile}/AccountMonitorTx.js +13 -13
- package/dist/modal/components/flows/account/Profile/FarcasterLink.d.ts +2 -0
- package/dist/modal/components/{OAuth → flows/account/Profile}/FarcasterLink.js +6 -6
- package/dist/modal/components/{Account/AccountProfile.d.ts → flows/account/Profile/Profile.d.ts} +1 -1
- package/dist/modal/components/{Account/AccountProfile.js → flows/account/Profile/Profile.js} +20 -24
- package/dist/modal/components/{Account/AccountProfileEntry.js → flows/account/Profile/ProfileEntry.js} +13 -15
- package/dist/modal/components/flows/account/Profile/ProfileLink.d.ts +1 -0
- package/dist/modal/components/{Account/AccountProfileLink.js → flows/account/Profile/ProfileLink.js} +19 -34
- package/dist/modal/components/flows/account/Profile/ProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/{Account/AccountProfileLinkOptions.js → flows/account/Profile/ProfileLinkOptions.js} +11 -11
- package/dist/modal/components/flows/account/Profile/ProfileUnlink.d.ts +1 -0
- package/dist/modal/components/{Account/AccountProfileUnlink.js → flows/account/Profile/ProfileUnlink.js} +6 -6
- package/dist/modal/{hooks/useTelegramLogin.d.ts → components/flows/account/Profile/useTelegramLink.d.ts} +1 -5
- package/dist/modal/{hooks/useTelegramLogin.js → components/flows/account/Profile/useTelegramLink.js} +16 -23
- package/dist/modal/components/{Account/AccountSend → flows/account/Send}/AssetNetwork.js +1 -1
- package/dist/modal/components/flows/account/Send/SendAsset.d.ts +1 -0
- package/dist/modal/components/{Account/AccountSend/AccountSendAsset.js → flows/account/Send/SendAsset.js} +11 -12
- package/dist/modal/components/flows/account/Send/SendForm.d.ts +1 -0
- package/dist/modal/components/{Account/AccountSend/AccountSendForm.js → flows/account/Send/SendForm.js} +15 -16
- package/dist/modal/components/flows/account/Send/SendNetwork.d.ts +1 -0
- package/dist/modal/components/{Account/AccountSend/AccountSendNetwork.js → flows/account/Send/SendNetwork.js} +9 -10
- package/dist/modal/components/flows/account/Send/SendNoAssets.d.ts +1 -0
- package/dist/modal/components/{Account/AccountSend/AccountSendNoAssets.js → flows/account/Send/SendNoAssets.js} +8 -9
- package/dist/modal/components/{Account/AccountSend → flows/account/Send}/context.js +19 -6
- package/dist/modal/components/{Account/AccountSend → flows/account/Send}/index.js +11 -11
- package/dist/modal/components/flows/account/SwitchWallets/SwitchWallets.d.ts +1 -0
- package/dist/modal/components/{SwitchWalletsStep/SwitchWalletsStep.js → flows/account/SwitchWallets/SwitchWallets.js} +4 -4
- package/dist/modal/components/flows/account/Wallet/Wallet.d.ts +1 -0
- package/dist/modal/components/{Account/AccountWallet.js → flows/account/Wallet/Wallet.js} +12 -18
- package/dist/modal/components/flows/auth/AuthFlow/AuthFlow.d.ts +10 -0
- package/dist/modal/components/flows/auth/AuthFlow/AuthFlow.js +94 -0
- package/dist/modal/components/flows/auth/AuthMain/AuthMain.d.ts +9 -0
- package/dist/modal/components/{AuthMainStep/AuthMainStep.js → flows/auth/AuthMain/AuthMain.js} +10 -21
- package/dist/modal/components/flows/auth/AuthMain/AuthMainContent.d.ts +9 -0
- package/dist/modal/components/{AuthMainStep/AuthMainStepContent.js → flows/auth/AuthMain/AuthMainContent.js} +49 -24
- package/dist/modal/components/flows/auth/AwaitingAccountSetup/AwaitingAccountSetup.d.ts +1 -0
- package/dist/modal/components/flows/auth/AwaitingAccountSetup/AwaitingAccountSetup.js +31 -0
- package/dist/modal/components/flows/auth/AwaitingBiometrics/AwaitingBiometrics.d.ts +1 -0
- package/dist/modal/components/flows/auth/AwaitingBiometrics/AwaitingBiometrics.js +21 -0
- package/dist/modal/components/flows/auth/AwaitingOAuth/AwaitingOAuth.d.ts +1 -0
- package/dist/modal/components/{AwaitingOAuthStep/AwaitingOAuthStep.js → flows/auth/AwaitingOAuth/AwaitingOAuth.js} +4 -4
- package/dist/modal/components/flows/auth/AwaitingPassword/AwaitingPassword.d.ts +1 -0
- package/dist/modal/components/flows/auth/AwaitingPassword/AwaitingPassword.js +22 -0
- package/dist/modal/components/flows/auth/BiometricCreation/BiometricCreation.d.ts +1 -0
- package/dist/modal/components/{BiometricCreationStep/BiometricCreationStep.js → flows/auth/BiometricCreation/BiometricCreation.js} +25 -22
- package/dist/modal/components/flows/auth/BiometricLogin/BiometricLogin.d.ts +1 -0
- package/dist/modal/components/flows/auth/BiometricLogin/BiometricLogin.js +72 -0
- package/dist/modal/components/flows/auth/LoginDone/LoginDone.d.ts +5 -0
- package/dist/modal/components/{LoginDoneStep/LoginDoneStep.js → flows/auth/LoginDone/LoginDone.js} +9 -13
- package/dist/modal/components/{OAuth → flows/auth/OAuth}/OAuth.js +15 -23
- package/dist/modal/components/{RecoverySecretStep → flows/auth/RecoverySecretStep}/RecoverySecretStep.js +9 -11
- package/dist/modal/components/flows/auth/Setup2FA/Setup2FA.d.ts +5 -0
- package/dist/modal/components/{Setup2FAStep/Setup2FAStep.js → flows/auth/Setup2FA/Setup2FA.js} +42 -19
- package/dist/modal/components/flows/auth/Verification/Verification.d.ts +1 -0
- package/dist/modal/components/flows/auth/Verification/Verification.js +36 -0
- package/dist/modal/components/flows/auth/WalletCreationDone/WalletCreationDone.d.ts +6 -0
- package/dist/modal/components/{WalletCreationDoneStep/WalletCreationDoneStep.js → flows/auth/WalletCreationDone/WalletCreationDone.js} +19 -46
- package/dist/modal/components/{AuthOptions → shared}/AuthOptions.d.ts +2 -2
- package/dist/modal/components/{AuthOptions → shared}/AuthOptions.js +18 -15
- package/dist/modal/components/{ExternalWalletStep/ExternalWalletStep.d.ts → shared/ConnectExternalWallet/ConnectExternalWallet.d.ts} +1 -1
- package/dist/modal/components/{ExternalWalletStep/ExternalWalletStep.js → shared/ConnectExternalWallet/ConnectExternalWallet.js} +17 -37
- package/dist/modal/components/{ExternalWalletStep → shared/ConnectExternalWallet}/config.js +1 -1
- package/dist/modal/components/{AuthInput/AuthInput.d.ts → shared/EmailOrPhone/EmailOrPhoneInput.d.ts} +4 -4
- package/dist/modal/components/{AuthInput/AuthInput.js → shared/EmailOrPhone/EmailOrPhoneInput.js} +14 -10
- package/dist/modal/components/{AuthInput → shared/EmailOrPhone}/phoneMasks.js +1 -1
- package/dist/modal/components/{ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts → shared/ExternalWalletNetworkSelect.d.ts} +1 -1
- package/dist/modal/components/{ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js → shared/ExternalWalletNetworkSelect.js} +9 -9
- package/dist/modal/components/{ExternalWallets → shared}/ExternalWallets.js +17 -12
- package/dist/modal/components/shared/IFrame.d.ts +1 -0
- package/dist/modal/components/shared/IFrame.js +87 -0
- package/dist/modal/components/{VerificationCodeStep/VerificationCodeStep.d.ts → shared/VerificationCode.d.ts} +3 -4
- package/dist/modal/components/{VerificationCodeStep/VerificationCodeStep.js → shared/VerificationCode.js} +4 -28
- package/dist/modal/components/shared/VerifyExternalWallet.d.ts +1 -0
- package/dist/modal/components/{ExternalWalletVerificationStep/ExternalWalletVerificationStep.js → shared/VerifyExternalWallet.js} +10 -17
- package/dist/modal/hooks/index.d.ts +1 -2
- package/dist/modal/hooks/index.js +1 -2
- package/dist/modal/hooks/useAuthView.d.ts +4 -0
- package/dist/modal/hooks/useAuthView.js +115 -0
- package/dist/modal/hooks/useCanbGoBack.d.ts +3 -0
- package/dist/modal/hooks/useCanbGoBack.js +47 -0
- package/dist/modal/{components/AuthInput/hooks → hooks}/useDropdownPosition.d.ts +1 -1
- package/dist/modal/hooks/useDropdownPosition.js +41 -0
- package/dist/modal/hooks/useGoBack.d.ts +4 -1
- package/dist/modal/hooks/useGoBack.js +60 -36
- package/dist/modal/hooks/useSendMutations.js +4 -5
- package/dist/modal/hooks/useTransactionMonitoring.js +8 -8
- package/dist/modal/index.d.ts +1 -2
- package/dist/modal/index.js +1 -3
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +0 -1
- package/dist/modal/types/modalProps.d.ts +18 -8
- package/dist/provider/ParaProviderMin.js +34 -38
- package/dist/provider/actions/getWallet.d.ts +1 -1
- package/dist/provider/actions/index.d.ts +43 -49
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/components/CosmosWalletWrapper.js +0 -3
- package/dist/provider/components/EvmWalletWrapper.js +0 -3
- package/dist/provider/components/ExternalWalletWrapper.js +8 -2
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +7 -12
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.d.ts +34 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithEmailOrPhone.js +28 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.d.ts +34 -0
- package/dist/provider/hooks/mutations/useAuthenticateWithOAuth.js +28 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +7 -13
- package/dist/provider/hooks/mutations/useClaimPregenWallets.js +4 -1
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +7 -6
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +6 -3
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +7 -93
- package/dist/provider/hooks/mutations/useCreatePregenWallet.js +4 -1
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +7 -15
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +7 -15
- package/dist/provider/hooks/mutations/useCreateWallet.js +4 -1
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +7 -27
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +7 -12
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +2 -7
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +7 -13
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +7 -21
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +6 -7
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +2 -2
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +7 -25
- package/dist/provider/hooks/mutations/useLoginExternalWallet.js +4 -1
- package/dist/provider/hooks/mutations/useLogout.d.ts +7 -12
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +7 -13
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +4 -1
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +7 -7
- package/dist/provider/hooks/mutations/useSetup2fa.js +2 -2
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +7 -31
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +7 -31
- package/dist/provider/hooks/mutations/useSignTransaction.js +4 -1
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +7 -19
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.js +4 -1
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +7 -30
- package/dist/provider/hooks/mutations/useSwitchWallets.js +4 -1
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +7 -15
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.js +4 -1
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +7 -30
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +7 -19
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.js +4 -1
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +7 -31
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +4 -1
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +7 -66
- package/dist/provider/hooks/mutations/useVerifyNewAccount.js +4 -1
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +7 -37
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +7 -22
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +7 -30
- package/dist/provider/hooks/mutations/useWaitForLogin.js +4 -1
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +7 -18
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +7 -27
- package/dist/provider/hooks/mutations/utils.js +1 -1
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +4 -1
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +6 -1
- package/dist/provider/hooks/queries/useLinkedAccounts.d.ts +2 -4
- package/dist/provider/hooks/queries/useParaStatus.d.ts +0 -1
- package/dist/provider/hooks/queries/useParaStatus.js +0 -2
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +0 -7
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +1 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +9 -5
- package/dist/provider/hooks/utils/useModal.d.ts +4 -3
- package/dist/provider/hooks/utils/useModal.js +17 -9
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
- package/dist/provider/hooks/utils/useWalletState.js +14 -6
- package/dist/provider/providers/AccountLinkProvider.js +21 -19
- package/dist/provider/providers/AuthProvider/AuthContext.d.ts +19 -0
- package/dist/provider/providers/AuthProvider/AuthContext.js +35 -0
- package/dist/provider/providers/AuthProvider/AuthProvider.d.ts +9 -0
- package/dist/provider/providers/AuthProvider/AuthProvider.js +261 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +12 -4
- package/dist/provider/providers/ExternalWalletProvider.js +285 -283
- package/dist/provider/stores/getters.d.ts +1 -1
- package/dist/provider/stores/getters.js +5 -5
- package/dist/provider/stores/setters.js +2 -2
- package/dist/provider/stores/slices/accountFlow.d.ts +3 -0
- package/dist/provider/stores/slices/accountFlow.js +30 -0
- package/dist/provider/stores/slices/authFlow.d.ts +3 -0
- package/dist/provider/stores/slices/authFlow.js +63 -0
- package/dist/provider/stores/slices/externalWallets.js +10 -0
- package/dist/provider/stores/slices/index.d.ts +4 -0
- package/dist/provider/stores/slices/index.js +4 -0
- package/dist/provider/stores/slices/modal.js +8 -2
- package/dist/provider/stores/slices/onRamp.d.ts +3 -0
- package/dist/provider/stores/slices/onRamp.js +20 -0
- package/dist/provider/stores/slices/paraState.d.ts +3 -0
- package/dist/provider/stores/slices/paraState.js +9 -0
- package/dist/provider/stores/types.d.ts +117 -5
- package/dist/provider/stores/types.js +9 -0
- package/dist/provider/stores/useStore.d.ts +5 -3
- package/dist/provider/stores/useStore.js +15 -8
- package/package.json +8 -8
- package/dist/modal/components/Account/AccountProfileLink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +0 -1
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +0 -1
- package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +0 -1
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +0 -1
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +0 -1
- package/dist/modal/components/Account/AccountWallet.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +0 -1
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +0 -9
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.d.ts +0 -1
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +0 -21
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +0 -1
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +0 -1
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +0 -1
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -21
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +0 -5
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -24
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -67
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +0 -1
- package/dist/modal/components/Hero/Hero.d.ts +0 -1
- package/dist/modal/components/Hero/Hero.js +0 -118
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +0 -1
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -83
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +0 -5
- package/dist/modal/components/OAuth/FarcasterLink.d.ts +0 -2
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +0 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -53
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +0 -8
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -91
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +0 -5
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +0 -1
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +0 -5
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -27
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +0 -6
- package/dist/modal/hooks/useFarcasterLogin.d.ts +0 -9
- package/dist/modal/hooks/useFarcasterLogin.js +0 -77
- package/dist/modal/stores/modal/actions.d.ts +0 -3
- package/dist/modal/stores/modal/actions.js +0 -146
- package/dist/modal/stores/modal/useModalStore.d.ts +0 -119
- package/dist/modal/stores/modal/useModalStore.js +0 -80
- package/dist/modal/utils/steps.d.ts +0 -162
- package/dist/modal/utils/steps.js +0 -335
- package/dist/provider/providers/AuthProvider.d.ts +0 -43
- package/dist/provider/providers/AuthProvider.js +0 -777
- /package/dist/modal/components/{Account → flows/account/Account}/Account.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFunds.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsAsset.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsAwaiting.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsDone.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsNetwork.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/AddFundsSettings.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/MoonPayEmbed.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/index.d.ts +0 -0
- /package/dist/modal/components/{AddFunds → flows/account/AddFunds}/index.js +0 -0
- /package/dist/modal/components/{ChainSwitch → flows/account/ChainSwitch}/ChainSwitch.d.ts +0 -0
- /package/dist/modal/components/{ChainSwitch → flows/account/ChainSwitch}/config.d.ts +0 -0
- /package/dist/modal/components/{Account → flows/account/Profile}/AccountMonitorTx.d.ts +0 -0
- /package/dist/modal/components/{Account/AccountProfileEntry.d.ts → flows/account/Profile/ProfileEntry.d.ts} +0 -0
- /package/dist/modal/components/{Account/AccountSend → flows/account/Send}/AssetNetwork.d.ts +0 -0
- /package/dist/modal/components/{Account/AccountSend → flows/account/Send}/context.d.ts +0 -0
- /package/dist/modal/components/{Account/AccountSend → flows/account/Send}/index.d.ts +0 -0
- /package/dist/modal/components/{OAuth → flows/auth/OAuth}/OAuth.d.ts +0 -0
- /package/dist/modal/components/{RecoverySecretStep → flows/auth/RecoverySecretStep}/RecoverySecretStep.d.ts +0 -0
- /package/dist/modal/components/{ExternalWalletStep → shared/ConnectExternalWallet}/config.d.ts +0 -0
- /package/dist/modal/components/{AuthInput → shared/EmailOrPhone}/phoneMasks.d.ts +0 -0
- /package/dist/modal/components/{ExternalWallets → shared}/ExternalWallets.d.ts +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../../../chunk-MMUBH76A.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { useEffect, useMemo, useRef } from "react";
|
|
5
|
-
import { useInternalClient } from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
|
|
7
|
+
import { useInternalClient } from "../../../../../provider/hooks/utils/useInternalClient.js";
|
|
8
|
+
import { getExternalWalletIcon, safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
9
|
+
import { useAccount, useWallet, useWalletState } from "../../../../../provider/index.js";
|
|
9
10
|
import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
|
|
10
11
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
12
|
+
import { useDropdownPosition } from "../../../../hooks/useDropdownPosition.js";
|
|
13
|
+
import { getMobilePopoverPositionCSS } from "../../../common.js";
|
|
11
14
|
const getValue = (id, type) => {
|
|
12
15
|
return id && type ? `${id}~${type}` : void 0;
|
|
13
16
|
};
|
|
@@ -62,7 +65,7 @@ const Wallet = ({
|
|
|
62
65
|
)
|
|
63
66
|
] });
|
|
64
67
|
};
|
|
65
|
-
const
|
|
68
|
+
const WalletSelect = () => {
|
|
66
69
|
var _a, _b, _c;
|
|
67
70
|
const containerRef = useRef(null);
|
|
68
71
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
@@ -79,20 +82,19 @@ const AccountWalletSelect = () => {
|
|
|
79
82
|
resize();
|
|
80
83
|
}
|
|
81
84
|
}, [activeWallet, availableWallets, dropdownMaxHeight]);
|
|
82
|
-
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef,
|
|
85
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, children: /* @__PURE__ */ jsxs(
|
|
83
86
|
Select,
|
|
84
87
|
{
|
|
85
88
|
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
86
|
-
onCpslSelectValueChange: (e) => {
|
|
89
|
+
onCpslSelectValueChange: (e) => __async(void 0, null, function* () {
|
|
87
90
|
const [id, type] = e.detail.split("~");
|
|
88
|
-
setSelectedWallet({ id, type });
|
|
89
|
-
},
|
|
91
|
+
yield setSelectedWallet({ id, type });
|
|
92
|
+
}),
|
|
90
93
|
showFormattedSelectedItem: true,
|
|
91
94
|
placeholder: "Choose wallet...",
|
|
92
|
-
anchorElId: "addressInputContainer",
|
|
93
95
|
dropdownMaxHeight,
|
|
94
96
|
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
95
|
-
$top:
|
|
97
|
+
$top: mobileAnchor != null ? mobileAnchor : void 0,
|
|
96
98
|
selectedItemVariant: "bodyXS",
|
|
97
99
|
icon: isMultiWallet ? "chevronUp" : null,
|
|
98
100
|
disabled: !isMultiWallet,
|
|
@@ -148,14 +150,7 @@ const Select = safeStyled(CpslSelect)`
|
|
|
148
150
|
|
|
149
151
|
&::part(popover) {
|
|
150
152
|
/* 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 */
|
|
151
|
-
|
|
152
|
-
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
153
|
-
bottom: 16px;
|
|
154
|
-
}
|
|
155
|
-
cpsl-auth-modal.force-mobile-media & {
|
|
156
|
-
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
157
|
-
bottom: 16px;
|
|
158
|
-
}
|
|
153
|
+
${({ $top }) => getMobilePopoverPositionCSS($top)}
|
|
159
154
|
}
|
|
160
155
|
|
|
161
156
|
&::part(icon) {
|
|
@@ -195,8 +190,8 @@ const CopyButton = safeStyled(CpslButton)`
|
|
|
195
190
|
}
|
|
196
191
|
`;
|
|
197
192
|
export {
|
|
198
|
-
AccountWalletSelect,
|
|
199
193
|
Select,
|
|
200
194
|
SelectContainer,
|
|
201
|
-
SelectItem
|
|
195
|
+
SelectItem,
|
|
196
|
+
WalletSelect
|
|
202
197
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TOAuthMethod } from '@getpara/web-sdk';
|
|
2
|
+
interface AccountFlowProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onDisconnect: () => void;
|
|
5
|
+
isDisconnecting: boolean;
|
|
6
|
+
oAuthMethods?: TOAuthMethod[];
|
|
7
|
+
disableEmailLogin: boolean;
|
|
8
|
+
disablePhoneLogin: boolean;
|
|
9
|
+
isGuestModeEnabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const AccountFlow: (props: AccountFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useMemo } from "react";
|
|
7
|
+
import { Account } from "../Account/Account.js";
|
|
8
|
+
import { AccountProvider } from "../AccountProvider/AccountProvider.js";
|
|
9
|
+
import { useStore } from "../../../../../provider/stores/useStore.js";
|
|
10
|
+
import { Profile } from "../Profile/Profile.js";
|
|
11
|
+
import { Wallet } from "../Wallet/Wallet.js";
|
|
12
|
+
import { ProfileLink } from "../Profile/ProfileLink.js";
|
|
13
|
+
import { ProfileLinkOptions } from "../Profile/ProfileLinkOptions.js";
|
|
14
|
+
import { ProfileUnlink } from "../Profile/ProfileUnlink.js";
|
|
15
|
+
import { AccountSend } from "../Send/index.js";
|
|
16
|
+
import { AddFunds } from "../AddFunds/AddFunds.js";
|
|
17
|
+
import { AddFundsAwaiting } from "../AddFunds/AddFundsAwaiting.js";
|
|
18
|
+
import { AddFundsDone } from "../AddFunds/AddFundsDone.js";
|
|
19
|
+
import { ExternalWallets } from "../../../shared/ExternalWallets.js";
|
|
20
|
+
import { ExternalWalletNetworkSelect } from "../../../shared/ExternalWalletNetworkSelect.js";
|
|
21
|
+
import { ChainSwitch } from "../ChainSwitch/ChainSwitch.js";
|
|
22
|
+
import { ConnectExternalWallet } from "../../../shared/ConnectExternalWallet/ConnectExternalWallet.js";
|
|
23
|
+
import { SwitchWallet } from "../SwitchWallets/SwitchWallets.js";
|
|
24
|
+
import { AuthOptions } from "../../../shared/AuthOptions.js";
|
|
25
|
+
import { AccountMonitorTx } from "../Profile/AccountMonitorTx.js";
|
|
26
|
+
const AccountFlowContent = ({
|
|
27
|
+
onDisconnect,
|
|
28
|
+
isDisconnecting,
|
|
29
|
+
onClose,
|
|
30
|
+
oAuthMethods,
|
|
31
|
+
disableEmailLogin,
|
|
32
|
+
disablePhoneLogin,
|
|
33
|
+
isGuestModeEnabled
|
|
34
|
+
}) => {
|
|
35
|
+
const accountView = useStore((state) => state.accountView);
|
|
36
|
+
const selectedComponent = useMemo(() => {
|
|
37
|
+
switch (accountView) {
|
|
38
|
+
case "ACCOUNT_MAIN": {
|
|
39
|
+
return /* @__PURE__ */ jsx(Account, {});
|
|
40
|
+
}
|
|
41
|
+
case "ACCOUNT_WALLET": {
|
|
42
|
+
return /* @__PURE__ */ jsx(Wallet, {});
|
|
43
|
+
}
|
|
44
|
+
// Profile Views
|
|
45
|
+
case "ACCOUNT_PROFILE": {
|
|
46
|
+
return /* @__PURE__ */ jsx(Profile, { onDisconnect, isDisconnecting });
|
|
47
|
+
}
|
|
48
|
+
case "ACCOUNT_PROFILE_ADD": {
|
|
49
|
+
return /* @__PURE__ */ jsx(ProfileLink, {});
|
|
50
|
+
}
|
|
51
|
+
case "ACCOUNT_PROFILE_LIST": {
|
|
52
|
+
return /* @__PURE__ */ jsx(ProfileLinkOptions, {});
|
|
53
|
+
}
|
|
54
|
+
case "ACCOUNT_PROFILE_REMOVE": {
|
|
55
|
+
return /* @__PURE__ */ jsx(ProfileUnlink, {});
|
|
56
|
+
}
|
|
57
|
+
// External Wallets
|
|
58
|
+
case "ACCOUNT_ADD_EX_WALLET_MORE": {
|
|
59
|
+
return /* @__PURE__ */ jsx(ExternalWallets, { isAddingWallets: true });
|
|
60
|
+
}
|
|
61
|
+
case "ACCOUNT_ADD_EX_WALLET_SELECTED": {
|
|
62
|
+
return /* @__PURE__ */ jsx(ConnectExternalWallet, { isAddingWallets: true });
|
|
63
|
+
}
|
|
64
|
+
case "ACCOUNT_ADD_EX_WALLET_NETWORK_SELECT": {
|
|
65
|
+
return /* @__PURE__ */ jsx(ExternalWalletNetworkSelect, { type: "ADD_EXTERNAL" });
|
|
66
|
+
}
|
|
67
|
+
case "ACCOUNT_LINK_EX_WALLET_NETWORK_SELECT": {
|
|
68
|
+
return /* @__PURE__ */ jsx(ExternalWalletNetworkSelect, { type: "ACCOUNT_LINKING" });
|
|
69
|
+
}
|
|
70
|
+
case "ACCOUNT_CHAIN_SWITCH": {
|
|
71
|
+
return /* @__PURE__ */ jsx(ChainSwitch, {});
|
|
72
|
+
}
|
|
73
|
+
// Send Views
|
|
74
|
+
case "ACCOUNT_SEND": {
|
|
75
|
+
return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_FORM" });
|
|
76
|
+
}
|
|
77
|
+
case "ACCOUNT_SEND_ASSET": {
|
|
78
|
+
return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_ASSET" });
|
|
79
|
+
}
|
|
80
|
+
case "ACCOUNT_SEND_NETWORK": {
|
|
81
|
+
return /* @__PURE__ */ jsx(AccountSend, { step: "SEND_NETWORK" });
|
|
82
|
+
}
|
|
83
|
+
// Add Funds Views
|
|
84
|
+
case "ACCOUNT_ADD_FUNDS_BUY":
|
|
85
|
+
case "ACCOUNT_ADD_FUNDS_WITHDRAW":
|
|
86
|
+
case "ACCOUNT_ADD_FUNDS_RECEIVE": {
|
|
87
|
+
return /* @__PURE__ */ jsx(AddFunds, { "data-testid": "add-funds" });
|
|
88
|
+
}
|
|
89
|
+
case "ACCOUNT_ADD_FUNDS_AWAITING": {
|
|
90
|
+
return /* @__PURE__ */ jsx(AddFundsAwaiting, {});
|
|
91
|
+
}
|
|
92
|
+
case "ACCOUNT_ADD_FUNDS_SUCCESS": {
|
|
93
|
+
return /* @__PURE__ */ jsx(AddFundsDone, { isSuccess: true, onClose });
|
|
94
|
+
}
|
|
95
|
+
case "ACCOUNT_ADD_FUNDS_FAILURE": {
|
|
96
|
+
return /* @__PURE__ */ jsx(AddFundsDone, { onClose });
|
|
97
|
+
}
|
|
98
|
+
// Switch wallet
|
|
99
|
+
case "ACCOUNT_SWITCH_WALLETS": {
|
|
100
|
+
return /* @__PURE__ */ jsx(SwitchWallet, {});
|
|
101
|
+
}
|
|
102
|
+
// Guest Signup
|
|
103
|
+
case "ACCOUNT_GUEST_SIGNUP": {
|
|
104
|
+
return /* @__PURE__ */ jsx(
|
|
105
|
+
AuthOptions,
|
|
106
|
+
{
|
|
107
|
+
oAuthMethods,
|
|
108
|
+
disableEmailLogin,
|
|
109
|
+
disablePhoneLogin,
|
|
110
|
+
isGuestModeEnabled
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
case "ACCOUNT_MONITOR_TX": {
|
|
115
|
+
return /* @__PURE__ */ jsx(AccountMonitorTx, {});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, [accountView, isDisconnecting]);
|
|
119
|
+
return selectedComponent;
|
|
120
|
+
};
|
|
121
|
+
const AccountFlow = (props) => {
|
|
122
|
+
return /* @__PURE__ */ jsx(AccountProvider, { children: /* @__PURE__ */ jsx(AccountFlowContent, __spreadValues({}, props)) });
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
AccountFlow
|
|
126
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type AccountView = 'ACCOUNT_MAIN' | 'ACCOUNT_GUEST_SIGNUP' | 'ACCOUNT_ADD_FUNDS_BUY' | 'ACCOUNT_ADD_FUNDS_RECEIVE' | 'ACCOUNT_ADD_FUNDS_WITHDRAW' | 'ACCOUNT_ADD_FUNDS_AWAITING' | 'ACCOUNT_ADD_FUNDS_SUCCESS' | 'ACCOUNT_ADD_FUNDS_FAILURE' | 'ACCOUNT_CHAIN_SWITCH' | 'ACCOUNT_PROFILE' | 'ACCOUNT_PROFILE_ADD' | 'ACCOUNT_PROFILE_LIST' | 'ACCOUNT_PROFILE_REMOVE' | 'ACCOUNT_WALLET' | 'ACCOUNT_SWITCH_WALLETS' | 'ACCOUNT_SWITCH_WALLETS_IFRAME' | 'ACCOUNT_ADD_EX_WALLET_MORE' | 'ACCOUNT_ADD_EX_WALLET_SELECTED' | 'ACCOUNT_ADD_EX_WALLET_NETWORK_SELECT' | 'ACCOUNT_LINK_EX_WALLET_NETWORK_SELECT' | 'ACCOUNT_SEND' | 'ACCOUNT_SEND_ASSET' | 'ACCOUNT_SEND_NETWORK' | 'ACCOUNT_MONITOR_TX';
|
|
2
|
+
export declare const AccountPreviousView: {
|
|
3
|
+
[key in AccountView]: AccountView | undefined;
|
|
4
|
+
};
|
|
5
|
+
export interface AccountContextValue {
|
|
6
|
+
switchWallets: (authMethod?: string) => void;
|
|
7
|
+
switchWalletsUrl: string | undefined;
|
|
8
|
+
setSwitchWalletsUrl: (_: string) => void;
|
|
9
|
+
isSwitchWalletsPending: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const AccountContext: import("react").Context<AccountContextValue>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
const AccountPreviousView = {
|
|
5
|
+
ACCOUNT_MAIN: void 0,
|
|
6
|
+
ACCOUNT_GUEST_SIGNUP: "ACCOUNT_MAIN",
|
|
7
|
+
ACCOUNT_ADD_FUNDS_BUY: "ACCOUNT_MAIN",
|
|
8
|
+
ACCOUNT_ADD_FUNDS_WITHDRAW: "ACCOUNT_MAIN",
|
|
9
|
+
ACCOUNT_ADD_FUNDS_RECEIVE: "ACCOUNT_MAIN",
|
|
10
|
+
ACCOUNT_ADD_FUNDS_AWAITING: "ACCOUNT_ADD_FUNDS_BUY",
|
|
11
|
+
ACCOUNT_ADD_FUNDS_SUCCESS: "ACCOUNT_MAIN",
|
|
12
|
+
ACCOUNT_ADD_FUNDS_FAILURE: "ACCOUNT_MAIN",
|
|
13
|
+
ACCOUNT_CHAIN_SWITCH: "ACCOUNT_MAIN",
|
|
14
|
+
ACCOUNT_PROFILE: "ACCOUNT_MAIN",
|
|
15
|
+
ACCOUNT_PROFILE_LIST: "ACCOUNT_PROFILE",
|
|
16
|
+
ACCOUNT_PROFILE_ADD: "ACCOUNT_PROFILE_LIST",
|
|
17
|
+
ACCOUNT_PROFILE_REMOVE: "ACCOUNT_PROFILE",
|
|
18
|
+
ACCOUNT_WALLET: "ACCOUNT_PROFILE",
|
|
19
|
+
ACCOUNT_SWITCH_WALLETS: "ACCOUNT_PROFILE",
|
|
20
|
+
ACCOUNT_SWITCH_WALLETS_IFRAME: "ACCOUNT_PROFILE",
|
|
21
|
+
ACCOUNT_ADD_EX_WALLET_MORE: "ACCOUNT_PROFILE",
|
|
22
|
+
ACCOUNT_ADD_EX_WALLET_SELECTED: "ACCOUNT_ADD_EX_WALLET_MORE",
|
|
23
|
+
ACCOUNT_ADD_EX_WALLET_NETWORK_SELECT: "ACCOUNT_ADD_EX_WALLET_MORE",
|
|
24
|
+
ACCOUNT_LINK_EX_WALLET_NETWORK_SELECT: "ACCOUNT_PROFILE_LIST",
|
|
25
|
+
ACCOUNT_SEND: "ACCOUNT_MAIN",
|
|
26
|
+
ACCOUNT_SEND_ASSET: "ACCOUNT_SEND",
|
|
27
|
+
ACCOUNT_SEND_NETWORK: "ACCOUNT_SEND_ASSET",
|
|
28
|
+
ACCOUNT_MONITOR_TX: "ACCOUNT_MAIN"
|
|
29
|
+
};
|
|
30
|
+
const defaultAuthContextValue = {
|
|
31
|
+
switchWallets: () => {
|
|
32
|
+
},
|
|
33
|
+
switchWalletsUrl: void 0,
|
|
34
|
+
setSwitchWalletsUrl: () => {
|
|
35
|
+
},
|
|
36
|
+
isSwitchWalletsPending: false
|
|
37
|
+
};
|
|
38
|
+
const AccountContext = createContext(defaultAuthContextValue);
|
|
39
|
+
export {
|
|
40
|
+
AccountContext,
|
|
41
|
+
AccountPreviousView
|
|
42
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useContext, useState } from "react";
|
|
7
|
+
import { AccountContext } from "./AccountContext.js";
|
|
8
|
+
import { store, useStore } from "../../../../../provider/stores/useStore.js";
|
|
9
|
+
import { openPopup } from "../../../../utils/openPopup.js";
|
|
10
|
+
import { useSwitchWallets } from "../../../../../provider/hooks/mutations/useSwitchWallets.js";
|
|
11
|
+
import { useGoBack } from "../../../../hooks/useGoBack.js";
|
|
12
|
+
import { useWalletState } from "../../../../../provider/index.js";
|
|
13
|
+
import { DEFAULTS } from "../../../../constants/defaults.js";
|
|
14
|
+
const AccountProvider = ({ children }) => {
|
|
15
|
+
const { switchWallets: mutateSwitchWallets } = useSwitchWallets();
|
|
16
|
+
const { goBack } = useGoBack();
|
|
17
|
+
const { updateSelectedWallet } = useWalletState();
|
|
18
|
+
const refs = useStore((state) => state.refs);
|
|
19
|
+
const setAccountView = useStore((state) => state.setAccountView);
|
|
20
|
+
const [switchWalletsUrl, setSwitchWalletsUrl] = useState(void 0);
|
|
21
|
+
const [isSwitchWalletsPending, setIsSwitchWalletsPending] = useState(false);
|
|
22
|
+
const switchWallets = () => {
|
|
23
|
+
if (!switchWalletsUrl) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setIsSwitchWalletsPending(true);
|
|
27
|
+
try {
|
|
28
|
+
setAccountView("ACCOUNT_SWITCH_WALLETS");
|
|
29
|
+
refs.popupWindow.current = openPopup({
|
|
30
|
+
url: switchWalletsUrl,
|
|
31
|
+
target: "ParaSwitchWallets",
|
|
32
|
+
type: "SWITCH_WALLETS",
|
|
33
|
+
current: refs.popupWindow.current
|
|
34
|
+
});
|
|
35
|
+
pollSwitchWallets();
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("Failed to open wallet switching popup:", error);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const pollSwitchWallets = () => {
|
|
41
|
+
if (typeof window !== "undefined") {
|
|
42
|
+
refs.poll.current = {
|
|
43
|
+
action: "login",
|
|
44
|
+
timeout: window == null ? void 0 : window.setTimeout(() => __async(void 0, null, function* () {
|
|
45
|
+
mutateSwitchWallets(
|
|
46
|
+
{
|
|
47
|
+
isCanceled: () => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const currentView = store.getState().accountView;
|
|
50
|
+
const exitedSteps = !!currentView && !["ACCOUNT_SWITCH_WALLETS", "ACCOUNT_SWITCH_WALLETS_IFRAME"].includes(currentView);
|
|
51
|
+
const popupClosed = (_b = (_a = refs.popupWindow.current) == null ? void 0 : _a.closed) != null ? _b : false;
|
|
52
|
+
const isCanceled = exitedSteps || popupClosed;
|
|
53
|
+
if (isCanceled) {
|
|
54
|
+
if (popupClosed && (currentView === "ACCOUNT_SWITCH_WALLETS" || currentView === "ACCOUNT_SWITCH_WALLETS_IFRAME")) {
|
|
55
|
+
goBack();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return isCanceled;
|
|
59
|
+
},
|
|
60
|
+
onPoll: () => {
|
|
61
|
+
var _a;
|
|
62
|
+
const currentView = store.getState().accountView;
|
|
63
|
+
if (currentView === "ACCOUNT_SWITCH_WALLETS" || currentView === "ACCOUNT_SWITCH_WALLETS_IFRAME") {
|
|
64
|
+
if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && ["ACCOUNT_SWITCH_WALLETS", "ACCOUNT_SWITCH_WALLETS_IFRAME"].includes(currentView)) {
|
|
65
|
+
refs.popupWindow.current = null;
|
|
66
|
+
goBack();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
onSuccess: () => __async(void 0, null, function* () {
|
|
73
|
+
yield updateSelectedWallet();
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
setAccountView("ACCOUNT_PROFILE");
|
|
76
|
+
refs.popupWindow.current = null;
|
|
77
|
+
}, 500);
|
|
78
|
+
}),
|
|
79
|
+
onError: () => {
|
|
80
|
+
const currentView = store.getState().accountView;
|
|
81
|
+
if (currentView === "ACCOUNT_SWITCH_WALLETS") {
|
|
82
|
+
goBack();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
onSettled: () => {
|
|
86
|
+
var _a;
|
|
87
|
+
setIsSwitchWalletsPending(false);
|
|
88
|
+
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
89
|
+
refs.poll.current = null;
|
|
90
|
+
refs.popupWindow.current = null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const value = {
|
|
99
|
+
switchWallets,
|
|
100
|
+
switchWalletsUrl,
|
|
101
|
+
setSwitchWalletsUrl,
|
|
102
|
+
isSwitchWalletsPending
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ jsx(AccountContext.Provider, { value, children });
|
|
105
|
+
};
|
|
106
|
+
const useAccountActions = () => useContext(AccountContext);
|
|
107
|
+
export {
|
|
108
|
+
AccountProvider,
|
|
109
|
+
useAccountActions
|
|
110
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { EnabledFlow } from "@getpara/web-sdk";
|
|
5
|
-
import { InnerStepContainer, StepContainer } from "
|
|
5
|
+
import { InnerStepContainer, StepContainer } from "../../../common.js";
|
|
6
6
|
import { CpslIcon, CpslSpinner, CpslTab, CpslTabs } from "@getpara/react-components";
|
|
7
|
-
import { OnRampStep } from "../../stores/index.js";
|
|
8
|
-
import { useModalStore } from "../../stores/modal/useModalStore.js";
|
|
9
7
|
import { useEffect, useMemo } from "react";
|
|
10
|
-
import { getAddFundsStep } from "../../utils/steps.js";
|
|
11
8
|
import { safeStyled } from "@getpara/react-common";
|
|
12
|
-
import { useAccount, useWallet } from "
|
|
9
|
+
import { useAccount, useWallet } from "../../../../../provider/index.js";
|
|
13
10
|
import { AddFundsProvider } from "./AddFundsProvider.js";
|
|
14
11
|
import { AddFundsReceive } from "./AddFundsReceive.js";
|
|
15
12
|
import { AddFundsContextProvider, TABS } from "./AddFundsContext.js";
|
|
16
13
|
import { AnimatePresence } from "framer-motion";
|
|
17
14
|
import { AddFundsSettings } from "./AddFundsSettings.js";
|
|
15
|
+
import { getAddFundsStep } from "./utils.js";
|
|
16
|
+
import { OnRampStep } from "../../../../../provider/stores/types.js";
|
|
17
|
+
import { useStore } from "../../../../../provider/stores/useStore.js";
|
|
18
18
|
const AddFunds = () => {
|
|
19
19
|
var _a;
|
|
20
|
-
const onRampConfig =
|
|
21
|
-
const onRampStep =
|
|
22
|
-
const storedTab =
|
|
23
|
-
const
|
|
24
|
-
const setOnRampPurchase =
|
|
20
|
+
const onRampConfig = useStore((state) => state.onRampConfig);
|
|
21
|
+
const onRampStep = useStore((state) => state.onRampStep);
|
|
22
|
+
const storedTab = useStore((state) => state.accountAddFundTab);
|
|
23
|
+
const setAccountView = useStore((state) => state.setAccountView);
|
|
24
|
+
const setOnRampPurchase = useStore((state) => state.setOnRampPurchase);
|
|
25
25
|
const { data: activeWallet } = useWallet();
|
|
26
26
|
const { embedded } = useAccount();
|
|
27
27
|
const isGuestMode = (embedded == null ? void 0 : embedded.isConnected) && embedded.isGuestMode;
|
|
@@ -31,7 +31,7 @@ const AddFunds = () => {
|
|
|
31
31
|
const tab = storedTab != null ? storedTab : (_a = tabs[0]) == null ? void 0 : _a[0];
|
|
32
32
|
const isMultiFlow = (tab === EnabledFlow.BUY || tab === EnabledFlow.RECEIVE) && (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) && (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled);
|
|
33
33
|
const onSetTab = (event) => {
|
|
34
|
-
|
|
34
|
+
setAccountView(getAddFundsStep(event.detail.tab));
|
|
35
35
|
};
|
|
36
36
|
const Content = useMemo(() => {
|
|
37
37
|
switch (tab) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import * as comp from "@getpara/react-components";
|
|
5
5
|
import { formatCurrency } from "@getpara/web-sdk";
|
|
6
6
|
import { getAssetCode, getAssetName, ON_RAMP_ASSETS } from "@getpara/react-common";
|
|
7
7
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
8
|
-
import { AssetIcon, SearchableButtonList } from "
|
|
9
|
-
import { useAssets } from "
|
|
8
|
+
import { AssetIcon, SearchableButtonList } from "../../../common.js";
|
|
9
|
+
import { useAssets } from "../../../../../provider/providers/AssetsProvider.js";
|
|
10
10
|
function AddFundsAsset() {
|
|
11
11
|
const { assets, setAsset } = useAddFunds();
|
|
12
12
|
const { assetMetadata } = useAssets();
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
3
|
-
import { useModalStore } from "../../stores/index.js";
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
4
3
|
import { useEffect } from "react";
|
|
5
|
-
import {
|
|
4
|
+
import { useStore } from "../../../../../provider/stores/useStore.js";
|
|
6
5
|
const STEPS = {
|
|
7
|
-
CANCELLED:
|
|
8
|
-
FINISHED:
|
|
6
|
+
CANCELLED: "ACCOUNT_ADD_FUNDS_FAILURE",
|
|
7
|
+
FINISHED: "ACCOUNT_ADD_FUNDS_SUCCESS"
|
|
9
8
|
};
|
|
10
9
|
const AddFundsAwaiting = () => {
|
|
11
|
-
const
|
|
12
|
-
const onRampPurchase =
|
|
10
|
+
const setAccountView = useStore((state) => state.setAccountView);
|
|
11
|
+
const onRampPurchase = useStore((state) => state.onRampPurchase);
|
|
13
12
|
useEffect(() => {
|
|
14
13
|
let timeoutId;
|
|
15
14
|
if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
|
|
16
15
|
timeoutId = setTimeout(() => {
|
|
17
16
|
var _a;
|
|
18
|
-
|
|
17
|
+
setAccountView(STEPS[(_a = onRampPurchase.status) != null ? _a : ""]);
|
|
19
18
|
}, 5e3);
|
|
20
19
|
}
|
|
21
20
|
return () => clearTimeout(timeoutId);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { useWallet } from '
|
|
2
|
+
import { useWallet } from '../../../../../provider/hooks/index.js';
|
|
3
3
|
import { EnabledFlow, TNetwork, TOnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
|
|
4
4
|
import { IconType } from '@getpara/react-components';
|
|
5
5
|
export type Tab = EnabledFlow;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
__spreadProps,
|
|
4
4
|
__spreadValues
|
|
5
|
-
} from "
|
|
5
|
+
} from "../../../../../chunk-MMUBH76A.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import {
|
|
8
8
|
createContext,
|
|
@@ -12,9 +12,8 @@ import {
|
|
|
12
12
|
useRef,
|
|
13
13
|
useState
|
|
14
14
|
} from "react";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
15
|
+
import { useWallet } from "../../../../../provider/hooks/index.js";
|
|
16
|
+
import { useExternalWallets } from "../../../../../provider/providers/ExternalWalletProvider.js";
|
|
18
17
|
import {
|
|
19
18
|
EnabledFlow,
|
|
20
19
|
getOnRampAssets,
|
|
@@ -24,8 +23,9 @@ import {
|
|
|
24
23
|
} from "@getpara/web-sdk";
|
|
25
24
|
import { getNetworkFromChainId, getNetworkOrMainNetEquivalent, safeStyled } from "@getpara/react-common";
|
|
26
25
|
import { CpslAlert, CpslIcon } from "@getpara/react-components";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
26
|
+
import { getDefaultAssetAndNetwork, isAmountWithinProviderLimits } from "../../../../utils/onramps.js";
|
|
27
|
+
import { useStore } from "../../../../../provider/stores/useStore.js";
|
|
28
|
+
import { OnRampStep } from "../../../../../provider/stores/types.js";
|
|
29
29
|
const TABS = [
|
|
30
30
|
[EnabledFlow.BUY, "isBuyEnabled", "creditCard", "Buy"],
|
|
31
31
|
[EnabledFlow.RECEIVE, "isReceiveEnabled", "qrCode", "Receive"],
|
|
@@ -61,11 +61,11 @@ function AddFundsContextProvider({ tab, children }) {
|
|
|
61
61
|
var _a, _b, _c, _d, _e, _f;
|
|
62
62
|
const appName = useStore((state) => state.appName);
|
|
63
63
|
const client = useStore((state) => state.client);
|
|
64
|
-
const onRampConfig =
|
|
65
|
-
const onRampStep =
|
|
66
|
-
const setOnRampStep =
|
|
67
|
-
const isTestModeAlertDismissed =
|
|
68
|
-
const setIsTestModeAlertDismissed =
|
|
64
|
+
const onRampConfig = useStore((state) => state.onRampConfig);
|
|
65
|
+
const onRampStep = useStore((state) => state.onRampStep);
|
|
66
|
+
const setOnRampStep = useStore((state) => state.setOnRampStep);
|
|
67
|
+
const isTestModeAlertDismissed = useStore((state) => state.isTestModeAlertDismissed);
|
|
68
|
+
const setIsTestModeAlertDismissed = useStore((state) => state.setIsTestModeAlertDismissed);
|
|
69
69
|
const { chainId } = useExternalWallets();
|
|
70
70
|
const isTestMode = ((_a = client == null ? void 0 : client.ctx) == null ? void 0 : _a.env) === Environment.PROD ? (_b = onRampConfig == null ? void 0 : onRampConfig.testMode) != null ? _b : false : true;
|
|
71
71
|
const { data: activeWallet } = useWallet();
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Heading, HeroIcon, InnerStepContainer, StepContainer } from "
|
|
5
|
-
import { useModalStore } from "../../stores/index.js";
|
|
4
|
+
import { Heading, HeroIcon, InnerStepContainer, StepContainer } from "../../../common.js";
|
|
6
5
|
import { useMemo } from "react";
|
|
7
6
|
import { CpslButton, CpslText } from "@getpara/react-components";
|
|
8
|
-
import {
|
|
9
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
7
|
+
import { useStore } from "../../../../../provider/stores/useStore.js";
|
|
10
8
|
import { EnabledFlow } from "@getpara/web-sdk";
|
|
9
|
+
import { getAddFundsStep } from "./utils.js";
|
|
11
10
|
const AddFundsDone = ({ isSuccess, onClose }) => {
|
|
12
11
|
var _a;
|
|
13
12
|
const hideWallets = useStore((state) => {
|
|
14
13
|
var _a2;
|
|
15
14
|
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
16
15
|
});
|
|
17
|
-
const
|
|
18
|
-
const onRampPurchase =
|
|
19
|
-
const accountAddFundTab =
|
|
16
|
+
const setAccountView = useStore((state) => state.setAccountView);
|
|
17
|
+
const onRampPurchase = useStore((state) => state.onRampPurchase);
|
|
18
|
+
const accountAddFundTab = useStore((state) => state.accountAddFundTab);
|
|
20
19
|
const formatter = useMemo(() => {
|
|
21
20
|
return new Intl.NumberFormat("en-US", {
|
|
22
21
|
style: "currency",
|
|
@@ -37,7 +36,7 @@ const AddFundsDone = ({ isSuccess, onClose }) => {
|
|
|
37
36
|
{
|
|
38
37
|
fullWidth: true,
|
|
39
38
|
onClick: () => {
|
|
40
|
-
isSuccess ? onClose() :
|
|
39
|
+
isSuccess ? onClose() : setAccountView(getAddFundsStep(accountAddFundTab != null ? accountAddFundTab : EnabledFlow.BUY));
|
|
41
40
|
},
|
|
42
41
|
children: buttonText
|
|
43
42
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "
|
|
2
|
+
import "../../../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { getNetworkName } from "@getpara/react-common";
|
|
5
5
|
import { useAddFunds } from "./AddFundsContext.js";
|
|
6
|
-
import { Heading, NetworkIcon, SearchableButtonList } from "
|
|
6
|
+
import { Heading, NetworkIcon, SearchableButtonList } from "../../../common.js";
|
|
7
7
|
import { CpslRow } from "@getpara/react-components";
|
|
8
8
|
function AddFundsNetwork() {
|
|
9
9
|
const { narrowedNetworks, setNetwork } = useAddFunds();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AddFundsProvider: () => import("react/jsx-runtime").JSX.Element;
|