@getpara/react-sdk 1.12.0 → 2.0.0-alpha.10
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 +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/modal/ParaModal.js +211 -313
- package/dist/modal/components/Account/Account.js +73 -16
- package/dist/modal/components/AddFunds/AddFunds.js +5 -6
- package/dist/modal/components/AddFunds/AddFundsAsset.js +15 -13
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +16 -10
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +2 -2
- package/dist/modal/components/AddFunds/AddFundsContext.js +20 -14
- package/dist/modal/components/AddFunds/AddFundsDone.js +10 -4
- package/dist/modal/components/AddFunds/AddFundsProvider.js +11 -7
- package/dist/modal/components/AddFunds/AddFundsReceive.js +17 -13
- package/dist/modal/components/AddFunds/AddFundsSettings.js +10 -6
- package/dist/modal/components/AddFunds/common.d.ts +1 -1
- package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
- package/dist/modal/components/AuthInput/AuthInput.js +70 -91
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +4 -4
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +20 -7
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +54 -10
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +35 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +9 -4
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -3
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +25 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +34 -72
- package/dist/modal/components/Body/Body.d.ts +4 -3
- package/dist/modal/components/Body/Body.js +27 -10
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +5 -4
- package/dist/modal/components/Controls/Controls.js +5 -2
- package/dist/modal/components/Controls/Selects.d.ts +1 -1
- package/dist/modal/components/Controls/Selects.js +30 -25
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +10 -6
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +7 -69
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +7 -6
- package/dist/modal/components/Footer/Footer.d.ts +1 -1
- package/dist/modal/components/Footer/Footer.js +6 -4
- package/dist/modal/components/Header/hooks/useStepTitle.js +7 -3
- package/dist/modal/components/Hero/Hero.js +5 -5
- package/dist/modal/components/IFrameStep/IFrameStep.js +8 -4
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +7 -4
- package/dist/modal/components/ModalContent/ModalContent.js +14 -243
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +3 -57
- package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
- package/dist/modal/components/OAuth/OAuth.js +11 -85
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +11 -60
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +10 -4
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +23 -32
- package/dist/modal/components/StripeComponents/StripeComponents.js +1 -1
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +5 -2
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +44 -60
- package/dist/modal/components/WalletCard/WalletCard.d.ts +5 -5
- package/dist/modal/components/WalletCard/WalletCard.js +8 -7
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +33 -12
- package/dist/modal/components/common.d.ts +5 -5
- package/dist/modal/components/common.js +10 -4
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/constants/oAuthLogos.d.ts +3 -3
- package/dist/modal/hooks/useGoBack.js +6 -5
- package/dist/modal/index.d.ts +0 -3
- package/dist/modal/index.js +1 -5
- package/dist/modal/stores/index.d.ts +0 -2
- package/dist/modal/stores/index.js +0 -2
- package/dist/modal/stores/modal/actions.js +69 -16
- package/dist/modal/stores/modal/useModalStore.d.ts +26 -22
- package/dist/modal/stores/modal/useModalStore.js +9 -13
- package/dist/modal/types/commonTypes.d.ts +0 -52
- package/dist/modal/types/modalProps.d.ts +8 -32
- package/dist/modal/utils/authInputHelpers.d.ts +7 -0
- package/dist/modal/utils/authInputHelpers.js +38 -0
- package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
- package/dist/modal/{components/AuthInput → utils}/countryCodes.js +6 -3
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.d.ts +2 -2
- package/dist/modal/utils/openPopup.js +2 -2
- package/dist/modal/utils/steps.d.ts +6 -0
- package/dist/modal/utils/steps.js +15 -0
- package/dist/provider/ParaProvider.d.ts +3 -1
- package/dist/provider/ParaProvider.js +69 -8
- package/dist/provider/actions/getAccount.d.ts +26 -8
- package/dist/provider/actions/getAccount.js +42 -14
- package/dist/provider/actions/getWallet.d.ts +3 -3
- package/dist/provider/actions/index.d.ts +27 -0
- package/dist/provider/actions/index.js +59 -0
- package/dist/provider/actions/utils.d.ts +3 -0
- package/dist/provider/actions/utils.js +15 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/CosmosWalletWrapper.js +34 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/EvmWalletWrapper.js +34 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/ExternalWalletWrapper.js +139 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/components/SolanaWalletWrapper.js +36 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaCosmosConnector.js +22 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.js +22 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.js +22 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
- package/dist/provider/hooks/mutations/index.d.ts +27 -11
- package/dist/provider/hooks/mutations/index.js +54 -17
- package/dist/provider/hooks/mutations/utils.d.ts +5 -0
- package/dist/provider/hooks/mutations/utils.js +59 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +1 -7
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +1 -2
- package/dist/provider/hooks/queries/useWalletBalance.js +40 -11
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +5 -5
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +100 -56
- package/dist/provider/hooks/utils/useWalletState.d.ts +5 -4
- package/dist/provider/hooks/utils/useWalletState.js +24 -9
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +1 -0
- package/dist/provider/providers/AuthProvider.d.ts +35 -0
- package/dist/provider/providers/AuthProvider.js +498 -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 +76 -0
- package/dist/{modal/providers/ExternalWalletContext.js → provider/providers/ExternalWalletProvider.js} +146 -112
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +3 -3
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.js +40 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/slices/index.js +1 -0
- package/dist/provider/stores/slices/modal.js +11 -4
- package/dist/provider/stores/types.d.ts +50 -4
- package/dist/provider/stores/useStore.js +4 -3
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +126 -17
- package/dist/provider/types/utils.d.ts +20 -0
- package/dist/provider/utils/constants.js +3 -4
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +3 -0
- package/dist/provider/utils/renameMutations.js +5 -3
- package/package.json +20 -8
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
- package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
- package/dist/modal/hooks/useActiveWallet.js +0 -15
- package/dist/modal/hooks/useCreateAccount.d.ts +0 -6
- package/dist/modal/hooks/useCreateAccount.js +0 -77
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
- package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
- package/dist/modal/hooks/useSetLoginURLs.js +0 -49
- package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
- package/dist/modal/hooks/useWalletBalance.js +0 -49
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
- package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
- package/dist/modal/stores/theme/actions.d.ts +0 -3
- package/dist/modal/stores/theme/actions.js +0 -28
- package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
- package/dist/modal/stores/theme/useThemeStore.js +0 -21
- package/dist/modal/stores/userInfo/actions.d.ts +0 -3
- package/dist/modal/stores/userInfo/actions.js +0 -30
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
- package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
- package/dist/provider/actions/checkIfUserExists.js +0 -21
- package/dist/provider/actions/createGuestWallets.d.ts +0 -2
- package/dist/provider/actions/createGuestWallets.js +0 -13
- package/dist/provider/actions/createUser.d.ts +0 -12
- package/dist/provider/actions/createUser.js +0 -26
- package/dist/provider/actions/getWalletBalance.d.ts +0 -2
- package/dist/provider/actions/getWalletBalance.js +0 -14
- package/dist/provider/actions/initiateLogin.d.ts +0 -4
- package/dist/provider/actions/initiateLogin.js +0 -20
- package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
- package/dist/provider/actions/keepSessionAlive.js +0 -20
- package/dist/provider/actions/logout.d.ts +0 -2
- package/dist/provider/actions/logout.js +0 -17
- package/dist/provider/actions/signMessage.d.ts +0 -8
- package/dist/provider/actions/signMessage.js +0 -20
- package/dist/provider/actions/signTransaction.d.ts +0 -8
- package/dist/provider/actions/signTransaction.js +0 -20
- package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
- package/dist/provider/actions/waitForAccountCreation.js +0 -21
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
- package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +0 -15
- package/dist/provider/hooks/mutations/useCreateGuestWallets.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
- package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
- package/dist/provider/hooks/mutations/useLogout.js +0 -30
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js
CHANGED
|
@@ -1,80 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
5
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
4
|
import { CpslButton, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
7
|
-
import { useEffect
|
|
5
|
+
import { useEffect } from "react";
|
|
8
6
|
import { styled } from "styled-components";
|
|
9
|
-
import {
|
|
10
|
-
import { useModalStore, useThemeStore, useUserInfoStore } from "../../stores/index.js";
|
|
7
|
+
import { useModalStore } from "../../stores/index.js";
|
|
11
8
|
import { ErrorContainer, ErrorIcon, Heading, InnerStepContainer, StepContainer } from "../common.js";
|
|
12
|
-
import {
|
|
13
|
-
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
14
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
9
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
15
10
|
const ExternalWalletVerificationStep = () => {
|
|
16
|
-
const
|
|
17
|
-
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
18
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
19
|
-
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
20
|
-
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
21
|
-
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
22
|
-
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
11
|
+
const { isExternalWalletVerifying, verifyWalletSignature } = useExternalWallets();
|
|
23
12
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
24
|
-
const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
|
|
25
|
-
const para = useInternalClient();
|
|
26
|
-
const { verifyWalletSignature } = useExternalWallets();
|
|
27
|
-
const [shouldRouteToStep, setShouldRouteToStep] = useState();
|
|
28
|
-
const [isVerifying, setIsVerifying] = useState(false);
|
|
29
13
|
useEffect(() => {
|
|
30
|
-
|
|
14
|
+
verifyWalletSignature();
|
|
31
15
|
}, []);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!!shouldRouteToStep && isIFrameReady) {
|
|
34
|
-
setTimeout(() => {
|
|
35
|
-
setStep(shouldRouteToStep);
|
|
36
|
-
setIsVerifying(false);
|
|
37
|
-
}, 200);
|
|
38
|
-
}
|
|
39
|
-
}, [shouldRouteToStep, isIFrameReady]);
|
|
40
|
-
const handleVerifyWallet = () => __async(void 0, null, function* () {
|
|
41
|
-
setIsVerifying(true);
|
|
42
|
-
try {
|
|
43
|
-
setIsIFrameReady(false);
|
|
44
|
-
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
45
|
-
const walletSignature = yield verifyWalletSignature();
|
|
46
|
-
if (!walletSignature.signature || !walletSignature.address) {
|
|
47
|
-
console.error("No signature or address found on the verifyWalletSignature response.");
|
|
48
|
-
setIsVerifying(false);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const url = yield para.verifyExternalWallet({
|
|
52
|
-
address: walletSignature.address,
|
|
53
|
-
signedMessage: walletSignature.signature,
|
|
54
|
-
cosmosPublicKeyHex: walletSignature.cosmosPublicKeyHex,
|
|
55
|
-
cosmosSigner: walletSignature.cosmosSigner
|
|
56
|
-
});
|
|
57
|
-
if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
|
|
58
|
-
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
59
|
-
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
60
|
-
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
61
|
-
setShouldRouteToStep(ModalStep.BIOMETRIC_CREATION);
|
|
62
|
-
return;
|
|
63
|
-
} else if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD)) {
|
|
64
|
-
const url2 = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
65
|
-
setIFrameUrl(yield para.shortenLoginLink(url2));
|
|
66
|
-
setShouldRouteToStep(ModalStep.PASSWORD_CREATION);
|
|
67
|
-
return;
|
|
68
|
-
} else {
|
|
69
|
-
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
70
|
-
setStep(ModalStep.BIOMETRIC_CREATION);
|
|
71
|
-
}
|
|
72
|
-
} catch (e) {
|
|
73
|
-
console.error("Error verifying signature:", e);
|
|
74
|
-
setExternalWalletError(["Signature verification failed."]);
|
|
75
|
-
setIsVerifying(false);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
16
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
79
17
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
80
18
|
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Verify Your Wallet" }),
|
|
@@ -84,7 +22,7 @@ const ExternalWalletVerificationStep = () => {
|
|
|
84
22
|
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
|
|
85
23
|
] })
|
|
86
24
|
] }),
|
|
87
|
-
/* @__PURE__ */ jsx(InnerStepContainer, { children:
|
|
25
|
+
/* @__PURE__ */ jsx(InnerStepContainer, { children: isExternalWalletVerifying ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(CpslButton, { onClick: verifyWalletSignature, children: "Retry" }) })
|
|
88
26
|
] });
|
|
89
27
|
};
|
|
90
28
|
const InlineText = styled(CpslText)`
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
} from "../../../chunk-MMUBH76A.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
8
7
|
import { StyledCpslTileButton } from "../common.js";
|
|
9
8
|
import { CpslButton, CpslIcon, CpslInput, CpslText } from "@getpara/react-components";
|
|
10
|
-
import { useModalStore
|
|
9
|
+
import { useModalStore } from "../../stores/index.js";
|
|
11
10
|
import { ModalStep } from "../../utils/steps.js";
|
|
12
11
|
import { useState } from "react";
|
|
13
12
|
import { hasEmbeddedAuth } from "../../utils/authLayoutHelpers.js";
|
|
13
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
14
14
|
const HAS_MORE_LENGTH = 3;
|
|
15
15
|
const ExternalWallets = () => {
|
|
16
16
|
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
17
17
|
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
18
18
|
const setStep = useModalStore((state) => state.setStep);
|
|
19
19
|
const showAll = useModalStore((state) => state.step === ModalStep.EX_WALLET_MORE);
|
|
20
|
-
const authLayout =
|
|
20
|
+
const authLayout = useModalStore((state) => state.authLayout);
|
|
21
21
|
const [search, setSearch] = useState("");
|
|
22
22
|
const hasMore = wallets.length > HAS_MORE_LENGTH;
|
|
23
23
|
const walletsToShow = showAll || !hasMore ? search ? wallets.filter((w) => w.name.toLowerCase().includes(search.toLowerCase())) : wallets : wallets.slice(0, HAS_MORE_LENGTH);
|
|
@@ -44,14 +44,15 @@ const ExternalWallets = () => {
|
|
|
44
44
|
{
|
|
45
45
|
placeholder: "Search for your wallet",
|
|
46
46
|
onCpslInput: (e) => __async(void 0, null, function* () {
|
|
47
|
-
|
|
47
|
+
var _a;
|
|
48
|
+
setSearch((_a = e.target.value) != null ? _a : "");
|
|
48
49
|
}),
|
|
49
50
|
value: search,
|
|
50
51
|
style: { width: "100%" },
|
|
51
52
|
children: /* @__PURE__ */ jsx(SearchIcon, { slot: "start", icon: "search" })
|
|
52
53
|
}
|
|
53
54
|
) }),
|
|
54
|
-
hasEmbeddedAuth(authLayout) && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: /* @__PURE__ */ jsxs(WalletButtonOuterContainer, { children: [
|
|
55
|
+
hasEmbeddedAuth(authLayout != null ? authLayout : []) && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: /* @__PURE__ */ jsxs(WalletButtonOuterContainer, { children: [
|
|
55
56
|
/* @__PURE__ */ jsxs(WalletButtonInnerContainer, { children: [
|
|
56
57
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "paraIcon" }),
|
|
57
58
|
/* @__PURE__ */ jsx(CpslText, { weight: "medium", children: "Para" })
|
|
@@ -65,7 +66,7 @@ const ExternalWallets = () => {
|
|
|
65
66
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", src: wallet.iconUrl }),
|
|
66
67
|
/* @__PURE__ */ jsx(CpslText, { weight: "medium", children: wallet.name })
|
|
67
68
|
] }),
|
|
68
|
-
/* @__PURE__ */ jsx(Badge, { $show: wallet.isMobile || wallet.installed, $variant: wallet.installed ? "installed" : "mobile", children: /* @__PURE__ */ jsx(CpslText, { variant: "body2XS", weight: "medium", children: wallet.installed ? "Installed" : "Mobile" }) })
|
|
69
|
+
/* @__PURE__ */ jsx(Badge, { $show: !!wallet.isMobile || !!wallet.installed, $variant: wallet.installed ? "installed" : "mobile", children: /* @__PURE__ */ jsx(CpslText, { variant: "body2XS", weight: "medium", children: wallet.installed ? "Installed" : "Mobile" }) })
|
|
69
70
|
] }) }, wallet.id) : /* @__PURE__ */ jsx(WalletTileButton, { src: wallet.iconUrl, onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs(TileButtonInnerContainer, { children: [
|
|
70
71
|
wallet.installed && /* @__PURE__ */ jsx(InstalledIndicator, {}),
|
|
71
72
|
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: wallet.name })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Footer: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const Footer: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -7,12 +7,14 @@ import { useModalStore } from "../../stores/index.js";
|
|
|
7
7
|
import { PARA_CONNECT, PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
|
|
8
8
|
import { useMemo } from "react";
|
|
9
9
|
import { getStepHasFooter } from "../../utils/steps.js";
|
|
10
|
+
import { useAccount } from "../../../provider/index.js";
|
|
10
11
|
const Footer = () => {
|
|
11
|
-
const
|
|
12
|
+
const { data: account } = useAccount();
|
|
12
13
|
const currentStep = useModalStore((state) => state.step);
|
|
13
|
-
const
|
|
14
|
+
const accountFooter = (account == null ? void 0 : account.isConnected) && !account.isGuestMode;
|
|
15
|
+
const showFooter = accountFooter || getStepHasFooter(currentStep);
|
|
14
16
|
const Content = useMemo(() => {
|
|
15
|
-
if (
|
|
17
|
+
if (accountFooter) {
|
|
16
18
|
return /* @__PURE__ */ jsxs(ConnectContainer, { children: [
|
|
17
19
|
/* @__PURE__ */ jsxs(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
18
20
|
"Access all your wallet\u2019s features at",
|
|
@@ -33,7 +35,7 @@ const Footer = () => {
|
|
|
33
35
|
/* @__PURE__ */ jsx(ParaLogo, { icon: "para" })
|
|
34
36
|
] })
|
|
35
37
|
] });
|
|
36
|
-
}, [
|
|
38
|
+
}, [account]);
|
|
37
39
|
if (!showFooter) {
|
|
38
40
|
return null;
|
|
39
41
|
}
|
|
@@ -3,10 +3,13 @@ import "../../../../chunk-MMUBH76A.js";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useModalStore } from "../../../stores/modal/useModalStore.js";
|
|
5
5
|
import { ModalStep } from "../../../utils/steps.js";
|
|
6
|
-
import { useExternalWallets } from "
|
|
7
|
-
import {
|
|
6
|
+
import { useExternalWallets } from "../../../../provider/providers/ExternalWalletProvider.js";
|
|
7
|
+
import { useStore } from "../../../../provider/stores/useStore.js";
|
|
8
8
|
const useStepTitle = () => {
|
|
9
|
-
const hideWallets =
|
|
9
|
+
const hideWallets = useStore((state) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
12
|
+
});
|
|
10
13
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
11
14
|
const currentStep = useModalStore((state) => state.step);
|
|
12
15
|
const { chainId } = useExternalWallets();
|
|
@@ -14,6 +17,7 @@ const useStepTitle = () => {
|
|
|
14
17
|
() => ({
|
|
15
18
|
[ModalStep.AUTH_MAIN]: "",
|
|
16
19
|
[ModalStep.AUTH_MORE]: "Sign Up or Log In",
|
|
20
|
+
[ModalStep.AUTH_GUEST_SIGNUP]: "Complete Account Setup",
|
|
17
21
|
[ModalStep.EX_WALLET_MORE]: "Connect Wallet",
|
|
18
22
|
[ModalStep.VERIFICATIONS]: "Sign Up",
|
|
19
23
|
[ModalStep.AWAITING_OAUTH]: isLogin ? "Login" : "Sign Up",
|
|
@@ -5,12 +5,12 @@ import { CpslHero, CpslIcon, CpslIdenticon } from "@getpara/react-components";
|
|
|
5
5
|
import styled from "styled-components";
|
|
6
6
|
import { ModalStep } from "../../utils/steps.js";
|
|
7
7
|
import { useModalStore } from "../../stores/index.js";
|
|
8
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
9
8
|
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
10
9
|
import { useEffect, useState } from "react";
|
|
11
10
|
import { isMobile } from "@getpara/web-sdk";
|
|
12
|
-
import { useActiveWallet } from "../../hooks/useActiveWallet.js";
|
|
13
11
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
12
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
13
|
+
import { useWallet } from "../../../provider/index.js";
|
|
14
14
|
const getStepConfig = ({
|
|
15
15
|
externalWalletError
|
|
16
16
|
}) => {
|
|
@@ -41,7 +41,7 @@ const Hero = () => {
|
|
|
41
41
|
const { wallet: connector, walletDisplayHelpers, avatar } = useExternalWallets();
|
|
42
42
|
const step = useModalStore((state) => state.step);
|
|
43
43
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
44
|
-
const activeWallet =
|
|
44
|
+
const { data: activeWallet } = useWallet();
|
|
45
45
|
const [currentStep, setCurrentStep] = useState(step);
|
|
46
46
|
const stepConfig = getStepConfig({
|
|
47
47
|
externalWalletError
|
|
@@ -66,12 +66,12 @@ const Hero = () => {
|
|
|
66
66
|
const shouldHide = !stepConfig || !isMobile() && isExternalStep && !showExtension || !isMobile() && isChainSwitchStep && isCosmosMobileWallet || !isMobile() && isFarcasterStep;
|
|
67
67
|
const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig != null ? stepConfig : {};
|
|
68
68
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
-
/* @__PURE__ */ jsx(Container, { $top: -45 + topOffset, children: shouldHide ? null : /* @__PURE__ */ jsxs(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Container, { $top: -45 + (topOffset != null ? topOffset : 0), children: shouldHide ? null : /* @__PURE__ */ jsxs(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
|
|
70
70
|
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", src: connector == null ? void 0 : connector.iconUrl }),
|
|
71
71
|
isFarcasterStep && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }),
|
|
72
72
|
isAccountStep && (avatar ? /* @__PURE__ */ jsx(Avatar, { slot: "image", src: avatar }) : activeWallet ? /* @__PURE__ */ jsx(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }) : null)
|
|
73
73
|
] }) }),
|
|
74
|
-
!shouldHide && /* @__PURE__ */ jsx(Spacer, { $height: spacerHeight })
|
|
74
|
+
!shouldHide && /* @__PURE__ */ jsx(Spacer, { $height: spacerHeight != null ? spacerHeight : 0 })
|
|
75
75
|
] });
|
|
76
76
|
};
|
|
77
77
|
const Container = styled.div`
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useModalStore
|
|
4
|
+
import { useModalStore } from "../../stores/index.js";
|
|
5
5
|
import { IFrameSteps } from "../../utils/steps.js";
|
|
6
6
|
import styled from "styled-components";
|
|
7
7
|
import { SpinnerContainer } from "@getpara/react-common";
|
|
8
8
|
import { CpslSpinner } from "@getpara/react-components";
|
|
9
9
|
import { MOBILE_SIZE } from "../../constants/constants.js";
|
|
10
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
10
11
|
const IFrameStep = () => {
|
|
11
12
|
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
12
13
|
const setIsReady = useModalStore((state) => state.setIsIFrameReady);
|
|
13
14
|
const isReady = useModalStore((state) => state.isIFrameReady);
|
|
14
15
|
const currentStep = useModalStore((state) => state.step);
|
|
15
|
-
const embeddedModal =
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const embeddedModal = useStore((state) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: !!embeddedModal, children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Container, { $isReady: !!isReady, children: /* @__PURE__ */ jsx(
|
|
18
22
|
"iframe",
|
|
19
23
|
{
|
|
20
24
|
src: iFrameUrl,
|
|
@@ -4,12 +4,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
import { Heading, HeroIcon, StepContainer } from "../common.js";
|
|
6
6
|
import { ExternalWalletCard, WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
|
|
7
|
-
import { useThemeStore } from "../../stores/index.js";
|
|
8
7
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
8
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
9
9
|
const LoginDoneStep = ({ onClose }) => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
const para = useInternalClient();
|
|
12
|
-
const hideWallets =
|
|
12
|
+
const hideWallets = useStore((state) => {
|
|
13
|
+
var _a2;
|
|
14
|
+
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
15
|
+
});
|
|
13
16
|
useEffect(() => {
|
|
14
17
|
setTimeout(() => {
|
|
15
18
|
onClose();
|
|
@@ -18,7 +21,7 @@ const LoginDoneStep = ({ onClose }) => {
|
|
|
18
21
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
19
22
|
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
20
23
|
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
|
|
21
|
-
!hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.
|
|
24
|
+
!hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.externalWalletConnectionType === "CONNECTION_ONLY" ? /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_b = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address) != null ? _b : "" }) : para.currentWalletIdsArray.map(([id, type]) => {
|
|
22
25
|
return /* @__PURE__ */ jsx(WalletCard, { id, type }, `${id}-${type}`);
|
|
23
26
|
}) })
|
|
24
27
|
] });
|
|
@@ -5,96 +5,31 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "../../../chunk-MMUBH76A.js";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { forwardRef, useEffect, useImperativeHandle
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
OnRampProvider,
|
|
12
|
-
OnRampAsset,
|
|
13
|
-
Network,
|
|
14
|
-
EnabledFlow
|
|
15
|
-
} from "@getpara/web-sdk";
|
|
16
|
-
import { useModalStore, useUserInfoStore } from "../../stores/index.js";
|
|
8
|
+
import { forwardRef, useEffect, useImperativeHandle } from "react";
|
|
9
|
+
import { EnabledFlow } from "@getpara/web-sdk";
|
|
10
|
+
import { useModalStore } from "../../stores/index.js";
|
|
17
11
|
import { ModalStep } from "../../utils/steps.js";
|
|
18
12
|
import { Body } from "../Body/Body.js";
|
|
19
13
|
import { Footer } from "../Footer/Footer.js";
|
|
20
|
-
import { DEFAULTS } from "../../constants/defaults.js";
|
|
21
|
-
import { useGoBack } from "../../hooks/useGoBack.js";
|
|
22
14
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
23
|
-
import {
|
|
24
|
-
import { useCreateAccount } from "../../hooks/useCreateAccount.js";
|
|
25
|
-
import { formatBiometricHints } from "@getpara/react-common";
|
|
26
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
27
|
-
function isRampConfig(config) {
|
|
28
|
-
return "hostApiKey" in config;
|
|
29
|
-
}
|
|
30
|
-
const AssetNetworks = {
|
|
31
|
-
[OnRampAsset.SOLANA]: Network.SOLANA,
|
|
32
|
-
[OnRampAsset.ATOM]: Network.COSMOS,
|
|
33
|
-
[OnRampAsset.CELO]: Network.CELO,
|
|
34
|
-
[OnRampAsset.POLYGON]: Network.POLYGON
|
|
35
|
-
};
|
|
36
|
-
const AssetMap = {
|
|
37
|
-
SOLANA: OnRampAsset.SOLANA,
|
|
38
|
-
SOL: OnRampAsset.SOLANA,
|
|
39
|
-
ATOM: OnRampAsset.ATOM,
|
|
40
|
-
CELO: OnRampAsset.CELO,
|
|
41
|
-
POLYGON: OnRampAsset.POLYGON,
|
|
42
|
-
MATIC: OnRampAsset.POLYGON,
|
|
43
|
-
USDC: OnRampAsset.USDC,
|
|
44
|
-
ETH: OnRampAsset.ETHEREUM,
|
|
45
|
-
ETHEREUM: OnRampAsset.ETHEREUM
|
|
46
|
-
};
|
|
15
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
47
16
|
const ModalContent = forwardRef(
|
|
48
17
|
({
|
|
49
|
-
onRampConfig: propsOnRampConfig,
|
|
50
18
|
twoFactorAuthEnabled = false,
|
|
51
|
-
recoverySecretStepEnabled = false,
|
|
52
19
|
oAuthMethods,
|
|
53
20
|
disableEmailLogin,
|
|
54
21
|
disablePhoneLogin,
|
|
22
|
+
isGuestModeEnabled = false,
|
|
55
23
|
onClose,
|
|
56
|
-
onRampTestMode
|
|
57
|
-
loginTransitionOverride,
|
|
58
|
-
createWalletOverride
|
|
24
|
+
onRampTestMode
|
|
59
25
|
}, ref) => {
|
|
60
|
-
var _a;
|
|
61
26
|
const para = useInternalClient();
|
|
62
27
|
const refs = useModalStore((state) => state.refs);
|
|
63
|
-
const currentStep = useModalStore((state) => state.step);
|
|
64
|
-
const webAuthURLForLogin = useModalStore((state) => state.webAuthURLForLogin);
|
|
65
|
-
const passwordUrlForLogin = useModalStore((state) => state.passwordUrlForLogin);
|
|
66
|
-
const isLogin = useModalStore((state) => state.isLogin());
|
|
67
28
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
68
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
69
|
-
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
70
|
-
const setWebAuthURLForLogin = useModalStore((state) => state.setWebAuthURLForLogin);
|
|
71
|
-
const setPasswordUrlForLogin = useModalStore((state) => state.setPasswordUrlForLogin);
|
|
72
|
-
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
73
29
|
const setOnRampConfig = useModalStore((state) => state.setOnRampConfig);
|
|
74
30
|
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
75
31
|
const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
|
|
76
|
-
const setRecoveryShare = useUserInfoStore((state) => state.setRecoveryShare);
|
|
77
|
-
const authStepRoute = useModalStore((state) => state.authStepRoute);
|
|
78
|
-
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
79
|
-
const goBack = useGoBack();
|
|
80
|
-
const createAccount = useCreateAccount({ twoFactorAuthEnabled });
|
|
81
|
-
const biometricLocationHints = useModalStore((state) => {
|
|
82
|
-
var _a2;
|
|
83
|
-
return (_a2 = state.biometricLocationHints) != null ? _a2 : [];
|
|
84
|
-
});
|
|
85
|
-
const formattedHints = useMemo(() => formatBiometricHints(biometricLocationHints), [biometricLocationHints]);
|
|
86
|
-
const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
|
|
87
|
-
const [hasHints, isOnKnownDevice] = [(biometricLocationHints == null ? void 0 : biometricLocationHints.length) > 0, (_a = formattedHints == null ? void 0 : formattedHints.isOnKnownDevice) != null ? _a : false];
|
|
88
32
|
const { disconnectExternalWallet } = useExternalWallets();
|
|
89
|
-
const [walletCreationInProgress, setWalletCreationInProgress] = useState(false);
|
|
90
|
-
const connectEmbeddedToExternalConnectors = useEmbeddedExternalConnection();
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (!!authStepRoute && isIFrameReady) {
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
setStep(authStepRoute);
|
|
95
|
-
}, 200);
|
|
96
|
-
}
|
|
97
|
-
}, [authStepRoute, isIFrameReady]);
|
|
98
33
|
useImperativeHandle(ref, () => {
|
|
99
34
|
return {
|
|
100
35
|
handleModalClose() {
|
|
@@ -102,181 +37,17 @@ const ModalContent = forwardRef(
|
|
|
102
37
|
}
|
|
103
38
|
};
|
|
104
39
|
}, []);
|
|
105
|
-
const is2FASetup = () => __async(void 0, null, function* () {
|
|
106
|
-
if (!twoFactorAuthEnabled) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
const { isSetup } = yield para.check2FAStatus();
|
|
111
|
-
return isSetup;
|
|
112
|
-
} catch (error) {
|
|
113
|
-
console.error("An error occurred while checking 2FA:", error);
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
function awaitLoginTransition() {
|
|
118
|
-
return __async(this, null, function* () {
|
|
119
|
-
const { isComplete, isError, needsWallet } = yield para.waitForLoginAndSetup({
|
|
120
|
-
popupWindow: refs.popupWindow.current
|
|
121
|
-
});
|
|
122
|
-
if (isError) {
|
|
123
|
-
[ModalStep.AWAITING_BIOMETRIC_LOGIN, ModalStep.AWAITING_PASSWORD_LOGIN].includes(refs.currentStep.current) && goBack();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (isComplete) {
|
|
127
|
-
setWebAuthURLForLogin("");
|
|
128
|
-
setPasswordUrlForLogin("");
|
|
129
|
-
setSupportedAuthMethods(/* @__PURE__ */ new Set());
|
|
130
|
-
setBiometricLocationHints();
|
|
131
|
-
if (needsWallet && !para.isNoWalletConfig) {
|
|
132
|
-
setStep(ModalStep.AWAITING_WALLET_CREATION);
|
|
133
|
-
} else {
|
|
134
|
-
yield connectEmbeddedToExternalConnectors();
|
|
135
|
-
if (yield is2FASetup()) {
|
|
136
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
137
|
-
} else {
|
|
138
|
-
setStep(ModalStep.SETUP_2FA);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
if (currentStep !== ModalStep.AWAITING_WALLET_CREATION || walletCreationInProgress) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
function genWallet() {
|
|
149
|
-
return __async(this, null, function* () {
|
|
150
|
-
setWalletCreationInProgress(true);
|
|
151
|
-
let recoverySecret, walletIds;
|
|
152
|
-
if (!createWalletOverride) {
|
|
153
|
-
const created = yield para.waitForPasskeyAndCreateWallet();
|
|
154
|
-
recoverySecret = created.recoverySecret;
|
|
155
|
-
walletIds = created.walletIds;
|
|
156
|
-
} else {
|
|
157
|
-
const created = yield createWalletOverride(para);
|
|
158
|
-
const fetchedWallets = (yield para.fetchWallets()).filter((wallet) => !!wallet.address);
|
|
159
|
-
const newWallets = {};
|
|
160
|
-
for (const wallet of fetchedWallets) {
|
|
161
|
-
newWallets[wallet.id] = __spreadProps(__spreadValues({}, entityToWallet(wallet)), {
|
|
162
|
-
signer: ""
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
para.setWallets(newWallets);
|
|
166
|
-
recoverySecret = created.recoverySecret;
|
|
167
|
-
walletIds = created.walletIds;
|
|
168
|
-
}
|
|
169
|
-
yield para.setCurrentWalletIds(walletIds);
|
|
170
|
-
yield connectEmbeddedToExternalConnectors();
|
|
171
|
-
if (recoverySecretStepEnabled) {
|
|
172
|
-
setRecoveryShare(recoverySecret);
|
|
173
|
-
}
|
|
174
|
-
setWalletCreationInProgress(false);
|
|
175
|
-
if (!recoverySecret || !recoverySecretStepEnabled) {
|
|
176
|
-
setStep(ModalStep.WALLET_CREATION_DONE);
|
|
177
|
-
} else {
|
|
178
|
-
setStep(ModalStep.SECRET);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
genWallet();
|
|
183
|
-
}, [isLogin, currentStep]);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
const isAwaitingLogin = [
|
|
186
|
-
ModalStep.AWAITING_PASSWORD_LOGIN,
|
|
187
|
-
ModalStep.AWAITING_BIOMETRIC_LOGIN,
|
|
188
|
-
ModalStep.BIOMETRIC_LOGIN
|
|
189
|
-
].includes(currentStep);
|
|
190
|
-
const isUnknownDeviceWithHints = hasHints && !isOnKnownDevice;
|
|
191
|
-
const isPasskeyUnsupported = !passkeysSupported;
|
|
192
|
-
const hasLoginURLs = !!webAuthURLForLogin || !!passwordUrlForLogin;
|
|
193
|
-
const userNeedsToLogin = isAwaitingLogin || isUnknownDeviceWithHints || isPasskeyUnsupported;
|
|
194
|
-
if (userNeedsToLogin && hasLoginURLs) {
|
|
195
|
-
if (loginTransitionOverride) {
|
|
196
|
-
function loginOverride() {
|
|
197
|
-
return __async(this, null, function* () {
|
|
198
|
-
yield loginTransitionOverride(para);
|
|
199
|
-
setWebAuthURLForLogin("");
|
|
200
|
-
setPasswordUrlForLogin("");
|
|
201
|
-
setBiometricLocationHints();
|
|
202
|
-
yield connectEmbeddedToExternalConnectors();
|
|
203
|
-
if (yield is2FASetup()) {
|
|
204
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
205
|
-
} else {
|
|
206
|
-
setStep(ModalStep.SETUP_2FA);
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
loginOverride();
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
if (typeof window !== "undefined") {
|
|
214
|
-
refs.poll.current = {
|
|
215
|
-
action: "login",
|
|
216
|
-
timeout: window.setTimeout(awaitLoginTransition, DEFAULTS.LOGGIN_POLLING_DELAY_MS)
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return () => {
|
|
220
|
-
var _a2;
|
|
221
|
-
if (typeof window !== "undefined" && !!refs.poll.current) {
|
|
222
|
-
window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
|
|
223
|
-
}
|
|
224
|
-
para.exitLogin();
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
}, [currentStep, webAuthURLForLogin, passwordUrlForLogin]);
|
|
228
40
|
const handleClose = () => {
|
|
229
|
-
onClose();
|
|
230
|
-
if (currentStep === ModalStep.EXTERNAL_WALLET_VERIFICATION && para.isExternalWalletAuth) {
|
|
41
|
+
onClose == null ? void 0 : onClose();
|
|
42
|
+
if (refs.currentStep.current === ModalStep.EXTERNAL_WALLET_VERIFICATION && para.isExternalWalletAuth) {
|
|
231
43
|
disconnectExternalWallet();
|
|
232
44
|
}
|
|
233
45
|
};
|
|
234
|
-
useEffect(() => {
|
|
235
|
-
var _a2, _b, _c;
|
|
236
|
-
refs.currentStep.current = currentStep;
|
|
237
|
-
let resetPoll = false;
|
|
238
|
-
if (![ModalStep.AWAITING_BIOMETRIC_CREATION, ModalStep.PASSWORD_CREATION].includes(currentStep)) {
|
|
239
|
-
para.exitAccountCreation();
|
|
240
|
-
resetPoll = ["createPassword", "createPasskey"].includes((_a2 = refs.poll.current) == null ? void 0 : _a2.action);
|
|
241
|
-
}
|
|
242
|
-
if (![ModalStep.AWAITING_PASSWORD_LOGIN, ModalStep.AWAITING_BIOMETRIC_LOGIN, ModalStep.BIOMETRIC_LOGIN].includes(
|
|
243
|
-
currentStep
|
|
244
|
-
)) {
|
|
245
|
-
para.exitLogin();
|
|
246
|
-
resetPoll = ((_b = refs.poll.current) == null ? void 0 : _b.action) === "login";
|
|
247
|
-
}
|
|
248
|
-
if (![ModalStep.AWAITING_OAUTH, ModalStep.FARCASTER_OAUTH].includes(currentStep)) {
|
|
249
|
-
para.exitOAuth();
|
|
250
|
-
}
|
|
251
|
-
if (currentStep === ModalStep.PASSWORD_CREATION) {
|
|
252
|
-
createAccount.withPassword();
|
|
253
|
-
}
|
|
254
|
-
if (resetPoll && typeof window !== "undefined") {
|
|
255
|
-
window.clearTimeout((_c = refs.poll.current) == null ? void 0 : _c.timeout);
|
|
256
|
-
refs.poll.current = void 0;
|
|
257
|
-
}
|
|
258
|
-
}, [currentStep]);
|
|
259
46
|
useEffect(() => {
|
|
260
47
|
if (!onRampConfig) {
|
|
261
48
|
para.ctx.client.getOnRampConfig().then((res) => {
|
|
262
|
-
var _a2, _b;
|
|
263
49
|
let newOnRampConfig;
|
|
264
|
-
|
|
265
|
-
const { enabledFlows, network, asset, providers, testMode } = propsOnRampConfig;
|
|
266
|
-
const rampConfig = providers.find((config) => isRampConfig(config));
|
|
267
|
-
newOnRampConfig = {
|
|
268
|
-
isBuyEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow[str] === EnabledFlow.BUY),
|
|
269
|
-
isReceiveEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow[str] === EnabledFlow.RECEIVE),
|
|
270
|
-
isWithdrawEnabled: !enabledFlows || enabledFlows.some((str) => EnabledFlow[str] === EnabledFlow.WITHDRAW),
|
|
271
|
-
allowedAssets: network ? { [Network[network]]: asset ? [AssetMap[asset]] : true } : asset ? { [(_a2 = AssetNetworks[AssetMap[asset]]) != null ? _a2 : Network.ETHEREUM]: [AssetMap[asset]] } : res.allowedAssets,
|
|
272
|
-
assetInfo: res.assetInfo,
|
|
273
|
-
providers: providers.map(({ id }) => OnRampProvider[id]),
|
|
274
|
-
rampApiKey: (_b = rampConfig == null ? void 0 : rampConfig.hostApiKey) != null ? _b : res.rampApiKey,
|
|
275
|
-
testMode: testMode != null ? testMode : onRampTestMode
|
|
276
|
-
};
|
|
277
|
-
} else {
|
|
278
|
-
newOnRampConfig = __spreadProps(__spreadValues({}, res), { testMode: onRampTestMode });
|
|
279
|
-
}
|
|
50
|
+
newOnRampConfig = __spreadProps(__spreadValues({}, res), { testMode: onRampTestMode });
|
|
280
51
|
setOnRampConfig(newOnRampConfig);
|
|
281
52
|
if (!accountAddFundTab) {
|
|
282
53
|
setAccountAddFundTab(
|
|
@@ -299,9 +70,8 @@ const ModalContent = forwardRef(
|
|
|
299
70
|
});
|
|
300
71
|
init();
|
|
301
72
|
return () => {
|
|
302
|
-
var
|
|
303
|
-
window.clearTimeout((
|
|
304
|
-
para.exitLoops();
|
|
73
|
+
var _a;
|
|
74
|
+
window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
|
|
305
75
|
};
|
|
306
76
|
}, []);
|
|
307
77
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -310,8 +80,9 @@ const ModalContent = forwardRef(
|
|
|
310
80
|
{
|
|
311
81
|
oAuthMethods,
|
|
312
82
|
twoFactorAuthEnabled,
|
|
313
|
-
disableEmailLogin,
|
|
314
|
-
disablePhoneLogin,
|
|
83
|
+
disableEmailLogin: !!disableEmailLogin,
|
|
84
|
+
disablePhoneLogin: !!disablePhoneLogin,
|
|
85
|
+
isGuestModeEnabled,
|
|
315
86
|
onClose: handleClose
|
|
316
87
|
}
|
|
317
88
|
),
|