@coinbase/cdp-react 0.0.29 → 0.0.31

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.
package/README.md CHANGED
@@ -8,6 +8,8 @@ the CDP frontend SDK.
8
8
  - {@link SignOutButton | `SignOutButton`} - a sign out button
9
9
  - {@link AuthButton | `AuthButton`} - the `SignOutButton` when logged in, and the `SignInModal` when logged out
10
10
  - {@link SendTransactionButton | `SendTransactionButton`} - a button that signs and sends a transaction
11
+ - {@link Fund | `Fund`} - the fund flow
12
+ - {@link FundModal | `FundModal`} - a button that triggers a modal with the fund flow
11
13
 
12
14
  ## Quickstart
13
15
 
@@ -7,4 +7,4 @@ import { FetchBuyUrlParams } from './hooks/useBuyUrl';
7
7
  import { CamelToSnakeCase, CamelToSnakeCaseNested, FundAction, FetchBuyOptions, FetchBuyQuote, FundPaymentMethod, FundPresetAmountInputs, FundProps, FundState, FundStateError, FundStateProps, FundContextType, FundLifecycleStatus, OnrampAmount, OnrampBuyQuoteResponse, OnrampBuyOptionsResponse, OnrampBuyOptionsSnakeCaseResponse, OnrampBuyQuoteSnakeCaseResponse, OnrampError, OnrampNetwork, OnrampPaymentCurrency, OnrampPaymentMethodLimit, OnrampPurchaseCurrency, OnrampSuccessEventData } from './types';
8
8
  declare const Fund: ({ className, children, openIn, submitLabel, title, ...props }: FundProps) => import("react/jsx-runtime").JSX.Element;
9
9
  declare const FundFooter: (props: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
10
- export { Fund as unstable_Fund, FundFooter as unstable_FundFooter, FundForm as unstable_FundForm, FundTitle as unstable_FundTitle, useFundContext as unstable_useFundContext, type CamelToSnakeCase as unstable_CamelToSnakeCase, type CamelToSnakeCaseNested as unstable_CamelToSnakeCaseNested, type FundAction as unstable_FundAction, type FetchBuyOptions as unstable_FetchBuyOptions, type FetchBuyQuote as unstable_FetchBuyQuote, type FetchBuyUrlParams as unstable_FetchBuyUrlParams, type FundContextType as unstable_FundContextType, type FundFormProps as unstable_FundFormProps, type FundLifecycleStatus as unstable_FundLifecycleStatus, type FundPaymentMethod as unstable_FundPaymentMethod, type FundPresetAmountInputs as unstable_FundPresetAmountInputs, type FundProps as unstable_FundProps, type FundState as unstable_FundState, type FundStateError as unstable_FundStateError, type FundStateProps as unstable_FundStateProps, type FundTitleProps as unstable_FundTitleProps, type InputType as unstable_InputType, type OnrampAmount as unstable_OnrampAmount, type OnrampBuyQuoteResponse as unstable_OnrampBuyQuoteResponse, type OnrampBuyOptionsResponse as unstable_OnrampBuyOptionsResponse, type OnrampBuyOptionsSnakeCaseResponse as unstable_OnrampBuyOptionsSnakeCaseResponse, type OnrampBuyQuoteSnakeCaseResponse as unstable_OnrampBuyQuoteSnakeCaseResponse, type OnrampError as unstable_OnrampError, type OnrampNetwork as unstable_OnrampNetwork, type OnrampPaymentCurrency as unstable_OnrampPaymentCurrency, type OnrampPaymentMethodLimit as unstable_OnrampPaymentMethodLimit, type OnrampPurchaseCurrency as unstable_OnrampPurchaseCurrency, type OnrampSuccessEventData as unstable_OnrampSuccessEventData, };
10
+ export { Fund, FundFooter, FundForm, FundTitle, useFundContext, type CamelToSnakeCase, type CamelToSnakeCaseNested, type FundAction, type FetchBuyOptions, type FetchBuyQuote, type FetchBuyUrlParams, type FundContextType, type FundFormProps, type FundLifecycleStatus, type FundPaymentMethod, type FundPresetAmountInputs, type FundProps, type FundState, type FundStateError, type FundStateProps, type FundTitleProps, type InputType, type OnrampAmount, type OnrampBuyQuoteResponse, type OnrampBuyOptionsResponse, type OnrampBuyOptionsSnakeCaseResponse, type OnrampBuyQuoteSnakeCaseResponse, type OnrampError, type OnrampNetwork, type OnrampPaymentCurrency, type OnrampPaymentMethodLimit, type OnrampPurchaseCurrency, type OnrampSuccessEventData, };
@@ -1,30 +1,30 @@
1
- import { jsx as t, jsxs as m, Fragment as a } from "react/jsx-runtime";
2
- import { useId as F } from "react";
3
- import { useAppConfig as f } from "../CDPReactProvider/index.js";
4
- import { CoinbaseFooter as l } from "../ui/CoinbaseFooter/index.js";
5
- import { FundForm as p } from "./FundForm.js";
6
- import { FundProvider as c, useFundContext as _ } from "./FundProvider.js";
7
- import { FundTitle as b } from "./FundTitle.js";
8
- import { useSetupOnrampEventListeners as C } from "./hooks/useSetupOnrampEventListeners.js";
1
+ import { jsx as t, jsxs as m, Fragment as f } from "react/jsx-runtime";
2
+ import { useId as p } from "react";
3
+ import { useAppConfig as F } from "../CDPReactProvider/index.js";
4
+ import { CoinbaseFooter as c } from "../ui/CoinbaseFooter/index.js";
5
+ import { FundForm as a } from "./FundForm.js";
6
+ import { FundProvider as l, useFundContext as C } from "./FundProvider.js";
7
+ import { FundTitle as _ } from "./FundTitle.js";
8
+ import { useSetupOnrampEventListeners as b } from "./hooks/useSetupOnrampEventListeners.js";
9
9
  import '../../assets/Fund.css';const x = "Fund-module__fund___6j-Og", g = {
10
10
  fund: x
11
- }, E = ({ className: n = "", children: e, openIn: r, submitLabel: s, title: u, ...o }) => /* @__PURE__ */ t(c, { ...o, children: /* @__PURE__ */ t("div", { className: `${g.fund} ${n}`, children: /* @__PURE__ */ t(h, { openIn: r, submitLabel: s, title: u, children: e }) }) }), h = ({
12
- children: n,
13
- openIn: e,
14
- submitLabel: r,
11
+ }, L = ({ className: o = "", children: r, openIn: e, submitLabel: s, title: u, ...n }) => /* @__PURE__ */ t(l, { ...n, children: /* @__PURE__ */ t("div", { className: `${g.fund} ${o}`, children: /* @__PURE__ */ t(h, { openIn: e, submitLabel: s, title: u, children: r }) }) }), h = ({
12
+ children: o,
13
+ openIn: r,
14
+ submitLabel: e,
15
15
  title: s
16
16
  }) => {
17
- const { state: u } = _(), o = F(), { showCoinbaseFooter: d } = f();
18
- return C(), n ? typeof n == "function" ? n(u) : n : /* @__PURE__ */ t(p, { "aria-labelledby": o, openIn: e, submitLabel: r, children: ({ Content: i }) => /* @__PURE__ */ m(a, { children: [
19
- /* @__PURE__ */ t(b, { id: o, children: s }),
20
- i,
21
- d && /* @__PURE__ */ t(j, {})
17
+ const { state: u } = C(), n = p(), { showCoinbaseFooter: i } = F();
18
+ return b(), o ? typeof o == "function" ? o(u) : o : /* @__PURE__ */ t(a, { "aria-labelledby": n, openIn: r, submitLabel: e, children: ({ Content: d }) => /* @__PURE__ */ m(f, { children: [
19
+ /* @__PURE__ */ t(_, { id: n, children: s }),
20
+ d,
21
+ i && /* @__PURE__ */ t(j, {})
22
22
  ] }) });
23
- }, j = (n) => /* @__PURE__ */ t(l, { ...n });
23
+ }, j = (o) => /* @__PURE__ */ t(c, { ...o });
24
24
  export {
25
- E as unstable_Fund,
26
- j as unstable_FundFooter,
27
- p as unstable_FundForm,
28
- b as unstable_FundTitle,
29
- _ as unstable_useFundContext
25
+ L as Fund,
26
+ j as FundFooter,
27
+ a as FundForm,
28
+ _ as FundTitle,
29
+ C as useFundContext
30
30
  };
@@ -1,9 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
- import { unstable_FundProps as FundProps } from '../Fund';
2
+ import { FundProps } from '../Fund';
3
3
  interface FundModalProps extends FundProps {
4
4
  children?: ReactNode;
5
5
  open?: boolean;
6
6
  setIsOpen?: (value: boolean) => void;
7
7
  }
8
8
  declare const FundModal: ({ children, open, setIsOpen, openIn, submitLabel, title, ...fundProps }: FundModalProps) => import("react/jsx-runtime").JSX.Element;
9
- export { FundModal as unstable_FundModal, type FundModalProps as unstable_FundModalProps };
9
+ export { FundModal, type FundModalProps };
@@ -1,8 +1,8 @@
1
1
  import { jsxs as t, jsx as o, Fragment as x } from "react/jsx-runtime";
2
- import { useId as O, useState as v, useCallback as h } from "react";
2
+ import { useId as O, useState as v, useCallback as p } from "react";
3
3
  import { useAppConfig as T } from "../CDPReactProvider/index.js";
4
- import { unstable_Fund as j, unstable_FundFooter as I } from "../Fund/index.js";
5
- import { Button as p } from "../ui/Button/index.js";
4
+ import { Fund as j, FundFooter as I } from "../Fund/index.js";
5
+ import { Button as F } from "../ui/Button/index.js";
6
6
  import { Modal as $, ModalTrigger as z, ModalContent as A, ModalTitle as S, ModalClose as k } from "../ui/Modal/index.js";
7
7
  import { VisuallyHidden as M } from "../ui/VisuallyHidden/index.js";
8
8
  import { IconXMark as U } from "../../icons/IconXMark.js";
@@ -20,7 +20,7 @@ import '../../assets/FundModal.css';const W = "FundModal-module__trigger___2IuXj
20
20
  title: q,
21
21
  content: B
22
22
  }, Y = ({
23
- children: b,
23
+ children: g,
24
24
  open: i,
25
25
  setIsOpen: c,
26
26
  openIn: u,
@@ -28,14 +28,14 @@ import '../../assets/FundModal.css';const W = "FundModal-module__trigger___2IuXj
28
28
  title: d,
29
29
  ...m
30
30
  }) => {
31
- const { showCoinbaseFooter: f } = T(), l = O(), r = i !== void 0, [g, F] = v(!1), C = r ? i : g, s = h(
32
- (e) => r ? c?.(e) : F(e),
33
- [r, c, F]
34
- ), N = h(() => {
31
+ const { showCoinbaseFooter: f } = T(), r = O(), l = i !== void 0, [C, h] = v(!1), b = l ? i : C, s = p(
32
+ (e) => l ? c?.(e) : h(e),
33
+ [l, c, h]
34
+ ), N = p(() => {
35
35
  s(!1);
36
36
  }, [s]);
37
- return /* @__PURE__ */ t($, { open: C, onOpenChange: s, children: [
38
- /* @__PURE__ */ o(z, { asChild: !0, children: b || /* @__PURE__ */ t(p, { variant: "primary", className: n.trigger, children: [
37
+ return /* @__PURE__ */ t($, { open: b, onOpenChange: s, children: [
38
+ /* @__PURE__ */ o(z, { asChild: !0, children: g || /* @__PURE__ */ t(F, { variant: "primary", className: n.trigger, children: [
39
39
  "Deposit ",
40
40
  m.cryptoCurrency.toUpperCase()
41
41
  ] }) }),
@@ -52,7 +52,7 @@ import '../../assets/FundModal.css';const W = "FundModal-module__trigger___2IuXj
52
52
  /* @__PURE__ */ o(
53
53
  V,
54
54
  {
55
- "aria-labelledby": l,
55
+ "aria-labelledby": r,
56
56
  openIn: u,
57
57
  unmountOnTransactionSuccess: !0,
58
58
  unmount: N,
@@ -63,9 +63,9 @@ import '../../assets/FundModal.css';const W = "FundModal-module__trigger___2IuXj
63
63
  className: `${n["fund-inner"]} ${e === "transaction-status" ? n["tx-status"] : ""}`,
64
64
  children: [
65
65
  /* @__PURE__ */ t("div", { className: n["title-buttons"], children: [
66
- e === "error" ? /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(a, { id: l, children: d }) }) : /* @__PURE__ */ o(a, { className: n.title, id: l, children: d }),
66
+ e === "error" ? /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(a, { id: r, children: d }) }) : /* @__PURE__ */ o(a, { className: n.title, id: r, children: d }),
67
67
  /* @__PURE__ */ o(k, { asChild: !0, children: /* @__PURE__ */ o(
68
- p,
68
+ F,
69
69
  {
70
70
  className: n["close-button"],
71
71
  "aria-label": "Close",
@@ -88,5 +88,5 @@ import '../../assets/FundModal.css';const W = "FundModal-module__trigger___2IuXj
88
88
  ] });
89
89
  };
90
90
  export {
91
- Y as unstable_FundModal
91
+ Y as FundModal
92
92
  };
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import { AUTH_METHODS as e, CDPReactProvider as t, useAppConfig as n } from "./components/CDPReactProvider/index.js";
2
2
  import { AuthButton as p } from "./components/AuthButton/index.js";
3
- import { unstable_Fund as f, unstable_FundFooter as s } from "./components/Fund/index.js";
4
- import { unstable_FundModal as i } from "./components/FundModal/index.js";
5
- import { SendTransactionButton as c } from "./components/SendTransactionButton/index.js";
6
- import { SignIn as I } from "./components/SignIn/index.js";
7
- import { useSignInReducer as g } from "./components/SignIn/useSignInReducer.js";
8
- import { SignOutButton as S } from "./components/SignOutButton/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 { SendTransactionButton as I } from "./components/SendTransactionButton/index.js";
6
+ import { SignIn as l } from "./components/SignIn/index.js";
7
+ import { useSignInReducer as S } from "./components/SignIn/useSignInReducer.js";
8
+ import { SignOutButton as h } from "./components/SignOutButton/index.js";
9
9
  import { SignInModal as C } from "./components/SignInModal/index.js";
10
- import { ThemeProvider as b, useTheme as k } from "./components/ThemeProvider/index.js";
11
- import { cssVariables as B } from "./theme/cssVariables.js";
12
- import { theme as _ } from "./theme/theme.js";
13
- import { colors as v, colorsBase as w, colorsComponents as D, colorsSemantic as P, font as O, tokens as U } from "./theme/tokens.js";
14
- import { flattenTokensObject as H, themeToCssVariables as L } from "./theme/utils.js";
15
- import { IconArrowLeft as j } from "./icons/IconArrowLeft.js";
16
- import { IconArrowsUpDown as X } from "./icons/IconArrowsUpDown.js";
10
+ import { ThemeProvider as k, useTheme as A } from "./components/ThemeProvider/index.js";
11
+ import { cssVariables as E } from "./theme/cssVariables.js";
12
+ import { theme as v } from "./theme/theme.js";
13
+ import { colors as D, colorsBase as P, colorsComponents as b, colorsSemantic as O, font as U, tokens as V } from "./theme/tokens.js";
14
+ import { flattenTokensObject as L, themeToCssVariables as R } from "./theme/utils.js";
15
+ import { IconArrowLeft as N } from "./icons/IconArrowLeft.js";
16
+ import { IconArrowsUpDown as _ } from "./icons/IconArrowsUpDown.js";
17
17
  import { IconCheck as y } from "./icons/IconCheck.js";
18
18
  import { IconCheckCircle as G } from "./icons/IconCheckCircle.js";
19
19
  import { IconChevronDown as K } from "./icons/IconChevronDown.js";
@@ -23,28 +23,33 @@ import { IconExclamationTriangle as oo } from "./icons/IconExclamationTriangle.j
23
23
  import { IconLock as eo } from "./icons/IconLock.js";
24
24
  import { IconPhone as no } from "./icons/IconPhone.js";
25
25
  import { IconXMark as po } from "./icons/IconXMark.js";
26
- import { clamp as fo } from "./utils/clamp.js";
27
- import { getMessageFromUnknownError as ao } from "./utils/getMessageFromUnknownError.js";
28
- import { isApiError as uo } from "./utils/isApiError.js";
29
- import { isEmailInvalid as lo } from "./utils/isEmailInvalid.js";
26
+ import { clamp as xo } from "./utils/clamp.js";
27
+ import { getMessageFromUnknownError as co } from "./utils/getMessageFromUnknownError.js";
28
+ import { isApiError as ao } from "./utils/isApiError.js";
29
+ import { isEmailInvalid as uo } from "./utils/isEmailInvalid.js";
30
30
  import { parseValuesFromPhoneNumber as go } from "./utils/parseValuesFromPhoneNumber.js";
31
- import { FundForm as So } from "./components/Fund/FundForm.js";
31
+ import { FundForm as ho } from "./components/Fund/FundForm.js";
32
32
  import { FundTitle as Co } from "./components/Fund/FundTitle.js";
33
- import { useFundContext as bo } from "./components/Fund/FundProvider.js";
34
- import { SignInAuthMethodButtons as Ao } from "./components/SignIn/SignInAuthMethodButtons.js";
35
- import { SignInBackButton as Eo } from "./components/SignIn/SignInBackButton.js";
36
- import { SignInDescription as Mo } from "./components/SignIn/SignInDescription.js";
37
- import { SignInFooter as wo } from "./components/SignIn/SignInFooter.js";
38
- import { SignInForm as Po } from "./components/SignIn/SignInForm.js";
39
- import { SignInImage as Uo } from "./components/SignIn/SignInImage.js";
40
- import { SignInTitle as Ho } from "./components/SignIn/SignInTitle.js";
41
- import { useSignInContext as Ro } from "./components/SignIn/SignInProvider.js";
33
+ import { useFundContext as ko } from "./components/Fund/FundProvider.js";
34
+ import { SignInAuthMethodButtons as Bo } from "./components/SignIn/SignInAuthMethodButtons.js";
35
+ import { SignInBackButton as Mo } from "./components/SignIn/SignInBackButton.js";
36
+ import { SignInDescription as wo } from "./components/SignIn/SignInDescription.js";
37
+ import { SignInFooter as Po } from "./components/SignIn/SignInFooter.js";
38
+ import { SignInForm as Oo } from "./components/SignIn/SignInForm.js";
39
+ import { SignInImage as Vo } from "./components/SignIn/SignInImage.js";
40
+ import { SignInTitle as Lo } from "./components/SignIn/SignInTitle.js";
41
+ import { useSignInContext as jo } from "./components/SignIn/SignInProvider.js";
42
42
  export {
43
43
  e as AUTH_METHODS,
44
44
  p as AuthButton,
45
45
  t as CDPReactProvider,
46
- j as IconArrowLeft,
47
- X as IconArrowsUpDown,
46
+ x as Fund,
47
+ i as FundFooter,
48
+ ho as FundForm,
49
+ s as FundModal,
50
+ Co as FundTitle,
51
+ N as IconArrowLeft,
52
+ _ as IconArrowsUpDown,
48
53
  y as IconCheck,
49
54
  G as IconCheckCircle,
50
55
  K as IconChevronDown,
@@ -54,41 +59,36 @@ export {
54
59
  eo as IconLock,
55
60
  no as IconPhone,
56
61
  po as IconXMark,
57
- c as SendTransactionButton,
58
- I as SignIn,
59
- Ao as SignInAuthMethodButtons,
60
- Eo as SignInBackButton,
61
- Mo as SignInDescription,
62
- wo as SignInFooter,
63
- Po as SignInForm,
64
- Uo as SignInImage,
62
+ I as SendTransactionButton,
63
+ l as SignIn,
64
+ Bo as SignInAuthMethodButtons,
65
+ Mo as SignInBackButton,
66
+ wo as SignInDescription,
67
+ Po as SignInFooter,
68
+ Oo as SignInForm,
69
+ Vo as SignInImage,
65
70
  C as SignInModal,
66
- Ho as SignInTitle,
67
- S as SignOutButton,
68
- b as ThemeProvider,
69
- fo as clamp,
70
- v as colors,
71
- w as colorsBase,
72
- D as colorsComponents,
73
- P as colorsSemantic,
74
- B as cssVariables,
75
- H as flattenTokensObject,
76
- O as font,
77
- ao as getMessageFromUnknownError,
78
- uo as isApiError,
79
- lo as isEmailInvalid,
71
+ Lo as SignInTitle,
72
+ h as SignOutButton,
73
+ k as ThemeProvider,
74
+ xo as clamp,
75
+ D as colors,
76
+ P as colorsBase,
77
+ b as colorsComponents,
78
+ O as colorsSemantic,
79
+ E as cssVariables,
80
+ L as flattenTokensObject,
81
+ U as font,
82
+ co as getMessageFromUnknownError,
83
+ ao as isApiError,
84
+ uo as isEmailInvalid,
80
85
  go as parseValuesFromPhoneNumber,
81
- _ as theme,
82
- L as themeToCssVariables,
83
- U as tokens,
84
- f as unstable_Fund,
85
- s as unstable_FundFooter,
86
- So as unstable_FundForm,
87
- i as unstable_FundModal,
88
- Co as unstable_FundTitle,
89
- bo as unstable_useFundContext,
86
+ v as theme,
87
+ R as themeToCssVariables,
88
+ V as tokens,
90
89
  n as useAppConfig,
91
- Ro as useSignInContext,
92
- g as useSignInReducer,
93
- k as useTheme
90
+ ko as useFundContext,
91
+ jo as useSignInContext,
92
+ S as useSignInReducer,
93
+ A as useTheme
94
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-react",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
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",
17
- "@coinbase/cdp-core": "^0.0.29",
18
- "@coinbase/cdp-hooks": "^0.0.29"
17
+ "@coinbase/cdp-core": "^0.0.31",
18
+ "@coinbase/cdp-hooks": "^0.0.31"
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.29",
49
- "@coinbase/cdp-hooks": "^0.0.29"
48
+ "@coinbase/cdp-core": "^0.0.31",
49
+ "@coinbase/cdp-hooks": "^0.0.31"
50
50
  },
51
51
  "size-limit": [
52
52
  {