@coinbase/cdp-react 0.0.76 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,89 +1,52 @@
1
- import { jsx as p, jsxs as H } from "react/jsx-runtime";
2
- import { OAuth2ProviderType as S, CDPContext as U, CDPHooksProvider as _ } from "@coinbase/cdp-hooks";
3
- import { lazy as E, createContext as j, useContext as m, useMemo as L } from "react";
4
- import { ThemeProvider as F } from "../ThemeProvider/index.js";
5
- const k = E(() => import("../OAuthStatusModal/index.js")), I = (t) => {
1
+ import { jsx as c, jsxs as y } from "react/jsx-runtime";
2
+ import { OAuth2ProviderType as w, CDPContext as O, CDPHooksProvider as H } from "@coinbase/cdp-hooks";
3
+ import { lazy as N, createContext as T, useContext as m, useMemo as g } from "react";
4
+ import { ThemeProvider as b } from "../ThemeProvider/index.js";
5
+ const D = N(() => import("../OAuthStatusModal/index.js")), l = (o) => {
6
6
  try {
7
- return JSON.stringify(t);
7
+ return JSON.stringify(o);
8
8
  } catch {
9
9
  }
10
10
  return "";
11
- }, J = Object.keys(S).map((t) => `oauth:${t}`), V = [
11
+ }, S = Object.keys(w).map((o) => `oauth:${o}`), U = [
12
12
  /** Email OTP method */
13
13
  "email",
14
14
  /** SMS OTP method */
15
15
  "sms"
16
- ], G = [...V, ...J], K = ({
17
- children: t,
16
+ ], J = [...U, ...S], V = ({
17
+ children: o,
18
18
  className: r = "",
19
19
  config: n,
20
20
  name: s,
21
21
  style: a,
22
22
  theme: i
23
23
  }) => {
24
- const {
25
- appName: h,
26
- appLogoUrl: c,
27
- showCoinbaseFooter: u,
28
- authMethods: e,
29
- projectId: d,
30
- secureIframeBasePath: C,
31
- useMock: l,
32
- debugging: f,
33
- basePath: A,
34
- ethereum: y,
35
- solana: b,
36
- disableAnalytics: O,
37
- customAuth: P
38
- } = n, { createOnLogin: M } = y ?? {}, { createOnLogin: v } = b ?? {}, w = L(
39
- () => ({
40
- projectId: d,
41
- useMock: l,
42
- debugging: f,
43
- basePath: A,
44
- secureIframeBasePath: C,
45
- disableAnalytics: O,
46
- customAuth: P,
47
- ethereum: { createOnLogin: M },
48
- solana: { createOnLogin: v }
49
- }),
50
- [
51
- d,
52
- l,
53
- f,
54
- A,
55
- C,
56
- M,
57
- v,
58
- O,
59
- P
60
- ]
61
- ), N = { appName: h, appLogoUrl: c, showCoinbaseFooter: u, authMethods: e }, T = e?.some((D) => D.startsWith("oauth:")), x = /* @__PURE__ */ p(z, { name: s, config: N, children: /* @__PURE__ */ H(F, { className: r, style: a, theme: i, children: [
62
- t,
63
- T && /* @__PURE__ */ p(k, {})
24
+ const { appName: h, appLogoUrl: p, showCoinbaseFooter: u, authMethods: t, ...d } = n, A = l(d), M = g(() => d, [A]), P = { appName: h, appLogoUrl: p, showCoinbaseFooter: u, authMethods: t }, v = t?.some((x) => x.startsWith("oauth:")), f = /* @__PURE__ */ c(L, { name: s, config: P, children: /* @__PURE__ */ y(b, { className: r, style: a, theme: i, children: [
25
+ o,
26
+ v && /* @__PURE__ */ c(D, {})
64
27
  ] }) });
65
- return m(U) ? x : /* @__PURE__ */ p(_, { config: w, children: x });
66
- }, g = j(
28
+ return m(O) ? f : /* @__PURE__ */ c(H, { config: M, children: f });
29
+ }, C = T(
67
30
  void 0
68
- ), o = {
31
+ ), e = {
69
32
  appName: "",
70
33
  appLogoUrl: "",
71
34
  showCoinbaseFooter: !0,
72
35
  authMethods: ["email"]
73
- }, z = ({
74
- children: t,
36
+ }, L = ({
37
+ children: o,
75
38
  config: r,
76
39
  name: n
77
40
  }) => {
78
41
  const {
79
- appName: s = o.appName,
80
- appLogoUrl: a = o.appLogoUrl,
81
- showCoinbaseFooter: i = o.showCoinbaseFooter,
82
- authMethods: h = o.authMethods
83
- } = r ?? {}, c = I(h), u = L(() => {
84
- let e = ["email"];
42
+ appName: s = e.appName,
43
+ appLogoUrl: a = e.appLogoUrl,
44
+ showCoinbaseFooter: i = e.showCoinbaseFooter,
45
+ authMethods: h = e.authMethods
46
+ } = r ?? {}, p = l(h), u = g(() => {
47
+ let t = ["email"];
85
48
  try {
86
- e = JSON.parse(c);
49
+ t = JSON.parse(p);
87
50
  } catch {
88
51
  }
89
52
  return {
@@ -91,28 +54,28 @@ const k = E(() => import("../OAuthStatusModal/index.js")), I = (t) => {
91
54
  appName: s,
92
55
  appLogoUrl: a,
93
56
  showCoinbaseFooter: i,
94
- authMethods: Array.isArray(e) && e?.length ? e : o.authMethods
57
+ authMethods: Array.isArray(t) && t?.length ? t : e.authMethods
95
58
  },
96
59
  name: n
97
60
  };
98
- }, [s, a, i, c, n]);
99
- return /* @__PURE__ */ p(g.Provider, { value: u, children: t });
100
- }, Q = () => {
101
- const t = m(g);
102
- if (!t)
61
+ }, [s, a, i, p, n]);
62
+ return /* @__PURE__ */ c(C.Provider, { value: u, children: o });
63
+ }, z = () => {
64
+ const o = m(C);
65
+ if (!o)
103
66
  throw new Error("useAppConfig must be used within an AppConfigProvider");
104
- return t.app;
105
- }, X = () => {
106
- const t = m(g);
107
- if (!t)
67
+ return o.app;
68
+ }, K = () => {
69
+ const o = m(C);
70
+ if (!o)
108
71
  throw new Error("useProviderName must be used within an AppConfigProvider");
109
- return t.name ?? "";
72
+ return o.name ?? "";
110
73
  };
111
74
  export {
112
- G as ALL_AUTH_METHODS,
113
- V as AUTH_METHODS,
114
- K as CDPReactProvider,
115
- J as OAUTH_METHODS,
116
- Q as useAppConfig,
117
- X as useProviderName
75
+ J as ALL_AUTH_METHODS,
76
+ U as AUTH_METHODS,
77
+ V as CDPReactProvider,
78
+ S as OAUTH_METHODS,
79
+ z as useAppConfig,
80
+ K as useProviderName
118
81
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.76";
1
+ export declare const VERSION = "0.0.77";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.0.76";
1
+ const o = "0.0.77";
2
2
  export {
3
3
  o as VERSION
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">=18.2.0 <19.2.0",
18
- "@coinbase/cdp-hooks": "^0.0.76",
19
- "@coinbase/cdp-core": "^0.0.76"
18
+ "@coinbase/cdp-core": "^0.0.77",
19
+ "@coinbase/cdp-hooks": "^0.0.77"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -47,8 +47,8 @@
47
47
  "vite": "^7.0.4",
48
48
  "vite-plugin-dts": "^4.5.4",
49
49
  "vite-plugin-lib-inject-css": "^2.2.2",
50
- "@coinbase/cdp-core": "^0.0.76",
51
- "@coinbase/cdp-hooks": "^0.0.76"
50
+ "@coinbase/cdp-core": "^0.0.77",
51
+ "@coinbase/cdp-hooks": "^0.0.77"
52
52
  },
53
53
  "size-limit": [
54
54
  {