@coinbase/cdp-react 0.0.72 → 0.0.74

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.
@@ -5,7 +5,7 @@ import { useRef as j, useState as i, useCallback as E } from "react";
5
5
  import "../ui/Button/index.js";
6
6
  import { IframeButton as K } from "../ui/IframeButton/index.js";
7
7
  import { useKeyExportPostMessage as T } from "../../hooks/useKeyExportPostMessage.js";
8
- import "../../types/secureIframe.js";
8
+ import "@coinbase/cdp-core";
9
9
  const F = ({
10
10
  address: p,
11
11
  className: n = "",
@@ -5,7 +5,7 @@ import { useRef as K, useState as i, useCallback as T } from "react";
5
5
  import "../ui/Button/index.js";
6
6
  import { IframeButton as U } from "../ui/IframeButton/index.js";
7
7
  import { useKeyExportPostMessage as v } from "../../hooks/useKeyExportPostMessage.js";
8
- import "../../types/secureIframe.js";
8
+ import "@coinbase/cdp-core";
9
9
  const F = ({
10
10
  address: m,
11
11
  className: p = "",
@@ -51,7 +51,7 @@ import "../../utils/isApiError.js";
51
51
  import "../../utils/isEmailInvalid.js";
52
52
  import "../../utils/parseValuesFromPhoneNumber.js";
53
53
  import "../../utils/sendIframeMessage.js";
54
- import "../../types/secureIframe.js";
54
+ import "@coinbase/cdp-core";
55
55
  import "../Fund/FundForm.js";
56
56
  import "../Fund/FundTitle.js";
57
57
  import "../Fund/FundProvider.js";
@@ -1,11 +1,11 @@
1
- import { jsxs as y, jsx as _ } from "react/jsx-runtime";
2
- import { c as S } from "../../../chunks/lite.1fxw3LjI.js";
3
- import { forwardRef as v, useRef as F, useMemo as T, useState as $, useEffect as I } from "react";
4
- import { useTheme as H } from "../../ThemeProvider/index.js";
5
- import { LoadingSkeleton as R } from "../LoadingSkeleton/index.js";
1
+ import { jsxs as H, jsx as B } from "react/jsx-runtime";
2
+ import { c as F } from "../../../chunks/lite.1fxw3LjI.js";
3
+ import { forwardRef as R, useRef as y, useMemo as C, useState as U, useEffect as T } from "react";
4
+ import { useTheme as L } from "../../ThemeProvider/index.js";
5
+ import { LoadingSkeleton as W } from "../LoadingSkeleton/index.js";
6
6
  import "../../../theme/theme.js";
7
- import { colorsBase as l } from "../../../theme/tokens.js";
8
- import '../../../assets/IframeButton.css';const C = "IframeButton-module__label___Vvl8W", U = "IframeButton-module__iframe___0RBLL", L = "IframeButton-module__hidden___LcF1X", s = {
7
+ import { colorsBase as i } from "../../../theme/tokens.js";
8
+ import '../../../assets/IframeButton.css';const N = "IframeButton-module__label___Vvl8W", P = "IframeButton-module__iframe___0RBLL", j = "IframeButton-module__hidden___LcF1X", s = {
9
9
  "iframe-button": "IframeButton-module__iframe-button___XeAhH",
10
10
  "full-width": "IframeButton-module__full-width___lQWpM",
11
11
  "size-lg": "IframeButton-module__size-lg___HCOiF",
@@ -13,153 +13,154 @@ import '../../../assets/IframeButton.css';const C = "IframeButton-module__label_
13
13
  "size-sm": "IframeButton-module__size-sm___U8ILi",
14
14
  "size-xs": "IframeButton-module__size-xs___S2jGa",
15
15
  "loading-skeleton": "IframeButton-module__loading-skeleton___fzBol",
16
- label: C,
16
+ label: N,
17
17
  "with-icon": "IframeButton-module__with-icon___KBiq1",
18
- iframe: U,
19
- hidden: L,
18
+ iframe: P,
19
+ hidden: j,
20
20
  "computed-style": "IframeButton-module__computed-style___ciB13"
21
- }, W = {
22
- pageBg: l.white,
23
- buttonBg: l.blue500,
21
+ }, k = {
22
+ pageBg: i.white,
23
+ buttonBg: i.blue500,
24
24
  buttonBgHover: "#0748d6",
25
25
  buttonBgPressed: "#0b3eae",
26
- buttonBgFocus: l.blue550,
27
- buttonBorder: l.blue550,
26
+ buttonBgFocus: i.blue550,
27
+ buttonBorder: i.blue550,
28
28
  buttonBorderHover: "#0748d6",
29
29
  buttonBorderPressed: "#0b3eae",
30
- buttonBorderFocus: l.blue550,
31
- buttonBorderFocusInset: l.white,
32
- buttonText: l.white,
33
- buttonTextHover: l.white,
34
- buttonTextPressed: l.white,
35
- buttonTextFocus: l.white,
30
+ buttonBorderFocus: i.blue550,
31
+ buttonBorderFocusInset: i.white,
32
+ buttonText: i.white,
33
+ buttonTextHover: i.white,
34
+ buttonTextPressed: i.white,
35
+ buttonTextFocus: i.white,
36
36
  buttonBorderRadius: 99999,
37
37
  buttonFontSize: 16,
38
38
  buttonFontWeight: 500,
39
39
  buttonSize: "md",
40
40
  fontUrl: "",
41
41
  fontFamily: ""
42
- }, N = Object.keys(W), P = (n) => N.every(
43
- (e) => e === "fontUrl" || e === "buttonSize" ? !0 : n[e] !== void 0
44
- ), f = (n, e, t) => (e.style.backgroundColor = `var(--cdp-web-${n})`, k(getComputedStyle(e).backgroundColor, t)), k = (n, e) => {
45
- if (!n || typeof n != "string")
46
- return console.warn("Invalid color input:", n), "";
47
- const t = n.trim();
42
+ }, $ = Object.keys(k), q = (o) => $.every(
43
+ (e) => e === "fontUrl" || e === "buttonSize" ? !0 : o[e] !== void 0
44
+ ), v = (o, e) => o === e ? !0 : !o || !e ? !1 : $.every((t) => o[t] === e[t]), f = (o, e, t) => (e.style.backgroundColor = `var(--cdp-web-${o})`, A(getComputedStyle(e).backgroundColor, t)), A = (o, e) => {
45
+ if (!o || typeof o != "string")
46
+ return console.warn("Invalid color input:", o), "";
47
+ const t = o.trim();
48
48
  if (t.startsWith("#"))
49
49
  return /^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(t) ? t.toLowerCase() : (console.warn("Invalid hex color:", t), "");
50
50
  if (t === "transparent") return "transparent";
51
51
  if (t === "none") return "none";
52
- const o = e.getContext("2d", { willReadFrequently: !0 });
53
- if (!o)
52
+ const r = e.getContext("2d", { willReadFrequently: !0 });
53
+ if (!r)
54
54
  return console.warn("Could not create canvas context"), "";
55
- if (o.fillStyle = t, o.fillStyle.startsWith("#"))
56
- return o.fillStyle.toLowerCase();
57
- o.fillRect(0, 0, 1, 1);
58
- const a = o.getImageData(0, 0, 1, 1), [m, r, c, i] = a.data, d = m.toString(16).padStart(2, "0"), u = r.toString(16).padStart(2, "0"), g = c.toString(16).padStart(2, "0");
59
- if (i < 255) {
60
- const b = i.toString(16).padStart(2, "0");
61
- return `#${d}${u}${g}${b}`;
55
+ if (r.fillStyle = t, r.fillStyle.startsWith("#"))
56
+ return r.fillStyle.toLowerCase();
57
+ r.fillRect(0, 0, 1, 1);
58
+ const a = r.getImageData(0, 0, 1, 1), [m, n, c, l] = a.data, d = m.toString(16).padStart(2, "0"), u = n.toString(16).padStart(2, "0"), _ = c.toString(16).padStart(2, "0");
59
+ if (l < 255) {
60
+ const b = l.toString(16).padStart(2, "0");
61
+ return `#${d}${u}${_}${b}`;
62
62
  }
63
- return `#${d}${u}${g}`;
64
- }, j = (n, e, t, o) => {
65
- const a = getComputedStyle(t), m = f("colors-page-bg-default", t, o), r = f(`colors-cta-${e}-bg-default`, t, o), c = f(`colors-cta-${e}-bg-hover`, t, o), i = f(`colors-cta-${e}-bg-pressed`, t, o), d = f(`colors-cta-${e}-text-default`, t, o);
63
+ return `#${d}${u}${_}`;
64
+ }, M = (o, e, t, r) => {
65
+ const a = getComputedStyle(t), m = f("colors-page-bg-default", t, r), n = f(`colors-cta-${e}-bg-default`, t, r), c = f(`colors-cta-${e}-bg-hover`, t, r), l = f(`colors-cta-${e}-bg-pressed`, t, r), d = f(`colors-cta-${e}-text-default`, t, r);
66
66
  return {
67
67
  pageBg: m,
68
- buttonBg: r,
68
+ buttonBg: n,
69
69
  buttonBgHover: c,
70
- buttonBgPressed: i,
71
- buttonBgFocus: r,
72
- buttonBorder: r,
70
+ buttonBgPressed: l,
71
+ buttonBgFocus: n,
72
+ buttonBorder: n,
73
73
  buttonBorderHover: c,
74
- buttonBorderPressed: i,
75
- buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t, o),
74
+ buttonBorderPressed: l,
75
+ buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t, r),
76
76
  buttonBorderFocusInset: m,
77
77
  buttonBorderRadius: parseInt(a.borderRadius),
78
78
  buttonFontSize: parseInt(a.fontSize),
79
79
  buttonFontWeight: parseInt(a.fontWeight),
80
80
  buttonText: d,
81
- buttonTextHover: f(`colors-cta-${e}-text-hover`, t, o),
81
+ buttonTextHover: f(`colors-cta-${e}-text-hover`, t, r),
82
82
  buttonTextPressed: d,
83
83
  buttonTextFocus: d,
84
- buttonSize: n ?? "md",
84
+ buttonSize: o ?? "md",
85
85
  fontFamily: a.fontFamily,
86
86
  fontUrl: ""
87
87
  };
88
- }, A = {
88
+ }, V = {
89
89
  xs: s["size-xs"],
90
90
  sm: s["size-sm"],
91
91
  md: s["size-md"],
92
92
  lg: s["size-lg"]
93
- }, M = v(
93
+ }, D = R(
94
94
  ({
95
- className: n = "",
95
+ className: o = "",
96
96
  isPending: e,
97
97
  label: t,
98
- icon: o,
98
+ icon: r,
99
99
  fullWidth: a,
100
100
  size: m,
101
- theme: r,
101
+ theme: n,
102
102
  onThemeChange: c,
103
- ...i
103
+ ...l
104
104
  }, d) => {
105
- const u = m === "none" ? "md" : m, { theme: g } = H(), b = g["font-url-iframe"], p = F(null), h = F(null), B = T(() => !!r && P(r), [r]), [x, z] = $(
106
- B ? {
107
- ...r,
108
- fontUrl: r?.fontUrl ?? b,
105
+ const u = m === "none" ? "md" : m, { theme: _ } = L(), b = _["font-url-iframe"], p = y(null), x = y(null), h = C(() => !!n && q(n), [n]), [S, z] = U(
106
+ h ? {
107
+ ...n,
108
+ fontUrl: n?.fontUrl ?? b,
109
109
  buttonSize: u ?? "md"
110
110
  } : void 0
111
111
  );
112
- return I(() => {
113
- if (B) {
114
- z({
115
- ...r,
116
- fontUrl: r?.fontUrl ?? b,
112
+ return T(() => {
113
+ if (h) {
114
+ const g = {
115
+ ...n,
116
+ fontUrl: n?.fontUrl ?? b,
117
117
  buttonSize: u ?? "md"
118
- });
118
+ };
119
+ z((w) => v(g, w) ? w : g);
119
120
  return;
120
121
  }
121
- if (!p.current || !h.current) return;
122
- const w = j(
123
- u ?? "md",
124
- i.variant ?? "primary",
125
- p.current,
126
- h.current
127
- );
128
- z({
129
- ...w,
122
+ if (!p.current || !x.current) return;
123
+ const I = {
124
+ ...M(
125
+ u ?? "md",
126
+ l.variant ?? "primary",
127
+ p.current,
128
+ x.current
129
+ ),
130
130
  fontUrl: b,
131
- ...r
132
- });
133
- }, [i.variant, u, B, r, b]), I(() => {
134
- x && c?.(x);
135
- }, [x, c]), /* @__PURE__ */ y(
131
+ ...n
132
+ };
133
+ z((g) => v(I, g) ? g : I);
134
+ }, [l.variant, u, h, n, b, _]), T(() => {
135
+ S && c?.(S);
136
+ }, [S, c]), /* @__PURE__ */ H(
136
137
  "div",
137
138
  {
138
- className: S(
139
+ className: F(
139
140
  s["iframe-button"],
140
- o && s["with-icon"],
141
+ r && s["with-icon"],
141
142
  a && s["full-width"],
142
- u && A[u]
143
+ u && V[u]
143
144
  ),
144
145
  "data-part": "iframe-button",
145
146
  children: [
146
- /* @__PURE__ */ _("span", { className: s.label, children: t }),
147
- e && /* @__PURE__ */ _(R, { className: S(s["loading-skeleton"]) }),
148
- /* @__PURE__ */ _(
147
+ /* @__PURE__ */ B("span", { className: s.label, children: t }),
148
+ e && /* @__PURE__ */ B(W, { className: F(s["loading-skeleton"]) }),
149
+ /* @__PURE__ */ B(
149
150
  "iframe",
150
151
  {
151
152
  ref: d,
152
- className: S(s.iframe, e ? s.hidden : void 0, n),
153
- ...i
153
+ className: F(s.iframe, e ? s.hidden : void 0, o),
154
+ ...l
154
155
  }
155
156
  ),
156
- !B && /* @__PURE__ */ _("div", { ref: p, className: s["computed-style"], children: /* @__PURE__ */ _("canvas", { ref: h }) })
157
+ !h && /* @__PURE__ */ B("div", { ref: p, className: s["computed-style"], children: /* @__PURE__ */ B("canvas", { ref: x }) })
157
158
  ]
158
159
  }
159
160
  );
160
161
  }
161
162
  );
162
- M.displayName = "IframeButton";
163
+ D.displayName = "IframeButton";
163
164
  export {
164
- M as IframeButton
165
+ D as IframeButton
165
166
  };
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from 'react';
2
- import { SecureIframeChainType, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage, SecureIframeStatus, IframeTheme } from '../types/secureIframe';
2
+ import { SecureIframeChainType, SecureIframeKeyExportIncomingMessage, SecureIframeStatus, IframeTheme } from '../types/secureIframe';
3
3
  export interface UseKeyExportPostMessageProps {
4
4
  address: string;
5
5
  type: SecureIframeChainType;
@@ -13,7 +13,6 @@ export interface UseKeyExportPostMessageProps {
13
13
  theme?: IframeTheme;
14
14
  }
15
15
  export declare const sendKeyExportMessage: (el: HTMLIFrameElement | null, message: SecureIframeKeyExportIncomingMessage) => void;
16
- export declare const isKeyExportMessage: (message: unknown) => message is SecureIframeKeyExportIncomingMessage | SecureIframeKeyExportOutgoingMessage;
17
16
  export declare const useKeyExportPostMessage: ({ address, basePath, copiedLabel, icon, iframeRef, label, onStatusUpdate, projectId, theme, type, }: UseKeyExportPostMessageProps) => {
18
17
  iframeUrl: string;
19
18
  isPending: boolean;
@@ -1,84 +1,82 @@
1
- import { getAccessToken as P, getAccessTokenExpiration as C } from "@coinbase/cdp-core";
2
- import { useCurrentUser as K } from "@coinbase/cdp-hooks";
3
- import { useState as R, useRef as h, useMemo as $, useCallback as _, useEffect as w } from "react";
4
- import { SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE as a, SECURE_IFRAME_EVENT_TYPE_PREFIX as F } from "../types/secureIframe.js";
1
+ import { buildKeyExportIframeUrl as K, getAccessToken as P, getAccessTokenExpiration as L, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE as n, isSecureIframeKeyExportMessage as C } from "@coinbase/cdp-core";
2
+ import { useCurrentUser as N } from "@coinbase/cdp-hooks";
3
+ import { useState as w, useRef as Y, useMemo as F, useCallback as A, useEffect as _ } from "react";
5
4
  import "libphonenumber-js";
6
- import { sendIframeMessage as I } from "../utils/sendIframeMessage.js";
7
- const A = "https://secure-wallet.cdp.coinbase.com", L = (r, s) => {
8
- I(r, s);
9
- }, N = (r) => typeof r == "object" && r !== null && "type" in r && typeof r.type == "string" && !!a[r.type.replace(
10
- F,
11
- ""
12
- )], q = ({
13
- address: r,
14
- basePath: s = A,
15
- copiedLabel: c,
16
- icon: y,
17
- iframeRef: o,
18
- label: i,
19
- onStatusUpdate: f,
20
- projectId: u,
21
- theme: n,
22
- type: l
5
+ import { sendIframeMessage as x } from "../utils/sendIframeMessage.js";
6
+ const k = "https://secure-wallet.cdp.coinbase.com", G = (o, s) => {
7
+ x(o, s);
8
+ }, O = ({
9
+ address: o,
10
+ basePath: s = k,
11
+ copiedLabel: E,
12
+ icon: d,
13
+ iframeRef: t,
14
+ label: p,
15
+ onStatusUpdate: g,
16
+ projectId: y,
17
+ theme: a,
18
+ type: T
23
19
  }) => {
24
- const { currentUser: p } = K(), [U, M] = R(!0), [E, k] = R(!1), T = h(!1), S = $(() => {
25
- const e = ["fullWidth"];
26
- return u && e.push(`projectId=${u.trim()}`), i && e.push(`label=${encodeURIComponent(i.trim())}`), c && e.push(`copiedLabel=${encodeURIComponent(c.trim())}`), y && e.push("icon"), `${s}?${e.join("&")}`;
27
- }, [u, i, c, y, s]), g = _(async () => {
28
- if (!p || !o.current) return;
29
- const e = await P({ forceRefresh: !0 }), t = await C();
30
- L(o.current, {
31
- type: a.GET_PRIVATE_KEY,
20
+ const { currentUser: c } = N(), [I, M] = w(!0), [i, R] = w(!1), l = Y(!1), S = F(() => K({
21
+ projectId: y,
22
+ label: p,
23
+ copiedLabel: E,
24
+ icon: d,
25
+ basePath: s
26
+ }), [y, p, E, d, s]), f = A(async () => {
27
+ if (!c || !t.current) return;
28
+ const r = await P({ forceRefresh: !0 }), e = await L();
29
+ G(t.current, {
30
+ type: n.GET_PRIVATE_KEY,
32
31
  payload: {
33
- address: r,
34
- type: l,
32
+ address: o,
33
+ type: T,
35
34
  authState: {
36
- accessToken: e || "",
37
- expiresAt: t || 0,
38
- user: p
35
+ accessToken: r || "",
36
+ expiresAt: e || 0,
37
+ user: c
39
38
  },
40
- theme: n
39
+ theme: a
41
40
  }
42
41
  });
43
- }, [p, r, l, n, o]), m = _(
44
- (e, t) => {
45
- f?.(e, t), M(!1);
42
+ }, [c, o, T, a, t]), m = A(
43
+ (r, e) => {
44
+ g?.(r, e), M(!1);
46
45
  },
47
- [f]
46
+ [g]
48
47
  );
49
- return w(() => {
50
- const e = T.current;
51
- T.current = E, e && E && n && I(o.current, {
52
- type: a.THEME,
48
+ return _(() => {
49
+ const r = l.current;
50
+ l.current = i, r && i && a && x(t.current, {
51
+ type: n.THEME,
53
52
  payload: {
54
- theme: n
53
+ theme: a
55
54
  }
56
55
  });
57
- }, [n, E, o]), w(() => {
58
- const e = (t) => {
59
- let d = "";
56
+ }, [a, i, t]), _(() => {
57
+ const r = (e) => {
58
+ let u = "";
60
59
  try {
61
- d = new URL(s || A).origin;
62
- } catch (x) {
63
- console.error("Error parsing iframe origin", x);
60
+ u = new URL(s || k).origin;
61
+ } catch (U) {
62
+ console.error("Error parsing iframe origin", U);
64
63
  }
65
- if (!(!d || t.origin !== d) && N(t.data))
66
- switch (t.data?.type) {
67
- case a.LISTENING:
68
- k(!0), g();
64
+ if (!(!u || e.origin !== u) && C(e.data))
65
+ switch (e.data?.type) {
66
+ case n.LISTENING:
67
+ R(!0), f();
69
68
  break;
70
- case a.STATUS:
71
- m(t.data.payload.status, t.data.payload.message);
69
+ case n.STATUS:
70
+ m(e.data.payload.status, e.data.payload.message);
72
71
  break;
73
72
  }
74
73
  };
75
- return window.addEventListener("message", e), () => {
76
- window.removeEventListener("message", e);
74
+ return window.addEventListener("message", r), () => {
75
+ window.removeEventListener("message", r);
77
76
  };
78
- }, [g, m, s]), { iframeUrl: S, isPending: U };
77
+ }, [f, m, s]), { iframeUrl: S, isPending: I };
79
78
  };
80
79
  export {
81
- N as isKeyExportMessage,
82
- L as sendKeyExportMessage,
83
- q as useKeyExportPostMessage
80
+ G as sendKeyExportMessage,
81
+ O as useKeyExportPostMessage
84
82
  };
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ import { isApiError as hr } from "./utils/isApiError.js";
46
46
  import { isEmailInvalid as Sr } from "./utils/isEmailInvalid.js";
47
47
  import { parseValuesFromPhoneNumber as kr } from "./utils/parseValuesFromPhoneNumber.js";
48
48
  import { sendIframeMessage as Lr } from "./utils/sendIframeMessage.js";
49
- import "./types/secureIframe.js";
49
+ import "@coinbase/cdp-core";
50
50
  import { FundForm as Wr } from "./components/Fund/FundForm.js";
51
51
  import { FundTitle as br } from "./components/Fund/FundTitle.js";
52
52
  import { useFundContext as wr } from "./components/Fund/FundProvider.js";
@@ -1,77 +1,4 @@
1
- import { AuthManager } from '@coinbase/cdp-core';
2
- export type IframeTheme = {
3
- pageBg: string;
4
- buttonBg: string;
5
- buttonBgHover: string;
6
- buttonBgPressed: string;
7
- buttonBgFocus: string;
8
- buttonBorder: string;
9
- buttonBorderHover: string;
10
- buttonBorderPressed: string;
11
- buttonBorderFocus: string;
12
- buttonBorderFocusInset: string;
13
- buttonText: string;
14
- buttonTextHover: string;
15
- buttonTextPressed: string;
16
- buttonTextFocus: string;
17
- buttonBorderRadius: number;
18
- buttonFontSize: number;
19
- buttonFontWeight: number;
20
- buttonSize: "xs" | "sm" | "md" | "lg";
21
- fontUrl: string;
22
- fontFamily: string;
23
- };
24
- export type SecureIframeAuthState = Parameters<AuthManager["setAuthState"]>[0];
25
- export type SecureIframeChainType = "evm" | "solana";
26
- export type SecureIframeContext = {
27
- authState: SecureIframeAuthState;
28
- theme?: IframeTheme;
29
- };
30
- export declare const SECURE_IFRAME_EVENT_TYPE_PREFIX = "CDP_WEB_SECURE_IFRAME_";
31
- export declare const SECURE_IFRAME_EVENT_TYPE: {
32
- readonly INIT: "CDP_WEB_SECURE_IFRAME_INIT";
33
- readonly LISTENING: "CDP_WEB_SECURE_IFRAME_LISTENING";
34
- readonly STATUS: "CDP_WEB_SECURE_IFRAME_STATUS";
35
- readonly THEME: "CDP_WEB_SECURE_IFRAME_THEME";
36
- };
37
- export type SecureIframeEventType = typeof SECURE_IFRAME_EVENT_TYPE;
38
- export type SecureIframeInitMessage = {
39
- type: SecureIframeEventType["INIT"];
40
- payload: SecureIframeContext;
41
- };
42
- export type SecureIframeThemeMessage = {
43
- type: SecureIframeEventType["THEME"];
44
- payload: {
45
- theme: Partial<IframeTheme>;
46
- };
47
- };
48
- export type SecureIframeIncomingMessage = SecureIframeInitMessage | SecureIframeThemeMessage;
49
- export type SecureIframeListeningMessage = {
50
- type: SecureIframeEventType["LISTENING"];
51
- };
52
- export type SecureIframeStatus = "ready" | "success" | "error" | "expiring" | "expired";
53
- export type SecureIframeStatusMessage = {
54
- type: SecureIframeEventType["STATUS"];
55
- payload: {
56
- status: SecureIframeStatus;
57
- message?: string;
58
- };
59
- };
60
- export type SecureIframeOutgoingMessage = SecureIframeListeningMessage | SecureIframeStatusMessage;
61
- export declare const SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE: {
62
- readonly GET_PRIVATE_KEY: "CDP_WEB_SECURE_IFRAME_GET_PRIVATE_KEY";
63
- readonly INIT: "CDP_WEB_SECURE_IFRAME_INIT";
64
- readonly LISTENING: "CDP_WEB_SECURE_IFRAME_LISTENING";
65
- readonly STATUS: "CDP_WEB_SECURE_IFRAME_STATUS";
66
- readonly THEME: "CDP_WEB_SECURE_IFRAME_THEME";
67
- };
68
- export type SecureIframeKeyExportEventType = typeof SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE;
69
- export type SecureIframeGetPrivateKeyMessage = {
70
- type: SecureIframeKeyExportEventType["GET_PRIVATE_KEY"];
71
- payload: SecureIframeContext & {
72
- address: string;
73
- type: SecureIframeChainType;
74
- };
75
- };
76
- export type SecureIframeKeyExportIncomingMessage = SecureIframeIncomingMessage | SecureIframeGetPrivateKeyMessage;
77
- export type SecureIframeKeyExportOutgoingMessage = SecureIframeOutgoingMessage;
1
+ import { SECURE_IFRAME_EVENT_TYPE_PREFIX, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE, SecureIframeTheme, SecureIframeAuthState, SecureIframeChainType, SecureIframeContext, SecureIframeStatus, SecureIframeEventType, SecureIframeInitMessage, SecureIframeThemeMessage, SecureIframeIncomingMessage, SecureIframeListeningMessage, SecureIframeStatusMessage, SecureIframeOutgoingMessage, SecureIframeKeyExportEventType, SecureIframeGetPrivateKeyMessage, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage } from '@coinbase/cdp-core';
2
+ export type IframeTheme = SecureIframeTheme;
3
+ export { SECURE_IFRAME_EVENT_TYPE_PREFIX, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE };
4
+ export type { SecureIframeAuthState, SecureIframeChainType, SecureIframeContext, SecureIframeStatus, SecureIframeEventType, SecureIframeInitMessage, SecureIframeThemeMessage, SecureIframeIncomingMessage, SecureIframeListeningMessage, SecureIframeStatusMessage, SecureIframeOutgoingMessage, SecureIframeKeyExportEventType, SecureIframeGetPrivateKeyMessage, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage, };
@@ -1,15 +1,5 @@
1
- import "@coinbase/cdp-core";
2
- const E = "CDP_WEB_SECURE_IFRAME_", T = {
3
- INIT: `${E}INIT`,
4
- LISTENING: `${E}LISTENING`,
5
- STATUS: `${E}STATUS`,
6
- THEME: `${E}THEME`
7
- }, I = {
8
- ...T,
9
- GET_PRIVATE_KEY: `${E}GET_PRIVATE_KEY`
10
- };
1
+ import { SECURE_IFRAME_EVENT_TYPE_PREFIX as R, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE as T } from "@coinbase/cdp-core";
11
2
  export {
12
- T as SECURE_IFRAME_EVENT_TYPE,
13
- E as SECURE_IFRAME_EVENT_TYPE_PREFIX,
14
- I as SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE
3
+ R as SECURE_IFRAME_EVENT_TYPE_PREFIX,
4
+ T as SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE
15
5
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.72";
1
+ export declare const VERSION = "0.0.74";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.0.72";
1
+ const o = "0.0.74";
2
2
  export {
3
3
  o as VERSION
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.72",
3
+ "version": "0.0.74",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">=18.2.0 <19.2.0",
18
- "@coinbase/cdp-core": "^0.0.72",
19
- "@coinbase/cdp-hooks": "^0.0.72"
18
+ "@coinbase/cdp-core": "^0.0.74",
19
+ "@coinbase/cdp-hooks": "^0.0.74"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -47,8 +47,8 @@
47
47
  "vite": "^7.0.4",
48
48
  "vite-plugin-dts": "^4.5.4",
49
49
  "vite-plugin-lib-inject-css": "^2.2.2",
50
- "@coinbase/cdp-core": "^0.0.72",
51
- "@coinbase/cdp-hooks": "^0.0.72"
50
+ "@coinbase/cdp-core": "^0.0.74",
51
+ "@coinbase/cdp-hooks": "^0.0.74"
52
52
  },
53
53
  "size-limit": [
54
54
  {