@getpara/react-sdk-lite 2.0.0-alpha.33
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/chunk-MMUBH76A.js +59 -0
- package/dist/cli/cli.mjs +51 -0
- package/dist/css/modal.css +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +308 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +148 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +168 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
- package/dist/modal/components/AuthInput/AuthInput.js +277 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +11 -0
- package/dist/modal/components/Body/Body.js +354 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +78 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +173 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +81 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
- package/dist/modal/components/common.d.ts +59 -0
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +40 -0
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +17 -0
- package/dist/modal/constants/oAuthLogos.js +158 -0
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +1 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +139 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
- package/dist/modal/stores/modal/useModalStore.js +75 -0
- package/dist/modal/types/commonTypes.d.ts +6 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +129 -0
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +5 -0
- package/dist/modal/utils/authInputHelpers.js +41 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.d.ts +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +6 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +136 -0
- package/dist/modal/utils/steps.js +279 -0
- package/dist/modal/utils/stringFormatters.d.ts +5 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.d.ts +4 -0
- package/dist/provider/ParaProvider.js +140 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +57 -0
- package/dist/provider/actions/getWallet.d.ts +5 -0
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +47 -0
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -0
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +19 -0
- package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
- package/dist/provider/external/getParaCosmosLib.js +16 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +19 -0
- package/dist/provider/external/getParaEvmLib.d.ts +4 -0
- package/dist/provider/external/getParaEvmLib.js +16 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +19 -0
- package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
- package/dist/provider/external/getParaSolanaLib.js +16 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
- package/dist/provider/hooks/index.d.ts +3 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -0
- package/dist/provider/hooks/mutations/index.js +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +12 -0
- package/dist/provider/hooks/mutations/utils.js +90 -0
- package/dist/provider/hooks/queries/core.d.ts +4 -0
- package/dist/provider/hooks/queries/core.js +16 -0
- package/dist/provider/hooks/queries/index.d.ts +5 -0
- package/dist/provider/hooks/queries/index.js +13 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
- package/dist/provider/hooks/queries/useAccount.js +141 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
- package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
- package/dist/provider/hooks/queries/useParaStatus.js +25 -0
- package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
- package/dist/provider/hooks/queries/useWallet.js +26 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/queries/utils.d.ts +7 -0
- package/dist/provider/hooks/queries/utils.js +25 -0
- package/dist/provider/hooks/utils/index.d.ts +3 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
- package/dist/provider/hooks/utils/useEventListeners.js +157 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +11 -0
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +452 -0
- package/dist/provider/providers/AuthProvider.d.ts +38 -0
- package/dist/provider/providers/AuthProvider.js +575 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
- package/dist/provider/providers/ExternalWalletProvider.js +626 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +4 -0
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/client.d.ts +3 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +11 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +46 -0
- package/dist/provider/stores/slices/index.d.ts +5 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.d.ts +3 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.d.ts +3 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +86 -0
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.d.ts +17 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +166 -0
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.d.ts +3 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +45 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +5 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/package.json +63 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
4
|
+
import { useExternalWallets } from "../../provider/providers/ExternalWalletProvider.js";
|
|
5
|
+
import { useModalStore } from "../stores/index.js";
|
|
6
|
+
import { getAddFundsStep, ModalStep } from "../utils/steps.js";
|
|
7
|
+
const useGoBack = () => {
|
|
8
|
+
const currentStep = useModalStore((state) => state.step);
|
|
9
|
+
const refs = useModalStore((state) => state.refs);
|
|
10
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
11
|
+
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
12
|
+
const decrementStep = useModalStore((state) => state.decrementStep);
|
|
13
|
+
const resetState = useModalStore((state) => state.resetState);
|
|
14
|
+
const { setChainIdSwitchingTo, disconnectExternalWallet } = useExternalWallets();
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const goBack = () => {
|
|
17
|
+
if (accountAddFundTab && currentStep === ModalStep.ADD_FUNDS_AWAITING) {
|
|
18
|
+
setStep(getAddFundsStep(accountAddFundTab));
|
|
19
|
+
} else {
|
|
20
|
+
decrementStep();
|
|
21
|
+
}
|
|
22
|
+
switch (refs.currentStep.current) {
|
|
23
|
+
case ModalStep.AUTH_MAIN:
|
|
24
|
+
case ModalStep.AUTH_MORE:
|
|
25
|
+
case ModalStep.EX_WALLET_SELECTED:
|
|
26
|
+
case ModalStep.EXTERNAL_WALLET_VERIFICATION: {
|
|
27
|
+
resetState();
|
|
28
|
+
if (para.isExternalWalletAuth) {
|
|
29
|
+
disconnectExternalWallet();
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case ModalStep.CHAIN_SWITCH: {
|
|
34
|
+
setChainIdSwitchingTo();
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return goBack;
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
useGoBack
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TelegramAuthResponse } from '@getpara/user-management-client';
|
|
2
|
+
import { MutationStatus } from '@tanstack/react-query';
|
|
3
|
+
export declare const useTelegramLogin: ({ isActive, onSubmit, status: propsStatus, }?: {
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
onSubmit?: (_: TelegramAuthResponse) => void;
|
|
6
|
+
status?: MutationStatus;
|
|
7
|
+
}) => {
|
|
8
|
+
url: string | undefined;
|
|
9
|
+
isLoaded: boolean;
|
|
10
|
+
setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
|
+
status: MutationStatus | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
7
|
+
import { useModalStore } from "../stores/index.js";
|
|
8
|
+
const useTelegramLogin = ({
|
|
9
|
+
isActive = false,
|
|
10
|
+
onSubmit,
|
|
11
|
+
status: propsStatus
|
|
12
|
+
} = {}) => {
|
|
13
|
+
const para = useInternalClient();
|
|
14
|
+
const refs = useModalStore((state) => state.refs);
|
|
15
|
+
const [url, setUrl] = useState();
|
|
16
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
17
|
+
const [msgStatus, setMsgStatus] = useState("idle");
|
|
18
|
+
const status = msgStatus === "success" ? propsStatus : msgStatus;
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (isActive) {
|
|
21
|
+
if (!url) {
|
|
22
|
+
para.constructPortalUrl("telegramLogin").then(setUrl);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}, [isActive, url]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const updateState = (event) => __async(void 0, null, function* () {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
switch (event.data.type) {
|
|
30
|
+
case "TELEGRAM_LOGIN":
|
|
31
|
+
setMsgStatus("pending");
|
|
32
|
+
break;
|
|
33
|
+
case "TELEGRAM_FAILED":
|
|
34
|
+
setMsgStatus("error");
|
|
35
|
+
break;
|
|
36
|
+
case "TELEGRAM_SUCCESS":
|
|
37
|
+
setMsgStatus("success");
|
|
38
|
+
if (!!event.data.payload) {
|
|
39
|
+
const authObject = event.data.payload;
|
|
40
|
+
try {
|
|
41
|
+
yield onSubmit == null ? void 0 : onSubmit(authObject);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
(_b = (_a = refs.telegramIFrame.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage({ type: "TELEGRAM_RETRY" }, "*");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (isActive) {
|
|
50
|
+
window == null ? void 0 : window.addEventListener("message", updateState, false);
|
|
51
|
+
}
|
|
52
|
+
return () => {
|
|
53
|
+
window == null ? void 0 : window.removeEventListener("message", updateState, false);
|
|
54
|
+
};
|
|
55
|
+
}, [isActive, onSubmit]);
|
|
56
|
+
return {
|
|
57
|
+
url,
|
|
58
|
+
isLoaded,
|
|
59
|
+
setIsLoaded,
|
|
60
|
+
status
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
useTelegramLogin
|
|
65
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './ParaModal.js';
|
|
2
|
+
export type { ParaModalProps, ParaModalHandle, ParaModalTheme } from './types/modalProps.js';
|
|
3
|
+
export { ModalStep, type ModalStepProp } from './utils/steps.js';
|
|
4
|
+
export { AuthLayout } from './types/modalProps.js';
|
|
5
|
+
export * from './utils/openPopup.js';
|
|
6
|
+
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from './constants/constants.js';
|
|
7
|
+
export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
|
|
8
|
+
export * from './utils/validateOnRampConfig.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
export * from "./ParaModal.js";
|
|
4
|
+
import { ModalStep } from "./utils/steps.js";
|
|
5
|
+
import { AuthLayout } from "./types/modalProps.js";
|
|
6
|
+
export * from "./utils/openPopup.js";
|
|
7
|
+
import {
|
|
8
|
+
ON_RAMP_PROVIDERS,
|
|
9
|
+
ON_RAMP_ASSETS,
|
|
10
|
+
NETWORKS,
|
|
11
|
+
getAssetIcon,
|
|
12
|
+
getAssetCode,
|
|
13
|
+
getNetworkIcon,
|
|
14
|
+
getNetworkName
|
|
15
|
+
} from "./constants/constants.js";
|
|
16
|
+
import { SaveRecoverySecret } from "./components/RecoverySecretStep/RecoverySecretStep.js";
|
|
17
|
+
export * from "./utils/validateOnRampConfig.js";
|
|
18
|
+
export {
|
|
19
|
+
AuthLayout,
|
|
20
|
+
ModalStep,
|
|
21
|
+
NETWORKS,
|
|
22
|
+
ON_RAMP_ASSETS,
|
|
23
|
+
ON_RAMP_PROVIDERS,
|
|
24
|
+
SaveRecoverySecret,
|
|
25
|
+
getAssetCode,
|
|
26
|
+
getAssetIcon,
|
|
27
|
+
getNetworkIcon,
|
|
28
|
+
getNetworkName
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modal/useModalStore.js';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { DEFAULT_MODAL_STATE } from "./useModalStore.js";
|
|
6
|
+
import {
|
|
7
|
+
AccountPreviousStep,
|
|
8
|
+
GuestPreviousStep,
|
|
9
|
+
LoginPreviousStep,
|
|
10
|
+
ModalStep,
|
|
11
|
+
SignUpPreviousStep
|
|
12
|
+
} from "../../utils/steps.js";
|
|
13
|
+
function getPreviousStep(flow, step) {
|
|
14
|
+
return flow === "account" ? AccountPreviousStep[step] : flow === "login" ? LoginPreviousStep[step] : flow === "guest" ? GuestPreviousStep[step] : SignUpPreviousStep[step];
|
|
15
|
+
}
|
|
16
|
+
const getActions = (set, get) => ({
|
|
17
|
+
resetState: () => set(DEFAULT_MODAL_STATE),
|
|
18
|
+
setOnModalStepChange: (onModalStepChange) => set({ onModalStepChange }),
|
|
19
|
+
setRecoveryShare: (recoveryShare) => set({ recoveryShare }),
|
|
20
|
+
setStep: (step) => {
|
|
21
|
+
const onModalStepChange = get().onModalStepChange;
|
|
22
|
+
const previousStep = get().step;
|
|
23
|
+
const refs = get().refs;
|
|
24
|
+
set({ step });
|
|
25
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep, currentStep: step, canGoBack: get().hasPreviousStep() });
|
|
26
|
+
if (step === ModalStep.ACCOUNT_MAIN) {
|
|
27
|
+
refs.wasSignedIn.current = true;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
decrementStep: () => {
|
|
31
|
+
var _a;
|
|
32
|
+
const currentStep = get().step;
|
|
33
|
+
const onRampStep = get().onRampStep;
|
|
34
|
+
const flow = get().flow;
|
|
35
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
36
|
+
set({ onRampStep: onRampStep - 1 });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const onModalStepChange = get().onModalStepChange;
|
|
40
|
+
const accountLinkOptions = get().accountLinkOptions || [];
|
|
41
|
+
const signupState = get().getSignupState();
|
|
42
|
+
const iFrameUrl = get().iFrameUrl;
|
|
43
|
+
const refs = get().refs;
|
|
44
|
+
let prevStep = getPreviousStep(flow, currentStep);
|
|
45
|
+
if (currentStep === ModalStep.ACCOUNT_PROFILE_ADD && accountLinkOptions.length < 2) {
|
|
46
|
+
prevStep = ModalStep.ACCOUNT_PROFILE;
|
|
47
|
+
}
|
|
48
|
+
if (currentStep === ModalStep.PASSWORD_CREATION && iFrameUrl && !(signupState == null ? void 0 : signupState.passkeyUrl)) {
|
|
49
|
+
prevStep = ModalStep.AUTH_MAIN;
|
|
50
|
+
}
|
|
51
|
+
if (currentStep === ModalStep.EX_WALLET_SELECTED) {
|
|
52
|
+
set({ selectedExternalWalletId: void 0, isExternalWalletConnecting: false, externalWalletError: void 0 });
|
|
53
|
+
}
|
|
54
|
+
if (prevStep) {
|
|
55
|
+
set(__spreadValues({
|
|
56
|
+
authStepRoute: void 0,
|
|
57
|
+
step: prevStep,
|
|
58
|
+
stepDirection: -1
|
|
59
|
+
}, prevStep === ModalStep.AUTH_MAIN && { flow: void 0 }));
|
|
60
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
|
|
61
|
+
}
|
|
62
|
+
(_a = refs.popupWindow.current) == null ? void 0 : _a.close();
|
|
63
|
+
refs.popupWindow.current = null;
|
|
64
|
+
},
|
|
65
|
+
hasPreviousStep: () => {
|
|
66
|
+
const flow = get().flow;
|
|
67
|
+
const currentStep = get().step;
|
|
68
|
+
const onRampStep = get().onRampStep;
|
|
69
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return !!getPreviousStep(flow, currentStep);
|
|
73
|
+
},
|
|
74
|
+
setFlow: (flow) => set({ flow }),
|
|
75
|
+
isLogin: () => get().flow === "login",
|
|
76
|
+
isAccount: () => get().flow === "account",
|
|
77
|
+
setAuthState: (authState) => {
|
|
78
|
+
let flow = get().flow, newFlow;
|
|
79
|
+
switch (authState == null ? void 0 : authState.stage) {
|
|
80
|
+
case "login":
|
|
81
|
+
newFlow = "login";
|
|
82
|
+
break;
|
|
83
|
+
case "signup":
|
|
84
|
+
case "verify":
|
|
85
|
+
newFlow = flow === "guest" ? "guest" : "signup";
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
set(__spreadValues({ authState }, newFlow ? { flow: newFlow } : {}));
|
|
91
|
+
},
|
|
92
|
+
getVerifyState: () => {
|
|
93
|
+
const authState = get().authState;
|
|
94
|
+
return (authState == null ? void 0 : authState.stage) === "verify" ? authState : void 0;
|
|
95
|
+
},
|
|
96
|
+
getLoginState: () => {
|
|
97
|
+
const authState = get().authState;
|
|
98
|
+
return (authState == null ? void 0 : authState.stage) === "login" ? authState : void 0;
|
|
99
|
+
},
|
|
100
|
+
getSignupState: () => {
|
|
101
|
+
const authState = get().authState;
|
|
102
|
+
return (authState == null ? void 0 : authState.stage) === "signup" ? authState : void 0;
|
|
103
|
+
},
|
|
104
|
+
setOnRampPurchase: (onRampPurchase) => set((state) => ({ onRampPurchase: __spreadValues(__spreadValues({}, state.onRampPurchase || {}), onRampPurchase) })),
|
|
105
|
+
setOnRampConfig: (onRampConfig) => set({ onRampConfig }),
|
|
106
|
+
setOnRampStep: (onRampStep) => set({ onRampStep }),
|
|
107
|
+
setIsFullyLoggedIn: (isFullyLoggedIn) => set({ isFullyLoggedIn }),
|
|
108
|
+
setAccountAddFundTab: (accountAddFundTab) => set({ accountAddFundTab }),
|
|
109
|
+
setGuestAddFundsTab: (guestAddFundsTab) => set({ guestAddFundsTab }),
|
|
110
|
+
setSelectedExternalWalletId: (selectedExternalWalletId) => set({ selectedExternalWalletId }),
|
|
111
|
+
setIsExternalWalletConnecting: (isExternalWalletConnecting) => set({ isExternalWalletConnecting }),
|
|
112
|
+
setExternalWalletError: (externalWalletError) => set({ externalWalletError }),
|
|
113
|
+
setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
|
|
114
|
+
setStepDirection: (stepDirection) => set({ stepDirection }),
|
|
115
|
+
setFarcasterConnectUri: (farcasterConnectUri) => set({ farcasterConnectUri }),
|
|
116
|
+
setTwoFactorStatus: (twoFactorStatus) => set({ twoFactorStatus }),
|
|
117
|
+
setIFrameUrl: (iFrameUrl) => set({ iFrameUrl }),
|
|
118
|
+
setIsIFrameReady: (isIFrameReady) => set({ isIFrameReady }),
|
|
119
|
+
setAuthLayout: (authLayout) => {
|
|
120
|
+
const types = [];
|
|
121
|
+
const uniqueLayouts = [];
|
|
122
|
+
authLayout.map((layout) => {
|
|
123
|
+
const type = layout.split(":")[0];
|
|
124
|
+
if (!types.includes(type)) {
|
|
125
|
+
uniqueLayouts.push(layout);
|
|
126
|
+
types.push(type);
|
|
127
|
+
} else {
|
|
128
|
+
console.warn(`${layout} is a duplicate ${type} layout type. Please remove the duplicate type from your config.`);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
set({ authLayout: uniqueLayouts });
|
|
132
|
+
},
|
|
133
|
+
setAuthStepRoute: (authStepRoute) => set({ authStepRoute }),
|
|
134
|
+
setIsPasskeySupported: (isPasskeySupported) => set({ isPasskeySupported }),
|
|
135
|
+
setAccountLinkOptions: (accountLinkOptions) => set({ accountLinkOptions })
|
|
136
|
+
});
|
|
137
|
+
export {
|
|
138
|
+
getActions
|
|
139
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ModalStep } from '../../utils/steps.js';
|
|
2
|
+
import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify, OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType, Setup2faResponse, SupportedAccountLinks } from '@getpara/web-sdk';
|
|
3
|
+
import { Tab as AddFundsTabType } from '../../components/AddFunds/AddFundsContext.js';
|
|
4
|
+
import { TAuthLayout } from '../../types/modalProps.js';
|
|
5
|
+
import { MutableRefObject } from 'react';
|
|
6
|
+
export type Flow = AuthStateSignup['stage'] | AuthStateLogin['stage'] | 'account' | 'guest';
|
|
7
|
+
type ActiveWallet = [string | undefined, TWalletType | undefined];
|
|
8
|
+
export declare enum OnRampStep {
|
|
9
|
+
SETTINGS = 0,
|
|
10
|
+
PROVIDER = 1
|
|
11
|
+
}
|
|
12
|
+
export type OnRampConfig = OnRampConfigBase & {
|
|
13
|
+
testMode?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface OnModalStepChangeValue {
|
|
16
|
+
previousStep: ModalStep;
|
|
17
|
+
currentStep: ModalStep;
|
|
18
|
+
canGoBack: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface ModalState {
|
|
21
|
+
recoveryShare: string | null;
|
|
22
|
+
step: ModalStep;
|
|
23
|
+
stepDirection: 1 | -1;
|
|
24
|
+
flow: Flow | undefined;
|
|
25
|
+
authState: AuthState | undefined;
|
|
26
|
+
onModalStepChange?: (value: OnModalStepChangeValue) => void | undefined;
|
|
27
|
+
onRampConfig: OnRampConfig | undefined;
|
|
28
|
+
onRampPurchase: Partial<OnRampPurchase> | undefined;
|
|
29
|
+
onRampStep: OnRampStep;
|
|
30
|
+
isFullyLoggedIn: boolean;
|
|
31
|
+
accountAddFundTab?: AddFundsTabType;
|
|
32
|
+
guestAddFundsTab?: AddFundsTabType;
|
|
33
|
+
selectedExternalWalletId?: string;
|
|
34
|
+
isUsingMobileConnector?: boolean;
|
|
35
|
+
isExternalWalletConnecting?: boolean;
|
|
36
|
+
externalWalletError?: string[];
|
|
37
|
+
activeWallet: ActiveWallet | undefined;
|
|
38
|
+
farcasterConnectUri: string | undefined;
|
|
39
|
+
twoFactorStatus: Setup2faResponse | undefined;
|
|
40
|
+
iFrameUrl: string | undefined;
|
|
41
|
+
isIFrameReady: boolean | undefined;
|
|
42
|
+
authLayout?: TAuthLayout[];
|
|
43
|
+
authStepRoute: ModalStep | undefined;
|
|
44
|
+
refs: {
|
|
45
|
+
popupWindow: MutableRefObject<Window | null>;
|
|
46
|
+
poll: MutableRefObject<{
|
|
47
|
+
action: 'login' | 'signup';
|
|
48
|
+
timeout: number;
|
|
49
|
+
} | null>;
|
|
50
|
+
currentStep: MutableRefObject<ModalStep | null>;
|
|
51
|
+
telegramIFrame: MutableRefObject<HTMLIFrameElement | null>;
|
|
52
|
+
wasSignedIn: MutableRefObject<boolean | null>;
|
|
53
|
+
initialFarcasterConnected: MutableRefObject<boolean | null>;
|
|
54
|
+
};
|
|
55
|
+
isPasskeySupported: boolean;
|
|
56
|
+
accountLinkOptions: SupportedAccountLinks;
|
|
57
|
+
}
|
|
58
|
+
export interface ModalActions {
|
|
59
|
+
resetState: () => void;
|
|
60
|
+
setRecoveryShare: (recoveryShare: string | null) => void;
|
|
61
|
+
setStep: (step: ModalStep) => void;
|
|
62
|
+
setGuestAddFundsTab: (tab?: AddFundsTabType | undefined) => void;
|
|
63
|
+
decrementStep: () => void;
|
|
64
|
+
hasPreviousStep: () => boolean;
|
|
65
|
+
setFlow: (flow?: Flow) => void;
|
|
66
|
+
setAuthState: (authState?: AuthState | undefined) => void;
|
|
67
|
+
getVerifyState: () => AuthStateVerify | undefined;
|
|
68
|
+
getSignupState: () => AuthStateSignup | undefined;
|
|
69
|
+
getLoginState: () => AuthStateLogin | undefined;
|
|
70
|
+
isLogin: () => boolean;
|
|
71
|
+
isAccount: () => boolean;
|
|
72
|
+
setOnModalStepChange: (fn?: (value: OnModalStepChangeValue) => void) => void;
|
|
73
|
+
setOnRampConfig: (_: OnRampConfig | undefined) => void;
|
|
74
|
+
setOnRampPurchase: (_: Partial<OnRampPurchase> | undefined) => void;
|
|
75
|
+
setOnRampStep: (_: OnRampStep) => void;
|
|
76
|
+
setIsFullyLoggedIn: (isFullyLoggedIn: boolean) => void;
|
|
77
|
+
setAccountAddFundTab: (accountAddFundTab?: AddFundsTabType) => void;
|
|
78
|
+
setSelectedExternalWalletId: (id?: string) => void;
|
|
79
|
+
setIsUsingMobileConnector: (isUsingMobileConnector?: boolean) => void;
|
|
80
|
+
setIsExternalWalletConnecting: (isExternalWalletConnecting: boolean) => void;
|
|
81
|
+
setExternalWalletError: (externalWalletError?: string[]) => void;
|
|
82
|
+
setStepDirection: (stepDirection: 1 | -1) => void;
|
|
83
|
+
setFarcasterConnectUri: (_: string | undefined) => void;
|
|
84
|
+
setTwoFactorStatus: (twoFactorStatus?: Setup2faResponse) => void;
|
|
85
|
+
setIFrameUrl: (_?: string) => void;
|
|
86
|
+
setIsIFrameReady: (_?: boolean) => void;
|
|
87
|
+
setAuthLayout: (authLayout: TAuthLayout[]) => void;
|
|
88
|
+
setAuthStepRoute: (_?: ModalStep) => void;
|
|
89
|
+
setIsPasskeySupported: (_: boolean) => void;
|
|
90
|
+
setAccountLinkOptions: (_: SupportedAccountLinks) => void;
|
|
91
|
+
}
|
|
92
|
+
export type ModalStore = ModalState & ModalActions;
|
|
93
|
+
export declare const DEFAULT_MODAL_STATE: Omit<ModalState, 'step' | 'onRampConfig'>;
|
|
94
|
+
export declare const useModalStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ModalStore>, "persist"> & {
|
|
95
|
+
persist: {
|
|
96
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ModalStore, unknown>>) => void;
|
|
97
|
+
clearStorage: () => void;
|
|
98
|
+
rehydrate: () => Promise<void> | void;
|
|
99
|
+
hasHydrated: () => boolean;
|
|
100
|
+
onHydrate: (fn: (state: ModalStore) => void) => () => void;
|
|
101
|
+
onFinishHydration: (fn: (state: ModalStore) => void) => () => void;
|
|
102
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<ModalStore, unknown>>;
|
|
103
|
+
};
|
|
104
|
+
}>;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { create } from "zustand";
|
|
6
|
+
import { persist, createJSONStorage } from "zustand/middleware";
|
|
7
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
8
|
+
import { getActions } from "./actions.js";
|
|
9
|
+
import {
|
|
10
|
+
LINKED_ACCOUNT_TYPES
|
|
11
|
+
} from "@getpara/web-sdk";
|
|
12
|
+
import { AuthLayout } from "../../types/modalProps.js";
|
|
13
|
+
import { createRef } from "react";
|
|
14
|
+
var OnRampStep = /* @__PURE__ */ ((OnRampStep2) => {
|
|
15
|
+
OnRampStep2[OnRampStep2["SETTINGS"] = 0] = "SETTINGS";
|
|
16
|
+
OnRampStep2[OnRampStep2["PROVIDER"] = 1] = "PROVIDER";
|
|
17
|
+
return OnRampStep2;
|
|
18
|
+
})(OnRampStep || {});
|
|
19
|
+
const DEFAULT_MODAL_STATE = {
|
|
20
|
+
recoveryShare: null,
|
|
21
|
+
flow: void 0,
|
|
22
|
+
stepDirection: 1,
|
|
23
|
+
authState: void 0,
|
|
24
|
+
onModalStepChange: void 0,
|
|
25
|
+
onRampPurchase: void 0,
|
|
26
|
+
onRampStep: 0 /* SETTINGS */,
|
|
27
|
+
isFullyLoggedIn: false,
|
|
28
|
+
accountAddFundTab: void 0,
|
|
29
|
+
guestAddFundsTab: void 0,
|
|
30
|
+
isExternalWalletConnecting: false,
|
|
31
|
+
externalWalletError: void 0,
|
|
32
|
+
activeWallet: [void 0, void 0],
|
|
33
|
+
farcasterConnectUri: void 0,
|
|
34
|
+
twoFactorStatus: void 0,
|
|
35
|
+
iFrameUrl: void 0,
|
|
36
|
+
isIFrameReady: void 0,
|
|
37
|
+
authLayout: [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
|
|
38
|
+
authStepRoute: void 0,
|
|
39
|
+
refs: {
|
|
40
|
+
popupWindow: createRef(),
|
|
41
|
+
poll: createRef(),
|
|
42
|
+
currentStep: createRef(),
|
|
43
|
+
telegramIFrame: createRef(),
|
|
44
|
+
wasSignedIn: createRef(),
|
|
45
|
+
initialFarcasterConnected: createRef()
|
|
46
|
+
},
|
|
47
|
+
isPasskeySupported: true,
|
|
48
|
+
accountLinkOptions: [...LINKED_ACCOUNT_TYPES]
|
|
49
|
+
};
|
|
50
|
+
const useModalStore = create()(
|
|
51
|
+
persist(
|
|
52
|
+
(set, get) => __spreadValues(__spreadValues({
|
|
53
|
+
step: ModalStep.AUTH_MAIN,
|
|
54
|
+
onRampConfig: void 0
|
|
55
|
+
}, DEFAULT_MODAL_STATE), getActions(set, get)),
|
|
56
|
+
{
|
|
57
|
+
version: 1,
|
|
58
|
+
name: "@PARA/modalState",
|
|
59
|
+
storage: createJSONStorage(() => localStorage),
|
|
60
|
+
partialize: (state) => ({
|
|
61
|
+
step: state.step,
|
|
62
|
+
authState: state.authState,
|
|
63
|
+
onRampPurchase: state.onRampPurchase,
|
|
64
|
+
selectedExternalWalletId: state.selectedExternalWalletId,
|
|
65
|
+
isUsingMobileConnector: state.isUsingMobileConnector,
|
|
66
|
+
isPasskeySupported: state.isPasskeySupported
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
export {
|
|
72
|
+
DEFAULT_MODAL_STATE,
|
|
73
|
+
OnRampStep,
|
|
74
|
+
useModalStore
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import ParaWeb, { CurrentWalletIds, SupportedAccountLinks, TOAuthMethod } from '@getpara/web-sdk';
|
|
2
|
+
import { Theme } from '@getpara/react-components';
|
|
3
|
+
import { OnModalStepChangeValue } from '../stores/index.js';
|
|
4
|
+
import { ModalStep, ModalStepProp } from '../utils/steps.js';
|
|
5
|
+
export type ParaModalHandle = {
|
|
6
|
+
/**
|
|
7
|
+
* Move the modal backward
|
|
8
|
+
*/
|
|
9
|
+
goBack: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Returns if the modal can go back
|
|
12
|
+
*/
|
|
13
|
+
canGoBack: () => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Returns if the modal is expanded
|
|
16
|
+
*/
|
|
17
|
+
currentStep: () => ModalStep;
|
|
18
|
+
/**
|
|
19
|
+
* Trigger the modal close handler
|
|
20
|
+
*/
|
|
21
|
+
handleModalClose: () => void;
|
|
22
|
+
};
|
|
23
|
+
export type OAuthLogoVariantType = 'dark' | 'light' | 'default';
|
|
24
|
+
export type ParaModalTheme = Theme & {
|
|
25
|
+
oAuthLogoVariant?: OAuthLogoVariantType;
|
|
26
|
+
};
|
|
27
|
+
export declare enum AuthLayout {
|
|
28
|
+
AUTH_FULL = "AUTH:FULL",
|
|
29
|
+
AUTH_CONDENSED = "AUTH:CONDENSED",
|
|
30
|
+
EXTERNAL_FULL = "EXTERNAL:FULL",
|
|
31
|
+
EXTERNAL_CONDENSED = "EXTERNAL:CONDENSED"
|
|
32
|
+
}
|
|
33
|
+
export type TAuthLayout = `${AuthLayout}`;
|
|
34
|
+
export interface ParaModalProps {
|
|
35
|
+
/**
|
|
36
|
+
* Your ParaWeb instance.
|
|
37
|
+
*/
|
|
38
|
+
para?: ParaWeb;
|
|
39
|
+
/**
|
|
40
|
+
* Whether or not the modal is open.
|
|
41
|
+
*/
|
|
42
|
+
isOpen?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether or not to show two-factor authentication steps to users.
|
|
45
|
+
* Defaults to `false`.
|
|
46
|
+
*/
|
|
47
|
+
twoFactorAuthEnabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether or not to show the wallet recovery to users.
|
|
50
|
+
* Defaults to `false`
|
|
51
|
+
*/
|
|
52
|
+
recoverySecretStepEnabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Which OAuth methods (if any) to show.
|
|
55
|
+
* Defaults to `true`.
|
|
56
|
+
*/
|
|
57
|
+
oAuthMethods?: TOAuthMethod[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether or not to allow for email login. If true, only OAuth login will be available.
|
|
60
|
+
* Defaults to `false`.
|
|
61
|
+
*/
|
|
62
|
+
disableEmailLogin?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether or not to allow for phone login. If true, only OAuth login will be available.
|
|
65
|
+
* Defaults to `false`.
|
|
66
|
+
*/
|
|
67
|
+
disablePhoneLogin?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Theming to be used throughout the modal.
|
|
70
|
+
*/
|
|
71
|
+
theme?: ParaModalTheme;
|
|
72
|
+
/**
|
|
73
|
+
* Logo to be shown throughout the modal.
|
|
74
|
+
*/
|
|
75
|
+
logo?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether or not to run configured on-ramp providers in test mode.
|
|
78
|
+
*/
|
|
79
|
+
onRampTestMode?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether to display information about on-chain wallets and use related terminology in the Para Modal.
|
|
82
|
+
*/
|
|
83
|
+
hideWallets?: boolean;
|
|
84
|
+
currentStepOverride?: ModalStepProp | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Whether or not to display just the modal without the overlay component.
|
|
87
|
+
* Useful for rendering the modal inside a custom component
|
|
88
|
+
* Defaults to `false`
|
|
89
|
+
*/
|
|
90
|
+
bareModal?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether or not to use the embedded modal styling
|
|
93
|
+
* This is typically only used internally by Para and may result in unwanted styling!
|
|
94
|
+
*/
|
|
95
|
+
embeddedModal?: boolean;
|
|
96
|
+
className?: string;
|
|
97
|
+
/**
|
|
98
|
+
* How the modal should order the components on the main auth screen.
|
|
99
|
+
* Only the first method of each type (auth or external) will be used.
|
|
100
|
+
* Default to [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL]
|
|
101
|
+
*/
|
|
102
|
+
authLayout?: TAuthLayout[];
|
|
103
|
+
/**
|
|
104
|
+
* Default email or phone number (formatted like: +15555555555) to pre-populate the input field.
|
|
105
|
+
*/
|
|
106
|
+
defaultAuthIdentifier?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Called when the modal step changes
|
|
109
|
+
*/
|
|
110
|
+
onModalStepChange?: (value: OnModalStepChangeValue) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Called when the modal is closed
|
|
113
|
+
*/
|
|
114
|
+
onClose?: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to enable guest login. A guest user will be provisioned embedded wallets that they will then claim upon signing up through your app.
|
|
117
|
+
*/
|
|
118
|
+
isGuestModeEnabled?: boolean;
|
|
119
|
+
loginTransitionOverride?: (para: ParaWeb) => Promise<void>;
|
|
120
|
+
createWalletOverride?: (para: ParaWeb) => Promise<{
|
|
121
|
+
recoverySecret?: string;
|
|
122
|
+
walletIds: CurrentWalletIds;
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Which external accounts or wallets to allow your users to link to their accounts. The accounts will be displayed in this order in the modal account screen.
|
|
126
|
+
* If not provided, will default to your Developer Portal configuration or to all available account types.
|
|
127
|
+
*/
|
|
128
|
+
supportedAccountLinks?: SupportedAccountLinks;
|
|
129
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
var AuthLayout = /* @__PURE__ */ ((AuthLayout2) => {
|
|
4
|
+
AuthLayout2["AUTH_FULL"] = "AUTH:FULL";
|
|
5
|
+
AuthLayout2["AUTH_CONDENSED"] = "AUTH:CONDENSED";
|
|
6
|
+
AuthLayout2["EXTERNAL_FULL"] = "EXTERNAL:FULL";
|
|
7
|
+
AuthLayout2["EXTERNAL_CONDENSED"] = "EXTERNAL:CONDENSED";
|
|
8
|
+
return AuthLayout2;
|
|
9
|
+
})(AuthLayout || {});
|
|
10
|
+
export {
|
|
11
|
+
AuthLayout
|
|
12
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Auth } from '@getpara/user-management-client';
|
|
2
|
+
import countryCodes from './countryCodes.js';
|
|
3
|
+
export declare function isCcMatch(countryCode: string, option: (typeof countryCodes)[number]): boolean;
|
|
4
|
+
export declare function validateAuth(auth: Auth<'email' | 'phone'>): Auth<'email' | 'phone'>;
|
|
5
|
+
export declare function validateInput(identifier: string, countryCode?: string, type?: 'email' | 'phone'): Auth<"email" | "phone">;
|