@coinbase/cdp-react 0.0.76 → 0.0.78
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
|
|
2
|
-
import { OAuth2ProviderType as
|
|
3
|
-
import { lazy as
|
|
4
|
-
import { ThemeProvider as
|
|
5
|
-
const
|
|
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(
|
|
7
|
+
return JSON.stringify(o);
|
|
8
8
|
} catch {
|
|
9
9
|
}
|
|
10
10
|
return "";
|
|
11
|
-
},
|
|
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
|
-
],
|
|
17
|
-
children:
|
|
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
|
-
|
|
26
|
-
|
|
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(
|
|
66
|
-
},
|
|
28
|
+
return m(O) ? f : /* @__PURE__ */ c(H, { config: M, children: f });
|
|
29
|
+
}, C = T(
|
|
67
30
|
void 0
|
|
68
|
-
),
|
|
31
|
+
), e = {
|
|
69
32
|
appName: "",
|
|
70
33
|
appLogoUrl: "",
|
|
71
34
|
showCoinbaseFooter: !0,
|
|
72
35
|
authMethods: ["email"]
|
|
73
|
-
},
|
|
74
|
-
children:
|
|
36
|
+
}, L = ({
|
|
37
|
+
children: o,
|
|
75
38
|
config: r,
|
|
76
39
|
name: n
|
|
77
40
|
}) => {
|
|
78
41
|
const {
|
|
79
|
-
appName: s =
|
|
80
|
-
appLogoUrl: a =
|
|
81
|
-
showCoinbaseFooter: i =
|
|
82
|
-
authMethods: h =
|
|
83
|
-
} = r ?? {},
|
|
84
|
-
let
|
|
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
|
-
|
|
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(
|
|
57
|
+
authMethods: Array.isArray(t) && t?.length ? t : e.authMethods
|
|
95
58
|
},
|
|
96
59
|
name: n
|
|
97
60
|
};
|
|
98
|
-
}, [s, a, i,
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
},
|
|
101
|
-
const
|
|
102
|
-
if (!
|
|
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
|
|
105
|
-
},
|
|
106
|
-
const
|
|
107
|
-
if (!
|
|
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
|
|
72
|
+
return o.name ?? "";
|
|
110
73
|
};
|
|
111
74
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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.
|
|
1
|
+
export declare const VERSION = "0.0.78";
|
package/dist/version.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.78",
|
|
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-
|
|
19
|
-
"@coinbase/cdp-
|
|
18
|
+
"@coinbase/cdp-core": "^0.0.78",
|
|
19
|
+
"@coinbase/cdp-hooks": "^0.0.78"
|
|
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.
|
|
51
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
50
|
+
"@coinbase/cdp-core": "^0.0.78",
|
|
51
|
+
"@coinbase/cdp-hooks": "^0.0.78"
|
|
52
52
|
},
|
|
53
53
|
"size-limit": [
|
|
54
54
|
{
|