@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,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 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";
|
|
6
6
|
import "../../../theme/theme.js";
|
|
7
|
-
import { colorsBase as
|
|
8
|
-
import '../../../assets/IframeButton.css';const
|
|
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 = {
|
|
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,38 +13,38 @@ import '../../../assets/IframeButton.css';const H = "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: C,
|
|
17
17
|
"with-icon": "IframeButton-module__with-icon___KBiq1",
|
|
18
|
-
iframe:
|
|
19
|
-
hidden:
|
|
18
|
+
iframe: U,
|
|
19
|
+
hidden: L,
|
|
20
20
|
"computed-style": "IframeButton-module__computed-style___ciB13"
|
|
21
|
-
},
|
|
22
|
-
pageBg:
|
|
23
|
-
buttonBg:
|
|
21
|
+
}, W = {
|
|
22
|
+
pageBg: l.white,
|
|
23
|
+
buttonBg: l.blue500,
|
|
24
24
|
buttonBgHover: "#0748d6",
|
|
25
25
|
buttonBgPressed: "#0b3eae",
|
|
26
|
-
buttonBgFocus:
|
|
27
|
-
buttonBorder:
|
|
26
|
+
buttonBgFocus: l.blue550,
|
|
27
|
+
buttonBorder: l.blue550,
|
|
28
28
|
buttonBorderHover: "#0748d6",
|
|
29
29
|
buttonBorderPressed: "#0b3eae",
|
|
30
|
-
buttonBorderFocus:
|
|
31
|
-
buttonBorderFocusInset:
|
|
32
|
-
buttonText:
|
|
33
|
-
buttonTextHover:
|
|
34
|
-
buttonTextPressed:
|
|
35
|
-
buttonTextFocus:
|
|
30
|
+
buttonBorderFocus: l.blue550,
|
|
31
|
+
buttonBorderFocusInset: l.white,
|
|
32
|
+
buttonText: l.white,
|
|
33
|
+
buttonTextHover: l.white,
|
|
34
|
+
buttonTextPressed: l.white,
|
|
35
|
+
buttonTextFocus: l.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
|
-
),
|
|
45
|
-
if (!
|
|
46
|
-
return console.warn("Invalid color input:",
|
|
47
|
-
const t =
|
|
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();
|
|
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";
|
|
@@ -55,85 +55,111 @@ import '../../../assets/IframeButton.css';const H = "IframeButton-module__label_
|
|
|
55
55
|
if (o.fillStyle = t, o.fillStyle.startsWith("#"))
|
|
56
56
|
return o.fillStyle.toLowerCase();
|
|
57
57
|
o.fillRect(0, 0, 1, 1);
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
return `#${
|
|
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}`;
|
|
62
62
|
}
|
|
63
|
-
return `#${
|
|
64
|
-
},
|
|
65
|
-
const
|
|
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);
|
|
66
66
|
return {
|
|
67
|
-
pageBg:
|
|
68
|
-
buttonBg:
|
|
69
|
-
buttonBgHover:
|
|
70
|
-
buttonBgPressed:
|
|
71
|
-
buttonBgFocus:
|
|
72
|
-
buttonBorder:
|
|
73
|
-
buttonBorderHover:
|
|
74
|
-
buttonBorderPressed:
|
|
75
|
-
buttonBorderFocus:
|
|
76
|
-
buttonBorderFocusInset:
|
|
77
|
-
buttonBorderRadius: parseInt(
|
|
78
|
-
buttonFontSize: parseInt(
|
|
79
|
-
buttonFontWeight: parseInt(
|
|
80
|
-
buttonText:
|
|
81
|
-
buttonTextHover:
|
|
82
|
-
buttonTextPressed:
|
|
83
|
-
buttonTextFocus:
|
|
84
|
-
buttonSize:
|
|
85
|
-
fontFamily:
|
|
67
|
+
pageBg: m,
|
|
68
|
+
buttonBg: r,
|
|
69
|
+
buttonBgHover: c,
|
|
70
|
+
buttonBgPressed: i,
|
|
71
|
+
buttonBgFocus: r,
|
|
72
|
+
buttonBorder: r,
|
|
73
|
+
buttonBorderHover: c,
|
|
74
|
+
buttonBorderPressed: i,
|
|
75
|
+
buttonBorderFocus: f(`colors-cta-${e}-border-focus`, t, o),
|
|
76
|
+
buttonBorderFocusInset: m,
|
|
77
|
+
buttonBorderRadius: parseInt(a.borderRadius),
|
|
78
|
+
buttonFontSize: parseInt(a.fontSize),
|
|
79
|
+
buttonFontWeight: parseInt(a.fontWeight),
|
|
80
|
+
buttonText: d,
|
|
81
|
+
buttonTextHover: f(`colors-cta-${e}-text-hover`, t, o),
|
|
82
|
+
buttonTextPressed: d,
|
|
83
|
+
buttonTextFocus: d,
|
|
84
|
+
buttonSize: n ?? "md",
|
|
85
|
+
fontFamily: a.fontFamily,
|
|
86
86
|
fontUrl: ""
|
|
87
87
|
};
|
|
88
|
-
},
|
|
88
|
+
}, A = {
|
|
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
|
-
},
|
|
94
|
-
({
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
}, M = v(
|
|
94
|
+
({
|
|
95
|
+
className: n = "",
|
|
96
|
+
isPending: e,
|
|
97
|
+
label: t,
|
|
98
|
+
icon: o,
|
|
99
|
+
fullWidth: a,
|
|
100
|
+
size: m,
|
|
101
|
+
theme: r,
|
|
102
|
+
onThemeChange: c,
|
|
103
|
+
...i
|
|
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,
|
|
109
|
+
buttonSize: u ?? "md"
|
|
110
|
+
} : void 0
|
|
97
111
|
);
|
|
98
|
-
return
|
|
99
|
-
if (B
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
return I(() => {
|
|
113
|
+
if (B) {
|
|
114
|
+
z({
|
|
115
|
+
...r,
|
|
116
|
+
fontUrl: r?.fontUrl ?? b,
|
|
117
|
+
buttonSize: u ?? "md"
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (!p.current || !h.current) return;
|
|
122
|
+
const w = j(
|
|
123
|
+
u ?? "md",
|
|
124
|
+
i.variant ?? "primary",
|
|
125
|
+
p.current,
|
|
126
|
+
h.current
|
|
105
127
|
);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
128
|
+
z({
|
|
129
|
+
...w,
|
|
130
|
+
fontUrl: b,
|
|
131
|
+
...r
|
|
132
|
+
});
|
|
133
|
+
}, [i.variant, u, B, r, b]), I(() => {
|
|
134
|
+
x && c?.(x);
|
|
135
|
+
}, [x, c]), /* @__PURE__ */ y(
|
|
110
136
|
"div",
|
|
111
137
|
{
|
|
112
|
-
className:
|
|
138
|
+
className: S(
|
|
113
139
|
s["iframe-button"],
|
|
114
140
|
o && s["with-icon"],
|
|
115
|
-
|
|
116
|
-
|
|
141
|
+
a && s["full-width"],
|
|
142
|
+
u && A[u]
|
|
117
143
|
),
|
|
118
144
|
"data-part": "iframe-button",
|
|
119
145
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
e && /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ _("span", { className: s.label, children: t }),
|
|
147
|
+
e && /* @__PURE__ */ _(R, { className: S(s["loading-skeleton"]) }),
|
|
148
|
+
/* @__PURE__ */ _(
|
|
123
149
|
"iframe",
|
|
124
150
|
{
|
|
125
|
-
ref:
|
|
126
|
-
className:
|
|
127
|
-
...
|
|
151
|
+
ref: d,
|
|
152
|
+
className: S(s.iframe, e ? s.hidden : void 0, n),
|
|
153
|
+
...i
|
|
128
154
|
}
|
|
129
155
|
),
|
|
130
|
-
!B && /* @__PURE__ */
|
|
156
|
+
!B && /* @__PURE__ */ _("div", { ref: p, className: s["computed-style"], children: /* @__PURE__ */ _("canvas", { ref: h }) })
|
|
131
157
|
]
|
|
132
158
|
}
|
|
133
159
|
);
|
|
134
160
|
}
|
|
135
161
|
);
|
|
136
|
-
|
|
162
|
+
M.displayName = "IframeButton";
|
|
137
163
|
export {
|
|
138
|
-
|
|
164
|
+
M as IframeButton
|
|
139
165
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Key } from 'react';
|
|
2
|
-
import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition
|
|
2
|
+
import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition';
|
|
3
3
|
export type SwitchFadeTransitionProps<T extends Key> = Omit<SwitchTransitionProps<T>, "transitionName" | "unmountOnExit" | "mountOnEnter" | "preEnter">;
|
|
4
4
|
export type SwitchFadeTransitionRef<T extends Key> = SwitchTransitionRef<T>;
|
|
5
5
|
export declare const SwitchFadeTransition: <T extends Key>({ children, className, ...props }: SwitchFadeTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Key } from 'react';
|
|
2
|
-
import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition
|
|
2
|
+
import { SwitchTransitionProps, SwitchTransitionRef } from '../SwitchTransition';
|
|
3
3
|
export interface SwitchSlideTransitionProps<T extends Key> extends Omit<SwitchTransitionProps<T>, "transitionName" | "unmountOnExit" | "mountOnEnter" | "preEnter"> {
|
|
4
4
|
direction?: "left" | "right";
|
|
5
5
|
}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE: Readonly<{
|
|
4
|
-
GET_PRIVATE_KEY: "CDP_WEB_SECURE_IFRAME_GET_PRIVATE_KEY";
|
|
5
|
-
INIT: "CDP_WEB_SECURE_IFRAME_INIT";
|
|
6
|
-
LISTENING: "CDP_WEB_SECURE_IFRAME_LISTENING";
|
|
7
|
-
STATUS: "CDP_WEB_SECURE_IFRAME_STATUS";
|
|
8
|
-
THEME: "CDP_WEB_SECURE_IFRAME_THEME";
|
|
9
|
-
}>;
|
|
10
|
-
export type SecureIframeKeyExportEventType = SecureIframeEventType & typeof SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE;
|
|
11
|
-
export type SecureIframeGetPrivateKeyMessage = {
|
|
12
|
-
type: SecureIframeKeyExportEventType["GET_PRIVATE_KEY"];
|
|
13
|
-
payload: {
|
|
14
|
-
address: string;
|
|
15
|
-
type: "evm" | "solana";
|
|
16
|
-
authState: SecureIframeInitMessage["payload"]["authState"];
|
|
17
|
-
theme: SecureIframeInitMessage["payload"]["theme"];
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export type SecureIframeKeyExportIncomingMessage = SecureIframeIncomingMessage | SecureIframeGetPrivateKeyMessage;
|
|
21
|
-
export type SecureIframeKeyExportOutgoingMessage = SecureIframeOutgoingMessage;
|
|
2
|
+
import { SecureIframeChainType, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage, SecureIframeStatus, IframeTheme } from '../types/secureIframe';
|
|
22
3
|
export interface UseKeyExportPostMessageProps {
|
|
23
4
|
address: string;
|
|
24
|
-
type:
|
|
5
|
+
type: SecureIframeChainType;
|
|
25
6
|
basePath?: string;
|
|
26
7
|
projectId: string;
|
|
27
8
|
label?: string;
|
|
@@ -36,5 +17,4 @@ export declare const isKeyExportMessage: (message: unknown) => message is Secure
|
|
|
36
17
|
export declare const useKeyExportPostMessage: ({ address, basePath, copiedLabel, icon, iframeRef, label, onStatusUpdate, projectId, theme, type, }: UseKeyExportPostMessageProps) => {
|
|
37
18
|
iframeUrl: string;
|
|
38
19
|
isPending: boolean;
|
|
39
|
-
onThemeChange: (newTheme: Partial<IframeTheme>) => void;
|
|
40
20
|
};
|
|
@@ -1,90 +1,84 @@
|
|
|
1
|
-
import { getAccessToken as
|
|
2
|
-
import { useCurrentUser as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
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";
|
|
5
5
|
import "libphonenumber-js";
|
|
6
|
-
import { sendIframeMessage as
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
A(t, s);
|
|
12
|
-
}, V = (t) => typeof t == "object" && t !== null && "type" in t && typeof t.type == "string" && !!n[t.type.replace(
|
|
13
|
-
f,
|
|
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,
|
|
14
11
|
""
|
|
15
|
-
)],
|
|
16
|
-
address:
|
|
17
|
-
basePath: s =
|
|
12
|
+
)], q = ({
|
|
13
|
+
address: r,
|
|
14
|
+
basePath: s = A,
|
|
18
15
|
copiedLabel: c,
|
|
19
|
-
icon:
|
|
16
|
+
icon: y,
|
|
20
17
|
iframeRef: o,
|
|
21
18
|
label: i,
|
|
22
|
-
onStatusUpdate:
|
|
23
|
-
projectId:
|
|
24
|
-
theme:
|
|
25
|
-
type:
|
|
19
|
+
onStatusUpdate: f,
|
|
20
|
+
projectId: u,
|
|
21
|
+
theme: n,
|
|
22
|
+
type: l
|
|
26
23
|
}) => {
|
|
27
|
-
const { currentUser:
|
|
24
|
+
const { currentUser: p } = K(), [U, M] = R(!0), [E, k] = R(!1), T = h(!1), S = $(() => {
|
|
28
25
|
const e = ["fullWidth"];
|
|
29
|
-
return
|
|
30
|
-
}, [
|
|
31
|
-
if (!
|
|
32
|
-
const e = await
|
|
33
|
-
|
|
34
|
-
type:
|
|
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,
|
|
35
32
|
payload: {
|
|
36
|
-
address:
|
|
37
|
-
type:
|
|
33
|
+
address: r,
|
|
34
|
+
type: l,
|
|
38
35
|
authState: {
|
|
39
36
|
accessToken: e || "",
|
|
40
|
-
expiresAt:
|
|
41
|
-
user:
|
|
37
|
+
expiresAt: t || 0,
|
|
38
|
+
user: p
|
|
42
39
|
},
|
|
43
|
-
theme:
|
|
40
|
+
theme: n
|
|
44
41
|
}
|
|
45
42
|
});
|
|
46
|
-
}, [
|
|
47
|
-
(e,
|
|
48
|
-
|
|
43
|
+
}, [p, r, l, n, o]), m = _(
|
|
44
|
+
(e, t) => {
|
|
45
|
+
f?.(e, t), M(!1);
|
|
49
46
|
},
|
|
50
|
-
[
|
|
51
|
-
), M = u(
|
|
52
|
-
(e) => {
|
|
53
|
-
A(o.current, {
|
|
54
|
-
type: n.THEME,
|
|
55
|
-
payload: {
|
|
56
|
-
theme: e
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
},
|
|
60
|
-
[o]
|
|
47
|
+
[f]
|
|
61
48
|
);
|
|
62
|
-
return
|
|
63
|
-
const e =
|
|
64
|
-
|
|
49
|
+
return w(() => {
|
|
50
|
+
const e = T.current;
|
|
51
|
+
T.current = E, e && E && n && I(o.current, {
|
|
52
|
+
type: a.THEME,
|
|
53
|
+
payload: {
|
|
54
|
+
theme: n
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}, [n, E, o]), w(() => {
|
|
58
|
+
const e = (t) => {
|
|
59
|
+
let d = "";
|
|
65
60
|
try {
|
|
66
|
-
|
|
67
|
-
} catch (
|
|
68
|
-
console.error("Error parsing iframe origin",
|
|
61
|
+
d = new URL(s || A).origin;
|
|
62
|
+
} catch (x) {
|
|
63
|
+
console.error("Error parsing iframe origin", x);
|
|
69
64
|
}
|
|
70
|
-
if (!(!
|
|
71
|
-
switch (
|
|
72
|
-
case
|
|
73
|
-
|
|
65
|
+
if (!(!d || t.origin !== d) && N(t.data))
|
|
66
|
+
switch (t.data?.type) {
|
|
67
|
+
case a.LISTENING:
|
|
68
|
+
k(!0), g();
|
|
74
69
|
break;
|
|
75
|
-
case
|
|
76
|
-
|
|
70
|
+
case a.STATUS:
|
|
71
|
+
m(t.data.payload.status, t.data.payload.message);
|
|
77
72
|
break;
|
|
78
73
|
}
|
|
79
74
|
};
|
|
80
75
|
return window.addEventListener("message", e), () => {
|
|
81
76
|
window.removeEventListener("message", e);
|
|
82
77
|
};
|
|
83
|
-
}, [
|
|
78
|
+
}, [g, m, s]), { iframeUrl: S, isPending: U };
|
|
84
79
|
};
|
|
85
80
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
H as useKeyExportPostMessage
|
|
81
|
+
N as isKeyExportMessage,
|
|
82
|
+
L as sendKeyExportMessage,
|
|
83
|
+
q as useKeyExportPostMessage
|
|
90
84
|
};
|
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 "./types/secureIframe.js";
|
|
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";
|
package/dist/theme/theme.d.ts
CHANGED
|
@@ -507,6 +507,9 @@ export declare const theme: Flattened<{
|
|
|
507
507
|
readonly code: {
|
|
508
508
|
readonly value: "{font.family.mono}";
|
|
509
509
|
};
|
|
510
|
+
readonly iframe: {
|
|
511
|
+
readonly value: "{font.family.interactive}";
|
|
512
|
+
};
|
|
510
513
|
readonly mono: {
|
|
511
514
|
readonly value: "\"DM Mono\", monospace";
|
|
512
515
|
};
|
|
@@ -520,6 +523,11 @@ export declare const theme: Flattened<{
|
|
|
520
523
|
readonly value: "{font.family.sans}";
|
|
521
524
|
};
|
|
522
525
|
};
|
|
526
|
+
readonly url: {
|
|
527
|
+
readonly iframe: {
|
|
528
|
+
readonly value: "";
|
|
529
|
+
};
|
|
530
|
+
};
|
|
523
531
|
readonly size: {
|
|
524
532
|
readonly base: {
|
|
525
533
|
readonly value: 16;
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -896,6 +896,14 @@ export declare const fontComponents: {
|
|
|
896
896
|
readonly code: {
|
|
897
897
|
readonly value: "{font.family.mono}";
|
|
898
898
|
};
|
|
899
|
+
readonly iframe: {
|
|
900
|
+
readonly value: "{font.family.interactive}";
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
readonly url: {
|
|
904
|
+
readonly iframe: {
|
|
905
|
+
readonly value: "";
|
|
906
|
+
};
|
|
899
907
|
};
|
|
900
908
|
};
|
|
901
909
|
export declare const font: {
|
|
@@ -918,6 +926,9 @@ export declare const font: {
|
|
|
918
926
|
readonly code: {
|
|
919
927
|
readonly value: "{font.family.mono}";
|
|
920
928
|
};
|
|
929
|
+
readonly iframe: {
|
|
930
|
+
readonly value: "{font.family.interactive}";
|
|
931
|
+
};
|
|
921
932
|
readonly mono: {
|
|
922
933
|
readonly value: "\"DM Mono\", monospace";
|
|
923
934
|
};
|
|
@@ -931,6 +942,11 @@ export declare const font: {
|
|
|
931
942
|
readonly value: "{font.family.sans}";
|
|
932
943
|
};
|
|
933
944
|
};
|
|
945
|
+
readonly url: {
|
|
946
|
+
readonly iframe: {
|
|
947
|
+
readonly value: "";
|
|
948
|
+
};
|
|
949
|
+
};
|
|
934
950
|
readonly size: {
|
|
935
951
|
readonly base: {
|
|
936
952
|
readonly value: 16;
|
|
@@ -1578,6 +1594,9 @@ export declare const tokens: {
|
|
|
1578
1594
|
readonly code: {
|
|
1579
1595
|
readonly value: "{font.family.mono}";
|
|
1580
1596
|
};
|
|
1597
|
+
readonly iframe: {
|
|
1598
|
+
readonly value: "{font.family.interactive}";
|
|
1599
|
+
};
|
|
1581
1600
|
readonly mono: {
|
|
1582
1601
|
readonly value: "\"DM Mono\", monospace";
|
|
1583
1602
|
};
|
|
@@ -1591,6 +1610,11 @@ export declare const tokens: {
|
|
|
1591
1610
|
readonly value: "{font.family.sans}";
|
|
1592
1611
|
};
|
|
1593
1612
|
};
|
|
1613
|
+
readonly url: {
|
|
1614
|
+
readonly iframe: {
|
|
1615
|
+
readonly value: "";
|
|
1616
|
+
};
|
|
1617
|
+
};
|
|
1594
1618
|
readonly size: {
|
|
1595
1619
|
readonly base: {
|
|
1596
1620
|
readonly value: 16;
|
package/dist/theme/tokens.js
CHANGED
|
@@ -15,7 +15,7 @@ const e = {
|
|
|
15
15
|
red500: "#cf202f",
|
|
16
16
|
green500: "#098551",
|
|
17
17
|
amber500: "#ed702f"
|
|
18
|
-
},
|
|
18
|
+
}, a = {
|
|
19
19
|
bg: {
|
|
20
20
|
default: { value: e.white },
|
|
21
21
|
// background
|
|
@@ -80,7 +80,7 @@ const e = {
|
|
|
80
80
|
negative: { value: "{colors.fg.negative}" }
|
|
81
81
|
// negative line color
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, r = {
|
|
84
84
|
page: {
|
|
85
85
|
bg: {
|
|
86
86
|
default: { value: "{colors.bg.default}" }
|
|
@@ -264,9 +264,9 @@ const e = {
|
|
|
264
264
|
default: { value: "{colors.fg.default}" }
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
},
|
|
268
|
-
...
|
|
269
|
-
...
|
|
267
|
+
}, t = {
|
|
268
|
+
...a,
|
|
269
|
+
...r
|
|
270
270
|
}, l = {
|
|
271
271
|
family: {
|
|
272
272
|
mono: {
|
|
@@ -285,7 +285,7 @@ const e = {
|
|
|
285
285
|
size: {
|
|
286
286
|
base: { value: 16 }
|
|
287
287
|
}
|
|
288
|
-
},
|
|
288
|
+
}, o = {
|
|
289
289
|
family: {
|
|
290
290
|
page: {
|
|
291
291
|
value: "{font.family.body}"
|
|
@@ -304,12 +304,23 @@ const e = {
|
|
|
304
304
|
},
|
|
305
305
|
code: {
|
|
306
306
|
value: "{font.family.mono}"
|
|
307
|
+
},
|
|
308
|
+
iframe: {
|
|
309
|
+
value: "{font.family.interactive}"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
url: {
|
|
313
|
+
iframe: {
|
|
314
|
+
value: ""
|
|
307
315
|
}
|
|
308
316
|
}
|
|
309
317
|
}, u = {
|
|
310
318
|
family: {
|
|
311
319
|
...l.family,
|
|
312
|
-
...
|
|
320
|
+
...o.family
|
|
321
|
+
},
|
|
322
|
+
url: {
|
|
323
|
+
...o.url
|
|
313
324
|
},
|
|
314
325
|
size: {
|
|
315
326
|
...l.size
|
|
@@ -365,24 +376,24 @@ const e = {
|
|
|
365
376
|
value: "{borderRadius.sm}"
|
|
366
377
|
}
|
|
367
378
|
}
|
|
368
|
-
},
|
|
379
|
+
}, f = {
|
|
369
380
|
...s,
|
|
370
381
|
...i
|
|
371
|
-
},
|
|
372
|
-
borderRadius:
|
|
373
|
-
colors:
|
|
382
|
+
}, c = {
|
|
383
|
+
borderRadius: f,
|
|
384
|
+
colors: t,
|
|
374
385
|
font: u
|
|
375
386
|
};
|
|
376
387
|
export {
|
|
377
|
-
|
|
388
|
+
f as borderRadius,
|
|
378
389
|
i as borderRadiusComponents,
|
|
379
390
|
s as borderRadiusSemantic,
|
|
380
|
-
|
|
391
|
+
t as colors,
|
|
381
392
|
e as colorsBase,
|
|
382
|
-
|
|
383
|
-
|
|
393
|
+
r as colorsComponents,
|
|
394
|
+
a as colorsSemantic,
|
|
384
395
|
u as font,
|
|
385
|
-
|
|
396
|
+
o as fontComponents,
|
|
386
397
|
l as fontSemantic,
|
|
387
|
-
|
|
398
|
+
c as tokens
|
|
388
399
|
};
|