@coinbase/cdp-react 0.0.86 → 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 (105) 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 +134 -128
  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 +3 -3
  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/useTransitionMap.js +24 -22
  96. package/dist/hooks/useVerifyMfaModal.js +1 -1
  97. package/dist/index.js +59 -51
  98. package/dist/utils/transition.d.ts +3 -3
  99. package/dist/utils/transition.js +21 -20
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/package.json +6 -6
  103. package/dist/chunks/CDPReactProvider.CIQm4C4z.js +0 -299
  104. package/dist/chunks/index.CKQKBoX2.js +0 -9
  105. package/dist/chunks/index.Dp-lIxM1.js +0 -9
@@ -34,7 +34,7 @@ interface VerifyMfaInlineBackButtonProps extends ButtonHTMLAttributes<HTMLButton
34
34
  size?: ButtonSize;
35
35
  variant?: ButtonVariant;
36
36
  }
37
- declare const VerifyMfaInlineBackButton: ({ children, onClick, size, variant, ["aria-label"]: ariaLabel, ...props }: VerifyMfaInlineBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
37
+ declare const VerifyMfaInlineBackButton: ({ children, onClick, size, variant, ["aria-label"]: ariaLabel, className, ...props }: VerifyMfaInlineBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
38
38
  declare const VerifyMfaInlineFlow: ({ children, className, animateHeight, autoFocus, transition, }: VerifyMfaInlineFlowProps) => import("react/jsx-runtime").JSX.Element;
39
39
  declare const VerifyMfaInline: ({ children, verifyFirst, onVerified, onCancel, successDelay, className, ...props }: VerifyMfaInlineProps) => import("react/jsx-runtime").JSX.Element;
40
40
  export { VerifyMfaInline, VerifyMfaInlineBackButton, VerifyMfaInlineFlow, useVerifyMfaInlineContext, type VerifyMfaInlineBackButtonProps, type VerifyMfaInlineContextValue, type VerifyMfaInlineDirection, type VerifyMfaInlineFlowProps, type VerifyMfaInlineProps, type VerifyMfaInlineView, };
@@ -1,175 +1,192 @@
1
- import { jsx as n, jsxs as R } from "react/jsx-runtime";
2
- import { isMfaRequired as E } from "@coinbase/cdp-core";
3
- import { useCancelMfaVerification as j, useIsInitialized as q, useRegisterMfaListener as F } from "@coinbase/cdp-hooks";
4
- import { u as L } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
5
- import { createContext as A, useMemo as h, useRef as x, useState as b, useCallback as w, useContext as O } from "react";
6
- import { c as P } from "../../chunks/lite.1fxw3LjI.js";
7
- import { Button as W } from "../ui/Button/index.js";
8
- import { SwitchFadeTransition as X } from "../ui/SwitchFadeTransition/index.js";
9
- import { SwitchSlideTransition as Y } from "../ui/SwitchSlideTransition/index.js";
10
- import { V as G } from "../../chunks/CDPReactProvider.CIQm4C4z.js";
11
- import { IconArrowLeft as J } from "../../icons/IconArrowLeft.js";
1
+ import { jsx as t, jsxs as E } from "react/jsx-runtime";
2
+ import { isMfaRequired as q } from "@coinbase/cdp-core";
3
+ import { useCancelMfaVerification as L, useIsInitialized as A, useRegisterMfaListener as O } from "@coinbase/cdp-hooks";
4
+ import { u as P } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
5
+ import { createContext as W, useMemo as h, useRef as k, useState as R, useCallback as C, useContext as X, useEffect as Y } from "react";
6
+ import { c as j } from "../../chunks/lite.1fxw3LjI.js";
7
+ import { Button as H } from "../ui/Button/index.js";
8
+ import { SwitchFadeTransition as J } from "../ui/SwitchFadeTransition/index.js";
9
+ import { SwitchSlideTransition as Q } from "../ui/SwitchSlideTransition/index.js";
10
+ import { V as U } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
11
+ import { IconArrowLeft as Z } from "../../icons/IconArrowLeft.js";
12
12
  import "../../theme/theme.js";
13
- import { VerifyMfaImage as Q } from "../VerifyMfa/VerifyMfaImage.js";
14
- import { VerifyMfaTitle as U } from "../VerifyMfa/VerifyMfaTitle.js";
15
- import { VerifyMfaDescription as Z } from "../VerifyMfa/VerifyMfaDescription.js";
16
- import { VerifyMfaFlow as $ } from "../VerifyMfa/VerifyMfaFlow.js";
17
- import '../../assets/VerifyMfaInline.css';const H = "VerifyMfaInline-module__icon___pezMX", C = {
13
+ import { useVerifyMfaContext as $ } from "../VerifyMfa/VerifyMfaProvider.js";
14
+ import { useVerifyMfaFlow as K } from "../VerifyMfa/VerifyMfaFlowProvider.js";
15
+ import { VerifyMfaFlow as ee } from "../VerifyMfa/VerifyMfaFlow.js";
16
+ import { VerifyMfaImage as ne } from "../VerifyMfa/VerifyMfaImage.js";
17
+ import { VerifyMfaTitle as te } from "../VerifyMfa/VerifyMfaTitle.js";
18
+ import { VerifyMfaDescription as ie } from "../VerifyMfa/VerifyMfaDescription.js";
19
+ import '../../assets/VerifyMfaInline.css';const oe = "VerifyMfaInline-module__icon___pezMX", re = "VerifyMfaInline-module__button___-gTjp", I = {
18
20
  "verify-mfa-inline": "VerifyMfaInline-module__verify-mfa-inline___mn38o",
19
- icon: H,
21
+ icon: oe,
22
+ button: re,
20
23
  "mfa-verification": "VerifyMfaInline-module__mfa-verification___WyY76",
21
- "mfa-verification-content": "VerifyMfaInline-module__mfa-verification-content___M4fq0",
22
- "mfa-verification-form": "VerifyMfaInline-module__mfa-verification-form___8h2u-"
23
- }, z = A(null), S = () => {
24
- const e = O(z);
24
+ "mfa-verification-content": "VerifyMfaInline-module__mfa-verification-content___M4fq0"
25
+ }, z = W(null), B = () => {
26
+ const e = X(z);
25
27
  if (!e)
26
28
  throw new Error("VerifyMfaInline compound components must be used within VerifyMfaInline");
27
29
  return e;
28
- }, ve = () => {
29
- const { view: e, goToContent: t, goToVerify: i, goBack: o } = S();
30
+ }, he = () => {
31
+ const { view: e, goToContent: n, goToVerify: i, goBack: o } = B();
30
32
  return h(
31
- () => ({ view: e, goToVerify: i, goToContent: t, goBack: o }),
32
- [e, i, t, o]
33
+ () => ({ view: e, goToVerify: i, goToContent: n, goBack: o }),
34
+ [e, i, n, o]
33
35
  );
34
- }, Ve = ({
36
+ }, Be = ({
35
37
  children: e,
36
- onClick: t,
38
+ onClick: n,
37
39
  size: i = "md",
38
40
  variant: o = "transparentSecondary",
39
- ["aria-label"]: d = "Back",
41
+ ["aria-label"]: f = "Back",
42
+ className: r = "",
40
43
  ...s
41
44
  }) => {
42
- const { goBack: M, verifyFirst: y, needsMfa: l, view: r } = S(), m = (f) => {
43
- t?.(f), M();
45
+ const { goBack: u, verifyFirst: d, needsMfa: c, view: y, canGoBack: l } = B(), V = (M) => {
46
+ n?.(M), u();
44
47
  };
45
- return y || !l || r === "content" ? null : /* @__PURE__ */ n(
46
- W,
48
+ return !c || y === "content" || d && !l ? null : /* @__PURE__ */ t(
49
+ H,
47
50
  {
48
51
  type: "button",
49
- "aria-label": d,
50
- onClick: m,
52
+ "aria-label": f,
53
+ onClick: V,
51
54
  size: i,
52
55
  variant: o,
56
+ className: j(I.button, r),
53
57
  ...s,
54
- children: e || /* @__PURE__ */ n(J, { className: C.icon })
58
+ children: e || /* @__PURE__ */ t(Z, { className: I.icon })
55
59
  }
56
60
  );
57
- }, N = ({ onSuccess: e }) => /* @__PURE__ */ n(G, { className: C["mfa-verification"], onSuccess: e, children: /* @__PURE__ */ R("div", { className: C["mfa-verification-content"], children: [
58
- /* @__PURE__ */ n(Q, {}),
59
- /* @__PURE__ */ R("div", { children: [
60
- /* @__PURE__ */ n(U, {}),
61
- /* @__PURE__ */ n(Z, {})
62
- ] }),
63
- /* @__PURE__ */ n($, { className: C["mfa-verification-form"] })
64
- ] }) }), Me = ({
61
+ }, fe = () => {
62
+ const { state: e } = $(), { back: n } = K(), { setCanGoBack: i, mfaFlowBackRef: o } = B(), f = e.step === "list" || e.step === "verification" && e.method !== e.methods[0];
63
+ return Y(() => (i(f), o.current = f ? n : null, () => {
64
+ i(!1), o.current = null;
65
+ }), [f, n, i, o]), /* @__PURE__ */ t(ee, { animateHeight: !1, children: ({ step: r, method: s, Content: u }) => /* @__PURE__ */ E("div", { className: I["mfa-verification-content"], children: [
66
+ /* @__PURE__ */ t(ne, { step: r, method: s }),
67
+ /* @__PURE__ */ E("div", { children: [
68
+ /* @__PURE__ */ t(te, { step: r, method: s }),
69
+ /* @__PURE__ */ t(ie, { step: r, method: s })
70
+ ] }),
71
+ u
72
+ ] }) });
73
+ }, N = ({ onSuccess: e }) => /* @__PURE__ */ t(U, { className: I["mfa-verification"], onSuccess: e, children: /* @__PURE__ */ t(fe, {}) }), be = ({
65
74
  children: e,
66
- className: t = "",
75
+ className: n = "",
67
76
  animateHeight: i = !0,
68
77
  autoFocus: o = !0,
69
- transition: d = "slide"
78
+ transition: f = "slide"
70
79
  }) => {
71
80
  const {
72
- goToContent: s,
73
- initialView: M,
74
- direction: y,
75
- transitionRef: l,
76
- verifyFirst: r,
77
- onVerified: m,
78
- successDelay: f
79
- } = S(), _ = w(() => {
80
- m?.(), r && (f > 0 ? setTimeout(() => s(), f) : s());
81
- }, [s, r, m, f]), v = M === "verify" ? ["verify", "content"] : ["content", "verify"], I = typeof e == "function", V = ({ itemKey: u, ...p }) => {
82
- let c = null;
83
- return I ? c = e(
84
- u === "content" ? { view: "content", Content: null } : { view: u, Content: u === "verify" ? /* @__PURE__ */ n(N, { onSuccess: _ }) : void 0 }
85
- ) : c = u === "verify" ? /* @__PURE__ */ n(N, { onSuccess: _ }) : e, /* @__PURE__ */ n("div", { ...p, children: c });
81
+ goToContent: r,
82
+ initialView: s,
83
+ direction: u,
84
+ transitionRef: d,
85
+ verifyFirst: c,
86
+ onVerified: y,
87
+ successDelay: l
88
+ } = B(), V = C(() => {
89
+ y?.(), c && (l > 0 ? setTimeout(() => r(), l) : r());
90
+ }, [r, c, y, l]), M = s === "verify" ? ["verify", "content"] : ["content", "verify"], p = typeof e == "function", w = ({ itemKey: m, ...g }) => {
91
+ let v = null;
92
+ return p ? v = e(
93
+ m === "content" ? { view: "content", Content: null } : { view: m, Content: m === "verify" ? /* @__PURE__ */ t(N, { onSuccess: V }) : void 0 }
94
+ ) : v = m === "verify" ? /* @__PURE__ */ t(N, { onSuccess: V }) : e, /* @__PURE__ */ t("div", { ...g, children: v });
86
95
  };
87
- return d === "fade" ? /* @__PURE__ */ n(
88
- X,
96
+ return f === "fade" ? /* @__PURE__ */ t(
97
+ J,
89
98
  {
90
99
  autoFocus: o,
91
100
  animateHeight: i,
92
- items: v,
101
+ items: M,
93
102
  initialEntered: !0,
94
- transitionRef: l,
95
- className: t,
96
- children: V
103
+ transitionRef: d,
104
+ className: n,
105
+ children: w
97
106
  }
98
- ) : /* @__PURE__ */ n(
99
- Y,
107
+ ) : /* @__PURE__ */ t(
108
+ Q,
100
109
  {
101
110
  autoFocus: o,
102
111
  animateHeight: i,
103
- items: v,
112
+ items: M,
104
113
  initialEntered: !0,
105
- direction: y,
106
- transitionRef: l,
107
- className: t,
108
- children: V
114
+ direction: u,
115
+ transitionRef: d,
116
+ className: n,
117
+ children: w
109
118
  }
110
119
  );
111
- }, _e = ({
120
+ }, xe = ({
112
121
  children: e,
113
- verifyFirst: t = !0,
122
+ verifyFirst: n = !0,
114
123
  onVerified: i,
115
124
  onCancel: o,
116
- successDelay: d = 500,
117
- className: s = "",
118
- ...M
125
+ successDelay: f = 500,
126
+ className: r = "",
127
+ ...s
119
128
  }) => {
120
- L("verify_mfa_inline");
121
- const { cancelMfaVerification: y } = j(), { isInitialized: l } = q(), r = h(() => l ? E() : !1, [l]), m = x(null), f = h(() => r && t ? "verify" : "content", [r, t]), [_, v] = b(f), [I, V] = b("left"), u = x(null), p = x(f), c = w((a) => {
122
- p.current !== a && (p.current = a, u.current?.transition.toggle(a));
123
- }, []), g = w(
129
+ P("verify_mfa_inline");
130
+ const { cancelMfaVerification: u } = L(), { isInitialized: d } = A(), c = h(() => d ? q() : !1, [d]), y = k(null), l = k(null), [V, M] = R(!1), p = h(() => c && n ? "verify" : "content", [c, n]), [w, m] = R(p), [g, v] = R("left"), b = k(null), x = k(p), _ = C((a) => {
131
+ x.current !== a && (x.current = a, b.current?.transition.toggle(a));
132
+ }, []), T = C(
124
133
  (a = "left") => {
125
- V(a), v("verify"), c("verify");
134
+ v(a), m("verify"), _("verify");
126
135
  },
127
- [c]
128
- ), T = w(
136
+ [_]
137
+ ), S = C(
129
138
  (a = "left") => {
130
- V(a), v("content"), c("content");
139
+ v(a), m("content"), _("content");
131
140
  },
132
- [c]
133
- ), k = w(() => {
134
- const a = p.current === "verify", B = a ? "content" : "verify";
135
- V("right"), v(B), c(B), a && (y(), o?.());
136
- }, [c, o, y]);
137
- F(() => g(), {
138
- scope: m,
139
- enabled: r
141
+ [_]
142
+ ), F = C(() => {
143
+ if (v("right"), l.current) {
144
+ l.current();
145
+ return;
146
+ }
147
+ const a = x.current === "verify", G = a ? "content" : "verify";
148
+ m(G), _(G), a && (u(), o?.());
149
+ }, [_, o, u]);
150
+ O(() => T(), {
151
+ scope: y,
152
+ enabled: c
140
153
  });
141
154
  const D = h(
142
155
  () => ({
143
- view: _,
144
- goToVerify: g,
145
- goToContent: T,
146
- goBack: k,
147
- needsMfa: r,
148
- verifyFirst: t,
149
- initialView: f,
150
- direction: I,
151
- transitionRef: u,
156
+ view: w,
157
+ goToVerify: T,
158
+ goToContent: S,
159
+ goBack: F,
160
+ needsMfa: c,
161
+ verifyFirst: n,
162
+ initialView: p,
163
+ direction: g,
164
+ transitionRef: b,
165
+ mfaFlowBackRef: l,
166
+ canGoBack: V,
167
+ setCanGoBack: M,
152
168
  onVerified: i,
153
- successDelay: d
169
+ successDelay: f
154
170
  }),
155
171
  [
156
- _,
157
- g,
172
+ w,
158
173
  T,
159
- k,
160
- r,
161
- t,
162
- f,
163
- I,
174
+ S,
175
+ F,
176
+ c,
177
+ n,
178
+ p,
179
+ g,
180
+ V,
164
181
  i,
165
- d
182
+ f
166
183
  ]
167
184
  );
168
- return /* @__PURE__ */ n(z.Provider, { value: D, children: /* @__PURE__ */ n("div", { ref: m, className: P(C["verify-mfa-inline"], s), ...M, children: e }) });
185
+ return /* @__PURE__ */ t(z.Provider, { value: D, children: /* @__PURE__ */ t("div", { ref: y, className: j(I["verify-mfa-inline"], r), ...s, children: e }) });
169
186
  };
170
187
  export {
171
- _e as VerifyMfaInline,
172
- Ve as VerifyMfaInlineBackButton,
173
- Me as VerifyMfaInlineFlow,
174
- ve as useVerifyMfaInlineContext
188
+ xe as VerifyMfaInline,
189
+ Be as VerifyMfaInlineBackButton,
190
+ be as VerifyMfaInlineFlow,
191
+ he as useVerifyMfaInlineContext
175
192
  };
@@ -2,18 +2,20 @@ import "react/jsx-runtime";
2
2
  import "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
3
3
  import "react";
4
4
  import "../../chunks/lite.1fxw3LjI.js";
5
- import { d as g, e as n, f as x } from "../../chunks/CDPReactProvider.CIQm4C4z.js";
5
+ import { d as x, e as C, f as T } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
6
6
  import "../ui/Button/index.js";
7
7
  import "../ui/Modal/index.js";
8
+ import "../ui/VisuallyHidden/index.js";
8
9
  import "../../icons/IconXMark.js";
9
10
  import "../../utils/childrenHasComponent.js";
11
+ import "../VerifyMfa/VerifyMfaFlowBackButton.js";
12
+ import "../VerifyMfa/VerifyMfaFlow.js";
10
13
  import "../VerifyMfa/VerifyMfaImage.js";
11
14
  import "../VerifyMfa/VerifyMfaTitle.js";
12
15
  import "../VerifyMfa/VerifyMfaDescription.js";
13
- import "../VerifyMfa/VerifyMfaFlow.js";
14
16
  import "../VerifyMfa/VerifyMfaFooter.js";
15
17
  export {
16
- g as VerifyMfaModal,
17
- n as VerifyMfaModalContent,
18
- x as VerifyMfaModalTrigger
18
+ x as VerifyMfaModal,
19
+ C as VerifyMfaModalContent,
20
+ T as VerifyMfaModalTrigger
19
21
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as b, Fragment as H } from "react/jsx-runtime";
2
- import { useRef as R, useId as J, useState as _, useImperativeHandle as P, useLayoutEffect as j, useEffect as Q } from "react";
2
+ import { useRef as R, useId as J, useState as _, useImperativeHandle as P, useLayoutEffect as Q, useEffect as j } from "react";
3
3
  import { useTransitionMap as U } from "../../../hooks/useTransitionMap.js";
4
4
  import '../../../assets/SwitchTransition.css';const V = {
5
5
  "transition-wrapper": "SwitchTransition-module__transition-wrapper___jrI35"
@@ -15,7 +15,7 @@ import '../../../assets/SwitchTransition.css';const V = {
15
15
  transitionName: I,
16
16
  parentKey: m
17
17
  } = v;
18
- Q(() => (f(i, { initialEntered: u }), () => {
18
+ j(() => (f(i, { initialEntered: u }), () => {
19
19
  p(i);
20
20
  }), [i, u, f, p]);
21
21
  const { isEnter: h, isMounted: w, isResolved: x, status: g } = y.get(i) || {};
@@ -70,7 +70,7 @@ import '../../../assets/SwitchTransition.css';const V = {
70
70
  a.toggle(t), A(t);
71
71
  }
72
72
  } : a
73
- })), j(() => {
73
+ })), Q(() => {
74
74
  if (!n)
75
75
  return;
76
76
  let t = null;
@@ -0,0 +1,15 @@
1
+ import { CountryCode } from 'libphonenumber-js';
2
+ import { PhoneNumber } from '../utils/parseValuesFromPhoneNumber';
3
+ export interface UsePhoneNumberStateOptions {
4
+ phoneNumber?: string;
5
+ countryCode?: CountryCode;
6
+ onPhoneNumberChange?: (e164: string) => void;
7
+ onCountryCodeChange?: (countryCode: CountryCode) => void;
8
+ }
9
+ export interface UsePhoneNumberStateResult {
10
+ phoneNumberObject: PhoneNumber;
11
+ countryCode: CountryCode;
12
+ handlePhoneNumberChange: (pn: PhoneNumber) => void;
13
+ handleCountryCodeChange: (countryCode: CountryCode) => void;
14
+ }
15
+ export declare const usePhoneNumberState: ({ phoneNumber, countryCode: initialCountryCode, onPhoneNumberChange, onCountryCodeChange, }?: UsePhoneNumberStateOptions) => UsePhoneNumberStateResult;
@@ -0,0 +1,39 @@
1
+ import "libphonenumber-js";
2
+ import { useState as l, useEffect as h, useCallback as m } from "react";
3
+ import { parseValuesFromPhoneNumber as n } from "../utils/parseValuesFromPhoneNumber.js";
4
+ const i = ({
5
+ phoneNumber: r = "",
6
+ countryCode: o = "US",
7
+ onPhoneNumberChange: u,
8
+ onCountryCodeChange: c
9
+ } = {}) => {
10
+ const [s, f] = l(o), [t, a] = l(
11
+ () => n(r, o)
12
+ );
13
+ h(() => {
14
+ if (r === t.e164)
15
+ return;
16
+ const e = n(r, s);
17
+ a(e);
18
+ }, [r, s, t.e164]);
19
+ const b = m(
20
+ (e) => {
21
+ e.value !== t.value && (a(e), u?.(e.e164));
22
+ },
23
+ [t.value, u]
24
+ ), d = m(
25
+ (e) => {
26
+ f(e), c?.(e);
27
+ },
28
+ [c]
29
+ );
30
+ return {
31
+ phoneNumberObject: t,
32
+ countryCode: s,
33
+ handlePhoneNumberChange: b,
34
+ handleCountryCodeChange: d
35
+ };
36
+ };
37
+ export {
38
+ i as usePhoneNumberState
39
+ };
@@ -1,6 +1,6 @@
1
1
  import { useState as $, useRef as h, useCallback as f, useEffect as q } from "react";
2
2
  import { getTimeout as z, getEndStatus as B, getState as H, PRE_EXIT as D, nextTick as J, PRE_ENTER as A, EXITING as C, ENTERING as V, ENTERED as j, startOrEnd as F } from "../utils/transition.js";
3
- const w = (l, s, m, c, o, E) => {
3
+ const _ = (l, s, m, c, o, E) => {
4
4
  o && (clearTimeout(o), cancelAnimationFrame(o));
5
5
  const p = H(s), i = new Map(c.current);
6
6
  i.set(l, p), m(i), c.current = i, E?.({ key: l, current: p });
@@ -13,51 +13,53 @@ const w = (l, s, m, c, o, E) => {
13
13
  preExit: E,
14
14
  timeout: p = 200,
15
15
  initialEntered: i,
16
- mountOnEnter: _,
16
+ mountOnEnter: v,
17
17
  unmountOnExit: d,
18
18
  onStateChange: g
19
- } = l, [v, T] = $(/* @__PURE__ */ new Map()), n = h(v), u = h(/* @__PURE__ */ new Map()), [S, O] = z(p), G = f(
19
+ } = l, [x, T] = $(/* @__PURE__ */ new Map()), r = h(x), u = h(/* @__PURE__ */ new Map()), [O, R] = z(p), G = f(
20
20
  (t, e) => {
21
- const { initialEntered: a = i } = e || {}, r = a ? j : F(_ ?? !1);
22
- w(t, r, T, n), u.current.set(t, {});
21
+ const { initialEntered: a = i } = e || {}, n = a ? j : F(v ?? !1);
22
+ _(t, n, T, r), u.current.set(t, {});
23
23
  },
24
- [i, _]
24
+ [i, v]
25
25
  ), P = f((t) => {
26
- const e = new Map(n.current);
27
- return e.delete(t) ? (T(e), n.current = e, u.current.delete(t), !0) : !1;
26
+ const e = new Map(r.current);
27
+ return e.delete(t) ? (T(e), r.current = e, u.current.delete(t), !0) : !1;
28
28
  }, []), I = f(
29
29
  (t) => {
30
- const e = n.current.get(t);
30
+ const e = r.current.get(t);
31
31
  if (!e) {
32
32
  process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && console.error(`[React-Transition-State] invalid key: ${t}`);
33
33
  return;
34
34
  }
35
- const { timerId: a } = u.current.get(t) ?? {}, r = B(e._s, d ?? !1);
36
- r && w(t, r, T, n, a, g);
35
+ const { timerId: a } = u.current.get(t) ?? {}, n = B(e._s, d ?? !1);
36
+ n && _(t, n, T, r, a, g);
37
37
  },
38
38
  [g, d]
39
39
  ), M = f(
40
40
  (t, e) => {
41
- const a = n.current.get(t);
41
+ const a = r.current.get(t);
42
42
  if (!a) {
43
43
  process.env.NODE_ENV !== "production" && console.error(`[React-Transition-State] invalid key: ${t}`);
44
44
  return;
45
45
  }
46
- const r = u.current.get(t), R = (N) => {
47
- switch (w(t, N, T, n, r.timerId, g), N) {
46
+ const n = u.current.get(t), b = (N) => {
47
+ switch (_(t, N, T, r, n.timerId, g), N) {
48
48
  case V:
49
- S >= 0 && (r.timerId = setTimeout(() => I(t), S));
49
+ O >= 0 && (n.timerId = setTimeout(() => I(t), O));
50
50
  break;
51
51
  case C:
52
- O >= 0 && (r.timerId = setTimeout(() => I(t), O));
52
+ R >= 0 && (n.timerId = setTimeout(() => I(t), R));
53
53
  break;
54
54
  case A:
55
55
  case D:
56
- r.timerId = J(R, N);
56
+ n.timerId = J(b, N, (S) => {
57
+ n.timerId = S;
58
+ });
57
59
  break;
58
60
  }
59
- }, b = a.isEnter;
60
- typeof e != "boolean" && (e = !b), e ? b || (R(m ? o ? A : V : j), s || n.current.forEach((N, x) => x !== t && M(x, !1))) : b && R(c ? E ? D : C : F(d ?? !1));
61
+ }, w = a.isEnter;
62
+ typeof e != "boolean" && (e = !w), e ? w || (b(m ? o ? A : V : j), s || r.current.forEach((N, S) => S !== t && M(S, !1))) : w && b(c ? E ? D : C : F(d ?? !1));
61
63
  },
62
64
  [
63
65
  g,
@@ -67,14 +69,14 @@ const w = (l, s, m, c, o, E) => {
67
69
  c,
68
70
  o,
69
71
  E,
70
- S,
71
72
  O,
73
+ R,
72
74
  d
73
75
  ]
74
76
  ), X = f(
75
77
  (t) => {
76
78
  if (!(!s && t !== !1))
77
- for (const e of n.current.keys()) M(e, t);
79
+ for (const e of r.current.keys()) M(e, t);
78
80
  },
79
81
  [s, M]
80
82
  );
@@ -85,7 +87,7 @@ const w = (l, s, m, c, o, E) => {
85
87
  e.timerId && (clearTimeout(e.timerId), cancelAnimationFrame(e.timerId));
86
88
  };
87
89
  }, []), {
88
- stateMap: v,
90
+ stateMap: x,
89
91
  toggle: M,
90
92
  toggleAll: X,
91
93
  endTransition: I,
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "@coinbase/cdp-core";
3
3
  import "../chunks/useSendComponentCallOnce.BHZMuo6E.js";
4
- import { g as t, h as m, b as p } from "../chunks/CDPReactProvider.CIQm4C4z.js";
4
+ import { g as t, h as m, b as p } from "../chunks/CDPReactProvider.C38bKQ2x.js";
5
5
  import "react";
6
6
  export {
7
7
  t as VerifyMfaModalProvider,