@coinbase/cdp-react 0.0.16 → 0.0.17
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { OneTimePasswordField as _, OneTimePasswordFieldInput as f, OneTimePasswordFieldHiddenInput as P } from "@radix-ui/react-one-time-password-field";
|
|
3
3
|
import { forwardRef as O, useId as T, useRef as h, useEffect as y } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Input as I } from "../Input/index.js";
|
|
5
|
+
import { Error as v } from "../Error/index.js";
|
|
6
6
|
import '../../assets/OTP.css';const w = "OTP-module__otp___EUcSo", N = "OTP-module__input___MEBPV", r = {
|
|
7
7
|
otp: w,
|
|
8
8
|
"group-container": "OTP-module__group-container___rfrCo",
|
|
@@ -29,7 +29,7 @@ import '../../assets/OTP.css';const w = "OTP-module__otp___EUcSo", N = "OTP-modu
|
|
|
29
29
|
},
|
|
30
30
|
children: [
|
|
31
31
|
Array.from({ length: s }, (e, t) => /* @__PURE__ */ o("div", { className: r["input-container"], children: /* @__PURE__ */ o(f, { asChild: !0, children: /* @__PURE__ */ o(
|
|
32
|
-
|
|
32
|
+
I,
|
|
33
33
|
{
|
|
34
34
|
name: `${c.name || "otp"}-${t}`,
|
|
35
35
|
ref: (m) => p(m, t),
|
|
@@ -40,7 +40,7 @@ import '../../assets/OTP.css';const w = "OTP-module__otp___EUcSo", N = "OTP-modu
|
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
i && /* @__PURE__ */ o(
|
|
43
|
+
i && /* @__PURE__ */ o(v, { id: u, children: i })
|
|
44
44
|
] });
|
|
45
45
|
}
|
|
46
46
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import "@coinbase/cdp-hooks";
|
|
3
3
|
import { forwardRef as t } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { isApiError as p } from "../../utils/isApiError.js";
|
|
5
|
+
import { Error as f } from "../Error/index.js";
|
|
6
6
|
const a = t(
|
|
7
7
|
({ error: r, id: o, className: e = "" }, m) => {
|
|
8
|
-
const i =
|
|
9
|
-
return /* @__PURE__ */ s(
|
|
8
|
+
const i = p(r) ? r.errorMessage : r;
|
|
9
|
+
return /* @__PURE__ */ s(f, { ref: m, id: o, className: e, children: i });
|
|
10
10
|
}
|
|
11
11
|
);
|
|
12
12
|
a.displayName = "ServerError";
|
|
@@ -5,16 +5,16 @@ import { useState as v, useEffect as y, useRef as B } from "react";
|
|
|
5
5
|
import { Button as C } from "../Button/index.js";
|
|
6
6
|
import { useAppConfig as k } from "../CDPReactProvider/index.js";
|
|
7
7
|
import { Field as x } from "../Field/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { OTP as D } from "../OTP/index.js";
|
|
8
|
+
import { OTP as q } from "../OTP/index.js";
|
|
10
9
|
import { ServerError as O } from "../ServerError/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { IconLock as Z } from "../../icons/IconLock.js";
|
|
10
|
+
import { IconCoinbaseWordmark as D } from "../../icons/IconCoinbaseWordmark.js";
|
|
11
|
+
import { IconLock as W } from "../../icons/IconLock.js";
|
|
14
12
|
import { isApiError as T } from "../../utils/isApiError.js";
|
|
15
|
-
import { isEmailInvalid as
|
|
13
|
+
import { isEmailInvalid as Q } from "../../utils/isEmailInvalid.js";
|
|
16
14
|
import { useSignInContext as E } from "./SignInProvider.js";
|
|
17
|
-
import { withValidityState as
|
|
15
|
+
import { withValidityState as Z } from "../Input/index.js";
|
|
16
|
+
import { LoadingSpinner as $ } from "../LoadingSpinner/index.js";
|
|
17
|
+
import { VisuallyHidden as j } from "../VisuallyHidden/index.js";
|
|
18
18
|
import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V", G = "SignInForm-module__footer___6Lo9w", H = "SignInForm-module__hr___fOcy4", X = "SignInForm-module__icon___qkJnq", n = {
|
|
19
19
|
"form-wrapper": "SignInForm-module__form-wrapper___SlQkZ",
|
|
20
20
|
form: J,
|
|
@@ -45,9 +45,9 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
45
45
|
validators: [
|
|
46
46
|
["valueMissing", "Email is required"],
|
|
47
47
|
["typeMismatch", "Use a valid email address"],
|
|
48
|
-
[
|
|
48
|
+
[Q, "Use a valid email address"]
|
|
49
49
|
],
|
|
50
|
-
children:
|
|
50
|
+
children: Z({
|
|
51
51
|
autoComplete: "email",
|
|
52
52
|
type: "email",
|
|
53
53
|
placeholder: "name@example.com",
|
|
@@ -82,7 +82,7 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
82
82
|
onSubmit: f,
|
|
83
83
|
children: [
|
|
84
84
|
/* @__PURE__ */ o(
|
|
85
|
-
|
|
85
|
+
q,
|
|
86
86
|
{
|
|
87
87
|
ref: l,
|
|
88
88
|
name: "otp",
|
|
@@ -98,7 +98,7 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
98
98
|
),
|
|
99
99
|
/* @__PURE__ */ s("div", { className: n["form-footer"], children: [
|
|
100
100
|
(e.isPending && !e.canResetOTP || e.error) && /* @__PURE__ */ s("div", { className: n["server-state-wrapper"], children: [
|
|
101
|
-
e.isPending && !e.canResetOTP && /* @__PURE__ */ o(
|
|
101
|
+
e.isPending && !e.canResetOTP && /* @__PURE__ */ o($, { className: n["loading-spinner"] }),
|
|
102
102
|
e.error && /* @__PURE__ */ o(O, { error: e.error, className: n["server-error"] })
|
|
103
103
|
] }),
|
|
104
104
|
/* @__PURE__ */ s("div", { className: n["resend-wrapper"], children: [
|
|
@@ -118,7 +118,7 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
118
118
|
i,
|
|
119
119
|
"s"
|
|
120
120
|
] }),
|
|
121
|
-
/* @__PURE__ */ s(
|
|
121
|
+
/* @__PURE__ */ s(j, { children: [
|
|
122
122
|
i,
|
|
123
123
|
" ",
|
|
124
124
|
i === 1 ? "second" : "seconds"
|
|
@@ -187,11 +187,11 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
187
187
|
F && /* @__PURE__ */ s(A, { children: [
|
|
188
188
|
/* @__PURE__ */ o("hr", { className: n.hr }),
|
|
189
189
|
/* @__PURE__ */ s("div", { className: n.footer, children: [
|
|
190
|
-
/* @__PURE__ */ o(
|
|
190
|
+
/* @__PURE__ */ o(W, { className: n.icon }),
|
|
191
191
|
/* @__PURE__ */ s("p", { children: [
|
|
192
192
|
"Secured by",
|
|
193
193
|
" ",
|
|
194
|
-
/* @__PURE__ */ o(
|
|
194
|
+
/* @__PURE__ */ o(D, { className: n["coinbase-icon"], "aria-label": "Coinbase" })
|
|
195
195
|
] })
|
|
196
196
|
] })
|
|
197
197
|
] })
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as o, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { Dialog as
|
|
2
|
+
import { Dialog as m, DialogTrigger as g, DialogPortal as _, DialogOverlay as d, DialogContent as c, DialogClose as p, DialogTitle as I, DialogDescription as u } from "@radix-ui/react-dialog";
|
|
3
3
|
import "react";
|
|
4
4
|
import { IconXMark as h } from "../../icons/IconXMark.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
5
|
+
import { Button as e } from "../Button/index.js";
|
|
6
|
+
import { SignIn as S } from "../SignIn/index.js";
|
|
7
|
+
import "@coinbase/cdp-hooks";
|
|
8
|
+
import { useTheme as f } from "../ThemeProvider/index.js";
|
|
8
9
|
import { SignInImage as M } from "../SignIn/SignInImage.js";
|
|
9
10
|
import { SignInTitle as D } from "../SignIn/SignInTitle.js";
|
|
10
11
|
import { SignInDescription as v } from "../SignIn/SignInDescription.js";
|
|
@@ -20,15 +21,15 @@ import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___I
|
|
|
20
21
|
"close-button": "SignInModal-module__close-button___k1I5Q",
|
|
21
22
|
overlay: x,
|
|
22
23
|
spacer: b
|
|
23
|
-
},
|
|
24
|
-
const { cssVariables: t } =
|
|
25
|
-
return /* @__PURE__ */ o(
|
|
26
|
-
/* @__PURE__ */ i(
|
|
24
|
+
}, H = ({ children: l, open: a, setIsOpen: s, onSuccess: r }) => {
|
|
25
|
+
const { cssVariables: t } = f();
|
|
26
|
+
return /* @__PURE__ */ o(m, { open: a, onOpenChange: s, children: [
|
|
27
|
+
/* @__PURE__ */ i(g, { asChild: !0, children: l || /* @__PURE__ */ i(e, { variant: "primary", className: n.trigger, children: "Sign In" }) }),
|
|
27
28
|
/* @__PURE__ */ i(_, { children: /* @__PURE__ */ o(d, { className: n.overlay, style: t, children: [
|
|
28
29
|
/* @__PURE__ */ i("div", { className: n.spacer }),
|
|
29
|
-
/* @__PURE__ */ i(c, { className: n.modal, children: /* @__PURE__ */ o(
|
|
30
|
+
/* @__PURE__ */ i(c, { className: n.modal, children: /* @__PURE__ */ o(S, { onSuccess: r, className: n["sign-in"], children: [
|
|
30
31
|
/* @__PURE__ */ i(p, { asChild: !0, children: /* @__PURE__ */ i(
|
|
31
|
-
|
|
32
|
+
e,
|
|
32
33
|
{
|
|
33
34
|
"aria-label": "Close",
|
|
34
35
|
variant: "transparentSecondary",
|
|
@@ -39,11 +40,11 @@ import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___I
|
|
|
39
40
|
/* @__PURE__ */ i("div", { className: n["sign-in-image"], children: /* @__PURE__ */ i(M, {}) }),
|
|
40
41
|
/* @__PURE__ */ i("div", { className: n["sign-in-title"], children: /* @__PURE__ */ i(I, { asChild: !0, children: /* @__PURE__ */ i(D, {}) }) }),
|
|
41
42
|
/* @__PURE__ */ i(u, { asChild: !0, children: /* @__PURE__ */ i(v, { className: n["sign-in-description"] }) }),
|
|
42
|
-
/* @__PURE__ */ i(N, { className: n["sign-in-form"], onSuccess:
|
|
43
|
+
/* @__PURE__ */ i(N, { className: n["sign-in-form"], onSuccess: r })
|
|
43
44
|
] }) })
|
|
44
45
|
] }) })
|
|
45
46
|
] });
|
|
46
47
|
};
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
H as SignInModal
|
|
49
50
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { CDPReactProvider as e, useAppConfig as t } from "./components/CDPReactProvider/index.js";
|
|
2
2
|
import { AuthButton as m } from "./components/AuthButton/index.js";
|
|
3
3
|
import { SendTransactionButton as f } from "./components/SendTransactionButton/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
4
|
+
import { SignIn as x } from "./components/SignIn/index.js";
|
|
5
|
+
import { useSignInReducer as c } from "./components/SignIn/useSignInReducer.js";
|
|
6
|
+
import { SignOutButton as l } from "./components/SignOutButton/index.js";
|
|
7
|
+
import { SignInModal as g } from "./components/SignInModal/index.js";
|
|
8
|
+
import { ThemeProvider as u, useTheme as C } from "./components/ThemeProvider/index.js";
|
|
9
|
+
import { cssVariables as h } from "./theme/cssVariables.js";
|
|
10
|
+
import { theme as T } from "./theme/theme.js";
|
|
11
|
+
import { colors as E, colorsBase as b, colorsComponents as v, colorsSemantic as A, font as M, tokens as P } from "./theme/tokens.js";
|
|
12
|
+
import { flattenTokensObject as F, themeToCssVariables as O } from "./theme/utils.js";
|
|
13
|
+
import { IconCheckCircle as V } from "./icons/IconCheckCircle.js";
|
|
14
|
+
import { IconExclamationCircle as w } from "./icons/IconExclamationCircle.js";
|
|
15
|
+
import { IconLock as U } from "./icons/IconLock.js";
|
|
16
|
+
import { IconXMark as q } from "./icons/IconXMark.js";
|
|
17
|
+
import { getMessageFromUnknownError as z } from "./utils/getMessageFromUnknownError.js";
|
|
18
|
+
import { isApiError as H } from "./utils/isApiError.js";
|
|
19
|
+
import { isEmailInvalid as K } from "./utils/isEmailInvalid.js";
|
|
20
|
+
import { SignInDescription as Q } from "./components/SignIn/SignInDescription.js";
|
|
21
|
+
import { SignInForm as Y } from "./components/SignIn/SignInForm.js";
|
|
22
|
+
import { SignInImage as _ } from "./components/SignIn/SignInImage.js";
|
|
23
|
+
import { SignInTitle as oo } from "./components/SignIn/SignInTitle.js";
|
|
24
|
+
import { useSignInContext as eo } from "./components/SignIn/SignInProvider.js";
|
|
25
25
|
export {
|
|
26
26
|
m as AuthButton,
|
|
27
27
|
e as CDPReactProvider,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
V as IconCheckCircle,
|
|
29
|
+
w as IconExclamationCircle,
|
|
30
|
+
U as IconLock,
|
|
31
|
+
q as IconXMark,
|
|
32
32
|
f as SendTransactionButton,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
x as SignIn,
|
|
34
|
+
Q as SignInDescription,
|
|
35
|
+
Y as SignInForm,
|
|
36
|
+
_ as SignInImage,
|
|
37
|
+
g as SignInModal,
|
|
38
|
+
oo as SignInTitle,
|
|
39
|
+
l as SignOutButton,
|
|
40
|
+
u as ThemeProvider,
|
|
41
|
+
E as colors,
|
|
42
|
+
b as colorsBase,
|
|
43
|
+
v as colorsComponents,
|
|
44
|
+
A as colorsSemantic,
|
|
45
|
+
h as cssVariables,
|
|
46
|
+
F as flattenTokensObject,
|
|
47
|
+
M as font,
|
|
48
|
+
z as getMessageFromUnknownError,
|
|
49
|
+
H as isApiError,
|
|
50
|
+
K as isEmailInvalid,
|
|
51
|
+
T as theme,
|
|
52
|
+
O as themeToCssVariables,
|
|
53
|
+
P as tokens,
|
|
54
54
|
t as useAppConfig,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
eo as useSignInContext,
|
|
56
|
+
c as useSignInReducer,
|
|
57
|
+
C as useTheme
|
|
58
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"react": ">=18.2.0",
|
|
12
|
-
"@coinbase/cdp-core": "^0.0.
|
|
13
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
12
|
+
"@coinbase/cdp-core": "^0.0.17",
|
|
13
|
+
"@coinbase/cdp-hooks": "^0.0.17"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@size-limit/preset-big-lib": "^11.2.0",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"vite": "^7.0.4",
|
|
39
39
|
"vite-plugin-dts": "^4.5.4",
|
|
40
40
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
41
|
-
"@coinbase/cdp-core": "^0.0.
|
|
42
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
41
|
+
"@coinbase/cdp-core": "^0.0.17",
|
|
42
|
+
"@coinbase/cdp-hooks": "^0.0.17"
|
|
43
43
|
},
|
|
44
44
|
"size-limit": [
|
|
45
45
|
{
|