@coinbase/cdp-react 0.0.17 → 0.0.19
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/Button.css +1 -1
- package/dist/assets/EmailForm.css +1 -0
- package/dist/assets/Error.css +1 -1
- package/dist/assets/Field.css +1 -1
- package/dist/assets/FlowEmailOTP.css +1 -0
- package/dist/assets/FlowPhoneNumberOTP.css +1 -0
- package/dist/assets/Input.css +1 -1
- package/dist/assets/Label.css +1 -0
- package/dist/assets/OTP.css +1 -1
- package/dist/assets/OTPForm.css +1 -0
- package/dist/assets/PhoneNumberForm.css +1 -0
- package/dist/assets/PhoneNumberInput.css +1 -0
- package/dist/assets/SignIn.css +1 -1
- package/dist/assets/SignInAuthMethodButtons.css +1 -0
- package/dist/assets/SignInBackButton.css +1 -0
- package/dist/assets/SignInCredentials.css +1 -0
- package/dist/assets/SignInDescription.css +1 -1
- package/dist/assets/SignInFooter.css +1 -0
- package/dist/assets/SignInForm.css +1 -1
- package/dist/assets/SignInImage.css +1 -1
- package/dist/assets/SignInModal.css +1 -1
- package/dist/assets/SignInTitle.css +1 -1
- package/dist/assets/SuccessMessage.css +1 -0
- package/dist/assets/SwitchFadeTransition.css +1 -0
- package/dist/assets/SwitchSlideTransition.css +1 -0
- package/dist/assets/SwitchTransition.css +1 -0
- package/dist/assets/ThemeProvider.css +1 -1
- package/dist/chunks/index.BzllgVaP.js +12 -0
- package/dist/components/AuthButton/index.js +2 -2
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.js +47 -22
- package/dist/components/CDPReactProvider/index.d.ts +3 -0
- package/dist/components/CDPReactProvider/index.js +20 -13
- package/dist/components/EmailForm/index.d.ts +11 -0
- package/dist/components/EmailForm/index.js +56 -0
- package/dist/components/Error/index.d.ts +2 -2
- package/dist/components/Error/index.js +11 -11
- package/dist/components/Field/index.d.ts +2 -1
- package/dist/components/Field/index.js +20 -18
- package/dist/components/FlowEmailOTP/index.d.ts +18 -0
- package/dist/components/FlowEmailOTP/index.js +70 -0
- package/dist/components/FlowPhoneNumberOTP/index.d.ts +18 -0
- package/dist/components/FlowPhoneNumberOTP/index.js +75 -0
- package/dist/components/Label/index.d.ts +7 -0
- package/dist/components/Label/index.js +13 -0
- package/dist/components/OTP/index.d.ts +3 -0
- package/dist/components/OTP/index.js +48 -33
- package/dist/components/OTPForm/index.d.ts +16 -0
- package/dist/components/OTPForm/index.js +76 -0
- package/dist/components/PhoneNumberForm/index.d.ts +14 -0
- package/dist/components/PhoneNumberForm/index.js +68 -0
- package/dist/components/PhoneNumberInput/PhoneNumberMetadata.d.ts +2 -0
- package/dist/components/PhoneNumberInput/PhoneNumberMetadata.js +5 -0
- package/dist/components/PhoneNumberInput/index.d.ts +10 -0
- package/dist/components/PhoneNumberInput/index.js +76 -0
- package/dist/components/PhoneNumberInput/maskOverride.d.ts +8 -0
- package/dist/components/PhoneNumberInput/maskOverride.js +61 -0
- package/dist/components/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
- package/dist/components/PhoneNumberInput/usePhoneNumberFormatter.js +52 -0
- package/dist/components/SendTransactionButton/index.js +1 -1
- package/dist/components/ServerError/index.js +4 -4
- package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +13 -0
- package/dist/components/SignIn/SignInAuthMethodButtons.js +57 -0
- package/dist/components/SignIn/SignInBackButton.d.ts +9 -0
- package/dist/components/SignIn/SignInBackButton.js +38 -0
- package/dist/components/SignIn/SignInCredentials.d.ts +2 -0
- package/dist/components/SignIn/SignInCredentials.js +8 -0
- package/dist/components/SignIn/SignInDescription.d.ts +4 -3
- package/dist/components/SignIn/SignInDescription.js +16 -23
- package/dist/components/SignIn/SignInFooter.d.ts +2 -0
- package/dist/components/SignIn/SignInFooter.js +18 -0
- package/dist/components/SignIn/SignInForm.d.ts +12 -4
- package/dist/components/SignIn/SignInForm.js +25 -196
- package/dist/components/SignIn/SignInImage.d.ts +2 -2
- package/dist/components/SignIn/SignInImage.js +11 -14
- package/dist/components/SignIn/SignInProvider.d.ts +1 -1
- package/dist/components/SignIn/SignInProvider.js +24 -16
- package/dist/components/SignIn/SignInTitle.d.ts +4 -3
- package/dist/components/SignIn/SignInTitle.js +18 -13
- package/dist/components/SignIn/flows/SignInWithEmail.d.ts +5 -0
- package/dist/components/SignIn/flows/SignInWithEmail.js +71 -0
- package/dist/components/SignIn/flows/SignInWithSms.d.ts +5 -0
- package/dist/components/SignIn/flows/SignInWithSms.js +2994 -0
- package/dist/components/SignIn/hooks/useEmailForm.d.ts +13 -0
- package/dist/components/SignIn/hooks/useEmailForm.js +42 -0
- package/dist/components/SignIn/hooks/useOTPForm.d.ts +16 -0
- package/dist/components/SignIn/hooks/useOTPForm.js +59 -0
- package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +13 -0
- package/dist/components/SignIn/hooks/usePhoneNumberForm.js +42 -0
- package/dist/components/SignIn/index.d.ts +5 -2
- package/dist/components/SignIn/index.js +42 -24
- package/dist/components/SignIn/types.d.ts +106 -0
- package/dist/components/SignIn/types.js +3 -0
- package/dist/components/SignIn/useSignInReducer.d.ts +1 -57
- package/dist/components/SignIn/useSignInReducer.js +62 -20
- package/dist/components/SignInModal/index.d.ts +2 -2
- package/dist/components/SignInModal/index.js +62 -43
- package/dist/components/SignOutButton/index.js +1 -1
- package/dist/components/SuccessMessage/index.d.ts +7 -0
- package/dist/components/SuccessMessage/index.js +16 -0
- package/dist/components/SwitchFadeTransition/index.d.ts +5 -0
- package/dist/components/SwitchFadeTransition/index.js +24 -0
- package/dist/components/SwitchSlideTransition/index.d.ts +7 -0
- package/dist/components/SwitchSlideTransition/index.js +27 -0
- package/dist/components/SwitchTransition/index.d.ts +25 -0
- package/dist/components/SwitchTransition/index.js +155 -0
- package/dist/data/countries.d.ts +12 -0
- package/dist/data/countries.js +25 -0
- package/dist/data/countryNames.d.ts +1 -0
- package/dist/data/countryNames.js +6 -0
- package/dist/hooks/usePhoneNumberValidators.d.ts +14 -0
- package/dist/hooks/usePhoneNumberValidators.js +36 -0
- package/dist/hooks/useTimer.d.ts +5 -0
- package/dist/hooks/useTimer.js +24 -0
- package/dist/icons/IconArrowLeft.d.ts +2 -0
- package/dist/icons/IconArrowLeft.js +14 -0
- package/dist/icons/IconCheckCircle.js +2 -3
- package/dist/icons/IconCoinbaseWordmark.js +5 -5
- package/dist/icons/IconEnvelope.d.ts +2 -0
- package/dist/icons/IconEnvelope.js +7 -0
- package/dist/icons/IconExclamationCircle.js +3 -4
- package/dist/icons/IconPhone.d.ts +2 -0
- package/dist/icons/IconPhone.js +7 -0
- package/dist/icons/IconXMark.js +6 -5
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.js +14 -8
- package/dist/index.js +66 -53
- package/dist/theme/theme.d.ts +11 -2
- package/dist/theme/tokens.d.ts +30 -6
- package/dist/theme/tokens.js +7 -3
- package/dist/utils/parseValuesFromPhoneNumber.d.ts +6 -0
- package/dist/utils/parseValuesFromPhoneNumber.js +16 -0
- package/dist/utils/validatePhoneNumber.d.ts +1 -0
- package/dist/utils/validatePhoneNumber.js +1 -0
- package/package.json +11 -7
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { a as c } from "../../chunks/index.BzllgVaP.js";
|
|
4
|
+
import { useSignInContext as d } from "./SignInProvider.js";
|
|
5
|
+
import "@coinbase/cdp-hooks";
|
|
6
|
+
import "../CDPReactProvider/index.js";
|
|
7
|
+
import '../../assets/SignInTitle.css';const l = "SignInTitle-module__heading___QJ071", g = {
|
|
8
|
+
heading: l
|
|
9
|
+
}, S = ({
|
|
10
|
+
as: s = "h2",
|
|
11
|
+
children: t,
|
|
12
|
+
className: i = "",
|
|
13
|
+
authMethod: a,
|
|
14
|
+
step: h,
|
|
15
|
+
...m
|
|
11
16
|
}) => {
|
|
12
|
-
const { state:
|
|
13
|
-
return /* @__PURE__ */
|
|
17
|
+
const { state: o } = d(), r = h || o.step, e = a || o.authMethod, p = c[e].title;
|
|
18
|
+
return /* @__PURE__ */ n(s, { className: `${g.heading} ${i}`, ...m, children: t || /* @__PURE__ */ n(p, { step: r, authMethod: e }) });
|
|
14
19
|
};
|
|
15
20
|
export {
|
|
16
|
-
|
|
21
|
+
S as SignInTitle
|
|
17
22
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
|
|
2
|
+
export declare const SignInWithEmail: ({ step: stepFromProps, onSuccess, children }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const SignInWithEmailTitle: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const SignInWithEmailDescription: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const config: SignInFlowConfig;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as p, jsxs as o, Fragment as r } from "react/jsx-runtime";
|
|
2
|
+
import { useSignInWithEmail as x, useVerifyEmailOTP as y } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useRef as f, useLayoutEffect as D } from "react";
|
|
4
|
+
import { FlowEmailOTP as F } from "../../FlowEmailOTP/index.js";
|
|
5
|
+
import "react-transition-state";
|
|
6
|
+
import { useEmailForm as j } from "../hooks/useEmailForm.js";
|
|
7
|
+
import { useOTPForm as L } from "../hooks/useOTPForm.js";
|
|
8
|
+
import { SignInCredentials as H } from "../SignInCredentials.js";
|
|
9
|
+
import { useSignInContext as g } from "../SignInProvider.js";
|
|
10
|
+
import "../../CDPReactProvider/index.js";
|
|
11
|
+
const M = ({ step: i, onSuccess: s, children: S }) => {
|
|
12
|
+
const a = f(null), h = 6, { state: e } = g(), { signInWithEmail: E } = x(), { verifyEmailOTP: P } = y(), c = i || e.step, n = c === "credentials" ? "email" : "otp", m = f(n), { setEmail: T, submitEmail: l } = j({
|
|
13
|
+
submit: (t) => E({ email: t })
|
|
14
|
+
}), { resendCountdown: O, resetOTP: v, setOTP: I, startResendTimer: b, submitOtp: w } = L({
|
|
15
|
+
passwordLength: h,
|
|
16
|
+
submit: (t) => P({ flowId: e.flowId, otp: t })
|
|
17
|
+
}), u = () => {
|
|
18
|
+
b(60);
|
|
19
|
+
}, R = () => {
|
|
20
|
+
v(), l({ email: e.email, onSuccess: u });
|
|
21
|
+
}, W = (t) => {
|
|
22
|
+
t.preventDefault(), l({ email: e.email, onSuccess: u });
|
|
23
|
+
}, C = (t) => {
|
|
24
|
+
t.preventDefault(), w({ otp: e.otp, onSuccess: s });
|
|
25
|
+
};
|
|
26
|
+
return D(() => {
|
|
27
|
+
m.current !== n && (a.current?.transition.toggle(n), m.current = n);
|
|
28
|
+
}, [n]), /* @__PURE__ */ p(
|
|
29
|
+
F,
|
|
30
|
+
{
|
|
31
|
+
animateHeight: !1,
|
|
32
|
+
canResetOTP: e.canResetOTP,
|
|
33
|
+
email: e.email,
|
|
34
|
+
error: e.error || "",
|
|
35
|
+
isPending: e.isPending,
|
|
36
|
+
onEmailChange: T,
|
|
37
|
+
onOTPChange: I,
|
|
38
|
+
onResendOTP: R,
|
|
39
|
+
onSubmitEmail: W,
|
|
40
|
+
onSubmitOTP: C,
|
|
41
|
+
otp: e.otp,
|
|
42
|
+
resendCountdown: O,
|
|
43
|
+
step: n,
|
|
44
|
+
successMessage: e.isSuccess ? "Success!" : void 0,
|
|
45
|
+
transitionRef: a,
|
|
46
|
+
children: ({ step: t, Form: d }) => S?.({ step: c, Form: d }) || d
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}, V = ({ step: i }) => /* @__PURE__ */ o(r, { children: [
|
|
50
|
+
i === "credentials" && "Sign in",
|
|
51
|
+
i === "verification" && "Enter verification code"
|
|
52
|
+
] }), _ = ({ step: i }) => {
|
|
53
|
+
const { state: s } = g();
|
|
54
|
+
return /* @__PURE__ */ o(r, { children: [
|
|
55
|
+
i === "credentials" && "We’ll send you a verification code via email.",
|
|
56
|
+
i === "verification" && /* @__PURE__ */ o(r, { children: [
|
|
57
|
+
"Enter the 6 digit code sent to ",
|
|
58
|
+
/* @__PURE__ */ p(H, { children: s.email })
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
}, U = {
|
|
62
|
+
description: _,
|
|
63
|
+
forms: M,
|
|
64
|
+
title: V
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
M as SignInWithEmail,
|
|
68
|
+
_ as SignInWithEmailDescription,
|
|
69
|
+
V as SignInWithEmailTitle,
|
|
70
|
+
U as config
|
|
71
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SignInFlowProps, SignInTitleAndDescriptionProps, SignInFlowConfig } from '../types';
|
|
2
|
+
export declare const SignInWithSms: ({ step: stepFromProps, onSuccess, children }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const SignInWithSmsTitle: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const SignInWithSmsDescription: ({ step }: SignInTitleAndDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const config: SignInFlowConfig;
|