@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
|
|
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
|
|
2
|
-
import { useId as
|
|
3
|
-
import { useAppConfig as
|
|
4
|
-
import { CoinbaseFooter as
|
|
5
|
-
import { FundForm as
|
|
6
|
-
import { FundProvider as
|
|
7
|
-
import { FundTitle as
|
|
8
|
-
import { useSetupOnrampEventListeners as
|
|
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
|
-
},
|
|
12
|
-
children:
|
|
13
|
-
openIn:
|
|
14
|
-
submitLabel:
|
|
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 } =
|
|
18
|
-
return
|
|
19
|
-
/* @__PURE__ */ t(
|
|
20
|
-
|
|
21
|
-
|
|
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 = (
|
|
23
|
+
}, j = (o) => /* @__PURE__ */ t(c, { ...o });
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
j as
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 {
|
|
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
|
|
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
|
|
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 {
|
|
5
|
-
import { Button as
|
|
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:
|
|
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(),
|
|
32
|
-
(e) =>
|
|
33
|
-
[
|
|
34
|
-
), N =
|
|
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:
|
|
38
|
-
/* @__PURE__ */ o(z, { asChild: !0, 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":
|
|
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:
|
|
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
|
-
|
|
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
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import { SendTransactionButton as
|
|
6
|
-
import { SignIn as
|
|
7
|
-
import { useSignInReducer as
|
|
8
|
-
import { SignOutButton as
|
|
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
|
|
11
|
-
import { cssVariables as
|
|
12
|
-
import { theme as
|
|
13
|
-
import { colors as
|
|
14
|
-
import { flattenTokensObject as
|
|
15
|
-
import { IconArrowLeft as
|
|
16
|
-
import { IconArrowsUpDown as
|
|
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
|
|
27
|
-
import { getMessageFromUnknownError as
|
|
28
|
-
import { isApiError as
|
|
29
|
-
import { isEmailInvalid as
|
|
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
|
|
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
|
|
34
|
-
import { SignInAuthMethodButtons as
|
|
35
|
-
import { SignInBackButton as
|
|
36
|
-
import { SignInDescription as
|
|
37
|
-
import { SignInFooter as
|
|
38
|
-
import { SignInForm as
|
|
39
|
-
import { SignInImage as
|
|
40
|
-
import { SignInTitle as
|
|
41
|
-
import { useSignInContext as
|
|
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
|
-
|
|
47
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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.
|
|
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.
|
|
18
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
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.
|
|
49
|
-
"@coinbase/cdp-hooks": "^0.0.
|
|
48
|
+
"@coinbase/cdp-core": "^0.0.31",
|
|
49
|
+
"@coinbase/cdp-hooks": "^0.0.31"
|
|
50
50
|
},
|
|
51
51
|
"size-limit": [
|
|
52
52
|
{
|