@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,173 @@
|
|
|
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 { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { safeStyled } from "@getpara/react-common";
|
|
10
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
11
|
+
import { useEffect, useRef } from "react";
|
|
12
|
+
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
13
|
+
import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
|
|
14
|
+
import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem } from "../common.js";
|
|
15
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
16
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
17
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
18
|
+
import { useCopyToClipboard } from "@getpara/react-common";
|
|
19
|
+
import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
|
|
20
|
+
const getValue = (id, type) => {
|
|
21
|
+
return id && type ? `${id}~${type}` : void 0;
|
|
22
|
+
};
|
|
23
|
+
const ChainSelect = () => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
27
|
+
const { data: activeWallet } = useWallet();
|
|
28
|
+
const { switchChain, chainId, chains, chainIdSwitchingTo } = useExternalWallets();
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (dropdownMaxHeight && chainId) {
|
|
31
|
+
resize();
|
|
32
|
+
}
|
|
33
|
+
}, [chainId, chainIdSwitchingTo, dropdownMaxHeight]);
|
|
34
|
+
const handleChainChange = (chainId2) => __async(void 0, null, function* () {
|
|
35
|
+
yield switchChain(chainId2);
|
|
36
|
+
});
|
|
37
|
+
if (!activeWallet || !activeWallet.isExternal || activeWallet.type === "SOLANA") {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
|
|
41
|
+
const selectedChainName = (_a = chains.find((c) => c.id.toString() === chainIdToUse)) == null ? void 0 : _a.name;
|
|
42
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs(
|
|
43
|
+
HeaderSelect,
|
|
44
|
+
{
|
|
45
|
+
selectedValue: (_b = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _b : "",
|
|
46
|
+
onCpslSelectValueChange: (e) => {
|
|
47
|
+
handleChainChange(e.detail);
|
|
48
|
+
},
|
|
49
|
+
showFormattedSelectedItem: true,
|
|
50
|
+
placeholder: "Choose chain...",
|
|
51
|
+
anchorElId: "inputContainer",
|
|
52
|
+
dropdownMaxHeight,
|
|
53
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
54
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
55
|
+
autoWidth: true,
|
|
56
|
+
selectedItemVariant: "bodyXS",
|
|
57
|
+
children: [
|
|
58
|
+
chainIdToUse && /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", slot: "selected-item", children: selectedChainName }),
|
|
59
|
+
chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }) });
|
|
63
|
+
};
|
|
64
|
+
const AccountSelect = () => {
|
|
65
|
+
var _a;
|
|
66
|
+
const hideWallets = useStore((state) => {
|
|
67
|
+
var _a2;
|
|
68
|
+
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
69
|
+
});
|
|
70
|
+
const para = useInternalClient();
|
|
71
|
+
const containerRef = useRef(null);
|
|
72
|
+
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
73
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
74
|
+
const { setSelectedWallet } = useWalletState();
|
|
75
|
+
const { data: activeWallet } = useWallet();
|
|
76
|
+
const { embedded } = useAccount();
|
|
77
|
+
const availableWallets = embedded == null ? void 0 : embedded.wallets;
|
|
78
|
+
const isGuest = para.isGuestMode && (activeWallet == null ? void 0 : activeWallet.pregenIdentifierType) === "GUEST_ID";
|
|
79
|
+
const handleCopy = () => {
|
|
80
|
+
copy((activeWallet == null ? void 0 : activeWallet.address) ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
|
|
81
|
+
};
|
|
82
|
+
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs(FlexRow, { slot: "selected-item", style: { height: "24px" }, children: [
|
|
83
|
+
!isGuest && /* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "24px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
84
|
+
/* @__PURE__ */ jsx(WalletName, { variant: "bodyXS", color: "contrast", style: { marginLeft: isGuest ? "8px" : "0px" }, children: isGuest ? "Guest" : getWalletDisplayName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
|
|
85
|
+
!hideWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
86
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: (_a = activeWallet.ensName) != null ? _a : para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) }),
|
|
87
|
+
/* @__PURE__ */ jsx(
|
|
88
|
+
CpslButton,
|
|
89
|
+
{
|
|
90
|
+
id: "ignore-click",
|
|
91
|
+
size: "small",
|
|
92
|
+
variant: "ghost",
|
|
93
|
+
onClick: (e) => {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
handleCopy();
|
|
97
|
+
},
|
|
98
|
+
children: /* @__PURE__ */ jsx(CpslIcon, { id: "ignore-click", slot: "start", icon: isCopied ? "check" : "copy" })
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
] }) : null;
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
|
|
105
|
+
resize();
|
|
106
|
+
}
|
|
107
|
+
}, [activeWallet, availableWallets, dropdownMaxHeight]);
|
|
108
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "addressInputContainer", children: availableWallets && availableWallets.length > 1 ? /* @__PURE__ */ jsxs(
|
|
109
|
+
HeaderSelect,
|
|
110
|
+
{
|
|
111
|
+
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
112
|
+
onCpslSelectValueChange: (e) => {
|
|
113
|
+
const [id, type] = e.detail.split("~");
|
|
114
|
+
setSelectedWallet({ id, type });
|
|
115
|
+
},
|
|
116
|
+
showFormattedSelectedItem: true,
|
|
117
|
+
placeholder: "Choose wallet...",
|
|
118
|
+
anchorElId: "addressInputContainer",
|
|
119
|
+
dropdownMaxHeight,
|
|
120
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
121
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
122
|
+
autoWidth: true,
|
|
123
|
+
selectedItemVariant: "bodyXS",
|
|
124
|
+
children: [
|
|
125
|
+
activeWallet && ActiveWalletNode,
|
|
126
|
+
availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
|
|
127
|
+
const key = getValue(id, type);
|
|
128
|
+
const name = _name != null ? _name : getWalletDisplayName(para, { type, isExternal, isMenu: true, hideWallets });
|
|
129
|
+
return /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsxs(FlexRow, { children: [
|
|
130
|
+
/* @__PURE__ */ jsx(CpslIdenticon, { size: "40px", hash: para.getIdenticonHash(id, type) }),
|
|
131
|
+
/* @__PURE__ */ jsxs(FlexCol, { children: [
|
|
132
|
+
name && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "contrast", children: name }),
|
|
133
|
+
!hideWallets && address && type && /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: truncateAddress(address, type, { prefix: para.cosmosPrefix }) })
|
|
134
|
+
] })
|
|
135
|
+
] }) }, key);
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
) : ActiveWalletNode }) });
|
|
140
|
+
};
|
|
141
|
+
const Container = safeStyled.div`
|
|
142
|
+
flex: 0;
|
|
143
|
+
width: 100%;
|
|
144
|
+
display: flex;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
`;
|
|
147
|
+
const FlexRow = safeStyled.div`
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 8px;
|
|
151
|
+
`;
|
|
152
|
+
const FlexCol = safeStyled.div`
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: flex-start;
|
|
156
|
+
`;
|
|
157
|
+
const WalletName = safeStyled(CpslText)`
|
|
158
|
+
white-space: nowrap;
|
|
159
|
+
`;
|
|
160
|
+
const ChainName = safeStyled(CpslText)`
|
|
161
|
+
max-width: 150px;
|
|
162
|
+
text-transform: capitalize;
|
|
163
|
+
|
|
164
|
+
&::part(text-element) {
|
|
165
|
+
white-space: nowrap;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
export {
|
|
171
|
+
AccountSelect,
|
|
172
|
+
ChainSelect
|
|
173
|
+
};
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExternalWalletNetworkSelectStep: () => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { safeStyled } from "@getpara/react-common";
|
|
5
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
6
|
+
import { useModalStore } from "../../stores/index.js";
|
|
7
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
8
|
+
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
9
|
+
import { WALLET_TYPE_CONFIG } from "../../constants/walletTypeConfig.js";
|
|
10
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
11
|
+
const ExternalWalletNetworkSelectStep = () => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
14
|
+
const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
|
|
15
|
+
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
16
|
+
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
17
|
+
const { accountLinkInProgress, linkAccount } = useAccountLinking();
|
|
18
|
+
const externalWalletProvider = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId;
|
|
19
|
+
if (!accountLinkInProgress && !selectedExternalWalletId) {
|
|
20
|
+
setStep(ModalStep.ACCOUNT_MAIN);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const availableWallets = wallets.filter((w) => w.internalId === (externalWalletProvider != null ? externalWalletProvider : selectedExternalWalletId));
|
|
24
|
+
const firstWallet = availableWallets[0];
|
|
25
|
+
const handleWalletClick = (wallet) => () => {
|
|
26
|
+
if (accountLinkInProgress) {
|
|
27
|
+
linkAccount({ externalWallet: wallet });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
setSelectedExternalWalletId(wallet.internalId);
|
|
31
|
+
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
32
|
+
if (wallet.installed || wallet.internalId === "FARCASTER") {
|
|
33
|
+
connectExternalWallet(wallet);
|
|
34
|
+
} else if (wallet.isMobile) {
|
|
35
|
+
connectExternalWallet(wallet, true);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Avatar, { slot: "image", src: firstWallet == null ? void 0 : firstWallet.iconUrl }),
|
|
40
|
+
/* @__PURE__ */ jsx(ButtonContainer, { children: availableWallets.map((wallet) => {
|
|
41
|
+
const config = WALLET_TYPE_CONFIG[wallet.type];
|
|
42
|
+
return /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs(ButtonInnerContainer, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: config.icon }),
|
|
44
|
+
/* @__PURE__ */ jsx(CpslText, { weight: "medium", children: config.name })
|
|
45
|
+
] }) }, wallet.type);
|
|
46
|
+
}) })
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
49
|
+
const Container = safeStyled.div`
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 32px;
|
|
54
|
+
`;
|
|
55
|
+
const ButtonContainer = safeStyled.div`
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 8px;
|
|
61
|
+
`;
|
|
62
|
+
const Avatar = safeStyled.img`
|
|
63
|
+
width: 80px;
|
|
64
|
+
height: 80px;
|
|
65
|
+
object-fit: contain;
|
|
66
|
+
`;
|
|
67
|
+
const ButtonInnerContainer = safeStyled.div`
|
|
68
|
+
width: 100%;
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 8px;
|
|
72
|
+
`;
|
|
73
|
+
export {
|
|
74
|
+
ExternalWalletNetworkSelectStep
|
|
75
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CommonWallet } from '@getpara/react-common';
|
|
2
|
+
export declare const ExternalWalletMobileConnect: ({ wallet, qrUri: propsQrUri, onConnectWc, isSelfFetching, }: {
|
|
3
|
+
wallet: CommonWallet;
|
|
4
|
+
qrUri?: string;
|
|
5
|
+
onConnectWc: (_: CommonWallet) => Promise<void>;
|
|
6
|
+
isSelfFetching?: boolean;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const ExternalWalletStep: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
7
|
+
import { CenteredText, ErrorContainer, ErrorIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
|
|
8
|
+
import { useEffect, useMemo, useState } from "react";
|
|
9
|
+
import { useModalStore } from "../../stores/index.js";
|
|
10
|
+
import { safeStyled } from "@getpara/react-common";
|
|
11
|
+
import { useCopyToClipboard } from "@getpara/react-common";
|
|
12
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
13
|
+
import { isMobile, isTablet } from "@getpara/web-sdk";
|
|
14
|
+
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
15
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
17
|
+
const ExternalWalletMobileConnect = ({
|
|
18
|
+
wallet,
|
|
19
|
+
qrUri: propsQrUri,
|
|
20
|
+
onConnectWc,
|
|
21
|
+
isSelfFetching = false
|
|
22
|
+
}) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
25
|
+
const appName = useStore((state) => state.appName);
|
|
26
|
+
const [qrUri, setQrUri] = useState(isSelfFetching ? void 0 : propsQrUri);
|
|
27
|
+
const isWalletConnect = wallet.id === "walletConnect";
|
|
28
|
+
const handleCopy = () => {
|
|
29
|
+
if (qrUri) {
|
|
30
|
+
copy(qrUri);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const fetchQrUri = () => {
|
|
35
|
+
var _a2;
|
|
36
|
+
if (!isSelfFetching) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
(_a2 = wallet.getQrUri) == null ? void 0 : _a2.call(wallet).then(setQrUri).catch();
|
|
40
|
+
};
|
|
41
|
+
fetchQrUri();
|
|
42
|
+
}, [wallet, isSelfFetching]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setQrUri(propsQrUri);
|
|
45
|
+
}, [propsQrUri]);
|
|
46
|
+
if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
|
|
47
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: `Continue in the ${wallet.name} mobile app.` }) }),
|
|
49
|
+
wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
50
|
+
wallet.type === "SOLANA" && qrUri && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(CpslButton, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }) : /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: wallet.hasIosSafariExtension ? `Please install and use the ${wallet.name} extension for iOS Safari.` : `Please navigate to ${appName} in the ${wallet.name} wallet.` }),
|
|
51
|
+
!wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
|
|
52
|
+
`Get ${wallet.name}`,
|
|
53
|
+
/* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
|
|
54
|
+
] }) })
|
|
55
|
+
] })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
const GetWalletButton = /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? onConnectWc : void 0, children: [
|
|
59
|
+
`${isWalletConnect ? "Open" : "Get"} ${wallet.name}`,
|
|
60
|
+
/* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
|
|
61
|
+
] });
|
|
62
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
64
|
+
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }),
|
|
65
|
+
/* @__PURE__ */ jsx(QRContainer, { children: !qrUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: qrUri, imageSrc: wallet.iconUrl }) }),
|
|
66
|
+
/* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
68
|
+
isCopied ? "Copied" : "Copy Link"
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: isWalletConnect ? /* @__PURE__ */ jsx(Fragment, { children: GetWalletButton }) : /* @__PURE__ */ jsx(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: GetWalletButton }) })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
const ExternalWalletStep = () => {
|
|
75
|
+
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
76
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
77
|
+
const { connectExternalWallet, wallet, qrUri, walletDisplayHelpers } = useExternalWallets();
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
routeMobileExternalWallet(qrUri);
|
|
80
|
+
}, [qrUri]);
|
|
81
|
+
const handleTryAgainClick = () => __async(void 0, null, function* () {
|
|
82
|
+
if (wallet) {
|
|
83
|
+
yield connectExternalWallet(wallet);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const Content = useMemo(() => {
|
|
87
|
+
var _a;
|
|
88
|
+
if (!wallet) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const isWalletConnect = wallet.id === "walletConnect";
|
|
92
|
+
const isMobileWalletConnect = isMobile() && isWalletConnect;
|
|
93
|
+
if (isMobileWalletConnect) {
|
|
94
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: "Continue in the WalletConnect modal." }) });
|
|
95
|
+
}
|
|
96
|
+
const { showExtension, showMobile } = walletDisplayHelpers;
|
|
97
|
+
if (!showMobile && !showExtension) {
|
|
98
|
+
return /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: `${wallet.name} isn't supported on mobile devices.
|
|
99
|
+
|
|
100
|
+
Please choose another wallet or continue on desktop.` }) });
|
|
101
|
+
}
|
|
102
|
+
if (showExtension) {
|
|
103
|
+
const isInstalled = wallet.installed;
|
|
104
|
+
return /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
105
|
+
isInstalled && !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm connection request in the ${wallet.name} browser extension.` }) : /* @__PURE__ */ jsxs(ErrorContainer, { children: [
|
|
106
|
+
/* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
|
|
107
|
+
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError == null ? void 0 : externalWalletError[0] : `${wallet.name} not detected` })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ jsxs(
|
|
110
|
+
CpslButton,
|
|
111
|
+
{
|
|
112
|
+
as: isInstalled ? "button" : "a",
|
|
113
|
+
href: (_a = wallet.downloadUrl) != null ? _a : "",
|
|
114
|
+
target: "_blank",
|
|
115
|
+
variant: "secondary",
|
|
116
|
+
onClick: handleTryAgainClick,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isInstalled ? "refresh" : "linkExternal" }),
|
|
119
|
+
isInstalled ? "Try Again" : `Get ${wallet.name}`
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
if (showMobile) {
|
|
126
|
+
return /* @__PURE__ */ jsx(
|
|
127
|
+
ExternalWalletMobileConnect,
|
|
128
|
+
{
|
|
129
|
+
wallet,
|
|
130
|
+
qrUri,
|
|
131
|
+
onConnectWc: (w) => __async(void 0, null, function* () {
|
|
132
|
+
yield connectExternalWallet(w, true, true);
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!wallet) {
|
|
140
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
141
|
+
}
|
|
142
|
+
}, [wallet]);
|
|
143
|
+
if (!wallet) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ jsx(Container, { children: Content });
|
|
147
|
+
};
|
|
148
|
+
const Container = safeStyled(StepContainer)`
|
|
149
|
+
flex: 1;
|
|
150
|
+
justify-content: space-between;
|
|
151
|
+
`;
|
|
152
|
+
const Text = safeStyled(CenteredText)`
|
|
153
|
+
white-space: pre-line;
|
|
154
|
+
`;
|
|
155
|
+
const ExternalButton = safeStyled(CpslButton)`
|
|
156
|
+
display: flex;
|
|
157
|
+
gap: 8px;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
width: 100%;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
margin-top: 8px;
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
`;
|
|
165
|
+
const ExternalIcon = safeStyled(CpslIcon)`
|
|
166
|
+
--height: 20px;
|
|
167
|
+
--width: 20px;
|
|
168
|
+
`;
|
|
169
|
+
const Link = safeStyled.a`
|
|
170
|
+
text-decoration: none;
|
|
171
|
+
`;
|
|
172
|
+
export {
|
|
173
|
+
ExternalWalletMobileConnect,
|
|
174
|
+
ExternalWalletStep
|
|
175
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
var TabValue = /* @__PURE__ */ ((TabValue2) => {
|
|
4
|
+
TabValue2["extension"] = "extension";
|
|
5
|
+
TabValue2["mobile"] = "mobile";
|
|
6
|
+
TabValue2["web"] = "web";
|
|
7
|
+
return TabValue2;
|
|
8
|
+
})(TabValue || {});
|
|
9
|
+
const TABS = {
|
|
10
|
+
extension: { label: "Extension", value: "extension" /* extension */, icon: "puzzlePiece" },
|
|
11
|
+
mobile: { label: "Mobile", value: "mobile" /* mobile */, icon: "phone" },
|
|
12
|
+
web: { label: "Web", value: "web" /* web */, icon: "globe" }
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
TABS,
|
|
16
|
+
TabValue
|
|
17
|
+
};
|
package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExternalWalletVerificationStep: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CpslButton, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
5
|
+
import { safeStyled } from "@getpara/react-common";
|
|
6
|
+
import { useModalStore } from "../../stores/index.js";
|
|
7
|
+
import { ErrorContainer, ErrorIcon, Heading, InnerStepContainer, StepContainer } from "../common.js";
|
|
8
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
9
|
+
import { useEffect, useRef } from "react";
|
|
10
|
+
const ExternalWalletVerificationStep = () => {
|
|
11
|
+
const effectRan = useRef(false);
|
|
12
|
+
const { verifyWalletSignature } = useExternalWallets();
|
|
13
|
+
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const hasRun = effectRan.current;
|
|
16
|
+
if (!hasRun) {
|
|
17
|
+
verifyWalletSignature();
|
|
18
|
+
effectRan.current = true;
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
22
|
+
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
23
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Verify Your Wallet" }),
|
|
24
|
+
/* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", children: "Sign the message with your wallet to complete sign up." }),
|
|
25
|
+
!!(externalWalletError == null ? void 0 : externalWalletError[0]) && /* @__PURE__ */ jsxs(ErrorContainer, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
|
|
27
|
+
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
|
|
28
|
+
] })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: !externalWalletError || !effectRan.current ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
33
|
+
const InlineText = safeStyled(CpslText)`
|
|
34
|
+
text-align: center;
|
|
35
|
+
display: inline-block;
|
|
36
|
+
`;
|
|
37
|
+
export {
|
|
38
|
+
ExternalWalletVerificationStep
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExternalWallets: () => import("react/jsx-runtime").JSX.Element;
|