@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,20 +1,20 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { VERSION as
|
|
1
|
+
import { u as S, A as Y } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
2
|
+
import { createContext as N, useMemo as x, useState as z, useCallback as D, useContext as A } from "react";
|
|
3
|
+
import { VERSION as O } from "../../version.js";
|
|
4
4
|
import "../AuthButton/index.js";
|
|
5
5
|
import { useAppConfig as g } from "../CDPReactProvider/index.js";
|
|
6
|
-
import { CopyAddress as
|
|
7
|
-
import { CopyEvmKeyButton as
|
|
8
|
-
import { CopySolanaKeyButton as
|
|
9
|
-
import { jsx as o, jsxs as
|
|
10
|
-
import { useCurrentUser as
|
|
11
|
-
import { c as
|
|
12
|
-
import { Banner as
|
|
13
|
-
import { CoinbaseFooter as
|
|
14
|
-
import { Button as
|
|
15
|
-
import { Modal as
|
|
16
|
-
import { IconXMark as
|
|
17
|
-
import { childrenHasComponent as
|
|
6
|
+
import { CopyAddress as j } from "../CopyAddress/index.js";
|
|
7
|
+
import { CopyEvmKeyButton as U } from "../CopyEvmKeyButton/index.js";
|
|
8
|
+
import { CopySolanaKeyButton as X } from "../CopySolanaKeyButton/index.js";
|
|
9
|
+
import { jsx as o, jsxs as d, Fragment as E } from "react/jsx-runtime";
|
|
10
|
+
import { useCurrentUser as Z } from "@coinbase/cdp-hooks";
|
|
11
|
+
import { c as h } from "../../chunks/lite.1fxw3LjI.js";
|
|
12
|
+
import { Banner as _ } from "../ui/Banner/index.js";
|
|
13
|
+
import { CoinbaseFooter as $ } from "../ui/CoinbaseFooter/index.js";
|
|
14
|
+
import { Button as T } from "../ui/Button/index.js";
|
|
15
|
+
import { Modal as q, ModalClose as H, ModalContent as L, ModalTitle as G, ModalTrigger as J } from "../ui/Modal/index.js";
|
|
16
|
+
import { IconXMark as Q } from "../../icons/IconXMark.js";
|
|
17
|
+
import { childrenHasComponent as M } from "../../utils/childrenHasComponent.js";
|
|
18
18
|
import "../Fund/index.js";
|
|
19
19
|
import "../FundModal/index.js";
|
|
20
20
|
import "../LinkAuth/index.js";
|
|
@@ -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 "../../types/secureIframe.js";
|
|
55
55
|
import "../Fund/FundForm.js";
|
|
56
56
|
import "../Fund/FundTitle.js";
|
|
57
57
|
import "../Fund/FundProvider.js";
|
|
@@ -69,213 +69,243 @@ import "../SignIn/SignInForm.js";
|
|
|
69
69
|
import "../SignIn/SignInImage.js";
|
|
70
70
|
import "../SignIn/SignInTitle.js";
|
|
71
71
|
import "../SignIn/SignInProvider.js";
|
|
72
|
-
import '../../assets/ExportWallet.css';const
|
|
72
|
+
import '../../assets/ExportWallet.css';const tt = "ExportWallet-module__footer___NvrFY", f = {
|
|
73
73
|
"export-wallet": "ExportWallet-module__export-wallet___EyZys",
|
|
74
74
|
"no-footer": "ExportWallet-module__no-footer___fzl3R",
|
|
75
75
|
"export-wallet-title": "ExportWallet-module__export-wallet-title___MuI09",
|
|
76
|
-
footer:
|
|
77
|
-
},
|
|
76
|
+
footer: tt
|
|
77
|
+
}, k = N({
|
|
78
78
|
address: "",
|
|
79
|
+
isSessionExpired: !1,
|
|
79
80
|
type: "evm-eoa"
|
|
80
81
|
}), C = () => {
|
|
81
|
-
const t =
|
|
82
|
+
const t = A(k);
|
|
82
83
|
if (!t)
|
|
83
84
|
throw new Error("useExportWalletContext must be used within a ExportWalletProvider");
|
|
84
85
|
return t;
|
|
85
|
-
},
|
|
86
|
+
}, ot = ({
|
|
86
87
|
address: t,
|
|
87
|
-
children:
|
|
88
|
-
onIframeError:
|
|
89
|
-
onIframeReady:
|
|
90
|
-
|
|
88
|
+
children: e,
|
|
89
|
+
onIframeError: r,
|
|
90
|
+
onIframeReady: a,
|
|
91
|
+
onIframeSessionExpired: l,
|
|
92
|
+
onCopySuccess: i
|
|
91
93
|
}) => {
|
|
92
|
-
const { currentUser:
|
|
93
|
-
() => !!
|
|
94
|
-
[
|
|
95
|
-
),
|
|
96
|
-
() => !!
|
|
97
|
-
[
|
|
98
|
-
),
|
|
99
|
-
()
|
|
100
|
-
|
|
94
|
+
const { currentUser: n } = Z(), s = x(
|
|
95
|
+
() => !!n?.solanaAccounts?.find((w) => w === t),
|
|
96
|
+
[n?.solanaAccounts, t]
|
|
97
|
+
), m = x(
|
|
98
|
+
() => !!n?.evmSmartAccounts?.find((w) => w === t),
|
|
99
|
+
[n?.evmSmartAccounts, t]
|
|
100
|
+
), c = s ? "solana" : m ? "evm-smart" : "evm-eoa", [u, y] = z(!1), v = D(() => {
|
|
101
|
+
y(!0), l?.();
|
|
102
|
+
}, [l]), V = x(
|
|
103
|
+
() => ({
|
|
104
|
+
address: t,
|
|
105
|
+
isSessionExpired: u,
|
|
106
|
+
type: c,
|
|
107
|
+
onIframeError: r,
|
|
108
|
+
onIframeReady: a,
|
|
109
|
+
onIframeSessionExpired: v,
|
|
110
|
+
onCopySuccess: i
|
|
111
|
+
}),
|
|
112
|
+
[
|
|
113
|
+
t,
|
|
114
|
+
u,
|
|
115
|
+
c,
|
|
116
|
+
v,
|
|
117
|
+
r,
|
|
118
|
+
a,
|
|
119
|
+
i
|
|
120
|
+
]
|
|
101
121
|
);
|
|
102
|
-
return /* @__PURE__ */ o(
|
|
103
|
-
},
|
|
122
|
+
return /* @__PURE__ */ o(k.Provider, { value: V, children: e });
|
|
123
|
+
}, P = ({
|
|
104
124
|
children: t,
|
|
105
|
-
className:
|
|
106
|
-
as:
|
|
107
|
-
...
|
|
125
|
+
className: e = "",
|
|
126
|
+
as: r = "h2",
|
|
127
|
+
...a
|
|
108
128
|
}) => /* @__PURE__ */ o(
|
|
109
|
-
|
|
129
|
+
r,
|
|
110
130
|
{
|
|
111
131
|
"data-part": "title",
|
|
112
|
-
className: f
|
|
113
|
-
...
|
|
132
|
+
className: h(f["export-wallet-title"], e),
|
|
133
|
+
...a,
|
|
114
134
|
children: t || "Export your wallet"
|
|
115
135
|
}
|
|
116
|
-
),
|
|
117
|
-
const { type: r } = C();
|
|
118
|
-
return r === "evm-smart" ? /* @__PURE__ */ o(
|
|
119
|
-
},
|
|
136
|
+
), F = (t) => {
|
|
137
|
+
const { isSessionExpired: e, type: r } = C();
|
|
138
|
+
return e ? /* @__PURE__ */ o(_, { "data-part": "warning", variant: "warning", ...t, children: "Your export session has expired." }) : r === "evm-smart" ? /* @__PURE__ */ o(_, { "data-part": "warning", variant: "warning", ...t, children: "Cannot export a smart account's private key; only the owner's private key can be exported." }) : /* @__PURE__ */ o(_, { "data-part": "warning", variant: "warning", ...t, children: "Do not share your private key with anyone" });
|
|
139
|
+
}, I = ({
|
|
120
140
|
label: t = "Your wallet address",
|
|
121
|
-
...
|
|
141
|
+
...e
|
|
122
142
|
}) => {
|
|
123
|
-
const { address:
|
|
124
|
-
return /* @__PURE__ */ o(
|
|
125
|
-
},
|
|
143
|
+
const { address: r } = C();
|
|
144
|
+
return /* @__PURE__ */ o(j, { "data-part": "copy-address", address: r, label: t, ...e });
|
|
145
|
+
}, R = ({
|
|
126
146
|
fullWidth: t = !0,
|
|
127
|
-
...
|
|
147
|
+
...e
|
|
128
148
|
}) => {
|
|
129
|
-
const { address:
|
|
130
|
-
return
|
|
131
|
-
|
|
149
|
+
const { address: r, type: a, onIframeError: l, onIframeReady: i, onIframeSessionExpired: n, onCopySuccess: s } = C();
|
|
150
|
+
return a === "solana" ? /* @__PURE__ */ o(
|
|
151
|
+
X,
|
|
132
152
|
{
|
|
133
153
|
fullWidth: t,
|
|
134
|
-
address:
|
|
135
|
-
onError:
|
|
136
|
-
onReady:
|
|
137
|
-
|
|
138
|
-
|
|
154
|
+
address: r,
|
|
155
|
+
onError: l,
|
|
156
|
+
onReady: i,
|
|
157
|
+
onSessionExpired: n,
|
|
158
|
+
onSuccess: s,
|
|
159
|
+
...e
|
|
139
160
|
}
|
|
140
|
-
) :
|
|
141
|
-
|
|
161
|
+
) : a === "evm-eoa" ? /* @__PURE__ */ o(
|
|
162
|
+
U,
|
|
142
163
|
{
|
|
143
164
|
fullWidth: t,
|
|
144
|
-
address:
|
|
145
|
-
onError:
|
|
146
|
-
onReady:
|
|
147
|
-
|
|
148
|
-
|
|
165
|
+
address: r,
|
|
166
|
+
onError: l,
|
|
167
|
+
onReady: i,
|
|
168
|
+
onSessionExpired: n,
|
|
169
|
+
onSuccess: s,
|
|
170
|
+
...e
|
|
149
171
|
}
|
|
150
172
|
) : null;
|
|
151
|
-
},
|
|
173
|
+
}, B = (t) => /* @__PURE__ */ o($, { "data-part": "coinbase-footer", ...t }), et = ({ children: t }) => {
|
|
174
|
+
const { showCoinbaseFooter: e } = g(), { type: r, isSessionExpired: a } = C();
|
|
175
|
+
return t && typeof t == "function" ? t({ type: r, isSessionExpired: a }) : t || /* @__PURE__ */ d(E, { children: [
|
|
176
|
+
/* @__PURE__ */ o(P, {}),
|
|
177
|
+
/* @__PURE__ */ o(F, {}),
|
|
178
|
+
/* @__PURE__ */ o(I, {}),
|
|
179
|
+
/* @__PURE__ */ o(R, {}),
|
|
180
|
+
e && /* @__PURE__ */ o(B, { className: f.footer })
|
|
181
|
+
] });
|
|
182
|
+
}, rt = ({
|
|
152
183
|
address: t,
|
|
153
|
-
children:
|
|
154
|
-
className:
|
|
155
|
-
onIframeError:
|
|
156
|
-
onIframeReady:
|
|
157
|
-
|
|
158
|
-
|
|
184
|
+
children: e,
|
|
185
|
+
className: r = "",
|
|
186
|
+
onIframeError: a,
|
|
187
|
+
onIframeReady: l,
|
|
188
|
+
onIframeSessionExpired: i,
|
|
189
|
+
onCopySuccess: n,
|
|
190
|
+
...s
|
|
159
191
|
}) => {
|
|
160
|
-
|
|
192
|
+
S("export_wallet");
|
|
193
|
+
const { showCoinbaseFooter: m } = g();
|
|
161
194
|
return /* @__PURE__ */ o(
|
|
162
195
|
"div",
|
|
163
196
|
{
|
|
164
|
-
className:
|
|
165
|
-
|
|
166
|
-
!
|
|
167
|
-
|
|
197
|
+
className: h(
|
|
198
|
+
f["export-wallet"],
|
|
199
|
+
!m && f["no-footer"],
|
|
200
|
+
r
|
|
168
201
|
),
|
|
169
|
-
...
|
|
202
|
+
...s,
|
|
170
203
|
children: /* @__PURE__ */ o(
|
|
171
|
-
|
|
204
|
+
ot,
|
|
172
205
|
{
|
|
173
206
|
address: t,
|
|
174
|
-
onIframeReady:
|
|
175
|
-
onCopySuccess:
|
|
176
|
-
onIframeError:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
/* @__PURE__ */ o(S, {}),
|
|
180
|
-
/* @__PURE__ */ o(T, {}),
|
|
181
|
-
/* @__PURE__ */ o(k, {}),
|
|
182
|
-
s && /* @__PURE__ */ o(P, { className: _.footer })
|
|
183
|
-
] })
|
|
207
|
+
onIframeReady: l,
|
|
208
|
+
onCopySuccess: n,
|
|
209
|
+
onIframeError: a,
|
|
210
|
+
onIframeSessionExpired: i,
|
|
211
|
+
children: /* @__PURE__ */ o(et, { children: e })
|
|
184
212
|
}
|
|
185
213
|
)
|
|
186
214
|
}
|
|
187
215
|
);
|
|
188
|
-
},
|
|
216
|
+
}, at = "ExportWalletModal-module__trigger___zMk8N", nt = "ExportWalletModal-module__content___KzNol", lt = "ExportWalletModal-module__footer___byg1T", it = "ExportWalletModal-module__modal___pX1AP", p = {
|
|
189
217
|
"export-wallet": "ExportWalletModal-module__export-wallet___--L56",
|
|
190
|
-
trigger:
|
|
218
|
+
trigger: at,
|
|
191
219
|
"title-bar": "ExportWalletModal-module__title-bar___RTPZq",
|
|
192
|
-
content:
|
|
220
|
+
content: nt,
|
|
193
221
|
"close-button": "ExportWalletModal-module__close-button___ImsDR",
|
|
194
222
|
"close-icon": "ExportWalletModal-module__close-icon___iAfyT",
|
|
195
|
-
footer:
|
|
196
|
-
modal:
|
|
197
|
-
},
|
|
198
|
-
const t =
|
|
223
|
+
footer: lt,
|
|
224
|
+
modal: it
|
|
225
|
+
}, K = N(null), st = () => {
|
|
226
|
+
const t = A(K);
|
|
199
227
|
if (!t)
|
|
200
228
|
throw new Error("useExportWalletModalContext must be used within a ExportWalletModal");
|
|
201
229
|
return t;
|
|
202
|
-
},
|
|
230
|
+
}, b = ({
|
|
203
231
|
children: t,
|
|
204
|
-
className:
|
|
205
|
-
label:
|
|
206
|
-
...
|
|
207
|
-
}) => /* @__PURE__ */ o(
|
|
232
|
+
className: e = "",
|
|
233
|
+
label: r,
|
|
234
|
+
...a
|
|
235
|
+
}) => /* @__PURE__ */ o(J, { asChild: !0, children: t || /* @__PURE__ */ o(T, { className: h(p.trigger, e), ...a, children: r || "Export wallet" }) }), pt = ({
|
|
208
236
|
children: t = "Copy private key to export wallet",
|
|
209
|
-
...
|
|
210
|
-
}) => /* @__PURE__ */ o(
|
|
211
|
-
|
|
237
|
+
...e
|
|
238
|
+
}) => /* @__PURE__ */ o(G, { asChild: !0, children: /* @__PURE__ */ o(P, { ...e, children: t }) }), mt = ({ children: t }) => /* @__PURE__ */ o(H, { asChild: !0, children: t || /* @__PURE__ */ o(
|
|
239
|
+
T,
|
|
212
240
|
{
|
|
213
241
|
"aria-label": "Close",
|
|
214
242
|
className: p["close-button"],
|
|
215
243
|
variant: "transparentSecondary",
|
|
216
|
-
children: /* @__PURE__ */ o(
|
|
244
|
+
children: /* @__PURE__ */ o(Q, { className: p["close-icon"] })
|
|
217
245
|
}
|
|
218
|
-
) }),
|
|
246
|
+
) }), W = ({
|
|
219
247
|
children: t,
|
|
220
|
-
className:
|
|
221
|
-
...
|
|
248
|
+
className: e = "",
|
|
249
|
+
...r
|
|
222
250
|
}) => {
|
|
223
|
-
const { showCoinbaseFooter:
|
|
224
|
-
return /* @__PURE__ */ o(
|
|
225
|
-
|
|
251
|
+
const { showCoinbaseFooter: a } = g(), { address: l, onIframeReady: i, onCopySuccess: n, onIframeError: s, onIframeSessionExpired: m } = st();
|
|
252
|
+
return /* @__PURE__ */ o(L, { "aria-describedby": void 0, className: h(p.modal, e), ...r, children: /* @__PURE__ */ o(
|
|
253
|
+
rt,
|
|
226
254
|
{
|
|
227
|
-
address:
|
|
228
|
-
onIframeReady:
|
|
229
|
-
onCopySuccess:
|
|
255
|
+
address: l,
|
|
256
|
+
onIframeReady: i,
|
|
257
|
+
onCopySuccess: n,
|
|
230
258
|
onIframeError: s,
|
|
259
|
+
onIframeSessionExpired: m,
|
|
231
260
|
className: p["export-wallet"],
|
|
232
|
-
children: t || /* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
/* @__PURE__ */ o(
|
|
235
|
-
/* @__PURE__ */ o(
|
|
261
|
+
children: t || (({ isSessionExpired: c }) => /* @__PURE__ */ d(E, { children: [
|
|
262
|
+
/* @__PURE__ */ d("div", { className: p["title-bar"], children: [
|
|
263
|
+
/* @__PURE__ */ o(pt, {}),
|
|
264
|
+
/* @__PURE__ */ o(mt, {})
|
|
236
265
|
] }),
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
-
/* @__PURE__ */ o(
|
|
239
|
-
/* @__PURE__ */ o(
|
|
240
|
-
/* @__PURE__ */ o(
|
|
241
|
-
|
|
266
|
+
/* @__PURE__ */ d("div", { className: p.content, children: [
|
|
267
|
+
c ? /* @__PURE__ */ o(_, { role: "alert", "data-part": "warning", variant: "warning", children: "Your export session has expired. Please close and reopen the modal to export again." }) : /* @__PURE__ */ o(F, {}),
|
|
268
|
+
/* @__PURE__ */ o(I, {}),
|
|
269
|
+
/* @__PURE__ */ o(R, {}),
|
|
270
|
+
a && /* @__PURE__ */ o(B, { className: p.footer })
|
|
242
271
|
] })
|
|
243
|
-
] })
|
|
272
|
+
] }))
|
|
244
273
|
}
|
|
245
274
|
) });
|
|
246
|
-
},
|
|
275
|
+
}, Ao = ({
|
|
247
276
|
address: t,
|
|
248
|
-
children:
|
|
249
|
-
onIframeReady:
|
|
250
|
-
onCopySuccess:
|
|
251
|
-
onIframeError:
|
|
252
|
-
|
|
253
|
-
|
|
277
|
+
children: e,
|
|
278
|
+
onIframeReady: r,
|
|
279
|
+
onCopySuccess: a,
|
|
280
|
+
onIframeError: l,
|
|
281
|
+
onIframeSessionExpired: i,
|
|
282
|
+
open: n,
|
|
283
|
+
setIsOpen: s
|
|
254
284
|
}) => {
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
() => ({ address: t, onIframeReady:
|
|
258
|
-
[t,
|
|
259
|
-
),
|
|
260
|
-
return /* @__PURE__ */ o(
|
|
261
|
-
/* @__PURE__ */ o(
|
|
262
|
-
/* @__PURE__ */ o(
|
|
263
|
-
] }) : /* @__PURE__ */
|
|
264
|
-
|
|
265
|
-
!u && /* @__PURE__ */ o(
|
|
285
|
+
S("export_wallet_modal");
|
|
286
|
+
const m = x(
|
|
287
|
+
() => ({ address: t, onIframeReady: r, onCopySuccess: a, onIframeError: l, onIframeSessionExpired: i }),
|
|
288
|
+
[t, r, a, l, i]
|
|
289
|
+
), c = e ? M(e, b) : !1, u = e ? M(e, W) : !1, y = !c && !u;
|
|
290
|
+
return /* @__PURE__ */ o(K.Provider, { value: m, children: /* @__PURE__ */ o(q, { open: n, onOpenChange: s, children: y ? /* @__PURE__ */ d(E, { children: [
|
|
291
|
+
/* @__PURE__ */ o(b, { children: e }),
|
|
292
|
+
/* @__PURE__ */ o(W, {})
|
|
293
|
+
] }) : /* @__PURE__ */ d(E, { children: [
|
|
294
|
+
e,
|
|
295
|
+
!u && /* @__PURE__ */ o(W, {})
|
|
266
296
|
] }) }) });
|
|
267
297
|
};
|
|
268
|
-
|
|
298
|
+
Y.registerPackageVersion("react", O);
|
|
269
299
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
300
|
+
Ao as E,
|
|
301
|
+
rt as ExportWallet,
|
|
302
|
+
I as ExportWalletCopyAddress,
|
|
303
|
+
R as ExportWalletCopyKeyButton,
|
|
304
|
+
B as ExportWalletFooter,
|
|
305
|
+
P as ExportWalletTitle,
|
|
306
|
+
F as ExportWalletWarning,
|
|
307
|
+
mt as a,
|
|
308
|
+
W as b,
|
|
309
|
+
pt as c,
|
|
310
|
+
b as d
|
|
281
311
|
};
|
|
@@ -6,12 +6,12 @@ interface ExportWalletModalTriggerProps extends Partial<Pick<ButtonProps, "class
|
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
label?: ReactNode;
|
|
8
8
|
}
|
|
9
|
-
type ExportWalletModalContentProps = ModalContentProps
|
|
9
|
+
type ExportWalletModalContentProps = Omit<ModalContentProps, "children"> & Pick<ExportWalletProps, "children">;
|
|
10
10
|
type ExportWalletModalTitleProps = ExportWalletTitleProps;
|
|
11
11
|
interface ExportWalletModalCloseProps {
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
interface ExportWalletModalProps extends Pick<ExportWalletProps, "address" | "onIframeReady" | "onCopySuccess" | "onIframeError"> {
|
|
14
|
+
interface ExportWalletModalProps extends Pick<ExportWalletProps, "address" | "onIframeReady" | "onCopySuccess" | "onIframeError" | "onIframeSessionExpired"> {
|
|
15
15
|
children?: ReactNode;
|
|
16
16
|
open?: boolean;
|
|
17
17
|
setIsOpen?: (value: boolean) => void;
|
|
@@ -20,5 +20,5 @@ declare const ExportWalletModalTrigger: ({ children, className, label, ...props
|
|
|
20
20
|
declare const ExportWalletModalTitle: ({ children, ...props }: ExportWalletModalTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
declare const ExportWalletModalClose: ({ children }: ExportWalletModalCloseProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
declare const ExportWalletModalContent: ({ children, className, ...props }: ExportWalletModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
declare const ExportWalletModal: ({ address, children, onIframeReady, onCopySuccess, onIframeError, open, setIsOpen, }: ExportWalletModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare const ExportWalletModal: ({ address, children, onIframeReady, onCopySuccess, onIframeError, onIframeSessionExpired, open, setIsOpen, }: ExportWalletModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export { ExportWalletModal, ExportWalletModalClose, ExportWalletModalContent, ExportWalletModalTitle, ExportWalletModalTrigger, type ExportWalletModalProps, type ExportWalletModalCloseProps, type ExportWalletModalContentProps, type ExportWalletModalTitleProps, type ExportWalletModalTriggerProps, };
|
|
@@ -3,15 +3,16 @@ import "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import "../../chunks/lite.1fxw3LjI.js";
|
|
5
5
|
import "../CDPReactProvider/index.js";
|
|
6
|
-
import { E
|
|
6
|
+
import { E, a as M, b as W, c as g, d as n } from "../ExportWallet/index.js";
|
|
7
|
+
import "../ui/Banner/index.js";
|
|
7
8
|
import "../ui/Button/index.js";
|
|
8
9
|
import "../ui/Modal/index.js";
|
|
9
10
|
import "../../icons/IconXMark.js";
|
|
10
11
|
import "../../utils/childrenHasComponent.js";
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
E as ExportWalletModal,
|
|
14
|
+
M as ExportWalletModalClose,
|
|
15
|
+
W as ExportWalletModalContent,
|
|
16
|
+
g as ExportWalletModalTitle,
|
|
17
|
+
n as ExportWalletModalTrigger
|
|
17
18
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { EventMetadata, OnrampError, OnrampSuccessEventData } from '../types';
|
|
2
2
|
type SetupOnrampEventListenersParams = {
|
|
3
|
-
host?: string;
|
|
4
3
|
onEvent?: (event: EventMetadata) => void;
|
|
5
4
|
onExit?: (error?: OnrampError) => void;
|
|
6
5
|
onSuccess?: (data?: OnrampSuccessEventData) => void;
|
|
7
6
|
};
|
|
8
|
-
export declare function setupOnrampEventListeners({
|
|
7
|
+
export declare function setupOnrampEventListeners({ onEvent, onExit, onSuccess, }: SetupOnrampEventListenersParams): () => void;
|
|
9
8
|
export {};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import { subscribeToWindowMessage as
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onSuccess: r
|
|
2
|
+
import { subscribeToWindowMessage as i } from "./subscribeToWindowMessage.js";
|
|
3
|
+
function c({
|
|
4
|
+
onEvent: s,
|
|
5
|
+
onExit: t,
|
|
6
|
+
onSuccess: n
|
|
8
7
|
}) {
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
e.eventName === "success" && r?.(e.data), e.eventName === "exit" && n?.(e.error), t?.(e);
|
|
8
|
+
return i({
|
|
9
|
+
onMessage: (r) => {
|
|
10
|
+
const e = r;
|
|
11
|
+
e.eventName === "success" && n?.(e.data), e.eventName === "exit" && t?.(e.error), s?.(e);
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
15
|
export {
|
|
18
|
-
|
|
16
|
+
c as setupOnrampEventListeners
|
|
19
17
|
};
|
|
@@ -4,11 +4,11 @@ export type JsonObject = {
|
|
|
4
4
|
export type JsonArray = JsonValue[];
|
|
5
5
|
export type JsonPrimitive = string | number | boolean | null;
|
|
6
6
|
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
7
|
-
export declare const DEFAULT_ONRAMP_URL
|
|
7
|
+
export declare const DEFAULT_ONRAMP_URL: string[];
|
|
8
8
|
type MessageData = JsonObject;
|
|
9
9
|
export declare function subscribeToWindowMessage({ onMessage, allowedOrigin, onValidateOrigin, }: {
|
|
10
10
|
onMessage: (data?: MessageData) => void;
|
|
11
|
-
allowedOrigin
|
|
11
|
+
allowedOrigin?: string | string[];
|
|
12
12
|
onValidateOrigin?: (origin: string) => Promise<boolean>;
|
|
13
13
|
}): () => void;
|
|
14
14
|
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const a = "https://pay.coinbase.com";
|
|
1
|
+
const a = ["https://pay.coinbase.com", "https://pay-sandbox.coinbase.com"];
|
|
2
2
|
function d({
|
|
3
|
-
onMessage:
|
|
4
|
-
allowedOrigin:
|
|
5
|
-
onValidateOrigin:
|
|
3
|
+
onMessage: e,
|
|
4
|
+
allowedOrigin: s = a,
|
|
5
|
+
onValidateOrigin: i = () => Promise.resolve(!0)
|
|
6
6
|
}) {
|
|
7
|
-
const o = (
|
|
8
|
-
if (!c({ event:
|
|
7
|
+
const o = (n) => {
|
|
8
|
+
if (!c({ event: n, allowedOrigin: s }))
|
|
9
9
|
return;
|
|
10
|
-
const { eventName: t, data: r } = JSON.parse(
|
|
11
|
-
t === "event" && (async () => await n
|
|
10
|
+
const { eventName: t, data: r } = JSON.parse(n.data);
|
|
11
|
+
t === "event" && (async () => await i(n.origin) && e(r))();
|
|
12
12
|
};
|
|
13
13
|
return window.addEventListener("message", o), () => {
|
|
14
14
|
window.removeEventListener("message", o);
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
const c = ({
|
|
18
|
-
event:
|
|
19
|
-
allowedOrigin:
|
|
20
|
-
}) => !
|
|
18
|
+
event: e,
|
|
19
|
+
allowedOrigin: s
|
|
20
|
+
}) => !s || (typeof s == "string" ? e.origin === s : s.includes(e.origin));
|
|
21
21
|
export {
|
|
22
22
|
a as DEFAULT_ONRAMP_URL,
|
|
23
23
|
d as subscribeToWindowMessage
|