@getpara/react-sdk-lite 2.0.0-alpha.39 → 2.0.0-alpha.41
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/css/modal.css +14 -1
- package/dist/modal/ParaModal.js +29 -6
- package/dist/modal/components/Account/Account.d.ts +1 -5
- package/dist/modal/components/Account/Account.js +53 -71
- package/dist/modal/components/Account/AccountHeader.d.ts +3 -0
- package/dist/modal/components/Account/AccountHeader.js +64 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
- package/dist/modal/components/Account/AccountProfile.js +114 -27
- package/dist/modal/components/AddFunds/AddFunds.js +11 -6
- package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -32
- package/dist/modal/components/AddFunds/AddFundsDone.js +1 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.js +8 -53
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +3 -5
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +4 -3
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +4 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +7 -5
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +4 -4
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +1 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +2 -2
- package/dist/modal/components/Body/Body.d.ts +3 -1
- package/dist/modal/components/Body/Body.js +40 -47
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +13 -21
- package/dist/modal/components/Controls/{Selects.d.ts → ChainSelect.d.ts} +0 -1
- package/dist/modal/components/Controls/ChainSelect.js +88 -0
- package/dist/modal/components/Controls/Controls.js +10 -20
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +17 -12
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
- package/dist/modal/components/Footer/Footer.js +26 -57
- package/dist/modal/components/Header/Header.js +46 -8
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
- package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
- package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
- package/dist/modal/components/ModalContent/ModalContent.js +5 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
- package/dist/modal/components/OAuth/OAuth.js +1 -1
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
- package/dist/modal/components/Waiting/Waiting.js +1 -1
- package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
- package/dist/modal/components/WalletCard/WalletCard.js +41 -15
- package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
- package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
- package/dist/modal/components/common.d.ts +9 -4
- package/dist/modal/components/common.js +67 -13
- package/dist/modal/constants/constants.d.ts +7 -12
- package/dist/modal/constants/constants.js +7 -1
- package/dist/modal/constants/oAuthLogos.d.ts +2 -6
- package/dist/modal/constants/oAuthLogos.js +45 -43
- package/dist/modal/hooks/useGoBack.js +9 -0
- package/dist/modal/types/commonTypes.d.ts +9 -0
- package/dist/modal/utils/getWalletDisplayName.js +3 -6
- package/dist/modal/utils/icons.d.ts +5 -0
- package/dist/modal/utils/icons.js +17 -0
- package/dist/provider/ParaProvider.js +24 -129
- package/dist/provider/ParaProviderMin.d.ts +4 -0
- package/dist/provider/ParaProviderMin.js +140 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
- package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
- package/dist/provider/components/ExternalWalletWrapper.js +3 -36
- package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
- package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
- package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
- package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
- package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +4 -42
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/index.js +3 -1
- package/dist/provider/providers/AccountLinkProvider.js +8 -4
- package/dist/provider/providers/AuthProvider.js +28 -14
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
- package/dist/provider/providers/ExternalWalletProvider.js +1 -1
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
- package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
- package/dist/provider/stores/slices/modal.js +16 -12
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +64 -1
- package/dist/public/PPMori-Regular.woff2 +0 -0
- package/dist/public/PPMori-SemiBold.woff2 +0 -0
- package/package.json +8 -8
- package/dist/modal/components/Controls/Selects.js +0 -173
- package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
- package/dist/provider/utils/externalWalletDefaults.js +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useEffect } from "react";
|
|
4
|
+
import { useEffect, useMemo } from "react";
|
|
5
5
|
import { Heading, HeroIcon, StepContainer } from "../common.js";
|
|
6
6
|
import { ExternalWalletCard, WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
|
|
7
7
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
@@ -9,18 +9,26 @@ import { useStore } from "../../../provider/stores/useStore.js";
|
|
|
9
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
10
|
import { ModalStep } from "../../utils/steps.js";
|
|
11
11
|
const LoginDoneStep = ({ onClose }) => {
|
|
12
|
-
var _a, _b;
|
|
13
12
|
const para = useInternalClient();
|
|
14
13
|
const bareModal = useStore((state) => {
|
|
15
|
-
var
|
|
16
|
-
return (
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.bareModal;
|
|
17
16
|
});
|
|
18
17
|
const setStep = useModalStore((state) => state.setStep);
|
|
19
18
|
const setFlow = useModalStore((state) => state.setFlow);
|
|
20
19
|
const hideWallets = useStore((state) => {
|
|
21
|
-
var
|
|
22
|
-
return (
|
|
20
|
+
var _a;
|
|
21
|
+
return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
|
|
23
22
|
});
|
|
23
|
+
const content = useMemo(() => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") {
|
|
26
|
+
return /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_b = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address) != null ? _b : "", showAddFunds: false });
|
|
27
|
+
}
|
|
28
|
+
const { id, type } = Object.values(para.wallets || {})[0] || {};
|
|
29
|
+
if (!id || !type) return null;
|
|
30
|
+
return /* @__PURE__ */ jsx(WalletCard, { id, type, showAddFunds: false }, `${id}-${type}`);
|
|
31
|
+
}, [para.externalWalletConnectionType, para.externalWallets, para.wallets]);
|
|
24
32
|
useEffect(() => {
|
|
25
33
|
setTimeout(() => {
|
|
26
34
|
if (bareModal) {
|
|
@@ -33,10 +41,8 @@ const LoginDoneStep = ({ onClose }) => {
|
|
|
33
41
|
}, []);
|
|
34
42
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
35
43
|
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
36
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
37
|
-
!hideWallets && /* @__PURE__ */ jsx(WalletCards, { children:
|
|
38
|
-
return /* @__PURE__ */ jsx(WalletCard, { id, type }, `${id}-${type}`);
|
|
39
|
-
}) })
|
|
44
|
+
/* @__PURE__ */ jsx(Heading, { children: "Connected" }),
|
|
45
|
+
!hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: content })
|
|
40
46
|
] });
|
|
41
47
|
};
|
|
42
48
|
export {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ParaModalProps } from '../../types/modalProps.js';
|
|
2
|
-
type ModalContentProps = Omit<ParaModalProps, 'para' | 'isOpen' | 'theme' | 'branding' | 'onModalStepChange' | 'onExpandModalChange'>;
|
|
3
2
|
export type ModalContentHandle = {
|
|
4
3
|
/**
|
|
5
4
|
* Trigger the modal close handler
|
|
6
5
|
*/
|
|
7
6
|
handleModalClose: () => void;
|
|
8
7
|
};
|
|
9
|
-
export declare const ModalContent: import("react").ForwardRefExoticComponent<
|
|
10
|
-
|
|
8
|
+
export declare const ModalContent: import("react").ForwardRefExoticComponent<Omit<ParaModalProps, "onModalStepChange" | "isOpen" | "para" | "theme" | "branding" | "onExpandModalChange"> & {
|
|
9
|
+
onDisconnect: () => void;
|
|
10
|
+
isDisconnecting: boolean;
|
|
11
|
+
} & import("react").RefAttributes<ModalContentHandle>>;
|
|
@@ -20,6 +20,8 @@ const ModalContent = forwardRef(
|
|
|
20
20
|
disablePhoneLogin,
|
|
21
21
|
isGuestModeEnabled = false,
|
|
22
22
|
onClose,
|
|
23
|
+
onDisconnect,
|
|
24
|
+
isDisconnecting,
|
|
23
25
|
onRampTestMode
|
|
24
26
|
}, ref) => {
|
|
25
27
|
const para = useInternalClient();
|
|
@@ -76,7 +78,9 @@ const ModalContent = forwardRef(
|
|
|
76
78
|
disableEmailLogin: !!disableEmailLogin,
|
|
77
79
|
disablePhoneLogin: !!disablePhoneLogin,
|
|
78
80
|
isGuestModeEnabled,
|
|
79
|
-
onClose: handleClose
|
|
81
|
+
onClose: handleClose,
|
|
82
|
+
onDisconnect,
|
|
83
|
+
isDisconnecting
|
|
80
84
|
}
|
|
81
85
|
),
|
|
82
86
|
/* @__PURE__ */ jsx(Footer, {})
|
|
@@ -14,7 +14,7 @@ function FarcasterConnectQR() {
|
|
|
14
14
|
`Get Farcaster`
|
|
15
15
|
] })
|
|
16
16
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
17
|
+
/* @__PURE__ */ jsx(Heading, { children: "Sign in using Farcaster" }),
|
|
18
18
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
19
19
|
/* @__PURE__ */ jsx(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
|
|
20
20
|
/* @__PURE__ */ jsx(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: farcasterConnectUri }) })
|
|
@@ -44,7 +44,7 @@ const OAuth = ({ methods }) => {
|
|
|
44
44
|
OAuthButton,
|
|
45
45
|
{
|
|
46
46
|
$isDark: useDarkLogos,
|
|
47
|
-
icon: ACCOUNT_TYPES[method][useBrandedLogos ? "
|
|
47
|
+
icon: ACCOUNT_TYPES[method][useBrandedLogos ? "iconBranded" : "icon"],
|
|
48
48
|
onClick: handleMethodClick(method),
|
|
49
49
|
$index: index,
|
|
50
50
|
$totalItems: showMoreButton ? HAS_MORE_LENGTH : methodsToShow.length
|
|
@@ -39,7 +39,7 @@ const SaveRecoverySecret = ({
|
|
|
39
39
|
};
|
|
40
40
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
41
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
42
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
42
|
+
/* @__PURE__ */ jsx(Heading, { children: "Save your Recovery Secret" }),
|
|
43
43
|
/* @__PURE__ */ jsxs(ButtonContainer, { children: [
|
|
44
44
|
/* @__PURE__ */ jsx(ActionButton, { icon: "download", onClick: onDownload, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Download" }) }),
|
|
45
45
|
/* @__PURE__ */ jsx(ActionButton, { icon: isCopied ? "check" : "copy", onClick: onCopy, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isCopied ? "Copied!" : "Copy" }) }),
|
|
@@ -64,7 +64,7 @@ const RecoverySecretStep = () => {
|
|
|
64
64
|
});
|
|
65
65
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
66
66
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
67
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
67
|
+
/* @__PURE__ */ jsx(Heading, { children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }),
|
|
68
68
|
/* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
69
69
|
"Your",
|
|
70
70
|
" ",
|
|
@@ -82,8 +82,8 @@ const Setup2FAStep = ({ onClose }) => {
|
|
|
82
82
|
};
|
|
83
83
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
84
84
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
85
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
86
|
-
isVerifying && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Please enter the code from your authenticator app
|
|
85
|
+
/* @__PURE__ */ jsx(Heading, { children: "Turn on two-factor authentication" }),
|
|
86
|
+
isVerifying && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Please enter the code from your authenticator app" })
|
|
87
87
|
] }),
|
|
88
88
|
/* @__PURE__ */ jsx(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx(Fragment, { children: isPending ? /* @__PURE__ */ jsx(CpslSpinner, {}) : /* @__PURE__ */ jsx(
|
|
89
89
|
"form",
|
|
@@ -107,7 +107,7 @@ const Setup2FAStep = ({ onClose }) => {
|
|
|
107
107
|
)
|
|
108
108
|
}
|
|
109
109
|
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
-
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan with your preferred authenticator app
|
|
110
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan with your preferred authenticator app" }),
|
|
111
111
|
/* @__PURE__ */ jsx(QRContainer, { children: !(twoFactorStatus == null ? void 0 : twoFactorStatus.uri) ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: twoFactorStatus.uri }) })
|
|
112
112
|
] }) }),
|
|
113
113
|
!isVerifying && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -12,7 +12,7 @@ const TwoFactorDoneStep = ({ onClose }) => {
|
|
|
12
12
|
return /* @__PURE__ */ jsxs(StepContainer, { children: [
|
|
13
13
|
/* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
|
|
14
14
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
15
|
-
/* @__PURE__ */ jsx(Heading, { variant: "headingXS",
|
|
15
|
+
/* @__PURE__ */ jsx(Heading, { variant: "headingXS", children: "Success" }),
|
|
16
16
|
/* @__PURE__ */ jsxs(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
17
17
|
"Your ",
|
|
18
18
|
hideWallets ? "account" : "wallet",
|
|
@@ -73,7 +73,7 @@ const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
|
|
|
73
73
|
}, [error]);
|
|
74
74
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
75
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
76
|
-
/* @__PURE__ */ jsxs(Heading, {
|
|
76
|
+
/* @__PURE__ */ jsxs(Heading, { children: [
|
|
77
77
|
"Verify ",
|
|
78
78
|
isEmail ? "Email" : "Phone Number"
|
|
79
79
|
] }),
|
|
@@ -7,7 +7,7 @@ const Waiting = ({ heading, subheading }) => {
|
|
|
7
7
|
return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
|
|
8
8
|
/* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) }),
|
|
9
9
|
/* @__PURE__ */ jsxs(InnerStepContainer, { children: [
|
|
10
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
10
|
+
/* @__PURE__ */ jsx(Heading, { children: heading }),
|
|
11
11
|
subheading && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })
|
|
12
12
|
] })
|
|
13
13
|
] });
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { TWalletType } from '@getpara/web-sdk';
|
|
2
|
-
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare const ExternalWalletCard: ({ address, showAddFunds, }: Pick<SharedWalletCardProps, "showAddFunds"> & {
|
|
4
|
+
address: string;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
6
|
interface WalletCardProps {
|
|
4
7
|
id: string;
|
|
5
8
|
type: TWalletType;
|
|
@@ -7,12 +10,12 @@ interface WalletCardProps {
|
|
|
7
10
|
}
|
|
8
11
|
export declare const WalletCard: ({ id, type, showAddFunds }: WalletCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
12
|
interface SharedWalletCardProps {
|
|
10
|
-
address
|
|
13
|
+
address?: string;
|
|
11
14
|
id?: string;
|
|
12
15
|
type?: TWalletType;
|
|
13
16
|
name?: string;
|
|
14
|
-
identiconHash: string;
|
|
15
17
|
showAddFunds?: boolean;
|
|
18
|
+
Icon: ReactNode;
|
|
16
19
|
}
|
|
17
20
|
export declare const WalletCards: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
21
|
export {};
|
|
@@ -3,14 +3,18 @@ import "../../../chunk-MMUBH76A.js";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { safeStyled } from "@getpara/react-common";
|
|
5
5
|
import { useModalStore } from "../../stores/index.js";
|
|
6
|
-
import { CpslButton,
|
|
6
|
+
import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
|
|
7
7
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
8
8
|
import { ModalStep } from "../../utils/steps.js";
|
|
9
9
|
import { useWalletState } from "../../../provider/index.js";
|
|
10
10
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
11
11
|
import { useStore } from "../../../provider/stores/useStore.js";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { WalletTypeIcon } from "../common.js";
|
|
13
|
+
const ExternalWalletCard = ({
|
|
14
|
+
address,
|
|
15
|
+
showAddFunds
|
|
16
|
+
}) => {
|
|
17
|
+
var _a;
|
|
14
18
|
const para = useInternalClient();
|
|
15
19
|
const wallet = para.externalWallets[address];
|
|
16
20
|
if (!(wallet == null ? void 0 : wallet.address) || !(wallet == null ? void 0 : wallet.type)) {
|
|
@@ -19,34 +23,56 @@ const ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
|
19
23
|
return /* @__PURE__ */ jsx(
|
|
20
24
|
SharedWalletCard,
|
|
21
25
|
{
|
|
26
|
+
name: wallet.name,
|
|
22
27
|
address: (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type),
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
showAddFunds,
|
|
29
|
+
Icon: /* @__PURE__ */ jsx(
|
|
30
|
+
WalletTypeIcon,
|
|
31
|
+
{
|
|
32
|
+
externalWallet: wallet.externalProviderId,
|
|
33
|
+
walletType: wallet.type,
|
|
34
|
+
size: "48px",
|
|
35
|
+
inset: "6px",
|
|
36
|
+
radius: "theme",
|
|
37
|
+
background: "var(--cpsl-color-background-0)",
|
|
38
|
+
border: "1px solid var(--cpsl-color-background-16)"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
25
41
|
}
|
|
26
42
|
);
|
|
27
43
|
};
|
|
28
44
|
const WalletCard = ({ id, type, showAddFunds }) => {
|
|
29
|
-
var _a
|
|
45
|
+
var _a;
|
|
30
46
|
const para = useInternalClient();
|
|
31
47
|
const appName = useStore((state) => state.appName);
|
|
32
48
|
const wallet = para.findWallet(id, type);
|
|
33
49
|
if (!wallet) {
|
|
34
50
|
return null;
|
|
35
51
|
}
|
|
36
|
-
const address = para.getDisplayAddress(wallet.id, { addressType: type });
|
|
37
52
|
return /* @__PURE__ */ jsx(
|
|
38
53
|
SharedWalletCard,
|
|
39
54
|
{
|
|
40
55
|
id: wallet.id,
|
|
41
56
|
type: wallet.type,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
name: (_a = wallet.name) != null ? _a : `${appName ? `${appName} ` : ""}Wallet`,
|
|
58
|
+
showAddFunds,
|
|
59
|
+
Icon: /* @__PURE__ */ jsx(
|
|
60
|
+
CpslIcon,
|
|
61
|
+
{
|
|
62
|
+
icon: para.partnerLogo ? void 0 : "wallet02",
|
|
63
|
+
src: para.partnerLogo,
|
|
64
|
+
color: "var(--cpsl-color-text-contrast)",
|
|
65
|
+
radius: "theme",
|
|
66
|
+
background: "var(--cpsl-color-background-0)",
|
|
67
|
+
border: "1px solid var(--cpsl-color-background-16)",
|
|
68
|
+
size: "48px",
|
|
69
|
+
inset: para.partnerLogo ? "8px" : "12px"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
46
72
|
}
|
|
47
73
|
);
|
|
48
74
|
};
|
|
49
|
-
const SharedWalletCard = ({ address, name,
|
|
75
|
+
const SharedWalletCard = ({ address, name, showAddFunds, id, type, Icon }) => {
|
|
50
76
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
51
77
|
const { setSelectedWallet } = useWalletState();
|
|
52
78
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -59,10 +85,10 @@ const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type
|
|
|
59
85
|
};
|
|
60
86
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
61
87
|
/* @__PURE__ */ jsxs(InnerContainer, { children: [
|
|
62
|
-
|
|
88
|
+
Icon,
|
|
63
89
|
/* @__PURE__ */ jsxs(WalletNameContainer, { children: [
|
|
64
90
|
!!name && /* @__PURE__ */ jsx(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name }),
|
|
65
|
-
/* @__PURE__ */ jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })
|
|
91
|
+
!!address && /* @__PURE__ */ jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })
|
|
66
92
|
] })
|
|
67
93
|
] }),
|
|
68
94
|
showAddFunds && isAddFundsEnabled && /* @__PURE__ */ jsx(AddFundsButton, { onClick: handleAddFundsClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) })
|
|
@@ -76,7 +102,7 @@ const WalletCards = safeStyled.div`
|
|
|
76
102
|
`;
|
|
77
103
|
const Container = safeStyled.div`
|
|
78
104
|
width: 100%;
|
|
79
|
-
padding:
|
|
105
|
+
padding: 16px;
|
|
80
106
|
display: flex;
|
|
81
107
|
justify-content: space-between;
|
|
82
108
|
align-items: center;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const WalletSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Select: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
3
|
+
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|
|
4
|
+
}, {
|
|
5
|
+
$width: number;
|
|
6
|
+
$top?: number;
|
|
7
|
+
}>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
8
|
+
export declare const SelectItem: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
9
|
+
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|
|
10
|
+
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
11
|
+
export declare const SelectContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
6
|
+
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
7
|
+
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
8
|
+
import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
|
|
9
|
+
import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
|
|
10
|
+
import * as common from "../common.js";
|
|
11
|
+
const getValue = (id, type) => {
|
|
12
|
+
return id && type ? `${id}~${type}` : void 0;
|
|
13
|
+
};
|
|
14
|
+
const Wallet = ({ wallet, withCopy, slot }) => {
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const [isCopied, copy] = useCopyToClipboard();
|
|
17
|
+
return /* @__PURE__ */ jsxs(WalletContainer, { slot, style: { flex: "1" }, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
WalletTypeIcon,
|
|
20
|
+
{
|
|
21
|
+
externalWallet: wallet.isExternal ? wallet.externalProviderId : void 0,
|
|
22
|
+
walletType: wallet.type,
|
|
23
|
+
size: "32px",
|
|
24
|
+
inset: "6px"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "contrast", style: { flex: "1" }, children: para.getDisplayAddress(wallet.id, { truncate: true, addressType: wallet.type }) }),
|
|
28
|
+
withCopy && /* @__PURE__ */ jsx(
|
|
29
|
+
CopyButton,
|
|
30
|
+
{
|
|
31
|
+
id: "ignore-click",
|
|
32
|
+
size: "small",
|
|
33
|
+
variant: "ghost",
|
|
34
|
+
onClick: (e) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
copy(para.getDisplayAddress(wallet.id, { addressType: wallet.type }));
|
|
38
|
+
},
|
|
39
|
+
children: /* @__PURE__ */ jsx(CpslIcon, { id: "ignore-click", slot: "start", icon: isCopied ? "check" : "copy" })
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
const WalletSelect = () => {
|
|
45
|
+
const containerRef = useRef(null);
|
|
46
|
+
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
47
|
+
const { setSelectedWallet } = useWalletState();
|
|
48
|
+
const { data: activeWallet } = useWallet();
|
|
49
|
+
const { embedded } = useAccount();
|
|
50
|
+
const availableWallets = embedded == null ? void 0 : embedded.wallets;
|
|
51
|
+
const isMultiWallet = availableWallets && availableWallets.length > 1;
|
|
52
|
+
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsx(Wallet, { withCopy: true, wallet: activeWallet, slot: "selected-item" }) : null;
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
|
|
55
|
+
resize();
|
|
56
|
+
}
|
|
57
|
+
}, [activeWallet, availableWallets, dropdownMaxHeight]);
|
|
58
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
59
|
+
isMultiWallet && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: "Select Wallet" }),
|
|
60
|
+
/* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: /* @__PURE__ */ jsxs(
|
|
61
|
+
Select,
|
|
62
|
+
{
|
|
63
|
+
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
64
|
+
onCpslSelectValueChange: (e) => {
|
|
65
|
+
const [id, type] = e.detail.split("~");
|
|
66
|
+
setSelectedWallet({ id, type });
|
|
67
|
+
},
|
|
68
|
+
showFormattedSelectedItem: true,
|
|
69
|
+
placeholder: "Choose wallet...",
|
|
70
|
+
anchorElId: "addressInputContainer",
|
|
71
|
+
dropdownMaxHeight,
|
|
72
|
+
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
73
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
|
|
74
|
+
selectedItemVariant: "bodyXS",
|
|
75
|
+
icon: isMultiWallet ? "chevronUp" : null,
|
|
76
|
+
disabled: !isMultiWallet,
|
|
77
|
+
children: [
|
|
78
|
+
activeWallet && ActiveWalletNode,
|
|
79
|
+
(availableWallets || []).map(({ address, name: _name, id, type }) => {
|
|
80
|
+
const key = getValue(id, type);
|
|
81
|
+
return /* @__PURE__ */ jsx(SelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsx(Wallet, { wallet: { address, name: _name, id, type } }) }, key);
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
) })
|
|
86
|
+
] });
|
|
87
|
+
};
|
|
88
|
+
const Container = safeStyled.div`
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
gap: 8px;
|
|
92
|
+
align-items: center;
|
|
93
|
+
`;
|
|
94
|
+
const WalletContainer = safeStyled.div`
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
gap: 8px;
|
|
98
|
+
`;
|
|
99
|
+
const Select = safeStyled(CpslSelect)`
|
|
100
|
+
--icon-width: 32px;
|
|
101
|
+
--icon-height: 32px;
|
|
102
|
+
--container-border-color: var(--cpsl-color-background-16);
|
|
103
|
+
--container-background-color-disabled: var(--container-background-color);
|
|
104
|
+
width: 286px;
|
|
105
|
+
position: relative;
|
|
106
|
+
|
|
107
|
+
&::part(selected-text) {
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&::part(dropdown) {
|
|
112
|
+
min-width: ${({ $width }) => `${$width - 2}px`};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&::part(icon) {
|
|
116
|
+
--icon-color: var(--cpsl-color-text-primary);
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
const SelectItem = safeStyled(CpslSelectItem)`
|
|
120
|
+
--outer-container-padding-start: 0px;
|
|
121
|
+
--outer-container-padding-end: 0px;
|
|
122
|
+
--outer-container-padding-top: 0px;
|
|
123
|
+
--outer-container-padding-bottom: 0px;
|
|
124
|
+
--container-padding-start: 12px;
|
|
125
|
+
--container-padding-end: 12px;
|
|
126
|
+
--container-padding-top: 8px;
|
|
127
|
+
--container-padding-bottom: 8px;
|
|
128
|
+
`;
|
|
129
|
+
const SelectContainer = safeStyled.div`
|
|
130
|
+
position: relative;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 8px;
|
|
134
|
+
border-radius: var(--cpsl-border-radius-tile-button);
|
|
135
|
+
background-color: var(--cpsl-color-background-4);
|
|
136
|
+
`;
|
|
137
|
+
const WalletTypeIcon = safeStyled(common.WalletTypeIcon)`
|
|
138
|
+
--border: 1px solid var(--cpsl-color-background-8);
|
|
139
|
+
--background: var(--cpsl-color-background-0);
|
|
140
|
+
--border-radius: 4px;
|
|
141
|
+
`;
|
|
142
|
+
const CopyButton = safeStyled(CpslButton)`
|
|
143
|
+
cpsl-icon {
|
|
144
|
+
--height: 24px;
|
|
145
|
+
--width: 24px;
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
export {
|
|
149
|
+
Select,
|
|
150
|
+
SelectContainer,
|
|
151
|
+
SelectItem,
|
|
152
|
+
WalletSelect
|
|
153
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
-
import { Network, OnRampAsset, TLinkedAccountType } from '@getpara/web-sdk';
|
|
3
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
+
import { Network, OnRampAsset, TExternalWallet, TLinkedAccountType, TWalletType } from '@getpara/web-sdk';
|
|
3
|
+
import { ComponentProps, PropsWithChildren } from 'react';
|
|
4
4
|
export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
5
|
export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
6
|
export declare const InfoBoxContent: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -14,7 +14,7 @@ export declare const StepContainer: import("styled-components/dist/types.js").IS
|
|
|
14
14
|
}, {
|
|
15
15
|
$wide?: boolean;
|
|
16
16
|
}>> & string;
|
|
17
|
-
export declare const Heading: typeof CpslText;
|
|
17
|
+
export declare const Heading: ({ children, ...props }: PropsWithChildren & ComponentProps<typeof CpslText>) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export declare const StyledCpslTileButton: typeof CpslTileButton;
|
|
19
19
|
export declare const HeroIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
20
20
|
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|
|
@@ -37,6 +37,11 @@ export declare function NetworkIcon({ network, size }: {
|
|
|
37
37
|
network: Network;
|
|
38
38
|
size?: string;
|
|
39
39
|
}): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function WalletTypeIcon({ className, walletType, externalWallet, ...props }: {
|
|
41
|
+
className?: string;
|
|
42
|
+
walletType: TWalletType;
|
|
43
|
+
externalWallet?: TExternalWallet | string;
|
|
44
|
+
} & Parameters<typeof CpslIcon>[0]): import("react/jsx-runtime").JSX.Element;
|
|
40
45
|
export declare const ErrorContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
41
46
|
export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
42
47
|
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|