@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.
@@ -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:-.25em;width:calc(100% + .5em)}.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
+ .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:3.5em;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:4em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-md___p44a4{height:3.5em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-sm___U8ILi{padding-left:2em;padding-right:2em;height:3em}.IframeButton-module__iframe-button___XeAhH.IframeButton-module__size-xs___S2jGa{padding-left:1.5em;padding-right:1.5em;height:2.5em}.IframeButton-module__loading-skeleton___fzBol{border-radius:var(--cdp-web-borderRadius-cta);width:calc(100% - .5em);height:calc(100% - .5em);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-cta);font-weight:500;top:-999px;left:-999px;width:1px;height:1px}.IframeButton-module__computed-style___ciB13 canvas{width:100%;height:100%}
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 I } from "@coinbase/cdp-hooks";
3
- import { useRef as T, useState as j, useCallback as k, useEffect as w } from "react";
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 E } from "../ui/IframeButton/index.js";
6
- import { useKeyExportPostMessage as K } from "../../hooks/useKeyExportPostMessage.js";
7
- import "@coinbase/cdp-core";
8
- const D = ({
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: r = !0,
13
+ icon: e = !0,
13
14
  fullWidth: u,
14
- label: o = "Copy key",
15
- onReady: m,
16
- onSuccess: i,
17
- onError: f,
18
- size: h,
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: C, secureIframeBasePath: g }
24
- } = I(), s = T(null), [e, y] = j(void 0), P = k(
25
- (t, x) => {
26
- t === "ready" && m?.(), t === "success" && i?.(), t === "error" && f?.(x);
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
- [m, i, f]
29
- ), { iframeUrl: b, isPending: v, onThemeChange: a } = K({
44
+ [r, s, a, o]
45
+ ), { iframeUrl: x, isPending: I } = T({
30
46
  address: p,
31
47
  type: "evm",
32
- projectId: C,
33
- label: o,
34
- basePath: g,
48
+ projectId: y,
49
+ label: t,
50
+ basePath: b,
35
51
  copiedLabel: c,
36
- icon: r,
37
- iframeRef: s,
38
- onStatusUpdate: P,
39
- theme: e
52
+ icon: e,
53
+ iframeRef: m,
54
+ onStatusUpdate: v,
55
+ theme: h
40
56
  });
41
- return w(() => {
42
- e && a(e);
43
- }, [e, a]), /* @__PURE__ */ B(
44
- E,
57
+ return C ? null : /* @__PURE__ */ B(
58
+ K,
45
59
  {
46
- ref: s,
47
- src: b,
60
+ "data-testid": "copy-evm-key-button",
61
+ ref: m,
62
+ src: x,
48
63
  allow: "clipboard-read; clipboard-write",
49
- isPending: v,
50
- label: o,
51
- icon: r,
64
+ isPending: I,
65
+ label: t,
66
+ icon: e,
52
67
  fullWidth: u,
53
- onThemeChange: y,
54
- size: h,
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
- D as CopyEvmKeyButton
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 I } from "react/jsx-runtime";
2
- import { useConfig as T } from "@coinbase/cdp-hooks";
3
- import { useRef as j, useState as k, useCallback as w, useEffect as K } from "react";
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 S } from "../ui/IframeButton/index.js";
6
- import { useKeyExportPostMessage as U } from "../../hooks/useKeyExportPostMessage.js";
7
- import "@coinbase/cdp-core";
8
- const D = ({
9
- address: n,
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: t = !0,
13
+ icon: e = !0,
13
14
  fullWidth: u,
14
- label: r = "Copy key",
15
- onReady: m,
16
- onSuccess: a,
17
- onError: i,
18
- size: h,
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: C, secureIframeBasePath: g }
24
- } = T(), s = j(null), [e, y] = k(void 0), P = w(
25
- (o, B) => {
26
- o === "ready" && m?.(), o === "success" && a?.(), o === "error" && i?.(B);
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
- [m, a, i]
29
- ), { iframeUrl: b, isPending: x, onThemeChange: f } = U({
30
- address: n,
44
+ [o, s, a, r]
45
+ ), { iframeUrl: I, isPending: P } = v({
46
+ address: m,
31
47
  type: "solana",
32
- projectId: C,
33
- label: r,
34
- basePath: g,
48
+ projectId: y,
49
+ label: t,
50
+ basePath: b,
35
51
  copiedLabel: c,
36
- icon: t,
37
- iframeRef: s,
38
- onStatusUpdate: P,
39
- theme: e
52
+ icon: e,
53
+ iframeRef: n,
54
+ onStatusUpdate: x,
55
+ theme: h
40
56
  });
41
- return K(() => {
42
- e && f(e);
43
- }, [e, f]), /* @__PURE__ */ I(
44
- S,
57
+ return C ? null : /* @__PURE__ */ B(
58
+ U,
45
59
  {
46
- ref: s,
47
- src: b,
60
+ "data-testid": "copy-solana-key-button",
61
+ ref: n,
62
+ src: I,
48
63
  allow: "clipboard-read; clipboard-write",
49
- isPending: x,
50
- label: r,
51
- icon: t,
64
+ isPending: P,
65
+ label: t,
66
+ icon: e,
52
67
  fullWidth: u,
53
- onThemeChange: y,
54
- size: h,
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
- D as CopySolanaKeyButton
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, };