@coinbase/cdp-react 0.0.15 → 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 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 { Input as I } from "../Input/index.js";
5
- import { Error as v } from "../Error/index.js";
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
- I,
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(v, { id: u, children: i })
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,6 +1,6 @@
1
- import { ApiError } from '../../utils/isApiError';
1
+ import { APIError } from '@coinbase/cdp-hooks';
2
2
  interface Props {
3
- error: string | ApiError;
3
+ error: string | APIError;
4
4
  id?: string;
5
5
  className?: string;
6
6
  }
@@ -1,11 +1,12 @@
1
- import { jsx as i } from "react/jsx-runtime";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import "@coinbase/cdp-hooks";
2
3
  import { forwardRef as t } from "react";
3
- import { isApiError as p } from "../../utils/isApiError.js";
4
- import { Error as f } from "../Error/index.js";
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 s = p(r) ? r.errorMessage : r;
8
- return /* @__PURE__ */ i(f, { ref: m, id: o, className: e, children: s });
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";
@@ -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 { withValidityState as q } from "../Input/index.js";
8
- import { LoadingSpinner as D } from "../LoadingSpinner/index.js";
9
- import { OTP as W } from "../OTP/index.js";
10
- import { ServerError as C } from "../ServerError/index.js";
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 { LoadingSpinner as q } from "../LoadingSpinner/index.js";
9
+ import { OTP as D } from "../OTP/index.js";
10
+ import { ServerError as O } from "../ServerError/index.js";
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";
14
14
  import { isApiError as T } from "../../utils/isApiError.js";
15
- import { isEmailInvalid as j } from "../../utils/isEmailInvalid.js";
15
+ import { isEmailInvalid as $ } from "../../utils/isEmailInvalid.js";
16
16
  import { useSignInContext as E } from "./SignInProvider.js";
17
- import { Button as O } from "../Button/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
- [j, "Use a valid email address"]
48
+ [$, "Use a valid email address"]
49
49
  ],
50
- children: q({
50
+ children: j({
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(C, { error: i.error, className: n["server-error"] }),
63
- /* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(O, { type: "submit", isPending: i.isPending, children: "Continue with email" }) })
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
- W,
85
+ D,
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(D, { className: n["loading-spinner"] }),
102
- e.error && /* @__PURE__ */ o(C, { error: e.error, className: n["server-error"] })
101
+ e.isPending && !e.canResetOTP && /* @__PURE__ */ o(q, { 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
- O,
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(Q, { children: [
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($, { className: n.icon }),
190
+ /* @__PURE__ */ o(Z, { className: n.icon }),
191
191
  /* @__PURE__ */ s("p", { children: [
192
192
  "Secured by",
193
193
  " ",
194
- /* @__PURE__ */ o(Z, { className: n["coinbase-icon"], "aria-label": "Coinbase" })
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 c } from "./SignInForm.js";
5
- import { SignInImage as p } from "./SignInImage.js";
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(p, {}),
16
+ /* @__PURE__ */ n(c, {}),
16
17
  /* @__PURE__ */ n(f, {}),
17
18
  /* @__PURE__ */ n(g, {}),
18
- /* @__PURE__ */ n(c, { onSuccess: e })
19
+ /* @__PURE__ */ n(p, { onSuccess: e })
19
20
  ] })
20
21
  ] });
21
- }, C = (i) => /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(l, { ...i }) });
22
+ }, F = (i) => /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(l, { ...i }) });
22
23
  export {
23
- C as SignIn,
24
+ F as SignIn,
24
25
  g as SignInDescription,
25
- c as SignInForm,
26
- p as SignInImage,
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 { ApiError } from '../../utils/isApiError';
1
+ import { APIError } from '@coinbase/cdp-hooks';
2
2
  export interface SignInState {
3
3
  canResetOTP: boolean;
4
4
  email: string;
5
- error: string | ApiError | null;
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 | ApiError;
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 | ApiError;
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 o = (r) => n(l, r);
47
+ const s = (r) => n(l, r);
47
48
  export {
48
- o as useSignInReducer
49
+ s as useSignInReducer
49
50
  };
@@ -2,13 +2,13 @@ import { jsxs as o, jsx as i } from "react/jsx-runtime";
2
2
  import { Dialog as g, DialogTrigger as m, 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 { SignIn as S } from "../SignIn/index.js";
6
- import { useTheme as f } from "../ThemeProvider/index.js";
5
+ import { Button as r } from "../Button/index.js";
6
+ import { useTheme as S } from "../ThemeProvider/index.js";
7
+ import { SignIn as f } from "../SignIn/index.js";
7
8
  import { SignInImage as M } from "../SignIn/SignInImage.js";
8
9
  import { SignInTitle as D } from "../SignIn/SignInTitle.js";
9
10
  import { SignInDescription as v } from "../SignIn/SignInDescription.js";
10
11
  import { SignInForm as N } from "../SignIn/SignInForm.js";
11
- import { Button as r } from "../Button/index.js";
12
12
  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
13
  trigger: y,
14
14
  modal: C,
@@ -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 } = f();
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(S, { onSuccess: e, className: n["sign-in"], children: [
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
  {
@@ -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 { SignIn as i } from "./components/SignIn/index.js";
4
- import { useSignInReducer as x } from "./components/SignIn/useSignInReducer.js";
5
- import { SignOutButton as c } from "./components/SignOutButton/index.js";
6
- import { SignInModal as l } from "./components/SignInModal/index.js";
7
- import { ThemeProvider as g, useTheme as S } from "./components/ThemeProvider/index.js";
8
- import { cssVariables as C } from "./theme/cssVariables.js";
9
- import { theme as d } from "./theme/theme.js";
10
- import { colors as T, colorsBase as b, colorsComponents as v, colorsSemantic as A, font as B, tokens as E } from "./theme/tokens.js";
11
- import { flattenTokensObject as D, themeToCssVariables as M } from "./theme/utils.js";
12
- import { IconCheckCircle as R } from "./icons/IconCheckCircle.js";
13
- import { IconExclamationCircle as j } from "./icons/IconExclamationCircle.js";
14
- import { IconLock as L } from "./icons/IconLock.js";
15
- import { IconXMark as q } from "./icons/IconXMark.js";
16
- import { isEmailInvalid as y } from "./utils/isEmailInvalid.js";
17
- import { isApiError as G } from "./utils/isApiError.js";
18
- import { SignInDescription as J } from "./components/SignIn/SignInDescription.js";
19
- import { SignInForm as N } from "./components/SignIn/SignInForm.js";
20
- import { SignInImage as U } from "./components/SignIn/SignInImage.js";
21
- import { SignInTitle as Y } from "./components/SignIn/SignInTitle.js";
22
- import { useSignInContext as _ } from "./components/SignIn/SignInProvider.js";
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
- R as IconCheckCircle,
27
- j as IconExclamationCircle,
28
- L as IconLock,
29
- q as IconXMark,
30
- i as SignIn,
31
- J as SignInDescription,
32
- N as SignInForm,
33
- U as SignInImage,
34
- l as SignInModal,
35
- Y as SignInTitle,
36
- c as SignOutButton,
37
- g as ThemeProvider,
38
- T as colors,
39
- b as colorsBase,
40
- v as colorsComponents,
41
- A as colorsSemantic,
42
- C as cssVariables,
43
- D as flattenTokensObject,
44
- B as font,
45
- G as isApiError,
46
- y as isEmailInvalid,
47
- d as theme,
48
- M as themeToCssVariables,
49
- E as tokens,
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
- _ as useSignInContext,
52
- x as useSignInReducer,
53
- S as useTheme
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
+ };
@@ -1,2 +1,3 @@
1
- export * from './isEmailInvalid';
1
+ export * from './getMessageFromUnknownError';
2
2
  export * from './isApiError';
3
+ export * from './isEmailInvalid';
@@ -1,6 +1,8 @@
1
- import { isEmailInvalid as o } from "./isEmailInvalid.js";
2
- import { isApiError as p } from "./isApiError.js";
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
- p as isApiError,
5
- o as isEmailInvalid
5
+ e as getMessageFromUnknownError,
6
+ m as isApiError,
7
+ p as isEmailInvalid
6
8
  };
@@ -1,6 +1,2 @@
1
- export interface ApiError extends Error {
2
- errorLink?: string;
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;
@@ -1,4 +1,5 @@
1
- const e = (r) => r instanceof Error && "errorMessage" in r && "errorType" in r;
1
+ import { APIError as o } from "@coinbase/cdp-hooks";
2
+ const i = (r) => r instanceof o;
2
3
  export {
3
- e as isApiError
4
+ i as isApiError
4
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.15",
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.15",
13
- "@coinbase/cdp-hooks": "^0.0.15"
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.15",
42
- "@coinbase/cdp-hooks": "^0.0.15"
41
+ "@coinbase/cdp-core": "^0.0.16",
42
+ "@coinbase/cdp-hooks": "^0.0.16"
43
43
  },
44
44
  "size-limit": [
45
45
  {