@getpara/react-sdk 2.0.0-alpha.7 → 2.0.0-alpha.71
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/README.md +21 -0
- package/dist/cosmos/actions/getCosmjsAminoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsAminoSigner.js +16 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.js +16 -0
- package/dist/cosmos/actions/index.d.ts +2 -0
- package/dist/cosmos/actions/index.js +3 -0
- package/dist/cosmos/hooks/index.d.ts +2 -0
- package/dist/cosmos/hooks/index.js +3 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.js +37 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.js +37 -0
- package/dist/cosmos/index.d.ts +2 -0
- package/dist/cosmos/index.js +3 -0
- package/dist/css/modal.css +14 -1
- package/dist/evm/actions/getViemAccount.d.ts +22 -0
- package/dist/evm/actions/getViemAccount.js +20 -0
- package/dist/evm/actions/getViemClient.d.ts +17993 -0
- package/dist/evm/actions/getViemClient.js +25 -0
- package/dist/evm/actions/index.d.ts +2 -0
- package/dist/evm/actions/index.js +3 -0
- package/dist/evm/hooks/index.d.ts +2 -0
- package/dist/evm/hooks/index.js +3 -0
- package/dist/evm/hooks/useViemAccount.d.ts +26 -0
- package/dist/evm/hooks/useViemAccount.js +32 -0
- package/dist/evm/hooks/useViemClient.d.ts +17997 -0
- package/dist/evm/hooks/useViemClient.js +30 -0
- package/dist/evm/index.d.ts +2 -0
- package/dist/evm/index.js +3 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.js +4 -9
- package/dist/provider/ParaProvider.d.ts +1 -2
- package/dist/provider/ParaProvider.js +17 -76
- package/dist/public/PPMori-Regular.woff2 +0 -0
- package/dist/public/PPMori-SemiBold.woff2 +0 -0
- package/dist/solana/actions/getSolanaSigner.d.ts +8 -0
- package/dist/solana/actions/getSolanaSigner.js +15 -0
- package/dist/solana/actions/index.d.ts +1 -0
- package/dist/solana/actions/index.js +2 -0
- package/dist/solana/hooks/index.d.ts +1 -0
- package/dist/solana/hooks/index.js +2 -0
- package/dist/solana/hooks/useSolanaSigner.d.ts +12 -0
- package/dist/solana/hooks/useSolanaSigner.js +32 -0
- package/dist/solana/index.d.ts +2 -0
- package/dist/solana/index.js +3 -0
- package/package.json +37 -51
- package/styles.css/package.json +1 -1
- package/dist/cli/cli.mjs +0 -35
- package/dist/modal/ParaModal.d.ts +0 -2
- package/dist/modal/ParaModal.js +0 -262
- package/dist/modal/components/Account/Account.d.ts +0 -5
- package/dist/modal/components/Account/Account.js +0 -139
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFunds.js +0 -69
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAsset.js +0 -125
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -78
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +0 -31
- package/dist/modal/components/AddFunds/AddFundsContext.js +0 -160
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +0 -6
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -49
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.js +0 -109
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.js +0 -83
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsSettings.js +0 -237
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +0 -2
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -7
- package/dist/modal/components/AddFunds/common.d.ts +0 -19
- package/dist/modal/components/AddFunds/common.js +0 -24
- package/dist/modal/components/AddFunds/index.d.ts +0 -3
- package/dist/modal/components/AddFunds/index.js +0 -4
- package/dist/modal/components/AuthInput/AuthInput.d.ts +0 -6
- package/dist/modal/components/AuthInput/AuthInput.js +0 -262
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +0 -7
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +0 -247
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -50
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -157
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +0 -9
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -67
- 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/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +0 -1
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +0 -5
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -49
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +0 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -63
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -55
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +0 -6
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
- package/dist/modal/components/Body/Body.d.ts +0 -11
- package/dist/modal/components/Body/Body.js +0 -327
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +0 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -95
- package/dist/modal/components/ChainSwitch/config.d.ts +0 -7
- package/dist/modal/components/ChainSwitch/config.js +0 -17
- package/dist/modal/components/Controls/Controls.d.ts +0 -5
- package/dist/modal/components/Controls/Controls.js +0 -77
- package/dist/modal/components/Controls/Selects.d.ts +0 -2
- package/dist/modal/components/Controls/Selects.js +0 -189
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -144
- package/dist/modal/components/ExternalWalletStep/config.d.ts +0 -7
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +0 -34
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +0 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -173
- package/dist/modal/components/Footer/Footer.d.ts +0 -1
- package/dist/modal/components/Footer/Footer.js +0 -95
- package/dist/modal/components/Header/Header.d.ts +0 -1
- package/dist/modal/components/Header/Header.js +0 -43
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +0 -3
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -54
- package/dist/modal/components/Hero/Hero.d.ts +0 -1
- package/dist/modal/components/Hero/Hero.js +0 -116
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +0 -1
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -59
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +0 -1
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -31
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -10
- package/dist/modal/components/ModalContent/ModalContent.js +0 -95
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +0 -2
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -27
- package/dist/modal/components/OAuth/OAuth.d.ts +0 -6
- package/dist/modal/components/OAuth/OAuth.js +0 -79
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +0 -1
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -90
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +0 -1
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +0 -9
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +0 -6
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -107
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +0 -5
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -132
- package/dist/modal/components/StripeComponents/StripeComponents.d.ts +0 -16
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -88
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +0 -5
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -27
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +0 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -143
- package/dist/modal/components/Waiting/Waiting.d.ts +0 -6
- package/dist/modal/components/Waiting/Waiting.js +0 -17
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
- package/dist/modal/components/WalletCard/WalletCard.d.ts +0 -18
- package/dist/modal/components/WalletCard/WalletCard.js +0 -128
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +0 -6
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -73
- package/dist/modal/components/common.d.ts +0 -42
- package/dist/modal/components/common.js +0 -175
- package/dist/modal/components/index.d.ts +0 -1
- package/dist/modal/components/index.js +0 -2
- package/dist/modal/constants/constants.d.ts +0 -39
- package/dist/modal/constants/constants.js +0 -138
- package/dist/modal/constants/defaults.d.ts +0 -5
- package/dist/modal/constants/defaults.js +0 -10
- package/dist/modal/constants/oAuthLogos.d.ts +0 -8
- package/dist/modal/constants/oAuthLogos.js +0 -24
- package/dist/modal/hooks/useGoBack.d.ts +0 -1
- package/dist/modal/hooks/useGoBack.js +0 -43
- package/dist/modal/index.d.ts +0 -8
- package/dist/modal/index.js +0 -29
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +0 -2
- package/dist/modal/stores/modal/actions.d.ts +0 -3
- package/dist/modal/stores/modal/actions.js +0 -133
- package/dist/modal/stores/modal/useModalStore.d.ts +0 -102
- package/dist/modal/stores/modal/useModalStore.js +0 -68
- package/dist/modal/types/commonTypes.d.ts +0 -6
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.d.ts +0 -33
- package/dist/modal/types/externalWallets.js +0 -32
- package/dist/modal/types/modalProps.d.ts +0 -124
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authInputHelpers.d.ts +0 -7
- package/dist/modal/utils/authInputHelpers.js +0 -38
- package/dist/modal/utils/authLayoutHelpers.d.ts +0 -3
- package/dist/modal/utils/authLayoutHelpers.js +0 -8
- package/dist/modal/utils/countryCodes.d.ts +0 -8
- package/dist/modal/utils/countryCodes.js +0 -45
- package/dist/modal/utils/getMailtoLink.d.ts +0 -1
- package/dist/modal/utils/getMailtoLink.js +0 -10
- package/dist/modal/utils/getTileButtonFlex.d.ts +0 -1
- package/dist/modal/utils/getTileButtonFlex.js +0 -20
- package/dist/modal/utils/isPasskeySupported.d.ts +0 -1
- package/dist/modal/utils/isPasskeySupported.js +0 -15
- package/dist/modal/utils/openPopup.d.ts +0 -6
- package/dist/modal/utils/openPopup.js +0 -60
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
- package/dist/modal/utils/steps.d.ts +0 -120
- package/dist/modal/utils/steps.js +0 -247
- package/dist/modal/utils/stringFormatters.d.ts +0 -5
- package/dist/modal/utils/stringFormatters.js +0 -19
- package/dist/modal/utils/validateOnRampConfig.d.ts +0 -5
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/provider/actions/getAccount.d.ts +0 -26
- package/dist/provider/actions/getAccount.js +0 -51
- package/dist/provider/actions/getWallet.d.ts +0 -5
- package/dist/provider/actions/getWallet.js +0 -14
- package/dist/provider/actions/index.d.ts +0 -27
- package/dist/provider/actions/index.js +0 -59
- package/dist/provider/actions/utils.d.ts +0 -3
- package/dist/provider/actions/utils.js +0 -15
- package/dist/provider/components/CosmosWalletWrapper.d.ts +0 -11
- package/dist/provider/components/CosmosWalletWrapper.js +0 -34
- package/dist/provider/components/EvmWalletWrapper.d.ts +0 -12
- package/dist/provider/components/EvmWalletWrapper.js +0 -34
- package/dist/provider/components/ExternalWalletWrapper.d.ts +0 -8
- package/dist/provider/components/ExternalWalletWrapper.js +0 -139
- package/dist/provider/components/SolanaWalletWrapper.d.ts +0 -9
- package/dist/provider/components/SolanaWalletWrapper.js +0 -36
- package/dist/provider/external/getParaCosmosConnector.d.ts +0 -7
- package/dist/provider/external/getParaCosmosConnector.js +0 -22
- package/dist/provider/external/getParaEvmConnector.d.ts +0 -7
- package/dist/provider/external/getParaEvmConnector.js +0 -22
- package/dist/provider/external/getParaSolanaConnector.d.ts +0 -7
- package/dist/provider/external/getParaSolanaConnector.js +0 -22
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +0 -12
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +0 -18
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +0 -3
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +0 -21
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +0 -8
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +0 -14
- package/dist/provider/hooks/index.d.ts +0 -3
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/index.d.ts +0 -26
- package/dist/provider/hooks/mutations/index.js +0 -61
- package/dist/provider/hooks/mutations/utils.d.ts +0 -4
- package/dist/provider/hooks/mutations/utils.js +0 -22
- package/dist/provider/hooks/queries/index.d.ts +0 -3
- package/dist/provider/hooks/queries/index.js +0 -10
- package/dist/provider/hooks/queries/useAccount.d.ts +0 -5
- package/dist/provider/hooks/queries/useAccount.js +0 -21
- package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
- package/dist/provider/hooks/queries/useWallet.js +0 -22
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -6
- package/dist/provider/hooks/queries/useWalletBalance.js +0 -55
- package/dist/provider/hooks/utils/index.d.ts +0 -3
- package/dist/provider/hooks/utils/index.js +0 -10
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
- package/dist/provider/hooks/utils/useClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useClient.js +0 -10
- package/dist/provider/hooks/utils/useEventListeners.d.ts +0 -2
- package/dist/provider/hooks/utils/useEventListeners.js +0 -147
- package/dist/provider/hooks/utils/useInternalClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useInternalClient.js +0 -10
- package/dist/provider/hooks/utils/useModal.d.ts +0 -8
- package/dist/provider/hooks/utils/useModal.js +0 -17
- package/dist/provider/hooks/utils/useWalletState.d.ts +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -48
- package/dist/provider/index.d.ts +0 -4
- package/dist/provider/index.js +0 -9
- package/dist/provider/providers/AuthProvider.d.ts +0 -35
- package/dist/provider/providers/AuthProvider.js +0 -498
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/CosmosExternalWalletProvider.js +0 -66
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/EvmExternalWalletProvider.js +0 -74
- package/dist/provider/providers/ExternalWalletProvider.d.ts +0 -76
- package/dist/provider/providers/ExternalWalletProvider.js +0 -428
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/SolanaExternalWalletProvider.js +0 -66
- package/dist/provider/stores/getters.d.ts +0 -4
- package/dist/provider/stores/getters.js +0 -13
- package/dist/provider/stores/setters.d.ts +0 -1
- package/dist/provider/stores/setters.js +0 -7
- package/dist/provider/stores/slices/client.d.ts +0 -3
- package/dist/provider/stores/slices/client.js +0 -9
- package/dist/provider/stores/slices/config.d.ts +0 -3
- package/dist/provider/stores/slices/config.js +0 -9
- package/dist/provider/stores/slices/externalWallets.d.ts +0 -3
- package/dist/provider/stores/slices/externalWallets.js +0 -40
- package/dist/provider/stores/slices/index.d.ts +0 -4
- package/dist/provider/stores/slices/index.js +0 -5
- package/dist/provider/stores/slices/modal.d.ts +0 -3
- package/dist/provider/stores/slices/modal.js +0 -16
- package/dist/provider/stores/slices/wallet.d.ts +0 -3
- package/dist/provider/stores/slices/wallet.js +0 -13
- package/dist/provider/stores/types.d.ts +0 -64
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.d.ts +0 -17
- package/dist/provider/stores/useStore.js +0 -28
- package/dist/provider/types/externalWalletProviders.d.ts +0 -12
- package/dist/provider/types/externalWalletProviders.js +0 -1
- package/dist/provider/types/provider.d.ts +0 -147
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.d.ts +0 -3
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.d.ts +0 -22
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/constants.d.ts +0 -5
- package/dist/provider/utils/constants.js +0 -10
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +0 -7
- package/dist/provider/utils/paraConfigTypeGuards.js +0 -13
- package/dist/provider/utils/renameMutations.d.ts +0 -5
- package/dist/provider/utils/renameMutations.js +0 -18
package/dist/modal/ParaModal.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__objRest,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../chunk-MMUBH76A.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { CpslAuthModal, defineCustomElements, generateTheme } from "@getpara/react-components";
|
|
9
|
-
import { ModalContent } from "./components/index.js";
|
|
10
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
11
|
-
import { useModalStore } from "./stores/index.js";
|
|
12
|
-
import { ModalStep, RESET_TO_ACCOUNT_STEPS, RESET_TO_AUTH_STEPS } from "./utils/steps.js";
|
|
13
|
-
import { AuthLayout } from "./types/modalProps.js";
|
|
14
|
-
import { DEFAULTS } from "./constants/defaults.js";
|
|
15
|
-
import { useGoBack } from "./hooks/useGoBack.js";
|
|
16
|
-
import styled from "styled-components";
|
|
17
|
-
import { hasEmbeddedAuth, hasExternalWallet } from "./utils/authLayoutHelpers.js";
|
|
18
|
-
import { useModal, useWalletState } from "../provider/index.js";
|
|
19
|
-
import { useInternalClient } from "../provider/hooks/utils/useInternalClient.js";
|
|
20
|
-
import { useExternalWallets } from "../provider/providers/ExternalWalletProvider.js";
|
|
21
|
-
import { useStore } from "../provider/stores/useStore.js";
|
|
22
|
-
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
23
|
-
import { useAuthActions } from "../provider/providers/AuthProvider.js";
|
|
24
|
-
import { validateAuth } from "./utils/authInputHelpers.js";
|
|
25
|
-
defineCustomElements();
|
|
26
|
-
const ParaModal = forwardRef((props, ref) => {
|
|
27
|
-
const storedModalConfig = useStore((state) => state.modalConfig);
|
|
28
|
-
const modalContentRef = useRef(null);
|
|
29
|
-
const currentStep = useModalStore((state) => state.step);
|
|
30
|
-
const setAuthState = useModalStore((state) => state.setAuthState);
|
|
31
|
-
const setOnModalStepChange = useModalStore((state) => state.setOnModalStepChange);
|
|
32
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
33
|
-
const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
|
|
34
|
-
const setFlow = useModalStore((state) => state.setFlow);
|
|
35
|
-
const setIsFullyLoggedIn = useModalStore((state) => state.setIsFullyLoggedIn);
|
|
36
|
-
const goBack = useGoBack();
|
|
37
|
-
const setAuthLayout = useModalStore((state) => state.setAuthLayout);
|
|
38
|
-
const storedAuthLayout = useModalStore((state) => state.authLayout);
|
|
39
|
-
const resetModalState = useModalStore((state) => state.resetState);
|
|
40
|
-
const setRecoveryShare = useModalStore((state) => state.setRecoveryShare);
|
|
41
|
-
const { disconnectExternalWallet } = useExternalWallets();
|
|
42
|
-
const { isOpen: storedIsOpen, closeModal } = useModal();
|
|
43
|
-
const para = useInternalClient();
|
|
44
|
-
const { setSelectedWallet, updateSelectedWallet } = useWalletState();
|
|
45
|
-
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
46
|
-
const { signUpOrLogIn, isCreateGuestWalletsPending } = useAuthActions();
|
|
47
|
-
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
48
|
-
const [isInit, setIsInit] = useState(false);
|
|
49
|
-
const externalWallets = useStore((state) => state.externalWallets);
|
|
50
|
-
const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
|
|
51
|
-
isOpen: configIsOpen,
|
|
52
|
-
theme,
|
|
53
|
-
disableEmailLogin = false,
|
|
54
|
-
disablePhoneLogin = false,
|
|
55
|
-
isGuestModeEnabled = false,
|
|
56
|
-
oAuthMethods = ["GOOGLE", "TWITTER"],
|
|
57
|
-
bareModal = false,
|
|
58
|
-
className,
|
|
59
|
-
currentStepOverride,
|
|
60
|
-
authLayout = [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
|
|
61
|
-
embeddedModal,
|
|
62
|
-
onModalStepChange,
|
|
63
|
-
onClose,
|
|
64
|
-
defaultAuthIdentifier
|
|
65
|
-
} = _a, rest = __objRest(_a, [
|
|
66
|
-
"isOpen",
|
|
67
|
-
"theme",
|
|
68
|
-
"disableEmailLogin",
|
|
69
|
-
"disablePhoneLogin",
|
|
70
|
-
"isGuestModeEnabled",
|
|
71
|
-
"oAuthMethods",
|
|
72
|
-
"bareModal",
|
|
73
|
-
"className",
|
|
74
|
-
"currentStepOverride",
|
|
75
|
-
"authLayout",
|
|
76
|
-
"embeddedModal",
|
|
77
|
-
"onModalStepChange",
|
|
78
|
-
"onClose",
|
|
79
|
-
"defaultAuthIdentifier"
|
|
80
|
-
]);
|
|
81
|
-
const isOpen = configIsOpen != null ? configIsOpen : storedIsOpen;
|
|
82
|
-
useImperativeHandle(ref, () => {
|
|
83
|
-
return {
|
|
84
|
-
goBack() {
|
|
85
|
-
goBack();
|
|
86
|
-
},
|
|
87
|
-
canGoBack() {
|
|
88
|
-
return hasPreviousStep;
|
|
89
|
-
},
|
|
90
|
-
currentStep() {
|
|
91
|
-
return currentStep;
|
|
92
|
-
},
|
|
93
|
-
handleModalClose() {
|
|
94
|
-
var _a2;
|
|
95
|
-
(_a2 = modalContentRef == null ? void 0 : modalContentRef.current) == null ? void 0 : _a2.handleModalClose();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}, [hasPreviousStep, currentStep]);
|
|
99
|
-
const initModal = (shouldAutoLogin) => __async(void 0, null, function* () {
|
|
100
|
-
var _a2;
|
|
101
|
-
const isAccount = yield para.isFullyLoggedIn(), isGuest = isAccount && para.isGuestMode || isCreateGuestWalletsPending;
|
|
102
|
-
switch (true) {
|
|
103
|
-
case !!currentStepOverride:
|
|
104
|
-
setStep(ModalStep[currentStepOverride.toUpperCase()]);
|
|
105
|
-
break;
|
|
106
|
-
case isGuest:
|
|
107
|
-
setFlow("guest");
|
|
108
|
-
setStep(isCreateGuestWalletsPending ? ModalStep.AWAITING_GUEST_WALLET_CREATION : ModalStep.ACCOUNT_MAIN);
|
|
109
|
-
setIsFullyLoggedIn(true);
|
|
110
|
-
break;
|
|
111
|
-
case isAccount:
|
|
112
|
-
setFlow("account");
|
|
113
|
-
setStep(ModalStep.ACCOUNT_MAIN);
|
|
114
|
-
setIsFullyLoggedIn(true);
|
|
115
|
-
break;
|
|
116
|
-
default:
|
|
117
|
-
if (currentStep !== ModalStep.AUTH_MAIN && currentStep !== ModalStep.SECRET) {
|
|
118
|
-
setFlow(void 0);
|
|
119
|
-
setStep(para.isTelegram ? ModalStep.TELEGRAM_OAUTH : ModalStep.AUTH_MAIN);
|
|
120
|
-
setAuthState();
|
|
121
|
-
setAuthStepRoute();
|
|
122
|
-
}
|
|
123
|
-
yield disconnectExternalWallet();
|
|
124
|
-
setSelectedWallet({ id: void 0, type: void 0 });
|
|
125
|
-
setIsFullyLoggedIn(false);
|
|
126
|
-
if (shouldAutoLogin) {
|
|
127
|
-
if (defaultAuthIdentifier && ((_a2 = para.authInfo) == null ? void 0 : _a2.identifier) !== defaultAuthIdentifier) {
|
|
128
|
-
const number = parsePhoneNumberFromString(defaultAuthIdentifier);
|
|
129
|
-
try {
|
|
130
|
-
const auth = validateAuth(
|
|
131
|
-
number ? number.nationalNumber : defaultAuthIdentifier,
|
|
132
|
-
(number == null ? void 0 : number.countryCallingCode) ? `+${number == null ? void 0 : number.countryCallingCode}` : void 0,
|
|
133
|
-
number ? "phone" : "email"
|
|
134
|
-
);
|
|
135
|
-
para.setAuth(number ? { phone: defaultAuthIdentifier } : { email: defaultAuthIdentifier });
|
|
136
|
-
signUpOrLogIn(auth);
|
|
137
|
-
} catch (err) {
|
|
138
|
-
console.error("invalid user identifier:", err.message);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
setIsInit(true);
|
|
145
|
-
});
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
let _authLayout = authLayout;
|
|
148
|
-
if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
|
|
149
|
-
_authLayout = _authLayout.filter((l) => !l.includes("EXTERNAL"));
|
|
150
|
-
}
|
|
151
|
-
if (disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout)) {
|
|
152
|
-
_authLayout = _authLayout.filter((l) => !l.includes("AUTH"));
|
|
153
|
-
}
|
|
154
|
-
if (JSON.stringify(storedAuthLayout) !== JSON.stringify(_authLayout)) {
|
|
155
|
-
setAuthLayout(_authLayout);
|
|
156
|
-
}
|
|
157
|
-
}, [disableEmailLogin, disablePhoneLogin, oAuthMethods, externalWallets, authLayout, storedAuthLayout]);
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (theme) {
|
|
160
|
-
generateTheme(theme);
|
|
161
|
-
}
|
|
162
|
-
}, [theme]);
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
setOnModalStepChange(onModalStepChange);
|
|
165
|
-
}, [onModalStepChange]);
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
if (para) {
|
|
168
|
-
initModal();
|
|
169
|
-
} else {
|
|
170
|
-
console.error("A Para instance must be provided.");
|
|
171
|
-
}
|
|
172
|
-
}, []);
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (isOpen && para) {
|
|
175
|
-
initModal(true);
|
|
176
|
-
}
|
|
177
|
-
}, [isOpen]);
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
updateSelectedWallet();
|
|
180
|
-
}, [para]);
|
|
181
|
-
const handleClose = () => {
|
|
182
|
-
closeModal();
|
|
183
|
-
onClose == null ? void 0 : onClose();
|
|
184
|
-
};
|
|
185
|
-
const handleModalEntering = () => {
|
|
186
|
-
setIsModalMounted(true);
|
|
187
|
-
};
|
|
188
|
-
const handleModalExited = () => __async(void 0, null, function* () {
|
|
189
|
-
setIsModalMounted(false);
|
|
190
|
-
if (RESET_TO_AUTH_STEPS.includes(currentStep)) {
|
|
191
|
-
resetModalState();
|
|
192
|
-
setRecoveryShare(null);
|
|
193
|
-
} else if (RESET_TO_ACCOUNT_STEPS.includes(currentStep)) {
|
|
194
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
195
|
-
}
|
|
196
|
-
if (para) {
|
|
197
|
-
yield initModal();
|
|
198
|
-
}
|
|
199
|
-
setIsInit(false);
|
|
200
|
-
});
|
|
201
|
-
if (!para) {
|
|
202
|
-
console.error("A Para instance is required.");
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
if (!(storedAuthLayout == null ? void 0 : storedAuthLayout.length)) {
|
|
206
|
-
const hasExternalWalletError = !(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout);
|
|
207
|
-
const hasEmbeddedWalletError = disableEmailLogin && disablePhoneLogin && !(oAuthMethods == null ? void 0 : oAuthMethods.length) && hasEmbeddedAuth(authLayout);
|
|
208
|
-
if (hasExternalWalletError || hasEmbeddedWalletError) {
|
|
209
|
-
if (hasExternalWalletError) {
|
|
210
|
-
console.error("At least one external wallet must be provided if external wallet auth is enabled.");
|
|
211
|
-
}
|
|
212
|
-
if (hasEmbeddedWalletError) {
|
|
213
|
-
console.error(
|
|
214
|
-
"At least one login method (email, phone or OAuth) must be provided if embedded wallet auth is enabled."
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
console.error("At least one auth layout selection is required.");
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
return /* @__PURE__ */ jsx(
|
|
223
|
-
StyledAuthModal,
|
|
224
|
-
{
|
|
225
|
-
enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
226
|
-
exitTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
227
|
-
open: isOpen,
|
|
228
|
-
onCpslModalExited: handleModalExited,
|
|
229
|
-
onCpslModalEntering: handleModalEntering,
|
|
230
|
-
onCpslModalRequestClose: handleClose,
|
|
231
|
-
noOverlay: bareModal,
|
|
232
|
-
className,
|
|
233
|
-
"data-testid": "modal",
|
|
234
|
-
$embeddedModal: !!embeddedModal,
|
|
235
|
-
children: isModalMounted && ((embeddedModal || bareModal) && isInit || !embeddedModal && !bareModal) && /* @__PURE__ */ jsx(
|
|
236
|
-
ModalContent,
|
|
237
|
-
__spreadValues({
|
|
238
|
-
oAuthMethods,
|
|
239
|
-
disableEmailLogin,
|
|
240
|
-
disablePhoneLogin,
|
|
241
|
-
isGuestModeEnabled,
|
|
242
|
-
onClose: handleClose
|
|
243
|
-
}, rest)
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
});
|
|
248
|
-
const StyledAuthModal = styled(CpslAuthModal)`
|
|
249
|
-
${({ $embeddedModal }) => $embeddedModal && `
|
|
250
|
-
&::part(modal-body-card) {
|
|
251
|
-
--card-box-shadow: none;
|
|
252
|
-
--card-border-width: 0px;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
&::part(modal-footer) {
|
|
256
|
-
--card-box-shadow: none;
|
|
257
|
-
--card-border-width: 0px;
|
|
258
|
-
};`}
|
|
259
|
-
`;
|
|
260
|
-
export {
|
|
261
|
-
ParaModal
|
|
262
|
-
};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import styled from "styled-components";
|
|
7
|
-
import { InnerStepContainer, StepContainer, StyledCpslTileButton } from "../common.js";
|
|
8
|
-
import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
9
|
-
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
10
|
-
import { useState } from "react";
|
|
11
|
-
import { ModalStep } from "../../utils/steps.js";
|
|
12
|
-
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
|
-
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
15
|
-
import { formatBalanceString } from "../../utils/stringFormatters.js";
|
|
16
|
-
import { useAccount, useWalletBalance } from "../../../provider/index.js";
|
|
17
|
-
import { EnabledFlow } from "@getpara/web-sdk";
|
|
18
|
-
const Account = ({ onClose }) => {
|
|
19
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
20
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
21
|
-
const setFlow = useModalStore((state) => state.setFlow);
|
|
22
|
-
const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
|
|
23
|
-
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
24
|
-
const hideWallets = useStore((state) => {
|
|
25
|
-
var _a;
|
|
26
|
-
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
27
|
-
});
|
|
28
|
-
const { disconnectExternalWallet } = useExternalWallets();
|
|
29
|
-
const para = useInternalClient();
|
|
30
|
-
const { data: account } = useAccount();
|
|
31
|
-
const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
|
|
32
|
-
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
33
|
-
const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
|
|
34
|
-
const cantBuyAndWithdraw = para.externalWalletConnectionType === "CONNECTION_ONLY" && !para.userId;
|
|
35
|
-
const isOnRampLoaded = !!onRampConfig;
|
|
36
|
-
const handleBuyClick = () => {
|
|
37
|
-
if (isGuestMode) {
|
|
38
|
-
setGuestAddFundsTab(EnabledFlow.BUY);
|
|
39
|
-
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
40
|
-
} else {
|
|
41
|
-
setOnRampStep(OnRampStep.SETTINGS);
|
|
42
|
-
setStep(ModalStep.ADD_FUNDS_BUY);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const handleReceiveClick = () => {
|
|
46
|
-
setStep(ModalStep.ADD_FUNDS_RECEIVE);
|
|
47
|
-
};
|
|
48
|
-
const handleSellClick = () => {
|
|
49
|
-
if (isGuestMode) {
|
|
50
|
-
setGuestAddFundsTab(EnabledFlow.WITHDRAW);
|
|
51
|
-
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
52
|
-
} else {
|
|
53
|
-
setOnRampStep(OnRampStep.SETTINGS);
|
|
54
|
-
setStep(ModalStep.ADD_FUNDS_WITHDRAW);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
58
|
-
setIsDisconnecting(true);
|
|
59
|
-
yield para.logout();
|
|
60
|
-
yield disconnectExternalWallet();
|
|
61
|
-
onClose();
|
|
62
|
-
setStep(ModalStep.AUTH_MAIN);
|
|
63
|
-
setFlow(void 0);
|
|
64
|
-
setIsDisconnecting(false);
|
|
65
|
-
});
|
|
66
|
-
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
67
|
-
isBalanceLoading ? /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 39 }) }) : balance !== void 0 && balance !== null && /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslText, { variant: "headingS", weight: "medium", children: formatBalanceString(balance) }) }),
|
|
68
|
-
isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
-
balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
|
|
70
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
|
|
71
|
-
"You've funded this account - complete account setup to maintain access."
|
|
72
|
-
] }),
|
|
73
|
-
/* @__PURE__ */ jsxs(
|
|
74
|
-
CpslButton,
|
|
75
|
-
{
|
|
76
|
-
fullWidth: true,
|
|
77
|
-
variant: "primary",
|
|
78
|
-
onClick: () => {
|
|
79
|
-
setStep(ModalStep.AUTH_GUEST_SIGNUP);
|
|
80
|
-
},
|
|
81
|
-
children: [
|
|
82
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
|
|
83
|
-
"Complete Account Setup"
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] }),
|
|
88
|
-
/* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
-
onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Buy Crypto" }) }),
|
|
90
|
-
onRampConfig.isReceiveEnabled && /* @__PURE__ */ jsx(OptionButton, { icon: "qrCode02", onClick: handleReceiveClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
|
|
91
|
-
onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) })
|
|
92
|
-
] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
|
|
93
|
-
!isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
-
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
95
|
-
/* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
|
|
96
|
-
] }) })
|
|
97
|
-
] }) });
|
|
98
|
-
};
|
|
99
|
-
const ButtonContainer = styled.div`
|
|
100
|
-
display: flex;
|
|
101
|
-
align-items: center;
|
|
102
|
-
justify-content: center;
|
|
103
|
-
gap: 8px;
|
|
104
|
-
width: 100%;
|
|
105
|
-
height: 88px;
|
|
106
|
-
`;
|
|
107
|
-
const OptionButton = styled(StyledCpslTileButton)`
|
|
108
|
-
flex: 1;
|
|
109
|
-
|
|
110
|
-
--button-icon-color: var(--cpsl-color-text-primary);
|
|
111
|
-
`;
|
|
112
|
-
const DisconnectButton = styled(CpslButton)`
|
|
113
|
-
--button-border-width: 0px;
|
|
114
|
-
`;
|
|
115
|
-
const BalanceContainer = styled.div`
|
|
116
|
-
display: flex;
|
|
117
|
-
justify-content: center;
|
|
118
|
-
align-items: center;
|
|
119
|
-
padding-top: 8px;
|
|
120
|
-
padding-bottom: 24px;
|
|
121
|
-
`;
|
|
122
|
-
const Alert = styled.div`
|
|
123
|
-
--icon-color: var(--cpsl-color-utility-yellow);
|
|
124
|
-
--icon-stroke-color: var(--cpsl-color-utility-yellow);
|
|
125
|
-
--icon-fill-color: var(--cpsl-color-utility-yellow);
|
|
126
|
-
|
|
127
|
-
display: flex;
|
|
128
|
-
padding: 8px;
|
|
129
|
-
align-items: flex-start;
|
|
130
|
-
gap: 8px;
|
|
131
|
-
align-self: stretch;
|
|
132
|
-
border-radius: var(--cpsl-border-radius-alert);
|
|
133
|
-
border: 1px solid var(--cpsl-color-utility-yellow);
|
|
134
|
-
background: var(--cpsl-color-utility-yellow-light);
|
|
135
|
-
font-size: 14px;
|
|
136
|
-
`;
|
|
137
|
-
export {
|
|
138
|
-
Account
|
|
139
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AddFunds: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { EnabledFlow } from "@getpara/web-sdk";
|
|
5
|
-
import { InnerStepContainer, StepContainer } from "../common.js";
|
|
6
|
-
import { CpslIcon, CpslSpinner, CpslTab, CpslTabs } from "@getpara/react-components";
|
|
7
|
-
import { OnRampStep } from "../../stores/index.js";
|
|
8
|
-
import { useModalStore } from "../../stores/modal/useModalStore.js";
|
|
9
|
-
import { useEffect, useMemo } from "react";
|
|
10
|
-
import { getAddFundsStep } from "../../utils/steps.js";
|
|
11
|
-
import styled from "styled-components";
|
|
12
|
-
import { useAccount, useWallet } from "../../../provider/index.js";
|
|
13
|
-
import { AddFundsProvider } from "./AddFundsProvider.js";
|
|
14
|
-
import { AddFundsReceive } from "./AddFundsReceive.js";
|
|
15
|
-
import { AddFundsContextProvider, TABS } from "./AddFundsContext.js";
|
|
16
|
-
import { AnimatePresence } from "framer-motion";
|
|
17
|
-
import { AddFundsSettings } from "./AddFundsSettings.js";
|
|
18
|
-
const AddFunds = () => {
|
|
19
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
20
|
-
const onRampStep = useModalStore((state) => state.onRampStep);
|
|
21
|
-
const storedTab = useModalStore((state) => state.accountAddFundTab);
|
|
22
|
-
const setModalStep = useModalStore((state) => state.setStep);
|
|
23
|
-
const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
|
|
24
|
-
const { data: activeWallet } = useWallet();
|
|
25
|
-
const { data: account } = useAccount();
|
|
26
|
-
const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
|
|
27
|
-
const tabs = TABS.filter(
|
|
28
|
-
([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
|
|
29
|
-
);
|
|
30
|
-
const tab = storedTab != null ? storedTab : tabs[0][0];
|
|
31
|
-
const isMultiFlow = tabs.length > 1;
|
|
32
|
-
const onSetTab = (event) => {
|
|
33
|
-
setModalStep(getAddFundsStep(event.detail.tab));
|
|
34
|
-
};
|
|
35
|
-
const Content = useMemo(() => {
|
|
36
|
-
switch (tab) {
|
|
37
|
-
case EnabledFlow.BUY:
|
|
38
|
-
case EnabledFlow.WITHDRAW: {
|
|
39
|
-
switch (onRampStep) {
|
|
40
|
-
case OnRampStep.SETTINGS:
|
|
41
|
-
return /* @__PURE__ */ jsx(AddFundsSettings, {});
|
|
42
|
-
case OnRampStep.PROVIDER:
|
|
43
|
-
return /* @__PURE__ */ jsx(AddFundsProvider, {});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
default:
|
|
47
|
-
return /* @__PURE__ */ jsx(AddFundsReceive, {});
|
|
48
|
-
}
|
|
49
|
-
}, [onRampStep, tab]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
setOnRampPurchase(void 0);
|
|
52
|
-
}, []);
|
|
53
|
-
if (!onRampConfig || !activeWallet) {
|
|
54
|
-
return /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, {}) });
|
|
55
|
-
}
|
|
56
|
-
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
57
|
-
isMultiFlow && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.map(([tab2, _, icon, title]) => /* @__PURE__ */ jsxs(CpslTab, { tab: tab2, children: [
|
|
58
|
-
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon }),
|
|
59
|
-
title
|
|
60
|
-
] }, tab2)) }) }),
|
|
61
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(AddFundsContextProvider, { "data-testid": "add-funds", tab, children: Content }) })
|
|
62
|
-
] });
|
|
63
|
-
};
|
|
64
|
-
const SpinnerContainer = styled(StepContainer)`
|
|
65
|
-
margin: 50% 0;
|
|
66
|
-
`;
|
|
67
|
-
export {
|
|
68
|
-
AddFunds
|
|
69
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function AddFundsAsset(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import * as comp from "@getpara/react-components";
|
|
9
|
-
import { getOnRampNetworks } from "@getpara/web-sdk";
|
|
10
|
-
import styled from "styled-components";
|
|
11
|
-
import { getAssetCode, getAssetName, ON_RAMP_ASSETS } from "../../constants/constants.js";
|
|
12
|
-
import { useModalStore } from "../../stores/index.js";
|
|
13
|
-
import { useRef, useState } from "react";
|
|
14
|
-
import { useAddFunds } from "./AddFundsContext.js";
|
|
15
|
-
import { useWallet } from "../../../provider/hooks/queries/useWallet.js";
|
|
16
|
-
import { AssetIcon } from "../common.js";
|
|
17
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
18
|
-
import { contentMotionProps } from "./common.js";
|
|
19
|
-
function AddFundsAsset() {
|
|
20
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
21
|
-
const { assets, setAsset, network, setNetwork } = useAddFunds();
|
|
22
|
-
const { data: activeWallet } = useWallet();
|
|
23
|
-
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
24
|
-
const [isAtTop, setIsAtTop] = useState(true);
|
|
25
|
-
const [searchStr, setSearchStr] = useState("");
|
|
26
|
-
const ref = useRef(null);
|
|
27
|
-
const onSelect = (_asset) => __async(this, null, function* () {
|
|
28
|
-
yield setAsset(_asset);
|
|
29
|
-
if (!network && !!onRampConfig && !!activeWallet) {
|
|
30
|
-
yield setNetwork(
|
|
31
|
-
getOnRampNetworks(onRampConfig.assetInfo, {
|
|
32
|
-
walletType: activeWallet.type,
|
|
33
|
-
assets: [_asset]
|
|
34
|
-
})[0]
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
const onScroll = () => {
|
|
39
|
-
if (ref.current) {
|
|
40
|
-
const { scrollTop, scrollHeight, clientHeight } = ref.current;
|
|
41
|
-
if (scrollTop + clientHeight >= scrollHeight - 30) {
|
|
42
|
-
setIsAtBottom(true);
|
|
43
|
-
} else {
|
|
44
|
-
setIsAtBottom(false);
|
|
45
|
-
}
|
|
46
|
-
if (scrollTop < 30) {
|
|
47
|
-
setIsAtTop(true);
|
|
48
|
-
} else {
|
|
49
|
-
setIsAtTop(false);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
-
/* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: assets.length >= 4 && /* @__PURE__ */ jsx(motion.div, __spreadProps(__spreadValues({}, contentMotionProps), { children: /* @__PURE__ */ jsx(
|
|
55
|
-
SearchInput,
|
|
56
|
-
{
|
|
57
|
-
placeholder: "Search for an asset",
|
|
58
|
-
value: searchStr,
|
|
59
|
-
onCpslInput: (e) => {
|
|
60
|
-
setSearchStr(e.detail.value);
|
|
61
|
-
},
|
|
62
|
-
children: /* @__PURE__ */ jsx(comp.CpslIcon, { icon: "search", slot: "start" })
|
|
63
|
-
}
|
|
64
|
-
) })) }),
|
|
65
|
-
/* @__PURE__ */ jsx(ScrollContainer, { isAtBottom, isAtTop, ref, onScroll, children: /* @__PURE__ */ jsx(AssetList, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: assets.filter((asset) => {
|
|
66
|
-
return searchStr === "" || getAssetCode(asset).toLowerCase().startsWith(searchStr.toLowerCase()) || getAssetName(asset).toLowerCase().startsWith(searchStr.toLowerCase());
|
|
67
|
-
}).map((asset) => /* @__PURE__ */ jsx(
|
|
68
|
-
motion.li,
|
|
69
|
-
{
|
|
70
|
-
style: { width: "100%" },
|
|
71
|
-
initial: { opacity: 0 },
|
|
72
|
-
animate: { opacity: 1 },
|
|
73
|
-
exit: { opacity: 0 },
|
|
74
|
-
transition: { duration: 0.2 },
|
|
75
|
-
children: /* @__PURE__ */ jsxs(AssetButton, { fullWidth: true, variant: "secondary", onClick: () => onSelect(asset), children: [
|
|
76
|
-
/* @__PURE__ */ jsx(AssetIcon, { asset, size: "48px" }),
|
|
77
|
-
/* @__PURE__ */ jsxs(Info, { children: [
|
|
78
|
-
/* @__PURE__ */ jsx(Code, { variant: "bodyL", children: ON_RAMP_ASSETS[asset].code }),
|
|
79
|
-
/* @__PURE__ */ jsx(Name, { variant: "bodyS", children: ON_RAMP_ASSETS[asset].name })
|
|
80
|
-
] })
|
|
81
|
-
] }, asset)
|
|
82
|
-
},
|
|
83
|
-
asset
|
|
84
|
-
)) }) }) })
|
|
85
|
-
] });
|
|
86
|
-
}
|
|
87
|
-
const ScrollContainer = styled.div`
|
|
88
|
-
height: calc(100% - 56px);
|
|
89
|
-
width: 100%;
|
|
90
|
-
display: flex;
|
|
91
|
-
flex-direction: column;
|
|
92
|
-
gap: 8px;
|
|
93
|
-
overflow-y: auto;
|
|
94
|
-
mask-image: ${({ isAtBottom, isAtTop }) => !isAtBottom && !isAtTop ? "linear-gradient(to bottom, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%)" : !isAtBottom ? "linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)" : !isAtTop ? "linear-gradient(to top, black calc(100% - 24px), transparent 100%)" : "none"};
|
|
95
|
-
`;
|
|
96
|
-
const AssetList = styled.ul`
|
|
97
|
-
display: flex;
|
|
98
|
-
flex-direction: column;
|
|
99
|
-
width: 100%;
|
|
100
|
-
gap: 8px;
|
|
101
|
-
list-style: none;
|
|
102
|
-
padding-inline-start: 0;
|
|
103
|
-
margin: 0;
|
|
104
|
-
padding: 0px;
|
|
105
|
-
`;
|
|
106
|
-
const AssetButton = styled(comp.CpslButton)`
|
|
107
|
-
display: flex;
|
|
108
|
-
justify-content: center;
|
|
109
|
-
align-items: center;
|
|
110
|
-
gap: 8px;
|
|
111
|
-
--button-secondary-background-color: var(--cpsl-color-background-8);
|
|
112
|
-
--button-secondary-border-color: var(--cpsl-color-background-8);
|
|
113
|
-
--button-secondary-hover-background-color: var(--cpsl-color-background-16);
|
|
114
|
-
--button-secondary-hover-border-color: var(--cpsl-color-background-16);
|
|
115
|
-
`;
|
|
116
|
-
const Info = styled(comp.CpslCol)`
|
|
117
|
-
text-align: left;
|
|
118
|
-
`, Code = comp.CpslText, Name = comp.CpslText;
|
|
119
|
-
const SearchInput = styled(comp.CpslInput)`
|
|
120
|
-
--container-background-color: var(--cpsl-color-background-8);
|
|
121
|
-
--input-background-color: transparent;
|
|
122
|
-
`;
|
|
123
|
-
export {
|
|
124
|
-
AddFundsAsset
|
|
125
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const AddFundsAwaiting: () => import("react/jsx-runtime").JSX.Element;
|