@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.
- 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.C38bKQ2x.js +337 -0
- package/dist/chunks/{LinkAuthFlow.BaUSMzGH.js → LinkAuthFlow.CLubKoY0.js} +13 -13
- package/dist/chunks/{index.C_DV0Ud7.js → index.BN39qScu.js} +1 -1
- package/dist/chunks/index.BX4k-ruQ.js +12 -0
- package/dist/chunks/index.Bgx0-QLY.js +12 -0
- package/dist/components/CDPReactProvider/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 +1 -1
- package/dist/components/ExportWallet/index.js +109 -101
- package/dist/components/ExportWalletModal/index.js +1 -1
- package/dist/components/Fund/index.js +1 -1
- package/dist/components/FundModal/index.js +1 -1
- 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 +3 -3
- package/dist/components/LinkAuth/types.js +1 -1
- package/dist/components/LinkAuth/utils.js +1 -1
- package/dist/components/LinkAuthModal/index.js +2 -2
- package/dist/components/OAuthStatusModal/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 +1 -1
- 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 +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 +23 -14
- 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 +7 -5
- 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 +1 -1
- package/dist/index.js +59 -51
- 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
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as u, useContext as i, useMemo as c } from "react";
|
|
3
|
+
import "@coinbase/cdp-core";
|
|
3
4
|
import "@coinbase/cdp-hooks";
|
|
4
5
|
const l = u(null), f = () => {
|
|
5
6
|
const o = i(l);
|
|
6
7
|
if (!o)
|
|
7
8
|
throw new Error("useEnrollMfaFlowInternal must be used within a EnrollMfaFlowContext.Provider");
|
|
8
9
|
return o;
|
|
9
|
-
},
|
|
10
|
+
}, M = () => {
|
|
10
11
|
const { transitionRef: o, ...t } = f();
|
|
11
12
|
return t;
|
|
12
|
-
},
|
|
13
|
+
}, F = ({
|
|
13
14
|
children: o,
|
|
14
15
|
onBack: t,
|
|
15
16
|
onStartEnrollment: r,
|
|
@@ -28,7 +29,7 @@ const l = u(null), f = () => {
|
|
|
28
29
|
return /* @__PURE__ */ a(l.Provider, { value: s, children: o });
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
F as EnrollMfaFlowProvider,
|
|
33
|
+
M as useEnrollMfaFlow,
|
|
33
34
|
f as useEnrollMfaFlowInternal
|
|
34
35
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { useEnrollMfaContext as l } from "./EnrollMfaProvider.js";
|
|
4
|
-
import { m as c } from "../../chunks/index.
|
|
4
|
+
import { m as c } from "../../chunks/index.Bgx0-QLY.js";
|
|
5
|
+
import "@coinbase/cdp-core";
|
|
5
6
|
import "@coinbase/cdp-hooks";
|
|
6
|
-
const
|
|
7
|
+
const u = ({
|
|
7
8
|
as: r = "div",
|
|
8
9
|
children: t,
|
|
9
10
|
className: s = "",
|
|
@@ -11,9 +12,9 @@ const M = ({
|
|
|
11
12
|
step: p,
|
|
12
13
|
...a
|
|
13
14
|
}) => {
|
|
14
|
-
const { state: o } = l(), i = p || o.step,
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
const { state: o } = l(), i = p || o.step, m = n || o.method, f = c[m].image;
|
|
16
|
+
return /* @__PURE__ */ e(r, { className: s, ...a, children: t || /* @__PURE__ */ e(f, { step: i, method: m }) });
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
+
u as EnrollMfaImage
|
|
19
20
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useCurrentUser as l } from "@coinbase/cdp-hooks";
|
|
3
3
|
import "react";
|
|
4
4
|
import { ToggleListItem as a } from "../ui/ToggleListItem/index.js";
|
|
5
|
-
|
|
5
|
+
import "@coinbase/cdp-core";
|
|
6
|
+
const A = ({ method: e, icon: o, label: s, isPending: i, onSetUp: m }) => {
|
|
6
7
|
const { currentUser: t } = l(), r = t?.mfaMethods?.[e]?.enrolledAt ? Date.now() > new Date(t.mfaMethods[e].enrolledAt).getTime() : !1;
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
8
9
|
a,
|
|
9
10
|
{
|
|
10
11
|
icon: o,
|
|
11
12
|
label: s,
|
|
12
13
|
isActive: r,
|
|
13
|
-
isPending:
|
|
14
|
-
onActivate:
|
|
14
|
+
isPending: i,
|
|
15
|
+
onActivate: m,
|
|
15
16
|
isDisabled: r
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
};
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
A as EnrollMfaItem
|
|
21
22
|
};
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { c as u } from "../../chunks/lite.1fxw3LjI.js";
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useMemo as I } from "react";
|
|
4
|
+
import { IconPhone as M } from "../../icons/IconPhone.js";
|
|
5
|
+
import { IconPinCode as d } from "../../icons/IconPinCode.js";
|
|
6
|
+
import { EnrollMfaItem as E } from "./EnrollMfaItem.js";
|
|
7
|
+
import { useEnrollMfaContext as P } from "./EnrollMfaProvider.js";
|
|
8
|
+
import "@coinbase/cdp-core";
|
|
7
9
|
import "@coinbase/cdp-hooks";
|
|
8
10
|
import '../../assets/EnrollMfaItems.css';const _ = "EnrollMfaItems-module__list___5ZZmE", x = {
|
|
9
11
|
list: _
|
|
10
|
-
},
|
|
11
|
-
totp: { Icon: /* @__PURE__ */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
}, b = {
|
|
13
|
+
totp: { Icon: /* @__PURE__ */ t(d, {}), label: "Authenticator app" },
|
|
14
|
+
sms: { Icon: /* @__PURE__ */ t(M, {}), label: "SMS" }
|
|
15
|
+
}, N = ({ children: l, className: m = "", onSetUp: r, ...c }) => {
|
|
16
|
+
const { state: a } = P(), { methods: s, method: i, isPending: e } = a, p = I(() => s.map((o) => {
|
|
17
|
+
const { Icon: n, label: f } = b[o];
|
|
15
18
|
return {
|
|
16
|
-
method:
|
|
17
|
-
icon:
|
|
19
|
+
method: o,
|
|
20
|
+
icon: n,
|
|
18
21
|
label: f,
|
|
19
22
|
onSetUp: async () => {
|
|
20
|
-
await
|
|
23
|
+
await r?.(o);
|
|
21
24
|
}
|
|
22
25
|
};
|
|
23
|
-
}), [
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
...
|
|
26
|
-
method:
|
|
27
|
-
isPending: e && i ===
|
|
28
|
-
}) || /* @__PURE__ */
|
|
29
|
-
|
|
26
|
+
}), [s, r]);
|
|
27
|
+
return /* @__PURE__ */ t("ul", { className: u(x.list, m), ...c, children: p.map(({ method: o, ...n }) => /* @__PURE__ */ t("li", { children: l?.({
|
|
28
|
+
...n,
|
|
29
|
+
method: o,
|
|
30
|
+
isPending: e && i === o
|
|
31
|
+
}) || /* @__PURE__ */ t(
|
|
32
|
+
E,
|
|
30
33
|
{
|
|
31
|
-
...
|
|
32
|
-
method:
|
|
33
|
-
isPending: e && i ===
|
|
34
|
+
...n,
|
|
35
|
+
method: o,
|
|
36
|
+
isPending: e && i === o
|
|
34
37
|
}
|
|
35
|
-
) },
|
|
38
|
+
) }, o)) });
|
|
36
39
|
};
|
|
37
40
|
export {
|
|
38
|
-
|
|
41
|
+
N as EnrollMfaItems
|
|
39
42
|
};
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as s, useContext as a, useEffect as u, useMemo as c } from "react";
|
|
3
|
+
import "@coinbase/cdp-core";
|
|
3
4
|
import "@coinbase/cdp-hooks";
|
|
4
|
-
import { useEnrollMfaReducer as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
5
|
+
import { useEnrollMfaReducer as p } from "./useEnrollMfaReducer.js";
|
|
6
|
+
const i = s(null), C = () => {
|
|
7
|
+
const o = a(i);
|
|
8
|
+
if (!o)
|
|
8
9
|
throw new Error("useEnrollMfaContext must be used within EnrollMfaProvider");
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
children:
|
|
12
|
-
onEnrollSuccess:
|
|
13
|
-
methods:
|
|
10
|
+
return o;
|
|
11
|
+
}, v = ({
|
|
12
|
+
children: o,
|
|
13
|
+
onEnrollSuccess: n,
|
|
14
|
+
methods: t
|
|
14
15
|
}) => {
|
|
15
|
-
const [r, e] =
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const [r, e] = p(t);
|
|
17
|
+
u(() => {
|
|
18
|
+
t && t.join(",") !== r.methods.join(",") && e({ type: "SET_METHODS", payload: { methods: t } });
|
|
19
|
+
}, [t, e, r.methods]);
|
|
20
|
+
const l = c(
|
|
21
|
+
() => ({ state: r, dispatch: e, onEnrollSuccess: n }),
|
|
22
|
+
[r, e, n]
|
|
18
23
|
);
|
|
19
|
-
return /* @__PURE__ */ i
|
|
24
|
+
return /* @__PURE__ */ f(i.Provider, { value: l, children: o });
|
|
20
25
|
};
|
|
21
26
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
v as EnrollMfaProvider,
|
|
28
|
+
C as useEnrollMfaContext
|
|
24
29
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsx as t, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { useEnrollMfaContext as p } from "./EnrollMfaProvider.js";
|
|
4
|
-
import { m as f } from "../../chunks/index.
|
|
4
|
+
import { m as f } from "../../chunks/index.Bgx0-QLY.js";
|
|
5
|
+
import "@coinbase/cdp-core";
|
|
5
6
|
import "@coinbase/cdp-hooks";
|
|
6
7
|
import '../../assets/EnrollMfaTitle.css';const g = "EnrollMfaTitle-module__heading___ogrZZ", u = {
|
|
7
8
|
heading: g
|
|
8
|
-
},
|
|
9
|
-
as:
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
9
|
+
}, C = ({
|
|
10
|
+
as: i = "h2",
|
|
11
|
+
children: r,
|
|
12
|
+
className: s = "",
|
|
12
13
|
method: l,
|
|
13
14
|
step: m,
|
|
14
15
|
...a
|
|
15
16
|
}) => {
|
|
16
17
|
const { state: o } = p(), e = m || o.step, n = l || o.method, c = f[n].title, d = e === "list" ? /* @__PURE__ */ t(h, { children: "Add multi-factor authentication" }) : /* @__PURE__ */ t(c, { step: e, method: n });
|
|
17
|
-
return /* @__PURE__ */ t(
|
|
18
|
+
return /* @__PURE__ */ t(i, { className: `${u.heading} ${s}`, ...a, children: r ?? d });
|
|
18
19
|
};
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
+
C as EnrollMfaTitle
|
|
21
22
|
};
|
|
@@ -1,180 +1,186 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as s, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { getEnabledMfaMethods as $, getEnrolledMfaMethods as k } from "@coinbase/cdp-core";
|
|
3
|
+
import { useCurrentUser as w, useIsInitialized as V, useInitiateMfaEnrollment as j, useSubmitMfaEnrollment as z, useRecordMfaEnrollmentPrompted as q } from "@coinbase/cdp-hooks";
|
|
4
|
+
import { u as J } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
5
|
+
import { useMemo as C, useRef as _, useEffect as v, useCallback as p, useLayoutEffect as K } from "react";
|
|
6
|
+
import { c as G } from "../../chunks/lite.1fxw3LjI.js";
|
|
7
|
+
import { u as X } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
8
|
+
import { useTimeout as Y } from "../../hooks/useTimeout.js";
|
|
9
|
+
import { isApiError as Z } from "../../utils/isApiError.js";
|
|
9
10
|
import "libphonenumber-js";
|
|
10
|
-
import { EnrollMfaDescription as
|
|
11
|
-
import { EnrollMfaFlow as
|
|
12
|
-
import { EnrollMfaFlowBackButton as
|
|
13
|
-
import { EnrollMfaFlowProvider as
|
|
14
|
-
import { useEnrollMfaFlow as
|
|
15
|
-
import { EnrollMfaFooter as
|
|
16
|
-
import { EnrollMfaImage as
|
|
17
|
-
import { EnrollMfaItem as
|
|
18
|
-
import { EnrollMfaItems as
|
|
19
|
-
import { EnrollMfaProvider as
|
|
20
|
-
import { EnrollMfaTitle as
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
11
|
+
import { EnrollMfaDescription as O } from "./EnrollMfaDescription.js";
|
|
12
|
+
import { EnrollMfaFlow as H } from "./EnrollMfaFlow.js";
|
|
13
|
+
import { EnrollMfaFlowBackButton as Q } from "./EnrollMfaFlowBackButton.js";
|
|
14
|
+
import { EnrollMfaFlowProvider as W } from "./EnrollMfaFlowProvider.js";
|
|
15
|
+
import { useEnrollMfaFlow as Fe } from "./EnrollMfaFlowProvider.js";
|
|
16
|
+
import { EnrollMfaFooter as ee } from "./EnrollMfaFooter.js";
|
|
17
|
+
import { EnrollMfaImage as te } from "./EnrollMfaImage.js";
|
|
18
|
+
import { EnrollMfaItem as Pe } from "./EnrollMfaItem.js";
|
|
19
|
+
import { EnrollMfaItems as De } from "./EnrollMfaItems.js";
|
|
20
|
+
import { EnrollMfaProvider as oe, useEnrollMfaContext as A } from "./EnrollMfaProvider.js";
|
|
21
|
+
import { EnrollMfaTitle as U } from "./EnrollMfaTitle.js";
|
|
22
|
+
import { m as re } from "../../chunks/index.Bgx0-QLY.js";
|
|
23
|
+
import { Banner as ne } from "../ui/Banner/index.js";
|
|
24
|
+
import '../../assets/EnrollMfa.css';const le = "EnrollMfa-module__img___JmjV1", ae = "EnrollMfa-module__centered___YxB8I", ie = "EnrollMfa-module__footer___Zro3u", a = {
|
|
23
25
|
"mfa-enrollment": "EnrollMfa-module__mfa-enrollment___80xnL",
|
|
24
|
-
img:
|
|
26
|
+
img: le,
|
|
25
27
|
"flex-container": "EnrollMfa-module__flex-container___9Dazs",
|
|
26
28
|
"gap-2": "EnrollMfa-module__gap-2___BKEqR",
|
|
27
29
|
"gap-3": "EnrollMfa-module__gap-3___JKVyF",
|
|
28
|
-
centered:
|
|
29
|
-
footer:
|
|
30
|
-
},
|
|
31
|
-
const { state:
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
className:
|
|
35
|
-
children:
|
|
36
|
-
resetOnSuccess:
|
|
37
|
-
...
|
|
30
|
+
centered: ae,
|
|
31
|
+
footer: ie
|
|
32
|
+
}, se = 5 * 60 * 1e3, me = ({ role: d = "alert", ...m }) => {
|
|
33
|
+
const { state: i } = A(), { error: l } = i;
|
|
34
|
+
return l ? /* @__PURE__ */ r(ne, { variant: "error", role: d, ...m, children: Z(l) ? l.message : l }) : null;
|
|
35
|
+
}, ce = ({
|
|
36
|
+
className: d = "",
|
|
37
|
+
children: m,
|
|
38
|
+
resetOnSuccess: i = !0,
|
|
39
|
+
...l
|
|
38
40
|
}) => {
|
|
39
|
-
const { isInitialized:
|
|
40
|
-
|
|
41
|
-
!
|
|
42
|
-
}, [
|
|
41
|
+
const { isInitialized: c } = V(), { currentUser: E } = w(), { state: e, dispatch: o, onEnrollSuccess: M } = A(), { initiateMfaEnrollment: h } = j(), { submitMfaEnrollment: I } = z(), { recordMfaEnrollmentPrompted: S } = q(), { showCoinbaseFooter: F } = X(), g = _(!1), y = !!E;
|
|
42
|
+
v(() => {
|
|
43
|
+
!c || !y || g.current || (S(), g.current = !0);
|
|
44
|
+
}, [S, c, y]), v(() => {
|
|
43
45
|
if (!e.initiatedAt) return;
|
|
44
46
|
const t = () => {
|
|
45
|
-
e.initiatedAt && Date.now() - e.initiatedAt >=
|
|
47
|
+
e.initiatedAt && Date.now() - e.initiatedAt >= se && o({ type: "ENROLLMENT_SESSION_EXPIRED" });
|
|
46
48
|
};
|
|
47
49
|
t();
|
|
48
|
-
const
|
|
49
|
-
return () => clearInterval(
|
|
50
|
-
}, [e.initiatedAt,
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}, []),
|
|
54
|
-
|
|
55
|
-
}, [
|
|
50
|
+
const n = setInterval(t, 1e3);
|
|
51
|
+
return () => clearInterval(n);
|
|
52
|
+
}, [e.initiatedAt, o]);
|
|
53
|
+
const T = _(e.step), N = _(null), { schedule: L } = Y(), R = p((t) => {
|
|
54
|
+
T.current !== t && (T.current = t, N.current?.transition.toggle(t));
|
|
55
|
+
}, []), B = p(() => {
|
|
56
|
+
o({ type: "GO_TO_PREVIOUS_STEP" });
|
|
57
|
+
}, [o]), P = p(
|
|
56
58
|
async (t) => {
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
if (!c) return;
|
|
60
|
+
const n = re[t];
|
|
61
|
+
if (n.requiresInput && e.step !== "setup") {
|
|
62
|
+
o({
|
|
63
|
+
type: "SET_STEP",
|
|
64
|
+
payload: { step: "setup", flowDirection: "left", method: t }
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
o({ type: "INITIATE_ENROLLMENT", payload: { method: t } });
|
|
69
|
+
try {
|
|
70
|
+
const f = n.getInitiateOptions(e), D = await h(f);
|
|
71
|
+
o({ type: "INITIATE_ENROLLMENT_SUCCESS", payload: D });
|
|
72
|
+
} catch (f) {
|
|
73
|
+
o({
|
|
74
|
+
type: "INITIATE_ENROLLMENT_FAILURE",
|
|
75
|
+
payload: {
|
|
76
|
+
error: f instanceof Error ? f.message : "Failed to initiate enrollment"
|
|
77
|
+
}
|
|
78
|
+
});
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
|
-
[
|
|
79
|
-
),
|
|
81
|
+
[o, h, c, e]
|
|
82
|
+
), b = p(
|
|
80
83
|
async (t) => {
|
|
81
|
-
t.preventDefault(),
|
|
84
|
+
t.preventDefault(), o({ type: "SUBMIT_ENROLLMENT" });
|
|
82
85
|
try {
|
|
83
|
-
await
|
|
86
|
+
await I({
|
|
84
87
|
mfaMethod: e.method,
|
|
85
88
|
mfaCode: e.mfaCode
|
|
86
|
-
}),
|
|
87
|
-
|
|
89
|
+
}), o({ type: "SUBMIT_ENROLLMENT_SUCCESS" }), M?.(), i && L(() => {
|
|
90
|
+
o({ type: "SET_STEP", payload: { step: "list", flowDirection: "left" } });
|
|
88
91
|
}, 800);
|
|
89
|
-
} catch (
|
|
90
|
-
|
|
92
|
+
} catch (n) {
|
|
93
|
+
o({
|
|
91
94
|
type: "SUBMIT_ENROLLMENT_FAILURE",
|
|
92
95
|
payload: {
|
|
93
|
-
error:
|
|
96
|
+
error: n instanceof Error ? n.message : "Verification failed"
|
|
94
97
|
}
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
},
|
|
98
101
|
[
|
|
99
|
-
|
|
102
|
+
o,
|
|
100
103
|
e.method,
|
|
101
104
|
e.mfaCode,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
I,
|
|
106
|
+
M,
|
|
107
|
+
i,
|
|
108
|
+
L
|
|
106
109
|
]
|
|
107
110
|
);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}, [e.step,
|
|
111
|
-
const
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
-
|
|
111
|
+
K(() => {
|
|
112
|
+
R(e.step);
|
|
113
|
+
}, [e.step, R]);
|
|
114
|
+
const x = typeof m == "function" ? m(e) : m;
|
|
115
|
+
return /* @__PURE__ */ r(
|
|
116
|
+
W,
|
|
114
117
|
{
|
|
115
|
-
onBack:
|
|
116
|
-
onStartEnrollment:
|
|
117
|
-
onSubmit:
|
|
118
|
-
transitionRef:
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
|
|
121
|
-
!
|
|
122
|
-
/* @__PURE__ */
|
|
118
|
+
onBack: B,
|
|
119
|
+
onStartEnrollment: P,
|
|
120
|
+
onSubmit: b,
|
|
121
|
+
transitionRef: N,
|
|
122
|
+
children: /* @__PURE__ */ s("div", { className: `${a["mfa-enrollment"]} ${d}`, ...l, children: [
|
|
123
|
+
x,
|
|
124
|
+
!x && /* @__PURE__ */ s(u, { children: [
|
|
125
|
+
/* @__PURE__ */ s(
|
|
123
126
|
"div",
|
|
124
127
|
{
|
|
125
|
-
className:
|
|
126
|
-
|
|
127
|
-
e.step === "list" ?
|
|
128
|
+
className: G(
|
|
129
|
+
a["flex-container"],
|
|
130
|
+
e.step === "list" ? a["gap-3"] : ""
|
|
128
131
|
),
|
|
129
132
|
children: [
|
|
130
|
-
e.step === "list" ? /* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
e.step === "list" ? /* @__PURE__ */ s(u, { children: [
|
|
134
|
+
/* @__PURE__ */ s("div", { children: [
|
|
135
|
+
/* @__PURE__ */ r(U, { step: "list", method: e.method }),
|
|
136
|
+
/* @__PURE__ */ r(O, { step: "list", method: e.method })
|
|
134
137
|
] }),
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
] }) : /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
t !== "list" && /* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
138
|
+
/* @__PURE__ */ r(me, {})
|
|
139
|
+
] }) : /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(Q, { step: e.step }) }),
|
|
140
|
+
/* @__PURE__ */ r(H, { children: ({ step: t, method: n, Content: f }) => /* @__PURE__ */ s("div", { className: `${a["flex-container"]} ${a["gap-2"]}`, children: [
|
|
141
|
+
t !== "list" && /* @__PURE__ */ s(u, { children: [
|
|
142
|
+
/* @__PURE__ */ r(
|
|
143
|
+
te,
|
|
141
144
|
{
|
|
142
|
-
className: `${
|
|
145
|
+
className: `${a.img} ${a.centered}`,
|
|
143
146
|
step: t,
|
|
144
|
-
method:
|
|
147
|
+
method: n
|
|
145
148
|
}
|
|
146
149
|
),
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ s("div", { className: a.centered, children: [
|
|
151
|
+
/* @__PURE__ */ r(U, { step: t, method: n }),
|
|
152
|
+
/* @__PURE__ */ r(O, { step: t, method: n })
|
|
150
153
|
] })
|
|
151
154
|
] }),
|
|
152
|
-
|
|
155
|
+
f
|
|
153
156
|
] }) })
|
|
154
157
|
]
|
|
155
158
|
}
|
|
156
159
|
),
|
|
157
|
-
|
|
160
|
+
F && /* @__PURE__ */ r(ee, { className: a.footer })
|
|
158
161
|
] })
|
|
159
162
|
] })
|
|
160
163
|
}
|
|
161
164
|
);
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
165
|
+
}, Ue = ({ onEnrollSuccess: d, ...m }) => {
|
|
166
|
+
J("enroll_mfa");
|
|
167
|
+
const { currentUser: i } = w(), l = $(), c = C(
|
|
168
|
+
() => i ? k(i) : [],
|
|
169
|
+
[i]
|
|
170
|
+
), E = C(() => [.../* @__PURE__ */ new Set([...l, ...c])], [l, c]);
|
|
171
|
+
return /* @__PURE__ */ r(oe, { methods: E, onEnrollSuccess: d, children: /* @__PURE__ */ r(ce, { ...m }) });
|
|
166
172
|
};
|
|
167
173
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
Ue as EnrollMfa,
|
|
175
|
+
O as EnrollMfaDescription,
|
|
176
|
+
me as EnrollMfaError,
|
|
177
|
+
H as EnrollMfaFlow,
|
|
178
|
+
Q as EnrollMfaFlowBackButton,
|
|
179
|
+
ee as EnrollMfaFooter,
|
|
180
|
+
te as EnrollMfaImage,
|
|
181
|
+
Pe as EnrollMfaItem,
|
|
182
|
+
De as EnrollMfaItems,
|
|
183
|
+
U as EnrollMfaTitle,
|
|
184
|
+
A as useEnrollMfaContext,
|
|
185
|
+
Fe as useEnrollMfaFlow
|
|
180
186
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EnrollMfaMethodConfig, EnrollMfaMethodContentProps, EnrollMfaMethodComponentProps } from '../types';
|
|
2
|
+
export declare const SmsContent: ({ autoFocus, step, onSubmit, children, }: EnrollMfaMethodContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const SmsTitle: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export declare const SmsDescription: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export declare const SmsImage: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare const smsMethodConfig: EnrollMfaMethodConfig;
|