@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,777 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../chunk-MMUBH76A.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { openMobileUrl, useUserAgent } from "@getpara/react-common";
|
|
9
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { useModalStore } from "../../modal/stores/index.js";
|
|
11
|
-
import { ModalStep } from "../../modal/utils/steps.js";
|
|
12
|
-
import {
|
|
13
|
-
useSignUpOrLogIn,
|
|
14
|
-
useVerifyNewAccount,
|
|
15
|
-
useWaitForSignup,
|
|
16
|
-
useWaitForLogin,
|
|
17
|
-
useWaitForWalletCreation,
|
|
18
|
-
useVerifyOAuth,
|
|
19
|
-
useVerifyFarcaster,
|
|
20
|
-
useVerifyTelegram,
|
|
21
|
-
useSetup2fa,
|
|
22
|
-
useLogout,
|
|
23
|
-
useCreateGuestWallets,
|
|
24
|
-
useWalletState
|
|
25
|
-
} from "../index.js";
|
|
26
|
-
import { useSwitchWallets } from "../hooks/mutations/useSwitchWallets.js";
|
|
27
|
-
import { DEFAULTS } from "../../modal/constants/defaults.js";
|
|
28
|
-
import { openPopup } from "../../modal/utils/openPopup.js";
|
|
29
|
-
import {
|
|
30
|
-
AuthMethod,
|
|
31
|
-
entityToWallet,
|
|
32
|
-
isMobile
|
|
33
|
-
} from "@getpara/web-sdk";
|
|
34
|
-
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
35
|
-
import { useGoBack } from "../../modal/hooks/useGoBack.js";
|
|
36
|
-
import { isExternalWallet } from "@getpara/user-management-client";
|
|
37
|
-
import { useStore } from "../stores/useStore.js";
|
|
38
|
-
import { useFormattedBiometricHints } from "../hooks/utils/useFormattedBiometricHints.js";
|
|
39
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
40
|
-
import { validatePortalOrigin } from "../../modal/utils/validatePortalOrigin.js";
|
|
41
|
-
const AuthContext = createContext({
|
|
42
|
-
signUpOrLogIn: () => {
|
|
43
|
-
},
|
|
44
|
-
isSignUpOrLogInPending: false,
|
|
45
|
-
verifyNewAccount: () => {
|
|
46
|
-
},
|
|
47
|
-
verifyNewAccountStatus: "idle",
|
|
48
|
-
verifyNewAccountError: null,
|
|
49
|
-
verifyOAuth: () => {
|
|
50
|
-
},
|
|
51
|
-
verifyFarcaster: () => {
|
|
52
|
-
},
|
|
53
|
-
verifyTelegram: () => {
|
|
54
|
-
},
|
|
55
|
-
verifyTelegramStatus: "idle",
|
|
56
|
-
verifyFarcasterStatus: "idle",
|
|
57
|
-
onNewAuthState: () => {
|
|
58
|
-
},
|
|
59
|
-
isSetup2faPending: false,
|
|
60
|
-
presentSignupUi: () => {
|
|
61
|
-
},
|
|
62
|
-
presentLoginUi: () => {
|
|
63
|
-
},
|
|
64
|
-
presentVerifyUi: () => {
|
|
65
|
-
},
|
|
66
|
-
createGuestWallets: () => {
|
|
67
|
-
},
|
|
68
|
-
isCreateGuestWalletsPending: false,
|
|
69
|
-
logout: () => {
|
|
70
|
-
},
|
|
71
|
-
switchWallets: () => {
|
|
72
|
-
},
|
|
73
|
-
switchWalletsUrl: void 0,
|
|
74
|
-
setSwitchWalletsUrl: () => {
|
|
75
|
-
},
|
|
76
|
-
isSwitchWalletsPending: false
|
|
77
|
-
});
|
|
78
|
-
function AuthProvider({
|
|
79
|
-
children,
|
|
80
|
-
is2faEnabled = false,
|
|
81
|
-
isRecoverySecretStepEnabled = false,
|
|
82
|
-
overrides = {}
|
|
83
|
-
}) {
|
|
84
|
-
const queryClient = useQueryClient();
|
|
85
|
-
const para = useInternalClient();
|
|
86
|
-
const userAgent = useUserAgent();
|
|
87
|
-
const onLoginRef = useStore((state) => state.onLoginRef);
|
|
88
|
-
const setIsOpen = useStore((state) => state.setIsOpen);
|
|
89
|
-
const bareModal = useStore((state) => {
|
|
90
|
-
var _a;
|
|
91
|
-
return (_a = state.modalConfig) == null ? void 0 : _a.bareModal;
|
|
92
|
-
});
|
|
93
|
-
const refs = useModalStore((state) => state.refs);
|
|
94
|
-
const setFlow = useModalStore((state) => state.setFlow);
|
|
95
|
-
const currentStep = useModalStore((state) => state.step);
|
|
96
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
97
|
-
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
98
|
-
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
99
|
-
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
100
|
-
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
101
|
-
const loginState = useModalStore((state) => state.getLoginState());
|
|
102
|
-
const signupState = useModalStore((state) => state.getSignupState());
|
|
103
|
-
const setAuthState = useModalStore((state) => state.setAuthState);
|
|
104
|
-
const setFarcasterConnectUri = useModalStore((state) => state.setFarcasterConnectUri);
|
|
105
|
-
const setTwoFactorStatus = useModalStore((state) => state.setTwoFactorStatus);
|
|
106
|
-
const setRecoveryShare = useModalStore((state) => state.setRecoveryShare);
|
|
107
|
-
const authStepRoute = useModalStore((state) => state.authStepRoute);
|
|
108
|
-
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
109
|
-
const goBack = useGoBack();
|
|
110
|
-
const { signUpOrLogIn: mutateSignUpOrLogIn, isPending: isSignUpOrLogInPending } = useSignUpOrLogIn();
|
|
111
|
-
const {
|
|
112
|
-
verifyNewAccount: mutateVerifyNewAccount,
|
|
113
|
-
status: verifyNewAccountStatus,
|
|
114
|
-
error: verifyNewAccountError
|
|
115
|
-
} = useVerifyNewAccount();
|
|
116
|
-
const { verifyOAuth: mutateVerifyOAuth } = useVerifyOAuth();
|
|
117
|
-
const { verifyFarcaster: mutateVerifyFarcaster, status: verifyFarcasterStatus } = useVerifyFarcaster();
|
|
118
|
-
const { verifyTelegram: mutateVerifyTelegram, status: verifyTelegramStatus } = useVerifyTelegram();
|
|
119
|
-
const { waitForLogin: mutateWaitForLogin } = useWaitForLogin();
|
|
120
|
-
const { waitForSignup: mutateWaitForSignup } = useWaitForSignup();
|
|
121
|
-
const { waitForWalletCreationAsync: mutateAsyncWaitForWalletCreation } = useWaitForWalletCreation();
|
|
122
|
-
const { switchWallets: mutateSwitchWallets, isPending: mutateIsSwitchWalletsPending } = useSwitchWallets();
|
|
123
|
-
const { setup2fa: mutateSetup2fa, isPending: isSetup2faPending } = useSetup2fa();
|
|
124
|
-
const { createGuestWallets: mutateCreateGuestWallets, isPending: isCreateGuestWalletsPending } = useCreateGuestWallets();
|
|
125
|
-
const { logout: mutateLogout } = useLogout();
|
|
126
|
-
const { updateSelectedWallet } = useWalletState();
|
|
127
|
-
const { data: biometricHints } = useFormattedBiometricHints();
|
|
128
|
-
const [switchWalletsUrl, setSwitchWalletsUrl] = useState(void 0);
|
|
129
|
-
const [isSwitchWalletsPending, setIsSwitchWalletsPending] = useState(mutateIsSwitchWalletsPending);
|
|
130
|
-
const messageHandlerRef = useRef(null);
|
|
131
|
-
const goBackIfPopupClosedOnSteps = (steps) => {
|
|
132
|
-
var _a;
|
|
133
|
-
if (((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) && (!refs.currentStep.current || steps.includes(refs.currentStep.current))) {
|
|
134
|
-
refs.popupWindow.current = null;
|
|
135
|
-
goBack();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const cancelIfExitedSteps = (steps) => {
|
|
139
|
-
const stepNow = refs.currentStep.current;
|
|
140
|
-
return !!stepNow && !steps.includes(stepNow);
|
|
141
|
-
};
|
|
142
|
-
const setupListener = () => {
|
|
143
|
-
if (messageHandlerRef.current) {
|
|
144
|
-
window.removeEventListener("message", messageHandlerRef.current);
|
|
145
|
-
}
|
|
146
|
-
const handleMessage = (event) => {
|
|
147
|
-
var _a;
|
|
148
|
-
if (!validatePortalOrigin(event, para.ctx)) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
if (((_a = event.data) == null ? void 0 : _a.type) === "CLOSE_WINDOW") {
|
|
152
|
-
if (event.data.success) {
|
|
153
|
-
setAuthStepRoute();
|
|
154
|
-
setIFrameUrl();
|
|
155
|
-
setIsIFrameReady(false);
|
|
156
|
-
if (refs.currentStep.current !== ModalStep.LOGIN_DONE && refs.currentStep.current !== ModalStep.AWAITING_ACCOUNT) {
|
|
157
|
-
setStep(ModalStep.AWAITING_ACCOUNT);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
window.removeEventListener("message", handleMessage);
|
|
161
|
-
messageHandlerRef.current = null;
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
messageHandlerRef.current = handleMessage;
|
|
165
|
-
window.addEventListener("message", handleMessage);
|
|
166
|
-
};
|
|
167
|
-
const pollSignup = () => {
|
|
168
|
-
if (typeof window !== "undefined") {
|
|
169
|
-
refs.poll.current = {
|
|
170
|
-
action: "signup",
|
|
171
|
-
timeout: window == null ? void 0 : window.setTimeout(() => __async(this, null, function* () {
|
|
172
|
-
mutateWaitForSignup(
|
|
173
|
-
{
|
|
174
|
-
isCanceled: () => cancelIfExitedSteps([
|
|
175
|
-
ModalStep.BIOMETRIC_CREATION,
|
|
176
|
-
ModalStep.AWAITING_BIOMETRIC_CREATION,
|
|
177
|
-
ModalStep.PASSWORD_CREATION,
|
|
178
|
-
ModalStep.AWAITING_ACCOUNT,
|
|
179
|
-
ModalStep.VERIFICATIONS,
|
|
180
|
-
ModalStep.AWAITING_OAUTH,
|
|
181
|
-
ModalStep.EXTERNAL_WALLET_VERIFICATION,
|
|
182
|
-
ModalStep.OTP
|
|
183
|
-
]),
|
|
184
|
-
onPoll: () => {
|
|
185
|
-
goBackIfPopupClosedOnSteps([ModalStep.AWAITING_BIOMETRIC_CREATION]);
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
onSuccess: () => {
|
|
190
|
-
if (para.isNoWalletConfig) {
|
|
191
|
-
onLoginComplete({
|
|
192
|
-
on2faSetupOrError: () => {
|
|
193
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
194
|
-
},
|
|
195
|
-
on2faNotSetup: () => setStep(ModalStep.SETUP_2FA)
|
|
196
|
-
});
|
|
197
|
-
} else {
|
|
198
|
-
createWallets();
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
onError: () => {
|
|
202
|
-
if (refs.currentStep.current && [ModalStep.AWAITING_BIOMETRIC_CREATION, ModalStep.PASSWORD_CREATION, ModalStep.AWAITING_ACCOUNT].includes(
|
|
203
|
-
refs.currentStep.current
|
|
204
|
-
)) {
|
|
205
|
-
goBack();
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
onSettled: () => {
|
|
209
|
-
var _a;
|
|
210
|
-
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
211
|
-
refs.poll.current = null;
|
|
212
|
-
refs.popupWindow.current = null;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
}), DEFAULTS.POLLING_INTERVAL_MS)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const presentSignupUi = useCallback(
|
|
221
|
-
(method, authState) => {
|
|
222
|
-
switch (method) {
|
|
223
|
-
case AuthMethod.PASSKEY:
|
|
224
|
-
if (refs.currentStep.current !== ModalStep.AWAITING_BIOMETRIC_CREATION) {
|
|
225
|
-
setStep(ModalStep.AWAITING_BIOMETRIC_CREATION);
|
|
226
|
-
}
|
|
227
|
-
if (typeof window !== "undefined") {
|
|
228
|
-
refs.popupWindow.current = openPopup({
|
|
229
|
-
url: authState.passkeyUrl,
|
|
230
|
-
target: "ParaPasskey",
|
|
231
|
-
type: "CREATE_PASSKEY",
|
|
232
|
-
current: refs.popupWindow.current
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
case AuthMethod.PASSWORD:
|
|
237
|
-
setupListener();
|
|
238
|
-
if (isIFrameReady) {
|
|
239
|
-
setStep(ModalStep.PASSWORD_CREATION);
|
|
240
|
-
} else {
|
|
241
|
-
setIFrameUrl(authState.passwordUrl);
|
|
242
|
-
setIsIFrameReady(false);
|
|
243
|
-
setAuthStepRoute(ModalStep.PASSWORD_CREATION);
|
|
244
|
-
}
|
|
245
|
-
break;
|
|
246
|
-
case AuthMethod.PIN:
|
|
247
|
-
setupListener();
|
|
248
|
-
if (isIFrameReady) {
|
|
249
|
-
setStep(ModalStep.PASSWORD_CREATION);
|
|
250
|
-
} else {
|
|
251
|
-
setIFrameUrl(authState.pinUrl);
|
|
252
|
-
setIsIFrameReady(false);
|
|
253
|
-
setAuthStepRoute(ModalStep.PASSWORD_CREATION);
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
[isIFrameReady]
|
|
259
|
-
);
|
|
260
|
-
const presentVerifyUi = useCallback(
|
|
261
|
-
(method, authState) => {
|
|
262
|
-
switch (method) {
|
|
263
|
-
case AuthMethod.BASIC_LOGIN:
|
|
264
|
-
setupListener();
|
|
265
|
-
if (isIFrameReady) {
|
|
266
|
-
setStep(ModalStep.OTP);
|
|
267
|
-
} else {
|
|
268
|
-
setIFrameUrl(authState.loginUrl);
|
|
269
|
-
setIsIFrameReady(false);
|
|
270
|
-
setAuthStepRoute(ModalStep.OTP);
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
[isIFrameReady]
|
|
276
|
-
);
|
|
277
|
-
const login = (authState) => {
|
|
278
|
-
const hasPasskey = !!authState.passkeyUrl;
|
|
279
|
-
if (!hasPasskey) {
|
|
280
|
-
setupListener();
|
|
281
|
-
setIFrameUrl(authState.passwordUrl || authState.pinUrl);
|
|
282
|
-
setIsIFrameReady(false);
|
|
283
|
-
setStep(ModalStep.EMBEDDED_PASSWORD_LOGIN);
|
|
284
|
-
} else {
|
|
285
|
-
setStep(ModalStep.BIOMETRIC_LOGIN);
|
|
286
|
-
}
|
|
287
|
-
pollLogin();
|
|
288
|
-
};
|
|
289
|
-
const pollLogin = () => {
|
|
290
|
-
if (typeof window !== "undefined") {
|
|
291
|
-
refs.poll.current = {
|
|
292
|
-
action: "login",
|
|
293
|
-
timeout: window == null ? void 0 : window.setTimeout(() => __async(this, null, function* () {
|
|
294
|
-
mutateWaitForLogin(
|
|
295
|
-
{
|
|
296
|
-
isCanceled: () => cancelIfExitedSteps([
|
|
297
|
-
ModalStep.BIOMETRIC_LOGIN,
|
|
298
|
-
ModalStep.EMBEDDED_PASSWORD_LOGIN,
|
|
299
|
-
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
300
|
-
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
301
|
-
ModalStep.AWAITING_ACCOUNT,
|
|
302
|
-
ModalStep.OTP,
|
|
303
|
-
ModalStep.FARCASTER_OAUTH,
|
|
304
|
-
ModalStep.TELEGRAM_OAUTH,
|
|
305
|
-
ModalStep.AWAITING_OAUTH,
|
|
306
|
-
ModalStep.SWITCH_WALLETS
|
|
307
|
-
]),
|
|
308
|
-
onPoll: () => {
|
|
309
|
-
goBackIfPopupClosedOnSteps([
|
|
310
|
-
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
311
|
-
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
312
|
-
ModalStep.EMBEDDED_PASSWORD_LOGIN,
|
|
313
|
-
ModalStep.OTP,
|
|
314
|
-
ModalStep.SWITCH_WALLETS
|
|
315
|
-
]);
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
onSuccess: ({ needsWallet }) => {
|
|
320
|
-
if (needsWallet && !para.isNoWalletConfig) {
|
|
321
|
-
createWallets();
|
|
322
|
-
} else {
|
|
323
|
-
onLoginComplete({
|
|
324
|
-
on2faSetupOrError: () => setStep(ModalStep.LOGIN_DONE),
|
|
325
|
-
on2faNotSetup: () => setStep(ModalStep.SETUP_2FA)
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
onSettled: () => {
|
|
330
|
-
var _a;
|
|
331
|
-
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
332
|
-
refs.poll.current = null;
|
|
333
|
-
refs.popupWindow.current = null;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
}), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
const presentLoginUi = useCallback(
|
|
342
|
-
(method, authState) => {
|
|
343
|
-
const isPassword = method === AuthMethod.PASSWORD, isPIN = method === AuthMethod.PIN;
|
|
344
|
-
if (overrides.login) {
|
|
345
|
-
function loginOverride() {
|
|
346
|
-
return __async(this, null, function* () {
|
|
347
|
-
var _a, _b;
|
|
348
|
-
yield (_a = overrides == null ? void 0 : overrides.login) == null ? void 0 : _a.call(overrides, para);
|
|
349
|
-
yield (_b = onLoginRef.current) == null ? void 0 : _b.call(onLoginRef);
|
|
350
|
-
yield onLoginComplete();
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
loginOverride();
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
if (typeof window !== "undefined") {
|
|
357
|
-
refs.popupWindow.current = openPopup({
|
|
358
|
-
url: isPIN ? authState.pinUrl : isPassword ? authState.passwordUrl : authState.passkeyUrl,
|
|
359
|
-
target: isPIN ? "ParaPIN" : isPassword ? "ParaPassword" : "ParaPasskey",
|
|
360
|
-
type: isPIN ? "LOGIN_PASSWORD" : isPassword ? "LOGIN_PASSWORD" : "LOGIN_PASSKEY",
|
|
361
|
-
current: refs.popupWindow.current
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
setStep(isPassword || isPIN ? ModalStep.AWAITING_PASSWORD_LOGIN : ModalStep.AWAITING_BIOMETRIC_LOGIN);
|
|
365
|
-
},
|
|
366
|
-
[loginState, biometricHints]
|
|
367
|
-
);
|
|
368
|
-
const onNewAuthState = (authState) => __async(this, null, function* () {
|
|
369
|
-
var _a, _b, _c;
|
|
370
|
-
setAuthState(authState);
|
|
371
|
-
switch (authState.stage) {
|
|
372
|
-
case "verify":
|
|
373
|
-
if (isExternalWallet(authState.auth)) {
|
|
374
|
-
if (authState.loginUrl && ((_a = authState.externalWallet) == null ? void 0 : _a.withFullParaAuth)) {
|
|
375
|
-
let isBasicLogin = false;
|
|
376
|
-
if (authState.nextStage === "login") {
|
|
377
|
-
isBasicLogin = authState.loginAuthMethods.includes(AuthMethod.BASIC_LOGIN);
|
|
378
|
-
} else {
|
|
379
|
-
isBasicLogin = authState.signupAuthMethods.includes(AuthMethod.BASIC_LOGIN);
|
|
380
|
-
}
|
|
381
|
-
if (authState.nextStage === "login") {
|
|
382
|
-
setFlow("login");
|
|
383
|
-
isBasicLogin && pollLogin();
|
|
384
|
-
} else {
|
|
385
|
-
setFlow("signup");
|
|
386
|
-
isBasicLogin && pollSignup();
|
|
387
|
-
}
|
|
388
|
-
if (!isMobile() && refs.popupWindow.current) {
|
|
389
|
-
refs.popupWindow.current.location.href = authState.loginUrl;
|
|
390
|
-
setStep(ModalStep.AWAITING_ACCOUNT);
|
|
391
|
-
} else {
|
|
392
|
-
setIFrameUrl(authState.loginUrl);
|
|
393
|
-
setStep(ModalStep.OTP);
|
|
394
|
-
setupListener();
|
|
395
|
-
}
|
|
396
|
-
} else {
|
|
397
|
-
setStep(ModalStep.EXTERNAL_WALLET_VERIFICATION);
|
|
398
|
-
}
|
|
399
|
-
} else {
|
|
400
|
-
if (authState.nextStage === "login") {
|
|
401
|
-
setFlow("login");
|
|
402
|
-
pollLogin();
|
|
403
|
-
} else {
|
|
404
|
-
setFlow("signup");
|
|
405
|
-
pollSignup();
|
|
406
|
-
}
|
|
407
|
-
if (authState.loginUrl) {
|
|
408
|
-
setIFrameUrl(authState.loginUrl);
|
|
409
|
-
setIsIFrameReady(false);
|
|
410
|
-
presentVerifyUi(AuthMethod.BASIC_LOGIN, authState);
|
|
411
|
-
} else {
|
|
412
|
-
setStep(ModalStep.VERIFICATIONS);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
break;
|
|
416
|
-
case "login":
|
|
417
|
-
if (authState.pinUrl && authState.signatureVerificationMessage) {
|
|
418
|
-
setStep(ModalStep.EXTERNAL_WALLET_VERIFICATION);
|
|
419
|
-
} else {
|
|
420
|
-
login(authState);
|
|
421
|
-
}
|
|
422
|
-
break;
|
|
423
|
-
case "signup":
|
|
424
|
-
{
|
|
425
|
-
const isPassword = !!authState.passwordUrl, isPIN = !!authState.pinUrl, isPasswordOrPIN = isPassword || isPIN, isPasswordOrPINOnly = isPasswordOrPIN && (!authState.passkeyUrl || (userAgent == null ? void 0 : userAgent.device.type) === "mobile" && !authState.isPasskeySupported);
|
|
426
|
-
if (isPasswordOrPIN) {
|
|
427
|
-
setIFrameUrl(authState.passwordUrl || authState.pinUrl);
|
|
428
|
-
setIsIFrameReady(false);
|
|
429
|
-
}
|
|
430
|
-
pollSignup();
|
|
431
|
-
if (isPasswordOrPINOnly) {
|
|
432
|
-
presentSignupUi(isPassword ? AuthMethod.PASSWORD : AuthMethod.PIN, authState);
|
|
433
|
-
} else {
|
|
434
|
-
setStep(ModalStep.BIOMETRIC_CREATION);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
break;
|
|
438
|
-
case "done":
|
|
439
|
-
if (!((_b = authState.externalWallet) == null ? void 0 : _b.withFullParaAuth) && !((_c = authState.externalWallet) == null ? void 0 : _c.withVerification)) {
|
|
440
|
-
if (authState.isNewUser) {
|
|
441
|
-
pollSignup();
|
|
442
|
-
setFlow("signup");
|
|
443
|
-
} else {
|
|
444
|
-
pollLogin();
|
|
445
|
-
setFlow("login");
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (!authState.isWalletSelectionNeeded) {
|
|
449
|
-
setStep(ModalStep.AWAITING_ACCOUNT);
|
|
450
|
-
}
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
const signUpOrLogIn = (auth) => __async(this, null, function* () {
|
|
455
|
-
mutateSignUpOrLogIn(
|
|
456
|
-
{ auth, useShortUrls: true },
|
|
457
|
-
{
|
|
458
|
-
onSuccess: onNewAuthState
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
});
|
|
462
|
-
const verifyNewAccount = (verificationCode) => __async(this, null, function* () {
|
|
463
|
-
mutateVerifyNewAccount(
|
|
464
|
-
{ verificationCode, useShortUrls: true },
|
|
465
|
-
{
|
|
466
|
-
onSuccess: onNewAuthState
|
|
467
|
-
}
|
|
468
|
-
);
|
|
469
|
-
});
|
|
470
|
-
const verifyOAuth = (method) => __async(this, null, function* () {
|
|
471
|
-
setStep(ModalStep.AWAITING_OAUTH);
|
|
472
|
-
mutateVerifyOAuth(
|
|
473
|
-
{
|
|
474
|
-
method,
|
|
475
|
-
onOAuthPopup: (oAuthPopup) => {
|
|
476
|
-
refs.popupWindow.current = oAuthPopup;
|
|
477
|
-
},
|
|
478
|
-
isCanceled: () => {
|
|
479
|
-
var _a;
|
|
480
|
-
return ((_a = refs.popupWindow.current) == null ? void 0 : _a.closed) || cancelIfExitedSteps([ModalStep.AWAITING_OAUTH]);
|
|
481
|
-
},
|
|
482
|
-
onPoll: () => {
|
|
483
|
-
goBackIfPopupClosedOnSteps([ModalStep.AWAITING_OAUTH]);
|
|
484
|
-
},
|
|
485
|
-
useShortUrls: true
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
onSuccess: onNewAuthState,
|
|
489
|
-
onError: () => {
|
|
490
|
-
goBackIfPopupClosedOnSteps([ModalStep.AWAITING_OAUTH]);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
);
|
|
494
|
-
});
|
|
495
|
-
const verifyFarcaster = (serverAuthState) => __async(this, null, function* () {
|
|
496
|
-
if (!serverAuthState) {
|
|
497
|
-
setStep(ModalStep.FARCASTER_OAUTH);
|
|
498
|
-
} else {
|
|
499
|
-
setupListener();
|
|
500
|
-
}
|
|
501
|
-
mutateVerifyFarcaster(
|
|
502
|
-
{
|
|
503
|
-
isCanceled: () => refs.currentStep.current !== ModalStep.FARCASTER_OAUTH,
|
|
504
|
-
onConnectUri: (connectUri) => {
|
|
505
|
-
setFarcasterConnectUri(connectUri);
|
|
506
|
-
openMobileUrl(connectUri);
|
|
507
|
-
},
|
|
508
|
-
useShortUrls: true,
|
|
509
|
-
serverAuthState
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
onSuccess: onNewAuthState,
|
|
513
|
-
onError: () => {
|
|
514
|
-
if (refs.currentStep.current === ModalStep.FARCASTER_OAUTH) {
|
|
515
|
-
goBack();
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
);
|
|
520
|
-
});
|
|
521
|
-
const verifyTelegram = (serverAuthState) => __async(this, null, function* () {
|
|
522
|
-
if (serverAuthState) {
|
|
523
|
-
setupListener();
|
|
524
|
-
}
|
|
525
|
-
mutateVerifyTelegram(
|
|
526
|
-
{
|
|
527
|
-
serverAuthState,
|
|
528
|
-
useShortUrls: true
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
onSuccess: onNewAuthState
|
|
532
|
-
}
|
|
533
|
-
);
|
|
534
|
-
});
|
|
535
|
-
const onLoginComplete = useCallback(
|
|
536
|
-
(..._0) => __async(this, [..._0], function* ({
|
|
537
|
-
on2faSetupOrError,
|
|
538
|
-
on2faNotSetup
|
|
539
|
-
} = {}) {
|
|
540
|
-
var _a;
|
|
541
|
-
yield queryClient.invalidateQueries({ queryKey: ["isFullyLoggedIn"] });
|
|
542
|
-
setAuthState();
|
|
543
|
-
yield (_a = onLoginRef.current) == null ? void 0 : _a.call(onLoginRef);
|
|
544
|
-
if (is2faEnabled) {
|
|
545
|
-
mutateSetup2fa(void 0, {
|
|
546
|
-
onSuccess: (status) => {
|
|
547
|
-
setTwoFactorStatus(status);
|
|
548
|
-
if (!status.isSetup && !!status.uri) {
|
|
549
|
-
on2faNotSetup == null ? void 0 : on2faNotSetup();
|
|
550
|
-
} else {
|
|
551
|
-
on2faSetupOrError == null ? void 0 : on2faSetupOrError();
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
onError: () => {
|
|
555
|
-
on2faSetupOrError == null ? void 0 : on2faSetupOrError();
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
} else {
|
|
559
|
-
on2faSetupOrError == null ? void 0 : on2faSetupOrError();
|
|
560
|
-
}
|
|
561
|
-
}),
|
|
562
|
-
[is2faEnabled]
|
|
563
|
-
);
|
|
564
|
-
const createWallets = useCallback(() => __async(this, null, function* () {
|
|
565
|
-
var _a;
|
|
566
|
-
if (refs.currentStep.current !== ModalStep.AWAITING_WALLET_CREATION) {
|
|
567
|
-
setStep(ModalStep.AWAITING_WALLET_CREATION);
|
|
568
|
-
}
|
|
569
|
-
let recoverySecret, walletIds;
|
|
570
|
-
try {
|
|
571
|
-
if (overrides.createWallets) {
|
|
572
|
-
({ recoverySecret, walletIds } = yield (_a = overrides == null ? void 0 : overrides.createWallets) == null ? void 0 : _a.call(overrides, para));
|
|
573
|
-
const fetchedWallets = (yield para.fetchWallets()).filter((wallet) => !!wallet.address);
|
|
574
|
-
const newWallets = {};
|
|
575
|
-
for (const wallet of fetchedWallets) {
|
|
576
|
-
newWallets[wallet.id] = __spreadProps(__spreadValues({}, entityToWallet(wallet)), {
|
|
577
|
-
signer: ""
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
para.setWallets(newWallets);
|
|
581
|
-
} else {
|
|
582
|
-
({ recoverySecret, walletIds } = yield mutateAsyncWaitForWalletCreation({
|
|
583
|
-
isCanceled: () => false
|
|
584
|
-
}));
|
|
585
|
-
}
|
|
586
|
-
if (walletIds) {
|
|
587
|
-
yield para.setCurrentWalletIds(walletIds);
|
|
588
|
-
}
|
|
589
|
-
if (recoverySecret && isRecoverySecretStepEnabled) {
|
|
590
|
-
setRecoveryShare(recoverySecret);
|
|
591
|
-
}
|
|
592
|
-
setStep(recoverySecret && isRecoverySecretStepEnabled ? ModalStep.SECRET : ModalStep.WALLET_CREATION_DONE);
|
|
593
|
-
onLoginComplete();
|
|
594
|
-
} catch (e) {
|
|
595
|
-
}
|
|
596
|
-
}), [para, isRecoverySecretStepEnabled, overrides == null ? void 0 : overrides.createWallets]);
|
|
597
|
-
const createGuestWallets = () => {
|
|
598
|
-
if (bareModal) {
|
|
599
|
-
setFlow("guest");
|
|
600
|
-
setStep(ModalStep.AWAITING_GUEST_WALLET_CREATION);
|
|
601
|
-
} else {
|
|
602
|
-
setIsOpen(false);
|
|
603
|
-
}
|
|
604
|
-
mutateCreateGuestWallets(void 0, {
|
|
605
|
-
onSuccess: () => {
|
|
606
|
-
},
|
|
607
|
-
onSettled: () => {
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
};
|
|
611
|
-
const logout = () => {
|
|
612
|
-
mutateLogout();
|
|
613
|
-
};
|
|
614
|
-
const switchWallets = () => {
|
|
615
|
-
if (!switchWalletsUrl) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
setIsSwitchWalletsPending(true);
|
|
619
|
-
try {
|
|
620
|
-
setStep(ModalStep.SWITCH_WALLETS);
|
|
621
|
-
refs.popupWindow.current = openPopup({
|
|
622
|
-
url: switchWalletsUrl,
|
|
623
|
-
target: "ParaSwitchWallets",
|
|
624
|
-
type: "SWITCH_WALLETS",
|
|
625
|
-
current: refs.popupWindow.current
|
|
626
|
-
});
|
|
627
|
-
pollSwitchWallets();
|
|
628
|
-
} catch (error) {
|
|
629
|
-
console.error("Failed to open wallet switching popup:", error);
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
const pollSwitchWallets = () => {
|
|
633
|
-
if (typeof window !== "undefined") {
|
|
634
|
-
refs.poll.current = {
|
|
635
|
-
action: "login",
|
|
636
|
-
timeout: window == null ? void 0 : window.setTimeout(() => __async(this, null, function* () {
|
|
637
|
-
mutateSwitchWallets(
|
|
638
|
-
{
|
|
639
|
-
isCanceled: () => {
|
|
640
|
-
var _a, _b;
|
|
641
|
-
const exitedSteps = cancelIfExitedSteps([ModalStep.SWITCH_WALLETS, ModalStep.SWITCH_WALLETS_IFRAME]);
|
|
642
|
-
const popupClosed = (_b = (_a = refs.popupWindow.current) == null ? void 0 : _a.closed) != null ? _b : false;
|
|
643
|
-
const isCanceled = exitedSteps || popupClosed;
|
|
644
|
-
if (isCanceled) {
|
|
645
|
-
if (popupClosed && (refs.currentStep.current === ModalStep.SWITCH_WALLETS || refs.currentStep.current === ModalStep.SWITCH_WALLETS_IFRAME)) {
|
|
646
|
-
goBack();
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return isCanceled;
|
|
650
|
-
},
|
|
651
|
-
onPoll: () => {
|
|
652
|
-
if (refs.currentStep.current === ModalStep.SWITCH_WALLETS || refs.currentStep.current === ModalStep.SWITCH_WALLETS_IFRAME) {
|
|
653
|
-
goBackIfPopupClosedOnSteps([ModalStep.SWITCH_WALLETS, ModalStep.SWITCH_WALLETS_IFRAME]);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
},
|
|
657
|
-
{
|
|
658
|
-
onSuccess: () => {
|
|
659
|
-
updateSelectedWallet();
|
|
660
|
-
setTimeout(() => {
|
|
661
|
-
setStep(ModalStep.ACCOUNT_PROFILE);
|
|
662
|
-
refs.popupWindow.current = null;
|
|
663
|
-
}, 500);
|
|
664
|
-
},
|
|
665
|
-
onError: () => {
|
|
666
|
-
if (refs.currentStep.current === ModalStep.SWITCH_WALLETS) {
|
|
667
|
-
goBack();
|
|
668
|
-
}
|
|
669
|
-
},
|
|
670
|
-
onSettled: () => {
|
|
671
|
-
var _a;
|
|
672
|
-
setIsSwitchWalletsPending(false);
|
|
673
|
-
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
674
|
-
refs.poll.current = null;
|
|
675
|
-
refs.popupWindow.current = null;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
);
|
|
679
|
-
}), DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
const isPasswordIFrameLoading = !!iFrameUrl && iFrameUrl === (signupState == null ? void 0 : signupState.passwordUrl) && !isIFrameReady;
|
|
684
|
-
const value = useMemo(
|
|
685
|
-
() => ({
|
|
686
|
-
presentSignupUi,
|
|
687
|
-
presentLoginUi,
|
|
688
|
-
presentVerifyUi,
|
|
689
|
-
signUpOrLogIn,
|
|
690
|
-
isSignUpOrLogInPending,
|
|
691
|
-
verifyNewAccount,
|
|
692
|
-
verifyNewAccountStatus: isPasswordIFrameLoading ? "pending" : verifyNewAccountStatus,
|
|
693
|
-
verifyNewAccountError,
|
|
694
|
-
verifyOAuth,
|
|
695
|
-
verifyFarcaster,
|
|
696
|
-
verifyTelegram,
|
|
697
|
-
verifyTelegramStatus,
|
|
698
|
-
onNewAuthState,
|
|
699
|
-
isSetup2faPending,
|
|
700
|
-
createGuestWallets,
|
|
701
|
-
isCreateGuestWalletsPending,
|
|
702
|
-
logout,
|
|
703
|
-
switchWallets,
|
|
704
|
-
switchWalletsUrl,
|
|
705
|
-
setSwitchWalletsUrl,
|
|
706
|
-
isSwitchWalletsPending,
|
|
707
|
-
biometricHints: biometricHints || void 0,
|
|
708
|
-
verifyFarcasterStatus
|
|
709
|
-
}),
|
|
710
|
-
[
|
|
711
|
-
presentSignupUi,
|
|
712
|
-
presentLoginUi,
|
|
713
|
-
presentVerifyUi,
|
|
714
|
-
signUpOrLogIn,
|
|
715
|
-
isSignUpOrLogInPending,
|
|
716
|
-
verifyNewAccount,
|
|
717
|
-
verifyNewAccountStatus,
|
|
718
|
-
isPasswordIFrameLoading,
|
|
719
|
-
verifyNewAccountError,
|
|
720
|
-
verifyOAuth,
|
|
721
|
-
verifyFarcaster,
|
|
722
|
-
verifyTelegram,
|
|
723
|
-
verifyTelegramStatus,
|
|
724
|
-
onNewAuthState,
|
|
725
|
-
isSetup2faPending,
|
|
726
|
-
createGuestWallets,
|
|
727
|
-
isCreateGuestWalletsPending,
|
|
728
|
-
logout,
|
|
729
|
-
switchWallets,
|
|
730
|
-
switchWalletsUrl,
|
|
731
|
-
setSwitchWalletsUrl,
|
|
732
|
-
isSwitchWalletsPending,
|
|
733
|
-
biometricHints,
|
|
734
|
-
verifyFarcasterStatus
|
|
735
|
-
]
|
|
736
|
-
);
|
|
737
|
-
useEffect(() => {
|
|
738
|
-
let timerId;
|
|
739
|
-
if (!!authStepRoute && refs.currentStep.current !== authStepRoute) {
|
|
740
|
-
timerId = setTimeout(() => {
|
|
741
|
-
setStep(authStepRoute);
|
|
742
|
-
}, 200);
|
|
743
|
-
}
|
|
744
|
-
return () => {
|
|
745
|
-
if (timerId) {
|
|
746
|
-
clearTimeout(timerId);
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
}, [authStepRoute]);
|
|
750
|
-
useEffect(() => {
|
|
751
|
-
refs.currentStep.current = currentStep;
|
|
752
|
-
}, [currentStep]);
|
|
753
|
-
useEffect(() => {
|
|
754
|
-
if (refs.currentStep.current === ModalStep.AWAITING_GUEST_WALLET_CREATION && !isCreateGuestWalletsPending) {
|
|
755
|
-
setStep(ModalStep.ACCOUNT_MAIN);
|
|
756
|
-
}
|
|
757
|
-
}, [isCreateGuestWalletsPending]);
|
|
758
|
-
useEffect(() => {
|
|
759
|
-
setIsSwitchWalletsPending((prev) => !!prev ? mutateIsSwitchWalletsPending : prev);
|
|
760
|
-
}, [mutateIsSwitchWalletsPending]);
|
|
761
|
-
useEffect(() => {
|
|
762
|
-
return () => {
|
|
763
|
-
var _a;
|
|
764
|
-
window == null ? void 0 : window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
765
|
-
if (messageHandlerRef.current) {
|
|
766
|
-
window.removeEventListener("message", messageHandlerRef.current);
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
}, []);
|
|
770
|
-
return /* @__PURE__ */ jsx(AuthContext.Provider, { value, children });
|
|
771
|
-
}
|
|
772
|
-
const useAuthActions = () => useContext(AuthContext);
|
|
773
|
-
export {
|
|
774
|
-
AuthContext,
|
|
775
|
-
AuthProvider,
|
|
776
|
-
useAuthActions
|
|
777
|
-
};
|