@coinbase/cdp-react 0.0.67 → 0.0.69
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/assets/ExportWallet.css +1 -1
- package/dist/assets/IframeButton.css +1 -1
- package/dist/components/CopyEvmKeyButton/index.d.ts +2 -1
- package/dist/components/CopyEvmKeyButton/index.js +52 -37
- package/dist/components/CopySolanaKeyButton/index.d.ts +2 -1
- package/dist/components/CopySolanaKeyButton/index.js +55 -40
- package/dist/components/ExportWallet/index.d.ts +13 -3
- package/dist/components/ExportWallet/index.js +185 -155
- package/dist/components/ExportWalletModal/index.d.ts +3 -3
- package/dist/components/ExportWalletModal/index.js +7 -6
- package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +1 -2
- package/dist/components/Fund/utils/setupOnrampEventListeners.js +10 -12
- package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +2 -2
- package/dist/components/Fund/utils/subscribeToWindowMessage.js +11 -11
- package/dist/components/ui/IframeButton/index.js +107 -81
- package/dist/components/ui/SwitchFadeTransition/index.d.ts +1 -1
- package/dist/components/ui/SwitchSlideTransition/index.d.ts +1 -1
- package/dist/hooks/useKeyExportPostMessage.d.ts +2 -22
- package/dist/hooks/useKeyExportPostMessage.js +57 -63
- package/dist/index.js +1 -1
- package/dist/theme/theme.d.ts +8 -0
- package/dist/theme/tokens.d.ts +24 -0
- package/dist/theme/tokens.js +28 -17
- package/dist/types/secureIframe.d.ts +24 -5
- package/dist/types/secureIframe.js +7 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
.ExportWallet-module__export-wallet___EyZys{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;gap:1em;padding:1.5em 1.5em 1em;overflow:hidden;width:100%}.ExportWallet-module__export-wallet___EyZys.ExportWallet-module__no-footer___fzl3R{padding-bottom:1.5em}.ExportWallet-module__export-wallet___EyZys [data-part=iframe-button]{margin
|
|
1
|
+
.ExportWallet-module__export-wallet___EyZys{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;gap:1em;padding:1.5em 1.5em 1em;overflow:hidden;width:100%}.ExportWallet-module__export-wallet___EyZys.ExportWallet-module__no-footer___fzl3R{padding-bottom:1.5em}.ExportWallet-module__export-wallet___EyZys [data-part=iframe-button]{margin:-2px;width:calc(100% + 4px)}.ExportWallet-module__export-wallet___EyZys *{box-sizing:border-box}.ExportWallet-module__export-wallet-title___MuI09{font-size:1em;line-height:1.1;font-weight:600;margin:0}.ExportWallet-module__footer___NvrFY{padding-left:0;padding-right:0}.ExportWalletModal-module__export-wallet___--L56{height:100%;overflow:hidden;gap:0}.ExportWalletModal-module__trigger___zMk8N{padding-left:2em;padding-right:2em}.ExportWalletModal-module__title-bar___RTPZq{display:flex;justify-content:space-between;align-items:center;margin-bottom:1em;width:100%}.ExportWalletModal-module__content___KzNol{display:flex;flex-direction:column;gap:1em}.ExportWalletModal-module__close-button___ImsDR{padding:0}.ExportWalletModal-module__close-icon___iAfyT{height:1.5em;width:1.5em}.ExportWalletModal-module__footer___byg1T{padding:.75em 0 0}@media (min-width: 450px){.ExportWalletModal-module__modal___pX1AP{max-width:25em}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.IframeButton-module__iframe-button___XeAhH{position:relative;width:min-content;height:
|
|
1
|
+
.IframeButton-module__iframe-button___XeAhH{position:relative;width:min-content;height:calc(3em + 4px);padding-left:2.5em;padding-right:2.5em}.IframeButton-module__iframe-button___XeAhH>*{grid-area:center}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__full-width___lQWpM{width:100%}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-lg___HCOiF{height:calc(3.5em + 4px)}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-md___p44a4{height:calc(3em + 4px)}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-sm___U8ILi{padding-left:2em;padding-right:2em;height:calc(2.5em + 4px)}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-xs___S2jGa{padding-left:1.5em;padding-right:1.5em;height:calc(2em + 4px)}.IframeButton-module__loading-skeleton___fzBol{border-radius:var(--cdp-web-borderRadius-cta);width:calc(100% - 4px);height:calc(100% - 4px);position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__label___Vvl8W{visibility:hidden;white-space:nowrap;position:relative}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__with-icon___KBiq1 .IframeButton-module__label___Vvl8W{padding-left:1em}.IframeButton-module__iframe___0RBLL{border:none;width:100%;height:100%;position:absolute;top:50%;left:50%;transform:translate3d(-50%,-50%,0)}.IframeButton-module__iframe___0RBLL.IframeButton-module__hidden___LcF1X{display:none}.IframeButton-module__computed-style___ciB13{position:absolute;visibility:hidden;pointer-events:none;background-color:var(--cdp-web-colors-page-bg-default);border-radius:var(--cdp-web-borderRadius-cta);font-size:var(--cdp-web-font-size-base);font-family:var(--cdp-web-font-family-iframe, var(--cdp-web-font-family-cta));font-weight:500;top:-999px;left:-999px;width:1px;height:1px}.IframeButton-module__computed-style___ciB13 canvas{width:100%;height:100%}
|
|
@@ -7,10 +7,11 @@ interface CopyEvmKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth">
|
|
|
7
7
|
icon?: boolean;
|
|
8
8
|
label?: string;
|
|
9
9
|
onReady?: () => void;
|
|
10
|
+
onSessionExpired?: () => void;
|
|
10
11
|
onSuccess?: () => void;
|
|
11
12
|
onError?: (error?: string) => void;
|
|
12
13
|
theme?: Partial<IframeTheme>;
|
|
13
14
|
variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
|
|
14
15
|
}
|
|
15
|
-
declare const CopyEvmKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, theme: themeOverrides, variant, }: CopyEvmKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const CopyEvmKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSessionExpired, onSuccess, onError, size, theme: themeOverrides, variant, }: CopyEvmKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
17
|
export { CopyEvmKeyButton, type CopyEvmKeyButtonProps };
|
|
@@ -1,57 +1,72 @@
|
|
|
1
1
|
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
2
|
+
import { useConfig as S } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { u as _ } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
4
|
+
import { useRef as j, useState as i, useCallback as E } from "react";
|
|
4
5
|
import "../ui/Button/index.js";
|
|
5
|
-
import { IframeButton as
|
|
6
|
-
import { useKeyExportPostMessage as
|
|
7
|
-
import "
|
|
8
|
-
const
|
|
6
|
+
import { IframeButton as K } from "../ui/IframeButton/index.js";
|
|
7
|
+
import { useKeyExportPostMessage as T } from "../../hooks/useKeyExportPostMessage.js";
|
|
8
|
+
import "../../types/secureIframe.js";
|
|
9
|
+
const F = ({
|
|
9
10
|
address: p,
|
|
10
11
|
className: n = "",
|
|
11
12
|
copiedLabel: c = "Copied",
|
|
12
|
-
icon:
|
|
13
|
+
icon: e = !0,
|
|
13
14
|
fullWidth: u,
|
|
14
|
-
label:
|
|
15
|
-
onReady:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
label: t = "Copy key",
|
|
16
|
+
onReady: r,
|
|
17
|
+
onSessionExpired: o,
|
|
18
|
+
onSuccess: s,
|
|
19
|
+
onError: a,
|
|
20
|
+
size: f,
|
|
19
21
|
theme: d,
|
|
20
22
|
variant: l
|
|
21
23
|
}) => {
|
|
24
|
+
_("copy_evm_key_button");
|
|
22
25
|
const {
|
|
23
|
-
config: { projectId:
|
|
24
|
-
} =
|
|
25
|
-
(
|
|
26
|
-
|
|
26
|
+
config: { projectId: y, secureIframeBasePath: b }
|
|
27
|
+
} = S(), m = j(null), [h, k] = i(void 0), [C, g] = i(!1), v = E(
|
|
28
|
+
(P, w) => {
|
|
29
|
+
switch (P) {
|
|
30
|
+
case "ready":
|
|
31
|
+
r?.();
|
|
32
|
+
break;
|
|
33
|
+
case "success":
|
|
34
|
+
s?.();
|
|
35
|
+
break;
|
|
36
|
+
case "error":
|
|
37
|
+
a?.(w);
|
|
38
|
+
break;
|
|
39
|
+
case "expired":
|
|
40
|
+
g(!0), o?.();
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
27
43
|
},
|
|
28
|
-
[
|
|
29
|
-
), { iframeUrl:
|
|
44
|
+
[r, s, a, o]
|
|
45
|
+
), { iframeUrl: x, isPending: I } = T({
|
|
30
46
|
address: p,
|
|
31
47
|
type: "evm",
|
|
32
|
-
projectId:
|
|
33
|
-
label:
|
|
34
|
-
basePath:
|
|
48
|
+
projectId: y,
|
|
49
|
+
label: t,
|
|
50
|
+
basePath: b,
|
|
35
51
|
copiedLabel: c,
|
|
36
|
-
icon:
|
|
37
|
-
iframeRef:
|
|
38
|
-
onStatusUpdate:
|
|
39
|
-
theme:
|
|
52
|
+
icon: e,
|
|
53
|
+
iframeRef: m,
|
|
54
|
+
onStatusUpdate: v,
|
|
55
|
+
theme: h
|
|
40
56
|
});
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
}, [e, a]), /* @__PURE__ */ B(
|
|
44
|
-
E,
|
|
57
|
+
return C ? null : /* @__PURE__ */ B(
|
|
58
|
+
K,
|
|
45
59
|
{
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
"data-testid": "copy-evm-key-button",
|
|
61
|
+
ref: m,
|
|
62
|
+
src: x,
|
|
48
63
|
allow: "clipboard-read; clipboard-write",
|
|
49
|
-
isPending:
|
|
50
|
-
label:
|
|
51
|
-
icon:
|
|
64
|
+
isPending: I,
|
|
65
|
+
label: t,
|
|
66
|
+
icon: e,
|
|
52
67
|
fullWidth: u,
|
|
53
|
-
onThemeChange:
|
|
54
|
-
size:
|
|
68
|
+
onThemeChange: k,
|
|
69
|
+
size: f,
|
|
55
70
|
theme: d,
|
|
56
71
|
variant: l,
|
|
57
72
|
className: n
|
|
@@ -59,5 +74,5 @@ const D = ({
|
|
|
59
74
|
);
|
|
60
75
|
};
|
|
61
76
|
export {
|
|
62
|
-
|
|
77
|
+
F as CopyEvmKeyButton
|
|
63
78
|
};
|
|
@@ -7,10 +7,11 @@ interface CopySolanaKeyButtonProps extends Pick<ButtonProps, "size" | "fullWidth
|
|
|
7
7
|
icon?: boolean;
|
|
8
8
|
label?: string;
|
|
9
9
|
onReady?: () => void;
|
|
10
|
+
onSessionExpired?: () => void;
|
|
10
11
|
onSuccess?: () => void;
|
|
11
12
|
onError?: (error?: string) => void;
|
|
12
13
|
theme?: Partial<IframeTheme>;
|
|
13
14
|
variant?: Extract<ButtonProps["variant"], "primary" | "secondary">;
|
|
14
15
|
}
|
|
15
|
-
declare const CopySolanaKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSuccess, onError, size, theme: themeOverrides, variant, }: CopySolanaKeyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const CopySolanaKeyButton: ({ address, className, copiedLabel, icon, fullWidth, label, onReady, onSessionExpired, onSuccess, onError, size, theme: themeOverrides, variant, }: CopySolanaKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
17
|
export { CopySolanaKeyButton, type CopySolanaKeyButtonProps };
|
|
@@ -1,57 +1,72 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
2
|
+
import { useConfig as _ } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { u as j } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
4
|
+
import { useRef as K, useState as i, useCallback as T } from "react";
|
|
4
5
|
import "../ui/Button/index.js";
|
|
5
|
-
import { IframeButton as
|
|
6
|
-
import { useKeyExportPostMessage as
|
|
7
|
-
import "
|
|
8
|
-
const
|
|
9
|
-
address:
|
|
6
|
+
import { IframeButton as U } from "../ui/IframeButton/index.js";
|
|
7
|
+
import { useKeyExportPostMessage as v } from "../../hooks/useKeyExportPostMessage.js";
|
|
8
|
+
import "../../types/secureIframe.js";
|
|
9
|
+
const F = ({
|
|
10
|
+
address: m,
|
|
10
11
|
className: p = "",
|
|
11
12
|
copiedLabel: c = "Copied",
|
|
12
|
-
icon:
|
|
13
|
+
icon: e = !0,
|
|
13
14
|
fullWidth: u,
|
|
14
|
-
label:
|
|
15
|
-
onReady:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
label: t = "Copy key",
|
|
16
|
+
onReady: o,
|
|
17
|
+
onSessionExpired: r,
|
|
18
|
+
onSuccess: s,
|
|
19
|
+
onError: a,
|
|
20
|
+
size: f,
|
|
19
21
|
theme: l,
|
|
20
22
|
variant: d
|
|
21
23
|
}) => {
|
|
24
|
+
j("copy_solana_key_button");
|
|
22
25
|
const {
|
|
23
|
-
config: { projectId:
|
|
24
|
-
} =
|
|
25
|
-
(
|
|
26
|
-
|
|
26
|
+
config: { projectId: y, secureIframeBasePath: b }
|
|
27
|
+
} = _(), n = K(null), [h, k] = i(void 0), [C, g] = i(!1), x = T(
|
|
28
|
+
(S, w) => {
|
|
29
|
+
switch (S) {
|
|
30
|
+
case "ready":
|
|
31
|
+
o?.();
|
|
32
|
+
break;
|
|
33
|
+
case "success":
|
|
34
|
+
s?.();
|
|
35
|
+
break;
|
|
36
|
+
case "error":
|
|
37
|
+
a?.(w);
|
|
38
|
+
break;
|
|
39
|
+
case "expired":
|
|
40
|
+
g(!0), r?.();
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
27
43
|
},
|
|
28
|
-
[
|
|
29
|
-
), { iframeUrl:
|
|
30
|
-
address:
|
|
44
|
+
[o, s, a, r]
|
|
45
|
+
), { iframeUrl: I, isPending: P } = v({
|
|
46
|
+
address: m,
|
|
31
47
|
type: "solana",
|
|
32
|
-
projectId:
|
|
33
|
-
label:
|
|
34
|
-
basePath:
|
|
48
|
+
projectId: y,
|
|
49
|
+
label: t,
|
|
50
|
+
basePath: b,
|
|
35
51
|
copiedLabel: c,
|
|
36
|
-
icon:
|
|
37
|
-
iframeRef:
|
|
38
|
-
onStatusUpdate:
|
|
39
|
-
theme:
|
|
52
|
+
icon: e,
|
|
53
|
+
iframeRef: n,
|
|
54
|
+
onStatusUpdate: x,
|
|
55
|
+
theme: h
|
|
40
56
|
});
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
}, [e, f]), /* @__PURE__ */ I(
|
|
44
|
-
S,
|
|
57
|
+
return C ? null : /* @__PURE__ */ B(
|
|
58
|
+
U,
|
|
45
59
|
{
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
"data-testid": "copy-solana-key-button",
|
|
61
|
+
ref: n,
|
|
62
|
+
src: I,
|
|
48
63
|
allow: "clipboard-read; clipboard-write",
|
|
49
|
-
isPending:
|
|
50
|
-
label:
|
|
51
|
-
icon:
|
|
64
|
+
isPending: P,
|
|
65
|
+
label: t,
|
|
66
|
+
icon: e,
|
|
52
67
|
fullWidth: u,
|
|
53
|
-
onThemeChange:
|
|
54
|
-
size:
|
|
68
|
+
onThemeChange: k,
|
|
69
|
+
size: f,
|
|
55
70
|
theme: l,
|
|
56
71
|
variant: d,
|
|
57
72
|
className: p
|
|
@@ -59,5 +74,5 @@ const D = ({
|
|
|
59
74
|
);
|
|
60
75
|
};
|
|
61
76
|
export {
|
|
62
|
-
|
|
77
|
+
F as CopySolanaKeyButton
|
|
63
78
|
};
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import { ElementType, HTMLAttributes } from 'react';
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { CopyAddressProps } from '../CopyAddress';
|
|
3
3
|
import { CopyEvmKeyButtonProps } from '../CopyEvmKeyButton';
|
|
4
4
|
interface ExportWalletTitleProps extends HTMLAttributes<HTMLElement> {
|
|
5
5
|
as?: ElementType;
|
|
6
6
|
}
|
|
7
|
-
interface ExportWalletProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
interface ExportWalletProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
8
|
+
children?: ReactNode | ((props: {
|
|
9
|
+
type: ExportWalletContext["type"];
|
|
10
|
+
isSessionExpired: ExportWalletContext["isSessionExpired"];
|
|
11
|
+
}) => ReactNode);
|
|
8
12
|
address: string;
|
|
9
13
|
onIframeReady?: () => void;
|
|
10
14
|
onCopySuccess?: () => void;
|
|
11
15
|
onIframeError?: (error?: string) => void;
|
|
16
|
+
onIframeSessionExpired?: () => void;
|
|
17
|
+
}
|
|
18
|
+
interface ExportWalletContext extends Pick<ExportWalletProps, "address" | "onIframeReady" | "onCopySuccess" | "onIframeError" | "onIframeSessionExpired"> {
|
|
19
|
+
type: "evm-eoa" | "evm-smart" | "solana";
|
|
20
|
+
isSessionExpired: boolean;
|
|
12
21
|
}
|
|
13
22
|
type ExportWalletCopyAddressProps = Omit<CopyAddressProps, "address">;
|
|
14
23
|
type ExportWalletCopyKeyButtonProps = Omit<CopyEvmKeyButtonProps, "address" | "onError" | "onReady" | "onSuccess">;
|
|
24
|
+
declare const ExportWalletContext: import('react').Context<ExportWalletContext>;
|
|
15
25
|
declare const ExportWalletTitle: ({ children, className, as: Component, ...props }: ExportWalletTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
26
|
declare const ExportWalletWarning: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
17
27
|
declare const ExportWalletCopyAddress: ({ label, ...props }: ExportWalletCopyAddressProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
28
|
declare const ExportWalletCopyKeyButton: ({ fullWidth, ...props }: ExportWalletCopyKeyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
29
|
declare const ExportWalletFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
declare const ExportWallet: ({ address, children, className, onIframeError, onIframeReady, onCopySuccess, ...props }: ExportWalletProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const ExportWallet: ({ address, children, className, onIframeError, onIframeReady, onIframeSessionExpired, onCopySuccess, ...props }: ExportWalletProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
31
|
export { ExportWallet, ExportWalletCopyAddress, ExportWalletCopyKeyButton, ExportWalletFooter, ExportWalletTitle, ExportWalletWarning, type ExportWalletProps, type ExportWalletCopyAddressProps, type ExportWalletCopyKeyButtonProps, type ExportWalletTitleProps, };
|