@coinbase/cdp-react 0.0.14 → 0.0.16
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/OTP/index.js +4 -4
- 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 +6 -5
- package/dist/components/SignIn/SignInForm.js +12 -12
- 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 +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +51 -47
- 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}
|
|
@@ -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 { Error as I } from "../Error/index.js";
|
|
5
|
+
import { Input as v } from "../Input/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
|
+
v,
|
|
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(I, { id: u, children: i })
|
|
44
44
|
] });
|
|
45
45
|
}
|
|
46
46
|
);
|
|
@@ -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
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { Error as p } from "../Error/index.js";
|
|
5
|
+
import { isApiError as f } from "../../utils/isApiError.js";
|
|
5
6
|
const a = t(
|
|
6
7
|
({ error: r, id: o, className: e = "" }, m) => {
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
const i = f(r) ? r.errorMessage : r;
|
|
9
|
+
return /* @__PURE__ */ s(p, { ref: m, id: o, className: e, children: i });
|
|
9
10
|
}
|
|
10
11
|
);
|
|
11
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 {
|
|
8
|
+
import { LoadingSpinner as q } from "../LoadingSpinner/index.js";
|
|
9
9
|
import { OTP as D } from "../OTP/index.js";
|
|
10
10
|
import { ServerError as O } from "../ServerError/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { VisuallyHidden as W } from "../VisuallyHidden/index.js";
|
|
12
|
+
import { IconCoinbaseWordmark as Q } from "../../icons/IconCoinbaseWordmark.js";
|
|
13
|
+
import { IconLock as Z } from "../../icons/IconLock.js";
|
|
13
14
|
import { isApiError as T } from "../../utils/isApiError.js";
|
|
14
|
-
import { isEmailInvalid as
|
|
15
|
+
import { isEmailInvalid as $ } from "../../utils/isEmailInvalid.js";
|
|
15
16
|
import { useSignInContext as E } from "./SignInProvider.js";
|
|
16
|
-
import {
|
|
17
|
-
import { VisuallyHidden as j } from "../VisuallyHidden/index.js";
|
|
17
|
+
import { withValidityState as j } from "../Input/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
|
+
[$, "Use a valid email address"]
|
|
49
49
|
],
|
|
50
|
-
children:
|
|
50
|
+
children: j({
|
|
51
51
|
autoComplete: "email",
|
|
52
52
|
type: "email",
|
|
53
53
|
placeholder: "name@example.com",
|
|
@@ -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(q, { 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(W, { 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(Z, { className: n.icon }),
|
|
191
191
|
/* @__PURE__ */ s("p", { children: [
|
|
192
192
|
"Secured by",
|
|
193
193
|
" ",
|
|
194
|
-
/* @__PURE__ */ o(
|
|
194
|
+
/* @__PURE__ */ o(Q, { 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
|
};
|
|
@@ -3,8 +3,8 @@ import { Dialog as g, DialogTrigger as m, DialogPortal as _, DialogOverlay as d,
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { IconXMark as h } from "../../icons/IconXMark.js";
|
|
5
5
|
import { Button as r } from "../Button/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useTheme as S } from "../ThemeProvider/index.js";
|
|
7
|
+
import { SignIn as f } from "../SignIn/index.js";
|
|
8
8
|
import { SignInImage as M } from "../SignIn/SignInImage.js";
|
|
9
9
|
import { SignInTitle as D } from "../SignIn/SignInTitle.js";
|
|
10
10
|
import { SignInDescription as v } from "../SignIn/SignInDescription.js";
|
|
@@ -21,12 +21,12 @@ import '../../assets/SignInModal.css';const y = "SignInModal-module__trigger___I
|
|
|
21
21
|
overlay: x,
|
|
22
22
|
spacer: b
|
|
23
23
|
}, G = ({ children: l, open: a, setIsOpen: s, onSuccess: e }) => {
|
|
24
|
-
const { cssVariables: t } =
|
|
24
|
+
const { cssVariables: t } = S();
|
|
25
25
|
return /* @__PURE__ */ o(g, { open: a, onOpenChange: s, children: [
|
|
26
26
|
/* @__PURE__ */ i(m, { asChild: !0, children: l || /* @__PURE__ */ i(r, { variant: "primary", className: n.trigger, children: "Sign In" }) }),
|
|
27
27
|
/* @__PURE__ */ i(_, { children: /* @__PURE__ */ o(d, { className: n.overlay, style: t, children: [
|
|
28
28
|
/* @__PURE__ */ i("div", { className: n.spacer }),
|
|
29
|
-
/* @__PURE__ */ i(c, { className: n.modal, children: /* @__PURE__ */ o(
|
|
29
|
+
/* @__PURE__ */ i(c, { className: n.modal, children: /* @__PURE__ */ o(f, { onSuccess: e, className: n["sign-in"], children: [
|
|
30
30
|
/* @__PURE__ */ i(p, { asChild: !0, children: /* @__PURE__ */ i(
|
|
31
31
|
r,
|
|
32
32
|
{
|
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 {
|
|
15
|
-
import {
|
|
16
|
-
import { isEmailInvalid as
|
|
17
|
-
import {
|
|
18
|
-
import { SignInDescription as
|
|
19
|
-
import { SignInForm as
|
|
20
|
-
import { SignInImage as
|
|
21
|
-
import { SignInTitle as
|
|
22
|
-
import { useSignInContext as
|
|
3
|
+
import { SendTransactionButton as f } from "./components/SendTransactionButton/index.js";
|
|
4
|
+
import { SignOutButton as x } from "./components/SignOutButton/index.js";
|
|
5
|
+
import { SignInModal as c } from "./components/SignInModal/index.js";
|
|
6
|
+
import { cssVariables as l } from "./theme/cssVariables.js";
|
|
7
|
+
import { theme as g } from "./theme/theme.js";
|
|
8
|
+
import { colors as u, colorsBase as C, colorsComponents as d, colorsSemantic as h, font as k, tokens as T } from "./theme/tokens.js";
|
|
9
|
+
import { flattenTokensObject as E, themeToCssVariables as b } from "./theme/utils.js";
|
|
10
|
+
import { IconCheckCircle as A } from "./icons/IconCheckCircle.js";
|
|
11
|
+
import { IconExclamationCircle as P } from "./icons/IconExclamationCircle.js";
|
|
12
|
+
import { IconLock as F } from "./icons/IconLock.js";
|
|
13
|
+
import { IconXMark as R } from "./icons/IconXMark.js";
|
|
14
|
+
import { getMessageFromUnknownError as j } from "./utils/getMessageFromUnknownError.js";
|
|
15
|
+
import { isApiError as L } from "./utils/isApiError.js";
|
|
16
|
+
import { isEmailInvalid as X } from "./utils/isEmailInvalid.js";
|
|
17
|
+
import { SignIn as y } from "./components/SignIn/index.js";
|
|
18
|
+
import { SignInDescription as G } from "./components/SignIn/SignInDescription.js";
|
|
19
|
+
import { SignInForm as J } from "./components/SignIn/SignInForm.js";
|
|
20
|
+
import { SignInImage as N } from "./components/SignIn/SignInImage.js";
|
|
21
|
+
import { SignInTitle as W } from "./components/SignIn/SignInTitle.js";
|
|
22
|
+
import { useSignInContext as Z } from "./components/SignIn/SignInProvider.js";
|
|
23
|
+
import { useSignInReducer as $ } from "./components/SignIn/useSignInReducer.js";
|
|
24
|
+
import { ThemeProvider as ro, useTheme as eo } from "./components/ThemeProvider/index.js";
|
|
23
25
|
export {
|
|
24
26
|
m as AuthButton,
|
|
25
27
|
e as CDPReactProvider,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
A as IconCheckCircle,
|
|
29
|
+
P as IconExclamationCircle,
|
|
30
|
+
F as IconLock,
|
|
31
|
+
R as IconXMark,
|
|
32
|
+
f as SendTransactionButton,
|
|
33
|
+
y as SignIn,
|
|
34
|
+
G as SignInDescription,
|
|
35
|
+
J as SignInForm,
|
|
36
|
+
N as SignInImage,
|
|
37
|
+
c as SignInModal,
|
|
38
|
+
W as SignInTitle,
|
|
39
|
+
x as SignOutButton,
|
|
40
|
+
ro as ThemeProvider,
|
|
41
|
+
u as colors,
|
|
42
|
+
C as colorsBase,
|
|
43
|
+
d as colorsComponents,
|
|
44
|
+
h as colorsSemantic,
|
|
45
|
+
l as cssVariables,
|
|
46
|
+
E as flattenTokensObject,
|
|
47
|
+
k as font,
|
|
48
|
+
j as getMessageFromUnknownError,
|
|
49
|
+
L as isApiError,
|
|
50
|
+
X as isEmailInvalid,
|
|
51
|
+
g as theme,
|
|
52
|
+
b as themeToCssVariables,
|
|
53
|
+
T as tokens,
|
|
50
54
|
t as useAppConfig,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
Z as useSignInContext,
|
|
56
|
+
$ as useSignInReducer,
|
|
57
|
+
eo 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.16",
|
|
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.16",
|
|
13
|
+
"@coinbase/cdp-hooks": "^0.0.16"
|
|
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.16",
|
|
42
|
+
"@coinbase/cdp-hooks": "^0.0.16"
|
|
43
43
|
},
|
|
44
44
|
"size-limit": [
|
|
45
45
|
{
|