@getpara/react-sdk 2.0.0-alpha.31 → 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 → chunk-3GWWZKX7.js} +1 -22
- package/dist/index.d.ts +3 -5
- package/dist/index.js +5 -5
- package/dist/provider/ParaProvider.d.ts +1 -2
- package/dist/provider/ParaProvider.js +14 -107
- package/package.json +6 -28
- package/styles.css/package.json +1 -1
- package/dist/cli/cli.mjs +0 -50
- package/dist/modal/ParaModal.d.ts +0 -2
- package/dist/modal/ParaModal.js +0 -305
- package/dist/modal/components/Account/Account.d.ts +0 -5
- package/dist/modal/components/Account/Account.js +0 -148
- package/dist/modal/components/Account/AccountProfile.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfile.js +0 -168
- package/dist/modal/components/Account/AccountProfileLink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLink.js +0 -206
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +0 -111
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileUnlink.js +0 -47
- 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 -20
- package/dist/modal/components/AuthInput/AuthInput.js +0 -277
- 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 -164
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +0 -9
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -85
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +0 -1
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +0 -12
- 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 -62
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -48
- 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 -354
- 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 -78
- package/dist/modal/components/Controls/Selects.d.ts +0 -2
- package/dist/modal/components/Controls/Selects.js +0 -173
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +0 -75
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +0 -8
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -175
- 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 -39
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +0 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -184
- 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 -62
- 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 -5
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -44
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -10
- package/dist/modal/components/ModalContent/ModalContent.js +0 -88
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +0 -3
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -31
- 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 -8
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -74
- 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/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +0 -5
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -27
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +0 -12
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -160
- 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 -83
- package/dist/modal/components/common.d.ts +0 -59
- package/dist/modal/components/common.js +0 -261
- 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 -40
- package/dist/modal/constants/constants.js +0 -142
- 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 -17
- package/dist/modal/constants/oAuthLogos.js +0 -158
- package/dist/modal/constants/walletTypeConfig.d.ts +0 -6
- package/dist/modal/constants/walletTypeConfig.js +0 -13
- package/dist/modal/hooks/useGoBack.d.ts +0 -1
- package/dist/modal/hooks/useGoBack.js +0 -43
- package/dist/modal/hooks/useTelegramLogin.d.ts +0 -12
- package/dist/modal/hooks/useTelegramLogin.js +0 -65
- 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 -135
- package/dist/modal/stores/modal/useModalStore.d.ts +0 -103
- package/dist/modal/stores/modal/useModalStore.js +0 -73
- package/dist/modal/types/commonTypes.d.ts +0 -6
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/modalProps.d.ts +0 -129
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authInputHelpers.d.ts +0 -5
- package/dist/modal/utils/authInputHelpers.js +0 -41
- 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/getWalletDisplayName.d.ts +0 -5
- package/dist/modal/utils/getWalletDisplayName.js +0 -22
- 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 -136
- package/dist/modal/utils/steps.js +0 -279
- 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/getEmbeddedAccount.d.ts +0 -26
- package/dist/provider/actions/getEmbeddedAccount.js +0 -52
- package/dist/provider/actions/getWallet.d.ts +0 -5
- package/dist/provider/actions/getWallet.js +0 -18
- package/dist/provider/actions/index.d.ts +0 -47
- package/dist/provider/actions/index.js +0 -79
- package/dist/provider/actions/utils.d.ts +0 -4
- package/dist/provider/actions/utils.js +0 -34
- package/dist/provider/components/CosmosWalletWrapper.d.ts +0 -11
- package/dist/provider/components/CosmosWalletWrapper.js +0 -43
- package/dist/provider/components/EvmWalletWrapper.d.ts +0 -12
- package/dist/provider/components/EvmWalletWrapper.js +0 -43
- package/dist/provider/components/ExternalWalletWrapper.d.ts +0 -8
- package/dist/provider/components/ExternalWalletWrapper.js +0 -140
- package/dist/provider/components/SolanaWalletWrapper.d.ts +0 -9
- package/dist/provider/components/SolanaWalletWrapper.js +0 -44
- package/dist/provider/external/getParaCosmosConnector.d.ts +0 -7
- package/dist/provider/external/getParaCosmosConnector.js +0 -19
- package/dist/provider/external/getParaCosmosLib.d.ts +0 -4
- package/dist/provider/external/getParaCosmosLib.js +0 -16
- package/dist/provider/external/getParaEvmConnector.d.ts +0 -7
- package/dist/provider/external/getParaEvmConnector.js +0 -19
- package/dist/provider/external/getParaEvmLib.d.ts +0 -4
- package/dist/provider/external/getParaEvmLib.js +0 -16
- package/dist/provider/external/getParaSolanaConnector.d.ts +0 -7
- package/dist/provider/external/getParaSolanaConnector.js +0 -19
- package/dist/provider/external/getParaSolanaLib.d.ts +0 -4
- package/dist/provider/external/getParaSolanaLib.js +0 -16
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +0 -8
- package/dist/provider/hooks/index.d.ts +0 -3
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/core.d.ts +0 -27
- package/dist/provider/hooks/mutations/core.js +0 -66
- package/dist/provider/hooks/mutations/index.d.ts +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.js +0 -18
- package/dist/provider/hooks/mutations/utils.d.ts +0 -12
- package/dist/provider/hooks/mutations/utils.js +0 -90
- package/dist/provider/hooks/queries/core.d.ts +0 -4
- package/dist/provider/hooks/queries/core.js +0 -16
- package/dist/provider/hooks/queries/index.d.ts +0 -4
- package/dist/provider/hooks/queries/index.js +0 -11
- package/dist/provider/hooks/queries/useAccount.d.ts +0 -94
- package/dist/provider/hooks/queries/useAccount.js +0 -138
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +0 -5
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +0 -24
- package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
- package/dist/provider/hooks/queries/useWallet.js +0 -26
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -6
- package/dist/provider/hooks/queries/useWalletBalance.js +0 -55
- package/dist/provider/hooks/queries/utils.d.ts +0 -7
- package/dist/provider/hooks/queries/utils.js +0 -25
- 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 -157
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +0 -4
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +0 -27
- 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 -11
- package/dist/provider/hooks/utils/useModal.js +0 -27
- 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 -6
- package/dist/provider/index.js +0 -11
- package/dist/provider/providers/AccountLinkProvider.d.ts +0 -47
- package/dist/provider/providers/AccountLinkProvider.js +0 -452
- package/dist/provider/providers/AuthProvider.d.ts +0 -37
- package/dist/provider/providers/AuthProvider.js +0 -553
- 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 -59
- package/dist/provider/providers/ExternalWalletProvider.js +0 -596
- 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/analytics.d.ts +0 -3
- package/dist/provider/stores/slices/analytics.js +0 -9
- 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 -46
- package/dist/provider/stores/slices/index.d.ts +0 -5
- package/dist/provider/stores/slices/index.js +0 -6
- package/dist/provider/stores/slices/modal.d.ts +0 -3
- package/dist/provider/stores/slices/modal.js +0 -18
- 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 -76
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.d.ts +0 -17
- package/dist/provider/stores/useStore.js +0 -34
- 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 -161
- 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 -45
- 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
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { CpslButton, CpslText } from "@getpara/react-components";
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
6
|
-
import { AccountTypeIcon } from "../common.js";
|
|
7
|
-
import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
8
|
-
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
9
|
-
import { safeStyled } from "@getpara/react-common";
|
|
10
|
-
function AccountProfileUnlink() {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const { unlinkingAccount, unlinkAccountConfirm, isUnlinkAccountPending } = useAccountLinking(), [accountType, setAccountType] = useState((_b = (_a = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a.providerId) != null ? _b : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
var _a2, _b2;
|
|
15
|
-
if (unlinkingAccount) {
|
|
16
|
-
setAccountType((_b2 = (_a2 = unlinkingAccount == null ? void 0 : unlinkingAccount.externalWallet) == null ? void 0 : _a2.providerId) != null ? _b2 : unlinkingAccount == null ? void 0 : unlinkingAccount.type);
|
|
17
|
-
}
|
|
18
|
-
}, [unlinkingAccount]);
|
|
19
|
-
return /* @__PURE__ */ jsxs(Content, { children: [
|
|
20
|
-
/* @__PURE__ */ jsxs(Upper, { children: [
|
|
21
|
-
/* @__PURE__ */ jsx(AccountTypeIcon, { accountType, size: "80px", inset: "5px" }),
|
|
22
|
-
/* @__PURE__ */ jsxs(Message, { variant: "bodyM", weight: "semiBold", color: "contrast", children: [
|
|
23
|
-
"Are you sure you want to unlink your ",
|
|
24
|
-
getAccountTypeName(accountType, { inline: true }),
|
|
25
|
-
"?"
|
|
26
|
-
] })
|
|
27
|
-
] }),
|
|
28
|
-
/* @__PURE__ */ jsx(CpslButton, { variant: "destructive", fullWidth: true, onClick: unlinkAccountConfirm, disabled: isUnlinkAccountPending, children: "Confirm" })
|
|
29
|
-
] });
|
|
30
|
-
}
|
|
31
|
-
const Content = safeStyled.div`
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: flex-start;
|
|
36
|
-
gap: 32px;
|
|
37
|
-
`;
|
|
38
|
-
const Upper = safeStyled(Content)`
|
|
39
|
-
gap: 8px;
|
|
40
|
-
`;
|
|
41
|
-
const Message = safeStyled(CpslText)`
|
|
42
|
-
text-align: center;
|
|
43
|
-
max-width: 342px;
|
|
44
|
-
`;
|
|
45
|
-
export {
|
|
46
|
-
AccountProfileUnlink
|
|
47
|
-
};
|
|
@@ -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 { safeStyled } from "@getpara/react-common";
|
|
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 { embedded } = useAccount();
|
|
26
|
-
const isGuestMode = (embedded == null ? void 0 : embedded.isConnected) && embedded.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 = safeStyled(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 { safeStyled } from "@getpara/react-common";
|
|
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 = safeStyled.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 = safeStyled.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 = safeStyled(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 = safeStyled(comp.CpslCol)`
|
|
117
|
-
text-align: left;
|
|
118
|
-
`, Code = comp.CpslText, Name = comp.CpslText;
|
|
119
|
-
const SearchInput = safeStyled(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;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { StepContainer } from "../common.js";
|
|
8
|
-
import { OnRampProvider } from "@getpara/web-sdk";
|
|
9
|
-
import { useModalStore } from "../../stores/index.js";
|
|
10
|
-
import { lazy, useEffect, useMemo, useState } from "react";
|
|
11
|
-
import { ModalStep } from "../../utils/steps.js";
|
|
12
|
-
import { RampEmbed } from "@getpara/react-common";
|
|
13
|
-
import { safeStyled } from "@getpara/react-common";
|
|
14
|
-
import { useGoBack } from "../../hooks/useGoBack.js";
|
|
15
|
-
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
16
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
17
|
-
const STEPS = {
|
|
18
|
-
CANCELLED: ModalStep.ADD_FUNDS_FAILURE,
|
|
19
|
-
FINISHED: ModalStep.ADD_FUNDS_SUCCESS
|
|
20
|
-
};
|
|
21
|
-
const AddFundsAwaiting = () => {
|
|
22
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
23
|
-
const goBack = useGoBack();
|
|
24
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
25
|
-
const onRampPurchase = useModalStore((state) => state.onRampPurchase);
|
|
26
|
-
const setOnRampPurchase = useModalStore((state) => state.setOnRampPurchase);
|
|
27
|
-
const para = useInternalClient();
|
|
28
|
-
const appName = useStore((state) => state.appName);
|
|
29
|
-
const isDark = useStore((state) => state.isDarkTheme);
|
|
30
|
-
const [MoonPayEmbed, setMoonPayEmbed] = useState();
|
|
31
|
-
const props = {
|
|
32
|
-
para,
|
|
33
|
-
appName,
|
|
34
|
-
onRampConfig,
|
|
35
|
-
onRampPurchase,
|
|
36
|
-
isDark,
|
|
37
|
-
isEmbedded: true,
|
|
38
|
-
setOnRampPurchase,
|
|
39
|
-
onClose: goBack
|
|
40
|
-
};
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const _MoonPayEmbed = lazy(() => import("./MoonPayEmbed.js"));
|
|
43
|
-
if (_MoonPayEmbed) {
|
|
44
|
-
setMoonPayEmbed(_MoonPayEmbed);
|
|
45
|
-
}
|
|
46
|
-
}, []);
|
|
47
|
-
const onRampEmbed = useMemo(() => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
if (!(onRampPurchase == null ? void 0 : onRampPurchase.id) || !props.onRampConfig) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
|
|
53
|
-
case OnRampProvider.MOONPAY:
|
|
54
|
-
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx(MoonPayEmbed, __spreadProps(__spreadValues({}, props), { onRampConfig: props.onRampConfig }));
|
|
55
|
-
case OnRampProvider.RAMP:
|
|
56
|
-
return /* @__PURE__ */ jsx(RampEmbed, __spreadProps(__spreadValues({}, props), { apiKey: (_b = (_a = props.onRampConfig) == null ? void 0 : _a.rampApiKey) != null ? _b : "", onRampConfig: props.onRampConfig }));
|
|
57
|
-
default:
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
let timeoutId;
|
|
63
|
-
if ((onRampPurchase == null ? void 0 : onRampPurchase.status) && ["CANCELLED", "FINISHED"].includes(onRampPurchase.status)) {
|
|
64
|
-
timeoutId = setTimeout(() => {
|
|
65
|
-
var _a;
|
|
66
|
-
setStep(STEPS[(_a = onRampPurchase.status) != null ? _a : ""]);
|
|
67
|
-
}, 5e3);
|
|
68
|
-
}
|
|
69
|
-
return () => clearTimeout(timeoutId);
|
|
70
|
-
}, [onRampPurchase == null ? void 0 : onRampPurchase.status]);
|
|
71
|
-
return /* @__PURE__ */ jsx(Container, { $wide: true, children: onRampEmbed });
|
|
72
|
-
};
|
|
73
|
-
const Container = safeStyled(StepContainer)`
|
|
74
|
-
flex: 1;
|
|
75
|
-
`;
|
|
76
|
-
export {
|
|
77
|
-
AddFundsAwaiting
|
|
78
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { useWallet } from '../../../provider/hooks/index.js';
|
|
3
|
-
import { EnabledFlow, Network, OnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
|
|
4
|
-
import { IconType } from '@getpara/react-components';
|
|
5
|
-
export type Tab = EnabledFlow;
|
|
6
|
-
export declare const TABS: [
|
|
7
|
-
Tab,
|
|
8
|
-
keyof Pick<OnRampConfig, 'isBuyEnabled' | 'isReceiveEnabled' | 'isWithdrawEnabled'>,
|
|
9
|
-
IconType,
|
|
10
|
-
ReactNode
|
|
11
|
-
][];
|
|
12
|
-
type Value = {
|
|
13
|
-
network: Network | undefined;
|
|
14
|
-
setNetwork: Dispatch<SetStateAction<Value['network']>>;
|
|
15
|
-
asset: OnRampAsset | undefined;
|
|
16
|
-
setAsset: Dispatch<SetStateAction<Value['asset']>>;
|
|
17
|
-
fiatQuantity: string | undefined;
|
|
18
|
-
setFiatQuantity: Dispatch<SetStateAction<Value['fiatQuantity']>>;
|
|
19
|
-
networks: Network[];
|
|
20
|
-
assets: OnRampAsset[];
|
|
21
|
-
isProviderAllowed: Partial<Record<OnRampProvider, boolean>>;
|
|
22
|
-
tab: Tab;
|
|
23
|
-
activeWallet: ReturnType<typeof useWallet>['data'];
|
|
24
|
-
onRampConfig: OnRampConfig;
|
|
25
|
-
};
|
|
26
|
-
export declare const AddFundsContext: import("react").Context<Value>;
|
|
27
|
-
export declare function AddFundsContextProvider({ tab, children }: PropsWithChildren<{
|
|
28
|
-
tab: Tab;
|
|
29
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
export declare const useAddFunds: () => Value;
|
|
31
|
-
export {};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
createContext,
|
|
9
|
-
useContext,
|
|
10
|
-
useEffect,
|
|
11
|
-
useMemo,
|
|
12
|
-
useState
|
|
13
|
-
} from "react";
|
|
14
|
-
import { OnRampStep, useModalStore } from "../../stores/index.js";
|
|
15
|
-
import { useWallet } from "../../../provider/hooks/index.js";
|
|
16
|
-
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
17
|
-
import {
|
|
18
|
-
EnabledFlow,
|
|
19
|
-
getOnRampAssets,
|
|
20
|
-
getOnRampNetworks,
|
|
21
|
-
OnRampPurchaseType
|
|
22
|
-
} from "@getpara/web-sdk";
|
|
23
|
-
import { getNetworkFromChainId, getNetworkOrMainNetEquivalent } from "@getpara/react-common";
|
|
24
|
-
const TABS = [
|
|
25
|
-
[EnabledFlow.BUY, "isBuyEnabled", "creditCard", "Buy"],
|
|
26
|
-
[EnabledFlow.RECEIVE, "isReceiveEnabled", "qrCode", "Receive"],
|
|
27
|
-
[EnabledFlow.WITHDRAW, "isWithdrawEnabled", "arrowCircleBrokenDownLeft", "Withdraw"]
|
|
28
|
-
];
|
|
29
|
-
const DEFAULT = {
|
|
30
|
-
networks: [],
|
|
31
|
-
assets: [],
|
|
32
|
-
isProviderAllowed: {},
|
|
33
|
-
tab: TABS[0][0],
|
|
34
|
-
network: void 0,
|
|
35
|
-
setNetwork: () => {
|
|
36
|
-
},
|
|
37
|
-
asset: void 0,
|
|
38
|
-
setAsset: () => {
|
|
39
|
-
},
|
|
40
|
-
fiatQuantity: "25.00",
|
|
41
|
-
setFiatQuantity: () => {
|
|
42
|
-
},
|
|
43
|
-
onRampConfig: {},
|
|
44
|
-
activeWallet: {}
|
|
45
|
-
};
|
|
46
|
-
function isValid(onRampConfig, walletType, network, asset) {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
return network && asset && walletType ? !!((_b = (_a = onRampConfig == null ? void 0 : onRampConfig.assetInfo[walletType]) == null ? void 0 : _a[network]) == null ? void 0 : _b[asset]) : false;
|
|
49
|
-
}
|
|
50
|
-
const AddFundsContext = createContext(DEFAULT);
|
|
51
|
-
function AddFundsContextProvider({ tab, children }) {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
54
|
-
const onRampStep = useModalStore((state) => state.onRampStep);
|
|
55
|
-
const setOnRampStep = useModalStore((state) => state.setOnRampStep);
|
|
56
|
-
const { chainId } = useExternalWallets();
|
|
57
|
-
const { data: activeWallet } = useWallet();
|
|
58
|
-
const [fiatQuantity, setFiatQuantity] = useState((_b = (_a = onRampConfig == null ? void 0 : onRampConfig.defaultBuyAmount) == null ? void 0 : _a[0]) != null ? _b : "25.00");
|
|
59
|
-
const networks = useMemo(() => {
|
|
60
|
-
if (!onRampConfig) {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
const detectedNetwork = getNetworkFromChainId(chainId);
|
|
64
|
-
const isExternal = (activeWallet == null ? void 0 : activeWallet.isExternal) && !!detectedNetwork;
|
|
65
|
-
return isExternal ? [getNetworkOrMainNetEquivalent(detectedNetwork, onRampConfig.testMode)] : getOnRampNetworks(onRampConfig.assetInfo, {
|
|
66
|
-
walletType: activeWallet == null ? void 0 : activeWallet.type,
|
|
67
|
-
allowed: onRampConfig.allowedAssets ? Object.keys(onRampConfig.allowedAssets) : void 0,
|
|
68
|
-
providers: onRampConfig.providers,
|
|
69
|
-
action: OnRampPurchaseType[tab === EnabledFlow.BUY ? "BUY" : "SELL"]
|
|
70
|
-
});
|
|
71
|
-
}, [chainId, activeWallet, onRampConfig, tab]);
|
|
72
|
-
const assets = useMemo(() => {
|
|
73
|
-
if (!onRampConfig) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
return [
|
|
77
|
-
...new Set(
|
|
78
|
-
Object.values(
|
|
79
|
-
networks.reduce((acc, network2) => {
|
|
80
|
-
var _a2;
|
|
81
|
-
const configValue = (_a2 = onRampConfig.allowedAssets) == null ? void 0 : _a2[network2];
|
|
82
|
-
const allowed = configValue === true ? void 0 : configValue;
|
|
83
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
84
|
-
[network2]: getOnRampAssets(onRampConfig.assetInfo, {
|
|
85
|
-
walletType: activeWallet == null ? void 0 : activeWallet.type,
|
|
86
|
-
network: network2,
|
|
87
|
-
allowed,
|
|
88
|
-
providers: onRampConfig.providers,
|
|
89
|
-
action: OnRampPurchaseType[tab === EnabledFlow.BUY ? "BUY" : "SELL"]
|
|
90
|
-
})
|
|
91
|
-
});
|
|
92
|
-
}, {})
|
|
93
|
-
).flat()
|
|
94
|
-
)
|
|
95
|
-
];
|
|
96
|
-
}, [networks, onRampConfig, activeWallet, tab]);
|
|
97
|
-
const [network, setNetwork] = useState(
|
|
98
|
-
!!(activeWallet == null ? void 0 : activeWallet.type) && !!(onRampConfig == null ? void 0 : onRampConfig.defaultOnRampNetwork) && !!onRampConfig.assetInfo[activeWallet.type][onRampConfig.defaultOnRampNetwork] ? onRampConfig.defaultOnRampNetwork : void 0
|
|
99
|
-
);
|
|
100
|
-
const [asset, setAsset] = useState(
|
|
101
|
-
!!network && !!(onRampConfig == null ? void 0 : onRampConfig.defaultOnRampAsset) && assets.includes(onRampConfig.defaultOnRampAsset) ? onRampConfig.defaultOnRampAsset : void 0
|
|
102
|
-
);
|
|
103
|
-
const isProviderAllowed = useMemo(
|
|
104
|
-
() => onRampConfig && !!(activeWallet == null ? void 0 : activeWallet.type) ? onRampConfig.providers.reduce(
|
|
105
|
-
(acc, id) => {
|
|
106
|
-
var _a2, _b2, _c, _d, _e;
|
|
107
|
-
return __spreadProps(__spreadValues({}, acc), {
|
|
108
|
-
[id]: !!network && !!asset && !!((_e = (_d = (_c = (_b2 = (_a2 = onRampConfig.assetInfo[activeWallet.type]) == null ? void 0 : _a2[network]) == null ? void 0 : _b2[asset]) == null ? void 0 : _c[id]) == null ? void 0 : _d[1]) == null ? void 0 : _e[tab === EnabledFlow.BUY ? "BUY" : "SELL"])
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
{}
|
|
112
|
-
) : {},
|
|
113
|
-
[onRampConfig, network, asset, activeWallet, tab]
|
|
114
|
-
);
|
|
115
|
-
const value = useMemo(() => {
|
|
116
|
-
if (!onRampConfig || !activeWallet) {
|
|
117
|
-
return DEFAULT;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
tab,
|
|
121
|
-
networks,
|
|
122
|
-
assets,
|
|
123
|
-
isProviderAllowed,
|
|
124
|
-
asset,
|
|
125
|
-
setAsset,
|
|
126
|
-
network,
|
|
127
|
-
setNetwork,
|
|
128
|
-
fiatQuantity,
|
|
129
|
-
setFiatQuantity,
|
|
130
|
-
activeWallet,
|
|
131
|
-
onRampConfig
|
|
132
|
-
};
|
|
133
|
-
}, [
|
|
134
|
-
tab,
|
|
135
|
-
networks,
|
|
136
|
-
assets,
|
|
137
|
-
isProviderAllowed,
|
|
138
|
-
asset,
|
|
139
|
-
setAsset,
|
|
140
|
-
network,
|
|
141
|
-
setNetwork,
|
|
142
|
-
fiatQuantity,
|
|
143
|
-
setFiatQuantity,
|
|
144
|
-
activeWallet,
|
|
145
|
-
onRampConfig
|
|
146
|
-
]);
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
if (!!activeWallet && onRampStep === OnRampStep.PROVIDER && !isValid(onRampConfig, activeWallet.type, network, asset)) {
|
|
149
|
-
setOnRampStep(OnRampStep.SETTINGS);
|
|
150
|
-
}
|
|
151
|
-
}, [onRampStep, onRampConfig, activeWallet, network, asset, setOnRampStep]);
|
|
152
|
-
return /* @__PURE__ */ jsx(AddFundsContext.Provider, { value, children });
|
|
153
|
-
}
|
|
154
|
-
const useAddFunds = () => useContext(AddFundsContext);
|
|
155
|
-
export {
|
|
156
|
-
AddFundsContext,
|
|
157
|
-
AddFundsContextProvider,
|
|
158
|
-
TABS,
|
|
159
|
-
useAddFunds
|
|
160
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { Heading, HeroIcon, InnerStepContainer, StepContainer } from "../common.js";
|
|
5
|
-
import { useModalStore } from "../../stores/index.js";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
|
-
import { CpslButton, CpslText } from "@getpara/react-components";
|
|
8
|
-
import { getAddFundsStep } from "../../utils/steps.js";
|
|
9
|
-
import { useStore } from "../../../provider/stores/useStore.js";
|
|
10
|
-
import { EnabledFlow } from "@getpara/web-sdk";
|
|
11
|
-
const AddFundsDone = ({ isSuccess, onClose }) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const hideWallets = useStore((state) => {
|
|
14
|
-
var _a2;
|
|
15
|
-
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
16
|
-
});
|
|
17
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
18
|
-
const onRampPurchase = useModalStore((state) => state.onRampPurchase);
|
|
19
|
-
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
20
|
-
const formatter = useMemo(() => {
|
|
21
|
-
return new Intl.NumberFormat("en-US", {
|
|
22
|
-
style: "currency",
|
|
23
|
-
currency: (onRampPurchase == null ? void 0 : onRampPurchase.fiat) || "USD"
|
|
24
|
-
});
|
|
25
|
-
}, [onRampPurchase == null ? void 0 : onRampPurchase.fiat]);
|
|
26
|
-
const heading = isSuccess ? "Transaction Successful" : "Something Went Wrong";
|
|
27
|
-
const text = isSuccess ? `${formatter.format(parseFloat((_a = onRampPurchase == null ? void 0 : onRampPurchase.fiatQuantity) != null ? _a : "0"))} is now available in your ${hideWallets ? "account" : "wallet"}.` : `No funds were added to your ${hideWallets ? "account" : "wallet"}.`;
|
|
28
|
-
const buttonText = isSuccess ? "Done" : "Try Again";
|
|
29
|
-
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
31
|
-
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: heading }),
|
|
33
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", children: text })
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsx(
|
|
36
|
-
CpslButton,
|
|
37
|
-
{
|
|
38
|
-
fullWidth: true,
|
|
39
|
-
onClick: () => {
|
|
40
|
-
isSuccess ? onClose() : setStep(getAddFundsStep(accountAddFundTab != null ? accountAddFundTab : EnabledFlow.BUY));
|
|
41
|
-
},
|
|
42
|
-
children: buttonText
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
] });
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
AddFundsDone
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function AddFundsProvider(): import("react/jsx-runtime").JSX.Element;
|