@coinbase/cdp-react 0.0.46 → 0.0.48

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,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { AuthMethod } from '../CDPReactProvider/CDPReactProvider';
2
+ import { AuthMethod } from '../CDPReactProvider';
3
3
  export interface SignInAuthMethodButtonProps {
4
4
  key: AuthMethod;
5
5
  label: string;
@@ -1,5 +1,5 @@
1
1
  import { ElementType, HTMLAttributes, ReactNode } from 'react';
2
- import { AuthMethod } from '../CDPReactProvider/CDPReactProvider';
2
+ import { AuthMethod } from '../CDPReactProvider';
3
3
  import { SignInState } from './types';
4
4
  export interface SignInFormProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
5
5
  as?: ElementType;
@@ -1,34 +1,38 @@
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";
1
+ import { jsxs as h, Fragment as a, jsx as e } from "react/jsx-runtime";
9
2
  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: [
3
+ import { useRef as A, useCallback as S, useEffect as v } from "react";
4
+ import { useAppConfig as m } from "../../CDPReactProvider/index.js";
5
+ import { useSignInWithOAuth as O } from "../hooks/useSignInWithOAuth.js";
6
+ import { Button as W } from "../../ui/Button/index.js";
7
+ import { ServerError as I } from "../../ui/ServerError/index.js";
8
+ import { capitalize as p } from "../../../utils/capitalize.js";
9
+ import { toOAuthProviderType as f } from "../../../utils/toOAuthProviderType.js";
10
+ const y = ({ step: i, children: r }) => {
11
+ const { authMethods: n } = m(), d = n?.[0], t = f(d), { signInWithOAuth: s, isPending: l, error: u } = O(), o = A(t), g = S(() => {
12
+ t && s(t);
13
+ }, [t, s]);
14
+ v(() => {
15
+ t && (o.current = t);
16
+ }, [t]);
17
+ const c = o.current ? /* @__PURE__ */ h(a, { children: [
18
+ /* @__PURE__ */ h(W, { fullWidth: !0, onClick: g, type: "submit", isPending: l, children: [
15
19
  "Continue with ",
16
- m(i)
20
+ p(o.current)
17
21
  ] }),
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
22
+ u && /* @__PURE__ */ e("div", { style: { marginTop: "0.5em" }, children: /* @__PURE__ */ e(I, { error: u }) })
23
+ ] }) : null;
24
+ return /* @__PURE__ */ e("div", { children: r ? r({ step: i, Form: c }) : c });
25
+ }, C = () => "Sign in", M = () => {
26
+ const { authMethods: i } = m(), r = i?.[0], n = f(r);
27
+ return `Sign in with your ${p(n ?? "")} account.`;
28
+ }, R = {
29
+ description: M,
30
+ forms: y,
31
+ title: C
28
32
  };
29
33
  export {
30
- W as SignInWithOAuth,
31
- I as SignInWithOAuthDescription,
32
- v as SignInWithOAuthTitle,
33
- F as config
34
+ y as SignInWithOAuth,
35
+ M as SignInWithOAuthDescription,
36
+ C as SignInWithOAuthTitle,
37
+ R as config
34
38
  };
@@ -1,2 +1,2 @@
1
1
  import { OAuth2ProviderType } from '@coinbase/cdp-hooks';
2
- export declare function toOAuthProviderType(authMethod: string): OAuth2ProviderType;
2
+ export declare function toOAuthProviderType(authMethod: string): OAuth2ProviderType | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@internationalized/number": "3.6.4",
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "peerDependencies": {
16
16
  "react": ">=18.2.0 <19.2.0",
17
- "@coinbase/cdp-core": "^0.0.46",
18
- "@coinbase/cdp-hooks": "^0.0.46"
17
+ "@coinbase/cdp-core": "^0.0.48",
18
+ "@coinbase/cdp-hooks": "^0.0.48"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@size-limit/preset-big-lib": "^11.2.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.46",
49
- "@coinbase/cdp-hooks": "^0.0.46"
48
+ "@coinbase/cdp-core": "^0.0.48",
49
+ "@coinbase/cdp-hooks": "^0.0.48"
50
50
  },
51
51
  "size-limit": [
52
52
  {