@getpara/react-sdk-lite 2.0.0-dev.7 → 2.0.0
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/cli/cli.mjs +26 -1
- package/dist/modal/ParaModal.js +16 -10
- package/dist/modal/components/Account/Account.js +42 -4
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +82 -210
- package/dist/modal/components/Account/AccountProfileEntry.d.ts +12 -0
- package/dist/modal/components/Account/AccountProfileEntry.js +220 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +15 -4
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
- package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
- package/dist/modal/components/Account/AccountSend/context.js +418 -0
- package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
- package/dist/modal/components/Account/AccountSend/index.js +67 -0
- package/dist/modal/components/Account/AccountWallet.d.ts +1 -0
- package/dist/modal/components/Account/AccountWallet.js +133 -0
- package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
- package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +20 -6
- package/dist/modal/components/AddFunds/AddFunds.js +3 -2
- package/dist/modal/components/AddFunds/AddFundsAsset.js +7 -6
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
- package/dist/modal/components/AddFunds/AddFundsSettings.js +13 -54
- package/dist/modal/components/AddFunds/common.d.ts +0 -14
- package/dist/modal/components/AddFunds/common.js +1 -8
- package/dist/modal/components/AuthInput/AuthInput.js +2 -2
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +3 -2
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +8 -33
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +81 -48
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +8 -5
- package/dist/modal/components/Controls/ChainSelect.js +1 -2
- package/dist/modal/components/Controls/Controls.js +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +5 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +48 -19
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +5 -2
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +63 -33
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +3 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +22 -12
- package/dist/modal/components/Footer/Footer.js +4 -5
- package/dist/modal/components/Header/Header.js +1 -2
- package/dist/modal/components/Header/hooks/useStepTitle.js +53 -38
- package/dist/modal/components/Hero/Hero.js +5 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +13 -12
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -5
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +6 -5
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
- package/dist/modal/components/QuantityInput.d.ts +9 -0
- package/dist/modal/components/QuantityInput.js +91 -0
- package/dist/modal/components/SearchableButtonList.d.ts +34 -0
- package/dist/modal/components/SearchableButtonList.js +223 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/components/WalletCard/WalletCard.js +2 -3
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +33 -12
- package/dist/modal/components/common.d.ts +8 -10
- package/dist/modal/components/common.js +16 -36
- package/dist/modal/hooks/index.d.ts +4 -0
- package/dist/modal/hooks/index.js +5 -0
- package/dist/modal/hooks/useDebounce.d.ts +4 -0
- package/dist/modal/hooks/useDebounce.js +16 -0
- package/dist/modal/hooks/useFarcasterLogin.js +8 -1
- package/dist/modal/hooks/useTelegramLogin.js +4 -0
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/stores/modal/actions.js +9 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +9 -1
- package/dist/modal/stores/modal/useModalStore.js +6 -2
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/authInputHelpers.js +1 -1
- package/dist/modal/utils/countryCodes.js +50 -1
- package/dist/modal/utils/getWalletDisplayName.js +1 -1
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/modal/utils/openPopup.js +6 -2
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +24 -3
- package/dist/modal/utils/steps.js +51 -5
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +11 -7
- package/dist/modal/utils/validatePortalOrigin.d.ts +2 -0
- package/dist/modal/utils/validatePortalOrigin.js +14 -0
- package/dist/provider/ParaProviderMin.js +13 -5
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +13 -4
- package/dist/provider/actions/index.d.ts +11 -9
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/components/CosmosWalletWrapper.js +3 -3
- package/dist/provider/components/EvmWalletWrapper.js +3 -3
- package/dist/provider/components/ExternalWalletWrapper.js +7 -1
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +3 -1
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +5 -5
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +2 -2
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +2 -2
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +8 -2
- package/dist/provider/hooks/mutations/useLogout.d.ts +2 -2
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +18 -27
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +5 -5
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +14 -11
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +5 -5
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +2 -2
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useAccount.js +58 -24
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +29 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +65 -0
- package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
- package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +22 -5
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/hooks/utils/useWalletState.d.ts +2 -1
- package/dist/provider/hooks/utils/useWalletState.js +2 -1
- package/dist/provider/providers/AccountLinkProvider.js +18 -11
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +4 -0
- package/dist/provider/providers/AuthProvider.js +187 -43
- package/dist/provider/providers/ExternalWalletProvider.d.ts +19 -5
- package/dist/provider/providers/ExternalWalletProvider.js +363 -44
- package/dist/provider/stores/getters.d.ts +2 -2
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +6 -3
- package/package.json +8 -8
- package/dist/modal/constants/constants.d.ts +0 -35
- package/dist/modal/constants/constants.js +0 -148
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
|
@@ -7,11 +7,14 @@ import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpar
|
|
|
7
7
|
import { HeroAccountTypeIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
|
|
8
8
|
import { useEffect, useMemo } from "react";
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
HeroSpinner,
|
|
12
|
+
safeStyled,
|
|
13
|
+
NETWORK_NOT_SUPPORTED_ERROR,
|
|
14
|
+
useCopyToClipboard,
|
|
15
|
+
openMobileUrl
|
|
16
|
+
} from "@getpara/react-common";
|
|
12
17
|
import { ModalStep } from "../../utils/steps.js";
|
|
13
|
-
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
14
|
-
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
15
18
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
19
|
const ChainSwitch = () => {
|
|
17
20
|
const [isCopied, copy] = useCopyToClipboard();
|
|
@@ -21,7 +24,7 @@ const ChainSwitch = () => {
|
|
|
21
24
|
const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
|
|
22
25
|
useEffect(() => {
|
|
23
26
|
if ((wallet == null ? void 0 : wallet.type) === "COSMOS") {
|
|
24
|
-
|
|
27
|
+
openMobileUrl(qrUri);
|
|
25
28
|
}
|
|
26
29
|
}, [qrUri, wallet]);
|
|
27
30
|
useEffect(() => {
|
|
@@ -4,13 +4,12 @@ import {
|
|
|
4
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CpslText } from "@getpara/react-components";
|
|
7
|
-
import { getNetworkFromChainId, safeStyled } from "@getpara/react-common";
|
|
7
|
+
import { getNetworkFromChainId, getNetworkName, safeStyled } from "@getpara/react-common";
|
|
8
8
|
import { useEffect, useRef } from "react";
|
|
9
9
|
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
10
10
|
import { useWallet } from "../../../provider/index.js";
|
|
11
11
|
import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
|
|
12
12
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
13
|
-
import { getNetworkName } from "../../constants/constants.js";
|
|
14
13
|
const Chain = ({
|
|
15
14
|
chain: { id, name },
|
|
16
15
|
slot,
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
type ExternalWalletNetworkSelectStepType = 'CONNECT' | 'ADD_EXTERNAL' | 'ACCOUNT_LINKING';
|
|
2
|
+
export declare const ExternalWalletNetworkSelectStep: ({ type }: {
|
|
3
|
+
type?: ExternalWalletNetworkSelectStepType;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export {};
|
package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
import { safeStyled } from "@getpara/react-common";
|
|
5
7
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
@@ -8,35 +10,62 @@ import { ModalStep } from "../../utils/steps.js";
|
|
|
8
10
|
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
9
11
|
import { WALLET_TYPE_CONFIG } from "../../constants/walletTypeConfig.js";
|
|
10
12
|
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
11
|
-
const ExternalWalletNetworkSelectStep = () => {
|
|
12
|
-
var _a, _b;
|
|
13
|
+
const ExternalWalletNetworkSelectStep = ({ type = "CONNECT" }) => {
|
|
14
|
+
var _a, _b, _c;
|
|
13
15
|
const setStep = useModalStore((state) => state.setStep);
|
|
14
16
|
const selectedExternalWallet = useModalStore((state) => state.selectedExternalWallet);
|
|
15
17
|
const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
|
|
16
|
-
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
18
|
+
const { wallets, connectExternalWallet, addAdditionalExternalWallet } = useExternalWallets();
|
|
17
19
|
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 (!
|
|
20
|
-
setStep(ModalStep.ACCOUNT_MAIN);
|
|
20
|
+
const externalWalletProvider = (_c = (_b = accountLinkInProgress == null ? void 0 : accountLinkInProgress.pendingWalletProvider) != null ? _b : (_a = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a.providerId) != null ? _c : selectedExternalWallet == null ? void 0 : selectedExternalWallet.id;
|
|
21
|
+
if (!externalWalletProvider) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
|
-
const availableWallets = wallets.filter((w) => w.id ===
|
|
24
|
+
const availableWallets = wallets.filter((w) => w.id === externalWalletProvider);
|
|
24
25
|
const firstWallet = availableWallets[0];
|
|
25
|
-
const handleWalletClick = (wallet) => () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const handleWalletClick = (wallet) => () => __async(void 0, null, function* () {
|
|
27
|
+
switch (type) {
|
|
28
|
+
case "ACCOUNT_LINKING":
|
|
29
|
+
linkAccount({ externalWallet: { provider: wallet.id, type: wallet.type } });
|
|
30
|
+
break;
|
|
31
|
+
case "ADD_EXTERNAL":
|
|
32
|
+
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
33
|
+
setStep(ModalStep.ADD_EX_WALLET_SELECTED);
|
|
34
|
+
try {
|
|
35
|
+
yield addAdditionalExternalWallet(wallet);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error("Failed to add additional wallet:", error);
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case "CONNECT":
|
|
41
|
+
default:
|
|
42
|
+
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
43
|
+
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
44
|
+
if (wallet.installed || wallet.internalId === "FARCASTER") {
|
|
45
|
+
connectExternalWallet({ wallet });
|
|
46
|
+
} else if (wallet.isMobile) {
|
|
47
|
+
connectExternalWallet({ wallet, isMobile: true });
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
29
50
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
});
|
|
52
|
+
const getIconSource = () => {
|
|
53
|
+
var _a2, _b2, _c2;
|
|
54
|
+
switch (type) {
|
|
55
|
+
case "ACCOUNT_LINKING":
|
|
56
|
+
return ((_a2 = accountLinkInProgress == null ? void 0 : accountLinkInProgress.externalWallet) == null ? void 0 : _a2.providerId) ? (_b2 = wallets.find((w) => {
|
|
57
|
+
var _a3;
|
|
58
|
+
return w.id === ((_a3 = accountLinkInProgress.externalWallet) == null ? void 0 : _a3.providerId);
|
|
59
|
+
})) == null ? void 0 : _b2.iconUrl : firstWallet == null ? void 0 : firstWallet.iconUrl;
|
|
60
|
+
case "ADD_EXTERNAL":
|
|
61
|
+
return (selectedExternalWallet == null ? void 0 : selectedExternalWallet.id) ? (_c2 = wallets.find((w) => w.id === selectedExternalWallet.id)) == null ? void 0 : _c2.iconUrl : firstWallet == null ? void 0 : firstWallet.iconUrl;
|
|
62
|
+
case "CONNECT":
|
|
63
|
+
default:
|
|
64
|
+
return firstWallet == null ? void 0 : firstWallet.iconUrl;
|
|
36
65
|
}
|
|
37
66
|
};
|
|
38
67
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
39
|
-
/* @__PURE__ */ jsx(Avatar, { slot: "image", src:
|
|
68
|
+
/* @__PURE__ */ jsx(Avatar, { slot: "image", src: getIconSource() }),
|
|
40
69
|
/* @__PURE__ */ jsx(ButtonContainer, { children: availableWallets.map((wallet) => {
|
|
41
70
|
const config = WALLET_TYPE_CONFIG[wallet.type];
|
|
42
71
|
return /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs(ButtonInnerContainer, { children: [
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { CommonWallet } from '@getpara/react-common';
|
|
2
|
-
export declare const ExternalWalletMobileConnect: ({ wallet,
|
|
2
|
+
export declare const ExternalWalletMobileConnect: ({ wallet, onConnectWc, onRetryClick, }: {
|
|
3
3
|
wallet: CommonWallet;
|
|
4
4
|
qrUri?: string;
|
|
5
5
|
onConnectWc: (_: CommonWallet) => Promise<void>;
|
|
6
|
+
onRetryClick?: () => Promise<void>;
|
|
6
7
|
isSelfFetching?: boolean;
|
|
7
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const ExternalWalletStep: (
|
|
9
|
+
export declare const ExternalWalletStep: ({ isAddingWallets }: {
|
|
10
|
+
isAddingWallets?: boolean;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -5,49 +5,56 @@ import {
|
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
7
7
|
import { CenteredText, HeroAccountTypeIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
|
|
8
|
-
import { useEffect, useMemo
|
|
8
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
|
-
import { HeroSpinner, safeStyled } from "@getpara/react-common";
|
|
10
|
+
import { HeroSpinner, openMobileUrl, safeStyled } from "@getpara/react-common";
|
|
11
11
|
import { useCopyToClipboard } from "@getpara/react-common";
|
|
12
12
|
import { ModalStep } from "../../utils/steps.js";
|
|
13
13
|
import { isMobile, isTablet } from "@getpara/web-sdk";
|
|
14
|
-
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
15
14
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
15
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
16
|
+
const isSolanaWalletInAppBrowser = (wallet) => {
|
|
17
|
+
var _a;
|
|
18
|
+
switch (wallet) {
|
|
19
|
+
case "PHANTOM":
|
|
20
|
+
return !!((_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.solana);
|
|
21
|
+
case "SOLFLARE":
|
|
22
|
+
return !!(window == null ? void 0 : window.solflare);
|
|
23
|
+
case "BACKPACK":
|
|
24
|
+
return !!(window == null ? void 0 : window.backpack);
|
|
25
|
+
case "GLOW":
|
|
26
|
+
return !!(window == null ? void 0 : window.glowSolana);
|
|
27
|
+
default:
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
17
31
|
const ExternalWalletMobileConnect = ({
|
|
18
32
|
wallet,
|
|
19
|
-
qrUri: propsQrUri,
|
|
20
33
|
onConnectWc,
|
|
21
|
-
|
|
34
|
+
onRetryClick
|
|
22
35
|
}) => {
|
|
23
36
|
var _a, _b;
|
|
24
37
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
25
38
|
const [isCopied, copy] = useCopyToClipboard();
|
|
26
39
|
const appName = useStore((state) => state.appName);
|
|
27
|
-
const [qrUri, setQrUri] = useState(isSelfFetching ? void 0 : propsQrUri);
|
|
28
40
|
const isWalletConnect = wallet.id === "WalletConnect";
|
|
41
|
+
const { qrUri } = useExternalWallets();
|
|
29
42
|
const handleCopy = () => {
|
|
30
43
|
if (qrUri) {
|
|
31
44
|
copy(qrUri);
|
|
32
45
|
}
|
|
33
46
|
};
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const fetchQrUri = () => {
|
|
36
|
-
var _a2;
|
|
37
|
-
if (!isSelfFetching) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
(_a2 = wallet.getQrUri) == null ? void 0 : _a2.call(wallet).then(setQrUri).catch();
|
|
41
|
-
};
|
|
42
|
-
fetchQrUri();
|
|
43
|
-
}, [wallet, isSelfFetching]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
setQrUri(propsQrUri);
|
|
46
|
-
}, [propsQrUri]);
|
|
47
47
|
const isError = !!(externalWalletError == null ? void 0 : externalWalletError[0]);
|
|
48
|
+
const handleRetryClick = () => __async(void 0, null, function* () {
|
|
49
|
+
if (isError && onRetryClick) {
|
|
50
|
+
yield onRetryClick();
|
|
51
|
+
} else {
|
|
52
|
+
yield openMobileUrl(qrUri);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
48
55
|
if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
|
|
49
56
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
-
wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
wallet.type === "SOLANA" && !!qrUri && !isSolanaWalletInAppBrowser(wallet.internalId) && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(
|
|
51
58
|
HeroSpinner,
|
|
52
59
|
{
|
|
53
60
|
icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
|
|
@@ -61,12 +68,12 @@ const ExternalWalletMobileConnect = ({
|
|
|
61
68
|
HeroSpinner,
|
|
62
69
|
{
|
|
63
70
|
icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
|
|
64
|
-
status: isError ? "error" : "pending",
|
|
65
|
-
text: isError ? externalWalletError[0] : `Confirm connection request in the ${wallet.name} app.`,
|
|
71
|
+
status: wallet.type === "SOLANA" && !isSolanaWalletInAppBrowser(wallet.internalId) ? "idle" : isError ? "error" : "pending",
|
|
72
|
+
text: wallet.type === "SOLANA" && (!isSolanaWalletInAppBrowser(wallet.internalId) || wallet.hasIosSafariExtension) ? "" : isError ? externalWalletError[0] : `Confirm connection request in the ${wallet.name} app.`,
|
|
66
73
|
secondaryText: externalWalletError == null ? void 0 : externalWalletError[1]
|
|
67
74
|
}
|
|
68
75
|
),
|
|
69
|
-
wallet.type === "SOLANA" &&
|
|
76
|
+
wallet.type === "SOLANA" && isSolanaWalletInAppBrowser(wallet.internalId) && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(CpslButton, { onClick: handleRetryClick, fullWidth: true, children: isError ? "Retry" : "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.` }),
|
|
70
77
|
!wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
|
|
71
78
|
`Get ${wallet.name}`,
|
|
72
79
|
/* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
|
|
@@ -90,16 +97,24 @@ const ExternalWalletMobileConnect = ({
|
|
|
90
97
|
/* @__PURE__ */ jsx(InnerStepContainer, { children: isWalletConnect ? /* @__PURE__ */ jsx(Fragment, { children: GetWalletButton }) : /* @__PURE__ */ jsx(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: GetWalletButton }) })
|
|
91
98
|
] });
|
|
92
99
|
};
|
|
93
|
-
const ExternalWalletStep = () => {
|
|
100
|
+
const ExternalWalletStep = ({ isAddingWallets = false }) => {
|
|
94
101
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
102
|
+
const step = useModalStore((state) => state.step);
|
|
95
103
|
const setStep = useModalStore((state) => state.setStep);
|
|
96
|
-
const { connectExternalWallet, wallet, qrUri, walletDisplayHelpers } = useExternalWallets();
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
const { connectExternalWallet, addAdditionalExternalWallet, wallet, qrUri, walletDisplayHelpers } = useExternalWallets();
|
|
105
|
+
const handleConnect = useCallback(
|
|
106
|
+
(wallet2, isWc = false, isRetryConnection = false) => __async(void 0, null, function* () {
|
|
107
|
+
if (isAddingWallets) {
|
|
108
|
+
yield addAdditionalExternalWallet(wallet2);
|
|
109
|
+
} else {
|
|
110
|
+
yield isWc ? connectExternalWallet({ wallet: wallet2, isMobile: true, isManualWalletConnect: true }) : connectExternalWallet({ wallet: wallet2, isMobile: wallet2.isMobile, isRetryConnection });
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
[isAddingWallets, addAdditionalExternalWallet, connectExternalWallet]
|
|
114
|
+
);
|
|
100
115
|
const handleTryAgainClick = () => __async(void 0, null, function* () {
|
|
101
116
|
if (wallet) {
|
|
102
|
-
yield
|
|
117
|
+
yield handleConnect(wallet, false, true);
|
|
103
118
|
}
|
|
104
119
|
});
|
|
105
120
|
const Content = useMemo(() => {
|
|
@@ -153,17 +168,32 @@ Please choose another wallet or continue on desktop.` }) });
|
|
|
153
168
|
wallet,
|
|
154
169
|
qrUri,
|
|
155
170
|
onConnectWc: (w) => __async(void 0, null, function* () {
|
|
156
|
-
yield
|
|
171
|
+
yield handleConnect(w, true);
|
|
172
|
+
}),
|
|
173
|
+
onRetryClick: () => __async(void 0, null, function* () {
|
|
174
|
+
yield connectExternalWallet({ wallet, isMobile: true, isRetryConnection: true });
|
|
157
175
|
})
|
|
158
176
|
}
|
|
159
177
|
);
|
|
160
178
|
}
|
|
161
|
-
}, [
|
|
179
|
+
}, [
|
|
180
|
+
wallet,
|
|
181
|
+
walletDisplayHelpers,
|
|
182
|
+
externalWalletError,
|
|
183
|
+
qrUri,
|
|
184
|
+
isAddingWallets,
|
|
185
|
+
addAdditionalExternalWallet,
|
|
186
|
+
connectExternalWallet
|
|
187
|
+
]);
|
|
162
188
|
useEffect(() => {
|
|
163
189
|
if (!wallet) {
|
|
164
|
-
|
|
190
|
+
if (step === ModalStep.ADD_EX_WALLET_SELECTED) {
|
|
191
|
+
setStep(ModalStep.ADD_EX_WALLET_MORE);
|
|
192
|
+
} else {
|
|
193
|
+
setStep(ModalStep.AUTH_MAIN);
|
|
194
|
+
}
|
|
165
195
|
}
|
|
166
|
-
}, [wallet]);
|
|
196
|
+
}, [wallet, step]);
|
|
167
197
|
if (!wallet) {
|
|
168
198
|
return null;
|
|
169
199
|
}
|
|
@@ -12,11 +12,13 @@ import { useState } from "react";
|
|
|
12
12
|
import { hasEmbeddedAuth } from "../../utils/authLayoutHelpers.js";
|
|
13
13
|
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
14
|
const HAS_MORE_LENGTH = 3;
|
|
15
|
-
const ExternalWallets = () => {
|
|
16
|
-
const { wallets: allWallets, connectExternalWallet } = useExternalWallets();
|
|
15
|
+
const ExternalWallets = ({ isAddingWallets = false }) => {
|
|
16
|
+
const { wallets: allWallets, connectExternalWallet, addAdditionalExternalWallet } = useExternalWallets();
|
|
17
17
|
const setSelectedExternalWallet = useModalStore((state) => state.setSelectedExternalWallet);
|
|
18
18
|
const setStep = useModalStore((state) => state.setStep);
|
|
19
|
-
const showAll = useModalStore(
|
|
19
|
+
const showAll = useModalStore(
|
|
20
|
+
(state) => state.step === ModalStep.EX_WALLET_MORE || state.step === ModalStep.ADD_EX_WALLET_MORE
|
|
21
|
+
);
|
|
20
22
|
const authLayout = useModalStore((state) => state.authLayout);
|
|
21
23
|
const [search, setSearch] = useState("");
|
|
22
24
|
const dedupedWallets = Array.from(new Set(allWallets.map((wallet) => wallet.id))).map((id) => {
|
|
@@ -31,21 +33,29 @@ const ExternalWallets = () => {
|
|
|
31
33
|
const handleParaClick = () => {
|
|
32
34
|
setStep(ModalStep.AUTH_MORE);
|
|
33
35
|
};
|
|
34
|
-
const handleWalletClick = (wallet) => () => {
|
|
36
|
+
const handleWalletClick = (wallet) => () => __async(void 0, null, function* () {
|
|
35
37
|
const shouldShowNetworkSelection = allWallets.filter((w) => w.id === wallet.id).length > 1;
|
|
36
38
|
if (shouldShowNetworkSelection) {
|
|
37
39
|
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
38
|
-
setStep(ModalStep.EX_WALLET_NETWORK_SELECT);
|
|
40
|
+
setStep(isAddingWallets ? ModalStep.ADD_EX_WALLET_NETWORK_SELECT : ModalStep.EX_WALLET_NETWORK_SELECT);
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
41
43
|
setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
|
|
42
|
-
setStep(ModalStep.EX_WALLET_SELECTED);
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
setStep(isAddingWallets ? ModalStep.ADD_EX_WALLET_SELECTED : ModalStep.EX_WALLET_SELECTED);
|
|
45
|
+
if (isAddingWallets) {
|
|
46
|
+
try {
|
|
47
|
+
yield addAdditionalExternalWallet(wallet);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("Failed to add additional wallet:", error);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
if (wallet.installed) {
|
|
53
|
+
connectExternalWallet({ wallet });
|
|
54
|
+
} else if (wallet.isMobile) {
|
|
55
|
+
connectExternalWallet({ wallet, isMobile: true });
|
|
56
|
+
}
|
|
47
57
|
}
|
|
48
|
-
};
|
|
58
|
+
});
|
|
49
59
|
return /* @__PURE__ */ jsxs(Container, { $maxHeight: showAll, children: [
|
|
50
60
|
showAll && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
61
|
/* @__PURE__ */ jsx(SearchInputWrapper, { children: /* @__PURE__ */ jsx(
|
|
@@ -61,7 +71,7 @@ const ExternalWallets = () => {
|
|
|
61
71
|
children: /* @__PURE__ */ jsx(SearchIcon, { slot: "start", icon: "search" })
|
|
62
72
|
}
|
|
63
73
|
) }),
|
|
64
|
-
hasEmbeddedAuth(authLayout != null ? authLayout : []) && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: /* @__PURE__ */ jsxs(WalletButtonOuterContainer, { children: [
|
|
74
|
+
hasEmbeddedAuth(authLayout != null ? authLayout : []) && !isAddingWallets && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: /* @__PURE__ */ jsxs(WalletButtonOuterContainer, { children: [
|
|
65
75
|
/* @__PURE__ */ jsxs(WalletButtonInnerContainer, { children: [
|
|
66
76
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "paraIcon" }),
|
|
67
77
|
/* @__PURE__ */ jsx(CpslText, { weight: "medium", children: "Para" })
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { safeStyled } from "@getpara/react-common";
|
|
4
|
+
import { safeStyled, PARA_TERMS_AND_CONDITIONS } from "@getpara/react-common";
|
|
5
5
|
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
6
|
-
import { PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
|
|
7
6
|
import { useModalStore } from "../../stores/index.js";
|
|
8
7
|
import { ModalStep } from "../../utils/steps.js";
|
|
9
|
-
import {
|
|
8
|
+
import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
|
|
10
9
|
const Footer = () => {
|
|
11
|
-
const { isConnected } = useAccount();
|
|
12
10
|
const currentStep = useModalStore((state) => state.step);
|
|
13
|
-
const
|
|
11
|
+
const { accountLinkInProgress } = useAccountLinking();
|
|
12
|
+
const showFooter = !accountLinkInProgress && [
|
|
14
13
|
ModalStep.AUTH_MAIN,
|
|
15
14
|
ModalStep.AUTH_MORE,
|
|
16
15
|
ModalStep.EX_WALLET_NETWORK_SELECT,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { getAuthDisplay, safeStyled } from "@getpara/react-common";
|
|
4
|
+
import { getAuthDisplay, safeStyled, BODY_MOTION_VARIANTS, BODY_TRANSITION } from "@getpara/react-common";
|
|
5
5
|
import { useStepTitle } from "./hooks/useStepTitle.js";
|
|
6
6
|
import { CenteredText } from "../common.js";
|
|
7
7
|
import { AnimatePresence, motion } from "framer-motion";
|
|
8
8
|
import { useModalStore } from "../../stores/index.js";
|
|
9
|
-
import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from "../../constants/constants.js";
|
|
10
9
|
import { useAccount } from "../../../provider/index.js";
|
|
11
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
12
11
|
import { CpslIcon, CpslText } from "@getpara/react-components";
|
|
@@ -22,6 +22,7 @@ const useStepTitle = () => {
|
|
|
22
22
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
23
23
|
const currentStep = useModalStore((state) => state.step);
|
|
24
24
|
const authLayout = useModalStore((state) => state.authLayout) || [];
|
|
25
|
+
const profileWallet = useModalStore((state) => state.profileWallet);
|
|
25
26
|
const { data: activeWallet } = useWallet();
|
|
26
27
|
const [isAuthFirst, isAuthCondensed, isExternalFirst, isExternalCondensed, isBothCondensed] = [
|
|
27
28
|
(_a = authLayout[0]) == null ? void 0 : _a.includes("AUTH"),
|
|
@@ -34,44 +35,58 @@ const useStepTitle = () => {
|
|
|
34
35
|
const { chainId } = useExternalWallets();
|
|
35
36
|
const { isEnabled: isAccountLinkingEnabled } = useAccountLinking();
|
|
36
37
|
const titles = useMemo(
|
|
37
|
-
() =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
38
|
+
() => {
|
|
39
|
+
var _a2;
|
|
40
|
+
return {
|
|
41
|
+
[ModalStep.AUTH_MAIN]: authStepTitle,
|
|
42
|
+
[ModalStep.AUTH_MORE]: signUpOrLogInTitle,
|
|
43
|
+
[ModalStep.AUTH_GUEST_SIGNUP]: "Complete Account Setup",
|
|
44
|
+
[ModalStep.EX_WALLET_MORE]: connectWalletTitle,
|
|
45
|
+
[ModalStep.ADD_EX_WALLET_MORE]: "Add Wallet",
|
|
46
|
+
[ModalStep.VERIFICATIONS]: "Sign Up",
|
|
47
|
+
[ModalStep.AWAITING_OAUTH]: signUpOrLogInTitle,
|
|
48
|
+
[ModalStep.FARCASTER_OAUTH]: signUpOrLogInTitle,
|
|
49
|
+
[ModalStep.TELEGRAM_OAUTH]: signUpOrLogInTitle,
|
|
50
|
+
[ModalStep.BIOMETRIC_CREATION]: "Sign Up",
|
|
51
|
+
[ModalStep.PASSWORD_CREATION]: "Sign Up",
|
|
52
|
+
[ModalStep.AWAITING_BIOMETRIC_CREATION]: "Sign Up",
|
|
53
|
+
[ModalStep.AWAITING_WALLET_CREATION]: isLogin ? "Login" : "Sign Up",
|
|
54
|
+
[ModalStep.AWAITING_PASSWORD_CREATION]: "Sign Up",
|
|
55
|
+
[ModalStep.WALLET_CREATION_DONE]: hideWallets ? "Account Created" : "Wallet Created",
|
|
56
|
+
[ModalStep.SECRET]: isLogin ? "Login" : "Sign Up",
|
|
57
|
+
[ModalStep.BIOMETRIC_LOGIN]: "Login",
|
|
58
|
+
[ModalStep.EMBEDDED_PASSWORD_LOGIN]: "Login",
|
|
59
|
+
[ModalStep.AWAITING_PASSWORD_LOGIN]: "Login",
|
|
60
|
+
[ModalStep.AWAITING_BIOMETRIC_LOGIN]: "Login",
|
|
61
|
+
[ModalStep.LOGIN_DONE]: "",
|
|
62
|
+
[ModalStep.SETUP_2FA]: "2FA",
|
|
63
|
+
[ModalStep.VERIFY_2FA]: "2FA",
|
|
64
|
+
[ModalStep.TWO_FACTOR_DONE]: "2FA",
|
|
65
|
+
[ModalStep.ADD_FUNDS_BUY]: "Add Funds",
|
|
66
|
+
[ModalStep.ADD_FUNDS_RECEIVE]: "Add Funds",
|
|
67
|
+
[ModalStep.ADD_FUNDS_WITHDRAW]: "Withdraw",
|
|
68
|
+
[ModalStep.ADD_FUNDS_AWAITING]: "Add Funds",
|
|
69
|
+
[ModalStep.ADD_FUNDS_SUCCESS]: "Add Funds",
|
|
70
|
+
[ModalStep.ADD_FUNDS_FAILURE]: "Add Funds",
|
|
71
|
+
[ModalStep.ACCOUNT_MAIN]: "",
|
|
72
|
+
[ModalStep.CHAIN_SWITCH]: "",
|
|
73
|
+
[ModalStep.ACCOUNT_PROFILE]: isAccountLinkingEnabled ? "Profile" : "Settings",
|
|
74
|
+
[ModalStep.ACCOUNT_PROFILE_LIST]: "Link Account",
|
|
75
|
+
[ModalStep.ACCOUNT_PROFILE_ADD]: "Link Account",
|
|
76
|
+
[ModalStep.ACCOUNT_PROFILE_REMOVE]: "Unlink Account",
|
|
77
|
+
[ModalStep.EX_WALLET_SELECTED]: "Connect Wallet",
|
|
78
|
+
[ModalStep.EX_WALLET_NETWORK_SELECT]: "Select Network",
|
|
79
|
+
[ModalStep.ADD_EX_WALLET_NETWORK_SELECT]: "Select Network",
|
|
80
|
+
[ModalStep.LINK_EX_WALLET_NETWORK_SELECT]: "Select Network",
|
|
81
|
+
[ModalStep.ADD_EX_WALLET_SELECTED]: "Add Wallet",
|
|
82
|
+
[ModalStep.EXTERNAL_WALLET_VERIFICATION]: "Verify Wallet",
|
|
83
|
+
[ModalStep.AWAITING_ACCOUNT]: isLogin ? "Login" : "Sign Up",
|
|
84
|
+
[ModalStep.ACCOUNT_WALLET]: (_a2 = profileWallet == null ? void 0 : profileWallet.displayName) != null ? _a2 : "Wallet Settings",
|
|
85
|
+
[ModalStep.ACCOUNT_SEND]: "Send",
|
|
86
|
+
[ModalStep.ACCOUNT_SEND_ASSET]: "Send",
|
|
87
|
+
[ModalStep.ACCOUNT_SEND_NETWORK]: "Send"
|
|
88
|
+
};
|
|
89
|
+
},
|
|
75
90
|
[isLogin, chainId, hideWallets, authStepTitle]
|
|
76
91
|
);
|
|
77
92
|
const title = useMemo(() => {
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { CpslHero, CpslIcon, CpslIdenticon } from "@getpara/react-components";
|
|
5
|
-
import { safeStyled } from "@getpara/react-common";
|
|
5
|
+
import { safeStyled, NETWORK_NOT_SUPPORTED_ERROR } from "@getpara/react-common";
|
|
6
6
|
import { ModalStep } from "../../utils/steps.js";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
|
-
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
9
8
|
import { useEffect, useState } from "react";
|
|
10
9
|
import { isMobile } from "@getpara/web-sdk";
|
|
11
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
@@ -54,9 +53,12 @@ const Hero = () => {
|
|
|
54
53
|
externalWalletError
|
|
55
54
|
})[step];
|
|
56
55
|
const delay = newStepConfig && prevStepConfig ? 0 : newStepConfig && !prevStepConfig ? 0 : 200;
|
|
57
|
-
setTimeout(() => {
|
|
56
|
+
const timerId = setTimeout(() => {
|
|
58
57
|
setCurrentStep(step);
|
|
59
58
|
}, delay);
|
|
59
|
+
return () => {
|
|
60
|
+
clearTimeout(timerId);
|
|
61
|
+
};
|
|
60
62
|
}, [step]);
|
|
61
63
|
const isExternalStep = currentStep === ModalStep.EX_WALLET_SELECTED;
|
|
62
64
|
const isChainSwitchStep = currentStep === ModalStep.CHAIN_SWITCH;
|
|
@@ -5,17 +5,17 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { useModalStore } from "../../stores/index.js";
|
|
6
6
|
import { IFrameSteps } from "../../utils/steps.js";
|
|
7
7
|
import { safeStyled } from "@getpara/react-common";
|
|
8
|
-
import { SpinnerContainer } from "@getpara/react-common";
|
|
8
|
+
import { SpinnerContainer, MOBILE_SIZE } from "@getpara/react-common";
|
|
9
9
|
import { CpslSpinner } from "@getpara/react-components";
|
|
10
|
-
import { getPortalBaseURL } from "@getpara/web-sdk";
|
|
11
|
-
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
12
10
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
13
11
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
12
|
+
import { validatePortalOrigin } from "../../utils/validatePortalOrigin.js";
|
|
14
13
|
const IFrameStep = () => {
|
|
15
14
|
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
16
15
|
const setIsReady = useModalStore((state) => state.setIsIFrameReady);
|
|
17
16
|
const isReady = useModalStore((state) => state.isIFrameReady);
|
|
18
17
|
const currentStep = useModalStore((state) => state.step);
|
|
18
|
+
const refs = useModalStore((state) => state.refs);
|
|
19
19
|
const embeddedModal = useStore((state) => {
|
|
20
20
|
var _a;
|
|
21
21
|
return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
|
|
@@ -32,22 +32,23 @@ const IFrameStep = () => {
|
|
|
32
32
|
if (!iFrameUrl) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
if (!event.origin.startsWith(portalBase)) {
|
|
35
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
38
|
if (event.data) {
|
|
40
|
-
if (event.data.type === "HEIGHT") {
|
|
41
|
-
setHeight(event.data.height);
|
|
42
|
-
setIsReady(true);
|
|
39
|
+
if (event.data.type === "HEIGHT" && typeof event.data.height === "number") {
|
|
40
|
+
setHeight(Math.max(event.data.height, 200));
|
|
41
|
+
setIsReady(event.data.height > 0 ? true : false);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
window.addEventListener("message", handleMessage);
|
|
47
|
-
return () =>
|
|
45
|
+
typeof window !== "undefined" && window.addEventListener("message", handleMessage);
|
|
46
|
+
return () => {
|
|
47
|
+
typeof window !== "undefined" && window.removeEventListener("message", handleMessage);
|
|
48
|
+
};
|
|
48
49
|
}, [setIsReady, iFrameUrl]);
|
|
49
50
|
return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: !!embeddedModal, $isReady: !!isReady, children: [
|
|
50
|
-
/* @__PURE__ */ jsx(Container, { $isReady: !!isReady, $height: height, children: /* @__PURE__ */ jsx("iframe", { src: iFrameUrl }) }),
|
|
51
|
+
/* @__PURE__ */ jsx(Container, { $isReady: !!isReady, $height: height, children: /* @__PURE__ */ jsx("iframe", { src: iFrameUrl, ref: refs.iFrame }) }),
|
|
51
52
|
!isReady && /* @__PURE__ */ jsx(SpinnerContainer, { style: { width: "100%", height: "100%", flex: 1, position: "absolute" }, children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) })
|
|
52
53
|
] });
|
|
53
54
|
};
|
|
@@ -62,7 +63,7 @@ const OuterContainer = safeStyled.div`
|
|
|
62
63
|
justify-content: center;
|
|
63
64
|
|
|
64
65
|
@media (max-width: ${MOBILE_SIZE}px) {
|
|
65
|
-
padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "
|
|
66
|
+
padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "0px"};
|
|
66
67
|
}
|
|
67
68
|
`;
|
|
68
69
|
const Container = safeStyled.div`
|