@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
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
5
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
4
|
import { CpslButton, CpslDivider, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
7
|
-
import { useModalStore
|
|
5
|
+
import { useModalStore } from "../../stores/index.js";
|
|
8
6
|
import { InnerStepContainer, StepContainer, Heading, QRContainer } from "../common.js";
|
|
9
7
|
import { useCopyToClipboard, UserIdentifier } from "@getpara/react-common";
|
|
10
|
-
import { useCreateAccount } from "../../hooks/useCreateAccount.js";
|
|
11
8
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
|
|
10
|
+
import { AuthMethod } from "@getpara/web-sdk";
|
|
11
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
12
|
+
const BiometricCreationStep = () => {
|
|
14
13
|
const para = useInternalClient();
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
14
|
+
const authInfo = para.authInfo;
|
|
15
|
+
const appName = useStore((state) => state.appName);
|
|
16
|
+
const { presentSignupUi } = useAuthActions();
|
|
17
|
+
const signupState = useModalStore((state) => state.getSignupState());
|
|
18
|
+
const authStepRoute = useModalStore((state) => state.authStepRoute);
|
|
18
19
|
const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
|
|
19
|
-
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
20
20
|
const [isCopied, copy] = useCopyToClipboard();
|
|
21
21
|
const handleCopy = () => {
|
|
22
|
-
|
|
22
|
+
if (signupState == null ? void 0 : signupState.passkeyUrl) {
|
|
23
|
+
copy(signupState.passkeyUrl);
|
|
24
|
+
}
|
|
23
25
|
};
|
|
24
|
-
const
|
|
26
|
+
const onClick = (method) => () => {
|
|
27
|
+
presentSignupUi(method, signupState);
|
|
28
|
+
};
|
|
29
|
+
const isBoth = !!(signupState == null ? void 0 : signupState.passkeyUrl) && !!(signupState == null ? void 0 : signupState.passwordUrl);
|
|
30
|
+
if (!signupState) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
25
33
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
26
34
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
27
35
|
/* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: para.isExternalWalletAuth ? `Finish setup for your${appName ? ` ${appName}` : ""} wallet` : isBoth ? "Secure Your Account" : "Create Passkey" }),
|
|
28
|
-
/* @__PURE__ */ jsx(UserIdentifier,
|
|
36
|
+
/* @__PURE__ */ jsx(UserIdentifier, { authInfo }),
|
|
29
37
|
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
|
|
30
38
|
] }),
|
|
31
39
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
32
|
-
isPasskeySupported ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick:
|
|
40
|
+
isPasskeySupported ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), children: [
|
|
33
41
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
34
42
|
isBoth ? "Create Passkey" : "Create"
|
|
35
43
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
44
|
/* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }),
|
|
37
|
-
/* @__PURE__ */ jsx(QRContainer, { children: !
|
|
45
|
+
/* @__PURE__ */ jsx(QRContainer, { children: !(signupState == null ? void 0 : signupState.passkeyUrl) ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: signupState.passkeyUrl }) }),
|
|
38
46
|
/* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
39
47
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
40
48
|
isCopied ? "Copied" : "Copy Link"
|
|
@@ -42,7 +50,7 @@ const BiometricCreationStep = ({ twoFactorAuthEnabled = false }) => {
|
|
|
42
50
|
] }),
|
|
43
51
|
isBoth && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
52
|
/* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
|
|
45
|
-
/* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick:
|
|
53
|
+
/* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSWORD), disabled: !!authStepRoute, children: [
|
|
46
54
|
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "passcode" }),
|
|
47
55
|
"Choose Password"
|
|
48
56
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const BiometricLoginStep: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const BiometricLoginStep: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,87 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
5
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
4
|
import { CpslButton, CpslDivider, CpslIcon } from "@getpara/react-components";
|
|
7
|
-
import {
|
|
8
|
-
import { useModalStore, useUserInfoStore } from "../../stores/index.js";
|
|
9
|
-
import { ModalStep } from "../../utils/steps.js";
|
|
5
|
+
import { useModalStore } from "../../stores/index.js";
|
|
10
6
|
import { Heading, StepContainer, InnerStepContainer } from "../common.js";
|
|
11
|
-
import { openPopup } from "../../utils/openPopup.js";
|
|
12
7
|
import styled from "styled-components";
|
|
13
8
|
import { AuthMethod } from "@getpara/web-sdk";
|
|
14
|
-
import {
|
|
9
|
+
import { KnownDevices, UserIdentifier } from "@getpara/react-common";
|
|
10
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
11
|
+
import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
|
|
15
12
|
const BiometricLoginStep = () => {
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setStep(ModalStep.AWAITING_BIOMETRIC_LOGIN);
|
|
33
|
-
};
|
|
34
|
-
const handlePasswordClick = () => {
|
|
35
|
-
refs.popupWindow.current = openPopup({
|
|
36
|
-
url: passwordUrlForLogin,
|
|
37
|
-
target: "ParaPassword",
|
|
38
|
-
type: "LOGIN_PASSWORD",
|
|
39
|
-
current: refs.popupWindow.current
|
|
40
|
-
});
|
|
41
|
-
setStep(ModalStep.AWAITING_PASSWORD_LOGIN);
|
|
42
|
-
};
|
|
43
|
-
function shouldShowWelcomeBack() {
|
|
44
|
-
return !(biometricLocationHints == null ? void 0 : biometricLocationHints.length) || passkeysSupported && formattedHints.isOnKnownDevice || (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod.PASSWORD);
|
|
13
|
+
var _a;
|
|
14
|
+
const loginState = useModalStore((state) => state.getLoginState());
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const { biometricHints, presentLoginUi } = useAuthActions();
|
|
17
|
+
const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
|
|
18
|
+
const [isPasskey, isPassword, hasHints, isPasskeyOnKnownDevice] = [
|
|
19
|
+
!!(loginState == null ? void 0 : loginState.passkeyUrl),
|
|
20
|
+
!!(loginState == null ? void 0 : loginState.passwordUrl),
|
|
21
|
+
(_a = loginState == null ? void 0 : loginState.biometricHints) == null ? void 0 : _a.length,
|
|
22
|
+
isPasskeySupported && !!(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice)
|
|
23
|
+
];
|
|
24
|
+
const knownDeviceLink = loginState == null ? void 0 : loginState.passkeyKnownDeviceUrl;
|
|
25
|
+
const isPasskeyUnavailable = hasHints && !(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice) || !isPasskeySupported;
|
|
26
|
+
const displayWelcomeBack = hasHints || isPasskeyOnKnownDevice || isPassword;
|
|
27
|
+
if (!loginState) {
|
|
28
|
+
return null;
|
|
45
29
|
}
|
|
46
30
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
47
31
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ jsx(UserIdentifier,
|
|
32
|
+
displayWelcomeBack && /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
|
|
33
|
+
/* @__PURE__ */ jsx(UserIdentifier, { authInfo: para.authInfo })
|
|
50
34
|
] }),
|
|
51
35
|
/* @__PURE__ */ jsxs(MainContainer, { children: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
] })
|
|
64
|
-
] });
|
|
65
|
-
};
|
|
66
|
-
const PasswordOnly = ({ handlePasswordClick }) => {
|
|
67
|
-
return /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handlePasswordClick, children: "Login" });
|
|
68
|
-
};
|
|
69
|
-
const BiometricOnly = ({
|
|
70
|
-
handlePasskeyClick,
|
|
71
|
-
formattedHints,
|
|
72
|
-
shortLoginLink,
|
|
73
|
-
passkeysSupported,
|
|
74
|
-
biometricLocationHints = []
|
|
75
|
-
}) => {
|
|
76
|
-
const [hasHints, isOnKnownDevice] = [biometricLocationHints.length > 0, formattedHints.isOnKnownDevice];
|
|
77
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
-
(hasHints && !isOnKnownDevice || !passkeysSupported) && /* @__PURE__ */ jsx(KnownDevices, { hints: formattedHints, link: shortLoginLink }),
|
|
79
|
-
passkeysSupported && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
-
hasHints && !isOnKnownDevice && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
|
|
81
|
-
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handlePasskeyClick, children: !hasHints || isOnKnownDevice ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
-
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
83
|
-
"Login with passkey"
|
|
84
|
-
] }) : "Continue anyway" })
|
|
36
|
+
isPassword && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSWORD, loginState), children: "Login" }),
|
|
37
|
+
isPasskey && !!knownDeviceLink && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
isPasskeyUnavailable && !!biometricHints && /* @__PURE__ */ jsx(KnownDevices, { hints: biometricHints, link: knownDeviceLink }),
|
|
39
|
+
isPasskeySupported && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
isPasskeyUnavailable && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
|
|
41
|
+
/* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSKEY, loginState), children: isPasskeyUnavailable ? "Continue anyway" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
|
+
/* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
|
|
43
|
+
"Login with passkey"
|
|
44
|
+
] }) })
|
|
45
|
+
] })
|
|
46
|
+
] })
|
|
85
47
|
] })
|
|
86
48
|
] });
|
|
87
49
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TOAuthMethod } from '@getpara/web-sdk';
|
|
2
2
|
interface BodyProps {
|
|
3
|
-
oAuthMethods?:
|
|
3
|
+
oAuthMethods?: TOAuthMethod[];
|
|
4
4
|
twoFactorAuthEnabled?: boolean;
|
|
5
5
|
disableEmailLogin: boolean;
|
|
6
6
|
disablePhoneLogin: boolean;
|
|
7
|
+
isGuestModeEnabled?: boolean;
|
|
7
8
|
onClose: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare const Body: ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, onClose }: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const Body: ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, onClose, }: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -5,8 +5,7 @@ import { styled } from "styled-components";
|
|
|
5
5
|
import { IFrameSteps, ModalStep } from "../../utils/steps.js";
|
|
6
6
|
import { CpslAlert, CpslIcon } from "@getpara/react-components";
|
|
7
7
|
import { VerificationCodeStep } from "../VerificationCodeStep/VerificationCodeStep.js";
|
|
8
|
-
import {
|
|
9
|
-
import { useModalStore, useThemeStore } from "../../stores/index.js";
|
|
8
|
+
import { useModalStore } from "../../stores/index.js";
|
|
10
9
|
import { BiometricLoginStep } from "../BiometricLoginStep/BiometricLoginStep.js";
|
|
11
10
|
import { Setup2FAStep } from "../Setup2FAStep/Setup2FAStep.js";
|
|
12
11
|
import { LoginDoneStep } from "../LoginDoneStep/LoginDoneStep.js";
|
|
@@ -36,6 +35,8 @@ import { useEffect, useState } from "react";
|
|
|
36
35
|
import { TelegramOAuthStep } from "../OAuth/TelegramOAuthStep.js";
|
|
37
36
|
import { AwaitingPasswordStep } from "../AwaitingPasswordStep/AwaitingPasswordStep.js";
|
|
38
37
|
import { IFrameStep } from "../IFrameStep/IFrameStep.js";
|
|
38
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
39
|
+
import { ExternalWalletVerificationStep } from "../ExternalWalletVerificationStep/ExternalWalletVerificationStep.js";
|
|
39
40
|
import { NetworkSpeedBanner } from "@getpara/react-common";
|
|
40
41
|
const MIN_HEIGHT = {
|
|
41
42
|
[ModalStep.ADD_FUNDS_AWAITING]: "680px"
|
|
@@ -46,15 +47,25 @@ const PADDING_TOP = {
|
|
|
46
47
|
const PADDING_BOTTOM = {
|
|
47
48
|
[ModalStep.TELEGRAM_OAUTH]: "16px"
|
|
48
49
|
};
|
|
49
|
-
const Body = ({
|
|
50
|
+
const Body = ({
|
|
51
|
+
oAuthMethods,
|
|
52
|
+
twoFactorAuthEnabled,
|
|
53
|
+
disableEmailLogin,
|
|
54
|
+
disablePhoneLogin,
|
|
55
|
+
isGuestModeEnabled = false,
|
|
56
|
+
onClose
|
|
57
|
+
}) => {
|
|
50
58
|
const currentStep = useModalStore((state) => state.step);
|
|
51
59
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
52
60
|
const stepDirection = useModalStore((state) => state.stepDirection);
|
|
53
61
|
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
54
62
|
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
55
63
|
const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
|
|
56
|
-
const
|
|
57
|
-
|
|
64
|
+
const embeddedModal = useStore((state) => {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
|
|
67
|
+
});
|
|
68
|
+
const appName = useStore((state) => state.appName);
|
|
58
69
|
const [isTestModeAlert, setIsTestModeAlert] = useState(onRampConfig == null ? void 0 : onRampConfig.testMode);
|
|
59
70
|
const Content = () => {
|
|
60
71
|
switch (currentStep) {
|
|
@@ -64,20 +75,26 @@ const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePh
|
|
|
64
75
|
{
|
|
65
76
|
oAuthMethods,
|
|
66
77
|
disableEmailLogin,
|
|
67
|
-
disablePhoneLogin
|
|
78
|
+
disablePhoneLogin,
|
|
79
|
+
isGuestModeEnabled
|
|
68
80
|
}
|
|
69
81
|
);
|
|
70
82
|
}
|
|
71
83
|
case ModalStep.EX_WALLET_MORE: {
|
|
72
84
|
return /* @__PURE__ */ jsx(ExternalWallets, {});
|
|
73
85
|
}
|
|
74
|
-
case ModalStep.
|
|
86
|
+
case ModalStep.AWAITING_GUEST_WALLET_CREATION: {
|
|
87
|
+
return /* @__PURE__ */ jsx(AwaitingWalletCreationStep, { isGuestMode: true });
|
|
88
|
+
}
|
|
89
|
+
case ModalStep.AUTH_MORE:
|
|
90
|
+
case ModalStep.AUTH_GUEST_SIGNUP: {
|
|
75
91
|
return /* @__PURE__ */ jsx(
|
|
76
92
|
AuthOptions,
|
|
77
93
|
{
|
|
78
94
|
oAuthMethods,
|
|
79
95
|
disableEmailLogin,
|
|
80
|
-
disablePhoneLogin
|
|
96
|
+
disablePhoneLogin,
|
|
97
|
+
isGuestModeEnabled
|
|
81
98
|
}
|
|
82
99
|
);
|
|
83
100
|
}
|
|
@@ -118,7 +135,7 @@ const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePh
|
|
|
118
135
|
return /* @__PURE__ */ jsx(TwoFactorDoneStep, { onClose });
|
|
119
136
|
}
|
|
120
137
|
case ModalStep.BIOMETRIC_CREATION: {
|
|
121
|
-
return /* @__PURE__ */ jsx(BiometricCreationStep, {
|
|
138
|
+
return /* @__PURE__ */ jsx(BiometricCreationStep, {});
|
|
122
139
|
}
|
|
123
140
|
case ModalStep.AWAITING_OAUTH: {
|
|
124
141
|
return /* @__PURE__ */ jsx(AwaitingOAuthStep, {});
|
|
@@ -208,7 +225,7 @@ const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePh
|
|
|
208
225
|
/* @__PURE__ */ jsxs(
|
|
209
226
|
InnerContainer,
|
|
210
227
|
{
|
|
211
|
-
$embeddedModal: embeddedModal,
|
|
228
|
+
$embeddedModal: !!embeddedModal,
|
|
212
229
|
$step: currentStep,
|
|
213
230
|
$isIFrameStep: IFrameSteps.includes(currentStep),
|
|
214
231
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ChainSwitch: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const ChainSwitch: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -8,12 +8,11 @@ import { CenteredText, InnerStepContainer, QRContainer, StepContainer } from "..
|
|
|
8
8
|
import { useEffect, useMemo } from "react";
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
10
|
import styled from "styled-components";
|
|
11
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
12
11
|
import { useCopyToClipboard } from "@getpara/react-common";
|
|
13
12
|
import { ModalStep } from "../../utils/steps.js";
|
|
14
13
|
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
15
14
|
import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
|
|
16
|
-
import {
|
|
15
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
17
16
|
const ChainSwitch = () => {
|
|
18
17
|
const [isCopied, copy] = useCopyToClipboard();
|
|
19
18
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
@@ -21,7 +20,7 @@ const ChainSwitch = () => {
|
|
|
21
20
|
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
22
21
|
const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
|
|
23
22
|
useEffect(() => {
|
|
24
|
-
if ((wallet == null ? void 0 : wallet.type) ===
|
|
23
|
+
if ((wallet == null ? void 0 : wallet.type) === "COSMOS") {
|
|
25
24
|
routeMobileExternalWallet(qrUri);
|
|
26
25
|
}
|
|
27
26
|
}, [qrUri, wallet]);
|
|
@@ -37,7 +36,9 @@ const ChainSwitch = () => {
|
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
const handleCopy = () => {
|
|
40
|
-
|
|
39
|
+
if (qrUri) {
|
|
40
|
+
copy(qrUri);
|
|
41
|
+
}
|
|
41
42
|
};
|
|
42
43
|
const Content = useMemo(() => {
|
|
43
44
|
var _a;
|
|
@@ -4,13 +4,16 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { CpslIcon } from "@getpara/react-components";
|
|
5
5
|
import { styled } from "styled-components";
|
|
6
6
|
import { useModalStore } from "../../stores/index.js";
|
|
7
|
-
import { useThemeStore } from "../../stores/theme/useThemeStore.js";
|
|
8
7
|
import { useGoBack } from "../../hooks/useGoBack.js";
|
|
9
8
|
import { AccountSelect, ChainSelect } from "./Selects.js";
|
|
10
9
|
import { ModalStep } from "../../utils/steps.js";
|
|
11
10
|
import { HeaderButton } from "@getpara/react-common";
|
|
11
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
12
12
|
const Controls = ({ onClose }) => {
|
|
13
|
-
const bareModal =
|
|
13
|
+
const bareModal = useStore((state) => {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.bareModal;
|
|
16
|
+
});
|
|
14
17
|
const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
|
|
15
18
|
const step = useModalStore((state) => state.step);
|
|
16
19
|
const isFullyLoggedIn = useModalStore((state) => state.isFullyLoggedIn);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ChainSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const ChainSelect: () => import("react/jsx-runtime").JSX.Element | null;
|
|
2
2
|
export declare const AccountSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,30 +6,29 @@ import {
|
|
|
6
6
|
} from "../../../chunk-MMUBH76A.js";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
|
|
9
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
10
9
|
import styled from "styled-components";
|
|
11
|
-
import {
|
|
12
|
-
import { truncateAddress, WalletType } from "@getpara/web-sdk";
|
|
10
|
+
import { truncateAddress } from "@getpara/web-sdk";
|
|
13
11
|
import { useEffect, useRef } from "react";
|
|
14
12
|
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
15
|
-
import {
|
|
13
|
+
import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
|
|
16
14
|
import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem } from "../common.js";
|
|
17
|
-
import { useWalletState } from "../../../provider/index.js";
|
|
18
15
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
16
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
17
|
+
import { useStore } from "../../../provider/stores/useStore.js";
|
|
19
18
|
import { useCopyToClipboard } from "@getpara/react-common";
|
|
20
19
|
const getValue = (id, type) => {
|
|
21
20
|
return id && type ? `${id}~${type}` : void 0;
|
|
22
21
|
};
|
|
23
22
|
const WALLET_TYPES = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
EVM: "EVM",
|
|
24
|
+
SOLANA: "Solana",
|
|
25
|
+
COSMOS: "Cosmos"
|
|
27
26
|
};
|
|
28
27
|
const ChainSelect = () => {
|
|
29
28
|
var _a, _b;
|
|
30
29
|
const containerRef = useRef(null);
|
|
31
30
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
32
|
-
const activeWallet =
|
|
31
|
+
const { data: activeWallet } = useWallet();
|
|
33
32
|
const { switchChain, chainId, chains, chainIdSwitchingTo } = useExternalWallets();
|
|
34
33
|
useEffect(() => {
|
|
35
34
|
if (dropdownMaxHeight && chainId) {
|
|
@@ -39,7 +38,7 @@ const ChainSelect = () => {
|
|
|
39
38
|
const handleChainChange = (chainId2) => __async(void 0, null, function* () {
|
|
40
39
|
yield switchChain(chainId2);
|
|
41
40
|
});
|
|
42
|
-
if (!activeWallet || !activeWallet.isExternal || activeWallet.type ===
|
|
41
|
+
if (!activeWallet || !activeWallet.isExternal || activeWallet.type === "SOLANA") {
|
|
43
42
|
return null;
|
|
44
43
|
}
|
|
45
44
|
const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
|
|
@@ -55,8 +54,8 @@ const ChainSelect = () => {
|
|
|
55
54
|
placeholder: "Choose chain...",
|
|
56
55
|
anchorElId: "inputContainer",
|
|
57
56
|
dropdownMaxHeight,
|
|
58
|
-
$width: dropdownWidth,
|
|
59
|
-
$top: mobileAnchor + 16 + 1,
|
|
57
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
58
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
60
59
|
autoWidth: true,
|
|
61
60
|
selectedItemVariant: "bodyXS",
|
|
62
61
|
children: [
|
|
@@ -74,25 +73,31 @@ function getName(para, {
|
|
|
74
73
|
hideWallets = false
|
|
75
74
|
}) {
|
|
76
75
|
if (para.isMultiWallet) {
|
|
77
|
-
return name != null ? name : `${isExternal ? "External " : ""}${WALLET_TYPES[type]}${!hideWallets && (isMenu || isExternal) ? " Wallet" : ""}`;
|
|
76
|
+
return name != null ? name : `${isExternal ? "External " : ""}${type ? WALLET_TYPES[type] : ""}${!hideWallets && (isMenu || isExternal) ? " Wallet" : ""}`;
|
|
78
77
|
}
|
|
79
78
|
return hideWallets ? "My Account" : name || "My Wallet";
|
|
80
79
|
}
|
|
81
80
|
const AccountSelect = () => {
|
|
82
81
|
var _a;
|
|
83
|
-
const hideWallets =
|
|
82
|
+
const hideWallets = useStore((state) => {
|
|
83
|
+
var _a2;
|
|
84
|
+
return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
|
|
85
|
+
});
|
|
84
86
|
const para = useInternalClient();
|
|
85
87
|
const containerRef = useRef(null);
|
|
86
88
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
87
89
|
const [isCopied, copy] = useCopyToClipboard();
|
|
88
90
|
const { setSelectedWallet } = useWalletState();
|
|
89
|
-
const activeWallet =
|
|
91
|
+
const { data: activeWallet } = useWallet();
|
|
92
|
+
const { data: account } = useAccount();
|
|
93
|
+
const availableWallets = account == null ? void 0 : account.wallets;
|
|
94
|
+
const isGuest = para.isGuestMode && (activeWallet == null ? void 0 : activeWallet.pregenIdentifierType) === "GUEST_ID";
|
|
90
95
|
const handleCopy = () => {
|
|
91
|
-
copy(activeWallet.address ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
|
|
96
|
+
copy((activeWallet == null ? void 0 : activeWallet.address) ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
|
|
92
97
|
};
|
|
93
|
-
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs(FlexRow, { slot: "selected-item", children: [
|
|
94
|
-
/* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "24px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
95
|
-
/* @__PURE__ */ jsx(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
|
|
98
|
+
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs(FlexRow, { slot: "selected-item", style: { height: "24px" }, children: [
|
|
99
|
+
!isGuest && /* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "24px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
100
|
+
/* @__PURE__ */ jsx(WalletName, { variant: "bodyXS", color: "contrast", style: { marginLeft: isGuest ? "8px" : "0px" }, children: isGuest ? "Guest" : getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
|
|
96
101
|
!hideWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
102
|
/* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: (_a = activeWallet.ensName) != null ? _a : para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) }),
|
|
98
103
|
/* @__PURE__ */ jsx(
|
|
@@ -115,8 +120,8 @@ const AccountSelect = () => {
|
|
|
115
120
|
if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
|
|
116
121
|
resize();
|
|
117
122
|
}
|
|
118
|
-
}, [activeWallet,
|
|
119
|
-
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "addressInputContainer", children:
|
|
123
|
+
}, [activeWallet, availableWallets, dropdownMaxHeight]);
|
|
124
|
+
return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "addressInputContainer", children: availableWallets && availableWallets.length > 1 ? /* @__PURE__ */ jsxs(
|
|
120
125
|
HeaderSelect,
|
|
121
126
|
{
|
|
122
127
|
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
@@ -128,20 +133,20 @@ const AccountSelect = () => {
|
|
|
128
133
|
placeholder: "Choose wallet...",
|
|
129
134
|
anchorElId: "addressInputContainer",
|
|
130
135
|
dropdownMaxHeight,
|
|
131
|
-
$width: dropdownWidth,
|
|
132
|
-
$top: mobileAnchor + 16 + 1,
|
|
136
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
137
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
133
138
|
autoWidth: true,
|
|
134
139
|
selectedItemVariant: "bodyXS",
|
|
135
140
|
children: [
|
|
136
141
|
activeWallet && ActiveWalletNode,
|
|
137
|
-
|
|
142
|
+
availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
|
|
138
143
|
const key = getValue(id, type);
|
|
139
144
|
const name = _name != null ? _name : getName(para, { type, isExternal, isMenu: true, hideWallets });
|
|
140
145
|
return /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsxs(FlexRow, { children: [
|
|
141
146
|
/* @__PURE__ */ jsx(CpslIdenticon, { size: "40px", hash: para.getIdenticonHash(id, type) }),
|
|
142
147
|
/* @__PURE__ */ jsxs(FlexCol, { children: [
|
|
143
148
|
name && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "contrast", children: name }),
|
|
144
|
-
!hideWallets && /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: truncateAddress(address, type, { prefix: para.cosmosPrefix }) })
|
|
149
|
+
!hideWallets && address && type && /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: truncateAddress(address, type, { prefix: para.cosmosPrefix }) })
|
|
145
150
|
] })
|
|
146
151
|
] }) }, key);
|
|
147
152
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ExternalWalletStep: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const ExternalWalletStep: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -8,11 +8,11 @@ import { CenteredText, ErrorContainer, ErrorIcon, InnerStepContainer, QRContaine
|
|
|
8
8
|
import { useEffect, useMemo } from "react";
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
10
|
import styled from "styled-components";
|
|
11
|
-
import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
|
|
12
11
|
import { useCopyToClipboard } from "@getpara/react-common";
|
|
13
12
|
import { ModalStep } from "../../utils/steps.js";
|
|
14
|
-
import { isMobile, isTablet
|
|
13
|
+
import { isMobile, isTablet } from "@getpara/web-sdk";
|
|
15
14
|
import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
|
|
15
|
+
import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
|
|
16
16
|
const ExternalWalletStep = () => {
|
|
17
17
|
const [isCopied, copy] = useCopyToClipboard();
|
|
18
18
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
@@ -22,10 +22,14 @@ const ExternalWalletStep = () => {
|
|
|
22
22
|
routeMobileExternalWallet(qrUri);
|
|
23
23
|
}, [qrUri]);
|
|
24
24
|
const handleTryAgainClick = () => __async(void 0, null, function* () {
|
|
25
|
-
|
|
25
|
+
if (wallet) {
|
|
26
|
+
yield connectExternalWallet(wallet);
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
const handleCopy = () => {
|
|
28
|
-
|
|
30
|
+
if (qrUri) {
|
|
31
|
+
copy(qrUri);
|
|
32
|
+
}
|
|
29
33
|
};
|
|
30
34
|
const Content = useMemo(() => {
|
|
31
35
|
var _a, _b, _c;
|
|
@@ -68,8 +72,8 @@ Please choose another wallet or continue on desktop.`;
|
|
|
68
72
|
] });
|
|
69
73
|
}
|
|
70
74
|
if (showMobile) {
|
|
71
|
-
if (wallet.type ===
|
|
72
|
-
const isInstalled = wallet.type !==
|
|
75
|
+
if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
|
|
76
|
+
const isInstalled = wallet.type !== "SOLANA" || wallet.installed;
|
|
73
77
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
78
|
/* @__PURE__ */ jsx(InnerStepContainer, { children: !isInstalled && /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: `${wallet.name} not detected` }) }),
|
|
75
79
|
wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|