@coinbase/cdp-react 0.0.78 → 0.0.80
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/README.md +5 -0
- package/dist/assets/Badge.css +1 -0
- package/dist/assets/Banner.css +1 -1
- package/dist/assets/CDPReactProvider.css +1 -0
- package/dist/assets/CoinbaseFooter.css +1 -1
- package/dist/assets/CopyTextField.css +1 -0
- package/dist/assets/EnrollMfa.css +1 -0
- package/dist/assets/EnrollMfaDescription.css +1 -0
- package/dist/assets/EnrollMfaFlow.css +1 -0
- package/dist/assets/EnrollMfaFlowBackButton.css +1 -0
- package/dist/assets/EnrollMfaItems.css +1 -0
- package/dist/assets/EnrollMfaModal.css +1 -0
- package/dist/assets/EnrollMfaTitle.css +1 -0
- package/dist/assets/ExportWallet.css +1 -1
- package/dist/assets/OTPForm.css +1 -1
- package/dist/assets/QRCode.css +1 -0
- package/dist/assets/ToggleListItem.css +1 -0
- package/dist/assets/VerifyMfaDescription.css +1 -0
- package/dist/assets/VerifyMfaFlow.css +1 -0
- package/dist/assets/VerifyMfaImage.css +1 -0
- package/dist/assets/VerifyMfaInline.css +1 -0
- package/dist/assets/VerifyMfaTitle.css +1 -0
- package/dist/assets/totp.css +1 -0
- package/dist/chunks/CDPReactProvider.CIQm4C4z.js +299 -0
- package/dist/chunks/{LinkAuthFlow.3HN888DV.js → LinkAuthFlow.BaUSMzGH.js} +1 -1
- package/dist/chunks/index.CKQKBoX2.js +9 -0
- package/dist/chunks/{index.Bvudzh_y.js → index.C_DV0Ud7.js} +1 -1
- package/dist/chunks/index.Dp-lIxM1.js +9 -0
- package/dist/components/CDPReactProvider/index.d.ts +4 -1
- package/dist/components/CDPReactProvider/index.js +11 -79
- package/dist/components/CopyAddress/index.js +24 -60
- package/dist/components/EnrollMfa/EnrollMfaDescription.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaDescription.js +21 -0
- package/dist/components/EnrollMfa/EnrollMfaFlow.d.ts +12 -0
- package/dist/components/EnrollMfa/EnrollMfaFlow.js +46 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.d.ts +9 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.js +39 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +21 -0
- package/dist/components/EnrollMfa/EnrollMfaFlowProvider.js +34 -0
- package/dist/components/EnrollMfa/EnrollMfaFooter.d.ts +2 -0
- package/dist/components/EnrollMfa/EnrollMfaFooter.js +7 -0
- package/dist/components/EnrollMfa/EnrollMfaImage.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaImage.js +19 -0
- package/dist/components/EnrollMfa/EnrollMfaItem.d.ts +11 -0
- package/dist/components/EnrollMfa/EnrollMfaItem.js +21 -0
- package/dist/components/EnrollMfa/EnrollMfaItems.d.ts +9 -0
- package/dist/components/EnrollMfa/EnrollMfaItems.js +39 -0
- package/dist/components/EnrollMfa/EnrollMfaProvider.d.ts +14 -0
- package/dist/components/EnrollMfa/EnrollMfaProvider.js +24 -0
- package/dist/components/EnrollMfa/EnrollMfaTitle.d.ts +6 -0
- package/dist/components/EnrollMfa/EnrollMfaTitle.js +21 -0
- package/dist/components/EnrollMfa/index.d.ts +20 -0
- package/dist/components/EnrollMfa/index.js +171 -0
- package/dist/components/EnrollMfa/methods/totp.d.ts +6 -0
- package/dist/components/EnrollMfa/methods/totp.js +120 -0
- package/dist/components/EnrollMfa/types.d.ts +83 -0
- package/dist/components/EnrollMfa/types.js +2 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.d.ts +3 -0
- package/dist/components/EnrollMfa/useEnrollMfaReducer.js +111 -0
- package/dist/components/EnrollMfaModal/index.d.ts +20 -0
- package/dist/components/EnrollMfaModal/index.js +144 -0
- package/dist/components/ExportWallet/index.d.ts +2 -1
- package/dist/components/ExportWallet/index.js +225 -165
- package/dist/components/ExportWalletModal/index.d.ts +7 -4
- package/dist/components/ExportWalletModal/index.js +9 -7
- package/dist/components/Fund/index.js +5 -5
- package/dist/components/FundModal/index.js +14 -14
- 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 +26 -45
- 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 +1 -1
- package/dist/components/SignIn/SignInDescription.js +2 -2
- package/dist/components/SignIn/SignInForm.js +2 -2
- package/dist/components/SignIn/SignInImage.js +5 -5
- 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 +1 -1
- package/dist/components/SignIn/index.js +4 -4
- package/dist/components/SignIn/types.js +1 -1
- package/dist/components/SignIn/useSignInReducer.js +1 -1
- package/dist/components/SignInModal/index.js +13 -13
- package/dist/components/ThemeProvider/index.d.ts +4 -6
- package/dist/components/ThemeProvider/index.js +32 -21
- package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaDescription.js +21 -0
- package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +11 -0
- package/dist/components/VerifyMfa/VerifyMfaFlow.js +19 -0
- package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +2 -0
- package/dist/components/VerifyMfa/VerifyMfaFooter.js +7 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaImage.js +21 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +15 -0
- package/dist/components/VerifyMfa/VerifyMfaProvider.js +28 -0
- package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +6 -0
- package/dist/components/VerifyMfa/VerifyMfaTitle.js +21 -0
- package/dist/components/VerifyMfa/index.d.ts +16 -0
- package/dist/components/VerifyMfa/index.js +20 -0
- package/dist/components/VerifyMfa/methods/totp.d.ts +6 -0
- package/dist/components/VerifyMfa/methods/totp.js +69 -0
- package/dist/components/VerifyMfa/types.d.ts +60 -0
- package/dist/components/VerifyMfa/types.js +2 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +2 -0
- package/dist/components/VerifyMfa/useVerifyMfaReducer.js +61 -0
- package/dist/components/VerifyMfaInline/index.d.ts +40 -0
- package/dist/components/VerifyMfaInline/index.js +175 -0
- package/dist/components/VerifyMfaModal/index.d.ts +23 -0
- package/dist/components/VerifyMfaModal/index.js +19 -0
- package/dist/components/forms/AmountInput/index.d.ts +1 -1
- package/dist/components/forms/ExchangeAmountInput/index.d.ts +1 -1
- package/dist/components/forms/OTPForm/index.d.ts +2 -2
- package/dist/components/forms/OTPForm/index.js +81 -64
- package/dist/components/ui/Badge/index.d.ts +7 -0
- package/dist/components/ui/Badge/index.js +9 -0
- package/dist/components/ui/CopyTextField/index.d.ts +10 -0
- package/dist/components/ui/CopyTextField/index.js +81 -0
- package/dist/components/ui/Modal/index.js +4 -4
- package/dist/components/ui/QRCode/QRCodeSvg.d.ts +17 -0
- package/dist/components/ui/QRCode/QRCodeSvg.js +57 -0
- package/dist/components/ui/QRCode/index.d.ts +5 -0
- package/dist/components/ui/QRCode/index.js +31 -0
- package/dist/components/ui/QRCode/useCorners.d.ts +1 -0
- package/dist/components/ui/QRCode/useCorners.js +72 -0
- package/dist/components/ui/QRCode/useDotsPath.d.ts +11 -0
- package/dist/components/ui/QRCode/useDotsPath.js +66 -0
- package/dist/components/ui/QRCode/useLogo.d.ts +12 -0
- package/dist/components/ui/QRCode/useLogo.js +52 -0
- package/dist/components/ui/QRCode/useMatrix.d.ts +1 -0
- package/dist/components/ui/QRCode/useMatrix.js +17 -0
- package/dist/components/ui/ToggleListItem/index.d.ts +15 -0
- package/dist/components/ui/ToggleListItem/index.js +52 -0
- package/dist/hooks/useKeyExportPostMessage.js +67 -55
- package/dist/hooks/useVerifyMfaModal.d.ts +22 -0
- package/dist/hooks/useVerifyMfaModal.js +10 -0
- package/dist/icons/IconCoinbaseWordmark.js +10 -13
- package/dist/icons/IconPinCode.d.ts +2 -0
- package/dist/icons/IconPinCode.js +13 -0
- package/dist/icons/IconShield.d.ts +2 -0
- package/dist/icons/IconShield.js +7 -0
- package/dist/icons/IconSmartPhone.d.ts +2 -0
- package/dist/icons/IconSmartPhone.js +7 -0
- package/dist/icons/index.d.ts +5 -2
- package/dist/icons/index.js +22 -16
- package/dist/index.d.ts +6 -0
- package/dist/index.js +220 -165
- package/dist/theme/theme.d.ts +104 -0
- package/dist/theme/tokens.d.ts +312 -0
- package/dist/theme/tokens.js +70 -0
- package/dist/utils/transition.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -7
- package/dist/assets/CopyAddress.css +0 -1
- package/dist/assets/LinkAuthItem.css +0 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { jsx as o, jsxs as a, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useIsInitialized as O, useCurrentUser as B, useInitiateMfaEnrollment as P, useSubmitMfaEnrollment as b, useRecordMfaEnrollmentPrompted as D } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { u as $ } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
4
|
+
import { useMemo as k, useRef as p, useEffect as L, useCallback as E, useLayoutEffect as V } from "react";
|
|
5
|
+
import { c as j } from "../../chunks/lite.1fxw3LjI.js";
|
|
6
|
+
import { u as z } from "../../chunks/CDPReactProvider.CIQm4C4z.js";
|
|
7
|
+
import { isApiError as J } from "../../utils/isApiError.js";
|
|
8
|
+
import "libphonenumber-js";
|
|
9
|
+
import { EnrollMfaDescription as R } from "./EnrollMfaDescription.js";
|
|
10
|
+
import { EnrollMfaFlow as K } from "./EnrollMfaFlow.js";
|
|
11
|
+
import { EnrollMfaFlowBackButton as q } from "./EnrollMfaFlowBackButton.js";
|
|
12
|
+
import { EnrollMfaFlowProvider as G } from "./EnrollMfaFlowProvider.js";
|
|
13
|
+
import { useEnrollMfaFlow as ge } from "./EnrollMfaFlowProvider.js";
|
|
14
|
+
import { EnrollMfaFooter as X } from "./EnrollMfaFooter.js";
|
|
15
|
+
import { EnrollMfaImage as Y } from "./EnrollMfaImage.js";
|
|
16
|
+
import { EnrollMfaItem as Re } from "./EnrollMfaItem.js";
|
|
17
|
+
import { EnrollMfaItems as Ce } from "./EnrollMfaItems.js";
|
|
18
|
+
import { EnrollMfaProvider as Z, useEnrollMfaContext as C } from "./EnrollMfaProvider.js";
|
|
19
|
+
import { EnrollMfaTitle as x } from "./EnrollMfaTitle.js";
|
|
20
|
+
import { Banner as H } from "../ui/Banner/index.js";
|
|
21
|
+
import '../../assets/EnrollMfa.css';const Q = "EnrollMfa-module__img___JmjV1", W = "EnrollMfa-module__centered___YxB8I", ee = "EnrollMfa-module__footer___Zro3u", l = {
|
|
22
|
+
"mfa-enrollment": "EnrollMfa-module__mfa-enrollment___80xnL",
|
|
23
|
+
img: Q,
|
|
24
|
+
"flex-container": "EnrollMfa-module__flex-container___9Dazs",
|
|
25
|
+
"gap-2": "EnrollMfa-module__gap-2___BKEqR",
|
|
26
|
+
"gap-3": "EnrollMfa-module__gap-3___JKVyF",
|
|
27
|
+
centered: W,
|
|
28
|
+
footer: ee
|
|
29
|
+
}, te = 5 * 60 * 1e3, re = ({ role: c = "alert", ...i }) => {
|
|
30
|
+
const { state: s } = C(), { error: m } = s;
|
|
31
|
+
return m ? /* @__PURE__ */ o(H, { variant: "error", role: c, ...i, children: J(m) ? m.message : m }) : null;
|
|
32
|
+
}, oe = ({
|
|
33
|
+
className: c = "",
|
|
34
|
+
children: i,
|
|
35
|
+
resetOnSuccess: s = !0,
|
|
36
|
+
...m
|
|
37
|
+
}) => {
|
|
38
|
+
const { isInitialized: f } = O(), { currentUser: u } = B(), { state: e, dispatch: n, onEnrollSuccess: _ } = C(), { initiateMfaEnrollment: M } = P(), { submitMfaEnrollment: h } = b(), { recordMfaEnrollmentPrompted: I } = D(), { showCoinbaseFooter: U } = z(), N = p(!1);
|
|
39
|
+
L(() => {
|
|
40
|
+
!f || !u || N.current || (I(), N.current = !0);
|
|
41
|
+
}, [I, f, u]), L(() => {
|
|
42
|
+
if (!e.initiatedAt) return;
|
|
43
|
+
const t = () => {
|
|
44
|
+
e.initiatedAt && Date.now() - e.initiatedAt >= te && n({ type: "ENROLLMENT_SESSION_EXPIRED" });
|
|
45
|
+
};
|
|
46
|
+
t();
|
|
47
|
+
const r = setInterval(t, 1e3);
|
|
48
|
+
return () => clearInterval(r);
|
|
49
|
+
}, [e.initiatedAt, n]);
|
|
50
|
+
const S = p(e.step), T = p(null), y = E((t) => {
|
|
51
|
+
S.current !== t && (S.current = t, T.current?.transition.toggle(t));
|
|
52
|
+
}, []), v = E(() => {
|
|
53
|
+
n({ type: "GO_TO_PREVIOUS_STEP" });
|
|
54
|
+
}, [n]), F = E(
|
|
55
|
+
async (t) => {
|
|
56
|
+
if (f) {
|
|
57
|
+
n({ type: "INITIATE_ENROLLMENT", payload: { method: t } });
|
|
58
|
+
try {
|
|
59
|
+
const r = await M({ mfaMethod: t });
|
|
60
|
+
if ("authUrl" in r && "secret" in r)
|
|
61
|
+
n({
|
|
62
|
+
type: "INITIATE_ENROLLMENT_SUCCESS",
|
|
63
|
+
payload: { authUrl: r.authUrl, secret: r.secret }
|
|
64
|
+
});
|
|
65
|
+
else
|
|
66
|
+
throw new Error("Failed to initiate enrollment");
|
|
67
|
+
} catch (r) {
|
|
68
|
+
n({
|
|
69
|
+
type: "INITIATE_ENROLLMENT_FAILURE",
|
|
70
|
+
payload: {
|
|
71
|
+
error: r instanceof Error ? r.message : "Failed to initiate enrollment"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
[n, M, f]
|
|
78
|
+
), w = E(
|
|
79
|
+
async (t) => {
|
|
80
|
+
t.preventDefault(), n({ type: "SUBMIT_ENROLLMENT" });
|
|
81
|
+
try {
|
|
82
|
+
await h({
|
|
83
|
+
mfaMethod: e.method,
|
|
84
|
+
mfaCode: e.mfaCode
|
|
85
|
+
}), n({ type: "SUBMIT_ENROLLMENT_SUCCESS" }), _?.(), s && setTimeout(() => {
|
|
86
|
+
n({ type: "SET_STEP", payload: { step: "list", flowDirection: "left" } });
|
|
87
|
+
}, 800);
|
|
88
|
+
} catch (r) {
|
|
89
|
+
n({
|
|
90
|
+
type: "SUBMIT_ENROLLMENT_FAILURE",
|
|
91
|
+
payload: {
|
|
92
|
+
error: r instanceof Error ? r.message : "Verification failed"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
[n, e.method, e.mfaCode, h, _, s]
|
|
98
|
+
);
|
|
99
|
+
V(() => {
|
|
100
|
+
y(e.step);
|
|
101
|
+
}, [e.step, y]);
|
|
102
|
+
const g = typeof i == "function" ? i(e) : i;
|
|
103
|
+
return /* @__PURE__ */ o(
|
|
104
|
+
G,
|
|
105
|
+
{
|
|
106
|
+
onBack: v,
|
|
107
|
+
onStartEnrollment: F,
|
|
108
|
+
onSubmit: w,
|
|
109
|
+
transitionRef: T,
|
|
110
|
+
children: /* @__PURE__ */ a("div", { className: `${l["mfa-enrollment"]} ${c}`, ...m, children: [
|
|
111
|
+
g,
|
|
112
|
+
!g && /* @__PURE__ */ a(d, { children: [
|
|
113
|
+
/* @__PURE__ */ a(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: j(
|
|
117
|
+
l["flex-container"],
|
|
118
|
+
e.step === "list" ? l["gap-3"] : ""
|
|
119
|
+
),
|
|
120
|
+
children: [
|
|
121
|
+
e.step === "list" ? /* @__PURE__ */ a(d, { children: [
|
|
122
|
+
/* @__PURE__ */ a("div", { children: [
|
|
123
|
+
/* @__PURE__ */ o(x, { step: "list", method: e.method }),
|
|
124
|
+
/* @__PURE__ */ o(R, { step: "list", method: e.method })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ o(re, {})
|
|
127
|
+
] }) : /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o(q, { step: e.step }) }),
|
|
128
|
+
/* @__PURE__ */ o(K, { children: ({ step: t, method: r, Content: A }) => /* @__PURE__ */ a("div", { className: `${l["flex-container"]} ${l["gap-2"]}`, children: [
|
|
129
|
+
t !== "list" && /* @__PURE__ */ a(d, { children: [
|
|
130
|
+
/* @__PURE__ */ o(
|
|
131
|
+
Y,
|
|
132
|
+
{
|
|
133
|
+
className: `${l.img} ${l.centered}`,
|
|
134
|
+
step: t,
|
|
135
|
+
method: r
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ a("div", { className: l.centered, children: [
|
|
139
|
+
/* @__PURE__ */ o(x, { step: t, method: r }),
|
|
140
|
+
/* @__PURE__ */ o(R, { step: t, method: r })
|
|
141
|
+
] })
|
|
142
|
+
] }),
|
|
143
|
+
A
|
|
144
|
+
] }) })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
U && /* @__PURE__ */ o(X, { className: l.footer })
|
|
149
|
+
] })
|
|
150
|
+
] })
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}, Se = ({ onEnrollSuccess: c, ...i }) => {
|
|
154
|
+
$("enroll_mfa");
|
|
155
|
+
const s = k(() => ["totp"], []);
|
|
156
|
+
return /* @__PURE__ */ o(Z, { methods: s, onEnrollSuccess: c, children: /* @__PURE__ */ o(oe, { ...i }) });
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
Se as EnrollMfa,
|
|
160
|
+
R as EnrollMfaDescription,
|
|
161
|
+
re as EnrollMfaError,
|
|
162
|
+
K as EnrollMfaFlow,
|
|
163
|
+
q as EnrollMfaFlowBackButton,
|
|
164
|
+
X as EnrollMfaFooter,
|
|
165
|
+
Y as EnrollMfaImage,
|
|
166
|
+
Re as EnrollMfaItem,
|
|
167
|
+
Ce as EnrollMfaItems,
|
|
168
|
+
x as EnrollMfaTitle,
|
|
169
|
+
C as useEnrollMfaContext,
|
|
170
|
+
ge as useEnrollMfaFlow
|
|
171
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EnrollMfaMethodConfig, EnrollMfaMethodContentProps, EnrollMfaMethodComponentProps } from '../types';
|
|
2
|
+
export declare const TotpContent: ({ autoFocus, step, onSubmit, children, }: EnrollMfaMethodContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const TotpTitle: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const TotpDescription: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export declare const TotpImage: ({ step }: EnrollMfaMethodComponentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare const totpMethodConfig: EnrollMfaMethodConfig;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as i } from "react/jsx-runtime";
|
|
2
|
+
import { c as u } from "../../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import { useCallback as a } from "react";
|
|
4
|
+
import { OTPForm as E } from "../../forms/OTPForm/index.js";
|
|
5
|
+
import { Badge as C } from "../../ui/Badge/index.js";
|
|
6
|
+
import { Button as m } from "../../ui/Button/index.js";
|
|
7
|
+
import { CopyTextField as T } from "../../ui/CopyTextField/index.js";
|
|
8
|
+
import { Error as f } from "../../ui/Error/index.js";
|
|
9
|
+
import { QRCode as v } from "../../ui/QRCode/index.js";
|
|
10
|
+
import { IconSmartPhone as k } from "../../../icons/IconSmartPhone.js";
|
|
11
|
+
import { useEnrollMfaFlow as S } from "../EnrollMfaFlowProvider.js";
|
|
12
|
+
import { useEnrollMfaContext as w } from "../EnrollMfaProvider.js";
|
|
13
|
+
import "@coinbase/cdp-hooks";
|
|
14
|
+
import '../../../assets/totp.css';const P = "totp-module__expired___SKiyj", F = "totp-module__container___1aL5H", o = {
|
|
15
|
+
"qr-code": "totp-module__qr-code___qyK1k",
|
|
16
|
+
expired: P,
|
|
17
|
+
container: F,
|
|
18
|
+
"copy-key": "totp-module__copy-key___iwzZf",
|
|
19
|
+
"otp-form": "totp-module__otp-form___OzooV"
|
|
20
|
+
}, M = ({
|
|
21
|
+
autoFocus: r = !0,
|
|
22
|
+
step: c,
|
|
23
|
+
onSubmit: h,
|
|
24
|
+
children: p
|
|
25
|
+
}) => {
|
|
26
|
+
const { state: e, dispatch: n } = w(), { startEnrollment: d } = S(), _ = a(() => {
|
|
27
|
+
d(e.method);
|
|
28
|
+
}, [d, e.method]), y = a(() => {
|
|
29
|
+
n({ type: "SET_STEP", payload: { step: "setup-verification", flowDirection: "left" } });
|
|
30
|
+
}, [n]), g = a(
|
|
31
|
+
(x) => {
|
|
32
|
+
n({ type: "SET_MFA_CODE", payload: { mfaCode: x } });
|
|
33
|
+
},
|
|
34
|
+
[n]
|
|
35
|
+
);
|
|
36
|
+
let s;
|
|
37
|
+
switch (c) {
|
|
38
|
+
case "setup":
|
|
39
|
+
s = /* @__PURE__ */ l("div", { className: o.container, children: [
|
|
40
|
+
/* @__PURE__ */ t("div", { className: u(o["qr-code"], e.isExpired ? o.expired : ""), children: /* @__PURE__ */ t(v, { value: e.authUrl || "", size: 128, ecl: "L" }) }),
|
|
41
|
+
/* @__PURE__ */ l("div", { className: u(o["copy-key"], e.isExpired ? o.expired : ""), children: [
|
|
42
|
+
/* @__PURE__ */ t(
|
|
43
|
+
T,
|
|
44
|
+
{
|
|
45
|
+
value: e.secret || "",
|
|
46
|
+
"aria-disabled": e.isExpired,
|
|
47
|
+
label: "Setup key"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
e.isExpired && /* @__PURE__ */ t(f, { children: "Verification timed out. For your security, try again." }),
|
|
51
|
+
!e.isExpired && !!e.error && e.step === "setup" && /* @__PURE__ */ t(f, { children: "isApiError(state.error) ? state.error.message : state.error" })
|
|
52
|
+
] }),
|
|
53
|
+
e.isExpired ? /* @__PURE__ */ t(
|
|
54
|
+
m,
|
|
55
|
+
{
|
|
56
|
+
fullWidth: !0,
|
|
57
|
+
isPending: e.isPending,
|
|
58
|
+
pendingLabel: "Restarting enrollment",
|
|
59
|
+
onClick: _,
|
|
60
|
+
children: "Try again"
|
|
61
|
+
}
|
|
62
|
+
) : /* @__PURE__ */ t(m, { fullWidth: !0, onClick: y, children: "Continue" })
|
|
63
|
+
] });
|
|
64
|
+
break;
|
|
65
|
+
case "setup-verification":
|
|
66
|
+
s = /* @__PURE__ */ t(
|
|
67
|
+
E,
|
|
68
|
+
{
|
|
69
|
+
className: o["otp-form"],
|
|
70
|
+
autoFocus: r,
|
|
71
|
+
otp: e.mfaCode,
|
|
72
|
+
error: e.error && e.step === "setup-verification" ? e.error : void 0,
|
|
73
|
+
isPending: e.isPending,
|
|
74
|
+
onOTPChange: g,
|
|
75
|
+
onSubmit: h,
|
|
76
|
+
passwordLength: 6,
|
|
77
|
+
successMessage: e.isSuccess ? "Enrolled!" : void 0
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return p ? /* @__PURE__ */ t(i, { children: p({ step: c, Content: s }) }) : s;
|
|
83
|
+
}, b = ({ step: r }) => {
|
|
84
|
+
switch (r) {
|
|
85
|
+
case "setup":
|
|
86
|
+
return /* @__PURE__ */ t(i, { children: "Set up authenticator" });
|
|
87
|
+
case "setup-verification":
|
|
88
|
+
return /* @__PURE__ */ t(i, { children: "Enter 6-digit code from your authenticator" });
|
|
89
|
+
default:
|
|
90
|
+
return /* @__PURE__ */ t(i, { children: "Set up MFA" });
|
|
91
|
+
}
|
|
92
|
+
}, q = ({ step: r }) => {
|
|
93
|
+
switch (r) {
|
|
94
|
+
case "setup":
|
|
95
|
+
return /* @__PURE__ */ t(i, { children: "Scan the QR code or copy the setup key to create your authenticator code." });
|
|
96
|
+
case "setup-verification":
|
|
97
|
+
return /* @__PURE__ */ t(i, { children: "This links the authenticator app to your account." });
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}, A = ({ step: r }) => {
|
|
102
|
+
switch (r) {
|
|
103
|
+
case "setup-verification":
|
|
104
|
+
return /* @__PURE__ */ t(C, { variant: "secondary", children: /* @__PURE__ */ t(k, {}) });
|
|
105
|
+
default:
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}, H = {
|
|
109
|
+
content: M,
|
|
110
|
+
title: b,
|
|
111
|
+
description: q,
|
|
112
|
+
image: A
|
|
113
|
+
};
|
|
114
|
+
export {
|
|
115
|
+
M as TotpContent,
|
|
116
|
+
q as TotpDescription,
|
|
117
|
+
A as TotpImage,
|
|
118
|
+
b as TotpTitle,
|
|
119
|
+
H as totpMethodConfig
|
|
120
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
|
+
import { FC, FormEvent, ReactNode } from 'react';
|
|
3
|
+
export type MfaMethod = "totp";
|
|
4
|
+
export type EnrollMfaStep = "list" | "setup" | "setup-verification";
|
|
5
|
+
export type EnrollMfaMethodStep = Exclude<EnrollMfaStep, "list">;
|
|
6
|
+
export interface EnrollMfaMethodComponentProps {
|
|
7
|
+
method?: MfaMethod;
|
|
8
|
+
step?: EnrollMfaStep;
|
|
9
|
+
}
|
|
10
|
+
export interface EnrollMfaState {
|
|
11
|
+
method: MfaMethod;
|
|
12
|
+
methods: MfaMethod[];
|
|
13
|
+
step: EnrollMfaStep;
|
|
14
|
+
flowDirection: "left" | "right";
|
|
15
|
+
mfaCode: string;
|
|
16
|
+
authUrl: string | null;
|
|
17
|
+
secret: string | null;
|
|
18
|
+
initiatedAt: number | null;
|
|
19
|
+
isExpired: boolean;
|
|
20
|
+
error: string | APIError | null;
|
|
21
|
+
isPending: boolean;
|
|
22
|
+
isSuccess: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type EnrollMfaAction = {
|
|
25
|
+
type: "SET_STEP";
|
|
26
|
+
payload: {
|
|
27
|
+
step: EnrollMfaStep;
|
|
28
|
+
flowDirection?: "left" | "right";
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
type: "SET_MFA_CODE";
|
|
32
|
+
payload: {
|
|
33
|
+
mfaCode: string;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
type: "INITIATE_ENROLLMENT";
|
|
37
|
+
payload: {
|
|
38
|
+
method: MfaMethod;
|
|
39
|
+
};
|
|
40
|
+
} | {
|
|
41
|
+
type: "INITIATE_ENROLLMENT_SUCCESS";
|
|
42
|
+
payload: {
|
|
43
|
+
authUrl: string;
|
|
44
|
+
secret: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
type: "INITIATE_ENROLLMENT_FAILURE";
|
|
48
|
+
payload: {
|
|
49
|
+
error: string | APIError;
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
type: "ENROLLMENT_SESSION_EXPIRED";
|
|
53
|
+
} | {
|
|
54
|
+
type: "SUBMIT_ENROLLMENT";
|
|
55
|
+
} | {
|
|
56
|
+
type: "SUBMIT_ENROLLMENT_SUCCESS";
|
|
57
|
+
} | {
|
|
58
|
+
type: "SUBMIT_ENROLLMENT_FAILURE";
|
|
59
|
+
payload: {
|
|
60
|
+
error: string | APIError;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
type: "CLEAR_ERROR";
|
|
64
|
+
} | {
|
|
65
|
+
type: "GO_TO_PREVIOUS_STEP";
|
|
66
|
+
} | {
|
|
67
|
+
type: "RESET_STATE";
|
|
68
|
+
};
|
|
69
|
+
export interface EnrollMfaMethodContentProps {
|
|
70
|
+
step: EnrollMfaMethodStep;
|
|
71
|
+
autoFocus?: boolean;
|
|
72
|
+
onSubmit?: (e: FormEvent<HTMLFormElement>) => void;
|
|
73
|
+
children?: (props: {
|
|
74
|
+
step: EnrollMfaMethodStep;
|
|
75
|
+
Content: ReactNode;
|
|
76
|
+
}) => ReactNode;
|
|
77
|
+
}
|
|
78
|
+
export interface EnrollMfaMethodConfig {
|
|
79
|
+
content: FC<EnrollMfaMethodContentProps>;
|
|
80
|
+
description: FC<EnrollMfaMethodComponentProps>;
|
|
81
|
+
image: FC<EnrollMfaMethodComponentProps>;
|
|
82
|
+
title: FC<EnrollMfaMethodComponentProps>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EnrollMfaAction, EnrollMfaState, MfaMethod } from './types';
|
|
2
|
+
export declare const STEPS: readonly ["list", "setup", "setup-verification"];
|
|
3
|
+
export declare const useEnrollMfaReducer: (methods?: MfaMethod[]) => [EnrollMfaState, import('react').ActionDispatch<[action: EnrollMfaAction]>];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useReducer as n } from "react";
|
|
2
|
+
import "@coinbase/cdp-hooks";
|
|
3
|
+
import { isApiError as t } from "../../utils/isApiError.js";
|
|
4
|
+
import "libphonenumber-js";
|
|
5
|
+
const l = ["list", "setup", "setup-verification"], i = (r) => ({
|
|
6
|
+
method: r[0] || "totp",
|
|
7
|
+
methods: r,
|
|
8
|
+
step: "list",
|
|
9
|
+
flowDirection: "left",
|
|
10
|
+
mfaCode: "",
|
|
11
|
+
authUrl: null,
|
|
12
|
+
secret: null,
|
|
13
|
+
initiatedAt: null,
|
|
14
|
+
isExpired: !1,
|
|
15
|
+
error: null,
|
|
16
|
+
isPending: !1,
|
|
17
|
+
isSuccess: !1
|
|
18
|
+
}), u = (r, e) => {
|
|
19
|
+
switch (e.type) {
|
|
20
|
+
case "SET_STEP":
|
|
21
|
+
return {
|
|
22
|
+
...r,
|
|
23
|
+
step: e.payload.step,
|
|
24
|
+
flowDirection: e.payload.flowDirection || r.flowDirection,
|
|
25
|
+
error: null
|
|
26
|
+
};
|
|
27
|
+
case "SET_MFA_CODE":
|
|
28
|
+
return {
|
|
29
|
+
...r,
|
|
30
|
+
mfaCode: e.payload.mfaCode,
|
|
31
|
+
error: null
|
|
32
|
+
};
|
|
33
|
+
case "INITIATE_ENROLLMENT":
|
|
34
|
+
return {
|
|
35
|
+
...r,
|
|
36
|
+
method: e.payload.method,
|
|
37
|
+
isPending: !0,
|
|
38
|
+
error: null,
|
|
39
|
+
flowDirection: "left"
|
|
40
|
+
};
|
|
41
|
+
case "INITIATE_ENROLLMENT_SUCCESS":
|
|
42
|
+
return {
|
|
43
|
+
...r,
|
|
44
|
+
isPending: !1,
|
|
45
|
+
authUrl: e.payload.authUrl,
|
|
46
|
+
secret: e.payload.secret,
|
|
47
|
+
initiatedAt: Date.now(),
|
|
48
|
+
isExpired: !1,
|
|
49
|
+
step: "setup"
|
|
50
|
+
};
|
|
51
|
+
case "INITIATE_ENROLLMENT_FAILURE":
|
|
52
|
+
return {
|
|
53
|
+
...r,
|
|
54
|
+
isPending: !1,
|
|
55
|
+
error: e.payload.error,
|
|
56
|
+
step: "list",
|
|
57
|
+
flowDirection: "right"
|
|
58
|
+
};
|
|
59
|
+
case "ENROLLMENT_SESSION_EXPIRED":
|
|
60
|
+
return {
|
|
61
|
+
...r,
|
|
62
|
+
mfaCode: "",
|
|
63
|
+
isExpired: !0
|
|
64
|
+
};
|
|
65
|
+
case "SUBMIT_ENROLLMENT":
|
|
66
|
+
return {
|
|
67
|
+
...r,
|
|
68
|
+
isPending: !0,
|
|
69
|
+
error: null,
|
|
70
|
+
flowDirection: "left"
|
|
71
|
+
};
|
|
72
|
+
case "SUBMIT_ENROLLMENT_SUCCESS":
|
|
73
|
+
return {
|
|
74
|
+
...r,
|
|
75
|
+
isPending: !1,
|
|
76
|
+
isSuccess: !0
|
|
77
|
+
};
|
|
78
|
+
case "SUBMIT_ENROLLMENT_FAILURE":
|
|
79
|
+
return {
|
|
80
|
+
...r,
|
|
81
|
+
isPending: !1,
|
|
82
|
+
error: e.payload.error,
|
|
83
|
+
isExpired: t(e.payload.error) ? e.payload.error.errorType === "mfa_flow_expired" : e.payload.error.toLowerCase().startsWith("mfa flow not found or expired")
|
|
84
|
+
};
|
|
85
|
+
case "CLEAR_ERROR":
|
|
86
|
+
return {
|
|
87
|
+
...r,
|
|
88
|
+
error: null
|
|
89
|
+
};
|
|
90
|
+
case "GO_TO_PREVIOUS_STEP": {
|
|
91
|
+
const o = l.indexOf(r.step), s = o > 0 ? l[o - 1] : r.step;
|
|
92
|
+
return {
|
|
93
|
+
...r,
|
|
94
|
+
flowDirection: "right",
|
|
95
|
+
step: s,
|
|
96
|
+
error: null,
|
|
97
|
+
isExpired: !1,
|
|
98
|
+
mfaCode: ""
|
|
99
|
+
// Clear MFA code when going back
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
case "RESET_STATE":
|
|
103
|
+
return i(r.methods);
|
|
104
|
+
default:
|
|
105
|
+
return r;
|
|
106
|
+
}
|
|
107
|
+
}, f = (r = ["totp"]) => n(u, r, i);
|
|
108
|
+
export {
|
|
109
|
+
l as STEPS,
|
|
110
|
+
f as useEnrollMfaReducer
|
|
111
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EnrollMfaProps } from '../EnrollMfa';
|
|
3
|
+
import { ButtonProps } from '../ui/Button';
|
|
4
|
+
import { ModalContentProps } from '../ui/Modal';
|
|
5
|
+
interface EnrollMfaModalTriggerProps extends Partial<Pick<ButtonProps, "className" | "fullWidth" | "size" | "style" | "variant">> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
interface EnrollMfaModalProps extends Pick<EnrollMfaProps, "onEnrollSuccess" | "resetOnSuccess"> {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
setIsOpen?: (value: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
interface EnrollMfaModalContentProps extends Omit<ModalContentProps, "children"> {
|
|
15
|
+
children?: EnrollMfaProps["children"];
|
|
16
|
+
}
|
|
17
|
+
declare const EnrollMfaModalTrigger: ({ children, className, label, ...props }: EnrollMfaModalTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const EnrollMfaModalContent: ({ children, ...props }: EnrollMfaModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const EnrollMfaModal: ({ children, open, setIsOpen, onEnrollSuccess, resetOnSuccess, }: EnrollMfaModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export { EnrollMfaModal, EnrollMfaModalContent, EnrollMfaModalTrigger, type EnrollMfaModalProps, type EnrollMfaModalContentProps, type EnrollMfaModalTriggerProps, };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as o, jsxs as r, Fragment as s } from "react/jsx-runtime";
|
|
2
|
+
import { u as v } from "../../chunks/useSendComponentCallOnce.BHZMuo6E.js";
|
|
3
|
+
import { createContext as b, useMemo as w, useContext as y } from "react";
|
|
4
|
+
import { c as p } from "../../chunks/lite.1fxw3LjI.js";
|
|
5
|
+
import { u as F } from "../../chunks/CDPReactProvider.CIQm4C4z.js";
|
|
6
|
+
import { EnrollMfa as T, EnrollMfaError as B } from "../EnrollMfa/index.js";
|
|
7
|
+
import { Button as h } from "../ui/Button/index.js";
|
|
8
|
+
import { Modal as A, ModalContent as O, ModalTitle as S, ModalDescription as $, ModalClose as E, ModalTrigger as D } from "../ui/Modal/index.js";
|
|
9
|
+
import { VisuallyHidden as I } from "../ui/VisuallyHidden/index.js";
|
|
10
|
+
import { IconXMark as g } from "../../icons/IconXMark.js";
|
|
11
|
+
import { childrenHasComponent as C } from "../../utils/childrenHasComponent.js";
|
|
12
|
+
import { EnrollMfaTitle as _ } from "../EnrollMfa/EnrollMfaTitle.js";
|
|
13
|
+
import { EnrollMfaDescription as M } from "../EnrollMfa/EnrollMfaDescription.js";
|
|
14
|
+
import { EnrollMfaFlowBackButton as P } from "../EnrollMfa/EnrollMfaFlowBackButton.js";
|
|
15
|
+
import { EnrollMfaFlow as j } from "../EnrollMfa/EnrollMfaFlow.js";
|
|
16
|
+
import { EnrollMfaImage as k } from "../EnrollMfa/EnrollMfaImage.js";
|
|
17
|
+
import { EnrollMfaFooter as z } from "../EnrollMfa/EnrollMfaFooter.js";
|
|
18
|
+
import '../../assets/EnrollMfaModal.css';const H = "EnrollMfaModal-module__enroll___RFMmp", J = "EnrollMfaModal-module__header___ZotIP", L = "EnrollMfaModal-module__trigger___AxlwE", R = "EnrollMfaModal-module__img___bTKfB", V = "EnrollMfaModal-module__centered___LhCxM", Z = "EnrollMfaModal-module__footer___Adcfg", e = {
|
|
19
|
+
enroll: H,
|
|
20
|
+
"no-footer": "EnrollMfaModal-module__no-footer___EMCyT",
|
|
21
|
+
header: J,
|
|
22
|
+
"close-icon": "EnrollMfaModal-module__close-icon___L9an5",
|
|
23
|
+
"close-button": "EnrollMfaModal-module__close-button___-qa5Z",
|
|
24
|
+
trigger: L,
|
|
25
|
+
img: R,
|
|
26
|
+
"flex-container": "EnrollMfaModal-module__flex-container___O6xYx",
|
|
27
|
+
"gap-2": "EnrollMfaModal-module__gap-2___NBJPS",
|
|
28
|
+
"gap-3": "EnrollMfaModal-module__gap-3___Jp1Oy",
|
|
29
|
+
centered: V,
|
|
30
|
+
footer: Z
|
|
31
|
+
}, N = b(null), q = () => {
|
|
32
|
+
const l = y(N);
|
|
33
|
+
if (!l)
|
|
34
|
+
throw new Error("useEnrollMfaModalContext must be used within a EnrollMfaModal");
|
|
35
|
+
return l;
|
|
36
|
+
}, x = ({
|
|
37
|
+
children: l,
|
|
38
|
+
className: d = "",
|
|
39
|
+
label: i,
|
|
40
|
+
...t
|
|
41
|
+
}) => /* @__PURE__ */ o(D, { asChild: !0, children: l || /* @__PURE__ */ o(h, { className: p(e.trigger, d), ...t, children: i || "Manage MFA" }) }), u = ({ children: l, ...d }) => {
|
|
42
|
+
const { onEnrollSuccess: i, resetOnSuccess: t } = q(), { showCoinbaseFooter: c } = F();
|
|
43
|
+
return /* @__PURE__ */ o(O, { ...d, children: /* @__PURE__ */ o(
|
|
44
|
+
T,
|
|
45
|
+
{
|
|
46
|
+
className: p(e.enroll, c ? "" : e["no-footer"]),
|
|
47
|
+
onEnrollSuccess: i,
|
|
48
|
+
resetOnSuccess: t,
|
|
49
|
+
children: (n) => /* @__PURE__ */ r(s, { children: [
|
|
50
|
+
/* @__PURE__ */ r(I, { children: [
|
|
51
|
+
/* @__PURE__ */ o(S, { asChild: !0, children: /* @__PURE__ */ o(_, { as: "span" }) }),
|
|
52
|
+
/* @__PURE__ */ o($, { asChild: !0, children: /* @__PURE__ */ o(M, { as: "span" }) })
|
|
53
|
+
] }),
|
|
54
|
+
l ? typeof l == "function" ? l(n) : l : null,
|
|
55
|
+
!l && /* @__PURE__ */ r(s, { children: [
|
|
56
|
+
/* @__PURE__ */ r(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: p(
|
|
60
|
+
e["flex-container"],
|
|
61
|
+
n.step === "list" ? e["gap-3"] : ""
|
|
62
|
+
),
|
|
63
|
+
children: [
|
|
64
|
+
n.step === "list" ? /* @__PURE__ */ r(s, { children: [
|
|
65
|
+
/* @__PURE__ */ r("div", { children: [
|
|
66
|
+
/* @__PURE__ */ r("div", { className: e.header, children: [
|
|
67
|
+
/* @__PURE__ */ o(_, { step: "list", method: n.method }),
|
|
68
|
+
/* @__PURE__ */ o(E, { asChild: !0, children: /* @__PURE__ */ o(
|
|
69
|
+
h,
|
|
70
|
+
{
|
|
71
|
+
className: e["close-button"],
|
|
72
|
+
"aria-label": "Close",
|
|
73
|
+
size: "md",
|
|
74
|
+
variant: "transparentSecondary",
|
|
75
|
+
children: /* @__PURE__ */ o(g, { className: e["close-icon"] })
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ o(M, { step: "list", method: n.method })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ o(B, {})
|
|
82
|
+
] }) : /* @__PURE__ */ r("div", { className: e.header, children: [
|
|
83
|
+
/* @__PURE__ */ o(P, { step: n.step }),
|
|
84
|
+
/* @__PURE__ */ o(E, { asChild: !0, children: /* @__PURE__ */ o(
|
|
85
|
+
h,
|
|
86
|
+
{
|
|
87
|
+
className: e["close-button"],
|
|
88
|
+
"aria-label": "Close",
|
|
89
|
+
size: "md",
|
|
90
|
+
variant: "transparentSecondary",
|
|
91
|
+
children: /* @__PURE__ */ o(g, { className: e["close-icon"] })
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ o(j, { children: ({ step: a, method: m, Content: f }) => /* @__PURE__ */ r("div", { className: `${e["flex-container"]} ${e["gap-2"]}`, children: [
|
|
96
|
+
a !== "list" && /* @__PURE__ */ r(s, { children: [
|
|
97
|
+
/* @__PURE__ */ o(
|
|
98
|
+
k,
|
|
99
|
+
{
|
|
100
|
+
className: `${e.img} ${e.centered}`,
|
|
101
|
+
step: a,
|
|
102
|
+
method: m
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ r("div", { className: e.centered, children: [
|
|
106
|
+
/* @__PURE__ */ o(_, { step: a, method: m }),
|
|
107
|
+
/* @__PURE__ */ o(M, { step: a, method: m })
|
|
108
|
+
] })
|
|
109
|
+
] }),
|
|
110
|
+
f
|
|
111
|
+
] }) })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
c && /* @__PURE__ */ o(z, { className: e.footer })
|
|
116
|
+
] })
|
|
117
|
+
] })
|
|
118
|
+
}
|
|
119
|
+
) });
|
|
120
|
+
}, mo = ({
|
|
121
|
+
children: l,
|
|
122
|
+
open: d,
|
|
123
|
+
setIsOpen: i,
|
|
124
|
+
onEnrollSuccess: t,
|
|
125
|
+
resetOnSuccess: c
|
|
126
|
+
}) => {
|
|
127
|
+
v("enroll_mfa_modal");
|
|
128
|
+
const n = l ? C(l, x) : !1, a = l ? C(l, u) : !1, m = !n && !a, f = w(
|
|
129
|
+
() => ({ onEnrollSuccess: t, resetOnSuccess: c }),
|
|
130
|
+
[t, c]
|
|
131
|
+
);
|
|
132
|
+
return /* @__PURE__ */ o(N.Provider, { value: f, children: /* @__PURE__ */ o(A, { open: d, onOpenChange: i, children: m ? /* @__PURE__ */ r(s, { children: [
|
|
133
|
+
/* @__PURE__ */ o(x, { children: l }),
|
|
134
|
+
/* @__PURE__ */ o(u, {})
|
|
135
|
+
] }) : /* @__PURE__ */ r(s, { children: [
|
|
136
|
+
l,
|
|
137
|
+
!a && /* @__PURE__ */ o(u, {})
|
|
138
|
+
] }) }) });
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
mo as EnrollMfaModal,
|
|
142
|
+
u as EnrollMfaModalContent,
|
|
143
|
+
x as EnrollMfaModalTrigger
|
|
144
|
+
};
|