@coinbase/cdp-react 0.0.45 → 0.0.47

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.
Files changed (31) hide show
  1. package/dist/assets/Error.css +1 -1
  2. package/dist/assets/OAuthStatusModal.css +1 -0
  3. package/dist/chunks/index.Bvudzh_y.js +17 -0
  4. package/dist/components/CDPReactProvider/index.d.ts +7 -3
  5. package/dist/components/CDPReactProvider/index.js +66 -48
  6. package/dist/components/OAuthStatusModal/index.d.ts +6 -0
  7. package/dist/components/OAuthStatusModal/index.js +130 -0
  8. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +1 -0
  9. package/dist/components/SignIn/SignInAuthMethodButtons.js +48 -26
  10. package/dist/components/SignIn/SignInDescription.js +1 -1
  11. package/dist/components/SignIn/SignInForm.js +1 -1
  12. package/dist/components/SignIn/SignInTitle.js +1 -1
  13. package/dist/components/SignIn/flows/SignInWithOAuth.d.ts +5 -0
  14. package/dist/components/SignIn/flows/SignInWithOAuth.js +34 -0
  15. package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +10 -0
  16. package/dist/components/SignIn/hooks/useSignInWithOAuth.js +30 -0
  17. package/dist/components/forms/AmountInput/index.d.ts +1 -1
  18. package/dist/components/forms/ExchangeAmountInput/index.d.ts +1 -1
  19. package/dist/components/ui/Error/index.js +10 -9
  20. package/dist/components/ui/Modal/index.js +4 -4
  21. package/dist/icons/IconGoogleColorLogo.d.ts +2 -0
  22. package/dist/icons/IconGoogleColorLogo.js +44 -0
  23. package/dist/icons/IconGoogleLogo.d.ts +2 -0
  24. package/dist/icons/IconGoogleLogo.js +13 -0
  25. package/dist/index.js +99 -96
  26. package/dist/utils/capitalize.d.ts +1 -0
  27. package/dist/utils/capitalize.js +6 -0
  28. package/dist/utils/toOAuthProviderType.d.ts +2 -0
  29. package/dist/utils/toOAuthProviderType.js +8 -0
  30. package/package.json +12 -12
  31. package/dist/chunks/index.BzllgVaP.js +0 -12
@@ -1 +1 @@
1
- .Error-module__error___zeTQt{color:var(--cdp-web-colors-fg-negative);line-height:1.25em;font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);display:flex;align-items:center;gap:.25em;margin:0}.Error-module__error___zeTQt span{font-size:.875em}.Error-module__icon___uwkis{width:auto;height:.875em;flex-grow:0;flex-shrink:0}
1
+ .Error-module__error___zeTQt{color:var(--cdp-web-colors-fg-negative);line-height:1.25em;font-family:var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);display:flex;gap:.25em;margin:0}.Error-module__text___wQxPI{font-size:.875em}.Error-module__icon___uwkis{width:.875em;height:1.25em;flex-grow:0;flex-shrink:0}
@@ -0,0 +1 @@
1
+ .OAuthStatusModal-module__oauth-status-modal___I69Ii{box-sizing:border-box;font:var(--cdp-web-font-size-base) / 1.5 var(--cdp-web-font-family-body);font-size:var(--cdp-web-font-size-base);font-optical-sizing:auto;background-color:var(--cdp-web-colors-page-bg-default);color:var(--cdp-web-colors-page-text-default);display:flex;flex-direction:column;align-items:center;justify-content:stretch;max-width:38.25em;padding:1em 2em;overflow:hidden;width:100%;height:100dvh;max-height:27.75em}.OAuthStatusModal-module__transition-wrapper___TmPRh,.OAuthStatusModal-module__status___vU6x7{display:flex;flex-direction:column;align-items:center;justify-content:center;flex-grow:1;text-align:center}.OAuthStatusModal-module__status___vU6x7{width:100%;height:100%}.OAuthStatusModal-module__graphic___2fKoa{display:flex;align-items:center;justify-content:center;position:relative}.OAuthStatusModal-module__pad___oooMz{padding:.5em}.OAuthStatusModal-module__spinner___Q3dYq{width:5em;height:5em;margin:-.5em;color:var(--cdp-web-colors-line-primary)}.OAuthStatusModal-module__icon___Lj5Gf{color:var(--cdp-web-colors-page-text-default);position:absolute;display:flex;align-items:center;justify-content:center;width:2em;height:2em;top:50%;left:50%;transform:translate(-50%,-50%)}.OAuthStatusModal-module__icon___Lj5Gf svg{width:100%;height:auto}.OAuthStatusModal-module__icon-success___gqMWr svg{color:var(--cdp-web-colors-fg-positive)}.OAuthStatusModal-module__icon-error___psI7m svg{color:var(--cdp-web-colors-fg-negative)}.OAuthStatusModal-module__subhead___Pg9GI{font-size:1.25em;line-height:1.2;font-weight:600;margin:1em 0 .25em}.OAuthStatusModal-module__description___0qOZY{font-size:1.125em;font-variant-numeric:tabular-nums;color:var(--cdp-web-colors-page-text-muted);line-height:1.5;font-weight:400;margin:0 0 1em}.OAuthStatusModal-module__description___0qOZY:last-child{margin-bottom:0}.OAuthStatusModal-module__ring___mKwSb{border-radius:9999em;border:3px solid transparent;display:block;width:4em;height:4em}.OAuthStatusModal-module__ring-success___unyM9{border-color:var(--cdp-web-colors-line-positive)}.OAuthStatusModal-module__ring-error___OsgqU{border-color:var(--cdp-web-colors-line-negative)}.OAuthStatusModal-module__invisible___IeRd0{visibility:hidden}
@@ -0,0 +1,17 @@
1
+ import { OAuth2ProviderType as t } from "@coinbase/cdp-hooks";
2
+ import "../components/CDPReactProvider/index.js";
3
+ import { config as i } from "../components/SignIn/flows/SignInWithEmail.js";
4
+ import { config as m } from "../components/SignIn/flows/SignInWithSms.js";
5
+ import "react";
6
+ import { config as e } from "../components/SignIn/flows/SignInWithOAuth.js";
7
+ const s = Object.keys(t).reduce(
8
+ (o, r) => (o[`oauth:${r.toLowerCase()}`] = e, o),
9
+ {}
10
+ ), g = {
11
+ ...s,
12
+ email: i,
13
+ sms: m
14
+ };
15
+ export {
16
+ g as a
17
+ };
@@ -1,7 +1,9 @@
1
- import { Config as CDPHooksConfig } from '@coinbase/cdp-hooks';
1
+ import { Config as CDPHooksConfig, OAuth2ProviderType } from '@coinbase/cdp-hooks';
2
2
  import { ThemeProviderProps } from '../ThemeProvider';
3
+ export declare const OAUTH_METHODS: string[];
3
4
  export declare const AUTH_METHODS: readonly ["email", "sms"];
4
- export type AuthMethod = (typeof AUTH_METHODS)[number];
5
+ export declare const ALL_AUTH_METHODS: string[];
6
+ export type AuthMethod = (typeof AUTH_METHODS)[number] | `oauth:${OAuth2ProviderType}`;
5
7
  export interface AppConfig {
6
8
  appName?: string;
7
9
  appLogoUrl?: string;
@@ -11,6 +13,8 @@ export interface AppConfig {
11
13
  export type Config = AppConfig & CDPHooksConfig;
12
14
  export type CDPReactProviderProps = {
13
15
  config: Config;
16
+ name?: string;
14
17
  } & ThemeProviderProps;
15
- export declare const CDPReactProvider: ({ children, config, theme }: CDPReactProviderProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const CDPReactProvider: ({ children, config, name, theme }: CDPReactProviderProps) => import("react/jsx-runtime").JSX.Element;
16
19
  export declare const useAppConfig: () => Required<AppConfig>;
20
+ export declare const useProviderName: () => string;
@@ -1,77 +1,95 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { CDPContext as L, CDPHooksProvider as O } from "@coinbase/cdp-hooks";
3
- import { createContext as v, useMemo as f, useContext as l } from "react";
4
- import { ThemeProvider as b } from "../ThemeProvider/index.js";
5
- const w = (o) => {
1
+ import { jsx as h, jsxs as y } from "react/jsx-runtime";
2
+ import { OAuth2ProviderType as b, CDPContext as N, CDPHooksProvider as T } from "@coinbase/cdp-hooks";
3
+ import { lazy as D, createContext as H, useContext as m, useMemo as O } from "react";
4
+ import { ThemeProvider as S } from "../ThemeProvider/index.js";
5
+ const U = D(() => import("../OAuthStatusModal/index.js")), _ = (o) => {
6
6
  try {
7
7
  return JSON.stringify(o);
8
8
  } catch {
9
9
  }
10
10
  return "";
11
- }, T = [
11
+ }, E = Object.keys(b).map((o) => `oauth:${o}`), j = [
12
12
  /** Email OTP method */
13
13
  "email",
14
14
  /** SMS OTP method */
15
15
  "sms"
16
- ], _ = ({ children: o, config: r, theme: n }) => {
16
+ ], R = [...j, ...E], W = ({ children: o, config: n, name: s, theme: a }) => {
17
17
  const {
18
- appName: a,
19
- appLogoUrl: s,
20
- showCoinbaseFooter: h,
21
- authMethods: i,
22
- projectId: p,
23
- useMock: e,
24
- debugging: u,
25
- basePath: g,
26
- ethereum: P,
27
- solana: x
28
- } = r, { createOnLogin: d } = P ?? {}, { createOnLogin: C } = x ?? {}, A = f(
18
+ appName: i,
19
+ appLogoUrl: p,
20
+ showCoinbaseFooter: u,
21
+ authMethods: e,
22
+ projectId: c,
23
+ useMock: t,
24
+ debugging: d,
25
+ basePath: C,
26
+ ethereum: M,
27
+ solana: P
28
+ } = n, { createOnLogin: l } = M ?? {}, { createOnLogin: f } = P ?? {}, v = O(
29
29
  () => ({
30
- projectId: p,
31
- useMock: e,
32
- debugging: u,
33
- basePath: g,
34
- ethereum: { createOnLogin: d },
35
- solana: { createOnLogin: C }
30
+ projectId: c,
31
+ useMock: t,
32
+ debugging: d,
33
+ basePath: C,
34
+ ethereum: { createOnLogin: l },
35
+ solana: { createOnLogin: f }
36
36
  }),
37
- [p, e, u, g, d, C]
38
- ), m = /* @__PURE__ */ c(y, { config: { appName: a, appLogoUrl: s, showCoinbaseFooter: h, authMethods: i }, children: /* @__PURE__ */ c(b, { theme: n, children: o }) });
39
- return l(L) ? m : /* @__PURE__ */ c(O, { config: A, children: m });
40
- }, M = v(void 0), t = {
37
+ [c, t, d, C, l, f]
38
+ ), x = { appName: i, appLogoUrl: p, showCoinbaseFooter: u, authMethods: e }, L = e?.some((w) => w.startsWith("oauth:")), A = /* @__PURE__ */ h(F, { name: s, config: x, children: /* @__PURE__ */ y(S, { theme: a, children: [
39
+ o,
40
+ L && /* @__PURE__ */ h(U, {})
41
+ ] }) });
42
+ return m(N) ? A : /* @__PURE__ */ h(T, { config: v, children: A });
43
+ }, g = H(
44
+ void 0
45
+ ), r = {
41
46
  appName: "",
42
47
  appLogoUrl: "",
43
48
  showCoinbaseFooter: !0,
44
49
  authMethods: ["email"]
45
- }, y = ({ children: o, config: r }) => {
50
+ }, F = ({
51
+ children: o,
52
+ config: n,
53
+ name: s
54
+ }) => {
46
55
  const {
47
- appName: n = t.appName,
48
- appLogoUrl: a = t.appLogoUrl,
49
- showCoinbaseFooter: s = t.showCoinbaseFooter,
50
- authMethods: h = t.authMethods
51
- } = r ?? {}, i = w(h), p = f(() => {
52
- let e = ["email"];
56
+ appName: a = r.appName,
57
+ appLogoUrl: i = r.appLogoUrl,
58
+ showCoinbaseFooter: p = r.showCoinbaseFooter,
59
+ authMethods: u = r.authMethods
60
+ } = n ?? {}, e = _(u), c = O(() => {
61
+ let t = ["email"];
53
62
  try {
54
- e = JSON.parse(i);
63
+ t = JSON.parse(e);
55
64
  } catch {
56
65
  }
57
66
  return {
58
67
  app: {
59
- appName: n,
60
- appLogoUrl: a,
61
- showCoinbaseFooter: s,
62
- authMethods: Array.isArray(e) && e?.length ? e : t.authMethods
63
- }
68
+ appName: a,
69
+ appLogoUrl: i,
70
+ showCoinbaseFooter: p,
71
+ authMethods: Array.isArray(t) && t?.length ? t : r.authMethods
72
+ },
73
+ name: s
64
74
  };
65
- }, [n, a, s, i]);
66
- return /* @__PURE__ */ c(M.Provider, { value: p, children: o });
67
- }, j = () => {
68
- const o = l(M);
75
+ }, [a, i, p, e, s]);
76
+ return /* @__PURE__ */ h(g.Provider, { value: c, children: o });
77
+ }, $ = () => {
78
+ const o = m(g);
69
79
  if (!o)
70
80
  throw new Error("useAppConfig must be used within an AppConfigProvider");
71
81
  return o.app;
82
+ }, q = () => {
83
+ const o = m(g);
84
+ if (!o)
85
+ throw new Error("useProviderName must be used within an AppConfigProvider");
86
+ return o.name ?? "";
72
87
  };
73
88
  export {
74
- T as AUTH_METHODS,
75
- _ as CDPReactProvider,
76
- j as useAppConfig
89
+ R as ALL_AUTH_METHODS,
90
+ j as AUTH_METHODS,
91
+ W as CDPReactProvider,
92
+ E as OAUTH_METHODS,
93
+ $ as useAppConfig,
94
+ q as useProviderName
77
95
  };
@@ -0,0 +1,6 @@
1
+ type OAuthStatusModalContentProps = {
2
+ handleClose: () => void;
3
+ };
4
+ export declare const OAuthStatusModal: () => import("react/jsx-runtime").JSX.Element;
5
+ export declare const OAuthStatusModalContent: ({ handleClose }: OAuthStatusModalContentProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default OAuthStatusModal;
@@ -0,0 +1,130 @@
1
+ import { jsx as s, jsxs as o, Fragment as l } from "react/jsx-runtime";
2
+ import "@coinbase/cdp-core";
3
+ import { useOAuthState as O } from "@coinbase/cdp-hooks";
4
+ import { useState as b, useEffect as u, useRef as S, useCallback as v } from "react";
5
+ import { useProviderName as I } from "../CDPReactProvider/index.js";
6
+ import { OAUTH_PROVIDER_SESSION_STORAGE_KEY as g } from "../SignIn/hooks/useSignInWithOAuth.js";
7
+ import { CoinbaseFooter as C } from "../ui/CoinbaseFooter/index.js";
8
+ import { LoadingSpinner as T } from "../ui/LoadingSpinner/index.js";
9
+ import { Modal as $, ModalContent as w, ModalTitle as E, ModalDescription as P } from "../ui/Modal/index.js";
10
+ import { SwitchFadeTransition as R } from "../ui/SwitchFadeTransition/index.js";
11
+ import { VisuallyHidden as f } from "../ui/VisuallyHidden/index.js";
12
+ import { useTimer as y } from "../../hooks/useTimer.js";
13
+ import { IconCheck as k } from "../../icons/IconCheck.js";
14
+ import { IconGoogleColorLogo as U } from "../../icons/IconGoogleColorLogo.js";
15
+ import { IconXMark as q } from "../../icons/IconXMark.js";
16
+ import { capitalize as d } from "../../utils/capitalize.js";
17
+ import '../../assets/OAuthStatusModal.css';const x = "OAuthStatusModal-module__status___vU6x7", G = "OAuthStatusModal-module__graphic___2fKoa", H = "OAuthStatusModal-module__pad___oooMz", K = "OAuthStatusModal-module__spinner___Q3dYq", j = "OAuthStatusModal-module__icon___Lj5Gf", D = "OAuthStatusModal-module__subhead___Pg9GI", F = "OAuthStatusModal-module__description___0qOZY", L = "OAuthStatusModal-module__ring___mKwSb", Y = "OAuthStatusModal-module__invisible___IeRd0", t = {
18
+ "oauth-status-modal": "OAuthStatusModal-module__oauth-status-modal___I69Ii",
19
+ "transition-wrapper": "OAuthStatusModal-module__transition-wrapper___TmPRh",
20
+ status: x,
21
+ graphic: G,
22
+ pad: H,
23
+ spinner: K,
24
+ icon: j,
25
+ "icon-success": "OAuthStatusModal-module__icon-success___gqMWr",
26
+ "icon-error": "OAuthStatusModal-module__icon-error___psI7m",
27
+ subhead: D,
28
+ description: F,
29
+ ring: L,
30
+ "ring-success": "OAuthStatusModal-module__ring-success___unyM9",
31
+ "ring-error": "OAuthStatusModal-module__ring-error___OsgqU",
32
+ invisible: Y
33
+ }, z = ["pending", "success", "error"], pt = () => {
34
+ const [n, e] = b(!1), { oauthState: a } = O(), r = I();
35
+ return u(() => {
36
+ if (a?.status === "pending") {
37
+ const c = sessionStorage.getItem(g);
38
+ if (c === null || c !== r)
39
+ return;
40
+ sessionStorage.removeItem(g), e(!0);
41
+ }
42
+ }, [a, r]), /* @__PURE__ */ s($, { open: n, onOpenChange: e, children: /* @__PURE__ */ o(w, { children: [
43
+ /* @__PURE__ */ s(f, { children: /* @__PURE__ */ s(E, { children: "OAuth Status" }) }),
44
+ /* @__PURE__ */ s(f, { children: /* @__PURE__ */ o(P, { children: [
45
+ "Sign in with ",
46
+ d(r),
47
+ " ",
48
+ a?.status ? `${a?.status === "success" ? "successful" : a?.status === "error" ? "failed" : "pending"}` : ""
49
+ ] }) }),
50
+ /* @__PURE__ */ s(V, { handleClose: () => e(!1) })
51
+ ] }) });
52
+ }, V = ({ handleClose: n }) => {
53
+ const { oauthState: e } = O(), a = e?.providerType || "google", { timeRemaining: r, start: c, reset: m } = y(), _ = S(null), h = S(null), A = 250, p = v((i) => {
54
+ h.current === i || i === void 0 || (h.current = i, _.current?.transition.toggle(i));
55
+ }, []);
56
+ return u(() => {
57
+ p(e?.status), e?.status === "success" && c(3);
58
+ }, [e?.status, p, c]), u(() => {
59
+ r !== null && r <= 0 && (m(), n());
60
+ }, [r, m, n]), /* @__PURE__ */ o("div", { className: t["oauth-status-modal"], children: [
61
+ /* @__PURE__ */ s(
62
+ R,
63
+ {
64
+ animateHeight: !1,
65
+ timeout: A,
66
+ items: z,
67
+ initialEntered: !0,
68
+ transitionRef: _,
69
+ className: t["transition-wrapper"],
70
+ children: ({ itemKey: i, ...M }) => {
71
+ const N = X[i];
72
+ return /* @__PURE__ */ s("div", { ...M, className: t.status, children: /* @__PURE__ */ s(N, { timeRemaining: r, provider: a }) });
73
+ }
74
+ }
75
+ ),
76
+ /* @__PURE__ */ s(C, {})
77
+ ] });
78
+ }, W = ({ provider: n }) => {
79
+ const e = Z[n];
80
+ return /* @__PURE__ */ o(l, { children: [
81
+ /* @__PURE__ */ o("div", { className: t.graphic, children: [
82
+ /* @__PURE__ */ s(
83
+ T,
84
+ {
85
+ strokeWidth: "5%",
86
+ staticStroke: !0,
87
+ staticStrokeColor: "var(--cdp-web-colors-line-default)",
88
+ className: t.spinner
89
+ }
90
+ ),
91
+ e && /* @__PURE__ */ s("span", { className: t.icon, children: /* @__PURE__ */ s(e, {}) })
92
+ ] }),
93
+ /* @__PURE__ */ o("p", { className: t.subhead, children: [
94
+ "Signing in with ",
95
+ d(n)
96
+ ] }),
97
+ /* @__PURE__ */ s("p", { className: t.description, children: "Just a moment..." })
98
+ ] });
99
+ }, J = ({ timeRemaining: n, provider: e }) => /* @__PURE__ */ o(l, { children: [
100
+ /* @__PURE__ */ o("div", { className: t.graphic, children: [
101
+ /* @__PURE__ */ s("span", { className: `${t.ring} ${t["ring-success"]}` }),
102
+ /* @__PURE__ */ s("span", { className: `${t.icon} ${t["icon-success"]}`, children: /* @__PURE__ */ s(k, {}) })
103
+ ] }),
104
+ /* @__PURE__ */ o("p", { className: t.subhead, children: [
105
+ "Signed in with ",
106
+ d(e)
107
+ ] }),
108
+ /* @__PURE__ */ o("p", { className: `${t.description} ${n === null ? t.invisible : ""}`, children: [
109
+ "This window will automatically close in ",
110
+ n ?? "soon"
111
+ ] })
112
+ ] }), Q = () => /* @__PURE__ */ o(l, { children: [
113
+ /* @__PURE__ */ o("div", { className: `${t.graphic} ${t.pad}`, children: [
114
+ /* @__PURE__ */ s("span", { className: `${t.ring} ${t["ring-error"]}` }),
115
+ /* @__PURE__ */ s("span", { className: `${t.icon} ${t["icon-error"]}`, children: /* @__PURE__ */ s(q, {}) })
116
+ ] }),
117
+ /* @__PURE__ */ s("p", { className: t.subhead, children: "Sign in failed" }),
118
+ /* @__PURE__ */ s("p", { className: t.description, children: "Something went wrong. Please try again." })
119
+ ] }), X = {
120
+ pending: W,
121
+ success: J,
122
+ error: Q
123
+ }, Z = {
124
+ google: U
125
+ };
126
+ export {
127
+ pt as OAuthStatusModal,
128
+ V as OAuthStatusModalContent,
129
+ pt as default
130
+ };
@@ -5,6 +5,7 @@ export interface SignInAuthMethodButtonProps {
5
5
  label: string;
6
6
  ariaLabel?: string;
7
7
  icon: ReactNode;
8
+ isPending?: boolean;
8
9
  onClick: () => void;
9
10
  }
10
11
  export interface SignInAuthMethodButtonsProps {
@@ -1,59 +1,81 @@
1
- import { jsx as n, jsxs as i } from "react/jsx-runtime";
2
- import { useMemo as c } from "react";
3
- import { useAppConfig as d } from "../CDPReactProvider/index.js";
4
- import { useSignInContext as m } from "./SignInProvider.js";
5
- import { Button as _ } from "../ui/Button/index.js";
6
- import { IconEnvelope as b } from "../../icons/IconEnvelope.js";
7
- import { IconPhone as p } from "../../icons/IconPhone.js";
8
- import '../../assets/SignInAuthMethodButtons.css';const f = "SignInAuthMethodButtons-module__divider___zphEh", o = {
1
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
2
+ import { useCallback as I, useMemo as v } from "react";
3
+ import { useAppConfig as y } from "../CDPReactProvider/index.js";
4
+ import { useSignInWithOAuth as S } from "./hooks/useSignInWithOAuth.js";
5
+ import { useSignInContext as M } from "./SignInProvider.js";
6
+ import { Button as C } from "../ui/Button/index.js";
7
+ import { ServerError as k } from "../ui/ServerError/index.js";
8
+ import { IconEnvelope as B } from "../../icons/IconEnvelope.js";
9
+ import { IconGoogleLogo as E } from "../../icons/IconGoogleLogo.js";
10
+ import { IconPhone as P } from "../../icons/IconPhone.js";
11
+ import { toOAuthProviderType as _ } from "../../utils/toOAuthProviderType.js";
12
+ import '../../assets/SignInAuthMethodButtons.css';const O = "SignInAuthMethodButtons-module__divider___zphEh", o = {
9
13
  "auth-method-buttons": "SignInAuthMethodButtons-module__auth-method-buttons___jYEH7",
10
14
  "auth-btn": "SignInAuthMethodButtons-module__auth-btn___o1a09",
11
15
  "auth-btn-icon": "SignInAuthMethodButtons-module__auth-btn-icon___VjvFY",
12
16
  "auth-btn-label": "SignInAuthMethodButtons-module__auth-btn-label___mEWd3",
13
- divider: f
14
- }, r = {
17
+ divider: O
18
+ }, b = {
15
19
  email: {
16
20
  label: "Continue with email",
17
- icon: /* @__PURE__ */ n(b, {})
21
+ icon: /* @__PURE__ */ n(B, {})
18
22
  },
19
23
  sms: {
20
24
  label: "Continue with phone",
21
- icon: /* @__PURE__ */ n(p, {})
25
+ icon: /* @__PURE__ */ n(P, {})
26
+ },
27
+ "oauth:google": {
28
+ label: "Continue with Google",
29
+ icon: /* @__PURE__ */ n(E, {})
22
30
  }
23
- }, S = ({ activeMethod: a }) => {
24
- const { authMethods: u } = d(), { dispatch: l } = m(), e = c(() => (u || ["email"]).map((t) => {
25
- if (!r[t])
31
+ }, z = ({ activeMethod: u }) => {
32
+ const { authMethods: a } = y(), {
33
+ signInWithOAuth: s,
34
+ isPending: l,
35
+ error: h,
36
+ oauthProvider: c
37
+ } = S(), d = I(
38
+ async (t) => {
39
+ const e = _(t);
40
+ e && s(e);
41
+ },
42
+ [s]
43
+ ), { dispatch: m } = M(), i = v(() => (a || ["email"]).map((t) => {
44
+ if (!b[t])
26
45
  return null;
27
- const { label: s, icon: h } = r[t];
46
+ const { label: e, icon: g } = b[t], p = t.startsWith("oauth:"), f = p ? () => d(t) : () => m({ type: "SET_AUTH_METHOD", payload: { authMethod: t } }), A = p && c.current === _(t) && l;
28
47
  return {
29
48
  key: t,
30
- label: s,
31
- icon: h,
32
- onClick: () => l({ type: "SET_AUTH_METHOD", payload: { authMethod: t } })
49
+ label: e,
50
+ icon: g,
51
+ onClick: f,
52
+ isPending: A
33
53
  };
34
- }).filter((t) => t !== null), [u, l]);
35
- return !e.length || e.length === 1 && e[0].key === a ? null : /* @__PURE__ */ i("div", { className: o["auth-method-buttons"], children: [
36
- /* @__PURE__ */ i("div", { className: o.divider, children: [
54
+ }).filter((t) => t !== null), [a, m, d, l, c]);
55
+ return !i.length || i.length === 1 && i[0].key === u ? null : /* @__PURE__ */ r("div", { className: o["auth-method-buttons"], children: [
56
+ /* @__PURE__ */ r("div", { className: o.divider, children: [
37
57
  /* @__PURE__ */ n("hr", {}),
38
58
  /* @__PURE__ */ n("span", { children: "or" })
39
59
  ] }),
40
- e.map((t) => t.key === a ? null : /* @__PURE__ */ i(
41
- _,
60
+ i.map((t) => t.key === u ? null : /* @__PURE__ */ r(
61
+ C,
42
62
  {
43
63
  "aria-label": t.ariaLabel,
44
64
  className: o["auth-btn"],
45
65
  type: "button",
46
66
  variant: "secondary",
47
67
  onClick: t.onClick,
68
+ isPending: t.isPending,
48
69
  children: [
49
70
  /* @__PURE__ */ n("span", { className: o["auth-btn-icon"], children: t.icon }),
50
71
  /* @__PURE__ */ n("span", { className: o["auth-btn-label"], children: t.label })
51
72
  ]
52
73
  },
53
74
  t.key
54
- ))
75
+ )),
76
+ h && /* @__PURE__ */ n(k, { error: h })
55
77
  ] });
56
78
  };
57
79
  export {
58
- S as SignInAuthMethodButtons
80
+ z as SignInAuthMethodButtons
59
81
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import "react";
3
- import { a as d } from "../../chunks/index.BzllgVaP.js";
3
+ import { a as d } from "../../chunks/index.Bvudzh_y.js";
4
4
  import { useSignInContext as h } from "./SignInProvider.js";
5
5
  import "@coinbase/cdp-hooks";
6
6
  import "../CDPReactProvider/index.js";
@@ -2,7 +2,7 @@ import { jsx as a } from "react/jsx-runtime";
2
2
  import { useRef as d, useState as _, useLayoutEffect as p } from "react";
3
3
  import { useAppConfig as I } from "../CDPReactProvider/index.js";
4
4
  import { SwitchFadeTransition as T } from "../ui/SwitchFadeTransition/index.js";
5
- import { a as y } from "../../chunks/index.BzllgVaP.js";
5
+ import { a as y } from "../../chunks/index.Bvudzh_y.js";
6
6
  import { useSignInContext as v } from "./SignInProvider.js";
7
7
  import "@coinbase/cdp-hooks";
8
8
  import '../../assets/SignInForm.css';const E = {
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import "react";
3
- import { a as c } from "../../chunks/index.BzllgVaP.js";
3
+ import { a as c } from "../../chunks/index.Bvudzh_y.js";
4
4
  import { useSignInContext as d } from "./SignInProvider.js";
5
5
  import "@coinbase/cdp-hooks";
6
6
  import "../CDPReactProvider/index.js";
@@ -0,0 +1,5 @@
1
+ import { SignInFlowProps, SignInFlowConfig } from '../types';
2
+ export declare const SignInWithOAuth: ({ step, children }: SignInFlowProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const SignInWithOAuthTitle: () => string;
4
+ export declare const SignInWithOAuthDescription: () => string;
5
+ export declare const config: SignInFlowConfig;
@@ -0,0 +1,34 @@
1
+ import { jsxs as c, Fragment as l, jsx as r } from "react/jsx-runtime";
2
+ import { useCallback as a } from "react";
3
+ import { useAppConfig as u } from "../../CDPReactProvider/index.js";
4
+ import { useSignInWithOAuth as A } from "../hooks/useSignInWithOAuth.js";
5
+ import { Button as S } from "../../ui/Button/index.js";
6
+ import { ServerError as O } from "../../ui/ServerError/index.js";
7
+ import { capitalize as m } from "../../../utils/capitalize.js";
8
+ import { toOAuthProviderType as p } from "../../../utils/toOAuthProviderType.js";
9
+ import "@coinbase/cdp-hooks";
10
+ const W = ({ step: o, children: t }) => {
11
+ const { authMethods: n } = u(), d = n?.[0], i = p(d), { signInWithOAuth: e, isPending: g, error: s } = A(), f = a(() => {
12
+ i && e(i);
13
+ }, [i, e]), h = /* @__PURE__ */ c(l, { children: [
14
+ /* @__PURE__ */ c(S, { fullWidth: !0, onClick: f, type: "submit", isPending: g, children: [
15
+ "Continue with ",
16
+ m(i)
17
+ ] }),
18
+ s && /* @__PURE__ */ r("div", { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ r(O, { error: s }) })
19
+ ] });
20
+ return /* @__PURE__ */ r("div", { children: t ? t({ step: o, Form: h }) : h });
21
+ }, v = () => "Sign in", I = () => {
22
+ const { authMethods: o } = u(), t = o?.[0], n = p(t);
23
+ return `Sign in with your ${m(n)} account.`;
24
+ }, F = {
25
+ description: I,
26
+ forms: W,
27
+ title: v
28
+ };
29
+ export {
30
+ W as SignInWithOAuth,
31
+ I as SignInWithOAuthDescription,
32
+ v as SignInWithOAuthTitle,
33
+ F as config
34
+ };
@@ -0,0 +1,10 @@
1
+ import { OAuth2ProviderType, APIError } from '@coinbase/cdp-hooks';
2
+ import { RefObject } from 'react';
3
+ export declare const OAUTH_PROVIDER_SESSION_STORAGE_KEY = "cdp-react-sign-in-with-oauth-provider-name";
4
+ export type UseSignInWithOAuthReturnType = {
5
+ error: string | APIError | null;
6
+ isPending: boolean;
7
+ oauthProvider: RefObject<OAuth2ProviderType | null>;
8
+ signInWithOAuth: (providerType: OAuth2ProviderType) => Promise<void>;
9
+ };
10
+ export declare const useSignInWithOAuth: () => UseSignInWithOAuthReturnType;
@@ -0,0 +1,30 @@
1
+ import { useSignInWithOAuth as h } from "@coinbase/cdp-hooks";
2
+ import { useState as c, useRef as m, useCallback as I } from "react";
3
+ import { useProviderName as f } from "../../CDPReactProvider/index.js";
4
+ import { isApiError as A } from "../../../utils/isApiError.js";
5
+ const O = "cdp-react-sign-in-with-oauth-provider-name", W = () => {
6
+ const { signInWithOAuth: e } = h(), [r, s] = c(!1), [g, o] = c(null), i = f(), a = m(null), u = "An error occurred while signing in. Please try again.";
7
+ return {
8
+ signInWithOAuth: I(
9
+ async (t) => {
10
+ if (!r) {
11
+ a.current = t, s(!0), o(null);
12
+ try {
13
+ await e(t === "apple" ? "google" : t), sessionStorage.setItem(O, i);
14
+ } catch (n) {
15
+ const l = A(n) ? n : n instanceof Error && n.message || u;
16
+ o(l), s(!1), console.error(n);
17
+ }
18
+ }
19
+ },
20
+ [r, e, i]
21
+ ),
22
+ oauthProvider: a,
23
+ isPending: r,
24
+ error: g
25
+ };
26
+ };
27
+ export {
28
+ O as OAUTH_PROVIDER_SESSION_STORAGE_KEY,
29
+ W as useSignInWithOAuth
30
+ };
@@ -1,3 +1,3 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  import { AmountInputProps } from './types';
3
- export declare const AmountInput: import('react').ForwardRefExoticComponent<AmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "inputMode" | "onChange" | "max" | "min"> & import('react').RefAttributes<HTMLInputElement>>;
3
+ export declare const AmountInput: import('react').ForwardRefExoticComponent<AmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "max" | "min" | "onChange" | "inputMode"> & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,3 +1,3 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  import { ExchangeAmountInputProps } from './types';
3
- export declare const ExchangeAmountInput: import('react').ForwardRefExoticComponent<ExchangeAmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "inputMode" | "onChange" | "max" | "min"> & import('react').RefAttributes<HTMLInputElement>>;
3
+ export declare const ExchangeAmountInput: import('react').ForwardRefExoticComponent<ExchangeAmountInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "type" | "max" | "min" | "onChange" | "inputMode"> & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,13 +1,14 @@
1
- import { jsxs as m, jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as t } from "react";
1
+ import { jsxs as m, jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as n } from "react";
3
3
  import { IconExclamationCircle as a } from "../../../icons/IconExclamationCircle.js";
4
- import '../../../assets/Error.css';const _ = "Error-module__error___zeTQt", l = "Error-module__icon___uwkis", o = {
5
- error: _,
6
- icon: l
7
- }, p = t(
8
- ({ children: e, id: s, className: c = "", ...n }, i) => /* @__PURE__ */ m("p", { id: s, className: `${o.error} ${c}`, ref: i, ...n, children: [
9
- /* @__PURE__ */ r(a, { className: o.icon }),
10
- /* @__PURE__ */ r("span", { children: e })
4
+ import '../../../assets/Error.css';const i = "Error-module__error___zeTQt", l = "Error-module__text___wQxPI", x = "Error-module__icon___uwkis", r = {
5
+ error: i,
6
+ text: l,
7
+ icon: x
8
+ }, p = n(
9
+ ({ children: e, id: t, className: s = "", ...c }, _) => /* @__PURE__ */ m("p", { id: t, className: `${r.error} ${s}`, ref: _, ...c, children: [
10
+ /* @__PURE__ */ o(a, { className: r.icon }),
11
+ /* @__PURE__ */ o("span", { className: r.text, children: e })
11
12
  ] })
12
13
  );
13
14
  p.displayName = "Error";
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as t } from "react/jsx-runtime";
2
- import { DialogPortal as i, DialogOverlay as c, DialogContent as d, Dialog as n, DialogClose as m, DialogDescription as _, DialogTitle as g, DialogTrigger as p } from "@radix-ui/react-dialog";
2
+ import { Dialog as i, DialogTitle as c, DialogDescription as d, DialogPortal as n, DialogOverlay as m, DialogContent as _, DialogClose as g, DialogTrigger as p } from "@radix-ui/react-dialog";
3
3
  import { forwardRef as M } from "react";
4
4
  import { useTheme as D } from "../../ThemeProvider/index.js";
5
5
  import '../../../assets/Modal.css';const f = "Modal-module__modal___MUsZA", y = "Modal-module__overlay___-RqGQ", v = "Modal-module__spacer___dIfOA", l = {
@@ -9,14 +9,14 @@ import '../../../assets/Modal.css';const f = "Modal-module__modal___MUsZA", y =
9
9
  }, u = M(
10
10
  ({ children: a, ...e }, s) => {
11
11
  const { cssVariables: r } = D();
12
- return /* @__PURE__ */ o(i, { children: /* @__PURE__ */ t(c, { className: l.overlay, style: r, children: [
12
+ return /* @__PURE__ */ o(n, { children: /* @__PURE__ */ t(m, { className: l.overlay, style: r, children: [
13
13
  /* @__PURE__ */ o("div", { className: l.spacer }),
14
- /* @__PURE__ */ o(d, { ...e, ref: s, className: l.modal, children: a })
14
+ /* @__PURE__ */ o(_, { ...e, ref: s, className: l.modal, children: a })
15
15
  ] }) });
16
16
  }
17
17
  );
18
18
  u.displayName = "ModalContent";
19
- const x = n, j = m, A = _, O = g, R = p;
19
+ const x = i, j = g, A = d, O = c, R = p;
20
20
  export {
21
21
  x as Modal,
22
22
  j as ModalClose,
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare const IconGoogleColorLogo: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsxs as o, jsx as l } from "react/jsx-runtime";
2
+ import "react";
3
+ import { SvgIcon as d } from "./SvgIcon.js";
4
+ const p = (e) => /* @__PURE__ */ o(d, { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", ...e, children: [
5
+ /* @__PURE__ */ l(
6
+ "path",
7
+ {
8
+ fillRule: "evenodd",
9
+ clipRule: "evenodd",
10
+ d: "M32 16.3637C32 15.2292 31.8961 14.1383 31.7032 13.091H16.3265V19.2801H25.1132C24.7347 21.2801 23.5844 22.9747 21.8553 24.1092V28.1237H27.1317C30.2189 25.3383 32 21.2365 32 16.3637Z",
11
+ fill: "#4285F4"
12
+ }
13
+ ),
14
+ /* @__PURE__ */ l(
15
+ "path",
16
+ {
17
+ fillRule: "evenodd",
18
+ clipRule: "evenodd",
19
+ d: "M16.3265 32C20.7347 32 24.4304 30.5674 27.1317 28.1237L21.8553 24.1092C20.3933 25.0692 18.5232 25.6364 16.3265 25.6364C12.0742 25.6364 8.47497 22.8218 7.19111 19.04H1.73656V23.1855C4.42302 28.4145 9.94436 32 16.3265 32Z",
20
+ fill: "#34A853"
21
+ }
22
+ ),
23
+ /* @__PURE__ */ l(
24
+ "path",
25
+ {
26
+ fillRule: "evenodd",
27
+ clipRule: "evenodd",
28
+ d: "M7.19111 19.04C6.86458 18.08 6.67904 17.0546 6.67904 16.0001C6.67904 14.9455 6.86457 13.9201 7.1911 12.9601V8.81463H1.73655C0.630798 10.9746 0 13.4183 0 16.0001C0 18.5819 0.630805 21.0254 1.73656 23.1855L7.19111 19.04Z",
29
+ fill: "#FBBC05"
30
+ }
31
+ ),
32
+ /* @__PURE__ */ l(
33
+ "path",
34
+ {
35
+ fillRule: "evenodd",
36
+ clipRule: "evenodd",
37
+ d: "M16.3265 6.36364C18.7236 6.36364 20.8757 7.17091 22.5677 8.75637L27.2505 4.16728C24.423 1.58546 20.7273 0 16.3265 0C9.94436 0 4.42301 3.58554 1.73655 8.81463L7.1911 12.9601C8.47496 9.17827 12.0742 6.36364 16.3265 6.36364Z",
38
+ fill: "#EA4335"
39
+ }
40
+ )
41
+ ] });
42
+ export {
43
+ p as IconGoogleColorLogo
44
+ };
@@ -0,0 +1,2 @@
1
+ import { SVGProps } from 'react';
2
+ export declare const IconGoogleLogo: (props: Omit<SVGProps<SVGSVGElement>, "viewBox">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import "react";
3
+ import { SvgIcon as r } from "./SvgIcon.js";
4
+ const n = (C) => /* @__PURE__ */ o(r, { width: "20", height: "20", viewBox: "0 0 20 20", ...C, children: /* @__PURE__ */ o(
5
+ "path",
6
+ {
7
+ d: "M14.0229 5.47276C12.9867 4.48185 11.6683 3.9773 10.2002 3.9773C7.59563 3.9773 5.39102 5.7364 4.60468 8.10005C4.40449 8.70007 4.29096 9.34099 4.29096 10.0001C4.29096 10.6592 4.40449 11.3001 4.60448 11.9001C5.39102 14.2636 7.59563 16.0227 10.2002 16.0227C11.5456 16.0227 12.6911 15.6682 13.5865 15.0684C14.6454 14.3593 15.35 13.3002 15.5819 12.0502H10.2V8.18197H19.6182C19.7364 8.83652 19.8001 9.51834 19.8001 10.2274C19.8001 13.2729 18.7092 15.8366 16.8183 17.5775C15.1638 19.1045 12.9002 20 10.2002 20C6.2911 20 2.90932 17.7591 1.2636 14.491C0.586306 13.141 0.199951 11.6137 0.199951 10.0001C0.199951 8.38644 0.586306 6.85915 1.2638 5.50913C2.90932 2.24092 6.2911 0 10.2002 0C12.8958 0 15.1594 0.990915 16.8911 2.60456L14.0229 5.47276Z",
8
+ fill: "currentColor"
9
+ }
10
+ ) });
11
+ export {
12
+ n as IconGoogleLogo
13
+ };
package/dist/index.js CHANGED
@@ -1,101 +1,104 @@
1
- import { AUTH_METHODS as e, CDPReactProvider as t, useAppConfig as n } from "./components/CDPReactProvider/index.js";
2
- import { AuthButton as p } from "./components/AuthButton/index.js";
3
- import { Fund as x, FundFooter as i } from "./components/Fund/index.js";
4
- import { FundModal as s } from "./components/FundModal/index.js";
5
- import { SendEvmTransactionButton as u } from "./components/SendEvmTransactionButton/index.js";
6
- import { SendSolanaTransactionButton as l } from "./components/SendSolanaTransactionButton/index.js";
7
- import { SignIn as S } from "./components/SignIn/index.js";
8
- import { useSignInReducer as C } from "./components/SignIn/useSignInReducer.js";
9
- import { SignOutButton as F } from "./components/SignOutButton/index.js";
10
- import { SignInModal as k } from "./components/SignInModal/index.js";
11
- import { ThemeProvider as E, useTheme as b } from "./components/ThemeProvider/index.js";
12
- import { cssVariables as v } from "./theme/cssVariables.js";
13
- import { theme as w } from "./theme/theme.js";
14
- import { borderRadius as P, borderRadiusComponents as R, borderRadiusSemantic as O, colors as U, colorsBase as V, colorsComponents as H, colorsSemantic as L, font as j, fontComponents as N, fontSemantic as X, tokens as _ } from "./theme/tokens.js";
15
- import { flattenTokensObject as y, themeToCssVariables as z } from "./theme/utils.js";
16
- import { IconArrowLeft as J } from "./icons/IconArrowLeft.js";
17
- import { IconArrowsUpDown as Q } from "./icons/IconArrowsUpDown.js";
18
- import { IconCheck as Y } from "./icons/IconCheck.js";
19
- import { IconCheckCircle as $ } from "./icons/IconCheckCircle.js";
20
- import { IconChevronDown as ro } from "./icons/IconChevronDown.js";
21
- import { IconEnvelope as to } from "./icons/IconEnvelope.js";
22
- import { IconExclamationCircle as mo } from "./icons/IconExclamationCircle.js";
23
- import { IconExclamationTriangle as fo } from "./icons/IconExclamationTriangle.js";
24
- import { IconLock as io } from "./icons/IconLock.js";
25
- import { IconPhone as so } from "./icons/IconPhone.js";
26
- import { IconXMark as uo } from "./icons/IconXMark.js";
27
- import { clamp as lo } from "./utils/clamp.js";
28
- import { getMessageFromUnknownError as go } from "./utils/getMessageFromUnknownError.js";
29
- import { isApiError as ho } from "./utils/isApiError.js";
30
- import { isEmailInvalid as To } from "./utils/isEmailInvalid.js";
31
- import { parseValuesFromPhoneNumber as Bo } from "./utils/parseValuesFromPhoneNumber.js";
32
- import { FundForm as bo } from "./components/Fund/FundForm.js";
33
- import { FundTitle as vo } from "./components/Fund/FundTitle.js";
34
- import { useFundContext as wo } from "./components/Fund/FundProvider.js";
35
- import { SignInAuthMethodButtons as Po } from "./components/SignIn/SignInAuthMethodButtons.js";
36
- import { SignInBackButton as Oo } from "./components/SignIn/SignInBackButton.js";
1
+ import { ALL_AUTH_METHODS as e, AUTH_METHODS as t, CDPReactProvider as n, OAUTH_METHODS as m, useAppConfig as p, useProviderName as f } from "./components/CDPReactProvider/index.js";
2
+ import { AuthButton as i } from "./components/AuthButton/index.js";
3
+ import { Fund as s, FundFooter as c } from "./components/Fund/index.js";
4
+ import { FundModal as I } from "./components/FundModal/index.js";
5
+ import { SendEvmTransactionButton as l } from "./components/SendEvmTransactionButton/index.js";
6
+ import { SendSolanaTransactionButton as g } from "./components/SendSolanaTransactionButton/index.js";
7
+ import { SignIn as C } from "./components/SignIn/index.js";
8
+ import { useSignInReducer as F } from "./components/SignIn/useSignInReducer.js";
9
+ import { SignOutButton as E } from "./components/SignOutButton/index.js";
10
+ import { SignInModal as B } from "./components/SignInModal/index.js";
11
+ import { ThemeProvider as b, useTheme as v } from "./components/ThemeProvider/index.js";
12
+ import { cssVariables as H } from "./theme/cssVariables.js";
13
+ import { theme as P } from "./theme/theme.js";
14
+ import { borderRadius as R, borderRadiusComponents as U, borderRadiusSemantic as L, colors as _, colorsBase as V, colorsComponents as N, colorsSemantic as j, font as X, fontComponents as q, fontSemantic as y, tokens as z } from "./theme/tokens.js";
15
+ import { flattenTokensObject as J, themeToCssVariables as K } from "./theme/utils.js";
16
+ import { IconArrowLeft as W } from "./icons/IconArrowLeft.js";
17
+ import { IconArrowsUpDown as Z } from "./icons/IconArrowsUpDown.js";
18
+ import { IconCheck as oo } from "./icons/IconCheck.js";
19
+ import { IconCheckCircle as eo } from "./icons/IconCheckCircle.js";
20
+ import { IconChevronDown as no } from "./icons/IconChevronDown.js";
21
+ import { IconEnvelope as po } from "./icons/IconEnvelope.js";
22
+ import { IconExclamationCircle as xo } from "./icons/IconExclamationCircle.js";
23
+ import { IconExclamationTriangle as ao } from "./icons/IconExclamationTriangle.js";
24
+ import { IconLock as co } from "./icons/IconLock.js";
25
+ import { IconPhone as Io } from "./icons/IconPhone.js";
26
+ import { IconXMark as So } from "./icons/IconXMark.js";
27
+ import { clamp as To } from "./utils/clamp.js";
28
+ import { getMessageFromUnknownError as ho } from "./utils/getMessageFromUnknownError.js";
29
+ import { isApiError as Ao } from "./utils/isApiError.js";
30
+ import { isEmailInvalid as ko } from "./utils/isEmailInvalid.js";
31
+ import { parseValuesFromPhoneNumber as Mo } from "./utils/parseValuesFromPhoneNumber.js";
32
+ import { FundForm as vo } from "./components/Fund/FundForm.js";
33
+ import { FundTitle as Ho } from "./components/Fund/FundTitle.js";
34
+ import { useFundContext as Po } from "./components/Fund/FundProvider.js";
35
+ import { SignInAuthMethodButtons as Ro } from "./components/SignIn/SignInAuthMethodButtons.js";
36
+ import { SignInBackButton as Lo } from "./components/SignIn/SignInBackButton.js";
37
37
  import { SignInDescription as Vo } from "./components/SignIn/SignInDescription.js";
38
- import { SignInFooter as Lo } from "./components/SignIn/SignInFooter.js";
39
- import { SignInForm as No } from "./components/SignIn/SignInForm.js";
40
- import { SignInImage as _o } from "./components/SignIn/SignInImage.js";
41
- import { SignInTitle as yo } from "./components/SignIn/SignInTitle.js";
42
- import { useSignInContext as Go } from "./components/SignIn/SignInProvider.js";
38
+ import { SignInFooter as jo } from "./components/SignIn/SignInFooter.js";
39
+ import { SignInForm as qo } from "./components/SignIn/SignInForm.js";
40
+ import { SignInImage as zo } from "./components/SignIn/SignInImage.js";
41
+ import { SignInTitle as Jo } from "./components/SignIn/SignInTitle.js";
42
+ import { useSignInContext as Qo } from "./components/SignIn/SignInProvider.js";
43
43
  export {
44
- e as AUTH_METHODS,
45
- p as AuthButton,
46
- t as CDPReactProvider,
47
- x as Fund,
48
- i as FundFooter,
49
- bo as FundForm,
50
- s as FundModal,
51
- vo as FundTitle,
52
- J as IconArrowLeft,
53
- Q as IconArrowsUpDown,
54
- Y as IconCheck,
55
- $ as IconCheckCircle,
56
- ro as IconChevronDown,
57
- to as IconEnvelope,
58
- mo as IconExclamationCircle,
59
- fo as IconExclamationTriangle,
60
- io as IconLock,
61
- so as IconPhone,
62
- uo as IconXMark,
63
- u as SendEvmTransactionButton,
64
- l as SendSolanaTransactionButton,
65
- S as SignIn,
66
- Po as SignInAuthMethodButtons,
67
- Oo as SignInBackButton,
44
+ e as ALL_AUTH_METHODS,
45
+ t as AUTH_METHODS,
46
+ i as AuthButton,
47
+ n as CDPReactProvider,
48
+ s as Fund,
49
+ c as FundFooter,
50
+ vo as FundForm,
51
+ I as FundModal,
52
+ Ho as FundTitle,
53
+ W as IconArrowLeft,
54
+ Z as IconArrowsUpDown,
55
+ oo as IconCheck,
56
+ eo as IconCheckCircle,
57
+ no as IconChevronDown,
58
+ po as IconEnvelope,
59
+ xo as IconExclamationCircle,
60
+ ao as IconExclamationTriangle,
61
+ co as IconLock,
62
+ Io as IconPhone,
63
+ So as IconXMark,
64
+ m as OAUTH_METHODS,
65
+ l as SendEvmTransactionButton,
66
+ g as SendSolanaTransactionButton,
67
+ C as SignIn,
68
+ Ro as SignInAuthMethodButtons,
69
+ Lo as SignInBackButton,
68
70
  Vo as SignInDescription,
69
- Lo as SignInFooter,
70
- No as SignInForm,
71
- _o as SignInImage,
72
- k as SignInModal,
73
- yo as SignInTitle,
74
- F as SignOutButton,
75
- E as ThemeProvider,
76
- P as borderRadius,
77
- R as borderRadiusComponents,
78
- O as borderRadiusSemantic,
79
- lo as clamp,
80
- U as colors,
71
+ jo as SignInFooter,
72
+ qo as SignInForm,
73
+ zo as SignInImage,
74
+ B as SignInModal,
75
+ Jo as SignInTitle,
76
+ E as SignOutButton,
77
+ b as ThemeProvider,
78
+ R as borderRadius,
79
+ U as borderRadiusComponents,
80
+ L as borderRadiusSemantic,
81
+ To as clamp,
82
+ _ as colors,
81
83
  V as colorsBase,
82
- H as colorsComponents,
83
- L as colorsSemantic,
84
- v as cssVariables,
85
- y as flattenTokensObject,
86
- j as font,
87
- N as fontComponents,
88
- X as fontSemantic,
89
- go as getMessageFromUnknownError,
90
- ho as isApiError,
91
- To as isEmailInvalid,
92
- Bo as parseValuesFromPhoneNumber,
93
- w as theme,
94
- z as themeToCssVariables,
95
- _ as tokens,
96
- n as useAppConfig,
97
- wo as useFundContext,
98
- Go as useSignInContext,
99
- C as useSignInReducer,
100
- b as useTheme
84
+ N as colorsComponents,
85
+ j as colorsSemantic,
86
+ H as cssVariables,
87
+ J as flattenTokensObject,
88
+ X as font,
89
+ q as fontComponents,
90
+ y as fontSemantic,
91
+ ho as getMessageFromUnknownError,
92
+ Ao as isApiError,
93
+ ko as isEmailInvalid,
94
+ Mo as parseValuesFromPhoneNumber,
95
+ P as theme,
96
+ K as themeToCssVariables,
97
+ z as tokens,
98
+ p as useAppConfig,
99
+ Po as useFundContext,
100
+ f as useProviderName,
101
+ Qo as useSignInContext,
102
+ F as useSignInReducer,
103
+ v as useTheme
101
104
  };
@@ -0,0 +1 @@
1
+ export declare function capitalize(value: string): string;
@@ -0,0 +1,6 @@
1
+ function r(t) {
2
+ return t.length === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1);
3
+ }
4
+ export {
5
+ r as capitalize
6
+ };
@@ -0,0 +1,2 @@
1
+ import { OAuth2ProviderType } from '@coinbase/cdp-hooks';
2
+ export declare function toOAuthProviderType(authMethod: string): OAuth2ProviderType;
@@ -0,0 +1,8 @@
1
+ import { OAuth2ProviderType as o } from "@coinbase/cdp-hooks";
2
+ function p(r) {
3
+ const t = r.startsWith("oauth:") ? r.split(":")[1] : r;
4
+ return o[t];
5
+ }
6
+ export {
7
+ p as toOAuthProviderType
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -13,9 +13,9 @@
13
13
  "react-transition-state": "2.3.0"
14
14
  },
15
15
  "peerDependencies": {
16
- "react": ">=18.2.0",
17
- "@coinbase/cdp-core": "^0.0.45",
18
- "@coinbase/cdp-hooks": "^0.0.45"
16
+ "react": ">=18.2.0 <19.2.0",
17
+ "@coinbase/cdp-core": "^0.0.47",
18
+ "@coinbase/cdp-hooks": "^0.0.47"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -28,15 +28,15 @@
28
28
  "@testing-library/user-event": "^14.6.1",
29
29
  "@types/big.js": "6.2.2",
30
30
  "@types/glob": "^9.0.0",
31
- "@types/react": "^19.1.0",
32
- "@types/react-dom": "^19.1.0",
31
+ "@types/react": "~19.1.0",
32
+ "@types/react-dom": "~19.1.0",
33
33
  "@vitejs/plugin-react": "^4.6.0",
34
34
  "eslint-plugin-css-modules": "^2.12.0",
35
35
  "eslint-plugin-react": "^7.37.5",
36
36
  "eslint-plugin-react-hooks": "^5.2.0",
37
37
  "glob": "^11.0.3",
38
- "react": "^19.1.0",
39
- "react-dom": "^19.1.0",
38
+ "react": "~19.1.0",
39
+ "react-dom": "~19.1.0",
40
40
  "rollup-plugin-visualizer": "^6.0.3",
41
41
  "size-limit": "^11.2.0",
42
42
  "stylelint": "^16.22.0",
@@ -45,8 +45,8 @@
45
45
  "vite": "^7.0.4",
46
46
  "vite-plugin-dts": "^4.5.4",
47
47
  "vite-plugin-lib-inject-css": "^2.2.2",
48
- "@coinbase/cdp-core": "^0.0.45",
49
- "@coinbase/cdp-hooks": "^0.0.45"
48
+ "@coinbase/cdp-core": "^0.0.47",
49
+ "@coinbase/cdp-hooks": "^0.0.47"
50
50
  },
51
51
  "size-limit": [
52
52
  {
@@ -54,14 +54,14 @@
54
54
  "path": "./dist/index.js",
55
55
  "import": "*",
56
56
  "running": false,
57
- "limit": "100 KB"
57
+ "limit": "110 KB"
58
58
  },
59
59
  {
60
60
  "name": "single-component",
61
61
  "path": "./dist/components/SignIn/index.js",
62
62
  "import": "{ SignIn }",
63
63
  "running": false,
64
- "limit": "80 KB"
64
+ "limit": "85 KB"
65
65
  }
66
66
  ],
67
67
  "files": [
@@ -1,12 +0,0 @@
1
- import "../components/CDPReactProvider/index.js";
2
- import { config as o } from "../components/SignIn/flows/SignInWithEmail.js";
3
- import { config as i } from "../components/SignIn/flows/SignInWithSms.js";
4
- import "@coinbase/cdp-hooks";
5
- import "react";
6
- const a = {
7
- email: o,
8
- sms: i
9
- };
10
- export {
11
- a
12
- };