@nowramp/form 0.1.44 → 0.1.45
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -93
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +6 -6
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -68,7 +68,7 @@ function Pt(t, n) {
|
|
|
68
68
|
}, [t.projectId, n]);
|
|
69
69
|
return { quotes: a, loading: l, error: d, refetch: v };
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Ht(t) {
|
|
72
72
|
const [n, a] = b(null), [r, l] = b(!1), [m, d] = b(null), u = K(null), s = K(""), i = `${t.apiUrl}|${t.projectId}`;
|
|
73
73
|
(!u.current || s.current !== i) && (u.current = new Me({ apiKey: "", ...t }), s.current = i);
|
|
74
74
|
const h = $(async (v) => {
|
|
@@ -87,7 +87,7 @@ function Dt(t) {
|
|
|
87
87
|
}, []);
|
|
88
88
|
return { order: n, loading: r, error: m, createOrder: h, reset: f };
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Dt(t, n, a) {
|
|
91
91
|
const [r, l] = b(null), [m, d] = b(!1), [u, s] = b(null), i = K(null);
|
|
92
92
|
i.current || (i.current = new Me({ apiKey: "", projectId: "", ...t }));
|
|
93
93
|
const h = $(async () => {
|
|
@@ -218,7 +218,7 @@ function Kt({
|
|
|
218
218
|
onError: N,
|
|
219
219
|
children: T
|
|
220
220
|
}) {
|
|
221
|
-
const P = F(() => ({ apiUrl: n, projectId: t }), [n, t]), w = u || (d ? d.toLowerCase() : ""),
|
|
221
|
+
const P = F(() => ({ apiUrl: n, projectId: t }), [n, t]), w = u || (d ? d.toLowerCase() : ""), j = r === "sell", Q = j ? !!i : !!s, q = (j ? !!(Q && d && w) : !!(Q && d && w && h)) && f ? "confirm" : "amount", [c, O] = It(Ut, {
|
|
222
222
|
...yt,
|
|
223
223
|
step: q,
|
|
224
224
|
flowType: r,
|
|
@@ -232,15 +232,15 @@ function Kt({
|
|
|
232
232
|
}), C = c.flowType === "sell", {
|
|
233
233
|
config: I,
|
|
234
234
|
loading: _,
|
|
235
|
-
error:
|
|
235
|
+
error: V
|
|
236
236
|
} = Ot(P, c.flowType);
|
|
237
237
|
ke.useEffect(() => {
|
|
238
238
|
var L, k, S;
|
|
239
239
|
if (!I || !c.cryptoCurrency || c.network) return;
|
|
240
|
-
const g = (L = I.cryptos) == null ? void 0 : L.find((
|
|
240
|
+
const g = (L = I.cryptos) == null ? void 0 : L.find((H) => H.code === c.cryptoCurrency), A = ((k = g == null ? void 0 : g.networks) == null ? void 0 : k.find((H) => H.isDefault)) || ((S = g == null ? void 0 : g.networks) == null ? void 0 : S[0]);
|
|
241
241
|
A != null && A.id && O({ type: "SET_NETWORK", network: A.id });
|
|
242
242
|
}, [I, c.cryptoCurrency, c.network]), ke.useEffect(() => {
|
|
243
|
-
var S,
|
|
243
|
+
var S, H;
|
|
244
244
|
if (!((S = I == null ? void 0 : I.paymentMethods) != null && S.length)) return;
|
|
245
245
|
const g = c.fiatCurrency, A = I.paymentMethods;
|
|
246
246
|
if (c.paymentMethodId && A.some(
|
|
@@ -248,11 +248,11 @@ function Kt({
|
|
|
248
248
|
))
|
|
249
249
|
return;
|
|
250
250
|
const k = A.find(
|
|
251
|
-
(
|
|
252
|
-
) || A.find((
|
|
253
|
-
O({ type: "SET_PAYMENT_METHOD", methodId: (k == null ? void 0 : k.id) || ((
|
|
251
|
+
(D) => D.supportedFiats.includes(g) && (D.id.includes("card") || D.id.includes("debit"))
|
|
252
|
+
) || A.find((D) => D.supportedFiats.includes(g));
|
|
253
|
+
O({ type: "SET_PAYMENT_METHOD", methodId: (k == null ? void 0 : k.id) || ((H = A[0]) == null ? void 0 : H.id) || "" });
|
|
254
254
|
}, [I, c.fiatCurrency, c.paymentMethodId]);
|
|
255
|
-
const
|
|
255
|
+
const G = F(() => {
|
|
256
256
|
if (C) {
|
|
257
257
|
if (!c.cryptoAmount) return null;
|
|
258
258
|
const S = parseFloat(c.cryptoAmount);
|
|
@@ -267,7 +267,7 @@ function Kt({
|
|
|
267
267
|
return !isNaN(L) && g < L ? `Minimum amount is ${A.minAmount} ${c.fiatCurrency}` : !isNaN(k) && g > k ? `Maximum amount is ${A.maxAmount} ${c.fiatCurrency}` : null;
|
|
268
268
|
}, [I, c.fiatAmount, c.fiatCurrency, c.cryptoAmount, C]), Ne = F(() => {
|
|
269
269
|
const g = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
270
|
-
return !I || !g || !c.cryptoCurrency || !c.network ||
|
|
270
|
+
return !I || !g || !c.cryptoCurrency || !c.network || G ? null : {
|
|
271
271
|
fiatCurrency: c.fiatCurrency,
|
|
272
272
|
...C ? { cryptoAmount: c.cryptoAmount } : { fiatAmount: c.fiatAmount },
|
|
273
273
|
cryptoCurrency: c.cryptoCurrency,
|
|
@@ -276,7 +276,7 @@ function Kt({
|
|
|
276
276
|
country: c.country || void 0,
|
|
277
277
|
orderType: c.flowType
|
|
278
278
|
};
|
|
279
|
-
}, [I, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country,
|
|
279
|
+
}, [I, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country, G, C, c.flowType]), {
|
|
280
280
|
quotes: fe,
|
|
281
281
|
loading: ce,
|
|
282
282
|
error: X,
|
|
@@ -286,20 +286,20 @@ function Kt({
|
|
|
286
286
|
loading: Ce,
|
|
287
287
|
error: ie,
|
|
288
288
|
createOrder: de
|
|
289
|
-
} =
|
|
290
|
-
status:
|
|
289
|
+
} = Ht(P), be = 15e3, {
|
|
290
|
+
status: Y,
|
|
291
291
|
loading: re
|
|
292
|
-
} =
|
|
292
|
+
} = Dt(
|
|
293
293
|
{ apiUrl: n },
|
|
294
294
|
(ae == null ? void 0 : ae.orderId) ?? null,
|
|
295
295
|
{ pollInterval: x, initialDelay: be }
|
|
296
296
|
);
|
|
297
297
|
ke.useEffect(() => {
|
|
298
|
-
(
|
|
299
|
-
}, [
|
|
300
|
-
const g =
|
|
298
|
+
(Y == null ? void 0 : Y.status) === "completed" && p && p(Y);
|
|
299
|
+
}, [Y == null ? void 0 : Y.status, p]), ke.useEffect(() => {
|
|
300
|
+
const g = V || ie;
|
|
301
301
|
g && N && N(g);
|
|
302
|
-
}, [
|
|
302
|
+
}, [V, ie, N]);
|
|
303
303
|
const oe = f || (I == null ? void 0 : I.defaultGateway) || null, Ee = K(oe);
|
|
304
304
|
Ee.current = oe;
|
|
305
305
|
const Ae = K(fe);
|
|
@@ -326,8 +326,8 @@ function Kt({
|
|
|
326
326
|
orderType: c.flowType
|
|
327
327
|
}), O({ type: "SET_STEP", step: "checkout" });
|
|
328
328
|
} catch (S) {
|
|
329
|
-
const
|
|
330
|
-
/wallet|address/i.test(
|
|
329
|
+
const H = S instanceof Error ? S.message : "Failed to create order";
|
|
330
|
+
/wallet|address/i.test(H) ? O({ type: "SET_WALLET_ERROR", message: H.replace(/^Failed to create checkout intent:\s*/i, "") }) : O({ type: "SET_ERROR", message: H });
|
|
331
331
|
}
|
|
332
332
|
}, [c, de, C]), ee = $((g) => {
|
|
333
333
|
O({ type: "SET_STEP", step: g });
|
|
@@ -338,9 +338,9 @@ function Kt({
|
|
|
338
338
|
const g = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
339
339
|
switch (c.step) {
|
|
340
340
|
case "confirm":
|
|
341
|
-
return !!(g && c.cryptoCurrency && c.network && c.walletAddress && !
|
|
341
|
+
return !!(g && c.cryptoCurrency && c.network && c.walletAddress && !G);
|
|
342
342
|
case "amount":
|
|
343
|
-
return !!(g && c.cryptoCurrency && c.network && !
|
|
343
|
+
return !!(g && c.cryptoCurrency && c.network && !G);
|
|
344
344
|
case "quotes":
|
|
345
345
|
return !!c.selectedQuote;
|
|
346
346
|
case "wallet":
|
|
@@ -348,12 +348,12 @@ function Kt({
|
|
|
348
348
|
default:
|
|
349
349
|
return !1;
|
|
350
350
|
}
|
|
351
|
-
}, [c,
|
|
351
|
+
}, [c, G, C]), xe = {
|
|
352
352
|
apiConfig: P,
|
|
353
353
|
assetBaseUrl: a,
|
|
354
354
|
config: I,
|
|
355
355
|
configLoading: _,
|
|
356
|
-
configError:
|
|
356
|
+
configError: V,
|
|
357
357
|
state: c,
|
|
358
358
|
dispatch: O,
|
|
359
359
|
quotes: fe,
|
|
@@ -364,11 +364,11 @@ function Kt({
|
|
|
364
364
|
orderLoading: Ce,
|
|
365
365
|
orderError: ie,
|
|
366
366
|
createOrder: we,
|
|
367
|
-
orderStatus:
|
|
367
|
+
orderStatus: Y,
|
|
368
368
|
orderStatusLoading: re,
|
|
369
369
|
fieldLocks: v || null,
|
|
370
370
|
defaultGateway: oe,
|
|
371
|
-
amountError:
|
|
371
|
+
amountError: G,
|
|
372
372
|
goToStep: ee,
|
|
373
373
|
goBack: ue,
|
|
374
374
|
canProceed: Oe
|
|
@@ -802,7 +802,7 @@ function In(t) {
|
|
|
802
802
|
const n = t.toPrecision(4);
|
|
803
803
|
return parseFloat(n).toString();
|
|
804
804
|
}
|
|
805
|
-
const _e = (t) => /^#([0-9A-Fa-f]{3}){1,2}$/.test(t), mt = 10, pt = 1e-4,
|
|
805
|
+
const _e = (t) => /^#([0-9A-Fa-f]{3}){1,2}$/.test(t), mt = 10, pt = 1e-4, Vt = (() => {
|
|
806
806
|
const t = [];
|
|
807
807
|
for (const n of Ft)
|
|
808
808
|
for (const a of n.chains)
|
|
@@ -835,13 +835,13 @@ function $e({ currencyCode: t, size: n = 16, baseUrl: a = "" }) {
|
|
|
835
835
|
}
|
|
836
836
|
);
|
|
837
837
|
}
|
|
838
|
-
function
|
|
838
|
+
function Ve({ size: t = 32, color: n = "#888" }) {
|
|
839
839
|
return /* @__PURE__ */ o("svg", { width: t, height: t, viewBox: "0 0 32 32", fill: "none", children: [
|
|
840
840
|
/* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "16", fill: n }),
|
|
841
841
|
/* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "8", stroke: "white", strokeWidth: "1.5", fill: "none" })
|
|
842
842
|
] });
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Gt({ size: t = 24 }) {
|
|
845
845
|
return /* @__PURE__ */ o("svg", { width: t, height: t, viewBox: "0 0 32 32", fill: "none", children: [
|
|
846
846
|
/* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "16", fill: "#0077FF" }),
|
|
847
847
|
/* @__PURE__ */ e("path", { d: "M8 15l8-6 8 6H8z", fill: "white" }),
|
|
@@ -851,7 +851,7 @@ function jt({ size: t = 24 }) {
|
|
|
851
851
|
/* @__PURE__ */ e("rect", { x: "8", y: "22", width: "16", height: "2", rx: "0.5", fill: "white" })
|
|
852
852
|
] });
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function jt({ size: t = 32 }) {
|
|
855
855
|
return /* @__PURE__ */ e(
|
|
856
856
|
"div",
|
|
857
857
|
{
|
|
@@ -861,7 +861,7 @@ function Wt({ size: t = 32 }) {
|
|
|
861
861
|
}
|
|
862
862
|
);
|
|
863
863
|
}
|
|
864
|
-
function
|
|
864
|
+
function Wt({ size: t = 32 }) {
|
|
865
865
|
return /* @__PURE__ */ e(
|
|
866
866
|
"div",
|
|
867
867
|
{
|
|
@@ -871,7 +871,7 @@ function Yt({ size: t = 32 }) {
|
|
|
871
871
|
}
|
|
872
872
|
);
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function Yt({ size: t = 32 }) {
|
|
875
875
|
return /* @__PURE__ */ o(
|
|
876
876
|
"div",
|
|
877
877
|
{
|
|
@@ -927,9 +927,8 @@ function Jt({ onClick: t }) {
|
|
|
927
927
|
return /* @__PURE__ */ e("button", { onClick: t, className: "hover:opacity-70 transition-opacity", children: /* @__PURE__ */ e("svg", { width: "24", height: "16", viewBox: "0 0 24 16", fill: "none", children: /* @__PURE__ */ e(
|
|
928
928
|
"path",
|
|
929
929
|
{
|
|
930
|
-
d: "
|
|
931
|
-
|
|
932
|
-
strokeWidth: "1.6"
|
|
930
|
+
d: "M22.4004 12V4C22.4004 2.67452 21.3255 1.59961 20 1.59961H6.7998V14.4004H20V16H4V14.4004H5.2002V1.59961H4C2.67452 1.59961 1.59961 2.67452 1.59961 4V12C1.59961 13.3255 2.67452 14.4004 4 14.4004V16L3.79395 15.9951C1.68056 15.8879 0 14.14 0 12V4C0 1.79086 1.79086 6.44266e-08 4 0H20C22.2091 0 24 1.79086 24 4V12L23.9951 12.2061C23.8913 14.2512 22.2512 15.8913 20.2061 15.9951L20 16V14.4004C21.3255 14.4004 22.4004 13.3255 22.4004 12Z",
|
|
931
|
+
fill: "var(--t-icon-stroke)"
|
|
933
932
|
}
|
|
934
933
|
) }) });
|
|
935
934
|
}
|
|
@@ -949,19 +948,19 @@ function qt({ size: t = 40 }) {
|
|
|
949
948
|
function en(t, n = 32) {
|
|
950
949
|
switch (t) {
|
|
951
950
|
case "revolut":
|
|
952
|
-
return /* @__PURE__ */ e(
|
|
951
|
+
return /* @__PURE__ */ e(jt, { size: n });
|
|
953
952
|
case "applepay":
|
|
954
|
-
return /* @__PURE__ */ e(
|
|
953
|
+
return /* @__PURE__ */ e(Wt, { size: n });
|
|
955
954
|
case "card":
|
|
956
955
|
return /* @__PURE__ */ e(Zt, { size: n });
|
|
957
956
|
case "googlepay":
|
|
958
|
-
return /* @__PURE__ */ e(
|
|
957
|
+
return /* @__PURE__ */ e(Yt, { size: n });
|
|
959
958
|
case "paypal":
|
|
960
959
|
return /* @__PURE__ */ e(Qt, { size: n });
|
|
961
960
|
case "bank":
|
|
962
|
-
return /* @__PURE__ */ e(
|
|
961
|
+
return /* @__PURE__ */ e(Gt, { size: n });
|
|
963
962
|
default:
|
|
964
|
-
return /* @__PURE__ */ e(
|
|
963
|
+
return /* @__PURE__ */ e(Ve, { size: n });
|
|
965
964
|
}
|
|
966
965
|
}
|
|
967
966
|
const tn = {
|
|
@@ -986,7 +985,7 @@ function vt(t, n) {
|
|
|
986
985
|
}
|
|
987
986
|
function Nt(t, n, a = 24) {
|
|
988
987
|
const r = tn[t];
|
|
989
|
-
return r ? en(r, a) : n ? /* @__PURE__ */ e("img", { src: n, alt: "", width: a, height: a, style: { borderRadius: "50%" } }) : /* @__PURE__ */ e(
|
|
988
|
+
return r ? en(r, a) : n ? /* @__PURE__ */ e("img", { src: n, alt: "", width: a, height: a, style: { borderRadius: "50%" } }) : /* @__PURE__ */ e(Ve, { size: a });
|
|
990
989
|
}
|
|
991
990
|
function an({
|
|
992
991
|
methods: t,
|
|
@@ -1945,7 +1944,7 @@ function hn({ onClose: t, onSelect: n, currencies: a, assetBaseUrl: r = "" }) {
|
|
|
1945
1944
|
}
|
|
1946
1945
|
function fn({ onClose: t, onSelect: n, cryptos: a, assetBaseUrl: r = "" }) {
|
|
1947
1946
|
const [l, m] = b(""), d = F(() => {
|
|
1948
|
-
if (!a || a.length === 0) return
|
|
1947
|
+
if (!a || a.length === 0) return Vt;
|
|
1949
1948
|
const s = [];
|
|
1950
1949
|
for (const i of a) {
|
|
1951
1950
|
const h = i.networks || [];
|
|
@@ -1970,10 +1969,10 @@ function fn({ onClose: t, onSelect: n, cryptos: a, assetBaseUrl: r = "" }) {
|
|
|
1970
1969
|
if (!s) return d;
|
|
1971
1970
|
const i = s.split(/\s+/), h = [];
|
|
1972
1971
|
for (const v of d) {
|
|
1973
|
-
const x = Ie(v.chain), p = x ? x.name.toLowerCase() : "", N = ((f = x == null ? void 0 : x.shortName) == null ? void 0 : f.toLowerCase()) || "", T = v.chain.toLowerCase(), P = v.code.toLowerCase(), w = v.name.toLowerCase(),
|
|
1974
|
-
if (!i.every((q) =>
|
|
1975
|
-
let
|
|
1976
|
-
P === s ?
|
|
1972
|
+
const x = Ie(v.chain), p = x ? x.name.toLowerCase() : "", N = ((f = x == null ? void 0 : x.shortName) == null ? void 0 : f.toLowerCase()) || "", T = v.chain.toLowerCase(), P = v.code.toLowerCase(), w = v.name.toLowerCase(), j = [P, w, p, N, T];
|
|
1973
|
+
if (!i.every((q) => j.some((c) => c.includes(q)))) continue;
|
|
1974
|
+
let W = 0;
|
|
1975
|
+
P === s ? W += 100 : P.startsWith(i[0]) && (W += 50), v.popular && (W += 10), i.length > 1 && (p.includes(i[1]) || N.includes(i[1]) || T.includes(i[1])) && (W += 25), h.push({ item: v, score: W });
|
|
1977
1976
|
}
|
|
1978
1977
|
return h.sort((v, x) => x.score - v.score), h.map((v) => v.item);
|
|
1979
1978
|
}, [d, l]);
|
|
@@ -2227,18 +2226,18 @@ function Nn({
|
|
|
2227
2226
|
config: T,
|
|
2228
2227
|
configLoading: P,
|
|
2229
2228
|
quotes: w,
|
|
2230
|
-
quotesLoading:
|
|
2229
|
+
quotesLoading: j,
|
|
2231
2230
|
quotesError: Q,
|
|
2232
|
-
fetchQuotes:
|
|
2231
|
+
fetchQuotes: W,
|
|
2233
2232
|
createOrder: q,
|
|
2234
2233
|
orderLoading: c,
|
|
2235
2234
|
amountError: O,
|
|
2236
2235
|
fieldLocks: C,
|
|
2237
2236
|
apiConfig: I,
|
|
2238
2237
|
assetBaseUrl: _
|
|
2239
|
-
} = he(), [
|
|
2238
|
+
} = he(), [V, G] = b(n === "dark"), [Ne, fe] = b(a), [ce, X] = b(null), [ye, ae] = b(!1), [Ce, ie] = b(!1), [de, be] = b(!1), [Y, re] = b(null), [oe, Ee] = b(!0), [Ae, we] = b(!1), [ee, ue] = b(!1), Oe = K(null), xe = K(), g = K(p.flowType);
|
|
2240
2239
|
U(() => {
|
|
2241
|
-
|
|
2240
|
+
G(n === "dark");
|
|
2242
2241
|
}, [n]), U(() => {
|
|
2243
2242
|
const y = setTimeout(() => Ee(!1), P ? 0 : 800);
|
|
2244
2243
|
return () => clearTimeout(y);
|
|
@@ -2250,7 +2249,7 @@ function Nn({
|
|
|
2250
2249
|
}
|
|
2251
2250
|
g.current = p.flowType;
|
|
2252
2251
|
}, [p.flowType, oe]);
|
|
2253
|
-
const A = p.flowType, L = A === "buy", k = p.cryptoCurrency || "BTC", S = p.fiatCurrency || "USD",
|
|
2252
|
+
const A = p.flowType, L = A === "buy", k = p.cryptoCurrency || "BTC", S = p.fiatCurrency || "USD", H = L ? p.fiatAmount : p.cryptoAmount, D = $t(H), Z = (qe = w == null ? void 0 : w.bestQuote) != null && qe.exchangeRate ? parseFloat(w.bestQuote.exchangeRate) : null, Se = K(null);
|
|
2254
2253
|
Z && k && S && (Se.current = { rate: Z, crypto: k, fiat: S });
|
|
2255
2254
|
const Ct = F(() => {
|
|
2256
2255
|
if (w != null && w.bestQuote) {
|
|
@@ -2259,8 +2258,8 @@ function Nn({
|
|
|
2259
2258
|
}
|
|
2260
2259
|
return "0";
|
|
2261
2260
|
}, [w, L]), bt = F(() => {
|
|
2262
|
-
var B, te,
|
|
2263
|
-
const y = Z || ((B = Se.current) == null ? void 0 : B.rate), E = Z ? k : (te = Se.current) == null ? void 0 : te.crypto, R = Z ? S : (
|
|
2261
|
+
var B, te, De;
|
|
2262
|
+
const y = Z || ((B = Se.current) == null ? void 0 : B.rate), E = Z ? k : (te = Se.current) == null ? void 0 : te.crypto, R = Z ? S : (De = Se.current) == null ? void 0 : De.fiat;
|
|
2264
2263
|
return !y || !E || !R ? "" : `1 ${E} ≈ ${y.toFixed(2)} ${R}`;
|
|
2265
2264
|
}, [k, S, Z]);
|
|
2266
2265
|
U(() => {
|
|
@@ -2291,11 +2290,11 @@ function Nn({
|
|
|
2291
2290
|
}
|
|
2292
2291
|
}, 500), () => clearTimeout(xe.current);
|
|
2293
2292
|
}, [p.walletAddress, p.network, I.apiUrl]);
|
|
2294
|
-
const
|
|
2293
|
+
const Ge = !H || D === 0, je = D > 0 && (L ? D < mt : D < pt), We = !!O || je || ye && Ge, Et = D > 0 && !O && !je, Pe = p.walletAddress.trim().length >= 10 && Y !== !1 && !de, Re = Et && Pe && !!p.cryptoCurrency && !!p.network, At = (y) => {
|
|
2295
2294
|
let E = y.target.value.replace(/[^0-9.,]/g, "");
|
|
2296
2295
|
const R = L ? 2 : 6, B = E.indexOf(".");
|
|
2297
2296
|
B !== -1 && E.length - B - 1 > R && (E = E.slice(0, B + R + 1)), N(L ? { type: "SET_FIAT_AMOUNT", amount: E } : { type: "SET_CRYPTO_AMOUNT", amount: E });
|
|
2298
|
-
},
|
|
2297
|
+
}, Ye = (y) => {
|
|
2299
2298
|
y !== A && N({ type: "SET_FLOW_TYPE", flowType: y });
|
|
2300
2299
|
}, wt = $(
|
|
2301
2300
|
(y) => {
|
|
@@ -2313,11 +2312,11 @@ function Nn({
|
|
|
2313
2312
|
},
|
|
2314
2313
|
[N]
|
|
2315
2314
|
), Tt = () => {
|
|
2316
|
-
Re && (ue(!0),
|
|
2315
|
+
Re && (ue(!0), W());
|
|
2317
2316
|
};
|
|
2318
2317
|
U(() => {
|
|
2319
2318
|
var y;
|
|
2320
|
-
if (!(!ee ||
|
|
2319
|
+
if (!(!ee || j)) {
|
|
2321
2320
|
if (w != null && w.bestQuote)
|
|
2322
2321
|
ue(!1), N({ type: "SELECT_QUOTE", quote: w.bestQuote }), q().catch(() => {
|
|
2323
2322
|
});
|
|
@@ -2329,14 +2328,14 @@ function Nn({
|
|
|
2329
2328
|
N({ type: "SET_ERROR", message: R });
|
|
2330
2329
|
}
|
|
2331
2330
|
}
|
|
2332
|
-
}, [ee, w,
|
|
2333
|
-
const Qe =
|
|
2334
|
-
"--t-accent":
|
|
2335
|
-
"--t-cta-bg":
|
|
2336
|
-
"--t-cta-text":
|
|
2331
|
+
}, [ee, w, j, Q, N, q]);
|
|
2332
|
+
const Qe = V ? "theme-dark" : "theme-light", He = dt.find((y) => y.id === Ne) || dt[0], kt = He.accent === null, Ze = (r ? _e(r) : !1) ? { "--t-accent": r, "--t-cta-bg": r, "--t-cta-text": "#ffffff" } : kt ? {
|
|
2333
|
+
"--t-accent": V ? "#ffffff" : "#111111",
|
|
2334
|
+
"--t-cta-bg": V ? "#ffffff" : "#111111",
|
|
2335
|
+
"--t-cta-text": V ? "#000000" : "#ffffff"
|
|
2337
2336
|
} : {
|
|
2338
|
-
"--t-accent":
|
|
2339
|
-
"--t-cta-bg":
|
|
2337
|
+
"--t-accent": He.accent,
|
|
2338
|
+
"--t-cta-bg": He.accent,
|
|
2340
2339
|
"--t-cta-text": "#ffffff"
|
|
2341
2340
|
}, le = {};
|
|
2342
2341
|
l && _e(l) ? le.backgroundColor = l : le.backgroundColor = "var(--t-bg)", m && (le.backgroundImage = `url(${m})`, le.backgroundSize = "cover", le.backgroundPosition = "center");
|
|
@@ -2375,7 +2374,7 @@ function Nn({
|
|
|
2375
2374
|
/* @__PURE__ */ e(
|
|
2376
2375
|
"button",
|
|
2377
2376
|
{
|
|
2378
|
-
onClick: () =>
|
|
2377
|
+
onClick: () => Ye("buy"),
|
|
2379
2378
|
className: "flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",
|
|
2380
2379
|
style: { color: A === "buy" ? "var(--t-text)" : "var(--t-text-secondary)" },
|
|
2381
2380
|
children: "Buy"
|
|
@@ -2384,7 +2383,7 @@ function Nn({
|
|
|
2384
2383
|
/* @__PURE__ */ e(
|
|
2385
2384
|
"button",
|
|
2386
2385
|
{
|
|
2387
|
-
onClick: () =>
|
|
2386
|
+
onClick: () => Ye("sell"),
|
|
2388
2387
|
className: "flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",
|
|
2389
2388
|
style: { color: A === "sell" ? "var(--t-text)" : "var(--t-text-secondary)" },
|
|
2390
2389
|
children: "Sell"
|
|
@@ -2414,7 +2413,8 @@ function Nn({
|
|
|
2414
2413
|
style: {
|
|
2415
2414
|
background: "var(--t-surface)",
|
|
2416
2415
|
borderRadius: 5,
|
|
2417
|
-
border: ye &&
|
|
2416
|
+
border: ye && We ? "1px solid #EF4444" : "1px solid transparent",
|
|
2417
|
+
minHeight: 102
|
|
2418
2418
|
},
|
|
2419
2419
|
children: [
|
|
2420
2420
|
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "You spend" }),
|
|
@@ -2424,7 +2424,7 @@ function Nn({
|
|
|
2424
2424
|
{
|
|
2425
2425
|
ref: Oe,
|
|
2426
2426
|
type: "text",
|
|
2427
|
-
value:
|
|
2427
|
+
value: H,
|
|
2428
2428
|
onChange: At,
|
|
2429
2429
|
onBlur: () => ae(!0),
|
|
2430
2430
|
placeholder: L ? "250" : "0.01",
|
|
@@ -2493,7 +2493,7 @@ function Nn({
|
|
|
2493
2493
|
]
|
|
2494
2494
|
}
|
|
2495
2495
|
),
|
|
2496
|
-
ye &&
|
|
2496
|
+
ye && We && /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5 px-[2px]", style: { color: "#EF4444" }, children: O || (Ge ? "Amount should be more than 0" : L ? `Minimum amount is ${mt} ${S}` : `Minimum amount is ${pt} ${k}`) }),
|
|
2497
2497
|
/* @__PURE__ */ o(
|
|
2498
2498
|
"div",
|
|
2499
2499
|
{
|
|
@@ -2504,18 +2504,19 @@ function Nn({
|
|
|
2504
2504
|
borderTopRightRadius: 5,
|
|
2505
2505
|
borderBottomLeftRadius: 0,
|
|
2506
2506
|
borderBottomRightRadius: 0,
|
|
2507
|
-
marginTop: 4
|
|
2507
|
+
marginTop: 4,
|
|
2508
|
+
minHeight: 102
|
|
2508
2509
|
},
|
|
2509
2510
|
children: [
|
|
2510
2511
|
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "You get" }),
|
|
2511
2512
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between", children: [
|
|
2512
|
-
|
|
2513
|
+
j ? /* @__PURE__ */ e(M, { w: 180, h: 32 }) : /* @__PURE__ */ e(
|
|
2513
2514
|
mn,
|
|
2514
2515
|
{
|
|
2515
|
-
value:
|
|
2516
|
+
value: D > 0 ? Ct : "0",
|
|
2516
2517
|
height: 32,
|
|
2517
2518
|
className: "font-semibold",
|
|
2518
|
-
style: { color:
|
|
2519
|
+
style: { color: D > 0 ? "var(--t-text)" : "var(--t-text-muted)", fontSize: 24 }
|
|
2519
2520
|
}
|
|
2520
2521
|
),
|
|
2521
2522
|
L ? /* @__PURE__ */ o("div", { className: "flex flex-col items-end shrink-0", children: [
|
|
@@ -2696,8 +2697,8 @@ function Nn({
|
|
|
2696
2697
|
vn,
|
|
2697
2698
|
{
|
|
2698
2699
|
onClose: y,
|
|
2699
|
-
darkMode:
|
|
2700
|
-
onToggleDarkMode:
|
|
2700
|
+
darkMode: V,
|
|
2701
|
+
onToggleDarkMode: G,
|
|
2701
2702
|
skinId: Ne,
|
|
2702
2703
|
onSelectSkin: (E) => {
|
|
2703
2704
|
fe(E);
|
|
@@ -2728,17 +2729,17 @@ function Cn({
|
|
|
2728
2729
|
className: T,
|
|
2729
2730
|
theme: P,
|
|
2730
2731
|
skinId: w,
|
|
2731
|
-
accentColor:
|
|
2732
|
+
accentColor: j,
|
|
2732
2733
|
bgColor: Q,
|
|
2733
|
-
bgImage:
|
|
2734
|
+
bgImage: W,
|
|
2734
2735
|
borderColor: q,
|
|
2735
2736
|
borderRadius: c,
|
|
2736
2737
|
showFlowToggle: O,
|
|
2737
2738
|
autoRedirect: C,
|
|
2738
2739
|
explorerUrl: I,
|
|
2739
2740
|
doneButtonText: _,
|
|
2740
|
-
supportEmail:
|
|
2741
|
-
onDone:
|
|
2741
|
+
supportEmail: V,
|
|
2742
|
+
onDone: G
|
|
2742
2743
|
}) {
|
|
2743
2744
|
return /* @__PURE__ */ e(
|
|
2744
2745
|
Kt,
|
|
@@ -2765,17 +2766,17 @@ function Cn({
|
|
|
2765
2766
|
className: T,
|
|
2766
2767
|
theme: P,
|
|
2767
2768
|
skinId: w,
|
|
2768
|
-
accentColor:
|
|
2769
|
+
accentColor: j,
|
|
2769
2770
|
bgColor: Q,
|
|
2770
|
-
bgImage:
|
|
2771
|
+
bgImage: W,
|
|
2771
2772
|
borderColor: q,
|
|
2772
2773
|
borderRadius: c,
|
|
2773
2774
|
showFlowToggle: O,
|
|
2774
2775
|
autoRedirect: C,
|
|
2775
2776
|
explorerUrl: I,
|
|
2776
2777
|
doneButtonText: _,
|
|
2777
|
-
supportEmail:
|
|
2778
|
-
onDone:
|
|
2778
|
+
supportEmail: V,
|
|
2779
|
+
onDone: G
|
|
2779
2780
|
}
|
|
2780
2781
|
)
|
|
2781
2782
|
}
|
|
@@ -2838,7 +2839,7 @@ function En({ quote: t }) {
|
|
|
2838
2839
|
className: "rounded-full shrink-0",
|
|
2839
2840
|
style: { width: 36, height: 36 }
|
|
2840
2841
|
}
|
|
2841
|
-
) : /* @__PURE__ */ e(
|
|
2842
|
+
) : /* @__PURE__ */ e(Ve, { size: 36 });
|
|
2842
2843
|
}
|
|
2843
2844
|
function An() {
|
|
2844
2845
|
return /* @__PURE__ */ e("div", { className: "space-y-2", children: [0, 1, 2].map((t) => /* @__PURE__ */ o(
|
|
@@ -2943,10 +2944,10 @@ function Pn({
|
|
|
2943
2944
|
export {
|
|
2944
2945
|
un as AnimatedDigit,
|
|
2945
2946
|
mn as AnimatedNumber,
|
|
2946
|
-
|
|
2947
|
+
Wt as ApplePayIcon,
|
|
2947
2948
|
Fe as BLOCKCHAINS,
|
|
2948
|
-
|
|
2949
|
-
|
|
2949
|
+
Gt as BankIcon,
|
|
2950
|
+
Vt as CRYPTO_CHAIN_COMBOS,
|
|
2950
2951
|
Ft as CRYPTO_CURRENCIES,
|
|
2951
2952
|
Zt as CardIcon,
|
|
2952
2953
|
Bn as CheckoutForm,
|
|
@@ -2967,8 +2968,8 @@ export {
|
|
|
2967
2968
|
hn as FiatCurrencyModal,
|
|
2968
2969
|
$e as FiatFlag,
|
|
2969
2970
|
pn as FormSkeleton,
|
|
2970
|
-
|
|
2971
|
-
|
|
2971
|
+
Ve as GenericCoinIcon,
|
|
2972
|
+
Yt as GooglePayIcon,
|
|
2972
2973
|
ut as MOCK_RATES,
|
|
2973
2974
|
Jt as MenuIcon,
|
|
2974
2975
|
Le as Modal,
|
|
@@ -2977,7 +2978,7 @@ export {
|
|
|
2977
2978
|
ln as ProcessingStep,
|
|
2978
2979
|
Cn as RampForm,
|
|
2979
2980
|
Kt as RampProvider,
|
|
2980
|
-
|
|
2981
|
+
jt as RevolutIcon,
|
|
2981
2982
|
dt as SKINS,
|
|
2982
2983
|
Be as SearchInput,
|
|
2983
2984
|
vn as SettingsScreen,
|
|
@@ -2991,10 +2992,10 @@ export {
|
|
|
2991
2992
|
Ln as getMockRate,
|
|
2992
2993
|
en as getPaymentIcon,
|
|
2993
2994
|
$t as parseAmount,
|
|
2994
|
-
|
|
2995
|
+
Ht as useCheckoutIntent,
|
|
2995
2996
|
Pt as useQuotes,
|
|
2996
2997
|
he as useRamp,
|
|
2997
2998
|
Ot as useRampConfig,
|
|
2998
|
-
|
|
2999
|
+
Dt as useTransaction
|
|
2999
3000
|
};
|
|
3000
3001
|
//# sourceMappingURL=index.js.map
|