@coinbase/cdp-react 0.0.28 → 0.0.29
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/dist/assets/AmountInput.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/components/Fund/FundForm.js +68 -72
- package/dist/components/Fund/components/FundTransactionStatus.js +83 -64
- package/dist/components/Fund/hooks/useBuyUrl.js +29 -29
- package/dist/components/Fund/hooks/useSetupOnrampEventListeners.js +25 -20
- package/dist/components/Fund/types.d.ts +4 -0
- package/dist/components/Fund/utils/buildPaymentMethods.js +12 -12
- package/dist/components/forms/AmountInput/index.js +52 -52
- package/dist/icons/IconCurrencies.d.ts +2 -0
- package/dist/icons/IconCurrencies.js +11 -0
- package/dist/theme/theme.d.ts +2 -2
- package/dist/theme/tokens.d.ts +6 -6
- package/dist/theme/tokens.js +2 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
.AmountInput-module__amount-input___24NlC{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.2;display:flex;align-items:center;justify-content:flex-start;gap:.25rem;overflow:hidden;position:relative;width:100%}.AmountInput-module__input___Af-R1{appearance:textfield;background-color:transparent;color:var(--cdp-web-colors-page-text-default);border:0;font-size:1em;font-family:var(--cdp-web-font-family-sans);font-weight:
|
|
1
|
+
.AmountInput-module__amount-input___24NlC{box-sizing:border-box;color:var(--cdp-web-colors-page-text-default);font-family:var(--cdp-web-font-family-sans);font-size:var(--cdp-web-font-size-base);line-height:1.2;display:flex;align-items:center;justify-content:flex-start;gap:.25rem;overflow:hidden;position:relative;width:100%}.AmountInput-module__input___Af-R1{appearance:textfield;background-color:transparent;color:var(--cdp-web-colors-page-text-default);border:0;font-size:1em;font-family:var(--cdp-web-font-family-sans);font-weight:500;margin:0;outline:0;padding:0;width:1em}.AmountInput-module__input___Af-R1::placeholder{color:var(--cdp-web-colors-page-text-muted)}.AmountInput-module__amount-unit___48d60{font-size:3.75em;font-weight:500;display:flex;align-items:center;justify-content:flex-start}.AmountInput-module__amount-unit___48d60.AmountInput-module__visible___qmvT0{cursor:text;transform-origin:left center}.AmountInput-module__hidden___cO0sQ{visibility:hidden;position:absolute;pointer-events:none}.AmountInput-module__unit___-zmGz{color:var(--cdp-web-colors-page-text-muted)}
|
package/dist/assets/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.Button-module__btn___Wj6Dr{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;border-radius:9999em}.Button-module__link-primary___6Zgkh,.Button-module__link-secondary___S0Qdo{padding:0 .25em}.Button-module__primary___WGT--{background-color:var(--cdp-web-colors-cta-primary-bg-default);color:var(--cdp-web-colors-cta-primary-text-default)}.Button-module__primary___WGT--:hover{background-color:var(--cdp-web-colors-cta-primary-bg-hover);color:var(--cdp-web-colors-cta-primary-text-hover)}.Button-module__primary___WGT--:focus{outline:none}.Button-module__primary___WGT--:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-primary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__secondary___Fx0LJ{background-color:var(--cdp-web-colors-cta-secondary-bg-default);color:var(--cdp-web-colors-cta-secondary-text-default)}.Button-module__secondary___Fx0LJ:hover{background-color:var(--cdp-web-colors-cta-secondary-bg-hover);color:var(--cdp-web-colors-cta-secondary-text-hover)}.Button-module__secondary___Fx0LJ:focus{outline:none}.Button-module__secondary___Fx0LJ:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-secondary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__link-primary___6Zgkh,.Button-module__transparent-primary___iwWv5{background-color:transparent;color:var(--cdp-web-colors-link-primary-text-default)}.Button-module__link-primary___6Zgkh:hover,.Button-module__transparent-primary___iwWv5:hover{color:var(--cdp-web-colors-link-primary-text-hover)}.Button-module__link-primary___6Zgkh:focus,.Button-module__transparent-primary___iwWv5:focus{outline:none}.Button-module__link-primary___6Zgkh:focus-visible,.Button-module__transparent-primary___iwWv5:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-primary-text-default);outline:none}.Button-module__link-secondary___S0Qdo,.Button-module__transparent-secondary___GfRXu{background-color:transparent;color:var(--cdp-web-colors-link-secondary-text-default)}.Button-module__link-secondary___S0Qdo:hover,.Button-module__transparent-secondary___GfRXu:hover{color:var(--cdp-web-colors-link-secondary-text-hover)}.Button-module__link-secondary___S0Qdo:focus,.Button-module__transparent-secondary___GfRXu:focus{outline:none}.Button-module__link-secondary___S0Qdo:focus-visible,.Button-module__transparent-secondary___GfRXu:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-secondary-text-default);outline:none}.Button-module__control-btn___9Gkoz{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-
|
|
1
|
+
.Button-module__btn___Wj6Dr{--cdp-web-button-ring-color: transparent;--cdp-web-button-ring-width: 2px;--cdp-web-button-ring-inset-color: transparent;--cdp-web-button-ring-inset-width: 2px;border-radius:9999em}.Button-module__link-primary___6Zgkh,.Button-module__link-secondary___S0Qdo{padding:0 .25em}.Button-module__primary___WGT--{background-color:var(--cdp-web-colors-cta-primary-bg-default);color:var(--cdp-web-colors-cta-primary-text-default)}.Button-module__primary___WGT--:hover{background-color:var(--cdp-web-colors-cta-primary-bg-hover);color:var(--cdp-web-colors-cta-primary-text-hover)}.Button-module__primary___WGT--:focus{outline:none}.Button-module__primary___WGT--:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-primary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__secondary___Fx0LJ{background-color:var(--cdp-web-colors-cta-secondary-bg-default);color:var(--cdp-web-colors-cta-secondary-text-default)}.Button-module__secondary___Fx0LJ:hover{background-color:var(--cdp-web-colors-cta-secondary-bg-hover);color:var(--cdp-web-colors-cta-secondary-text-hover)}.Button-module__secondary___Fx0LJ:focus{outline:none}.Button-module__secondary___Fx0LJ:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-cta-secondary-border-focus);--cdp-web-button-ring-inset-color: var(--cdp-web-colors-page-bg-default);outline:none}.Button-module__link-primary___6Zgkh,.Button-module__transparent-primary___iwWv5{background-color:transparent;color:var(--cdp-web-colors-link-primary-text-default)}.Button-module__link-primary___6Zgkh:hover,.Button-module__transparent-primary___iwWv5:hover{color:var(--cdp-web-colors-link-primary-text-hover)}.Button-module__link-primary___6Zgkh:focus,.Button-module__transparent-primary___iwWv5:focus{outline:none}.Button-module__link-primary___6Zgkh:focus-visible,.Button-module__transparent-primary___iwWv5:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-primary-text-default);outline:none}.Button-module__link-secondary___S0Qdo,.Button-module__transparent-secondary___GfRXu{background-color:transparent;color:var(--cdp-web-colors-link-secondary-text-default)}.Button-module__link-secondary___S0Qdo:hover,.Button-module__transparent-secondary___GfRXu:hover{color:var(--cdp-web-colors-link-secondary-text-hover)}.Button-module__link-secondary___S0Qdo:focus,.Button-module__transparent-secondary___GfRXu:focus{outline:none}.Button-module__link-secondary___S0Qdo:focus-visible,.Button-module__transparent-secondary___GfRXu:focus-visible{--cdp-web-button-ring-color: var(--cdp-web-colors-link-secondary-text-default);outline:none}.Button-module__control-btn___9Gkoz{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-select-trigger-border-default);--cdp-web-button-ring-inset-width: 1px;background-color:var(--cdp-web-colors-select-trigger-bg-default);border-radius:.5em;color:var(--cdp-web-colors-select-trigger-text-default);font-weight:400}.Button-module__control-btn___9Gkoz:focus{outline:none}.Button-module__control-btn___9Gkoz:focus-visible{--cdp-web-button-ring-inset-color: var(--cdp-web-colors-input-border-focus);--cdp-web-button-ring-inset-width: 2px;outline:none}
|
|
@@ -1,68 +1,64 @@
|
|
|
1
1
|
import { jsx as r, jsxs as H } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as c, useState as h, useCallback as s, useEffect as y, useMemo as J } from "react";
|
|
3
3
|
import { Button as Y } from "../ui/Button/index.js";
|
|
4
4
|
import { SwitchFadeTransition as Q } from "../ui/SwitchFadeTransition/index.js";
|
|
5
5
|
import { useTimer as X } from "../../hooks/useTimer.js";
|
|
6
6
|
import { formatFiat as w } from "../../utils/formatFiat.js";
|
|
7
7
|
import { openPopup as Z } from "../../utils/openPopup.js";
|
|
8
|
-
import { FundAmountInput as
|
|
9
|
-
import { FundErrorScreen as
|
|
10
|
-
import { FundPaymentMethods as
|
|
11
|
-
import { FundPresetAmountInputs as
|
|
12
|
-
import { FundTransactionStatus as
|
|
13
|
-
import { useFundContext as
|
|
8
|
+
import { FundAmountInput as tt } from "./components/FundAmountInput.js";
|
|
9
|
+
import { FundErrorScreen as et } from "./components/FundErrorScreen.js";
|
|
10
|
+
import { FundPaymentMethods as rt } from "./components/FundPaymentMethods.js";
|
|
11
|
+
import { FundPresetAmountInputs as nt } from "./components/FundPresetAmountInputs.js";
|
|
12
|
+
import { FundTransactionStatus as ot } from "./components/FundTransactionStatus.js";
|
|
13
|
+
import { useFundContext as st } from "./FundProvider.js";
|
|
14
14
|
import { usePopupMonitor as it } from "./hooks/usePopupMonitor.js";
|
|
15
|
-
import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO",
|
|
15
|
+
import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", ut = "FundForm-module__form___TIzVJ", B = {
|
|
16
16
|
view: at,
|
|
17
|
-
form:
|
|
18
|
-
}, mt = ["form", "error", "transaction-status"],
|
|
19
|
-
className:
|
|
20
|
-
children:
|
|
21
|
-
onPopupClose:
|
|
22
|
-
onPopupOpen:
|
|
17
|
+
form: ut
|
|
18
|
+
}, mt = ["form", "error", "transaction-status"], Ft = ({
|
|
19
|
+
className: T = "",
|
|
20
|
+
children: A,
|
|
21
|
+
onPopupClose: N,
|
|
22
|
+
onPopupOpen: S,
|
|
23
23
|
onSubmit: I,
|
|
24
24
|
openIn: V,
|
|
25
25
|
submitLabel: D,
|
|
26
|
-
unmountOnTransactionError:
|
|
27
|
-
unmountOnTransactionSuccess:
|
|
28
|
-
unmount:
|
|
29
|
-
|
|
26
|
+
unmountOnTransactionError: d = !1,
|
|
27
|
+
unmountOnTransactionSuccess: p = !1,
|
|
28
|
+
unmount: a,
|
|
29
|
+
...$
|
|
30
30
|
}) => {
|
|
31
|
-
const { state: t, dispatch:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const { state: t, dispatch: M, fetchBuyUrl: P } = st(), g = c(t.fiatAmount === void 0 ? NaN : t.fiatAmount), [k, _] = h(!1), [j, F] = h(!1), E = c(null), [K, L] = h(null), b = c(null), U = c(null), u = c(null), l = s(
|
|
32
|
+
(e) => (e === "transactionSuccess" || e === "transactionSubmitted") && p || e === "error" && d,
|
|
33
|
+
[p, d]
|
|
34
|
+
), {
|
|
35
|
+
timeRemaining: f,
|
|
36
|
+
start: v,
|
|
37
|
+
reset: C
|
|
38
|
+
} = X(), n = s((e) => {
|
|
39
|
+
U.current !== e && (U.current = e, b.current?.transition.toggle(e));
|
|
40
|
+
}, []), m = s(() => {
|
|
41
|
+
a && l(u.current) ? a() : n("form"), u.current = null, M({
|
|
39
42
|
type: "SET_TRANSACTION_STATUS",
|
|
40
43
|
payload: { transactionStatus: { statusName: "init", statusData: null } }
|
|
41
44
|
});
|
|
42
|
-
}, [n,
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
u
|
|
49
|
-
|
|
50
|
-
s
|
|
51
|
-
]);
|
|
52
|
-
h(() => {
|
|
53
|
-
d !== null && d <= 0 && (l(), U());
|
|
54
|
-
}, [d, l, U]), h(() => {
|
|
55
|
-
(t.transactionStatus.statusName === "transactionSuccess" || t.transactionStatus.statusName === "error") && (o.current = t.transactionStatus.statusName);
|
|
56
|
-
}, [t.transactionStatus.statusName]), h(() => {
|
|
45
|
+
}, [n, M, a, l]), O = s(() => {
|
|
46
|
+
a && l(u.current) ? v(3) : u.current === null && m(), N?.();
|
|
47
|
+
}, [v, N, m, a, l]);
|
|
48
|
+
y(() => {
|
|
49
|
+
f !== null && f <= 0 && (m(), C());
|
|
50
|
+
}, [f, m, C]), y(() => {
|
|
51
|
+
(t.transactionStatus.statusName === "transactionSubmitted" || t.transactionStatus.statusName === "transactionSuccess" || t.transactionStatus.statusName === "error") && (u.current = t.transactionStatus.statusName);
|
|
52
|
+
}, [t.transactionStatus.statusName]), y(() => {
|
|
57
53
|
t.paymentMethodsError?.message && n("error");
|
|
58
54
|
}, [t.paymentMethodsError?.message, n]);
|
|
59
|
-
const { startPopupMonitor:
|
|
55
|
+
const { startPopupMonitor: R } = it(O), W = s(
|
|
60
56
|
(e) => {
|
|
61
|
-
e && (n("transaction-status"),
|
|
57
|
+
e && (n("transaction-status"), R(e), S?.(e));
|
|
62
58
|
},
|
|
63
|
-
[
|
|
64
|
-
), q =
|
|
65
|
-
(t.fiatAmount === void 0 || isNaN(t.fiatAmount)) && isNaN(g.current) || t.fiatAmount === g.current ||
|
|
59
|
+
[S, R, n]
|
|
60
|
+
), q = s(() => {
|
|
61
|
+
(t.fiatAmount === void 0 || isNaN(t.fiatAmount)) && isNaN(g.current) || t.fiatAmount === g.current || _(!0);
|
|
66
62
|
}, [t.fiatAmount]), x = J(() => {
|
|
67
63
|
if (t.fiatAmount === void 0 || isNaN(t.fiatAmount))
|
|
68
64
|
return "Enter an amount";
|
|
@@ -77,7 +73,7 @@ import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", s
|
|
|
77
73
|
t.locale,
|
|
78
74
|
t.selectedPaymentMethod?.minAmount,
|
|
79
75
|
t.selectedPaymentMethod?.maxAmount
|
|
80
|
-
]), z =
|
|
76
|
+
]), z = s(async () => {
|
|
81
77
|
if (!(t.fiatAmount === void 0 || isNaN(t.fiatAmount) || !t.selectedPaymentMethod?.id))
|
|
82
78
|
return P(
|
|
83
79
|
{
|
|
@@ -85,7 +81,7 @@ import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", s
|
|
|
85
81
|
paymentAmount: t.fiatAmount
|
|
86
82
|
},
|
|
87
83
|
(e) => {
|
|
88
|
-
|
|
84
|
+
L({
|
|
89
85
|
code: e?.code || "UNKNOWN_BUY_URL_ERROR",
|
|
90
86
|
message: e?.debugMessage || "Something went wrong fetching the buy url"
|
|
91
87
|
}), n("error");
|
|
@@ -93,17 +89,17 @@ import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", s
|
|
|
93
89
|
);
|
|
94
90
|
}, [t.fiatAmount, t.selectedPaymentMethod?.id, P, n]), G = async (e) => {
|
|
95
91
|
if (e.preventDefault(), x) {
|
|
96
|
-
|
|
92
|
+
_(!0), E.current?.focus();
|
|
97
93
|
return;
|
|
98
94
|
}
|
|
99
|
-
I?.(e),
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
95
|
+
I?.(e), F(!0);
|
|
96
|
+
const i = await z();
|
|
97
|
+
if (F(!1), i)
|
|
102
98
|
if (V === "tab")
|
|
103
|
-
window.open(
|
|
99
|
+
window.open(i, "_blank");
|
|
104
100
|
else {
|
|
105
|
-
const
|
|
106
|
-
W(
|
|
101
|
+
const o = Z({ url: i, width: 460, height: 720 });
|
|
102
|
+
W(o);
|
|
107
103
|
}
|
|
108
104
|
};
|
|
109
105
|
return /* @__PURE__ */ r(
|
|
@@ -113,44 +109,44 @@ import '../../assets/FundForm.css';const at = "FundForm-module__view___5V1qO", s
|
|
|
113
109
|
timeout: 250,
|
|
114
110
|
items: mt,
|
|
115
111
|
initialEntered: !0,
|
|
116
|
-
transitionRef:
|
|
117
|
-
children: ({ itemKey: e, ...
|
|
118
|
-
let
|
|
119
|
-
return e === "form" && (
|
|
112
|
+
transitionRef: b,
|
|
113
|
+
children: ({ itemKey: e, ...i }) => {
|
|
114
|
+
let o = null;
|
|
115
|
+
return e === "form" && (o = /* @__PURE__ */ H("form", { className: `${B.form} ${T}`, onSubmit: G, ...$, children: [
|
|
120
116
|
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(
|
|
121
|
-
|
|
117
|
+
tt,
|
|
122
118
|
{
|
|
123
|
-
ref:
|
|
124
|
-
error:
|
|
119
|
+
ref: E,
|
|
120
|
+
error: k ? x : void 0,
|
|
125
121
|
onBlur: q
|
|
126
122
|
}
|
|
127
123
|
) }),
|
|
124
|
+
/* @__PURE__ */ r(nt, {}),
|
|
128
125
|
/* @__PURE__ */ r(rt, {}),
|
|
129
|
-
/* @__PURE__ */ r(et, {}),
|
|
130
126
|
/* @__PURE__ */ r(
|
|
131
127
|
Y,
|
|
132
128
|
{
|
|
133
129
|
variant: "primary",
|
|
134
130
|
type: "submit",
|
|
135
|
-
isPending:
|
|
131
|
+
isPending: j,
|
|
136
132
|
pendingLabel: "Getting purchase link",
|
|
137
133
|
children: D || "Deposit"
|
|
138
134
|
}
|
|
139
135
|
)
|
|
140
|
-
] })), e === "error" && (
|
|
141
|
-
|
|
136
|
+
] })), e === "error" && (o = /* @__PURE__ */ r(et, { error: t.paymentMethodsError || K })), e === "transaction-status" && (o = /* @__PURE__ */ r(
|
|
137
|
+
ot,
|
|
142
138
|
{
|
|
143
|
-
unmountOnSuccess:
|
|
144
|
-
unmountOnError:
|
|
145
|
-
reset:
|
|
146
|
-
timeRemaining:
|
|
139
|
+
unmountOnSuccess: p,
|
|
140
|
+
unmountOnError: d,
|
|
141
|
+
reset: m,
|
|
142
|
+
timeRemaining: f
|
|
147
143
|
}
|
|
148
|
-
)), /* @__PURE__ */ r("div", { ...
|
|
144
|
+
)), /* @__PURE__ */ r("div", { ...i, className: B.view, children: A ? A({ view: e, Content: o }) : o });
|
|
149
145
|
}
|
|
150
146
|
}
|
|
151
147
|
);
|
|
152
148
|
};
|
|
153
149
|
export {
|
|
154
|
-
|
|
150
|
+
Ft as FundForm,
|
|
155
151
|
mt as VIEWS
|
|
156
152
|
};
|
|
@@ -1,106 +1,125 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { LoadingSpinner as
|
|
5
|
-
import { SwitchFadeTransition as
|
|
1
|
+
import { jsx as t, jsxs as c, Fragment as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as l, useCallback as _, useEffect as S, useMemo as g } from "react";
|
|
3
|
+
import { Button as o } from "../../ui/Button/index.js";
|
|
4
|
+
import { LoadingSpinner as N } from "../../ui/LoadingSpinner/index.js";
|
|
5
|
+
import { SwitchFadeTransition as T } from "../../ui/SwitchFadeTransition/index.js";
|
|
6
6
|
import { IconCheck as f } from "../../../icons/IconCheck.js";
|
|
7
|
-
import {
|
|
7
|
+
import { IconCurrencies as $ } from "../../../icons/IconCurrencies.js";
|
|
8
|
+
import { IconXMark as w } from "../../../icons/IconXMark.js";
|
|
8
9
|
import { useFundContext as m } from "../FundProvider.js";
|
|
9
|
-
import '../../../assets/FundTransactionStatus.css';const y = "FundTransactionStatus-module__graphic___cam38",
|
|
10
|
+
import '../../../assets/FundTransactionStatus.css';const y = "FundTransactionStatus-module__graphic___cam38", b = "FundTransactionStatus-module__status___2zKJu", C = "FundTransactionStatus-module__pad___-9rGO", F = "FundTransactionStatus-module__spinner___94rMk", k = "FundTransactionStatus-module__icon___0hBQO", v = "FundTransactionStatus-module__subhead___0sHIM", M = "FundTransactionStatus-module__description___W7kK2", W = "FundTransactionStatus-module__ring___1vnCu", s = {
|
|
10
11
|
graphic: y,
|
|
11
|
-
status:
|
|
12
|
-
pad:
|
|
13
|
-
spinner:
|
|
14
|
-
icon:
|
|
12
|
+
status: b,
|
|
13
|
+
pad: C,
|
|
14
|
+
spinner: F,
|
|
15
|
+
icon: k,
|
|
15
16
|
"icon-success": "FundTransactionStatus-module__icon-success___893VG",
|
|
16
17
|
"icon-error": "FundTransactionStatus-module__icon-error___-aQvD",
|
|
17
|
-
subhead:
|
|
18
|
+
subhead: v,
|
|
18
19
|
description: M,
|
|
19
|
-
ring:
|
|
20
|
+
ring: W,
|
|
20
21
|
"ring-success": "FundTransactionStatus-module__ring-success___Bxudq",
|
|
21
22
|
"ring-error": "FundTransactionStatus-module__ring-error___WmTaE"
|
|
22
|
-
},
|
|
23
|
-
const { state:
|
|
24
|
-
|
|
23
|
+
}, P = ["waiting", "transactionSubmitted", "transactionSuccess", "error"], D = (n) => {
|
|
24
|
+
const { state: a } = m(), r = l(null), u = l(null), d = _((e) => {
|
|
25
|
+
u.current !== e && (u.current = e, r.current?.transition.toggle(e));
|
|
25
26
|
}, []);
|
|
26
27
|
return S(() => {
|
|
27
|
-
(
|
|
28
|
-
}, [
|
|
29
|
-
|
|
28
|
+
(a.transactionStatus.statusName === "transactionSubmitted" || a.transactionStatus.statusName === "transactionSuccess" || a.transactionStatus.statusName === "error") && d(a.transactionStatus.statusName);
|
|
29
|
+
}, [a.transactionStatus.statusName, d]), /* @__PURE__ */ t(
|
|
30
|
+
T,
|
|
30
31
|
{
|
|
31
32
|
animateHeight: !1,
|
|
32
33
|
timeout: 250,
|
|
33
|
-
items:
|
|
34
|
+
items: P,
|
|
34
35
|
initialEntered: !0,
|
|
35
|
-
transitionRef:
|
|
36
|
-
children: ({ itemKey:
|
|
37
|
-
const
|
|
38
|
-
return /* @__PURE__ */
|
|
36
|
+
transitionRef: r,
|
|
37
|
+
children: ({ itemKey: e, ...p }) => {
|
|
38
|
+
const h = E[e];
|
|
39
|
+
return /* @__PURE__ */ t("div", { ...p, className: s.status, children: /* @__PURE__ */ t(h, { ...n }) });
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
);
|
|
42
43
|
}, x = () => {
|
|
43
|
-
const { state:
|
|
44
|
-
() =>
|
|
45
|
-
[
|
|
44
|
+
const { state: n } = m(), a = g(
|
|
45
|
+
() => n.paymentMethods?.find((r) => r.id === n.selectedPaymentMethod?.id),
|
|
46
|
+
[n.paymentMethods, n.selectedPaymentMethod?.id]
|
|
46
47
|
);
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
48
|
+
return /* @__PURE__ */ c(i, { children: [
|
|
49
|
+
/* @__PURE__ */ c("div", { className: s.graphic, children: [
|
|
50
|
+
/* @__PURE__ */ t(
|
|
51
|
+
N,
|
|
51
52
|
{
|
|
52
53
|
strokeWidth: "5%",
|
|
53
54
|
staticStroke: !0,
|
|
54
55
|
staticStrokeColor: "var(--cdp-web-colors-line-default)",
|
|
55
|
-
className:
|
|
56
|
+
className: s.spinner
|
|
56
57
|
}
|
|
57
58
|
),
|
|
58
|
-
|
|
59
|
+
a && /* @__PURE__ */ t("span", { className: s.icon, children: a.icon })
|
|
59
60
|
] }),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
" ",
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
/* @__PURE__ */ t("p", { className: s.subhead, children: "Waiting" }),
|
|
62
|
+
/* @__PURE__ */ c("p", { className: s.description, children: [
|
|
63
|
+
"Purchase ",
|
|
64
|
+
n.cryptoCurrency.toUpperCase(),
|
|
65
|
+
" with ",
|
|
66
|
+
n.fiatCurrency.toUpperCase(),
|
|
67
|
+
a ? ` via ${a.name}` : ""
|
|
67
68
|
] })
|
|
68
69
|
] });
|
|
69
|
-
},
|
|
70
|
-
reset:
|
|
71
|
-
timeRemaining:
|
|
72
|
-
unmountOnSuccess:
|
|
73
|
-
}) => /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
70
|
+
}, G = ({
|
|
71
|
+
reset: n,
|
|
72
|
+
timeRemaining: a,
|
|
73
|
+
unmountOnSuccess: r
|
|
74
|
+
}) => /* @__PURE__ */ c(i, { children: [
|
|
75
|
+
/* @__PURE__ */ c("div", { className: `${s.graphic} ${s.pad}`, children: [
|
|
76
|
+
/* @__PURE__ */ t("span", { className: `${s.ring} ${s["ring-success"]}` }),
|
|
77
|
+
/* @__PURE__ */ t("span", { className: `${s.icon} ${s["icon-success"]}`, children: /* @__PURE__ */ t($, {}) })
|
|
77
78
|
] }),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
79
|
+
/* @__PURE__ */ t("p", { className: s.subhead, children: "Your funds are on the way" }),
|
|
80
|
+
r && /* @__PURE__ */ c("p", { className: s.description, children: [
|
|
80
81
|
"This window will automatically close",
|
|
81
82
|
" ",
|
|
82
|
-
|
|
83
|
+
a === null ? "soon" : `in ${a}`
|
|
83
84
|
] }),
|
|
84
|
-
!
|
|
85
|
-
!
|
|
86
|
-
] }),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
!r && /* @__PURE__ */ t("p", { className: s.description, children: "Your transaction was submitted." }),
|
|
86
|
+
!r && n !== void 0 && /* @__PURE__ */ t(o, { fullWidth: !0, onClick: n, children: "Go back" })
|
|
87
|
+
] }), I = ({
|
|
88
|
+
reset: n,
|
|
89
|
+
timeRemaining: a,
|
|
90
|
+
unmountOnSuccess: r
|
|
91
|
+
}) => /* @__PURE__ */ c(i, { children: [
|
|
92
|
+
/* @__PURE__ */ c("div", { className: `${s.graphic} ${s.pad}`, children: [
|
|
93
|
+
/* @__PURE__ */ t("span", { className: `${s.ring} ${s["ring-success"]}` }),
|
|
94
|
+
/* @__PURE__ */ t("span", { className: `${s.icon} ${s["icon-success"]}`, children: /* @__PURE__ */ t(f, {}) })
|
|
90
95
|
] }),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
96
|
+
/* @__PURE__ */ t("p", { className: s.subhead, children: "Success" }),
|
|
97
|
+
r && /* @__PURE__ */ c("p", { className: s.description, children: [
|
|
93
98
|
"This window will automatically close",
|
|
94
99
|
" ",
|
|
95
|
-
|
|
100
|
+
a === null ? "soon" : `in ${a}`
|
|
96
101
|
] }),
|
|
97
|
-
!
|
|
98
|
-
!
|
|
102
|
+
!r && /* @__PURE__ */ t("p", { className: s.description, children: "Your transaction was successful." }),
|
|
103
|
+
!r && n !== void 0 && /* @__PURE__ */ t(o, { fullWidth: !0, onClick: n, children: "Go back" })
|
|
104
|
+
] }), B = ({ reset: n, timeRemaining: a, unmountOnError: r }) => /* @__PURE__ */ c(i, { children: [
|
|
105
|
+
/* @__PURE__ */ c("div", { className: `${s.graphic} ${s.pad}`, children: [
|
|
106
|
+
/* @__PURE__ */ t("span", { className: `${s.ring} ${s["ring-error"]}` }),
|
|
107
|
+
/* @__PURE__ */ t("span", { className: `${s.icon} ${s["icon-error"]}`, children: /* @__PURE__ */ t(w, {}) })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ t("p", { className: s.subhead, children: "Payment failed" }),
|
|
110
|
+
r && /* @__PURE__ */ c("p", { className: s.description, children: [
|
|
111
|
+
"This window will automatically close",
|
|
112
|
+
" ",
|
|
113
|
+
a === null ? "soon" : `in ${a}`
|
|
114
|
+
] }),
|
|
115
|
+
!r && /* @__PURE__ */ t("p", { className: s.description, children: "Something went wrong. Please try again." }),
|
|
116
|
+
!r && n !== void 0 && /* @__PURE__ */ t(o, { fullWidth: !0, onClick: n, children: "Try again" })
|
|
99
117
|
] }), E = {
|
|
100
118
|
waiting: x,
|
|
101
|
-
|
|
119
|
+
transactionSubmitted: G,
|
|
120
|
+
transactionSuccess: I,
|
|
102
121
|
error: B
|
|
103
122
|
};
|
|
104
123
|
export {
|
|
105
|
-
|
|
124
|
+
D as FundTransactionStatus
|
|
106
125
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
const
|
|
3
|
-
country:
|
|
4
|
-
cryptoCurrency:
|
|
1
|
+
import { useCallback as y, useMemo as _ } from "react";
|
|
2
|
+
const N = ({
|
|
3
|
+
country: t,
|
|
4
|
+
cryptoCurrency: a,
|
|
5
5
|
destinationAddress: o,
|
|
6
|
-
fetchBuyQuote:
|
|
7
|
-
fiatCurrency:
|
|
6
|
+
fetchBuyQuote: c,
|
|
7
|
+
fiatCurrency: n,
|
|
8
8
|
network: u,
|
|
9
|
-
onError:
|
|
10
|
-
subdivision:
|
|
9
|
+
onError: s,
|
|
10
|
+
subdivision: p
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
13
|
-
async ({ paymentMethod:
|
|
14
|
-
if (isNaN(
|
|
12
|
+
const U = y(
|
|
13
|
+
async ({ paymentMethod: d, paymentAmount: i }, l) => {
|
|
14
|
+
if (isNaN(i) || !o || !d)
|
|
15
15
|
return "";
|
|
16
16
|
try {
|
|
17
|
-
const e = (await
|
|
18
|
-
purchaseCurrency:
|
|
19
|
-
purchaseNetwork: u,
|
|
20
|
-
paymentCurrency:
|
|
21
|
-
paymentAmount:
|
|
22
|
-
paymentMethod:
|
|
17
|
+
const e = (await c({
|
|
18
|
+
purchaseCurrency: a.toUpperCase(),
|
|
19
|
+
purchaseNetwork: u.toLowerCase(),
|
|
20
|
+
paymentCurrency: n.toUpperCase(),
|
|
21
|
+
paymentAmount: i.toFixed(),
|
|
22
|
+
paymentMethod: d.replace("_GUEST", ""),
|
|
23
23
|
// remove "_GUEST" from the payment method since it is not valid in the Buy Quote API
|
|
24
|
-
country:
|
|
25
|
-
subdivision:
|
|
24
|
+
country: t.toUpperCase(),
|
|
25
|
+
subdivision: p?.toUpperCase(),
|
|
26
26
|
destinationAddress: o
|
|
27
27
|
})).onrampUrl;
|
|
28
28
|
if (!e) {
|
|
29
|
-
const
|
|
29
|
+
const m = {
|
|
30
30
|
errorType: "handled_error",
|
|
31
31
|
code: "NO_ONRAMP_URL",
|
|
32
32
|
debugMessage: "No payment methods found for the selected country and currency. See docs for more information: https://docs.cdp.coinbase.com/onramp/docs/api-configurations"
|
|
33
33
|
};
|
|
34
|
-
return
|
|
34
|
+
return l?.(m), s?.(m), "";
|
|
35
35
|
}
|
|
36
36
|
return e;
|
|
37
37
|
} catch (r) {
|
|
@@ -44,22 +44,22 @@ const R = ({
|
|
|
44
44
|
errorType: "unknown_error",
|
|
45
45
|
code: "UNKNOWN_BUY_URL_ERROR",
|
|
46
46
|
debugMessage: JSON.stringify(r)
|
|
47
|
-
},
|
|
47
|
+
}, l?.(e), s?.(e), "";
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
[
|
|
51
|
+
t,
|
|
51
52
|
a,
|
|
52
|
-
n,
|
|
53
53
|
o,
|
|
54
|
-
s,
|
|
55
|
-
t,
|
|
56
|
-
u,
|
|
57
54
|
c,
|
|
58
|
-
|
|
55
|
+
n,
|
|
56
|
+
u,
|
|
57
|
+
s,
|
|
58
|
+
p
|
|
59
59
|
]
|
|
60
60
|
);
|
|
61
|
-
return
|
|
61
|
+
return _(() => ({ fetchBuyUrl: U }), [U]);
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
N as useBuyUrl
|
|
65
65
|
};
|
|
@@ -1,53 +1,58 @@
|
|
|
1
|
-
import { useCallback as n, useEffect as
|
|
2
|
-
import { useFundContext as
|
|
3
|
-
import { setupOnrampEventListeners as
|
|
4
|
-
const
|
|
1
|
+
import { useCallback as n, useEffect as o } from "react";
|
|
2
|
+
import { useFundContext as i } from "../FundProvider.js";
|
|
3
|
+
import { setupOnrampEventListeners as c } from "../utils/setupOnrampEventListeners.js";
|
|
4
|
+
const s = (t) => ({
|
|
5
5
|
type: "SET_TRANSACTION_STATUS",
|
|
6
6
|
payload: {
|
|
7
7
|
transactionStatus: t
|
|
8
8
|
}
|
|
9
9
|
}), S = () => {
|
|
10
|
-
const { dispatch: t } =
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const { dispatch: t } = i(), a = n(
|
|
11
|
+
(e) => {
|
|
12
|
+
e.eventName === "transition_view" ? e.pageRoute.endsWith("/order-submitted") ? t(
|
|
13
|
+
s({
|
|
14
|
+
statusName: "transactionSubmitted",
|
|
15
|
+
statusData: null
|
|
16
|
+
})
|
|
17
|
+
) : t(
|
|
18
|
+
s({
|
|
14
19
|
statusName: "transactionPending",
|
|
15
20
|
statusData: null
|
|
16
21
|
})
|
|
17
|
-
) :
|
|
18
|
-
|
|
22
|
+
) : e.eventName === "error" && t(
|
|
23
|
+
s({
|
|
19
24
|
statusName: "error",
|
|
20
|
-
statusData:
|
|
25
|
+
statusData: e.error
|
|
21
26
|
})
|
|
22
27
|
);
|
|
23
28
|
},
|
|
24
29
|
[t]
|
|
25
30
|
), r = n(
|
|
26
|
-
(
|
|
31
|
+
(e) => {
|
|
27
32
|
t(
|
|
28
|
-
|
|
33
|
+
s({
|
|
29
34
|
statusName: "transactionSuccess",
|
|
30
|
-
statusData:
|
|
35
|
+
statusData: e || null
|
|
31
36
|
})
|
|
32
37
|
);
|
|
33
38
|
},
|
|
34
39
|
[t]
|
|
35
|
-
),
|
|
40
|
+
), u = n(() => {
|
|
36
41
|
t(
|
|
37
|
-
|
|
42
|
+
s({
|
|
38
43
|
statusName: "exit",
|
|
39
44
|
statusData: null
|
|
40
45
|
})
|
|
41
46
|
);
|
|
42
47
|
}, [t]);
|
|
43
|
-
|
|
44
|
-
const
|
|
48
|
+
o(() => {
|
|
49
|
+
const e = c({
|
|
45
50
|
onEvent: a,
|
|
46
|
-
onExit:
|
|
51
|
+
onExit: u,
|
|
47
52
|
onSuccess: r
|
|
48
53
|
});
|
|
49
54
|
return () => {
|
|
50
|
-
|
|
55
|
+
e();
|
|
51
56
|
};
|
|
52
57
|
}, []);
|
|
53
58
|
};
|
|
@@ -59,6 +59,9 @@ export type FundLifecycleStatus = {
|
|
|
59
59
|
} | {
|
|
60
60
|
statusName: "error";
|
|
61
61
|
statusData: OnrampError;
|
|
62
|
+
} | {
|
|
63
|
+
statusName: "transactionSubmitted";
|
|
64
|
+
statusData: null;
|
|
62
65
|
} | {
|
|
63
66
|
statusName: "transactionSuccess";
|
|
64
67
|
statusData: OnrampSuccessEventData | null;
|
|
@@ -66,6 +69,7 @@ export type FundLifecycleStatus = {
|
|
|
66
69
|
statusName: "transactionPending";
|
|
67
70
|
statusData: null;
|
|
68
71
|
};
|
|
72
|
+
export type FundTxResolution = Extract<FundLifecycleStatus["statusName"], "transactionSubmitted" | "transactionSuccess" | "error"> | null;
|
|
69
73
|
export type FundLifecycleEvents = {
|
|
70
74
|
onError?: (e: OnrampError | undefined) => void;
|
|
71
75
|
onStatus?: (lifecycleStatus: FundLifecycleStatus) => void;
|
|
@@ -2,20 +2,20 @@ import { jsx as r } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconAppleLogo as u } from "../../../icons/IconAppleLogo.js";
|
|
3
3
|
import { IconCoinbaseMark as A } from "../../../icons/IconCoinbaseMark.js";
|
|
4
4
|
import { IconCreditCard as C } from "../../../icons/IconCreditCard.js";
|
|
5
|
-
const s = 2, c = 500,
|
|
5
|
+
const s = 2, c = 500, b = (n) => [
|
|
6
6
|
// Check API-provided methods
|
|
7
7
|
n.some((e) => e.id === "ACH_BANK_ACCOUNT") && "ACH",
|
|
8
8
|
n.some((e) => e.id === "CARD") && "debit",
|
|
9
9
|
n.some((e) => e.id === "FIAT_WALLET") && "cash",
|
|
10
10
|
// Always include these methods
|
|
11
11
|
"crypto balance"
|
|
12
|
-
].filter(Boolean).join(", "),
|
|
12
|
+
].filter(Boolean).join(", "), M = ({ limits: n }) => {
|
|
13
13
|
const o = n.flatMap((t) => t.min ? [Number(t.min)] : []), e = n.flatMap((t) => t.max ? [Number(t.max)] : []);
|
|
14
14
|
return {
|
|
15
15
|
id: n[0].id,
|
|
16
16
|
// use the first limit id as the coinbase payment method id to avoid passing in an invalid option
|
|
17
17
|
name: "Coinbase",
|
|
18
|
-
description:
|
|
18
|
+
description: b(n),
|
|
19
19
|
icon: /* @__PURE__ */ r(A, {}),
|
|
20
20
|
minAmount: o.length > 0 ? Math.min(...o) : s,
|
|
21
21
|
maxAmount: e.length > 0 ? Math.max(...e) : c
|
|
@@ -33,25 +33,25 @@ const s = 2, c = 500, M = (n) => [
|
|
|
33
33
|
}
|
|
34
34
|
].map((e) => {
|
|
35
35
|
const t = n.limits.find(
|
|
36
|
-
(
|
|
36
|
+
(i) => i.id === e.id.replace("_GUEST", "")
|
|
37
37
|
);
|
|
38
38
|
return {
|
|
39
39
|
...e,
|
|
40
|
-
description:
|
|
40
|
+
description: `Up to $500/week. No sign up required.${e.id === "APPLE_PAY_GUEST" ? " Debit only." : ""}`,
|
|
41
41
|
minAmount: Number(t?.min) || s,
|
|
42
42
|
maxAmount: Number(t?.max) || c
|
|
43
43
|
};
|
|
44
|
-
}),
|
|
45
|
-
const t = o.toUpperCase(),
|
|
44
|
+
}), f = (n, o, e) => {
|
|
45
|
+
const t = o.toUpperCase(), i = e.toUpperCase(), a = n.paymentCurrencies.find(
|
|
46
46
|
(p) => p.id.toUpperCase() === t
|
|
47
47
|
);
|
|
48
|
-
if (!
|
|
48
|
+
if (!a)
|
|
49
49
|
return [];
|
|
50
|
-
const d =
|
|
50
|
+
const d = M(a);
|
|
51
51
|
let m = [];
|
|
52
|
-
return
|
|
52
|
+
return i === "US" && t === "USD" && (m = l(a)), [d, ...m];
|
|
53
53
|
};
|
|
54
54
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
b as buildCoinbasePaymentMethodDescription,
|
|
56
|
+
f as buildPaymentMethods
|
|
57
57
|
};
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as g, useRef as u,
|
|
3
|
-
import { useAmountInput as
|
|
4
|
-
import { useInputScale as
|
|
5
|
-
import '../../../assets/AmountInput.css';const w = "AmountInput-module__input___Af-R1", E = "AmountInput-module__visible___qmvT0", G = "AmountInput-module__hidden___cO0sQ",
|
|
2
|
+
import { forwardRef as g, useRef as u, useMemo as j, useCallback as q, useEffect as h } from "react";
|
|
3
|
+
import { useAmountInput as z } from "./useAmountInput.js";
|
|
4
|
+
import { useInputScale as M } from "./useInputScale.js";
|
|
5
|
+
import '../../../assets/AmountInput.css';const w = "AmountInput-module__input___Af-R1", E = "AmountInput-module__visible___qmvT0", G = "AmountInput-module__hidden___cO0sQ", O = "AmountInput-module__unit___-zmGz", n = {
|
|
6
6
|
"amount-input": "AmountInput-module__amount-input___24NlC",
|
|
7
7
|
input: w,
|
|
8
8
|
"amount-unit": "AmountInput-module__amount-unit___48d60",
|
|
9
9
|
visible: E,
|
|
10
10
|
hidden: G,
|
|
11
|
-
unit:
|
|
12
|
-
},
|
|
11
|
+
unit: O
|
|
12
|
+
}, P = g(
|
|
13
13
|
({
|
|
14
|
-
amount:
|
|
15
|
-
className:
|
|
16
|
-
unit:
|
|
17
|
-
decimalPlaces:
|
|
18
|
-
locale:
|
|
19
|
-
max:
|
|
20
|
-
min:
|
|
14
|
+
amount: I,
|
|
15
|
+
className: A = "",
|
|
16
|
+
unit: p,
|
|
17
|
+
decimalPlaces: r = 2,
|
|
18
|
+
locale: R,
|
|
19
|
+
max: v,
|
|
20
|
+
min: C,
|
|
21
21
|
setAmount: N,
|
|
22
22
|
onBlur: y,
|
|
23
|
-
onPaste:
|
|
24
|
-
placeholder:
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
const o = u(null),
|
|
23
|
+
onPaste: $,
|
|
24
|
+
placeholder: c = "0",
|
|
25
|
+
...b
|
|
26
|
+
}, t) => {
|
|
27
|
+
const o = u(null), i = u(null), m = u(null), d = u(null), _ = u(null), e = j(() => p?.toUpperCase(), [p]), { handleBlur: x, handleChange: B, handleBeforeInput: k, handlePaste: S, inputValue: l } = z(
|
|
28
28
|
{
|
|
29
|
-
amount:
|
|
30
|
-
decimalPlaces:
|
|
31
|
-
locale:
|
|
32
|
-
max:
|
|
33
|
-
min:
|
|
29
|
+
amount: I,
|
|
30
|
+
decimalPlaces: r,
|
|
31
|
+
locale: R,
|
|
32
|
+
max: v,
|
|
33
|
+
min: C,
|
|
34
34
|
setAmount: N,
|
|
35
35
|
onBlur: y,
|
|
36
|
-
onPaste:
|
|
36
|
+
onPaste: $
|
|
37
37
|
}
|
|
38
|
-
), { updateScale:
|
|
39
|
-
containerRef:
|
|
40
|
-
measureRef:
|
|
41
|
-
valueRef:
|
|
38
|
+
), { updateScale: f } = M({
|
|
39
|
+
containerRef: i,
|
|
40
|
+
measureRef: m,
|
|
41
|
+
valueRef: d,
|
|
42
42
|
inputRef: o,
|
|
43
|
-
scaleWrapperRef:
|
|
44
|
-
}),
|
|
45
|
-
|
|
43
|
+
scaleWrapperRef: _
|
|
44
|
+
}), U = q(() => {
|
|
45
|
+
i.current?.querySelector("input[type='text']")?.focus();
|
|
46
46
|
}, []);
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
}, [
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
/* @__PURE__ */ s("span", { ref:
|
|
47
|
+
return h(() => {
|
|
48
|
+
f();
|
|
49
|
+
}, [l, e, r, f]), h(() => {
|
|
50
|
+
t && (typeof t == "function" ? t(o.current) : t.current = o.current);
|
|
51
|
+
}, [t]), /* @__PURE__ */ s("span", { ref: i, className: n["amount-input"], children: [
|
|
52
|
+
/* @__PURE__ */ s("span", { ref: _, className: `${n["amount-unit"]} ${n.visible}`, children: [
|
|
53
53
|
/* @__PURE__ */ a(
|
|
54
54
|
"input",
|
|
55
55
|
{
|
|
56
|
-
className: `${n.input} ${
|
|
56
|
+
className: `${n.input} ${A}`,
|
|
57
57
|
inputMode: "decimal",
|
|
58
|
-
onBlur:
|
|
59
|
-
onChange:
|
|
60
|
-
onBeforeInput:
|
|
61
|
-
onPaste:
|
|
62
|
-
placeholder:
|
|
58
|
+
onBlur: x,
|
|
59
|
+
onChange: B,
|
|
60
|
+
onBeforeInput: k,
|
|
61
|
+
onPaste: S,
|
|
62
|
+
placeholder: c,
|
|
63
63
|
ref: o,
|
|
64
64
|
type: "text",
|
|
65
|
-
value:
|
|
66
|
-
|
|
65
|
+
value: l,
|
|
66
|
+
...b
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
|
|
69
|
+
e && /* @__PURE__ */ a("span", { className: n.unit, onClick: U, children: e })
|
|
70
70
|
] }),
|
|
71
71
|
/* @__PURE__ */ s(
|
|
72
72
|
"span",
|
|
73
73
|
{
|
|
74
|
-
ref:
|
|
74
|
+
ref: m,
|
|
75
75
|
"aria-hidden": "true",
|
|
76
76
|
className: `${n["amount-unit"]} ${n.hidden}`,
|
|
77
77
|
children: [
|
|
78
|
-
/* @__PURE__ */ s("span", { ref:
|
|
79
|
-
|
|
78
|
+
/* @__PURE__ */ s("span", { ref: d, children: [
|
|
79
|
+
l || c,
|
|
80
80
|
" "
|
|
81
81
|
] }),
|
|
82
|
-
|
|
82
|
+
e && /* @__PURE__ */ a("span", { children: e })
|
|
83
83
|
]
|
|
84
84
|
}
|
|
85
85
|
)
|
|
86
86
|
] });
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
|
-
|
|
89
|
+
P.displayName = "AmountInput";
|
|
90
90
|
export {
|
|
91
|
-
|
|
91
|
+
P as AmountInput
|
|
92
92
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { SvgIcon as t } from "./SvgIcon.js";
|
|
4
|
+
const h = (C) => /* @__PURE__ */ o(t, { width: "25", height: "24", viewBox: "0 0 25 24", fill: "currentColor", ...C, children: [
|
|
5
|
+
/* @__PURE__ */ r("path", { d: "M10.4523 10.6689L9.48873 8.35229L8.52518 10.6689L6.02417 10.8694L7.92968 12.5017L7.34752 14.9423L9.48873 13.6344L11.63 14.9423L11.0478 12.5017L12.9533 10.8694L10.4523 10.6689Z" }),
|
|
6
|
+
/* @__PURE__ */ r("path", { d: "M9.48877 20.4951C14.1832 20.4951 17.9888 16.6895 17.9888 11.9951C17.9888 7.3007 14.1832 3.49512 9.48877 3.49512C4.79435 3.49512 0.98877 7.3007 0.98877 11.9951C0.98877 16.6895 4.79435 20.4951 9.48877 20.4951ZM9.48877 18.4951C5.89892 18.4951 2.98877 15.585 2.98877 11.9951C2.98877 8.40527 5.89892 5.49512 9.48877 5.49512C13.0786 5.49512 15.9888 8.40527 15.9888 11.9951C15.9888 15.585 13.0786 18.4951 9.48877 18.4951Z" }),
|
|
7
|
+
/* @__PURE__ */ r("path", { d: "M18.9888 20.1215C22.4631 19.0539 24.9888 15.8194 24.9888 11.9951C24.9888 8.17069 22.4631 4.93622 18.9888 3.86865V5.99322C21.3377 6.97278 22.9888 9.2911 22.9888 11.9951C22.9888 14.699 21.3377 17.0173 18.9888 17.9969V20.1215Z" })
|
|
8
|
+
] });
|
|
9
|
+
export {
|
|
10
|
+
h as IconCurrencies
|
|
11
|
+
};
|
package/dist/theme/theme.d.ts
CHANGED
|
@@ -168,7 +168,7 @@ export declare const theme: Flattened<{
|
|
|
168
168
|
};
|
|
169
169
|
readonly border: {
|
|
170
170
|
readonly default: {
|
|
171
|
-
readonly value: "{colors.line.
|
|
171
|
+
readonly value: "{colors.line.default}";
|
|
172
172
|
};
|
|
173
173
|
readonly focus: {
|
|
174
174
|
readonly value: "{colors.line.primary}";
|
|
@@ -209,7 +209,7 @@ export declare const theme: Flattened<{
|
|
|
209
209
|
};
|
|
210
210
|
readonly border: {
|
|
211
211
|
readonly default: {
|
|
212
|
-
readonly value: "{colors.line.
|
|
212
|
+
readonly value: "{colors.line.default}";
|
|
213
213
|
};
|
|
214
214
|
readonly focus: {
|
|
215
215
|
readonly value: "{colors.line.primary}";
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -253,7 +253,7 @@ export declare const colorsComponents: {
|
|
|
253
253
|
};
|
|
254
254
|
readonly border: {
|
|
255
255
|
readonly default: {
|
|
256
|
-
readonly value: "{colors.line.
|
|
256
|
+
readonly value: "{colors.line.default}";
|
|
257
257
|
};
|
|
258
258
|
readonly focus: {
|
|
259
259
|
readonly value: "{colors.line.primary}";
|
|
@@ -294,7 +294,7 @@ export declare const colorsComponents: {
|
|
|
294
294
|
};
|
|
295
295
|
readonly border: {
|
|
296
296
|
readonly default: {
|
|
297
|
-
readonly value: "{colors.line.
|
|
297
|
+
readonly value: "{colors.line.default}";
|
|
298
298
|
};
|
|
299
299
|
readonly focus: {
|
|
300
300
|
readonly value: "{colors.line.primary}";
|
|
@@ -517,7 +517,7 @@ export declare const colors: {
|
|
|
517
517
|
};
|
|
518
518
|
readonly border: {
|
|
519
519
|
readonly default: {
|
|
520
|
-
readonly value: "{colors.line.
|
|
520
|
+
readonly value: "{colors.line.default}";
|
|
521
521
|
};
|
|
522
522
|
readonly focus: {
|
|
523
523
|
readonly value: "{colors.line.primary}";
|
|
@@ -558,7 +558,7 @@ export declare const colors: {
|
|
|
558
558
|
};
|
|
559
559
|
readonly border: {
|
|
560
560
|
readonly default: {
|
|
561
|
-
readonly value: "{colors.line.
|
|
561
|
+
readonly value: "{colors.line.default}";
|
|
562
562
|
};
|
|
563
563
|
readonly focus: {
|
|
564
564
|
readonly value: "{colors.line.primary}";
|
|
@@ -868,7 +868,7 @@ export declare const tokens: {
|
|
|
868
868
|
};
|
|
869
869
|
readonly border: {
|
|
870
870
|
readonly default: {
|
|
871
|
-
readonly value: "{colors.line.
|
|
871
|
+
readonly value: "{colors.line.default}";
|
|
872
872
|
};
|
|
873
873
|
readonly focus: {
|
|
874
874
|
readonly value: "{colors.line.primary}";
|
|
@@ -909,7 +909,7 @@ export declare const tokens: {
|
|
|
909
909
|
};
|
|
910
910
|
readonly border: {
|
|
911
911
|
readonly default: {
|
|
912
|
-
readonly value: "{colors.line.
|
|
912
|
+
readonly value: "{colors.line.default}";
|
|
913
913
|
};
|
|
914
914
|
readonly focus: {
|
|
915
915
|
readonly value: "{colors.line.primary}";
|
package/dist/theme/tokens.js
CHANGED
|
@@ -153,7 +153,7 @@ const e = {
|
|
|
153
153
|
default: { value: "{colors.bg.default}" }
|
|
154
154
|
},
|
|
155
155
|
border: {
|
|
156
|
-
default: { value: "{colors.line.
|
|
156
|
+
default: { value: "{colors.line.default}" },
|
|
157
157
|
focus: { value: "{colors.line.primary}" },
|
|
158
158
|
error: { value: "{colors.line.negative}" },
|
|
159
159
|
success: { value: "{colors.line.positive}" }
|
|
@@ -176,7 +176,7 @@ const e = {
|
|
|
176
176
|
default: { value: "{colors.bg.default}" }
|
|
177
177
|
},
|
|
178
178
|
border: {
|
|
179
|
-
default: { value: "{colors.line.
|
|
179
|
+
default: { value: "{colors.line.default}" },
|
|
180
180
|
focus: { value: "{colors.line.primary}" },
|
|
181
181
|
error: { value: "{colors.line.negative}" },
|
|
182
182
|
success: { value: "{colors.line.positive}" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
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.29",
|
|
18
|
+
"@coinbase/cdp-hooks": "^0.0.29"
|
|
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.29",
|
|
49
|
+
"@coinbase/cdp-hooks": "^0.0.29"
|
|
50
50
|
},
|
|
51
51
|
"size-limit": [
|
|
52
52
|
{
|