@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.
- package/dist/components/CopyEvmKeyButton/index.js +1 -1
- package/dist/components/CopySolanaKeyButton/index.js +1 -1
- package/dist/components/ExportWallet/index.js +1 -1
- package/dist/components/ui/IframeButton/index.js +89 -88
- package/dist/hooks/useKeyExportPostMessage.d.ts +1 -2
- package/dist/hooks/useKeyExportPostMessage.js +60 -62
- package/dist/index.js +1 -1
- package/dist/types/secureIframe.d.ts +4 -77
- package/dist/types/secureIframe.js +3 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -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 "
|
|
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 "
|
|
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 "
|
|
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
|
|
2
|
-
import { c as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
import { LoadingSkeleton as
|
|
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
|
|
8
|
-
import '../../../assets/IframeButton.css';const
|
|
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:
|
|
16
|
+
label: N,
|
|
17
17
|
"with-icon": "IframeButton-module__with-icon___KBiq1",
|
|
18
|
-
iframe:
|
|
19
|
-
hidden:
|
|
18
|
+
iframe: P,
|
|
19
|
+
hidden: j,
|
|
20
20
|
"computed-style": "IframeButton-module__computed-style___ciB13"
|
|
21
|
-
},
|
|
22
|
-
pageBg:
|
|
23
|
-
buttonBg:
|
|
21
|
+
}, k = {
|
|
22
|
+
pageBg: i.white,
|
|
23
|
+
buttonBg: i.blue500,
|
|
24
24
|
buttonBgHover: "#0748d6",
|
|
25
25
|
buttonBgPressed: "#0b3eae",
|
|
26
|
-
buttonBgFocus:
|
|
27
|
-
buttonBorder:
|
|
26
|
+
buttonBgFocus: i.blue550,
|
|
27
|
+
buttonBorder: i.blue550,
|
|
28
28
|
buttonBorderHover: "#0748d6",
|
|
29
29
|
buttonBorderPressed: "#0b3eae",
|
|
30
|
-
buttonBorderFocus:
|
|
31
|
-
buttonBorderFocusInset:
|
|
32
|
-
buttonText:
|
|
33
|
-
buttonTextHover:
|
|
34
|
-
buttonTextPressed:
|
|
35
|
-
buttonTextFocus:
|
|
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
|
-
},
|
|
43
|
-
(e) => e === "fontUrl" || e === "buttonSize" ? !0 :
|
|
44
|
-
), f = (
|
|
45
|
-
if (!
|
|
46
|
-
return console.warn("Invalid color input:",
|
|
47
|
-
const t =
|
|
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
|
|
53
|
-
if (!
|
|
52
|
+
const r = e.getContext("2d", { willReadFrequently: !0 });
|
|
53
|
+
if (!r)
|
|
54
54
|
return console.warn("Could not create canvas context"), "";
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
const a =
|
|
59
|
-
if (
|
|
60
|
-
const b =
|
|
61
|
-
return `#${d}${u}${
|
|
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}${
|
|
64
|
-
},
|
|
65
|
-
const a = getComputedStyle(t), m = f("colors-page-bg-default", t,
|
|
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:
|
|
68
|
+
buttonBg: n,
|
|
69
69
|
buttonBgHover: c,
|
|
70
|
-
buttonBgPressed:
|
|
71
|
-
buttonBgFocus:
|
|
72
|
-
buttonBorder:
|
|
70
|
+
buttonBgPressed: l,
|
|
71
|
+
buttonBgFocus: n,
|
|
72
|
+
buttonBorder: n,
|
|
73
73
|
buttonBorderHover: c,
|
|
74
|
-
buttonBorderPressed:
|
|
75
|
-
buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t,
|
|
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,
|
|
81
|
+
buttonTextHover: f(`colors-cta-${e}-text-hover`, t, r),
|
|
82
82
|
buttonTextPressed: d,
|
|
83
83
|
buttonTextFocus: d,
|
|
84
|
-
buttonSize:
|
|
84
|
+
buttonSize: o ?? "md",
|
|
85
85
|
fontFamily: a.fontFamily,
|
|
86
86
|
fontUrl: ""
|
|
87
87
|
};
|
|
88
|
-
},
|
|
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
|
-
},
|
|
93
|
+
}, D = R(
|
|
94
94
|
({
|
|
95
|
-
className:
|
|
95
|
+
className: o = "",
|
|
96
96
|
isPending: e,
|
|
97
97
|
label: t,
|
|
98
|
-
icon:
|
|
98
|
+
icon: r,
|
|
99
99
|
fullWidth: a,
|
|
100
100
|
size: m,
|
|
101
|
-
theme:
|
|
101
|
+
theme: n,
|
|
102
102
|
onThemeChange: c,
|
|
103
|
-
...
|
|
103
|
+
...l
|
|
104
104
|
}, d) => {
|
|
105
|
-
const u = m === "none" ? "md" : m, { theme:
|
|
106
|
-
|
|
107
|
-
...
|
|
108
|
-
fontUrl:
|
|
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
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
...
|
|
116
|
-
fontUrl:
|
|
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 || !
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
...
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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:
|
|
139
|
+
className: F(
|
|
139
140
|
s["iframe-button"],
|
|
140
|
-
|
|
141
|
+
r && s["with-icon"],
|
|
141
142
|
a && s["full-width"],
|
|
142
|
-
u &&
|
|
143
|
+
u && V[u]
|
|
143
144
|
),
|
|
144
145
|
"data-part": "iframe-button",
|
|
145
146
|
children: [
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
e && /* @__PURE__ */
|
|
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:
|
|
153
|
-
...
|
|
153
|
+
className: F(s.iframe, e ? s.hidden : void 0, o),
|
|
154
|
+
...l
|
|
154
155
|
}
|
|
155
156
|
),
|
|
156
|
-
!
|
|
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
|
-
|
|
163
|
+
D.displayName = "IframeButton";
|
|
163
164
|
export {
|
|
164
|
-
|
|
165
|
+
D as IframeButton
|
|
165
166
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { SecureIframeChainType, SecureIframeKeyExportIncomingMessage,
|
|
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
|
|
3
|
-
import { useState as
|
|
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
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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:
|
|
34
|
-
type:
|
|
32
|
+
address: o,
|
|
33
|
+
type: T,
|
|
35
34
|
authState: {
|
|
36
|
-
accessToken:
|
|
37
|
-
expiresAt:
|
|
38
|
-
user:
|
|
35
|
+
accessToken: r || "",
|
|
36
|
+
expiresAt: e || 0,
|
|
37
|
+
user: c
|
|
39
38
|
},
|
|
40
|
-
theme:
|
|
39
|
+
theme: a
|
|
41
40
|
}
|
|
42
41
|
});
|
|
43
|
-
}, [
|
|
44
|
-
(
|
|
45
|
-
|
|
42
|
+
}, [c, o, T, a, t]), m = A(
|
|
43
|
+
(r, e) => {
|
|
44
|
+
g?.(r, e), M(!1);
|
|
46
45
|
},
|
|
47
|
-
[
|
|
46
|
+
[g]
|
|
48
47
|
);
|
|
49
|
-
return
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
type:
|
|
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:
|
|
53
|
+
theme: a
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
59
|
-
let
|
|
56
|
+
}, [a, i, t]), _(() => {
|
|
57
|
+
const r = (e) => {
|
|
58
|
+
let u = "";
|
|
60
59
|
try {
|
|
61
|
-
|
|
62
|
-
} catch (
|
|
63
|
-
console.error("Error parsing iframe origin",
|
|
60
|
+
u = new URL(s || k).origin;
|
|
61
|
+
} catch (U) {
|
|
62
|
+
console.error("Error parsing iframe origin", U);
|
|
64
63
|
}
|
|
65
|
-
if (!(!
|
|
66
|
-
switch (
|
|
67
|
-
case
|
|
68
|
-
|
|
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
|
|
71
|
-
m(
|
|
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",
|
|
76
|
-
window.removeEventListener("message",
|
|
74
|
+
return window.addEventListener("message", r), () => {
|
|
75
|
+
window.removeEventListener("message", r);
|
|
77
76
|
};
|
|
78
|
-
}, [
|
|
77
|
+
}, [f, m, s]), { iframeUrl: S, isPending: I };
|
|
79
78
|
};
|
|
80
79
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
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 "
|
|
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 {
|
|
2
|
-
export type IframeTheme =
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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.
|
|
1
|
+
export declare const VERSION = "0.0.74";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-react",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
19
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
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.
|
|
51
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
50
|
+
"@coinbase/cdp-core": "^0.0.74",
|
|
51
|
+
"@coinbase/cdp-hooks": "^0.0.74"
|
|
52
52
|
},
|
|
53
53
|
"size-limit": [
|
|
54
54
|
{
|