@getpara/react-sdk-lite 2.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-MMUBH76A.js +59 -0
- package/dist/cli/cli.mjs +51 -0
- package/dist/css/modal.css +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +10 -0
- package/dist/modal/ParaModal.d.ts +2 -0
- package/dist/modal/ParaModal.js +308 -0
- package/dist/modal/components/Account/Account.d.ts +5 -0
- package/dist/modal/components/Account/Account.js +148 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +168 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.d.ts +3 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
- package/dist/modal/components/AuthInput/AuthInput.js +277 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +11 -0
- package/dist/modal/components/Body/Body.js +354 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.d.ts +5 -0
- package/dist/modal/components/Controls/Controls.js +78 -0
- package/dist/modal/components/Controls/Selects.d.ts +2 -0
- package/dist/modal/components/Controls/Selects.js +173 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
- package/dist/modal/components/Footer/Footer.d.ts +1 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.d.ts +1 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
- package/dist/modal/components/Hero/Hero.d.ts +1 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
- package/dist/modal/components/OAuth/OAuth.js +81 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
- package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
- package/dist/modal/components/common.d.ts +59 -0
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.d.ts +1 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +40 -0
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.d.ts +5 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +17 -0
- package/dist/modal/constants/oAuthLogos.js +158 -0
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useGoBack.d.ts +1 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +1 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.d.ts +3 -0
- package/dist/modal/stores/modal/actions.js +139 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
- package/dist/modal/stores/modal/useModalStore.js +75 -0
- package/dist/modal/types/commonTypes.d.ts +6 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +129 -0
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +5 -0
- package/dist/modal/utils/authInputHelpers.js +41 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.d.ts +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.d.ts +1 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +6 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +136 -0
- package/dist/modal/utils/steps.js +279 -0
- package/dist/modal/utils/stringFormatters.d.ts +5 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.d.ts +4 -0
- package/dist/provider/ParaProvider.js +140 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +57 -0
- package/dist/provider/actions/getWallet.d.ts +5 -0
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +47 -0
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -0
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +19 -0
- package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
- package/dist/provider/external/getParaCosmosLib.js +16 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +19 -0
- package/dist/provider/external/getParaEvmLib.d.ts +4 -0
- package/dist/provider/external/getParaEvmLib.js +16 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +19 -0
- package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
- package/dist/provider/external/getParaSolanaLib.js +16 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
- package/dist/provider/hooks/index.d.ts +3 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -0
- package/dist/provider/hooks/mutations/index.js +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +12 -0
- package/dist/provider/hooks/mutations/utils.js +90 -0
- package/dist/provider/hooks/queries/core.d.ts +4 -0
- package/dist/provider/hooks/queries/core.js +16 -0
- package/dist/provider/hooks/queries/index.d.ts +5 -0
- package/dist/provider/hooks/queries/index.js +13 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
- package/dist/provider/hooks/queries/useAccount.js +141 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
- package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
- package/dist/provider/hooks/queries/useParaStatus.js +25 -0
- package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
- package/dist/provider/hooks/queries/useWallet.js +26 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/queries/utils.d.ts +7 -0
- package/dist/provider/hooks/queries/utils.js +25 -0
- package/dist/provider/hooks/utils/index.d.ts +3 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
- package/dist/provider/hooks/utils/useEventListeners.js +157 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +11 -0
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +452 -0
- package/dist/provider/providers/AuthProvider.d.ts +38 -0
- package/dist/provider/providers/AuthProvider.js +575 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
- package/dist/provider/providers/ExternalWalletProvider.js +626 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +4 -0
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/client.d.ts +3 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +11 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +46 -0
- package/dist/provider/stores/slices/index.d.ts +5 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.d.ts +3 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.d.ts +3 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +86 -0
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.d.ts +17 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +166 -0
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.d.ts +3 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +45 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +5 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/package.json +63 -0
- package/styles.css/package.json +3 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
|
|
8
|
+
import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { useClient } from "../../../provider/index.js";
|
|
10
|
+
import { useLinkedAccounts } from "../../../provider/hooks/index.js";
|
|
11
|
+
import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
12
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
13
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
14
|
+
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
15
|
+
import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
16
|
+
const Entry = ({
|
|
17
|
+
identifier,
|
|
18
|
+
icon,
|
|
19
|
+
name,
|
|
20
|
+
address,
|
|
21
|
+
addressShort,
|
|
22
|
+
onUnlink
|
|
23
|
+
}) => {
|
|
24
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
25
|
+
return /* @__PURE__ */ jsxs(EntryContainer, { children: [
|
|
26
|
+
icon,
|
|
27
|
+
/* @__PURE__ */ jsx(EntryDisplayName, { variant: "bodyM", color: "contrast", children: name }),
|
|
28
|
+
/* @__PURE__ */ jsx(EntryFlex, { children: address ? /* @__PURE__ */ jsxs(EntryAddress, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", children: addressShort != null ? addressShort : address }),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
CpslButton,
|
|
32
|
+
{
|
|
33
|
+
size: "small",
|
|
34
|
+
variant: "ghost",
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
copy(address);
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ jsx(CopyIcon, { id: "ignore-click", slot: "start", isCopied, icon: isCopied ? "check" : "copy" })
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
] }) : null }),
|
|
44
|
+
onUnlink && /* @__PURE__ */ jsx(EntryUnlink, { href: "#", onClick: onUnlink, children: "Unlink" })
|
|
45
|
+
] }, address != null ? address : identifier);
|
|
46
|
+
};
|
|
47
|
+
const AccountProfile = () => {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f;
|
|
49
|
+
const para = useClient();
|
|
50
|
+
const { data: linkedAccounts } = useLinkedAccounts();
|
|
51
|
+
const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
|
|
52
|
+
if (!para) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const externalWallet = (_a = para.authInfo) == null ? void 0 : _a.externalWallet;
|
|
56
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
57
|
+
/* @__PURE__ */ jsxs(Section, { children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
|
|
59
|
+
/* @__PURE__ */ jsx(Content, { children: externalWallet ? /* @__PURE__ */ jsx(
|
|
60
|
+
Entry,
|
|
61
|
+
{
|
|
62
|
+
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
|
|
63
|
+
name: (_c = (_b = externalWallet.ensName) != null ? _b : getAccountTypeName(externalWallet.providerId)) != null ? _c : "",
|
|
64
|
+
address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
|
|
65
|
+
addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
|
|
66
|
+
prefix: para.cosmosPrefix
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
externalWallet.address
|
|
70
|
+
) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) => {
|
|
71
|
+
var _a2;
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
Entry,
|
|
74
|
+
{
|
|
75
|
+
icon: wallet.isExternal ? /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = wallet.externalProviderId) != null ? _a2 : "EXTERNAL_WALLET", size: "24px" }) : /* @__PURE__ */ jsx(CpslIdenticon, { hash: para.getIdenticonHash(wallet.id, wallet.type), size: "24px", arcWidth: "40%" }),
|
|
76
|
+
name: getWalletDisplayName(para, wallet),
|
|
77
|
+
address: wallet.address,
|
|
78
|
+
addressShort: truncateAddress(wallet.address, wallet.type)
|
|
79
|
+
},
|
|
80
|
+
wallet.address
|
|
81
|
+
);
|
|
82
|
+
}) })
|
|
83
|
+
] }),
|
|
84
|
+
isEnabled && /* @__PURE__ */ jsxs(Section, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
|
|
86
|
+
/* @__PURE__ */ jsxs(Content, { children: [
|
|
87
|
+
/* @__PURE__ */ jsx(GradientScroll, { gap: "12px", height: "360px", children: [
|
|
88
|
+
...((linkedAccounts == null ? void 0 : linkedAccounts.primary) || []).map((p) => __spreadProps(__spreadValues({}, p), { isPrimary: true })),
|
|
89
|
+
...(linkedAccounts == null ? void 0 : linkedAccounts.linked) || []
|
|
90
|
+
].map((linkedAccount) => {
|
|
91
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
92
|
+
const { identifier, displayName, type, isPrimary = false, externalWallet: externalWallet2 } = linkedAccount;
|
|
93
|
+
return /* @__PURE__ */ jsx(
|
|
94
|
+
Entry,
|
|
95
|
+
{
|
|
96
|
+
icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = externalWallet2 == null ? void 0 : externalWallet2.providerId) != null ? _a2 : type, size: "24px" }),
|
|
97
|
+
name: externalWallet2 ? (_c2 = (_b2 = externalWallet2.ensName) != null ? _b2 : getAccountTypeName(externalWallet2.providerId)) != null ? _c2 : "" : displayName != null ? displayName : identifier,
|
|
98
|
+
address: (_d2 = externalWallet2 == null ? void 0 : externalWallet2.addressBech32) != null ? _d2 : externalWallet2 == null ? void 0 : externalWallet2.address,
|
|
99
|
+
addressShort: externalWallet2 ? truncateAddress((_e2 = externalWallet2.addressBech32) != null ? _e2 : externalWallet2.address, externalWallet2.type, {
|
|
100
|
+
prefix: para.cosmosPrefix
|
|
101
|
+
}) : void 0,
|
|
102
|
+
onUnlink: isPrimary ? void 0 : (e) => {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
unlinkAccount(linkedAccount);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
identifier
|
|
108
|
+
);
|
|
109
|
+
}) }),
|
|
110
|
+
/* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, variant: "tertiary", onClick: () => linkAccount(void 0), children: [
|
|
111
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "userPlus", slot: "start" }),
|
|
112
|
+
"Link an account"
|
|
113
|
+
] })
|
|
114
|
+
] })
|
|
115
|
+
] })
|
|
116
|
+
] });
|
|
117
|
+
};
|
|
118
|
+
const Section = safeStyled.div`
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
align-items: flex-start;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
gap: 16px;
|
|
124
|
+
width: 100%;
|
|
125
|
+
`;
|
|
126
|
+
const Content = safeStyled(Section)``;
|
|
127
|
+
const Title = safeStyled(CpslText)``;
|
|
128
|
+
const EntryContainer = safeStyled.div`
|
|
129
|
+
position: relative;
|
|
130
|
+
width: 100%;
|
|
131
|
+
display: flex;
|
|
132
|
+
gap: 8px;
|
|
133
|
+
align-items: center;
|
|
134
|
+
`;
|
|
135
|
+
const EntryDisplayName = safeStyled(CpslText)``;
|
|
136
|
+
const EntryFlex = safeStyled.div`
|
|
137
|
+
flex: 1;
|
|
138
|
+
`;
|
|
139
|
+
const EntryAddress = safeStyled.div`
|
|
140
|
+
display: flex;
|
|
141
|
+
gap: 8px;
|
|
142
|
+
align-items: center;
|
|
143
|
+
`;
|
|
144
|
+
const CopyIcon = safeStyled(CpslIcon)`
|
|
145
|
+
--width: 16px;
|
|
146
|
+
--height: 16px;
|
|
147
|
+
--icon-color: ${({ isCopied }) => isCopied ? "var(--cpsl-color-utility-green) !important" : "var(--cpsl-color-text-secondary)"};
|
|
148
|
+
|
|
149
|
+
&:hover {
|
|
150
|
+
--icon-color: var(--cpsl-color-text-contrast);
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
const EntryUnlink = safeStyled.a`
|
|
154
|
+
color: var(--cpsl-color-utility-red);
|
|
155
|
+
position: absolute;
|
|
156
|
+
right: 0;
|
|
157
|
+
text-decoration: none;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
font-weight: 500;
|
|
160
|
+
font-family: var(--cpsl-font-family);
|
|
161
|
+
|
|
162
|
+
&:hover {
|
|
163
|
+
text-decoration: underline;
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
export {
|
|
167
|
+
AccountProfile
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileLink(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { HeroSpinner } from "@getpara/react-common";
|
|
7
|
+
import { CpslButton, CpslIcon } from "@getpara/react-components";
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { HeroAccountTypeIcon, HeroSuccessIcon } from "../common.js";
|
|
10
|
+
import { VerificationCode } from "../VerificationCodeStep/VerificationCodeStep.js";
|
|
11
|
+
import { extractAuthInfo } from "@getpara/user-management-client";
|
|
12
|
+
import { FarcasterConnectQR } from "../OAuth/FarcasterOAuthStep.js";
|
|
13
|
+
import { useTelegramLogin } from "../../hooks/useTelegramLogin.js";
|
|
14
|
+
import { TelegramIFrame } from "../OAuth/TelegramOAuthStep.js";
|
|
15
|
+
import { AuthInput } from "../AuthInput/AuthInput.js";
|
|
16
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
17
|
+
import { useWalletDisplayHelpers, useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
18
|
+
import { ExternalWalletMobileConnect } from "../ExternalWalletStep/ExternalWalletStep.js";
|
|
19
|
+
import { useResendVerificationCode } from "../../../provider/index.js";
|
|
20
|
+
import { AccountLinkError } from "@getpara/web-sdk";
|
|
21
|
+
function AccountProfileLink() {
|
|
22
|
+
var _a, _b, _c, _d;
|
|
23
|
+
const {
|
|
24
|
+
accountLinkInProgress,
|
|
25
|
+
verifyEmailOrPhoneLink,
|
|
26
|
+
linkAccountStatus,
|
|
27
|
+
linkAccountError,
|
|
28
|
+
verifyTelegramLink,
|
|
29
|
+
linkAccount,
|
|
30
|
+
isLinkAccountPending,
|
|
31
|
+
resetMutations
|
|
32
|
+
} = useAccountLinking(), { wallets } = useExternalWallets(), { mutate: resendVerificationCode } = useResendVerificationCode(), accountLinkType = accountLinkInProgress == null ? void 0 : accountLinkInProgress.type, externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId, externalWalletType = (_d = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletType) != null ? _d : (_c = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _c.type, accountLinkIcon = externalWalletProvider != null ? externalWalletProvider : accountLinkType, isTelegram = accountLinkType === "TELEGRAM", {
|
|
33
|
+
url,
|
|
34
|
+
status: telegramStatus,
|
|
35
|
+
isLoaded,
|
|
36
|
+
setIsLoaded
|
|
37
|
+
} = useTelegramLogin(
|
|
38
|
+
isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
|
|
39
|
+
), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
|
|
40
|
+
const wallet = wallets.find((w) => w.internalId === externalWalletProvider && w.type === externalWalletType);
|
|
41
|
+
return wallet;
|
|
42
|
+
}, [wallets]), walletDisplayHelpers = useWalletDisplayHelpers(commonWallet);
|
|
43
|
+
const { upper, lower } = useMemo(() => {
|
|
44
|
+
let upper2 = null, lower2 = null;
|
|
45
|
+
let message;
|
|
46
|
+
switch (status) {
|
|
47
|
+
case "pending":
|
|
48
|
+
message = externalWalletType ? "Confirm wallet connection" : "Confirm login request";
|
|
49
|
+
break;
|
|
50
|
+
case "success":
|
|
51
|
+
message = "Account linked";
|
|
52
|
+
break;
|
|
53
|
+
case "error":
|
|
54
|
+
switch (linkAccountError) {
|
|
55
|
+
case AccountLinkError.Conflict:
|
|
56
|
+
message = "Account already linked";
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
message = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.type) === "EXTERNAL_WALLET" ? "Connection failed" : "Login failed";
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
message = null;
|
|
65
|
+
}
|
|
66
|
+
const heroSpinner = /* @__PURE__ */ jsx(
|
|
67
|
+
HeroSpinner,
|
|
68
|
+
{
|
|
69
|
+
status,
|
|
70
|
+
icon: status === "success" ? /* @__PURE__ */ jsx(HeroSuccessIcon, {}) : /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: accountLinkIcon }),
|
|
71
|
+
text: message
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
``;
|
|
75
|
+
const onTryAgain = externalWalletProvider && externalWalletType ? () => linkAccount({ externalWallet: { internalId: externalWalletProvider, type: externalWalletType } }) : accountLinkType && accountLinkType !== "EXTERNAL_WALLET" ? () => linkAccount({ type: accountLinkType }) : void 0;
|
|
76
|
+
const tryAgain = onTryAgain ? /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", fullWidth: true, onClick: onTryAgain, children: [
|
|
77
|
+
/* @__PURE__ */ jsx(CpslIcon, { icon: "refresh", slot: "start" }),
|
|
78
|
+
"Try Again"
|
|
79
|
+
] }) : null;
|
|
80
|
+
if (!accountLinkInProgress) {
|
|
81
|
+
return { upper: upper2, lower: lower2 };
|
|
82
|
+
}
|
|
83
|
+
switch (true) {
|
|
84
|
+
// Email or phone input
|
|
85
|
+
case (!accountLinkInProgress.identifier && (accountLinkInProgress.type === "EMAIL" || accountLinkInProgress.type === "PHONE")):
|
|
86
|
+
upper2 = heroSpinner;
|
|
87
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
88
|
+
AuthInput,
|
|
89
|
+
{
|
|
90
|
+
disableEmailLogin: accountLinkInProgress.type !== "EMAIL",
|
|
91
|
+
disablePhoneLogin: accountLinkInProgress.type !== "PHONE",
|
|
92
|
+
onSubmit: (auth) => {
|
|
93
|
+
try {
|
|
94
|
+
linkAccount({
|
|
95
|
+
auth
|
|
96
|
+
});
|
|
97
|
+
} catch (e) {
|
|
98
|
+
throw e;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
error: linkAccountError === "CONFLICT" ? "Account already linked" : void 0,
|
|
102
|
+
isSubmitting: isLinkAccountPending,
|
|
103
|
+
disableSubmitButton: true,
|
|
104
|
+
children: ({ isSubmitting, onSubmit, isPending }) => {
|
|
105
|
+
return /* @__PURE__ */ jsxs(CpslButton, { variant: "primary", onClick: onSubmit, disabled: isPending || isSubmitting, fullWidth: true, children: [
|
|
106
|
+
"Link ",
|
|
107
|
+
accountLinkType === "EMAIL" ? "Email Address" : "Phone Number"
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
break;
|
|
113
|
+
// Verify email or phone code
|
|
114
|
+
case ((accountLinkType === "EMAIL" || accountLinkType === "PHONE") && (accountLinkInProgress == null ? void 0 : accountLinkInProgress.identifier) && status !== "success"):
|
|
115
|
+
{
|
|
116
|
+
const authInfo = extractAuthInfo(
|
|
117
|
+
accountLinkType === "EMAIL" ? { email: accountLinkInProgress.identifier } : { phone: accountLinkInProgress.identifier },
|
|
118
|
+
{ isRequired: true }
|
|
119
|
+
);
|
|
120
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
121
|
+
VerificationCode,
|
|
122
|
+
{
|
|
123
|
+
authInfo,
|
|
124
|
+
onSubmit: verifyEmailOrPhoneLink,
|
|
125
|
+
onResend: () => {
|
|
126
|
+
resendVerificationCode({ type: "LINK_ACCOUNT" });
|
|
127
|
+
},
|
|
128
|
+
status: linkAccountStatus,
|
|
129
|
+
error: linkAccountError
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
// Farcaster Connect QR
|
|
135
|
+
case (accountLinkType === "FARCASTER" && status !== "success"):
|
|
136
|
+
lower2 = /* @__PURE__ */ jsx(FarcasterConnectQR, {});
|
|
137
|
+
break;
|
|
138
|
+
// OAuth, External Wallet, Telegram
|
|
139
|
+
default:
|
|
140
|
+
upper2 = heroSpinner;
|
|
141
|
+
switch (true) {
|
|
142
|
+
case accountLinkType === "EXTERNAL_WALLET":
|
|
143
|
+
{
|
|
144
|
+
if (commonWallet && walletDisplayHelpers.showMobile) {
|
|
145
|
+
upper2 = status === "success" || status === "error" ? heroSpinner : /* @__PURE__ */ jsx(
|
|
146
|
+
ExternalWalletMobileConnect,
|
|
147
|
+
{
|
|
148
|
+
wallet: commonWallet,
|
|
149
|
+
isSelfFetching: true,
|
|
150
|
+
onConnectWc: (w) => __async(this, null, function* () {
|
|
151
|
+
yield linkAccount({ externalWallet: { internalId: w.internalId, type: w.type } });
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
lower2 = linkAccountError ? tryAgain : null;
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
case accountLinkType === "TELEGRAM":
|
|
160
|
+
lower2 = /* @__PURE__ */ jsx(
|
|
161
|
+
TelegramIFrame,
|
|
162
|
+
{
|
|
163
|
+
url,
|
|
164
|
+
isLoaded,
|
|
165
|
+
setIsLoaded,
|
|
166
|
+
isVisible: status === "error" || status === "idle"
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
break;
|
|
170
|
+
case (status === "error" && !!accountLinkInProgress):
|
|
171
|
+
lower2 = tryAgain;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
upper: upper2,
|
|
178
|
+
lower: lower2
|
|
179
|
+
};
|
|
180
|
+
}, [
|
|
181
|
+
linkAccountError,
|
|
182
|
+
accountLinkType,
|
|
183
|
+
accountLinkInProgress,
|
|
184
|
+
telegramStatus,
|
|
185
|
+
url,
|
|
186
|
+
isLoaded,
|
|
187
|
+
linkAccount,
|
|
188
|
+
status,
|
|
189
|
+
isTelegram,
|
|
190
|
+
externalWalletType,
|
|
191
|
+
commonWallet,
|
|
192
|
+
walletDisplayHelpers.showMobile
|
|
193
|
+
]);
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
return () => {
|
|
196
|
+
resetMutations();
|
|
197
|
+
};
|
|
198
|
+
}, []);
|
|
199
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
+
upper,
|
|
201
|
+
lower
|
|
202
|
+
] });
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
AccountProfileLink
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileLinkOptions(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { AuthInput } from "../AuthInput/AuthInput.js";
|
|
5
|
+
import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
|
|
6
|
+
import { CpslButton, CpslDivider, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { getAccountTypeName } from "../../constants/oAuthLogos.js";
|
|
8
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
9
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
10
|
+
import { useEffect, useMemo } from "react";
|
|
11
|
+
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
12
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
13
|
+
import { safeStyled } from "@getpara/react-common";
|
|
14
|
+
function isExternalWallet(str) {
|
|
15
|
+
return EXTERNAL_WALLET_TYPES.includes(str);
|
|
16
|
+
}
|
|
17
|
+
function AccountProfileLinkOptions() {
|
|
18
|
+
const para = useInternalClient();
|
|
19
|
+
const { accountLinkOptions, linkAccount, isLinkAccountPending, linkAccountError, setLinkAccountError, resetMutations } = useAccountLinking();
|
|
20
|
+
const { wallet: connectedWallet, wallets } = useExternalWallets();
|
|
21
|
+
const [isEmail, isPhone, externalWalletIndex, isOptions] = [
|
|
22
|
+
accountLinkOptions.includes("EMAIL"),
|
|
23
|
+
accountLinkOptions.includes("PHONE"),
|
|
24
|
+
accountLinkOptions.indexOf("EXTERNAL_WALLET"),
|
|
25
|
+
(accountLinkOptions || []).filter((o) => o !== "EMAIL" && o !== "PHONE").length > 0
|
|
26
|
+
];
|
|
27
|
+
const options = useMemo(() => {
|
|
28
|
+
const baseOptions = externalWalletIndex >= 0 ? [
|
|
29
|
+
...accountLinkOptions.slice(0, externalWalletIndex),
|
|
30
|
+
...EXTERNAL_WALLET_TYPES,
|
|
31
|
+
...accountLinkOptions.slice(externalWalletIndex + 1)
|
|
32
|
+
] : accountLinkOptions;
|
|
33
|
+
return Array.from(
|
|
34
|
+
new Set(
|
|
35
|
+
baseOptions.filter((option) => {
|
|
36
|
+
if (!isExternalWallet(option) || (connectedWallet == null ? void 0 : connectedWallet.internalId) !== option && wallets.some(({ type, internalId, installed, isMobile }) => {
|
|
37
|
+
return (installed || isMobile) && (para == null ? void 0 : para.supportedWalletTypes.some((obj) => obj.type === type)) && internalId === option;
|
|
38
|
+
})) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
}, [accountLinkOptions, externalWalletIndex, wallets]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
resetMutations();
|
|
48
|
+
setLinkAccountError(null);
|
|
49
|
+
}, []);
|
|
50
|
+
const getExternalWalletType = (internalId) => {
|
|
51
|
+
const allWallets = wallets.filter((wallet) => wallet.internalId === internalId);
|
|
52
|
+
if (allWallets.length === 1) {
|
|
53
|
+
return allWallets[0].type;
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
};
|
|
57
|
+
return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
58
|
+
(isEmail || isPhone) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
AuthInput,
|
|
61
|
+
{
|
|
62
|
+
disableEmailLogin: !isEmail,
|
|
63
|
+
disablePhoneLogin: !isPhone,
|
|
64
|
+
onSubmit: (auth) => {
|
|
65
|
+
linkAccount({
|
|
66
|
+
auth
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
error: linkAccountError ? linkAccountError === "CONFLICT" ? "Account already linked" : "An unknown error occurred" : void 0,
|
|
70
|
+
isSubmitting: isLinkAccountPending
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
isOptions && /* @__PURE__ */ jsx(CpslDivider, { children: "or" })
|
|
74
|
+
] }),
|
|
75
|
+
isOptions && /* @__PURE__ */ jsx(GradientScroll, { height: "320px", children: options.filter((option) => option !== "EMAIL" && option !== "PHONE").map((option) => {
|
|
76
|
+
const isWallet = isExternalWallet(option);
|
|
77
|
+
return /* @__PURE__ */ jsxs(
|
|
78
|
+
Option,
|
|
79
|
+
{
|
|
80
|
+
fullWidth: true,
|
|
81
|
+
variant: "tertiary",
|
|
82
|
+
onClick: () => linkAccount(
|
|
83
|
+
isWallet ? { externalWallet: { internalId: option, type: getExternalWalletType(option) } } : { type: option }
|
|
84
|
+
),
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsx(AccountTypeIcon, { accountType: option, size: "24px" }),
|
|
87
|
+
/* @__PURE__ */ jsx(CpslText, { color: "contrast", variant: "bodyM", children: getAccountTypeName(option) })
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
option
|
|
91
|
+
);
|
|
92
|
+
}) })
|
|
93
|
+
] }) });
|
|
94
|
+
}
|
|
95
|
+
const Content = safeStyled.div`
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-items: flex-start;
|
|
99
|
+
gap: 8px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
`;
|
|
102
|
+
const Option = safeStyled(CpslButton)`
|
|
103
|
+
--button-justify-content: flex-start;
|
|
104
|
+
|
|
105
|
+
height: 48px;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
`;
|
|
109
|
+
export {
|
|
110
|
+
AccountProfileLinkOptions
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AccountProfileUnlink(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AddFunds: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AddFundsAsset(): import("react/jsx-runtime").JSX.Element;
|