@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,9 +1,9 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { a as d } from "../../chunks/index.
|
|
3
|
+
import { a as d } from "../../chunks/index.BN39qScu.js";
|
|
4
4
|
import { useSignInContext as h } from "./SignInProvider.js";
|
|
5
5
|
import "@coinbase/cdp-hooks";
|
|
6
|
-
import "../../chunks/CDPReactProvider.
|
|
6
|
+
import "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
7
7
|
import '../../assets/SignInDescription.css';const u = "SignInDescription-module__description___jZLc6", _ = {
|
|
8
8
|
description: u
|
|
9
9
|
}, M = ({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useState as I, useLayoutEffect as p } from "react";
|
|
3
|
-
import "../../chunks/CDPReactProvider.
|
|
3
|
+
import "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
4
4
|
import { SwitchFadeTransition as T } from "../ui/SwitchFadeTransition/index.js";
|
|
5
|
-
import { a as y } from "../../chunks/index.
|
|
5
|
+
import { a as y } from "../../chunks/index.BN39qScu.js";
|
|
6
6
|
import { useSignInContext as v } from "./SignInProvider.js";
|
|
7
7
|
import "@coinbase/cdp-hooks";
|
|
8
8
|
import '../../assets/SignInForm.css';const E = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { u as a } from "../../chunks/CDPReactProvider.
|
|
2
|
+
import { u as a } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
3
3
|
import '../../assets/SignInImage.css';const e = "SignInImage-module__logo___rlzt-", m = {
|
|
4
4
|
logo: e
|
|
5
5
|
}, p = (t) => /^https?:\/\//.test(t), f = ({ className: t = "", alt: s, src: g }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as h } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as m, useContext as l, useMemo as i } from "react";
|
|
3
|
-
import { u as f } from "../../chunks/CDPReactProvider.
|
|
3
|
+
import { u as f } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
4
4
|
import "@coinbase/cdp-hooks";
|
|
5
5
|
import { useSignInReducer as p } from "./useSignInReducer.js";
|
|
6
6
|
const a = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { a as c } from "../../chunks/index.
|
|
3
|
+
import { a as c } from "../../chunks/index.BN39qScu.js";
|
|
4
4
|
import { useSignInContext as d } from "./SignInProvider.js";
|
|
5
5
|
import "@coinbase/cdp-hooks";
|
|
6
|
-
import "../../chunks/CDPReactProvider.
|
|
6
|
+
import "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
7
7
|
import '../../assets/SignInTitle.css';const l = "SignInTitle-module__heading___QJ071", g = {
|
|
8
8
|
heading: l
|
|
9
9
|
}, S = ({
|
|
@@ -8,7 +8,7 @@ import { useEmailForm as A } from "../hooks/useEmailForm.js";
|
|
|
8
8
|
import { useOTPForm as B } from "../hooks/useOTPForm.js";
|
|
9
9
|
import { SignInCredentials as G } from "../SignInCredentials.js";
|
|
10
10
|
import { useSignInContext as E } from "../SignInProvider.js";
|
|
11
|
-
import "../../../chunks/CDPReactProvider.
|
|
11
|
+
import "../../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
12
12
|
const J = ["email", "otp"], N = ({
|
|
13
13
|
step: n,
|
|
14
14
|
autoFocus: s,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as h, Fragment as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "@coinbase/cdp-hooks";
|
|
3
3
|
import { useRef as A, useCallback as S, useEffect as v } from "react";
|
|
4
|
-
import { u as m } from "../../../chunks/CDPReactProvider.
|
|
4
|
+
import { u as m } from "../../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
5
5
|
import { useSignInWithOAuth as O } from "../hooks/useSignInWithOAuth.js";
|
|
6
6
|
import { Button as W } from "../../ui/Button/index.js";
|
|
7
7
|
import { ServerError as I } from "../../ui/ServerError/index.js";
|
|
@@ -1,116 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useIsSignedIn as
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { formatPhoneNumber as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
const ee = ["phoneNumber", "otp"], te = ({
|
|
1
|
+
import { jsxs as u, Fragment as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useIsSignedIn as M, useSignInWithSms as H, useLinkSms as V, useVerifySmsOTP as q } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useRef as S, useLayoutEffect as z, useMemo as A } from "react";
|
|
4
|
+
import { OTPForm as B } from "../../forms/OTPForm/index.js";
|
|
5
|
+
import { PhoneNumberForm as G } from "../../forms/PhoneNumberForm/index.js";
|
|
6
|
+
import { SwitchSlideTransition as J } from "../../ui/SwitchSlideTransition/index.js";
|
|
7
|
+
import { usePhoneNumberState as Q } from "../../../hooks/usePhoneNumberState.js";
|
|
8
|
+
import { formatPhoneNumber as U } from "../../../utils/formatPhoneNumber.js";
|
|
9
|
+
import { useOTPForm as X } from "../hooks/useOTPForm.js";
|
|
10
|
+
import { usePhoneNumberForm as Y } from "../hooks/usePhoneNumberForm.js";
|
|
11
|
+
import { SignInCredentials as Z } from "../SignInCredentials.js";
|
|
12
|
+
import { useSignInContext as g } from "../SignInProvider.js";
|
|
13
|
+
import "../../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
14
|
+
const _ = ["phoneNumber", "otp"], $ = ({
|
|
16
15
|
step: o,
|
|
17
16
|
autoFocus: i,
|
|
18
17
|
onSuccess: m,
|
|
19
|
-
children:
|
|
18
|
+
children: a
|
|
20
19
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}), { resendCountdown:
|
|
27
|
-
passwordLength:
|
|
28
|
-
submit: (
|
|
29
|
-
}),
|
|
30
|
-
e.value !== u.value && (f(e), R(e.e164));
|
|
31
|
-
};
|
|
32
|
-
A(() => {
|
|
33
|
-
if (t.phoneNumber === u.e164)
|
|
34
|
-
return;
|
|
35
|
-
const e = Z(t.phoneNumber, c);
|
|
36
|
-
f(e);
|
|
37
|
-
}, [t.phoneNumber, c, u.e164]);
|
|
38
|
-
const g = () => {
|
|
20
|
+
const h = S(null), P = 6, { isSignedIn: N } = M(), { state: e } = g(), { signInWithSms: T } = H(), { linkSms: C } = V(), { verifySmsOTP: O } = q(), p = o || e.step, t = p === "credentials" ? "phoneNumber" : "otp", d = S(t), { setPhoneNumber: I, submitPhoneNumber: f } = Y({
|
|
21
|
+
submit: (n) => N ? C(n) : T({ phoneNumber: n })
|
|
22
|
+
}), { phoneNumberObject: v, countryCode: y, handlePhoneNumberChange: F, handleCountryCodeChange: w } = Q({
|
|
23
|
+
phoneNumber: e.phoneNumber,
|
|
24
|
+
onPhoneNumberChange: I
|
|
25
|
+
}), { resendCountdown: R, resetOTP: D, setOTP: W, startResendTimer: x, submitOtp: E } = X({
|
|
26
|
+
passwordLength: P,
|
|
27
|
+
submit: (n) => O({ flowId: e.flowId, otp: n })
|
|
28
|
+
}), l = () => {
|
|
39
29
|
x(60);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
const r = new FormData(
|
|
47
|
-
|
|
30
|
+
}, j = () => {
|
|
31
|
+
D(), f({ phoneNumber: e.phoneNumber, onSuccess: l });
|
|
32
|
+
}, L = (n) => {
|
|
33
|
+
n.preventDefault(), f({ phoneNumber: e.phoneNumber, onSuccess: l });
|
|
34
|
+
}, k = (n) => {
|
|
35
|
+
n.preventDefault();
|
|
36
|
+
const r = new FormData(n.currentTarget).get("otp") || e.otp;
|
|
37
|
+
E({ otp: r, onSuccess: m });
|
|
48
38
|
};
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
39
|
+
return z(() => {
|
|
40
|
+
d.current !== t && (h.current?.transition.toggle(t), d.current = t);
|
|
41
|
+
}, [t]), /* @__PURE__ */ s(
|
|
42
|
+
J,
|
|
53
43
|
{
|
|
54
44
|
autoFocus: i ? "input[type='tel']" : !1,
|
|
55
45
|
animateHeight: !1,
|
|
56
|
-
items:
|
|
46
|
+
items: _,
|
|
57
47
|
initialEntered: !0,
|
|
58
|
-
direction:
|
|
59
|
-
transitionRef:
|
|
60
|
-
children: ({ itemKey:
|
|
48
|
+
direction: t === "otp" ? "left" : "right",
|
|
49
|
+
transitionRef: h,
|
|
50
|
+
children: ({ itemKey: n, ...b }) => {
|
|
61
51
|
let r = null;
|
|
62
|
-
return
|
|
63
|
-
|
|
52
|
+
return n === "phoneNumber" && (r = /* @__PURE__ */ s(
|
|
53
|
+
G,
|
|
64
54
|
{
|
|
65
|
-
countryCode:
|
|
66
|
-
error:
|
|
67
|
-
isPending:
|
|
55
|
+
countryCode: y,
|
|
56
|
+
error: t === "phoneNumber" && e.error || "",
|
|
57
|
+
isPending: e.isPending,
|
|
68
58
|
onCountryCodeChange: w,
|
|
69
|
-
onPhoneNumberChange:
|
|
70
|
-
onSubmit:
|
|
71
|
-
phoneNumber:
|
|
59
|
+
onPhoneNumberChange: F,
|
|
60
|
+
onSubmit: L,
|
|
61
|
+
phoneNumber: v
|
|
72
62
|
}
|
|
73
|
-
)),
|
|
74
|
-
|
|
63
|
+
)), n === "otp" && (r = /* @__PURE__ */ s(
|
|
64
|
+
B,
|
|
75
65
|
{
|
|
76
|
-
canResetOTP:
|
|
77
|
-
error:
|
|
78
|
-
isPending:
|
|
66
|
+
canResetOTP: e.canResetOTP,
|
|
67
|
+
error: t === "otp" && e.error || "",
|
|
68
|
+
isPending: e.isPending,
|
|
79
69
|
onOTPChange: W,
|
|
80
|
-
onResendOTP:
|
|
81
|
-
onSubmit:
|
|
82
|
-
otp:
|
|
83
|
-
resendCountdown:
|
|
84
|
-
successMessage:
|
|
70
|
+
onResendOTP: j,
|
|
71
|
+
onSubmit: k,
|
|
72
|
+
otp: e.otp,
|
|
73
|
+
resendCountdown: R,
|
|
74
|
+
successMessage: e.isSuccess ? "Success!" : void 0
|
|
85
75
|
}
|
|
86
|
-
)), /* @__PURE__ */ s("div", { ...
|
|
76
|
+
)), /* @__PURE__ */ s("div", { ...b, children: a ? a({ step: p, Form: r }) : r });
|
|
87
77
|
}
|
|
88
78
|
}
|
|
89
79
|
);
|
|
90
|
-
},
|
|
80
|
+
}, K = ({ step: o }) => /* @__PURE__ */ u(c, { children: [
|
|
91
81
|
o === "credentials" && "Sign in",
|
|
92
82
|
o === "verification" && "Enter verification code"
|
|
93
|
-
] }),
|
|
94
|
-
const { state: i } =
|
|
95
|
-
() =>
|
|
83
|
+
] }), ee = ({ step: o }) => {
|
|
84
|
+
const { state: i } = g(), m = A(
|
|
85
|
+
() => U(i.phoneNumber),
|
|
96
86
|
[i.phoneNumber]
|
|
97
87
|
);
|
|
98
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ u(c, { children: [
|
|
99
89
|
o === "credentials" && "We’ll send you a verification code via text.",
|
|
100
|
-
o === "verification" && /* @__PURE__ */
|
|
90
|
+
o === "verification" && /* @__PURE__ */ u(c, { children: [
|
|
101
91
|
"Enter the 6 digit code sent to",
|
|
102
92
|
" ",
|
|
103
|
-
m ? /* @__PURE__ */ s(
|
|
93
|
+
m ? /* @__PURE__ */ s(Z, { children: m }) : "your phone number"
|
|
104
94
|
] })
|
|
105
95
|
] });
|
|
106
|
-
},
|
|
107
|
-
description:
|
|
108
|
-
forms:
|
|
109
|
-
title:
|
|
96
|
+
}, fe = {
|
|
97
|
+
description: ee,
|
|
98
|
+
forms: $,
|
|
99
|
+
title: K
|
|
110
100
|
};
|
|
111
101
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
$ as SignInWithSms,
|
|
103
|
+
ee as SignInWithSmsDescription,
|
|
104
|
+
K as SignInWithSmsTitle,
|
|
105
|
+
fe as config
|
|
116
106
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n, jsxs as r, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import { u } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u as d } from "../../chunks/CDPReactProvider.
|
|
4
|
+
import { u as d } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
5
5
|
import { SignInAuthMethodButtons as f } from "./SignInAuthMethodButtons.js";
|
|
6
6
|
import { SignInBackButton as I } from "./SignInBackButton.js";
|
|
7
7
|
import { SignInDescription as S } from "./SignInDescription.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useReducer as
|
|
1
|
+
import { useReducer as l } from "react";
|
|
2
2
|
import "@coinbase/cdp-hooks";
|
|
3
|
-
import "../../chunks/CDPReactProvider.
|
|
4
|
-
function
|
|
3
|
+
import "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
4
|
+
function u(e, r) {
|
|
5
5
|
switch (r.type) {
|
|
6
6
|
case "SET_AUTH_METHODS":
|
|
7
7
|
return {
|
|
@@ -13,8 +13,8 @@ function l(e, r) {
|
|
|
13
13
|
...e,
|
|
14
14
|
authMethod: r.payload.authMethod,
|
|
15
15
|
step: "credentials",
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
phoneNumber: r.payload.authMethod === "sms" ? "" : e.phoneNumber,
|
|
17
|
+
email: r.payload.authMethod === "email" ? "" : e.email,
|
|
18
18
|
error: null
|
|
19
19
|
};
|
|
20
20
|
case "SET_EMAIL":
|
|
@@ -74,6 +74,20 @@ function l(e, r) {
|
|
|
74
74
|
return { ...e, error: null, canResetOTP: !1 };
|
|
75
75
|
case "CLEAR_ERROR":
|
|
76
76
|
return { ...e, error: null };
|
|
77
|
+
case "GO_TO_PREVIOUS_STEP":
|
|
78
|
+
return {
|
|
79
|
+
authMethod: e.authMethod,
|
|
80
|
+
authMethods: e.authMethods,
|
|
81
|
+
canResetOTP: !1,
|
|
82
|
+
error: null,
|
|
83
|
+
isPending: !1,
|
|
84
|
+
isSuccess: !1,
|
|
85
|
+
email: e.email,
|
|
86
|
+
flowId: "",
|
|
87
|
+
otp: "",
|
|
88
|
+
phoneNumber: e.phoneNumber,
|
|
89
|
+
step: "credentials"
|
|
90
|
+
};
|
|
77
91
|
case "RESET_STATE":
|
|
78
92
|
return {
|
|
79
93
|
authMethod: e.authMethod,
|
|
@@ -92,7 +106,7 @@ function l(e, r) {
|
|
|
92
106
|
throw new Error("Unknown action type");
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
|
-
const s = (e) => u
|
|
109
|
+
const s = (e) => l(u, e);
|
|
96
110
|
export {
|
|
97
111
|
s as useSignInReducer
|
|
98
112
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as n, jsxs as t, Fragment as c } from "react/jsx-runtime";
|
|
|
2
2
|
import { u as C } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
3
3
|
import { createContext as b, useMemo as x, useContext as v } from "react";
|
|
4
4
|
import { c as N } from "../../chunks/lite.1fxw3LjI.js";
|
|
5
|
-
import { u as w } from "../../chunks/CDPReactProvider.
|
|
5
|
+
import { u as w } from "../../chunks/CDPReactProvider.C38bKQ2x.js";
|
|
6
6
|
import { SignIn as T } from "../SignIn/index.js";
|
|
7
7
|
import "@coinbase/cdp-hooks";
|
|
8
8
|
import { Button as h } from "../ui/Button/index.js";
|
|
@@ -3,4 +3,4 @@ import { VerifyMfaMethodComponentProps } from './types';
|
|
|
3
3
|
export interface VerifyMfaDescriptionProps extends VerifyMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
4
4
|
as?: ElementType;
|
|
5
5
|
}
|
|
6
|
-
export declare const VerifyMfaDescription: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const VerifyMfaDescription: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaDescriptionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { m as
|
|
3
|
+
import { m as d } from "../../chunks/index.BX4k-ruQ.js";
|
|
4
4
|
import "@coinbase/cdp-hooks";
|
|
5
|
+
import "@coinbase/cdp-core";
|
|
5
6
|
import { useVerifyMfaContext as a } from "./VerifyMfaProvider.js";
|
|
6
|
-
import '../../assets/VerifyMfaDescription.css';const
|
|
7
|
-
description:
|
|
8
|
-
},
|
|
9
|
-
as:
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
12
|
-
method:
|
|
13
|
-
step:
|
|
14
|
-
...
|
|
7
|
+
import '../../assets/VerifyMfaDescription.css';const u = "VerifyMfaDescription-module__description___mDWgu", y = {
|
|
8
|
+
description: u
|
|
9
|
+
}, g = ({
|
|
10
|
+
as: n = "p",
|
|
11
|
+
children: e,
|
|
12
|
+
className: p = "",
|
|
13
|
+
method: m,
|
|
14
|
+
step: c,
|
|
15
|
+
...f
|
|
15
16
|
}) => {
|
|
16
|
-
const { state: o } = a(),
|
|
17
|
-
|
|
17
|
+
const { state: o } = a(), s = c || o.step, i = m || o.method;
|
|
18
|
+
let t;
|
|
19
|
+
if (e)
|
|
20
|
+
t = e;
|
|
21
|
+
else if (s === "list")
|
|
22
|
+
t = null;
|
|
23
|
+
else {
|
|
24
|
+
const l = d[i].description;
|
|
25
|
+
t = /* @__PURE__ */ r(l, { step: s, method: i });
|
|
26
|
+
}
|
|
27
|
+
return t ? /* @__PURE__ */ r(n, { className: `${y.description} ${p}`, ...f, children: t }) : null;
|
|
18
28
|
};
|
|
19
29
|
export {
|
|
20
|
-
|
|
30
|
+
g as VerifyMfaDescription
|
|
21
31
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { MfaMethod,
|
|
2
|
+
import { MfaMethod, VerifyMfaStep } from './types';
|
|
3
3
|
export interface VerifyMfaFlowProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4
4
|
autoFocus?: boolean;
|
|
5
|
+
animateHeight?: boolean;
|
|
5
6
|
children?: (props: {
|
|
6
|
-
step:
|
|
7
|
+
step: VerifyMfaStep;
|
|
7
8
|
method: MfaMethod;
|
|
8
|
-
|
|
9
|
+
Content: ReactNode;
|
|
9
10
|
}) => ReactNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const VerifyMfaFlow: ({ autoFocus, children, className, ...props }: VerifyMfaFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const VerifyMfaFlow: ({ autoFocus, animateHeight, children, className, ...props }: VerifyMfaFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Button as S } from "../ui/Button/index.js";
|
|
4
|
+
import { SwitchSlideTransition as v } from "../ui/SwitchSlideTransition/index.js";
|
|
5
|
+
import { m as F } from "../../chunks/index.BX4k-ruQ.js";
|
|
4
6
|
import "@coinbase/cdp-hooks";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import "@coinbase/cdp-core";
|
|
8
|
+
import { STEPS as $ } from "./useVerifyMfaReducer.js";
|
|
9
|
+
import { useVerifyMfaFlowInternal as g } from "./VerifyMfaFlowProvider.js";
|
|
10
|
+
import { VerifyMfaItems as x } from "./VerifyMfaItems.js";
|
|
11
|
+
import { useVerifyMfaContext as C } from "./VerifyMfaProvider.js";
|
|
12
|
+
import '../../assets/VerifyMfaFlow.css';const z = "VerifyMfaFlow-module__wrapper___lzVPg", E = "VerifyMfaFlow-module__list___-N0zn", o = {
|
|
13
|
+
wrapper: z,
|
|
14
|
+
"pad-top": "VerifyMfaFlow-module__pad-top___gF1z2",
|
|
15
|
+
list: E
|
|
16
|
+
}, b = ({
|
|
17
|
+
autoFocus: n = !0,
|
|
18
|
+
animateHeight: m = !0,
|
|
19
|
+
children: s,
|
|
20
|
+
className: l = "",
|
|
21
|
+
...a
|
|
13
22
|
}) => {
|
|
14
|
-
const { state:
|
|
15
|
-
return /* @__PURE__ */
|
|
23
|
+
const { state: p, onSuccess: d, onError: c } = C(), { direction: h, selectMethod: _, showMethodList: u, transitionRef: w } = g(), { method: i, methods: f } = p;
|
|
24
|
+
return /* @__PURE__ */ t(
|
|
25
|
+
v,
|
|
26
|
+
{
|
|
27
|
+
autoFocus: n,
|
|
28
|
+
animateHeight: m,
|
|
29
|
+
items: $,
|
|
30
|
+
initialEntered: !0,
|
|
31
|
+
timeout: 250,
|
|
32
|
+
direction: h,
|
|
33
|
+
transitionRef: w,
|
|
34
|
+
children: ({ itemKey: r, ...M }) => {
|
|
35
|
+
let e = null;
|
|
36
|
+
if (r === "verification") {
|
|
37
|
+
const V = F[i].content;
|
|
38
|
+
e = /* @__PURE__ */ y("div", { className: `${o.wrapper} ${o["pad-top"]} ${l}`, ...a, children: [
|
|
39
|
+
/* @__PURE__ */ t(
|
|
40
|
+
V,
|
|
41
|
+
{
|
|
42
|
+
autoFocus: n,
|
|
43
|
+
step: r,
|
|
44
|
+
onSuccess: d,
|
|
45
|
+
onError: c
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
f.length > 1 && i === f[0] && /* @__PURE__ */ t(S, { variant: "transparentPrimary", fullWidth: !0, onClick: u, children: "Use a different method" })
|
|
49
|
+
] });
|
|
50
|
+
} else r === "list" && (e = /* @__PURE__ */ t("div", { className: `${o.wrapper} ${l}`, ...a, children: /* @__PURE__ */ t(x, { className: o.list, onSelect: _ }) }));
|
|
51
|
+
return /* @__PURE__ */ t("div", { ...M, children: s ? s({ step: r, method: i, Content: e }) : e });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
16
55
|
};
|
|
17
56
|
export {
|
|
18
|
-
|
|
57
|
+
b as VerifyMfaFlow
|
|
19
58
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonProps } from '../ui/Button/Button';
|
|
3
|
+
import { VerifyMfaStep } from './types';
|
|
4
|
+
export interface VerifyMfaFlowBackButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
step?: VerifyMfaStep;
|
|
6
|
+
size?: ButtonProps["size"];
|
|
7
|
+
variant?: ButtonProps["variant"];
|
|
8
|
+
}
|
|
9
|
+
export declare const VerifyMfaFlowBackButton: ({ ["aria-label"]: ariaLabel, children, className, size, onClick, variant, step: stepFromProps, ...props }: VerifyMfaFlowBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { Button as u } from "../ui/Button/index.js";
|
|
5
|
+
import { IconArrowLeft as _ } from "../../icons/IconArrowLeft.js";
|
|
6
|
+
import "@coinbase/cdp-hooks";
|
|
7
|
+
import "@coinbase/cdp-core";
|
|
8
|
+
import { useVerifyMfaFlowInternal as b } from "./VerifyMfaFlowProvider.js";
|
|
9
|
+
import { useVerifyMfaContext as y } from "./VerifyMfaProvider.js";
|
|
10
|
+
import '../../assets/VerifyMfaFlowBackButton.css';const B = "VerifyMfaFlowBackButton-module__button___cAv9W", d = "VerifyMfaFlowBackButton-module__icon___ezNaM", r = {
|
|
11
|
+
button: B,
|
|
12
|
+
icon: d
|
|
13
|
+
}, C = ({
|
|
14
|
+
["aria-label"]: e = "Back",
|
|
15
|
+
children: n,
|
|
16
|
+
className: a = "",
|
|
17
|
+
size: c = "md",
|
|
18
|
+
onClick: i,
|
|
19
|
+
variant: s = "transparentSecondary",
|
|
20
|
+
step: m,
|
|
21
|
+
...f
|
|
22
|
+
}) => {
|
|
23
|
+
const { back: l } = b(), { state: t } = y();
|
|
24
|
+
return (m || t.step) === "verification" && t.method === t.methods[0] ? null : /* @__PURE__ */ o(
|
|
25
|
+
u,
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
"aria-label": e,
|
|
29
|
+
className: p(r.button, a),
|
|
30
|
+
onClick: i ?? l,
|
|
31
|
+
size: c,
|
|
32
|
+
variant: s,
|
|
33
|
+
...f,
|
|
34
|
+
children: n || /* @__PURE__ */ o(_, { className: r.icon })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
C as VerifyMfaFlowBackButton
|
|
40
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
|
|
3
|
+
import { MfaMethod, VerifyMfaStep } from './types';
|
|
4
|
+
export interface VerifyMfaFlowContextValue {
|
|
5
|
+
back: () => void;
|
|
6
|
+
direction: "left" | "right";
|
|
7
|
+
selectMethod: (method: MfaMethod) => void;
|
|
8
|
+
showMethodList: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface VerifyMfaFlowContextValueInternal extends VerifyMfaFlowContextValue {
|
|
11
|
+
transitionRef: RefObject<SwitchSlideTransitionRef<VerifyMfaStep> | null> | null;
|
|
12
|
+
}
|
|
13
|
+
export interface VerifyMfaFlowProviderProps {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
direction: VerifyMfaFlowContextValue["direction"];
|
|
16
|
+
onBack: VerifyMfaFlowContextValue["back"];
|
|
17
|
+
onSelectMethod: VerifyMfaFlowContextValue["selectMethod"];
|
|
18
|
+
onShowMethodList: VerifyMfaFlowContextValue["showMethodList"];
|
|
19
|
+
transitionRef: VerifyMfaFlowContextValueInternal["transitionRef"];
|
|
20
|
+
}
|
|
21
|
+
export declare const useVerifyMfaFlowInternal: () => VerifyMfaFlowContextValueInternal;
|
|
22
|
+
export declare const useVerifyMfaFlow: () => VerifyMfaFlowContextValue;
|
|
23
|
+
export declare const VerifyMfaFlowProvider: ({ children, direction, onBack, onSelectMethod, onShowMethodList, transitionRef, }: VerifyMfaFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useContext as l, useMemo as c } from "react";
|
|
3
|
+
import "@coinbase/cdp-hooks";
|
|
4
|
+
import "@coinbase/cdp-core";
|
|
5
|
+
const f = u(null), w = () => {
|
|
6
|
+
const e = l(f);
|
|
7
|
+
if (!e)
|
|
8
|
+
throw new Error("useVerifyMfaFlowInternal must be used within a VerifyMfaFlowProvider");
|
|
9
|
+
return e;
|
|
10
|
+
}, y = () => {
|
|
11
|
+
const { transitionRef: e, ...r } = w();
|
|
12
|
+
return r;
|
|
13
|
+
}, F = ({
|
|
14
|
+
children: e,
|
|
15
|
+
direction: r,
|
|
16
|
+
onBack: t,
|
|
17
|
+
onSelectMethod: o,
|
|
18
|
+
onShowMethodList: n,
|
|
19
|
+
transitionRef: s
|
|
20
|
+
}) => {
|
|
21
|
+
const i = c(
|
|
22
|
+
() => ({
|
|
23
|
+
back: t,
|
|
24
|
+
direction: r,
|
|
25
|
+
selectMethod: o,
|
|
26
|
+
showMethodList: n,
|
|
27
|
+
transitionRef: s
|
|
28
|
+
}),
|
|
29
|
+
[t, r, o, n, s]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ a(f.Provider, { value: i, children: e });
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
F as VerifyMfaFlowProvider,
|
|
35
|
+
y as useVerifyMfaFlow,
|
|
36
|
+
w as useVerifyMfaFlowInternal
|
|
37
|
+
};
|
|
@@ -3,4 +3,4 @@ import { VerifyMfaMethodComponentProps } from './types';
|
|
|
3
3
|
export interface VerifyMfaImageProps extends VerifyMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
4
4
|
as?: ElementType;
|
|
5
5
|
}
|
|
6
|
-
export declare const VerifyMfaImage: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const VerifyMfaImage: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: VerifyMfaImageProps) => import("react/jsx-runtime").JSX.Element | null;
|