@coinbase/cdp-react 0.0.61 → 0.0.62

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,9 +1,9 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { createContext as h, useContext as m, useMemo as l } from "react";
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { createContext as m, useContext as l, useMemo as i } from "react";
3
3
  import { useAppConfig as f } from "../CDPReactProvider/index.js";
4
4
  import "@coinbase/cdp-hooks";
5
5
  import { useSignInReducer as p } from "./useSignInReducer.js";
6
- const r = {
6
+ const a = {
7
7
  authMethod: "email",
8
8
  authMethods: ["email"],
9
9
  canResetOTP: !1,
@@ -15,28 +15,31 @@ const r = {
15
15
  otp: "",
16
16
  phoneNumber: "",
17
17
  step: "credentials"
18
- }, i = h({
19
- state: r,
18
+ }, u = m({
19
+ state: a,
20
20
  dispatch: () => {
21
21
  }
22
- }), I = () => {
23
- const t = m(i);
22
+ }), M = () => {
23
+ const t = l(u);
24
24
  if (!t)
25
25
  throw new Error("useSignInContext must be used within a SignInProvider");
26
26
  return t;
27
- }, P = ({
27
+ }, v = ({
28
28
  children: t,
29
- authMethods: a
29
+ authMethods: n
30
30
  }) => {
31
- const { authMethods: e } = f(), o = a?.filter((c) => e.includes(c)) ?? e, [n, s] = p({
32
- ...r,
33
- authMethod: o?.[0] || "email",
34
- authMethods: o
35
- }), u = l(() => ({ state: n, dispatch: s }), [n, s]);
36
- return /* @__PURE__ */ d(i.Provider, { value: u, children: t });
31
+ const { authMethods: o } = f(), e = i(() => n?.filter((d) => o.includes(d)) ?? o, [n, o]), [s, r] = p({
32
+ ...a,
33
+ authMethod: e?.[0] || "email",
34
+ authMethods: e
35
+ }), c = i(
36
+ () => ({ state: { ...s, authMethods: e }, dispatch: r }),
37
+ [s, r, e]
38
+ );
39
+ return /* @__PURE__ */ h(u.Provider, { value: c, children: t });
37
40
  };
38
41
  export {
39
- i as SignInContext,
40
- P as SignInProvider,
41
- I as useSignInContext
42
+ u as SignInContext,
43
+ v as SignInProvider,
44
+ M as useSignInContext
42
45
  };
@@ -23,6 +23,11 @@ export type SignInAction = {
23
23
  payload: {
24
24
  authMethod: AuthMethod;
25
25
  };
26
+ } | {
27
+ type: "SET_AUTH_METHODS";
28
+ payload: {
29
+ authMethods: AuthMethod[];
30
+ };
26
31
  } | {
27
32
  type: "SET_EMAIL";
28
33
  payload: {
@@ -1,8 +1,13 @@
1
- import { useReducer as n } from "react";
1
+ import { useReducer as u } from "react";
2
2
  import "@coinbase/cdp-hooks";
3
3
  import "../CDPReactProvider/index.js";
4
4
  function l(e, r) {
5
5
  switch (r.type) {
6
+ case "SET_AUTH_METHODS":
7
+ return {
8
+ ...e,
9
+ authMethods: r.payload.authMethods
10
+ };
6
11
  case "SET_AUTH_METHOD":
7
12
  return {
8
13
  ...e,
@@ -87,7 +92,7 @@ function l(e, r) {
87
92
  throw new Error("Unknown action type");
88
93
  }
89
94
  }
90
- const s = (e) => n(l, e);
95
+ const s = (e) => u(l, e);
91
96
  export {
92
97
  s as useSignInReducer
93
98
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
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-core": "^0.0.61",
19
- "@coinbase/cdp-hooks": "^0.0.61"
18
+ "@coinbase/cdp-core": "^0.0.62",
19
+ "@coinbase/cdp-hooks": "^0.0.62"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@size-limit/preset-big-lib": "^11.2.0",
@@ -46,8 +46,8 @@
46
46
  "vite": "^7.0.4",
47
47
  "vite-plugin-dts": "^4.5.4",
48
48
  "vite-plugin-lib-inject-css": "^2.2.2",
49
- "@coinbase/cdp-core": "^0.0.61",
50
- "@coinbase/cdp-hooks": "^0.0.61"
49
+ "@coinbase/cdp-core": "^0.0.62",
50
+ "@coinbase/cdp-hooks": "^0.0.62"
51
51
  },
52
52
  "size-limit": [
53
53
  {