@coinbase/cdp-react 0.0.15 → 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.
- package/README.md +1 -0
- package/dist/assets/SendTransactionButton.css +1 -0
- package/dist/components/SendTransactionButton/index.d.ts +13 -0
- package/dist/components/SendTransactionButton/index.js +67 -0
- package/dist/components/ServerError/index.d.ts +2 -2
- package/dist/components/ServerError/index.js +4 -3
- package/dist/components/SignIn/SignInForm.js +20 -20
- package/dist/components/SignIn/index.js +9 -8
- package/dist/components/SignIn/useSignInReducer.d.ts +4 -4
- package/dist/components/SignIn/useSignInReducer.js +3 -2
- package/dist/components/SignInModal/index.js +10 -9
- package/dist/components/SignOutButton/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +46 -42
- package/dist/utils/getMessageFromUnknownError.d.ts +1 -0
- package/dist/utils/getMessageFromUnknownError.js +8 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +6 -4
- package/dist/utils/isApiError.d.ts +2 -6
- package/dist/utils/isApiError.js +3 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ the CDP frontend SDK.
|
|
|
7
7
|
- {@link SignIn | `SignIn`} - the forms for the sign in flow, a logo, heading, and description text
|
|
8
8
|
- {@link SignOutButton | `SignOutButton`} - a sign out button
|
|
9
9
|
- {@link AuthButton | `AuthButton`} - the `SignOutButton` when logged in, and the `SignInModal` when logged out
|
|
10
|
+
- {@link SendTransactionButton | `SendTransactionButton`} - a button that signs and sends a transaction
|
|
10
11
|
|
|
11
12
|
## Quickstart
|
|
12
13
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.SendTransactionButton-module__send-transaction-button___-6UsN{padding-left:2em;padding-right:2em}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { APIError, SendEvmTransactionOptions } from '@coinbase/cdp-hooks';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import { ButtonVariant } from '../../theme/theme';
|
|
4
|
+
export interface SendTransactionButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onError"> {
|
|
5
|
+
account: SendEvmTransactionOptions["evmAccount"];
|
|
6
|
+
network: SendEvmTransactionOptions["network"];
|
|
7
|
+
onError?: (error: APIError | Error) => void;
|
|
8
|
+
onSuccess?: (hash: string) => void;
|
|
9
|
+
pendingLabel?: ReactNode;
|
|
10
|
+
transaction: SendEvmTransactionOptions["transaction"];
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
}
|
|
13
|
+
export declare const SendTransactionButton: ({ account, children, className, network, onClick, onError, onSuccess, pendingLabel, transaction, variant, ...props }: SendTransactionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { useSendEvmTransaction as y, APIError as T } from "@coinbase/cdp-hooks";
|
|
3
|
+
import { useState as _, useCallback as v } from "react";
|
|
4
|
+
import { Button as w } from "../Button/index.js";
|
|
5
|
+
import "../../theme/theme.js";
|
|
6
|
+
import { getMessageFromUnknownError as B } from "../../utils/getMessageFromUnknownError.js";
|
|
7
|
+
import '../../assets/SendTransactionButton.css';const P = {
|
|
8
|
+
"send-transaction-button": "SendTransactionButton-module__send-transaction-button___-6UsN"
|
|
9
|
+
}, N = ({
|
|
10
|
+
account: s,
|
|
11
|
+
children: f,
|
|
12
|
+
className: l = "",
|
|
13
|
+
network: r,
|
|
14
|
+
onClick: o,
|
|
15
|
+
onError: a,
|
|
16
|
+
onSuccess: i,
|
|
17
|
+
pendingLabel: u,
|
|
18
|
+
transaction: e,
|
|
19
|
+
variant: p = "primary",
|
|
20
|
+
...g
|
|
21
|
+
}) => {
|
|
22
|
+
const [h, c] = _(!1), m = y(), E = v(
|
|
23
|
+
async (d) => {
|
|
24
|
+
d.preventDefault(), o?.(d);
|
|
25
|
+
try {
|
|
26
|
+
if (!s || !r || !e) {
|
|
27
|
+
const n = [];
|
|
28
|
+
throw s || n.push("account"), r || n.push("network"), e || n.push("transaction"), new Error(`Missing required parameters: ${n.join(", ")}`);
|
|
29
|
+
}
|
|
30
|
+
c(!0);
|
|
31
|
+
const { transactionHash: t } = await m({
|
|
32
|
+
transaction: e,
|
|
33
|
+
evmAccount: s,
|
|
34
|
+
network: r
|
|
35
|
+
});
|
|
36
|
+
i?.(t);
|
|
37
|
+
} catch (t) {
|
|
38
|
+
let n;
|
|
39
|
+
if (t instanceof T || t instanceof Error)
|
|
40
|
+
n = t;
|
|
41
|
+
else {
|
|
42
|
+
const S = B(t);
|
|
43
|
+
n = new Error(S);
|
|
44
|
+
}
|
|
45
|
+
a?.(n);
|
|
46
|
+
} finally {
|
|
47
|
+
c(!1);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[s, r, o, a, i, m, e]
|
|
51
|
+
);
|
|
52
|
+
return /* @__PURE__ */ b(
|
|
53
|
+
w,
|
|
54
|
+
{
|
|
55
|
+
className: `${P["send-transaction-button"]} ${l}`,
|
|
56
|
+
isPending: h,
|
|
57
|
+
pendingLabel: u || "Sending transaction...",
|
|
58
|
+
onClick: E,
|
|
59
|
+
variant: p,
|
|
60
|
+
...g,
|
|
61
|
+
children: f || "Send transaction"
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
N as SendTransactionButton
|
|
67
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import "@coinbase/cdp-hooks";
|
|
2
3
|
import { forwardRef as t } from "react";
|
|
3
4
|
import { isApiError as p } from "../../utils/isApiError.js";
|
|
4
5
|
import { Error as f } from "../Error/index.js";
|
|
5
6
|
const a = t(
|
|
6
7
|
({ error: r, id: o, className: e = "" }, m) => {
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
const i = p(r) ? r.errorMessage : r;
|
|
9
|
+
return /* @__PURE__ */ s(f, { ref: m, id: o, className: e, children: i });
|
|
9
10
|
}
|
|
10
11
|
);
|
|
11
12
|
a.displayName = "ServerError";
|
|
@@ -2,19 +2,19 @@ import { jsxs as s, jsx as o, Fragment as A } from "react/jsx-runtime";
|
|
|
2
2
|
import { useSignInWithEmail as U, useVerifyEmailOTP as V } from "@coinbase/cdp-hooks";
|
|
3
3
|
import { Form as P, FormSubmit as R } from "@radix-ui/react-form";
|
|
4
4
|
import { useState as v, useEffect as y, useRef as B } from "react";
|
|
5
|
+
import { Button as C } from "../Button/index.js";
|
|
5
6
|
import { useAppConfig as k } from "../CDPReactProvider/index.js";
|
|
6
7
|
import { Field as x } from "../Field/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { VisuallyHidden as Q } from "../VisuallyHidden/index.js";
|
|
12
|
-
import { IconCoinbaseWordmark as Z } from "../../icons/IconCoinbaseWordmark.js";
|
|
13
|
-
import { IconLock as $ } from "../../icons/IconLock.js";
|
|
8
|
+
import { OTP as q } from "../OTP/index.js";
|
|
9
|
+
import { ServerError as O } from "../ServerError/index.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 {
|
|
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",
|
|
@@ -59,8 +59,8 @@ import '../../assets/SignInForm.css';const J = "SignInForm-module__form___8Mc3V"
|
|
|
59
59
|
})
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
|
-
i.error && /* @__PURE__ */ o(
|
|
63
|
-
/* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
|
|
62
|
+
i.error && /* @__PURE__ */ o(O, { error: i.error, className: n["server-error"] }),
|
|
63
|
+
/* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(C, { type: "submit", isPending: i.isPending, children: "Continue with email" }) })
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
66
|
);
|
|
@@ -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,12 +98,12 @@ 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(
|
|
102
|
-
e.error && /* @__PURE__ */ o(
|
|
101
|
+
e.isPending && !e.canResetOTP && /* @__PURE__ */ o($, { className: n["loading-spinner"] }),
|
|
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: [
|
|
105
105
|
e.canResetOTP && /* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
|
|
106
|
-
|
|
106
|
+
C,
|
|
107
107
|
{
|
|
108
108
|
type: "button",
|
|
109
109
|
onClick: S,
|
|
@@ -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 { jsx as n, jsxs as r, Fragment as s } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { SignInDescription as g } from "./SignInDescription.js";
|
|
4
|
-
import { SignInForm as
|
|
5
|
-
import { SignInImage as
|
|
4
|
+
import { SignInForm as p } from "./SignInForm.js";
|
|
5
|
+
import { SignInImage as c } from "./SignInImage.js";
|
|
6
6
|
import { SignInProvider as I, useSignInContext as S } from "./SignInProvider.js";
|
|
7
7
|
import { SignInTitle as f } from "./SignInTitle.js";
|
|
8
|
+
import "@coinbase/cdp-hooks";
|
|
8
9
|
import '../../assets/SignIn.css';const a = {
|
|
9
10
|
"sign-in": "SignIn-module__sign-in___cYpee"
|
|
10
11
|
}, l = ({ className: i = "", children: t, onSuccess: e }) => {
|
|
@@ -12,18 +13,18 @@ import '../../assets/SignIn.css';const a = {
|
|
|
12
13
|
return /* @__PURE__ */ r("div", { className: `${a["sign-in"]} ${i}`, children: [
|
|
13
14
|
o,
|
|
14
15
|
!o && /* @__PURE__ */ r(s, { children: [
|
|
15
|
-
/* @__PURE__ */ n(
|
|
16
|
+
/* @__PURE__ */ n(c, {}),
|
|
16
17
|
/* @__PURE__ */ n(f, {}),
|
|
17
18
|
/* @__PURE__ */ n(g, {}),
|
|
18
|
-
/* @__PURE__ */ n(
|
|
19
|
+
/* @__PURE__ */ n(p, { onSuccess: e })
|
|
19
20
|
] })
|
|
20
21
|
] });
|
|
21
|
-
},
|
|
22
|
+
}, F = (i) => /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(l, { ...i }) });
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
F as SignIn,
|
|
24
25
|
g as SignInDescription,
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
p as SignInForm,
|
|
27
|
+
c as SignInImage,
|
|
27
28
|
f as SignInTitle,
|
|
28
29
|
S as useSignInContext
|
|
29
30
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
2
|
export interface SignInState {
|
|
3
3
|
canResetOTP: boolean;
|
|
4
4
|
email: string;
|
|
5
|
-
error: string |
|
|
5
|
+
error: string | APIError | null;
|
|
6
6
|
flowId: string;
|
|
7
7
|
isPending: boolean;
|
|
8
8
|
otp: string;
|
|
@@ -26,7 +26,7 @@ export type SignInAction = {
|
|
|
26
26
|
} | {
|
|
27
27
|
type: "SUBMIT_EMAIL_FAILURE";
|
|
28
28
|
payload: {
|
|
29
|
-
error: string |
|
|
29
|
+
error: string | APIError;
|
|
30
30
|
};
|
|
31
31
|
} | {
|
|
32
32
|
type: "SET_OTP";
|
|
@@ -46,7 +46,7 @@ export type SignInAction = {
|
|
|
46
46
|
} | {
|
|
47
47
|
type: "SUBMIT_OTP_FAILURE";
|
|
48
48
|
payload: {
|
|
49
|
-
error: string |
|
|
49
|
+
error: string | APIError;
|
|
50
50
|
};
|
|
51
51
|
} | {
|
|
52
52
|
type: "ALLOW_RESET_OTP";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "@coinbase/cdp-hooks";
|
|
1
2
|
import { useReducer as n } from "react";
|
|
2
3
|
function l(r, e) {
|
|
3
4
|
switch (e.type) {
|
|
@@ -43,7 +44,7 @@ function l(r, e) {
|
|
|
43
44
|
throw new Error("Unknown action type");
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
+
const s = (r) => n(l, r);
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
+
s as useSignInReducer
|
|
49
50
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
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 e } from "../Button/index.js";
|
|
5
6
|
import { SignIn as S } from "../SignIn/index.js";
|
|
7
|
+
import "@coinbase/cdp-hooks";
|
|
6
8
|
import { useTheme as f } from "../ThemeProvider/index.js";
|
|
7
9
|
import { SignInImage as M } from "../SignIn/SignInImage.js";
|
|
8
10
|
import { SignInTitle as D } from "../SignIn/SignInTitle.js";
|
|
9
11
|
import { SignInDescription as v } from "../SignIn/SignInDescription.js";
|
|
10
12
|
import { SignInForm as N } from "../SignIn/SignInForm.js";
|
|
11
|
-
import { Button as r } from "../Button/index.js";
|
|
12
13
|
import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___IcJ8x", C = "SignInModal-module__modal___PErrT", x = "SignInModal-module__overlay___-0rmi", b = "SignInModal-module__spacer___x-lRH", n = {
|
|
13
14
|
trigger: y,
|
|
14
15
|
modal: C,
|
|
@@ -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
|
+
}, H = ({ children: l, open: a, setIsOpen: s, onSuccess: r }) => {
|
|
24
25
|
const { cssVariables: t } = f();
|
|
25
|
-
return /* @__PURE__ */ o(
|
|
26
|
-
/* @__PURE__ */ i(
|
|
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(S, { onSuccess:
|
|
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
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useSignOut as r } from "@coinbase/cdp-hooks";
|
|
3
3
|
import "react";
|
|
4
|
-
import "../../theme/theme.js";
|
|
5
4
|
import { Button as m } from "../Button/index.js";
|
|
5
|
+
import "../../theme/theme.js";
|
|
6
6
|
import '../../assets/SignOutButton.css';const e = {
|
|
7
7
|
"sign-out-button": "SignOutButton-module__sign-out-button___qiybe"
|
|
8
8
|
}, O = ({ children: t, variant: o = "primary", onSuccess: n }) => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './components/CDPReactProvider';
|
|
2
2
|
export * from './components/AuthButton';
|
|
3
|
+
export * from './components/SendTransactionButton';
|
|
3
4
|
export * from './components/SignIn';
|
|
4
5
|
export * from './components/SignOutButton';
|
|
5
6
|
export * from './components/SignInModal';
|
package/dist/index.js
CHANGED
|
@@ -1,54 +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
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
3
|
+
import { SendTransactionButton as f } from "./components/SendTransactionButton/index.js";
|
|
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";
|
|
15
16
|
import { IconXMark as q } from "./icons/IconXMark.js";
|
|
16
|
-
import {
|
|
17
|
-
import { isApiError as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
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";
|
|
23
25
|
export {
|
|
24
26
|
m as AuthButton,
|
|
25
27
|
e as CDPReactProvider,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
V as IconCheckCircle,
|
|
29
|
+
w as IconExclamationCircle,
|
|
30
|
+
U as IconLock,
|
|
29
31
|
q as IconXMark,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
f as SendTransactionButton,
|
|
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,
|
|
39
42
|
b as colorsBase,
|
|
40
43
|
v as colorsComponents,
|
|
41
44
|
A as colorsSemantic,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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,
|
|
50
54
|
t as useAppConfig,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
eo as useSignInContext,
|
|
56
|
+
c as useSignInReducer,
|
|
57
|
+
C as useTheme
|
|
54
58
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getMessageFromUnknownError: (error: unknown, defaultMesasge?: string) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { APIError as t } from "@coinbase/cdp-hooks";
|
|
2
|
+
const i = (e, n = "Something went wrong") => {
|
|
3
|
+
let s = "";
|
|
4
|
+
return e instanceof Error || e instanceof t || typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? s = e.message : typeof e == "string" && (s = e), s || n;
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
i as getMessageFromUnknownError
|
|
8
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isApiError as
|
|
1
|
+
import { getMessageFromUnknownError as e } from "./getMessageFromUnknownError.js";
|
|
2
|
+
import { isApiError as m } from "./isApiError.js";
|
|
3
|
+
import { isEmailInvalid as p } from "./isEmailInvalid.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
e as getMessageFromUnknownError,
|
|
6
|
+
m as isApiError,
|
|
7
|
+
p as isEmailInvalid
|
|
6
8
|
};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
errorMessage: string;
|
|
4
|
-
errorType: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const isApiError: (error: unknown) => error is ApiError;
|
|
1
|
+
import { APIError } from '@coinbase/cdp-hooks';
|
|
2
|
+
export declare const isApiError: (error: unknown) => error is APIError;
|
package/dist/utils/isApiError.js
CHANGED
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
|
{
|