@coinbase/cdp-react 0.0.86 → 0.0.88
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/CDPReactProvider.css +1 -1
- package/dist/assets/EnrollMfaFlow.css +1 -1
- package/dist/assets/VerifyMfaFlow.css +1 -1
- package/dist/assets/VerifyMfaFlowBackButton.css +1 -0
- package/dist/assets/VerifyMfaInline.css +1 -1
- package/dist/assets/VerifyMfaItem.css +1 -0
- package/dist/assets/VerifyMfaItems.css +1 -0
- package/dist/assets/sms.css +1 -0
- package/dist/chunks/CDPReactProvider.BkmtXUv1.js +337 -0
- package/dist/chunks/{LinkAuthFlow.BaUSMzGH.js → LinkAuthFlow.B4FAtf4V.js} +13 -13
- package/dist/chunks/index.BX4k-ruQ.js +12 -0
- package/dist/chunks/index.Bgx0-QLY.js +12 -0
- package/dist/chunks/{index.C_DV0Ud7.js → index.DgrgIsTX.js} +1 -1
- package/dist/chunks/useSendComponentCallOnce.DGjALrnZ.js +278 -0
- package/dist/components/AuthButton/index.js +1 -1
- package/dist/components/CDPReactProvider/index.js +1 -1
- package/dist/components/CopyEvmKeyButton/index.js +1 -1
- package/dist/components/CopySolanaKeyButton/index.js +1 -1
- package/dist/components/EnrollMfa/EnrollMfaDescription.js +4 -3
- package/dist/components/EnrollMfa/EnrollMfaFlow.js +27 -26
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.js +7 -6
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +1 -1
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.js +5 -4
- package/dist/components/EnrollMfa/EnrollMfaImage.js +7 -6
- package/dist/components/EnrollMfa/EnrollMfaItem.js +7 -6
- package/dist/components/EnrollMfa/EnrollMfaItems.js +28 -25
- package/dist/components/EnrollMfa/EnrollMfaProvider.js +22 -17
- package/dist/components/EnrollMfa/EnrollMfaTitle.js +8 -7
- package/dist/components/EnrollMfa/index.js +134 -128
- package/dist/components/EnrollMfa/methods/sms.d.ts +6 -0
- package/dist/components/EnrollMfa/methods/sms.js +148 -0
- package/dist/components/EnrollMfa/methods/totp.js +24 -19
- package/dist/components/EnrollMfa/types.d.ts +17 -5
- package/dist/components/EnrollMfa/types.js +1 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.js +51 -38
- package/dist/components/EnrollMfaModal/index.js +2 -2
- package/dist/components/ExportWallet/index.js +109 -101
- package/dist/components/ExportWalletModal/index.js +2 -2
- package/dist/components/Fund/index.js +2 -2
- package/dist/components/FundModal/index.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlow.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
- package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
- package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
- package/dist/components/LinkAuth/LinkAuthItems.js +1 -1
- package/dist/components/LinkAuth/LinkAuthProvider.js +1 -1
- package/dist/components/LinkAuth/index.js +4 -4
- package/dist/components/LinkAuth/types.js +1 -1
- package/dist/components/LinkAuth/utils.js +1 -1
- package/dist/components/LinkAuthModal/index.js +3 -3
- package/dist/components/OAuthStatusModal/index.js +2 -2
- package/dist/components/SendEvmTransactionButton/index.js +1 -1
- package/dist/components/SendSolanaTransactionButton/index.js +1 -1
- package/dist/components/SignIn/SignInAuthMethodButtons.js +1 -1
- package/dist/components/SignIn/SignInBackButton.js +12 -12
- package/dist/components/SignIn/SignInDescription.js +2 -2
- package/dist/components/SignIn/SignInForm.js +2 -2
- package/dist/components/SignIn/SignInImage.js +1 -1
- package/dist/components/SignIn/SignInProvider.js +1 -1
- package/dist/components/SignIn/SignInTitle.js +2 -2
- package/dist/components/SignIn/flows/SignInWithEmail.js +1 -1
- package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
- package/dist/components/SignIn/flows/SignInWithSms.js +74 -84
- package/dist/components/SignIn/index.js +2 -2
- package/dist/components/SignIn/types.d.ts +2 -0
- package/dist/components/SignIn/types.js +1 -1
- package/dist/components/SignIn/useSignInReducer.js +20 -6
- package/dist/components/SignInModal/index.js +2 -2
- package/dist/components/SignOutButton/index.js +1 -1
- package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +1 -1
- package/dist/components/VerifyMfa/VerifyMfaDescription.js +24 -14
- package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +5 -4
- package/dist/components/VerifyMfa/VerifyMfaFlow.js +52 -13
- package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +9 -0
- package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.js +40 -0
- package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +23 -0
- package/dist/components/VerifyMfa/VerifyMfaFlowProvider.js +37 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +1 -1
- package/dist/components/VerifyMfa/VerifyMfaImage.js +25 -13
- package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +10 -0
- package/dist/components/VerifyMfa/VerifyMfaItem.js +27 -0
- package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +9 -0
- package/dist/components/VerifyMfa/VerifyMfaItems.js +31 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.js +27 -14
- package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +1 -1
- package/dist/components/VerifyMfa/VerifyMfaTitle.js +23 -13
- package/dist/components/VerifyMfa/index.d.ts +6 -2
- package/dist/components/VerifyMfa/index.js +24 -15
- package/dist/components/VerifyMfa/methods/sms.d.ts +6 -0
- package/dist/components/VerifyMfa/methods/sms.js +90 -0
- package/dist/components/VerifyMfa/methods/totp.js +40 -39
- package/dist/components/VerifyMfa/types.d.ts +21 -2
- package/dist/components/VerifyMfa/types.js +1 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +2 -1
- package/dist/components/VerifyMfa/useVerifyMfaReducer.js +29 -4
- package/dist/components/VerifyMfaInline/index.d.ts +1 -1
- package/dist/components/VerifyMfaInline/index.js +133 -116
- package/dist/components/VerifyMfaModal/index.js +8 -6
- package/dist/components/ui/SwitchTransition/index.js +3 -3
- package/dist/hooks/usePhoneNumberState.d.ts +15 -0
- package/dist/hooks/usePhoneNumberState.js +39 -0
- package/dist/hooks/useTransitionMap.js +24 -22
- package/dist/hooks/useVerifyMfaModal.js +2 -2
- package/dist/index.js +60 -52
- package/dist/utils/transition.d.ts +3 -3
- package/dist/utils/transition.js +21 -20
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/dist/chunks/CDPReactProvider.CIQm4C4z.js +0 -299
- package/dist/chunks/index.CKQKBoX2.js +0 -9
- package/dist/chunks/index.Dp-lIxM1.js +0 -9
- package/dist/chunks/useSendComponentCallOnce.BHZMuo6E.js +0 -273
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as p, Fragment as N } from "react/jsx-runtime";
|
|
2
|
-
import { OAuth2ProviderType as Q, CDPContext as ee, CDPHooksProvider as oe } from "@coinbase/cdp-hooks";
|
|
3
|
-
import { useRef as A, useEffect as S, createContext as D, useState as $, useCallback as m, useMemo as E, useContext as P, useId as j, lazy as te } from "react";
|
|
4
|
-
import { registerMfaListener as re, cancelMfaVerification as ne } from "@coinbase/cdp-core";
|
|
5
|
-
import { A as se, u as J } from "./useSendComponentCallOnce.BHZMuo6E.js";
|
|
6
|
-
import { ThemeProvider as ae } from "../components/ThemeProvider/index.js";
|
|
7
|
-
import { c as ie } from "./lite.1fxw3LjI.js";
|
|
8
|
-
import { Button as Y } from "../components/ui/Button/index.js";
|
|
9
|
-
import { Modal as ce, ModalContent as fe, ModalClose as le, ModalTitle as de, ModalDescription as ue, ModalTrigger as me } from "../components/ui/Modal/index.js";
|
|
10
|
-
import { VerifyMfaDescription as q } from "../components/VerifyMfa/VerifyMfaDescription.js";
|
|
11
|
-
import { VerifyMfaFlow as z } from "../components/VerifyMfa/VerifyMfaFlow.js";
|
|
12
|
-
import { VerifyMfaFooter as B } from "../components/VerifyMfa/VerifyMfaFooter.js";
|
|
13
|
-
import { VerifyMfaImage as G } from "../components/VerifyMfa/VerifyMfaImage.js";
|
|
14
|
-
import { VerifyMfaProvider as pe, useVerifyMfaContext as he } from "../components/VerifyMfa/VerifyMfaProvider.js";
|
|
15
|
-
import { VerifyMfaTitle as X } from "../components/VerifyMfa/VerifyMfaTitle.js";
|
|
16
|
-
import { IconXMark as Me } from "../icons/IconXMark.js";
|
|
17
|
-
import { childrenHasComponent as I } from "../utils/childrenHasComponent.js";
|
|
18
|
-
import '../assets/CDPReactProvider.css';function _e(e) {
|
|
19
|
-
const t = A(!1);
|
|
20
|
-
S(() => {
|
|
21
|
-
t.current || (se.sendHookCallEvent({ name: e }), t.current = !0);
|
|
22
|
-
}, [e]);
|
|
23
|
-
}
|
|
24
|
-
const ve = "VerifyMfa-module__footer___3bANn", b = {
|
|
25
|
-
"mfa-verification": "VerifyMfa-module__mfa-verification___txLpd",
|
|
26
|
-
"mfa-verification-content": "VerifyMfa-module__mfa-verification-content___-ksMh",
|
|
27
|
-
"mfa-verification-form": "VerifyMfa-module__mfa-verification-form___7b69Y",
|
|
28
|
-
footer: ve
|
|
29
|
-
}, ye = ({
|
|
30
|
-
className: e = "",
|
|
31
|
-
children: t,
|
|
32
|
-
...r
|
|
33
|
-
}) => {
|
|
34
|
-
const { state: n } = he(), { showCoinbaseFooter: s } = R(), a = typeof t == "function" ? t(n) : t;
|
|
35
|
-
return /* @__PURE__ */ p("div", { className: `${b["mfa-verification"]} ${e}`, ...r, children: [
|
|
36
|
-
a,
|
|
37
|
-
!a && /* @__PURE__ */ p("div", { className: b["mfa-verification-content"], children: [
|
|
38
|
-
/* @__PURE__ */ o(G, {}),
|
|
39
|
-
/* @__PURE__ */ p("div", { children: [
|
|
40
|
-
/* @__PURE__ */ o(X, {}),
|
|
41
|
-
/* @__PURE__ */ o(q, {})
|
|
42
|
-
] }),
|
|
43
|
-
/* @__PURE__ */ o(z, { className: b["mfa-verification-form"] }),
|
|
44
|
-
s && /* @__PURE__ */ o(B, { className: b.footer })
|
|
45
|
-
] })
|
|
46
|
-
] });
|
|
47
|
-
}, Ce = ({ onSuccess: e, onError: t, ...r }) => (J("verify_mfa"), /* @__PURE__ */ o(pe, { onError: t, onSuccess: e, children: /* @__PURE__ */ o(ye, { ...r }) })), ge = "VerifyMfaModal-module__verify___GZ6dw", Ve = "VerifyMfaModal-module__content___BSj0G", Ae = "VerifyMfaModal-module__header___2plY9", Pe = "VerifyMfaModal-module__trigger___YXiwC", we = "VerifyMfaModal-module__flow___HE2Lf", V = {
|
|
48
|
-
verify: ge,
|
|
49
|
-
content: Ve,
|
|
50
|
-
header: Ae,
|
|
51
|
-
"close-icon": "VerifyMfaModal-module__close-icon___pyobJ",
|
|
52
|
-
"close-button": "VerifyMfaModal-module__close-button___h9yrq",
|
|
53
|
-
trigger: Pe,
|
|
54
|
-
flow: we
|
|
55
|
-
}, K = D(null), xe = () => {
|
|
56
|
-
const e = P(K);
|
|
57
|
-
if (!e)
|
|
58
|
-
throw new Error("useVerifyMfaModalContext must be used within a VerifyMfaModal");
|
|
59
|
-
return e;
|
|
60
|
-
}, U = ({
|
|
61
|
-
children: e,
|
|
62
|
-
className: t = "",
|
|
63
|
-
label: r,
|
|
64
|
-
...n
|
|
65
|
-
}) => /* @__PURE__ */ o(me, { asChild: !0, children: e || /* @__PURE__ */ o(Y, { className: ie(V.trigger, t), ...n, children: r || "Verify" }) }), O = ({ children: e, ...t }) => {
|
|
66
|
-
const { onSuccess: r, onError: n } = xe(), { showCoinbaseFooter: s } = R();
|
|
67
|
-
return /* @__PURE__ */ o(fe, { ...t, children: /* @__PURE__ */ o(Ce, { className: V.verify, onSuccess: r, onError: n, children: (a) => /* @__PURE__ */ p(N, { children: [
|
|
68
|
-
e ? typeof e == "function" ? e(a) : e : null,
|
|
69
|
-
!e && /* @__PURE__ */ p(N, { children: [
|
|
70
|
-
/* @__PURE__ */ p("div", { className: V.header, children: [
|
|
71
|
-
/* @__PURE__ */ o("span", {}),
|
|
72
|
-
/* @__PURE__ */ o(le, { asChild: !0, children: /* @__PURE__ */ o(
|
|
73
|
-
Y,
|
|
74
|
-
{
|
|
75
|
-
className: V["close-button"],
|
|
76
|
-
"aria-label": "Close",
|
|
77
|
-
size: "md",
|
|
78
|
-
variant: "transparentSecondary",
|
|
79
|
-
children: /* @__PURE__ */ o(Me, { className: V["close-icon"] })
|
|
80
|
-
}
|
|
81
|
-
) })
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ p("div", { className: V.content, children: [
|
|
84
|
-
/* @__PURE__ */ o(G, {}),
|
|
85
|
-
/* @__PURE__ */ p("div", { children: [
|
|
86
|
-
/* @__PURE__ */ o(de, { asChild: !0, children: /* @__PURE__ */ o(X, {}) }),
|
|
87
|
-
/* @__PURE__ */ o(ue, { asChild: !0, children: /* @__PURE__ */ o(q, {}) })
|
|
88
|
-
] }),
|
|
89
|
-
/* @__PURE__ */ o("div", { className: V.flow, children: /* @__PURE__ */ o(z, {}) })
|
|
90
|
-
] }),
|
|
91
|
-
s && /* @__PURE__ */ o(B, {})
|
|
92
|
-
] })
|
|
93
|
-
] }) }) });
|
|
94
|
-
}, be = ({
|
|
95
|
-
children: e,
|
|
96
|
-
open: t,
|
|
97
|
-
setIsOpen: r,
|
|
98
|
-
onCancel: n,
|
|
99
|
-
onError: s,
|
|
100
|
-
onSuccess: a
|
|
101
|
-
}) => {
|
|
102
|
-
J("verify_mfa_modal");
|
|
103
|
-
const f = t !== void 0 && r !== void 0, [i, u] = $(!1), M = f ? t : i, l = A(!1), _ = m(
|
|
104
|
-
(v) => {
|
|
105
|
-
l.current = !0, a?.(v);
|
|
106
|
-
},
|
|
107
|
-
[a]
|
|
108
|
-
), y = m(
|
|
109
|
-
(v) => {
|
|
110
|
-
f ? r?.(v) : u(v), v || (l.current || n?.(), l.current = !1);
|
|
111
|
-
},
|
|
112
|
-
[f, r, u, n]
|
|
113
|
-
), h = e ? I(e, U) : !1, d = e ? I(e, O) : !1, w = !h && !d, x = E(
|
|
114
|
-
() => ({ onCancel: n, onError: s, onSuccess: _ }),
|
|
115
|
-
[n, s, _]
|
|
116
|
-
);
|
|
117
|
-
return /* @__PURE__ */ o(K.Provider, { value: x, children: /* @__PURE__ */ o(ce, { open: M, onOpenChange: y, children: w ? /* @__PURE__ */ p(N, { children: [
|
|
118
|
-
/* @__PURE__ */ o(U, { children: e }),
|
|
119
|
-
/* @__PURE__ */ o(O, {})
|
|
120
|
-
] }) : /* @__PURE__ */ p(N, { children: [
|
|
121
|
-
e,
|
|
122
|
-
!d && /* @__PURE__ */ o(O, {})
|
|
123
|
-
] }) }) });
|
|
124
|
-
}, Oe = (e) => e?.closest("[data-cdp-provider]")?.getAttribute?.("data-cdp-provider") ?? null, F = D(void 0), Ne = "__core_mfa_handler__", Se = ({ children: e }) => {
|
|
125
|
-
const { mfa: t } = R(), r = He(), { disableAutoPrompt: n } = t, [s, a] = $(null), f = A(/* @__PURE__ */ new Map()), i = A(!1), u = m((c, C) => {
|
|
126
|
-
f.current.set(c, C);
|
|
127
|
-
}, []), M = m((c) => {
|
|
128
|
-
f.current.delete(c);
|
|
129
|
-
}, []), l = A(s);
|
|
130
|
-
l.current = s;
|
|
131
|
-
const _ = A(null), y = m((c) => l.current !== null ? !1 : (_.current = document.activeElement, a(c), !0), []), h = m(() => {
|
|
132
|
-
a(null);
|
|
133
|
-
const c = _.current;
|
|
134
|
-
_.current = null, c && requestAnimationFrame(() => {
|
|
135
|
-
c.focus();
|
|
136
|
-
});
|
|
137
|
-
}, []);
|
|
138
|
-
S(() => n ? void 0 : re(() => {
|
|
139
|
-
const C = document.activeElement, k = Oe(C);
|
|
140
|
-
k !== null && k !== r || (i.current = !0, y(Ne));
|
|
141
|
-
}), [n, y, r]);
|
|
142
|
-
const d = s ? f.current.get(s)?.current : void 0, w = s !== null, x = m(
|
|
143
|
-
(c) => {
|
|
144
|
-
c || h();
|
|
145
|
-
},
|
|
146
|
-
[h]
|
|
147
|
-
), v = m(
|
|
148
|
-
(c) => {
|
|
149
|
-
i.current && (i.current = !1), d?.onSuccess?.(c);
|
|
150
|
-
const C = d?.closeOnSuccessDelay === void 0 ? 500 : d?.closeOnSuccessDelay;
|
|
151
|
-
C !== null && (C === 0 ? h() : setTimeout(() => h(), C));
|
|
152
|
-
},
|
|
153
|
-
[d, h]
|
|
154
|
-
), L = m(
|
|
155
|
-
(c) => {
|
|
156
|
-
d?.onError?.(c);
|
|
157
|
-
},
|
|
158
|
-
[d]
|
|
159
|
-
), T = m(() => {
|
|
160
|
-
i.current && (ne(), i.current = !1), d?.onCancel?.();
|
|
161
|
-
}, [d]), Z = E(
|
|
162
|
-
() => ({
|
|
163
|
-
register: u,
|
|
164
|
-
unregister: M,
|
|
165
|
-
open: y,
|
|
166
|
-
close: h
|
|
167
|
-
}),
|
|
168
|
-
[u, M, y, h]
|
|
169
|
-
);
|
|
170
|
-
return /* @__PURE__ */ p(F.Provider, { value: Z, children: [
|
|
171
|
-
e,
|
|
172
|
-
/* @__PURE__ */ o(
|
|
173
|
-
be,
|
|
174
|
-
{
|
|
175
|
-
open: w,
|
|
176
|
-
setIsOpen: x,
|
|
177
|
-
onSuccess: v,
|
|
178
|
-
onError: L,
|
|
179
|
-
onCancel: T,
|
|
180
|
-
children: /* @__PURE__ */ o(O, {})
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
] });
|
|
184
|
-
}, Qe = (e = {}) => {
|
|
185
|
-
const t = P(F);
|
|
186
|
-
if (!t)
|
|
187
|
-
throw new Error(
|
|
188
|
-
"useVerifyMfaModal must be used within a MfaVerificationProvider or CDPReactProvider"
|
|
189
|
-
);
|
|
190
|
-
_e("use_verify_mfa_modal");
|
|
191
|
-
const r = j(), n = A(e);
|
|
192
|
-
S(() => {
|
|
193
|
-
n.current = e;
|
|
194
|
-
}, [e]);
|
|
195
|
-
const { register: s, unregister: a, open: f, close: i } = t;
|
|
196
|
-
S(() => (s(r, n), () => a(r)), [s, a, r]);
|
|
197
|
-
const u = m(() => f(r), [f, r]), M = m(() => {
|
|
198
|
-
i();
|
|
199
|
-
}, [i]);
|
|
200
|
-
return { open: u, close: M };
|
|
201
|
-
}, eo = () => P(F) ?? {
|
|
202
|
-
register: () => {
|
|
203
|
-
},
|
|
204
|
-
unregister: () => {
|
|
205
|
-
},
|
|
206
|
-
open: () => !1,
|
|
207
|
-
close: () => {
|
|
208
|
-
}
|
|
209
|
-
}, Ee = te(() => import("../components/OAuthStatusModal/index.js")), W = (e) => {
|
|
210
|
-
try {
|
|
211
|
-
return JSON.stringify(e);
|
|
212
|
-
} catch {
|
|
213
|
-
}
|
|
214
|
-
return "";
|
|
215
|
-
}, Te = Object.keys(Q).map((e) => `oauth:${e}`), De = [
|
|
216
|
-
/** Email OTP method */
|
|
217
|
-
"email",
|
|
218
|
-
/** SMS OTP method */
|
|
219
|
-
"sms"
|
|
220
|
-
], oo = [...De, ...Te], to = ({
|
|
221
|
-
children: e,
|
|
222
|
-
className: t = "",
|
|
223
|
-
config: r,
|
|
224
|
-
name: n,
|
|
225
|
-
style: s,
|
|
226
|
-
theme: a
|
|
227
|
-
}) => {
|
|
228
|
-
const f = j(), i = n ?? f, { appName: u, appLogoUrl: M, showCoinbaseFooter: l, authMethods: _, ...y } = r, h = W(y), d = E(() => y, [h]), w = { appName: u, appLogoUrl: M, showCoinbaseFooter: l, authMethods: _ }, x = _?.some((T) => T.startsWith("oauth:")), v = /* @__PURE__ */ o(Fe, { name: i, config: w, children: /* @__PURE__ */ o(ae, { className: t, style: s, theme: a, "data-cdp-provider": i, children: /* @__PURE__ */ p(Se, { children: [
|
|
229
|
-
e,
|
|
230
|
-
x && /* @__PURE__ */ o(Ee, {})
|
|
231
|
-
] }) }) });
|
|
232
|
-
return P(ee) ? v : /* @__PURE__ */ o(oe, { config: d, children: v });
|
|
233
|
-
}, H = D(
|
|
234
|
-
void 0
|
|
235
|
-
), g = {
|
|
236
|
-
appName: "",
|
|
237
|
-
appLogoUrl: "",
|
|
238
|
-
showCoinbaseFooter: !0,
|
|
239
|
-
authMethods: ["email"],
|
|
240
|
-
mfa: {
|
|
241
|
-
disableAutoPrompt: !1
|
|
242
|
-
}
|
|
243
|
-
}, Fe = ({
|
|
244
|
-
children: e,
|
|
245
|
-
config: t,
|
|
246
|
-
name: r
|
|
247
|
-
}) => {
|
|
248
|
-
const {
|
|
249
|
-
appName: n = g.appName,
|
|
250
|
-
appLogoUrl: s = g.appLogoUrl,
|
|
251
|
-
showCoinbaseFooter: a = g.showCoinbaseFooter,
|
|
252
|
-
authMethods: f = g.authMethods,
|
|
253
|
-
mfa: { disableAutoPrompt: i = g.mfa.disableAutoPrompt } = g.mfa
|
|
254
|
-
} = t ?? {}, u = W(f), M = E(() => {
|
|
255
|
-
let l = ["email"];
|
|
256
|
-
try {
|
|
257
|
-
l = JSON.parse(u);
|
|
258
|
-
} catch {
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
app: {
|
|
262
|
-
appName: n,
|
|
263
|
-
appLogoUrl: s,
|
|
264
|
-
showCoinbaseFooter: a,
|
|
265
|
-
authMethods: Array.isArray(l) && l?.length ? l : g.authMethods,
|
|
266
|
-
mfa: {
|
|
267
|
-
disableAutoPrompt: i
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
name: r
|
|
271
|
-
};
|
|
272
|
-
}, [n, s, a, u, r, i]);
|
|
273
|
-
return /* @__PURE__ */ o(H.Provider, { value: M, children: e });
|
|
274
|
-
}, R = () => {
|
|
275
|
-
const e = P(H);
|
|
276
|
-
if (!e)
|
|
277
|
-
throw new Error("useAppConfig must be used within an AppConfigProvider");
|
|
278
|
-
return e.app;
|
|
279
|
-
}, He = () => {
|
|
280
|
-
const e = P(H);
|
|
281
|
-
if (!e)
|
|
282
|
-
throw new Error("useProviderName must be used within an AppConfigProvider");
|
|
283
|
-
return e.name ?? "";
|
|
284
|
-
};
|
|
285
|
-
export {
|
|
286
|
-
De as A,
|
|
287
|
-
to as C,
|
|
288
|
-
Te as O,
|
|
289
|
-
Ce as V,
|
|
290
|
-
He as a,
|
|
291
|
-
Qe as b,
|
|
292
|
-
oo as c,
|
|
293
|
-
be as d,
|
|
294
|
-
O as e,
|
|
295
|
-
U as f,
|
|
296
|
-
Se as g,
|
|
297
|
-
eo as h,
|
|
298
|
-
R as u
|
|
299
|
-
};
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { useRef as M, useEffect as q } from "react";
|
|
2
|
-
function U(s) {
|
|
3
|
-
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
4
|
-
}
|
|
5
|
-
var E = { exports: {} }, T = { exports: {} }, S;
|
|
6
|
-
function H() {
|
|
7
|
-
return S || (S = 1, function() {
|
|
8
|
-
var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = {
|
|
9
|
-
// Bit-wise rotation left
|
|
10
|
-
rotl: function(c, u) {
|
|
11
|
-
return c << u | c >>> 32 - u;
|
|
12
|
-
},
|
|
13
|
-
// Bit-wise rotation right
|
|
14
|
-
rotr: function(c, u) {
|
|
15
|
-
return c << 32 - u | c >>> u;
|
|
16
|
-
},
|
|
17
|
-
// Swap big-endian to little-endian and vice versa
|
|
18
|
-
endian: function(c) {
|
|
19
|
-
if (c.constructor == Number)
|
|
20
|
-
return l.rotl(c, 8) & 16711935 | l.rotl(c, 24) & 4278255360;
|
|
21
|
-
for (var u = 0; u < c.length; u++)
|
|
22
|
-
c[u] = l.endian(c[u]);
|
|
23
|
-
return c;
|
|
24
|
-
},
|
|
25
|
-
// Generate an array of any length of random bytes
|
|
26
|
-
randomBytes: function(c) {
|
|
27
|
-
for (var u = []; c > 0; c--)
|
|
28
|
-
u.push(Math.floor(Math.random() * 256));
|
|
29
|
-
return u;
|
|
30
|
-
},
|
|
31
|
-
// Convert a byte array to big-endian 32-bit words
|
|
32
|
-
bytesToWords: function(c) {
|
|
33
|
-
for (var u = [], a = 0, f = 0; a < c.length; a++, f += 8)
|
|
34
|
-
u[f >>> 5] |= c[a] << 24 - f % 32;
|
|
35
|
-
return u;
|
|
36
|
-
},
|
|
37
|
-
// Convert big-endian 32-bit words to a byte array
|
|
38
|
-
wordsToBytes: function(c) {
|
|
39
|
-
for (var u = [], a = 0; a < c.length * 32; a += 8)
|
|
40
|
-
u.push(c[a >>> 5] >>> 24 - a % 32 & 255);
|
|
41
|
-
return u;
|
|
42
|
-
},
|
|
43
|
-
// Convert a byte array to a hex string
|
|
44
|
-
bytesToHex: function(c) {
|
|
45
|
-
for (var u = [], a = 0; a < c.length; a++)
|
|
46
|
-
u.push((c[a] >>> 4).toString(16)), u.push((c[a] & 15).toString(16));
|
|
47
|
-
return u.join("");
|
|
48
|
-
},
|
|
49
|
-
// Convert a hex string to a byte array
|
|
50
|
-
hexToBytes: function(c) {
|
|
51
|
-
for (var u = [], a = 0; a < c.length; a += 2)
|
|
52
|
-
u.push(parseInt(c.substr(a, 2), 16));
|
|
53
|
-
return u;
|
|
54
|
-
},
|
|
55
|
-
// Convert a byte array to a base-64 string
|
|
56
|
-
bytesToBase64: function(c) {
|
|
57
|
-
for (var u = [], a = 0; a < c.length; a += 3)
|
|
58
|
-
for (var f = c[a] << 16 | c[a + 1] << 8 | c[a + 2], d = 0; d < 4; d++)
|
|
59
|
-
a * 8 + d * 6 <= c.length * 8 ? u.push(s.charAt(f >>> 6 * (3 - d) & 63)) : u.push("=");
|
|
60
|
-
return u.join("");
|
|
61
|
-
},
|
|
62
|
-
// Convert a base-64 string to a byte array
|
|
63
|
-
base64ToBytes: function(c) {
|
|
64
|
-
c = c.replace(/[^A-Z0-9+\/]/ig, "");
|
|
65
|
-
for (var u = [], a = 0, f = 0; a < c.length; f = ++a % 4)
|
|
66
|
-
f != 0 && u.push((s.indexOf(c.charAt(a - 1)) & Math.pow(2, -2 * f + 8) - 1) << f * 2 | s.indexOf(c.charAt(a)) >>> 6 - f * 2);
|
|
67
|
-
return u;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
T.exports = l;
|
|
71
|
-
}()), T.exports;
|
|
72
|
-
}
|
|
73
|
-
var F, m;
|
|
74
|
-
function x() {
|
|
75
|
-
if (m) return F;
|
|
76
|
-
m = 1;
|
|
77
|
-
var s = {
|
|
78
|
-
// UTF-8 encoding
|
|
79
|
-
utf8: {
|
|
80
|
-
// Convert a string to a byte array
|
|
81
|
-
stringToBytes: function(l) {
|
|
82
|
-
return s.bin.stringToBytes(unescape(encodeURIComponent(l)));
|
|
83
|
-
},
|
|
84
|
-
// Convert a byte array to a string
|
|
85
|
-
bytesToString: function(l) {
|
|
86
|
-
return decodeURIComponent(escape(s.bin.bytesToString(l)));
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
// Binary encoding
|
|
90
|
-
bin: {
|
|
91
|
-
// Convert a string to a byte array
|
|
92
|
-
stringToBytes: function(l) {
|
|
93
|
-
for (var c = [], u = 0; u < l.length; u++)
|
|
94
|
-
c.push(l.charCodeAt(u) & 255);
|
|
95
|
-
return c;
|
|
96
|
-
},
|
|
97
|
-
// Convert a byte array to a string
|
|
98
|
-
bytesToString: function(l) {
|
|
99
|
-
for (var c = [], u = 0; u < l.length; u++)
|
|
100
|
-
c.push(String.fromCharCode(l[u]));
|
|
101
|
-
return c.join("");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
return F = s, F;
|
|
106
|
-
}
|
|
107
|
-
/*!
|
|
108
|
-
* Determine if an object is a Buffer
|
|
109
|
-
*
|
|
110
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
111
|
-
* @license MIT
|
|
112
|
-
*/
|
|
113
|
-
var B, O;
|
|
114
|
-
function N() {
|
|
115
|
-
if (O) return B;
|
|
116
|
-
O = 1, B = function(c) {
|
|
117
|
-
return c != null && (s(c) || l(c) || !!c._isBuffer);
|
|
118
|
-
};
|
|
119
|
-
function s(c) {
|
|
120
|
-
return !!c.constructor && typeof c.constructor.isBuffer == "function" && c.constructor.isBuffer(c);
|
|
121
|
-
}
|
|
122
|
-
function l(c) {
|
|
123
|
-
return typeof c.readFloatLE == "function" && typeof c.slice == "function" && s(c.slice(0, 0));
|
|
124
|
-
}
|
|
125
|
-
return B;
|
|
126
|
-
}
|
|
127
|
-
var A;
|
|
128
|
-
function V() {
|
|
129
|
-
return A || (A = 1, function() {
|
|
130
|
-
var s = H(), l = x().utf8, c = N(), u = x().bin, a = function(f, d) {
|
|
131
|
-
f.constructor == String ? d && d.encoding === "binary" ? f = u.stringToBytes(f) : f = l.stringToBytes(f) : c(f) ? f = Array.prototype.slice.call(f, 0) : !Array.isArray(f) && f.constructor !== Uint8Array && (f = f.toString());
|
|
132
|
-
for (var o = s.bytesToWords(f), y = f.length * 8, r = 1732584193, t = -271733879, e = -1732584194, n = 271733878, i = 0; i < o.length; i++)
|
|
133
|
-
o[i] = (o[i] << 8 | o[i] >>> 24) & 16711935 | (o[i] << 24 | o[i] >>> 8) & 4278255360;
|
|
134
|
-
o[y >>> 5] |= 128 << y % 32, o[(y + 64 >>> 9 << 4) + 14] = y;
|
|
135
|
-
for (var p = a._ff, h = a._gg, v = a._hh, _ = a._ii, i = 0; i < o.length; i += 16) {
|
|
136
|
-
var P = r, D = t, I = e, L = n;
|
|
137
|
-
r = p(r, t, e, n, o[i + 0], 7, -680876936), n = p(n, r, t, e, o[i + 1], 12, -389564586), e = p(e, n, r, t, o[i + 2], 17, 606105819), t = p(t, e, n, r, o[i + 3], 22, -1044525330), r = p(r, t, e, n, o[i + 4], 7, -176418897), n = p(n, r, t, e, o[i + 5], 12, 1200080426), e = p(e, n, r, t, o[i + 6], 17, -1473231341), t = p(t, e, n, r, o[i + 7], 22, -45705983), r = p(r, t, e, n, o[i + 8], 7, 1770035416), n = p(n, r, t, e, o[i + 9], 12, -1958414417), e = p(e, n, r, t, o[i + 10], 17, -42063), t = p(t, e, n, r, o[i + 11], 22, -1990404162), r = p(r, t, e, n, o[i + 12], 7, 1804603682), n = p(n, r, t, e, o[i + 13], 12, -40341101), e = p(e, n, r, t, o[i + 14], 17, -1502002290), t = p(t, e, n, r, o[i + 15], 22, 1236535329), r = h(r, t, e, n, o[i + 1], 5, -165796510), n = h(n, r, t, e, o[i + 6], 9, -1069501632), e = h(e, n, r, t, o[i + 11], 14, 643717713), t = h(t, e, n, r, o[i + 0], 20, -373897302), r = h(r, t, e, n, o[i + 5], 5, -701558691), n = h(n, r, t, e, o[i + 10], 9, 38016083), e = h(e, n, r, t, o[i + 15], 14, -660478335), t = h(t, e, n, r, o[i + 4], 20, -405537848), r = h(r, t, e, n, o[i + 9], 5, 568446438), n = h(n, r, t, e, o[i + 14], 9, -1019803690), e = h(e, n, r, t, o[i + 3], 14, -187363961), t = h(t, e, n, r, o[i + 8], 20, 1163531501), r = h(r, t, e, n, o[i + 13], 5, -1444681467), n = h(n, r, t, e, o[i + 2], 9, -51403784), e = h(e, n, r, t, o[i + 7], 14, 1735328473), t = h(t, e, n, r, o[i + 12], 20, -1926607734), r = v(r, t, e, n, o[i + 5], 4, -378558), n = v(n, r, t, e, o[i + 8], 11, -2022574463), e = v(e, n, r, t, o[i + 11], 16, 1839030562), t = v(t, e, n, r, o[i + 14], 23, -35309556), r = v(r, t, e, n, o[i + 1], 4, -1530992060), n = v(n, r, t, e, o[i + 4], 11, 1272893353), e = v(e, n, r, t, o[i + 7], 16, -155497632), t = v(t, e, n, r, o[i + 10], 23, -1094730640), r = v(r, t, e, n, o[i + 13], 4, 681279174), n = v(n, r, t, e, o[i + 0], 11, -358537222), e = v(e, n, r, t, o[i + 3], 16, -722521979), t = v(t, e, n, r, o[i + 6], 23, 76029189), r = v(r, t, e, n, o[i + 9], 4, -640364487), n = v(n, r, t, e, o[i + 12], 11, -421815835), e = v(e, n, r, t, o[i + 15], 16, 530742520), t = v(t, e, n, r, o[i + 2], 23, -995338651), r = _(r, t, e, n, o[i + 0], 6, -198630844), n = _(n, r, t, e, o[i + 7], 10, 1126891415), e = _(e, n, r, t, o[i + 14], 15, -1416354905), t = _(t, e, n, r, o[i + 5], 21, -57434055), r = _(r, t, e, n, o[i + 12], 6, 1700485571), n = _(n, r, t, e, o[i + 3], 10, -1894986606), e = _(e, n, r, t, o[i + 10], 15, -1051523), t = _(t, e, n, r, o[i + 1], 21, -2054922799), r = _(r, t, e, n, o[i + 8], 6, 1873313359), n = _(n, r, t, e, o[i + 15], 10, -30611744), e = _(e, n, r, t, o[i + 6], 15, -1560198380), t = _(t, e, n, r, o[i + 13], 21, 1309151649), r = _(r, t, e, n, o[i + 4], 6, -145523070), n = _(n, r, t, e, o[i + 11], 10, -1120210379), e = _(e, n, r, t, o[i + 2], 15, 718787259), t = _(t, e, n, r, o[i + 9], 21, -343485551), r = r + P >>> 0, t = t + D >>> 0, e = e + I >>> 0, n = n + L >>> 0;
|
|
138
|
-
}
|
|
139
|
-
return s.endian([r, t, e, n]);
|
|
140
|
-
};
|
|
141
|
-
a._ff = function(f, d, o, y, r, t, e) {
|
|
142
|
-
var n = f + (d & o | ~d & y) + (r >>> 0) + e;
|
|
143
|
-
return (n << t | n >>> 32 - t) + d;
|
|
144
|
-
}, a._gg = function(f, d, o, y, r, t, e) {
|
|
145
|
-
var n = f + (d & y | o & ~y) + (r >>> 0) + e;
|
|
146
|
-
return (n << t | n >>> 32 - t) + d;
|
|
147
|
-
}, a._hh = function(f, d, o, y, r, t, e) {
|
|
148
|
-
var n = f + (d ^ o ^ y) + (r >>> 0) + e;
|
|
149
|
-
return (n << t | n >>> 32 - t) + d;
|
|
150
|
-
}, a._ii = function(f, d, o, y, r, t, e) {
|
|
151
|
-
var n = f + (o ^ (d | ~y)) + (r >>> 0) + e;
|
|
152
|
-
return (n << t | n >>> 32 - t) + d;
|
|
153
|
-
}, a._blocksize = 16, a._digestsize = 16, E.exports = function(f, d) {
|
|
154
|
-
if (f == null)
|
|
155
|
-
throw new Error("Illegal argument " + f);
|
|
156
|
-
var o = s.wordsToBytes(a(f, d));
|
|
157
|
-
return d && d.asBytes ? o : d && d.asString ? u.bytesToString(o) : s.bytesToHex(o);
|
|
158
|
-
};
|
|
159
|
-
}()), E.exports;
|
|
160
|
-
}
|
|
161
|
-
var G = V();
|
|
162
|
-
const J = /* @__PURE__ */ U(G);
|
|
163
|
-
function K() {
|
|
164
|
-
try {
|
|
165
|
-
return typeof navigator < "u" && navigator.product === "ReactNative";
|
|
166
|
-
} catch {
|
|
167
|
-
return !1;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function $() {
|
|
171
|
-
try {
|
|
172
|
-
if (typeof window > "u")
|
|
173
|
-
return typeof process < "u" && process.env && "__NEXT_PROCESSED_ENV" in process.env;
|
|
174
|
-
const s = window;
|
|
175
|
-
return !!(s.__NEXT_DATA__ || s.next || document.getElementById("__next"));
|
|
176
|
-
} catch {
|
|
177
|
-
return !1;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function z() {
|
|
181
|
-
try {
|
|
182
|
-
if (typeof window > "u")
|
|
183
|
-
return !1;
|
|
184
|
-
const s = window;
|
|
185
|
-
return !!(s.__VUE__ || s.__VUE_DEVTOOLS_GLOBAL_HOOK__ || document.querySelector("[data-v-]"));
|
|
186
|
-
} catch {
|
|
187
|
-
return !1;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function W() {
|
|
191
|
-
try {
|
|
192
|
-
if (typeof window > "u")
|
|
193
|
-
return !1;
|
|
194
|
-
const s = window;
|
|
195
|
-
return s.__REACT_DEVTOOLS_GLOBAL_HOOK__ || s.React ? !0 : !!document.querySelector(
|
|
196
|
-
"[data-reactroot], [data-reactid], ._reactRoot, ._reactRootContainer"
|
|
197
|
-
);
|
|
198
|
-
} catch {
|
|
199
|
-
return !1;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function X() {
|
|
203
|
-
return W() ? "react" : K() ? "react-native" : $() ? "nextjs" : z() ? "vue" : "unknown";
|
|
204
|
-
}
|
|
205
|
-
let R = null;
|
|
206
|
-
function Z() {
|
|
207
|
-
return R === null && (R = X()), R;
|
|
208
|
-
}
|
|
209
|
-
const b = "1f8d3e558f493e38a037dbfadb8ba344", Q = "d473b1dcc969105adab157226cd9cf63", C = Symbol.for("@coinbase/cdp-analytics");
|
|
210
|
-
function Y() {
|
|
211
|
-
const s = globalThis;
|
|
212
|
-
return s[C] || (s[C] = {
|
|
213
|
-
identifier: "",
|
|
214
|
-
enabled: !0,
|
|
215
|
-
isProduction: !1,
|
|
216
|
-
isUsingMocks: !1,
|
|
217
|
-
sendEvent: w,
|
|
218
|
-
sendActionCallEvent: (l) => w({ ...l, type: "action_call" }),
|
|
219
|
-
sendHookCallEvent: (l) => w({ ...l, type: "hook_call" }),
|
|
220
|
-
sendComponentCallEvent: (l) => w({ ...l, type: "component_call" }),
|
|
221
|
-
versionRegistry: {},
|
|
222
|
-
registerPackageVersion: (l, c) => {
|
|
223
|
-
g.versionRegistry[l] = c;
|
|
224
|
-
}
|
|
225
|
-
}), s[C];
|
|
226
|
-
}
|
|
227
|
-
const g = Y();
|
|
228
|
-
async function w(s) {
|
|
229
|
-
if (!g.enabled || !g.identifier)
|
|
230
|
-
return;
|
|
231
|
-
const l = Date.now(), u = [{
|
|
232
|
-
user_id: g.identifier,
|
|
233
|
-
event_type: s.type,
|
|
234
|
-
platform: k() ? "web" : "native",
|
|
235
|
-
timestamp: l,
|
|
236
|
-
event_properties: {
|
|
237
|
-
project_name: "cdp-embedded-wallet",
|
|
238
|
-
framework: Z(),
|
|
239
|
-
isLocalHost: j(),
|
|
240
|
-
isUsingMocks: g.isUsingMocks,
|
|
241
|
-
package_versions: g.versionRegistry,
|
|
242
|
-
...s
|
|
243
|
-
}
|
|
244
|
-
}], a = JSON.stringify(u), f = l.toString(), d = J(a + f), o = {
|
|
245
|
-
client: g.isProduction ? Q : b,
|
|
246
|
-
e: a,
|
|
247
|
-
checksum: d
|
|
248
|
-
};
|
|
249
|
-
await fetch("https://cca-lite.coinbase.com/amp", {
|
|
250
|
-
method: "POST",
|
|
251
|
-
mode: "no-cors",
|
|
252
|
-
headers: {
|
|
253
|
-
"Content-Type": "application/json"
|
|
254
|
-
},
|
|
255
|
-
body: JSON.stringify(o)
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
function k() {
|
|
259
|
-
return typeof window < "u" && typeof document < "u";
|
|
260
|
-
}
|
|
261
|
-
function j() {
|
|
262
|
-
return k() ? window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" : !1;
|
|
263
|
-
}
|
|
264
|
-
function nt(s) {
|
|
265
|
-
const l = M(!1);
|
|
266
|
-
q(() => {
|
|
267
|
-
l.current || (g.sendComponentCallEvent({ name: s }), l.current = !0);
|
|
268
|
-
}, [s]);
|
|
269
|
-
}
|
|
270
|
-
export {
|
|
271
|
-
g as A,
|
|
272
|
-
nt as u
|
|
273
|
-
};
|