@coinbase/cdp-react 0.0.85 → 0.0.87

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.
Files changed (107) hide show
  1. package/dist/assets/CDPReactProvider.css +1 -1
  2. package/dist/assets/EnrollMfaFlow.css +1 -1
  3. package/dist/assets/VerifyMfaFlow.css +1 -1
  4. package/dist/assets/VerifyMfaFlowBackButton.css +1 -0
  5. package/dist/assets/VerifyMfaInline.css +1 -1
  6. package/dist/assets/VerifyMfaItem.css +1 -0
  7. package/dist/assets/VerifyMfaItems.css +1 -0
  8. package/dist/assets/sms.css +1 -0
  9. package/dist/chunks/CDPReactProvider.C38bKQ2x.js +337 -0
  10. package/dist/chunks/{LinkAuthFlow.BaUSMzGH.js → LinkAuthFlow.CLubKoY0.js} +13 -13
  11. package/dist/chunks/{index.C_DV0Ud7.js → index.BN39qScu.js} +1 -1
  12. package/dist/chunks/index.BX4k-ruQ.js +12 -0
  13. package/dist/chunks/index.Bgx0-QLY.js +12 -0
  14. package/dist/components/CDPReactProvider/index.js +1 -1
  15. package/dist/components/EnrollMfa/EnrollMfaDescription.js +4 -3
  16. package/dist/components/EnrollMfa/EnrollMfaFlow.js +27 -26
  17. package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.js +7 -6
  18. package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +1 -1
  19. package/dist/components/EnrollMfa/EnrollMfaFlowProvider.js +5 -4
  20. package/dist/components/EnrollMfa/EnrollMfaImage.js +7 -6
  21. package/dist/components/EnrollMfa/EnrollMfaItem.js +7 -6
  22. package/dist/components/EnrollMfa/EnrollMfaItems.js +28 -25
  23. package/dist/components/EnrollMfa/EnrollMfaProvider.js +22 -17
  24. package/dist/components/EnrollMfa/EnrollMfaTitle.js +8 -7
  25. package/dist/components/EnrollMfa/index.js +138 -123
  26. package/dist/components/EnrollMfa/methods/sms.d.ts +6 -0
  27. package/dist/components/EnrollMfa/methods/sms.js +148 -0
  28. package/dist/components/EnrollMfa/methods/totp.js +24 -19
  29. package/dist/components/EnrollMfa/types.d.ts +17 -5
  30. package/dist/components/EnrollMfa/types.js +1 -0
  31. package/dist/components/EnrollMfa/useEnrollMfaReducer.js +51 -38
  32. package/dist/components/EnrollMfaModal/index.js +1 -1
  33. package/dist/components/ExportWallet/index.js +109 -101
  34. package/dist/components/ExportWalletModal/index.js +1 -1
  35. package/dist/components/Fund/index.js +1 -1
  36. package/dist/components/FundModal/index.js +1 -1
  37. package/dist/components/LinkAuth/LinkAuthFlow.js +2 -2
  38. package/dist/components/LinkAuth/LinkAuthFlowBackButton.js +2 -2
  39. package/dist/components/LinkAuth/LinkAuthFlowProvider.js +2 -2
  40. package/dist/components/LinkAuth/LinkAuthItem.js +1 -1
  41. package/dist/components/LinkAuth/LinkAuthItems.js +1 -1
  42. package/dist/components/LinkAuth/LinkAuthProvider.js +1 -1
  43. package/dist/components/LinkAuth/index.js +59 -60
  44. package/dist/components/LinkAuth/types.js +1 -1
  45. package/dist/components/LinkAuth/utils.js +1 -1
  46. package/dist/components/LinkAuthModal/index.js +2 -2
  47. package/dist/components/OAuthStatusModal/index.js +1 -1
  48. package/dist/components/SignIn/SignInAuthMethodButtons.js +1 -1
  49. package/dist/components/SignIn/SignInBackButton.js +12 -12
  50. package/dist/components/SignIn/SignInDescription.js +2 -2
  51. package/dist/components/SignIn/SignInForm.js +2 -2
  52. package/dist/components/SignIn/SignInImage.js +1 -1
  53. package/dist/components/SignIn/SignInProvider.js +1 -1
  54. package/dist/components/SignIn/SignInTitle.js +2 -2
  55. package/dist/components/SignIn/flows/SignInWithEmail.js +1 -1
  56. package/dist/components/SignIn/flows/SignInWithOAuth.js +1 -1
  57. package/dist/components/SignIn/flows/SignInWithSms.js +74 -84
  58. package/dist/components/SignIn/index.js +1 -1
  59. package/dist/components/SignIn/types.d.ts +2 -0
  60. package/dist/components/SignIn/types.js +1 -1
  61. package/dist/components/SignIn/useSignInReducer.js +20 -6
  62. package/dist/components/SignInModal/index.js +1 -1
  63. package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +1 -1
  64. package/dist/components/VerifyMfa/VerifyMfaDescription.js +24 -14
  65. package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +5 -4
  66. package/dist/components/VerifyMfa/VerifyMfaFlow.js +52 -13
  67. package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +9 -0
  68. package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.js +40 -0
  69. package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +23 -0
  70. package/dist/components/VerifyMfa/VerifyMfaFlowProvider.js +37 -0
  71. package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +1 -1
  72. package/dist/components/VerifyMfa/VerifyMfaImage.js +25 -13
  73. package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +10 -0
  74. package/dist/components/VerifyMfa/VerifyMfaItem.js +27 -0
  75. package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +9 -0
  76. package/dist/components/VerifyMfa/VerifyMfaItems.js +31 -0
  77. package/dist/components/VerifyMfa/VerifyMfaProvider.js +27 -14
  78. package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +1 -1
  79. package/dist/components/VerifyMfa/VerifyMfaTitle.js +23 -13
  80. package/dist/components/VerifyMfa/index.d.ts +6 -2
  81. package/dist/components/VerifyMfa/index.js +23 -14
  82. package/dist/components/VerifyMfa/methods/sms.d.ts +6 -0
  83. package/dist/components/VerifyMfa/methods/sms.js +90 -0
  84. package/dist/components/VerifyMfa/methods/totp.js +40 -39
  85. package/dist/components/VerifyMfa/types.d.ts +21 -2
  86. package/dist/components/VerifyMfa/types.js +1 -0
  87. package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +2 -1
  88. package/dist/components/VerifyMfa/useVerifyMfaReducer.js +29 -4
  89. package/dist/components/VerifyMfaInline/index.d.ts +1 -1
  90. package/dist/components/VerifyMfaInline/index.js +133 -116
  91. package/dist/components/VerifyMfaModal/index.js +7 -5
  92. package/dist/components/ui/SwitchTransition/index.js +3 -3
  93. package/dist/hooks/usePhoneNumberState.d.ts +15 -0
  94. package/dist/hooks/usePhoneNumberState.js +39 -0
  95. package/dist/hooks/useTimeout.d.ts +4 -0
  96. package/dist/hooks/useTimeout.js +16 -0
  97. package/dist/hooks/useTransitionMap.js +58 -50
  98. package/dist/hooks/useVerifyMfaModal.js +1 -1
  99. package/dist/index.js +59 -51
  100. package/dist/utils/transition.d.ts +3 -3
  101. package/dist/utils/transition.js +21 -20
  102. package/dist/version.d.ts +1 -1
  103. package/dist/version.js +1 -1
  104. package/package.json +6 -6
  105. package/dist/chunks/CDPReactProvider.CIQm4C4z.js +0 -299
  106. package/dist/chunks/index.CKQKBoX2.js +0 -9
  107. package/dist/chunks/index.Dp-lIxM1.js +0 -9
@@ -1 +1 @@
1
- .VerifyMfa-module__mfa-verification___txLpd{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;padding:1em 2em;overflow:hidden;width:100%}.VerifyMfa-module__mfa-verification___txLpd *{box-sizing:border-box}.VerifyMfa-module__mfa-verification-content___-ksMh{display:flex;flex-direction:column;align-items:center;gap:1em;width:100%}.VerifyMfa-module__mfa-verification-form___7b69Y{padding-top:.5em}.VerifyMfa-module__footer___3bANn{padding-top:.75em;margin-top:auto;width:100%}.VerifyMfaModal-module__verify___GZ6dw{padding-top:1.5em}.VerifyMfaModal-module__content___BSj0G{display:flex;flex-direction:column;gap:1em}.VerifyMfaModal-module__header___2plY9{display:flex;align-items:center;justify-content:space-between}.VerifyMfaModal-module__close-icon___pyobJ{width:1.5em;height:1.5em}.VerifyMfaModal-module__close-button___h9yrq{padding:0}.VerifyMfaModal-module__trigger___YXiwC{padding-left:2em;padding-right:2em}.VerifyMfaModal-module__flow___HE2Lf{padding-top:.5em;padding-bottom:1em}
1
+ .VerifyMfa-module__mfa-verification___txLpd{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;max-width:38.25em;padding:.75em 1.5em 1em;overflow:hidden;width:100%}.VerifyMfa-module__mfa-verification___txLpd *{box-sizing:border-box}.VerifyMfa-module__mfa-verification-content___-ksMh{display:flex;flex-direction:column;align-items:center;gap:1em;width:100%}.VerifyMfa-module__footer___3bANn{padding-top:.75em;margin-top:auto;width:100%}.VerifyMfaModal-module__verify___GZ6dw{padding-top:1.5em}.VerifyMfaModal-module__content___BSj0G{display:flex;flex-direction:column;gap:1em}.VerifyMfaModal-module__header___2plY9{display:flex;align-items:center;justify-content:space-between}.VerifyMfaModal-module__close-icon___pyobJ{width:1.5em;height:1.5em}.VerifyMfaModal-module__close-button___h9yrq{padding:0}.VerifyMfaModal-module__trigger___YXiwC{padding-left:2em;padding-right:2em}.VerifyMfaModal-module__flow___HE2Lf{padding-bottom:1em}
@@ -1 +1 @@
1
- .EnrollMfaFlow-module__method-wrapper___yT4Pj{width:100%}.EnrollMfaFlow-module__list___oGYkb{display:flex;flex-direction:column;gap:.75em;width:100%}
1
+ .EnrollMfaFlow-module__wrapper___OVdk0{width:100%}.EnrollMfaFlow-module__list___oGYkb{display:flex;flex-direction:column;gap:.75em;width:100%}
@@ -1 +1 @@
1
- .VerifyMfaFlow-module__method-wrapper___LEPzD{width:100%}
1
+ .VerifyMfaFlow-module__wrapper___lzVPg{width:100%}.VerifyMfaFlow-module__pad-top___gF1z2{padding-top:.5em}.VerifyMfaFlow-module__list___-N0zn{display:flex;flex-direction:column;gap:.75em;width:100%}
@@ -0,0 +1 @@
1
+ .VerifyMfaFlowBackButton-module__button___cAv9W{padding:0}.VerifyMfaFlowBackButton-module__icon___ezNaM{width:1.5em;height:1.5em}
@@ -1 +1 @@
1
- .VerifyMfaInline-module__verify-mfa-inline___mn38o{box-sizing:border-box;overflow:hidden;width:100%}.VerifyMfaInline-module__verify-mfa-inline___mn38o *{box-sizing:border-box}.VerifyMfaInline-module__icon___pezMX{width:1.5em;height:auto}div.VerifyMfaInline-module__mfa-verification___WyY76{padding:0}.VerifyMfaInline-module__mfa-verification-content___M4fq0{display:flex;flex-direction:column;align-items:center;gap:1em;width:100%}.VerifyMfaInline-module__mfa-verification-form___8h2u-{padding-top:.5em}
1
+ .VerifyMfaInline-module__verify-mfa-inline___mn38o{box-sizing:border-box;overflow:hidden;width:100%}.VerifyMfaInline-module__verify-mfa-inline___mn38o *{box-sizing:border-box}.VerifyMfaInline-module__icon___pezMX{width:1.5em;height:auto}.VerifyMfaInline-module__button___-gTjp{padding:0}div.VerifyMfaInline-module__mfa-verification___WyY76{background:transparent;overflow:visible;padding:0}.VerifyMfaInline-module__mfa-verification-content___M4fq0{display:flex;flex-direction:column;align-items:center;gap:1em;width:100%}
@@ -0,0 +1 @@
1
+ .VerifyMfaItem-module__btn___7ZZjy{align-items:center;display:flex;gap:.75em;justify-content:flex-start;padding-left:1em;padding-right:1em}.VerifyMfaItem-module__icon___gse6F{display:flex;align-items:center;justify-content:center;width:1em;height:1em}.VerifyMfaItem-module__icon___gse6F svg{width:.875em;height:.875em}.VerifyMfaItem-module__text___aV6B6{font-weight:500;font-size:.875em;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -0,0 +1 @@
1
+ .VerifyMfaItems-module__list___ITk0B{list-style:none;margin:0;padding:0;width:100%}
@@ -0,0 +1 @@
1
+ .sms-module__form___G393d{display:flex;flex-direction:column;gap:1em}.sms-module__otp-form___yNrQa{padding-top:.5em}.sms-module__credentials___jMUzc{font-weight:500;overflow-wrap:break-word;word-wrap:break-word}
@@ -0,0 +1,337 @@
1
+ import { jsx as t, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
+ import { OAuth2ProviderType as ee, CDPContext as te, CDPHooksProvider as oe } from "@coinbase/cdp-hooks";
3
+ import { useRef as g, useEffect as O, useCallback as d, useLayoutEffect as re, createContext as D, useState as B, useMemo as T, useContext as S, useId as $, lazy as ne } from "react";
4
+ import { registerMfaListener as se, cancelMfaVerification as ie } from "@coinbase/cdp-core";
5
+ import { A as ae, u as j } from "./useSendComponentCallOnce.BHZMuo6E.js";
6
+ import { ThemeProvider as ce } from "../components/ThemeProvider/index.js";
7
+ import { c as le } from "./lite.1fxw3LjI.js";
8
+ import { Button as J } from "../components/ui/Button/index.js";
9
+ import { Modal as fe, ModalContent as de, ModalClose as ue, ModalTitle as me, ModalTrigger as pe } from "../components/ui/Modal/index.js";
10
+ import { VisuallyHidden as he } from "../components/ui/VisuallyHidden/index.js";
11
+ import { VerifyMfaDescription as q } from "../components/VerifyMfa/VerifyMfaDescription.js";
12
+ import { VerifyMfaFlow as z } from "../components/VerifyMfa/VerifyMfaFlow.js";
13
+ import { VerifyMfaFlowBackButton as G } from "../components/VerifyMfa/VerifyMfaFlowBackButton.js";
14
+ import { VerifyMfaFlowProvider as Me } from "../components/VerifyMfa/VerifyMfaFlowProvider.js";
15
+ import { VerifyMfaFooter as X } from "../components/VerifyMfa/VerifyMfaFooter.js";
16
+ import { VerifyMfaImage as Y } from "../components/VerifyMfa/VerifyMfaImage.js";
17
+ import "../components/VerifyMfa/VerifyMfaItem.js";
18
+ import "../components/VerifyMfa/VerifyMfaItems.js";
19
+ import { VerifyMfaProvider as ye, useVerifyMfaContext as _e } from "../components/VerifyMfa/VerifyMfaProvider.js";
20
+ import { VerifyMfaTitle as K } from "../components/VerifyMfa/VerifyMfaTitle.js";
21
+ import { IconXMark as ve } from "../icons/IconXMark.js";
22
+ import { childrenHasComponent as I } from "../utils/childrenHasComponent.js";
23
+ import '../assets/CDPReactProvider.css';function ge(e) {
24
+ const r = g(!1);
25
+ O(() => {
26
+ r.current || (ae.sendHookCallEvent({ name: e }), r.current = !0);
27
+ }, [e]);
28
+ }
29
+ const Ce = "VerifyMfa-module__footer___3bANn", E = {
30
+ "mfa-verification": "VerifyMfa-module__mfa-verification___txLpd",
31
+ "mfa-verification-content": "VerifyMfa-module__mfa-verification-content___-ksMh",
32
+ footer: Ce
33
+ }, Ve = ({
34
+ className: e = "",
35
+ children: r,
36
+ ...s
37
+ }) => {
38
+ const { state: o, dispatch: n } = _e(), { showCoinbaseFooter: l } = L(), a = g(o.step), c = g(null), u = d((i) => {
39
+ a.current !== i && (a.current = i, c.current?.transition.toggle(i));
40
+ }, []), M = d(() => {
41
+ o.step === "list" ? n({
42
+ type: "SET_STEP",
43
+ payload: { step: "verification", flowDirection: "right", method: o.methods[0] }
44
+ }) : n({ type: "SET_STEP", payload: { step: "list", flowDirection: "right" } });
45
+ }, [n, o.step, o.methods]), m = d(
46
+ (i) => {
47
+ n({ type: "SET_METHOD", payload: { method: i } });
48
+ },
49
+ [n]
50
+ ), y = d(() => {
51
+ n({ type: "SET_STEP", payload: { step: "list", flowDirection: "left" } });
52
+ }, [n]);
53
+ re(() => {
54
+ u(o.step);
55
+ }, [o.step, u]);
56
+ const _ = typeof r == "function" ? r(o) : r;
57
+ return /* @__PURE__ */ t(
58
+ Me,
59
+ {
60
+ direction: o.flowDirection,
61
+ onBack: M,
62
+ onSelectMethod: m,
63
+ onShowMethodList: y,
64
+ transitionRef: c,
65
+ children: /* @__PURE__ */ h("div", { className: `${E["mfa-verification"]} ${e}`, ...s, children: [
66
+ _,
67
+ !_ && /* @__PURE__ */ h(x, { children: [
68
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(G, {}) }),
69
+ /* @__PURE__ */ h("div", { className: E["mfa-verification-content"], children: [
70
+ /* @__PURE__ */ t(z, { children: ({ step: i, method: f, Content: C }) => /* @__PURE__ */ h("div", { className: E["mfa-verification-content"], children: [
71
+ /* @__PURE__ */ t(Y, { step: i, method: f }),
72
+ /* @__PURE__ */ h("div", { children: [
73
+ /* @__PURE__ */ t(K, { step: i, method: f }),
74
+ /* @__PURE__ */ t(q, { step: i, method: f })
75
+ ] }),
76
+ C
77
+ ] }) }),
78
+ l && /* @__PURE__ */ t(X, { className: E.footer })
79
+ ] })
80
+ ] })
81
+ ] })
82
+ }
83
+ );
84
+ }, we = ({ onSuccess: e, onError: r, ...s }) => (j("verify_mfa"), /* @__PURE__ */ t(ye, { onError: r, onSuccess: e, children: /* @__PURE__ */ t(Ve, { ...s }) })), Pe = "VerifyMfaModal-module__verify___GZ6dw", Se = "VerifyMfaModal-module__content___BSj0G", Ae = "VerifyMfaModal-module__header___2plY9", xe = "VerifyMfaModal-module__trigger___YXiwC", Ee = "VerifyMfaModal-module__flow___HE2Lf", P = {
85
+ verify: Pe,
86
+ content: Se,
87
+ header: Ae,
88
+ "close-icon": "VerifyMfaModal-module__close-icon___pyobJ",
89
+ "close-button": "VerifyMfaModal-module__close-button___h9yrq",
90
+ trigger: xe,
91
+ flow: Ee
92
+ }, W = D(null), be = () => {
93
+ const e = S(W);
94
+ if (!e)
95
+ throw new Error("useVerifyMfaModalContext must be used within a VerifyMfaModal");
96
+ return e;
97
+ }, U = ({
98
+ children: e,
99
+ className: r = "",
100
+ label: s,
101
+ ...o
102
+ }) => /* @__PURE__ */ t(pe, { asChild: !0, children: e || /* @__PURE__ */ t(J, { className: le(P.trigger, r), ...o, children: s || "Verify" }) }), b = ({ children: e, ...r }) => {
103
+ const { onSuccess: s, onError: o } = be(), { showCoinbaseFooter: n } = L();
104
+ return /* @__PURE__ */ t(de, { "aria-describedby": void 0, ...r, children: /* @__PURE__ */ t(we, { className: P.verify, onSuccess: s, onError: o, children: (l) => /* @__PURE__ */ h(x, { children: [
105
+ e ? typeof e == "function" ? e(l) : e : null,
106
+ !e && /* @__PURE__ */ h(x, { children: [
107
+ /* @__PURE__ */ h("div", { className: P.header, children: [
108
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(G, {}) }),
109
+ /* @__PURE__ */ t(ue, { asChild: !0, children: /* @__PURE__ */ t(
110
+ J,
111
+ {
112
+ className: P["close-button"],
113
+ "aria-label": "Close",
114
+ size: "md",
115
+ variant: "transparentSecondary",
116
+ children: /* @__PURE__ */ t(ve, { className: P["close-icon"] })
117
+ }
118
+ ) })
119
+ ] }),
120
+ /* @__PURE__ */ t(he, { children: /* @__PURE__ */ t(me, { asChild: !0, children: /* @__PURE__ */ t("span", { children: "Verify your identity" }) }) }),
121
+ /* @__PURE__ */ t("div", { className: P.flow, children: /* @__PURE__ */ t(z, { children: ({ Content: a }) => /* @__PURE__ */ h("div", { className: P.content, children: [
122
+ /* @__PURE__ */ t(Y, {}),
123
+ /* @__PURE__ */ h("div", { children: [
124
+ /* @__PURE__ */ t(K, {}),
125
+ /* @__PURE__ */ t(q, {})
126
+ ] }),
127
+ a
128
+ ] }) }) }),
129
+ n && /* @__PURE__ */ t(X, {})
130
+ ] })
131
+ ] }) }) });
132
+ }, Oe = ({
133
+ children: e,
134
+ open: r,
135
+ setIsOpen: s,
136
+ onCancel: o,
137
+ onError: n,
138
+ onSuccess: l
139
+ }) => {
140
+ j("verify_mfa_modal");
141
+ const a = r !== void 0 && s !== void 0, [c, u] = B(!1), M = a ? r : c, m = g(!1), y = d(
142
+ (v) => {
143
+ m.current = !0, l?.(v);
144
+ },
145
+ [l]
146
+ ), _ = d(
147
+ (v) => {
148
+ a ? s?.(v) : u(v), v || (m.current || o?.(), m.current = !1);
149
+ },
150
+ [a, s, u, o]
151
+ ), i = e ? I(e, U) : !1, f = e ? I(e, b) : !1, C = !i && !f, A = T(
152
+ () => ({ onCancel: o, onError: n, onSuccess: y }),
153
+ [o, n, y]
154
+ );
155
+ return /* @__PURE__ */ t(W.Provider, { value: A, children: /* @__PURE__ */ t(fe, { open: M, onOpenChange: _, children: C ? /* @__PURE__ */ h(x, { children: [
156
+ /* @__PURE__ */ t(U, { children: e }),
157
+ /* @__PURE__ */ t(b, {})
158
+ ] }) : /* @__PURE__ */ h(x, { children: [
159
+ e,
160
+ !f && /* @__PURE__ */ t(b, {})
161
+ ] }) }) });
162
+ }, Te = (e) => e?.closest("[data-cdp-provider]")?.getAttribute?.("data-cdp-provider") ?? null, F = D(void 0), Ne = "__core_mfa_handler__", De = ({ children: e }) => {
163
+ const { mfa: r } = L(), s = ke(), { disableAutoPrompt: o } = r, [n, l] = B(null), a = g(/* @__PURE__ */ new Map()), c = g(!1), u = d((p, V) => {
164
+ a.current.set(p, V);
165
+ }, []), M = d((p) => {
166
+ a.current.delete(p);
167
+ }, []), m = g(n);
168
+ m.current = n;
169
+ const y = g(null), _ = d((p) => m.current !== null ? !1 : (y.current = document.activeElement, l(p), !0), []), i = d(() => {
170
+ l(null);
171
+ const p = y.current;
172
+ y.current = null, p && requestAnimationFrame(() => {
173
+ p.focus();
174
+ });
175
+ }, []);
176
+ O(() => o ? void 0 : se(() => {
177
+ const V = document.activeElement, k = Te(V);
178
+ k !== null && k !== s || (c.current = !0, _(Ne));
179
+ }), [o, _, s]);
180
+ const f = n ? a.current.get(n)?.current : void 0, C = n !== null, A = d(
181
+ (p) => {
182
+ p || i();
183
+ },
184
+ [i]
185
+ ), v = d(
186
+ (p) => {
187
+ c.current && (c.current = !1), f?.onSuccess?.(p);
188
+ const V = f?.closeOnSuccessDelay === void 0 ? 500 : f?.closeOnSuccessDelay;
189
+ V !== null && (V === 0 ? i() : setTimeout(() => i(), V));
190
+ },
191
+ [f, i]
192
+ ), R = d(
193
+ (p) => {
194
+ f?.onError?.(p);
195
+ },
196
+ [f]
197
+ ), N = d(() => {
198
+ c.current && (ie(), c.current = !1), f?.onCancel?.();
199
+ }, [f]), Q = T(
200
+ () => ({
201
+ register: u,
202
+ unregister: M,
203
+ open: _,
204
+ close: i
205
+ }),
206
+ [u, M, _, i]
207
+ );
208
+ return /* @__PURE__ */ h(F.Provider, { value: Q, children: [
209
+ e,
210
+ /* @__PURE__ */ t(
211
+ Oe,
212
+ {
213
+ open: C,
214
+ setIsOpen: A,
215
+ onSuccess: v,
216
+ onError: R,
217
+ onCancel: N,
218
+ children: /* @__PURE__ */ t(b, {})
219
+ }
220
+ )
221
+ ] });
222
+ }, at = (e = {}) => {
223
+ const r = S(F);
224
+ if (!r)
225
+ throw new Error(
226
+ "useVerifyMfaModal must be used within a MfaVerificationProvider or CDPReactProvider"
227
+ );
228
+ ge("use_verify_mfa_modal");
229
+ const s = $(), o = g(e);
230
+ O(() => {
231
+ o.current = e;
232
+ }, [e]);
233
+ const { register: n, unregister: l, open: a, close: c } = r;
234
+ O(() => (n(s, o), () => l(s)), [n, l, s]);
235
+ const u = d(() => a(s), [a, s]), M = d(() => {
236
+ c();
237
+ }, [c]);
238
+ return { open: u, close: M };
239
+ }, ct = () => S(F) ?? {
240
+ register: () => {
241
+ },
242
+ unregister: () => {
243
+ },
244
+ open: () => !1,
245
+ close: () => {
246
+ }
247
+ }, Fe = ne(() => import("../components/OAuthStatusModal/index.js")), Z = (e) => {
248
+ try {
249
+ return JSON.stringify(e);
250
+ } catch {
251
+ }
252
+ return "";
253
+ }, He = Object.keys(ee).map((e) => `oauth:${e}`), Le = [
254
+ /** Email OTP method */
255
+ "email",
256
+ /** SMS OTP method */
257
+ "sms"
258
+ ], lt = [...Le, ...He], ft = ({
259
+ children: e,
260
+ className: r = "",
261
+ config: s,
262
+ name: o,
263
+ style: n,
264
+ theme: l
265
+ }) => {
266
+ const a = $(), c = o ?? a, { appName: u, appLogoUrl: M, showCoinbaseFooter: m, authMethods: y, ..._ } = s, i = Z(_), f = T(() => _, [i]), C = { appName: u, appLogoUrl: M, showCoinbaseFooter: m, authMethods: y }, A = y?.some((N) => N.startsWith("oauth:")), v = /* @__PURE__ */ t(Re, { name: c, config: C, children: /* @__PURE__ */ t(ce, { className: r, style: n, theme: l, "data-cdp-provider": c, children: /* @__PURE__ */ h(De, { children: [
267
+ e,
268
+ A && /* @__PURE__ */ t(Fe, {})
269
+ ] }) }) });
270
+ return S(te) ? v : /* @__PURE__ */ t(oe, { config: f, children: v });
271
+ }, H = D(
272
+ void 0
273
+ ), w = {
274
+ appName: "",
275
+ appLogoUrl: "",
276
+ showCoinbaseFooter: !0,
277
+ authMethods: ["email"],
278
+ mfa: {
279
+ disableAutoPrompt: !1
280
+ }
281
+ }, Re = ({
282
+ children: e,
283
+ config: r,
284
+ name: s
285
+ }) => {
286
+ const {
287
+ appName: o = w.appName,
288
+ appLogoUrl: n = w.appLogoUrl,
289
+ showCoinbaseFooter: l = w.showCoinbaseFooter,
290
+ authMethods: a = w.authMethods,
291
+ mfa: { disableAutoPrompt: c = w.mfa.disableAutoPrompt } = w.mfa
292
+ } = r ?? {}, u = Z(a), M = T(() => {
293
+ let m = ["email"];
294
+ try {
295
+ m = JSON.parse(u);
296
+ } catch {
297
+ }
298
+ return {
299
+ app: {
300
+ appName: o,
301
+ appLogoUrl: n,
302
+ showCoinbaseFooter: l,
303
+ authMethods: Array.isArray(m) && m?.length ? m : w.authMethods,
304
+ mfa: {
305
+ disableAutoPrompt: c
306
+ }
307
+ },
308
+ name: s
309
+ };
310
+ }, [o, n, l, u, s, c]);
311
+ return /* @__PURE__ */ t(H.Provider, { value: M, children: e });
312
+ }, L = () => {
313
+ const e = S(H);
314
+ if (!e)
315
+ throw new Error("useAppConfig must be used within an AppConfigProvider");
316
+ return e.app;
317
+ }, ke = () => {
318
+ const e = S(H);
319
+ if (!e)
320
+ throw new Error("useProviderName must be used within an AppConfigProvider");
321
+ return e.name ?? "";
322
+ };
323
+ export {
324
+ Le as A,
325
+ ft as C,
326
+ He as O,
327
+ we as V,
328
+ ke as a,
329
+ at as b,
330
+ lt as c,
331
+ Oe as d,
332
+ b as e,
333
+ U as f,
334
+ De as g,
335
+ ct as h,
336
+ L as u
337
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsx as i, jsxs as m, Fragment as p } from "react/jsx-runtime";
2
- import { createContext as S, useContext as I, useMemo as v, forwardRef as A, useRef as L, useImperativeHandle as x, useEffect as N } from "react";
3
- import { u as C } from "./CDPReactProvider.CIQm4C4z.js";
2
+ import { createContext as I, useContext as S, useMemo as v, forwardRef as A, useRef as L, useImperativeHandle as x, useEffect as N } from "react";
3
+ import { u as C } from "./CDPReactProvider.C38bKQ2x.js";
4
4
  import { SignIn as _ } from "../components/SignIn/index.js";
5
5
  import "@coinbase/cdp-hooks";
6
6
  import { SwitchSlideTransition as T } from "../components/ui/SwitchSlideTransition/index.js";
@@ -8,20 +8,20 @@ import { VisuallyHidden as h } from "../components/ui/VisuallyHidden/index.js";
8
8
  import { LinkAuthItems as E } from "../components/LinkAuth/LinkAuthItems.js";
9
9
  import { LINK_AUTH_FLOW_VIEWS as R } from "../components/LinkAuth/types.js";
10
10
  import { useSignInContext as y } from "../components/SignIn/SignInProvider.js";
11
- import { SignInImage as b } from "../components/SignIn/SignInImage.js";
12
- import { SignInForm as H } from "../components/SignIn/SignInForm.js";
11
+ import { SignInImage as P } from "../components/SignIn/SignInImage.js";
12
+ import { SignInForm as b } from "../components/SignIn/SignInForm.js";
13
13
  import { SignInTitle as g } from "../components/SignIn/SignInTitle.js";
14
14
  import { SignInDescription as w } from "../components/SignIn/SignInDescription.js";
15
- import { SignInFooter as P } from "../components/SignIn/SignInFooter.js";
16
- import '../assets/LinkAuthFlow.css';const j = "LinkAuthFlow-module__list___dkNmh", c = {
15
+ import { SignInFooter as H } from "../components/SignIn/SignInFooter.js";
16
+ import '../assets/LinkAuthFlow.css';const O = "LinkAuthFlow-module__list___dkNmh", c = {
17
17
  "sign-in": "LinkAuthFlow-module__sign-in___F2bj7",
18
18
  "sign-in-title-desc-wrapper": "LinkAuthFlow-module__sign-in-title-desc-wrapper___6QeTc",
19
19
  "sign-in-image": "LinkAuthFlow-module__sign-in-image___XGuJI",
20
20
  "sign-in-form": "LinkAuthFlow-module__sign-in-form___REZlP",
21
21
  "sign-in-footer": "LinkAuthFlow-module__sign-in-footer___KYZNd",
22
- list: j
23
- }, k = S(null), f = () => {
24
- const t = I(k);
22
+ list: O
23
+ }, k = I(null), f = () => {
24
+ const t = S(k);
25
25
  if (!t)
26
26
  throw new Error("useLinkAuthFlowInternal must be used within a LinkAuthFlowContext.Provider");
27
27
  return t;
@@ -60,7 +60,7 @@ import '../assets/LinkAuthFlow.css';const j = "LinkAuthFlow-module__list___dkNmh
60
60
  () => ({
61
61
  canGoBack: e.step === "verification",
62
62
  goBack: () => {
63
- r({ type: "RESET_STATE" });
63
+ r({ type: "GO_TO_PREVIOUS_STEP" });
64
64
  }
65
65
  }),
66
66
  [e.step, r]
@@ -72,15 +72,15 @@ import '../assets/LinkAuthFlow.css';const j = "LinkAuthFlow-module__list___dkNmh
72
72
  n.current?.querySelector("input[type='text']")?.focus();
73
73
  }, 300)), () => clearTimeout(o);
74
74
  }, [e.step]), /* @__PURE__ */ m(p, { children: [
75
- /* @__PURE__ */ i("div", { className: c["sign-in-image"], children: /* @__PURE__ */ i(b, {}) }),
76
- /* @__PURE__ */ i(H, { autoFocus: !1, onSuccess: a, children: ({ authMethod: o, step: l, Form: F }) => /* @__PURE__ */ m(p, { children: [
75
+ /* @__PURE__ */ i("div", { className: c["sign-in-image"], children: /* @__PURE__ */ i(P, {}) }),
76
+ /* @__PURE__ */ i(b, { autoFocus: !1, onSuccess: a, children: ({ authMethod: o, step: l, Form: F }) => /* @__PURE__ */ m(p, { children: [
77
77
  /* @__PURE__ */ m("div", { className: c["sign-in-title-desc-wrapper"], children: [
78
78
  l === "verification" ? /* @__PURE__ */ i(h, { as: "div", children: /* @__PURE__ */ i(g, {}) }) : /* @__PURE__ */ i(g, {}),
79
79
  l === "credentials" ? /* @__PURE__ */ i(h, { as: "div", children: /* @__PURE__ */ i(w, { authMethod: o }) }) : /* @__PURE__ */ i(w, { authMethod: o })
80
80
  ] }),
81
81
  /* @__PURE__ */ i("div", { ref: n, className: c["sign-in-form"], children: F })
82
82
  ] }) }),
83
- s && /* @__PURE__ */ i(P, { className: c["sign-in-footer"] })
83
+ s && /* @__PURE__ */ i(H, { className: c["sign-in-footer"] })
84
84
  ] });
85
85
  });
86
86
  d.displayName = "SignInContent";
@@ -1,5 +1,5 @@
1
1
  import { OAuth2ProviderType as t } from "@coinbase/cdp-hooks";
2
- import "./CDPReactProvider.CIQm4C4z.js";
2
+ import "./CDPReactProvider.C38bKQ2x.js";
3
3
  import { config as i } from "../components/SignIn/flows/SignInWithEmail.js";
4
4
  import { config as m } from "../components/SignIn/flows/SignInWithSms.js";
5
5
  import "react";
@@ -0,0 +1,12 @@
1
+ import "@coinbase/cdp-hooks";
2
+ import "react";
3
+ import "@coinbase/cdp-core";
4
+ import { smsMethodConfig as o } from "../components/VerifyMfa/methods/sms.js";
5
+ import { totpMethodConfig as t } from "../components/VerifyMfa/methods/totp.js";
6
+ const e = {
7
+ totp: t,
8
+ sms: o
9
+ };
10
+ export {
11
+ e as m
12
+ };
@@ -0,0 +1,12 @@
1
+ import "@coinbase/cdp-core";
2
+ import "@coinbase/cdp-hooks";
3
+ import "react";
4
+ import { smsMethodConfig as o } from "../components/EnrollMfa/methods/sms.js";
5
+ import { totpMethodConfig as t } from "../components/EnrollMfa/methods/totp.js";
6
+ const e = {
7
+ totp: t,
8
+ sms: o
9
+ };
10
+ export {
11
+ e as m
12
+ };
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@coinbase/cdp-hooks";
3
3
  import "react";
4
- import { c as p, A as m, C as t, O as A, u as H, a as T } from "../../chunks/CDPReactProvider.CIQm4C4z.js";
4
+ import { c as p, A as m, C as t, O as A, u as H, a as T } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
5
5
  import "../ThemeProvider/index.js";
6
6
  export {
7
7
  p as ALL_AUTH_METHODS,
@@ -1,11 +1,12 @@
1
1
  import { jsx as t, Fragment as d } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { useEnrollMfaContext as f } from "./EnrollMfaProvider.js";
4
- import { m as h } from "../../chunks/index.CKQKBoX2.js";
4
+ import { m as h } from "../../chunks/index.Bgx0-QLY.js";
5
+ import "@coinbase/cdp-core";
5
6
  import "@coinbase/cdp-hooks";
6
7
  import '../../assets/EnrollMfaDescription.css';const _ = "EnrollMfaDescription-module__description___qWKL6", u = {
7
8
  description: _
8
- }, q = ({
9
+ }, v = ({
9
10
  as: s = "p",
10
11
  children: n,
11
12
  className: r = "",
@@ -17,5 +18,5 @@ import '../../assets/EnrollMfaDescription.css';const _ = "EnrollMfaDescription-m
17
18
  return /* @__PURE__ */ t(s, { className: `${u.description} ${r}`, ...m, children: n ?? a });
18
19
  };
19
20
  export {
20
- q as EnrollMfaDescription
21
+ v as EnrollMfaDescription
21
22
  };
@@ -1,46 +1,47 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import "react";
3
- import { SwitchSlideTransition as _ } from "../ui/SwitchSlideTransition/index.js";
4
- import { useEnrollMfaFlowInternal as h } from "./EnrollMfaFlowProvider.js";
5
- import { EnrollMfaItems as w } from "./EnrollMfaItems.js";
6
- import { useEnrollMfaContext as M } from "./EnrollMfaProvider.js";
7
- import { m as S } from "../../chunks/index.CKQKBoX2.js";
3
+ import { SwitchSlideTransition as E } from "../ui/SwitchSlideTransition/index.js";
4
+ import { useEnrollMfaFlowInternal as _ } from "./EnrollMfaFlowProvider.js";
5
+ import { EnrollMfaItems as M } from "./EnrollMfaItems.js";
6
+ import { useEnrollMfaContext as h } from "./EnrollMfaProvider.js";
7
+ import { m as S } from "../../chunks/index.Bgx0-QLY.js";
8
+ import "@coinbase/cdp-core";
8
9
  import "@coinbase/cdp-hooks";
9
- import { STEPS as b } from "./useEnrollMfaReducer.js";
10
- import '../../assets/EnrollMfaFlow.css';const x = "EnrollMfaFlow-module__list___oGYkb", s = {
11
- "method-wrapper": "EnrollMfaFlow-module__method-wrapper___yT4Pj",
12
- list: x
13
- }, $ = ({
14
- autoFocus: e = !1,
15
- animateHeight: m = !0,
10
+ import { STEPS as $ } from "./useEnrollMfaReducer.js";
11
+ import '../../assets/EnrollMfaFlow.css';const b = "EnrollMfaFlow-module__wrapper___OVdk0", v = "EnrollMfaFlow-module__list___oGYkb", e = {
12
+ wrapper: b,
13
+ list: v
14
+ }, D = ({
15
+ autoFocus: n = !0,
16
+ animateHeight: p = !0,
16
17
  children: l,
17
- className: a = "",
18
- ...p
18
+ className: i = "",
19
+ ...s
19
20
  }) => {
20
- const { state: n } = M(), { startEnrollment: f, submit: d, transitionRef: c } = h(), { method: i } = n;
21
+ const { state: m } = h(), { startEnrollment: f, submit: c, transitionRef: d } = _(), { method: a } = m;
21
22
  return /* @__PURE__ */ t(
22
- _,
23
+ E,
23
24
  {
24
- autoFocus: e,
25
- animateHeight: m,
26
- items: b,
25
+ autoFocus: n,
26
+ animateHeight: p,
27
+ items: $,
27
28
  initialEntered: !0,
28
29
  timeout: 250,
29
- direction: n.flowDirection,
30
- transitionRef: c,
30
+ direction: m.flowDirection,
31
+ transitionRef: d,
31
32
  children: ({ itemKey: r, ...u }) => {
32
33
  let o = null;
33
34
  if (r === "list")
34
- o = /* @__PURE__ */ t(w, { className: s.list, onSetUp: f });
35
+ o = /* @__PURE__ */ t("div", { className: `${e.wrapper} ${i}`, ...s, children: /* @__PURE__ */ t(M, { className: e.list, onSetUp: f }) });
35
36
  else {
36
- const E = S[i].content;
37
- o = /* @__PURE__ */ t("div", { className: `${s["method-wrapper"]} ${a}`, ...p, children: /* @__PURE__ */ t(E, { autoFocus: e, step: r, onSubmit: d }) });
37
+ const w = S[a].content;
38
+ o = /* @__PURE__ */ t("div", { className: `${e.wrapper} ${i}`, ...s, children: /* @__PURE__ */ t(w, { autoFocus: n, step: r, onSubmit: c }) });
38
39
  }
39
- return /* @__PURE__ */ t("div", { ...u, children: l ? l({ step: r, method: i, Content: o }) : o });
40
+ return /* @__PURE__ */ t("div", { ...u, children: l ? l({ step: r, method: a, Content: o }) : o });
40
41
  }
41
42
  }
42
43
  );
43
44
  };
44
45
  export {
45
- $ as EnrollMfaFlow
46
+ D as EnrollMfaFlow
46
47
  };
@@ -1,15 +1,16 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { c as p } from "../../chunks/lite.1fxw3LjI.js";
2
+ import { c as u } from "../../chunks/lite.1fxw3LjI.js";
3
3
  import "react";
4
4
  import { Button as f } from "../ui/Button/index.js";
5
5
  import { IconArrowLeft as _ } from "../../icons/IconArrowLeft.js";
6
6
  import { useEnrollMfaFlowInternal as b } from "./EnrollMfaFlowProvider.js";
7
7
  import { useEnrollMfaContext as B } from "./EnrollMfaProvider.js";
8
+ import "@coinbase/cdp-core";
8
9
  import "@coinbase/cdp-hooks";
9
10
  import '../../assets/EnrollMfaFlowBackButton.css';const k = "EnrollMfaFlowBackButton-module__button___8J7mz", d = "EnrollMfaFlowBackButton-module__icon___H7y5j", t = {
10
11
  button: k,
11
12
  icon: d
12
- }, N = ({
13
+ }, h = ({
13
14
  ["aria-label"]: n = "Back",
14
15
  children: r,
15
16
  className: l = "",
@@ -19,13 +20,13 @@ import '../../assets/EnrollMfaFlowBackButton.css';const k = "EnrollMfaFlowBackBu
19
20
  step: e,
20
21
  ...m
21
22
  }) => {
22
- const { back: i } = b(), { state: u } = B();
23
- return (e || u.step) === "list" ? null : /* @__PURE__ */ o(
23
+ const { back: i } = b(), { state: p } = B();
24
+ return (e || p.step) === "list" ? null : /* @__PURE__ */ o(
24
25
  f,
25
26
  {
26
27
  type: "button",
27
28
  "aria-label": n,
28
- className: p(t.button, l),
29
+ className: u(t.button, l),
29
30
  onClick: s ?? i,
30
31
  size: a,
31
32
  variant: c,
@@ -35,5 +36,5 @@ import '../../assets/EnrollMfaFlowBackButton.css';const k = "EnrollMfaFlowBackBu
35
36
  );
36
37
  };
37
38
  export {
38
- N as EnrollMfaFlowBackButton
39
+ h as EnrollMfaFlowBackButton
39
40
  };
@@ -3,7 +3,7 @@ import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
3
3
  import { EnrollMfaStep, MfaMethod } from './types';
4
4
  export interface EnrollMfaFlowContextValue {
5
5
  back: () => void;
6
- startEnrollment: (method: MfaMethod) => void;
6
+ startEnrollment: (method: MfaMethod) => Promise<void>;
7
7
  submit: (e: FormEvent<HTMLFormElement>) => void;
8
8
  }
9
9
  export interface EnrollMfaFlowContextValueInternal extends EnrollMfaFlowContextValue {