@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
|
@@ -1,62 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (s) {
|
|
25
|
-
t?.();
|
|
26
|
-
try {
|
|
27
|
-
if (navigator.clipboard)
|
|
28
|
-
navigator.clipboard.writeText(s);
|
|
29
|
-
else
|
|
30
|
-
throw new Error("Clipboard API not supported");
|
|
31
|
-
} catch {
|
|
32
|
-
p.current?.select(), document.execCommand("copy");
|
|
33
|
-
}
|
|
34
|
-
a(!0), setTimeout(() => {
|
|
35
|
-
a(!1);
|
|
36
|
-
}, 2e3), d?.();
|
|
37
|
-
}
|
|
38
|
-
}, [s, t, d]);
|
|
39
|
-
return /* @__PURE__ */ c("div", { className: u(e["address-copy"], l), ...i, children: [
|
|
40
|
-
r && /* @__PURE__ */ o(b, { as: "span", className: e.label, children: r }),
|
|
41
|
-
/* @__PURE__ */ c("div", { className: e["address-input-container"], onClick: n, children: [
|
|
42
|
-
/* @__PURE__ */ c("span", { className: e["address-truncated"], children: [
|
|
43
|
-
s.slice(0, 6),
|
|
44
|
-
"...",
|
|
45
|
-
s.slice(-4)
|
|
46
|
-
] }),
|
|
47
|
-
/* @__PURE__ */ o(
|
|
48
|
-
"button",
|
|
49
|
-
{
|
|
50
|
-
type: "button",
|
|
51
|
-
"aria-label": "copy address",
|
|
52
|
-
onClick: n,
|
|
53
|
-
className: e["copy-button"],
|
|
54
|
-
children: _ ? /* @__PURE__ */ o(f, { className: e["success-icon"] }) : /* @__PURE__ */ o(h, { className: e["copy-icon"] })
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
] })
|
|
58
|
-
] });
|
|
59
|
-
};
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { CopyTextField as c } from "../ui/CopyTextField/index.js";
|
|
4
|
+
const a = ({
|
|
5
|
+
className: e = "",
|
|
6
|
+
address: o,
|
|
7
|
+
label: p,
|
|
8
|
+
onCopy: r,
|
|
9
|
+
onCopySuccess: i,
|
|
10
|
+
...l
|
|
11
|
+
}) => /* @__PURE__ */ t(
|
|
12
|
+
c,
|
|
13
|
+
{
|
|
14
|
+
className: e,
|
|
15
|
+
value: o,
|
|
16
|
+
displayValue: `${o.slice(0, 6)}...${o.slice(-4)}`,
|
|
17
|
+
label: p,
|
|
18
|
+
onCopy: r,
|
|
19
|
+
onCopySuccess: i,
|
|
20
|
+
copyAriaLabel: "copy address",
|
|
21
|
+
...l
|
|
22
|
+
}
|
|
23
|
+
);
|
|
60
24
|
export {
|
|
61
|
-
|
|
25
|
+
a as CopyAddress
|
|
62
26
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { EnrollMfaMethodComponentProps } from './types';
|
|
3
|
+
export interface EnrollMfaDescriptionProps extends EnrollMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
}
|
|
6
|
+
export declare const EnrollMfaDescription: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: EnrollMfaDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as t, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useEnrollMfaContext as f } from "./EnrollMfaProvider.js";
|
|
4
|
+
import { m as h } from "../../chunks/index.CKQKBoX2.js";
|
|
5
|
+
import "@coinbase/cdp-hooks";
|
|
6
|
+
import '../../assets/EnrollMfaDescription.css';const _ = "EnrollMfaDescription-module__description___qWKL6", u = {
|
|
7
|
+
description: _
|
|
8
|
+
}, q = ({
|
|
9
|
+
as: s = "p",
|
|
10
|
+
children: n,
|
|
11
|
+
className: r = "",
|
|
12
|
+
method: c,
|
|
13
|
+
step: p,
|
|
14
|
+
...m
|
|
15
|
+
}) => {
|
|
16
|
+
const { state: o } = f(), e = p || o.step, i = c || o.method, l = h[i].description, a = e === "list" ? /* @__PURE__ */ t(d, { children: "Require verification for sensitive actions." }) : /* @__PURE__ */ t(l, { step: e, method: i });
|
|
17
|
+
return /* @__PURE__ */ t(s, { className: `${u.description} ${r}`, ...m, children: n ?? a });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
q as EnrollMfaDescription
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EnrollMfaStep, MfaMethod } from './types';
|
|
3
|
+
export interface EnrollMfaFlowProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4
|
+
autoFocus?: boolean;
|
|
5
|
+
animateHeight?: boolean;
|
|
6
|
+
children?: (props: {
|
|
7
|
+
step: EnrollMfaStep;
|
|
8
|
+
method: MfaMethod;
|
|
9
|
+
Content: ReactNode;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const EnrollMfaFlow: ({ autoFocus, animateHeight, children, className, ...props }: EnrollMfaFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SwitchSlideTransition as _ } from "../ui/SwitchSlideTransition/index.js";
|
|
4
|
+
import { useEnrollMfaFlowInternal as h } from "./EnrollMfaFlowProvider.js";
|
|
5
|
+
import { EnrollMfaItems as w } from "./EnrollMfaItems.js";
|
|
6
|
+
import { useEnrollMfaContext as M } from "./EnrollMfaProvider.js";
|
|
7
|
+
import { m as S } from "../../chunks/index.CKQKBoX2.js";
|
|
8
|
+
import "@coinbase/cdp-hooks";
|
|
9
|
+
import { STEPS as b } from "./useEnrollMfaReducer.js";
|
|
10
|
+
import '../../assets/EnrollMfaFlow.css';const x = "EnrollMfaFlow-module__list___oGYkb", s = {
|
|
11
|
+
"method-wrapper": "EnrollMfaFlow-module__method-wrapper___yT4Pj",
|
|
12
|
+
list: x
|
|
13
|
+
}, $ = ({
|
|
14
|
+
autoFocus: e = !1,
|
|
15
|
+
animateHeight: m = !0,
|
|
16
|
+
children: l,
|
|
17
|
+
className: a = "",
|
|
18
|
+
...p
|
|
19
|
+
}) => {
|
|
20
|
+
const { state: n } = M(), { startEnrollment: f, submit: d, transitionRef: c } = h(), { method: i } = n;
|
|
21
|
+
return /* @__PURE__ */ t(
|
|
22
|
+
_,
|
|
23
|
+
{
|
|
24
|
+
autoFocus: e,
|
|
25
|
+
animateHeight: m,
|
|
26
|
+
items: b,
|
|
27
|
+
initialEntered: !0,
|
|
28
|
+
timeout: 250,
|
|
29
|
+
direction: n.flowDirection,
|
|
30
|
+
transitionRef: c,
|
|
31
|
+
children: ({ itemKey: r, ...u }) => {
|
|
32
|
+
let o = null;
|
|
33
|
+
if (r === "list")
|
|
34
|
+
o = /* @__PURE__ */ t(w, { className: s.list, onSetUp: f });
|
|
35
|
+
else {
|
|
36
|
+
const E = S[i].content;
|
|
37
|
+
o = /* @__PURE__ */ t("div", { className: `${s["method-wrapper"]} ${a}`, ...p, children: /* @__PURE__ */ t(E, { autoFocus: e, step: r, onSubmit: d }) });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ t("div", { ...u, children: l ? l({ step: r, method: i, Content: o }) : o });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
$ as EnrollMfaFlow
|
|
46
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonProps } from '../ui/Button/Button';
|
|
3
|
+
import { EnrollMfaStep } from './types';
|
|
4
|
+
export interface EnrollMfaFlowBackButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
step?: EnrollMfaStep;
|
|
6
|
+
size?: ButtonProps["size"];
|
|
7
|
+
variant?: ButtonProps["variant"];
|
|
8
|
+
}
|
|
9
|
+
export declare const EnrollMfaFlowBackButton: ({ ["aria-label"]: ariaLabel, children, className, size, onClick, variant, step: stepFromProps, ...props }: EnrollMfaFlowBackButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 f } from "../ui/Button/index.js";
|
|
5
|
+
import { IconArrowLeft as _ } from "../../icons/IconArrowLeft.js";
|
|
6
|
+
import { useEnrollMfaFlowInternal as b } from "./EnrollMfaFlowProvider.js";
|
|
7
|
+
import { useEnrollMfaContext as B } from "./EnrollMfaProvider.js";
|
|
8
|
+
import "@coinbase/cdp-hooks";
|
|
9
|
+
import '../../assets/EnrollMfaFlowBackButton.css';const k = "EnrollMfaFlowBackButton-module__button___8J7mz", d = "EnrollMfaFlowBackButton-module__icon___H7y5j", t = {
|
|
10
|
+
button: k,
|
|
11
|
+
icon: d
|
|
12
|
+
}, N = ({
|
|
13
|
+
["aria-label"]: n = "Back",
|
|
14
|
+
children: r,
|
|
15
|
+
className: l = "",
|
|
16
|
+
size: a = "md",
|
|
17
|
+
onClick: s,
|
|
18
|
+
variant: c = "transparentSecondary",
|
|
19
|
+
step: e,
|
|
20
|
+
...m
|
|
21
|
+
}) => {
|
|
22
|
+
const { back: i } = b(), { state: u } = B();
|
|
23
|
+
return (e || u.step) === "list" ? null : /* @__PURE__ */ o(
|
|
24
|
+
f,
|
|
25
|
+
{
|
|
26
|
+
type: "button",
|
|
27
|
+
"aria-label": n,
|
|
28
|
+
className: p(t.button, l),
|
|
29
|
+
onClick: s ?? i,
|
|
30
|
+
size: a,
|
|
31
|
+
variant: c,
|
|
32
|
+
...m,
|
|
33
|
+
children: r || /* @__PURE__ */ o(_, { className: t.icon })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
N as EnrollMfaFlowBackButton
|
|
39
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormEvent, ReactNode, RefObject } from 'react';
|
|
2
|
+
import { SwitchSlideTransitionRef } from '../ui/SwitchSlideTransition';
|
|
3
|
+
import { EnrollMfaStep, MfaMethod } from './types';
|
|
4
|
+
export interface EnrollMfaFlowContextValue {
|
|
5
|
+
back: () => void;
|
|
6
|
+
startEnrollment: (method: MfaMethod) => void;
|
|
7
|
+
submit: (e: FormEvent<HTMLFormElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface EnrollMfaFlowContextValueInternal extends EnrollMfaFlowContextValue {
|
|
10
|
+
transitionRef: RefObject<SwitchSlideTransitionRef<EnrollMfaStep> | null> | null;
|
|
11
|
+
}
|
|
12
|
+
export interface EnrollMfaFlowProviderProps {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
onBack: EnrollMfaFlowContextValue["back"];
|
|
15
|
+
onStartEnrollment: EnrollMfaFlowContextValue["startEnrollment"];
|
|
16
|
+
onSubmit: EnrollMfaFlowContextValue["submit"];
|
|
17
|
+
transitionRef: EnrollMfaFlowContextValueInternal["transitionRef"];
|
|
18
|
+
}
|
|
19
|
+
export declare const useEnrollMfaFlowInternal: () => EnrollMfaFlowContextValueInternal;
|
|
20
|
+
export declare const useEnrollMfaFlow: () => EnrollMfaFlowContextValue;
|
|
21
|
+
export declare const EnrollMfaFlowProvider: ({ children, onBack, onStartEnrollment, onSubmit, transitionRef, }: EnrollMfaFlowProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useContext as i, useMemo as c } from "react";
|
|
3
|
+
import "@coinbase/cdp-hooks";
|
|
4
|
+
const l = u(null), f = () => {
|
|
5
|
+
const o = i(l);
|
|
6
|
+
if (!o)
|
|
7
|
+
throw new Error("useEnrollMfaFlowInternal must be used within a EnrollMfaFlowContext.Provider");
|
|
8
|
+
return o;
|
|
9
|
+
}, E = () => {
|
|
10
|
+
const { transitionRef: o, ...t } = f();
|
|
11
|
+
return t;
|
|
12
|
+
}, M = ({
|
|
13
|
+
children: o,
|
|
14
|
+
onBack: t,
|
|
15
|
+
onStartEnrollment: r,
|
|
16
|
+
onSubmit: e,
|
|
17
|
+
transitionRef: n
|
|
18
|
+
}) => {
|
|
19
|
+
const s = c(
|
|
20
|
+
() => ({
|
|
21
|
+
back: t,
|
|
22
|
+
startEnrollment: r,
|
|
23
|
+
submit: e,
|
|
24
|
+
transitionRef: n
|
|
25
|
+
}),
|
|
26
|
+
[t, r, e, n]
|
|
27
|
+
);
|
|
28
|
+
return /* @__PURE__ */ a(l.Provider, { value: s, children: o });
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
M as EnrollMfaFlowProvider,
|
|
32
|
+
E as useEnrollMfaFlow,
|
|
33
|
+
f as useEnrollMfaFlowInternal
|
|
34
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { EnrollMfaMethodComponentProps } from './types';
|
|
3
|
+
export interface EnrollMfaImageProps extends EnrollMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
}
|
|
6
|
+
export declare const EnrollMfaImage: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: EnrollMfaImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useEnrollMfaContext as l } from "./EnrollMfaProvider.js";
|
|
4
|
+
import { m as c } from "../../chunks/index.CKQKBoX2.js";
|
|
5
|
+
import "@coinbase/cdp-hooks";
|
|
6
|
+
const M = ({
|
|
7
|
+
as: r = "div",
|
|
8
|
+
children: t,
|
|
9
|
+
className: s = "",
|
|
10
|
+
method: n,
|
|
11
|
+
step: p,
|
|
12
|
+
...a
|
|
13
|
+
}) => {
|
|
14
|
+
const { state: o } = l(), i = p || o.step, e = n || o.method, f = c[e].image;
|
|
15
|
+
return /* @__PURE__ */ m(r, { className: s, ...a, children: t || /* @__PURE__ */ m(f, { step: i, method: e }) });
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
M as EnrollMfaImage
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { MfaMethod } from './types';
|
|
3
|
+
interface EnrollMfaItemProps {
|
|
4
|
+
method: MfaMethod;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
label: string;
|
|
7
|
+
isPending?: boolean;
|
|
8
|
+
onSetUp: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
declare const EnrollMfaItem: ({ method, icon, label, isPending, onSetUp }: EnrollMfaItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { EnrollMfaItem, type EnrollMfaItemProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useCurrentUser as l } from "@coinbase/cdp-hooks";
|
|
3
|
+
import "react";
|
|
4
|
+
import { ToggleListItem as a } from "../ui/ToggleListItem/index.js";
|
|
5
|
+
const u = ({ method: e, icon: o, label: s, isPending: n, onSetUp: i }) => {
|
|
6
|
+
const { currentUser: t } = l(), r = t?.mfaMethods?.[e]?.enrolledAt ? Date.now() > new Date(t.mfaMethods[e].enrolledAt).getTime() : !1;
|
|
7
|
+
return /* @__PURE__ */ m(
|
|
8
|
+
a,
|
|
9
|
+
{
|
|
10
|
+
icon: o,
|
|
11
|
+
label: s,
|
|
12
|
+
isActive: r,
|
|
13
|
+
isPending: n,
|
|
14
|
+
onActivate: i,
|
|
15
|
+
isDisabled: r
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
u as EnrollMfaItem
|
|
21
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EnrollMfaItemProps } from './EnrollMfaItem';
|
|
3
|
+
import { MfaMethod } from './types';
|
|
4
|
+
interface EnrollMfaItemsProps extends Omit<HTMLAttributes<HTMLUListElement>, "children"> {
|
|
5
|
+
children?: (props: EnrollMfaItemProps) => ReactNode;
|
|
6
|
+
onSetUp?: (method: MfaMethod) => void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
declare const EnrollMfaItems: ({ children, className, onSetUp, ...props }: EnrollMfaItemsProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { EnrollMfaItems, type EnrollMfaItemsProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { c as u } from "../../chunks/lite.1fxw3LjI.js";
|
|
3
|
+
import { useMemo as d } from "react";
|
|
4
|
+
import { IconPinCode as I } from "../../icons/IconPinCode.js";
|
|
5
|
+
import { EnrollMfaItem as M } from "./EnrollMfaItem.js";
|
|
6
|
+
import { useEnrollMfaContext as E } from "./EnrollMfaProvider.js";
|
|
7
|
+
import "@coinbase/cdp-hooks";
|
|
8
|
+
import '../../assets/EnrollMfaItems.css';const _ = "EnrollMfaItems-module__list___5ZZmE", x = {
|
|
9
|
+
list: _
|
|
10
|
+
}, P = {
|
|
11
|
+
totp: { Icon: /* @__PURE__ */ n(I, {}), label: "Authenticator app" }
|
|
12
|
+
}, w = ({ children: l, className: m = "", onSetUp: s, ...c }) => {
|
|
13
|
+
const { state: a } = E(), { methods: r, method: i, isPending: e } = a, p = d(() => r.map((t) => {
|
|
14
|
+
const { Icon: o, label: f } = P[t];
|
|
15
|
+
return {
|
|
16
|
+
method: t,
|
|
17
|
+
icon: o,
|
|
18
|
+
label: f,
|
|
19
|
+
onSetUp: async () => {
|
|
20
|
+
await s?.(t);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}), [r, s]);
|
|
24
|
+
return /* @__PURE__ */ n("ul", { className: u(x.list, m), ...c, children: p.map(({ method: t, ...o }) => /* @__PURE__ */ n("li", { children: l?.({
|
|
25
|
+
...o,
|
|
26
|
+
method: t,
|
|
27
|
+
isPending: e && i === t
|
|
28
|
+
}) || /* @__PURE__ */ n(
|
|
29
|
+
M,
|
|
30
|
+
{
|
|
31
|
+
...o,
|
|
32
|
+
method: t,
|
|
33
|
+
isPending: e && i === t
|
|
34
|
+
}
|
|
35
|
+
) }, t)) });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
w as EnrollMfaItems
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dispatch, ReactNode } from 'react';
|
|
2
|
+
import { EnrollMfaAction, EnrollMfaState, MfaMethod } from './types';
|
|
3
|
+
export interface EnrollMfaContextValue {
|
|
4
|
+
state: EnrollMfaState;
|
|
5
|
+
dispatch: Dispatch<EnrollMfaAction>;
|
|
6
|
+
onEnrollSuccess?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useEnrollMfaContext: () => EnrollMfaContextValue;
|
|
9
|
+
export interface EnrollMfaProviderProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
methods?: MfaMethod[];
|
|
12
|
+
onEnrollSuccess?: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const EnrollMfaProvider: ({ children, onEnrollSuccess, methods, }: EnrollMfaProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useContext as a, useMemo as f } from "react";
|
|
3
|
+
import "@coinbase/cdp-hooks";
|
|
4
|
+
import { useEnrollMfaReducer as m } from "./useEnrollMfaReducer.js";
|
|
5
|
+
const n = u(null), p = () => {
|
|
6
|
+
const t = a(n);
|
|
7
|
+
if (!t)
|
|
8
|
+
throw new Error("useEnrollMfaContext must be used within EnrollMfaProvider");
|
|
9
|
+
return t;
|
|
10
|
+
}, E = ({
|
|
11
|
+
children: t,
|
|
12
|
+
onEnrollSuccess: o,
|
|
13
|
+
methods: s
|
|
14
|
+
}) => {
|
|
15
|
+
const [r, e] = m(s), l = f(
|
|
16
|
+
() => ({ state: r, dispatch: e, onEnrollSuccess: o }),
|
|
17
|
+
[r, e, o]
|
|
18
|
+
);
|
|
19
|
+
return /* @__PURE__ */ i(n.Provider, { value: l, children: t });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
E as EnrollMfaProvider,
|
|
23
|
+
p as useEnrollMfaContext
|
|
24
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import { EnrollMfaMethodComponentProps } from './types';
|
|
3
|
+
export interface EnrollMfaTitleProps extends EnrollMfaMethodComponentProps, HTMLAttributes<HTMLElement> {
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
}
|
|
6
|
+
export declare const EnrollMfaTitle: ({ as: Component, children, className, method: methodFromProps, step: stepFromProps, ...props }: EnrollMfaTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as t, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useEnrollMfaContext as p } from "./EnrollMfaProvider.js";
|
|
4
|
+
import { m as f } from "../../chunks/index.CKQKBoX2.js";
|
|
5
|
+
import "@coinbase/cdp-hooks";
|
|
6
|
+
import '../../assets/EnrollMfaTitle.css';const g = "EnrollMfaTitle-module__heading___ogrZZ", u = {
|
|
7
|
+
heading: g
|
|
8
|
+
}, y = ({
|
|
9
|
+
as: s = "h2",
|
|
10
|
+
children: i,
|
|
11
|
+
className: r = "",
|
|
12
|
+
method: l,
|
|
13
|
+
step: m,
|
|
14
|
+
...a
|
|
15
|
+
}) => {
|
|
16
|
+
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(s, { className: `${u.heading} ${r}`, ...a, children: i ?? d });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
y as EnrollMfaTitle
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EnrollMfaDescription, EnrollMfaDescriptionProps } from './EnrollMfaDescription';
|
|
3
|
+
import { EnrollMfaFlow, EnrollMfaFlowProps } from './EnrollMfaFlow';
|
|
4
|
+
import { EnrollMfaFlowBackButton, EnrollMfaFlowBackButtonProps } from './EnrollMfaFlowBackButton';
|
|
5
|
+
import { useEnrollMfaFlow, EnrollMfaFlowContextValue } from './EnrollMfaFlowProvider';
|
|
6
|
+
import { EnrollMfaFooter } from './EnrollMfaFooter';
|
|
7
|
+
import { EnrollMfaImage, EnrollMfaImageProps } from './EnrollMfaImage';
|
|
8
|
+
import { EnrollMfaItem, EnrollMfaItemProps } from './EnrollMfaItem';
|
|
9
|
+
import { EnrollMfaItems, EnrollMfaItemsProps } from './EnrollMfaItems';
|
|
10
|
+
import { useEnrollMfaContext, EnrollMfaContextValue } from './EnrollMfaProvider';
|
|
11
|
+
import { EnrollMfaTitle, EnrollMfaTitleProps } from './EnrollMfaTitle';
|
|
12
|
+
import { EnrollMfaAction, EnrollMfaState, EnrollMfaStep, MfaMethod } from './types';
|
|
13
|
+
interface EnrollMfaProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
14
|
+
children?: ReactNode | ((state: EnrollMfaState) => ReactNode);
|
|
15
|
+
onEnrollSuccess?: () => void;
|
|
16
|
+
resetOnSuccess?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const EnrollMfaError: ({ role, ...props }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
+
declare const EnrollMfa: ({ onEnrollSuccess, ...props }: EnrollMfaProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export { EnrollMfa, EnrollMfaDescription, EnrollMfaError, EnrollMfaFlow, EnrollMfaFlowBackButton, EnrollMfaFooter, EnrollMfaImage, EnrollMfaItem, EnrollMfaItems, EnrollMfaTitle, useEnrollMfaContext, useEnrollMfaFlow, type EnrollMfaProps, type EnrollMfaContextValue, type EnrollMfaDescriptionProps, type EnrollMfaFlowBackButtonProps, type EnrollMfaFlowContextValue, type EnrollMfaFlowProps, type EnrollMfaImageProps, type EnrollMfaItemProps, type EnrollMfaItemsProps, type EnrollMfaTitleProps, type EnrollMfaAction, type EnrollMfaState, type EnrollMfaStep, type MfaMethod, };
|