@nowramp/form 0.1.40 → 0.1.41
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 +170 -149
- 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
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
document.head.appendChild(s);
|
|
10
10
|
})();
|
|
11
11
|
import { jsx as e, jsxs as l, Fragment as J } from "react/jsx-runtime";
|
|
12
|
-
import ke, { useState as N, useRef as
|
|
12
|
+
import ke, { useState as N, useRef as U, useCallback as _, useEffect as H, useMemo as K, useReducer as Tt, useContext as kt, createContext as Lt } from "react";
|
|
13
13
|
import { RampApi as Me } from "@nowramp/sdk";
|
|
14
14
|
function It(t, a) {
|
|
15
|
-
const [n, s] = N(null), [r, u] = N(!0), [m, i] = N(null), o =
|
|
15
|
+
const [n, s] = N(null), [r, u] = N(!0), [m, i] = N(null), o = U(null);
|
|
16
16
|
(!o.current || o.current !== t) && (o.current = new Me({ apiKey: "", ...t }));
|
|
17
17
|
const d = _(async () => {
|
|
18
18
|
if (!t.projectId) {
|
|
@@ -29,15 +29,15 @@ function It(t, a) {
|
|
|
29
29
|
u(!1);
|
|
30
30
|
}
|
|
31
31
|
}, [t.projectId, a]);
|
|
32
|
-
return
|
|
32
|
+
return H(() => {
|
|
33
33
|
d();
|
|
34
34
|
}, [d]), { config: n, loading: r, error: m, refetch: d };
|
|
35
35
|
}
|
|
36
36
|
function Mt(t, a) {
|
|
37
|
-
const [n, s] = N(null), [r, u] = N(!1), [m, i] = N(null), o =
|
|
37
|
+
const [n, s] = N(null), [r, u] = N(!1), [m, i] = N(null), o = U(null), d = U(""), h = `${t.apiUrl}|${t.projectId}`;
|
|
38
38
|
(!o.current || d.current !== h) && (o.current = new Me({ apiKey: "", ...t }), d.current = h);
|
|
39
|
-
const f =
|
|
40
|
-
|
|
39
|
+
const f = U(0);
|
|
40
|
+
H(() => {
|
|
41
41
|
const g = ++f.current;
|
|
42
42
|
if (!a || !t.projectId) {
|
|
43
43
|
s(null), u(!1);
|
|
@@ -68,7 +68,7 @@ function Mt(t, a) {
|
|
|
68
68
|
return { quotes: n, loading: r, error: m, refetch: x };
|
|
69
69
|
}
|
|
70
70
|
function Bt(t) {
|
|
71
|
-
const [a, n] = N(null), [s, r] = N(!1), [u, m] = N(null), i =
|
|
71
|
+
const [a, n] = N(null), [s, r] = N(!1), [u, m] = N(null), i = U(null), o = U(""), d = `${t.apiUrl}|${t.projectId}`;
|
|
72
72
|
(!i.current || o.current !== d) && (i.current = new Me({ apiKey: "", ...t }), o.current = d);
|
|
73
73
|
const h = _(async (x) => {
|
|
74
74
|
r(!0), m(null);
|
|
@@ -87,7 +87,7 @@ function Bt(t) {
|
|
|
87
87
|
return { order: a, loading: s, error: u, createOrder: h, reset: f };
|
|
88
88
|
}
|
|
89
89
|
function Ot(t, a, n) {
|
|
90
|
-
const [s, r] = N(null), [u, m] = N(!1), [i, o] = N(null), d =
|
|
90
|
+
const [s, r] = N(null), [u, m] = N(!1), [i, o] = N(null), d = U(null);
|
|
91
91
|
d.current || (d.current = new Me({ apiKey: "", projectId: "", ...t }));
|
|
92
92
|
const h = _(async () => {
|
|
93
93
|
if (a) {
|
|
@@ -102,7 +102,7 @@ function Ot(t, a, n) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}, [a]);
|
|
105
|
-
return
|
|
105
|
+
return H(() => {
|
|
106
106
|
if (!a) return;
|
|
107
107
|
const f = (n == null ? void 0 : n.initialDelay) ?? 0;
|
|
108
108
|
if (f > 0) {
|
|
@@ -110,7 +110,7 @@ function Ot(t, a, n) {
|
|
|
110
110
|
return () => clearTimeout(x);
|
|
111
111
|
}
|
|
112
112
|
h();
|
|
113
|
-
}, [h, a, n == null ? void 0 : n.initialDelay]),
|
|
113
|
+
}, [h, a, n == null ? void 0 : n.initialDelay]), H(() => {
|
|
114
114
|
if (!a || !(n != null && n.pollInterval) || !s || ["completed", "failed", "cancelled", "expired", "refunded"].includes(s.status))
|
|
115
115
|
return;
|
|
116
116
|
const x = setInterval(h, n.pollInterval);
|
|
@@ -198,7 +198,7 @@ function Pt(t, a) {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
const ft = Lt(null);
|
|
201
|
-
function
|
|
201
|
+
function Dt({
|
|
202
202
|
projectId: t,
|
|
203
203
|
apiUrl: a = "https://api.nowramp.com",
|
|
204
204
|
assetBaseUrl: n = "",
|
|
@@ -215,9 +215,9 @@ function Ht({
|
|
|
215
215
|
statusPollInterval: g = 5e3,
|
|
216
216
|
onComplete: p,
|
|
217
217
|
onError: b,
|
|
218
|
-
children:
|
|
218
|
+
children: R
|
|
219
219
|
}) {
|
|
220
|
-
const P =
|
|
220
|
+
const P = K(() => ({ apiUrl: a, projectId: t }), [a, t]), w = i || (m ? m.toLowerCase() : ""), G = s === "sell", Q = G ? !!d : !!o, z = (G ? !!(Q && m && w) : !!(Q && m && w && h)) && f ? "confirm" : "amount", [c, O] = Tt(Pt, {
|
|
221
221
|
...ht,
|
|
222
222
|
step: z,
|
|
223
223
|
flowType: s,
|
|
@@ -230,39 +230,39 @@ function Ht({
|
|
|
230
230
|
customerId: r
|
|
231
231
|
}), C = c.flowType === "sell", {
|
|
232
232
|
config: L,
|
|
233
|
-
loading:
|
|
233
|
+
loading: F,
|
|
234
234
|
error: X
|
|
235
235
|
} = It(P, c.flowType);
|
|
236
236
|
ke.useEffect(() => {
|
|
237
|
-
var S, k,
|
|
237
|
+
var S, k, T;
|
|
238
238
|
if (!L || !c.cryptoCurrency || c.network) return;
|
|
239
|
-
const v = (S = L.cryptos) == null ? void 0 : S.find((
|
|
239
|
+
const v = (S = L.cryptos) == null ? void 0 : S.find((D) => D.code === c.cryptoCurrency), E = ((k = v == null ? void 0 : v.networks) == null ? void 0 : k.find((D) => D.isDefault)) || ((T = v == null ? void 0 : v.networks) == null ? void 0 : T[0]);
|
|
240
240
|
E != null && E.id && O({ type: "SET_NETWORK", network: E.id });
|
|
241
241
|
}, [L, c.cryptoCurrency, c.network]), ke.useEffect(() => {
|
|
242
|
-
var k,
|
|
242
|
+
var k, T;
|
|
243
243
|
if (!((k = L == null ? void 0 : L.paymentMethods) != null && k.length)) return;
|
|
244
244
|
const v = c.fiatCurrency, E = L.paymentMethods;
|
|
245
245
|
if (c.paymentMethodId && E.some(
|
|
246
246
|
(W) => W.id === c.paymentMethodId && W.supportedFiats.includes(v)
|
|
247
247
|
))
|
|
248
248
|
return;
|
|
249
|
-
const S = E.find((
|
|
250
|
-
O({ type: "SET_PAYMENT_METHOD", methodId: (S == null ? void 0 : S.id) || ((
|
|
249
|
+
const S = E.find((D) => D.supportedFiats.includes(v));
|
|
250
|
+
O({ type: "SET_PAYMENT_METHOD", methodId: (S == null ? void 0 : S.id) || ((T = E[0]) == null ? void 0 : T.id) || "" });
|
|
251
251
|
}, [L, c.fiatCurrency, c.paymentMethodId]);
|
|
252
|
-
const $ =
|
|
252
|
+
const $ = K(() => {
|
|
253
253
|
if (C) {
|
|
254
254
|
if (!c.cryptoAmount) return null;
|
|
255
|
-
const
|
|
256
|
-
return isNaN(
|
|
255
|
+
const T = parseFloat(c.cryptoAmount);
|
|
256
|
+
return isNaN(T) || T <= 0 ? "Enter a valid amount" : null;
|
|
257
257
|
}
|
|
258
258
|
if (!L || !c.fiatAmount) return null;
|
|
259
259
|
const v = parseFloat(c.fiatAmount);
|
|
260
260
|
if (isNaN(v)) return null;
|
|
261
|
-
const E = L.fiats.find((
|
|
261
|
+
const E = L.fiats.find((T) => T.code === c.fiatCurrency);
|
|
262
262
|
if (!E) return null;
|
|
263
263
|
const S = parseFloat(E.minAmount), k = parseFloat(E.maxAmount);
|
|
264
264
|
return !isNaN(S) && v < S ? `Minimum amount is ${E.minAmount} ${c.fiatCurrency}` : !isNaN(k) && v > k ? `Maximum amount is ${E.maxAmount} ${c.fiatCurrency}` : null;
|
|
265
|
-
}, [L, c.fiatAmount, c.fiatCurrency, c.cryptoAmount, C]), Ne =
|
|
265
|
+
}, [L, c.fiatAmount, c.fiatCurrency, c.cryptoAmount, C]), Ne = K(() => {
|
|
266
266
|
const v = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
267
267
|
return !L || !v || !c.cryptoCurrency || !c.network || $ ? null : {
|
|
268
268
|
fiatCurrency: c.fiatCurrency,
|
|
@@ -276,7 +276,7 @@ function Ht({
|
|
|
276
276
|
}, [L, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country, $, C, c.flowType]), {
|
|
277
277
|
quotes: he,
|
|
278
278
|
loading: fe,
|
|
279
|
-
error:
|
|
279
|
+
error: j,
|
|
280
280
|
refetch: ye
|
|
281
281
|
} = Mt(P, Ne), {
|
|
282
282
|
order: ae,
|
|
@@ -297,16 +297,16 @@ function Ht({
|
|
|
297
297
|
const v = X || se;
|
|
298
298
|
v && b && b(v);
|
|
299
299
|
}, [X, se, b]);
|
|
300
|
-
const re = f || (L == null ? void 0 : L.defaultGateway) || null, Ee =
|
|
300
|
+
const re = f || (L == null ? void 0 : L.defaultGateway) || null, Ee = U(re);
|
|
301
301
|
Ee.current = re;
|
|
302
|
-
const Ae =
|
|
302
|
+
const Ae = U(he);
|
|
303
303
|
Ae.current = he;
|
|
304
304
|
const we = _(async () => {
|
|
305
305
|
var E, S, k;
|
|
306
306
|
const v = ((E = c.selectedQuote) == null ? void 0 : E.gatewayId) || ((k = (S = Ae.current) == null ? void 0 : S.bestQuote) == null ? void 0 : k.gatewayId) || Ee.current;
|
|
307
307
|
if (!v || !c.walletAddress) {
|
|
308
|
-
const
|
|
309
|
-
O({ type: "SET_ERROR", message: `Missing required fields: ${
|
|
308
|
+
const T = [!v && "gateway", !c.walletAddress && "walletAddress"].filter(Boolean).join(", ");
|
|
309
|
+
O({ type: "SET_ERROR", message: `Missing required fields: ${T}` });
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
try {
|
|
@@ -322,16 +322,16 @@ function Ht({
|
|
|
322
322
|
email: c.email || void 0,
|
|
323
323
|
orderType: c.flowType
|
|
324
324
|
}), O({ type: "SET_STEP", step: "checkout" });
|
|
325
|
-
} catch (
|
|
326
|
-
const
|
|
327
|
-
/wallet|address/i.test(
|
|
325
|
+
} catch (T) {
|
|
326
|
+
const D = T instanceof Error ? T.message : "Failed to create order";
|
|
327
|
+
/wallet|address/i.test(D) ? O({ type: "SET_WALLET_ERROR", message: D.replace(/^Failed to create checkout intent:\s*/i, "") }) : O({ type: "SET_ERROR", message: D });
|
|
328
328
|
}
|
|
329
329
|
}, [c, ce, C]), q = _((v) => {
|
|
330
330
|
O({ type: "SET_STEP", step: v });
|
|
331
331
|
}, []), ie = _(() => {
|
|
332
332
|
const v = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], E = v.indexOf(c.step);
|
|
333
333
|
E > 0 && O({ type: "SET_STEP", step: v[E - 1] });
|
|
334
|
-
}, [c.step, C]), Oe =
|
|
334
|
+
}, [c.step, C]), Oe = K(() => {
|
|
335
335
|
const v = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
336
336
|
switch (c.step) {
|
|
337
337
|
case "confirm":
|
|
@@ -349,13 +349,13 @@ function Ht({
|
|
|
349
349
|
apiConfig: P,
|
|
350
350
|
assetBaseUrl: n,
|
|
351
351
|
config: L,
|
|
352
|
-
configLoading:
|
|
352
|
+
configLoading: F,
|
|
353
353
|
configError: X,
|
|
354
354
|
state: c,
|
|
355
355
|
dispatch: O,
|
|
356
356
|
quotes: he,
|
|
357
357
|
quotesLoading: fe,
|
|
358
|
-
quotesError:
|
|
358
|
+
quotesError: j,
|
|
359
359
|
fetchQuotes: ye,
|
|
360
360
|
order: ae,
|
|
361
361
|
orderLoading: Ce,
|
|
@@ -370,7 +370,7 @@ function Ht({
|
|
|
370
370
|
goBack: ie,
|
|
371
371
|
canProceed: Oe
|
|
372
372
|
};
|
|
373
|
-
return /* @__PURE__ */ e(ft.Provider, { value: xe, children:
|
|
373
|
+
return /* @__PURE__ */ e(ft.Provider, { value: xe, children: R });
|
|
374
374
|
}
|
|
375
375
|
function pe() {
|
|
376
376
|
const t = kt(ft);
|
|
@@ -512,7 +512,7 @@ const Ie = {
|
|
|
512
512
|
OKC: { name: "OKX Chain", icon: "eth" },
|
|
513
513
|
UNI_CHAIN: { name: "UNI", icon: "uni" },
|
|
514
514
|
ZEC: { name: "ZCash", icon: "zec" }
|
|
515
|
-
},
|
|
515
|
+
}, Ht = [
|
|
516
516
|
// --- Popular / Top coins ---
|
|
517
517
|
{ code: "BTC", name: "Bitcoin", chains: ["BTC", "LN"], popular: !0 },
|
|
518
518
|
{ code: "ETH", name: "Ethereum", chains: ["ETH", "ARB", "BASE", "BSC", "OPTIMISM", "LINEA", "ZKSYNC", "LRC", "STARK", "APE", "ECLIPSE", "FUEL", "INK", "SOPHON", "UNICHAIN", "WLD"], popular: !0 },
|
|
@@ -705,25 +705,46 @@ const Ie = {
|
|
|
705
705
|
{ code: "ZCHF", name: "Frankencoin", chains: ["ETH"], popular: !1 },
|
|
706
706
|
{ code: "ZETA", name: "Zeta", chains: ["ETH", "ZETACHAIN"], popular: !1 },
|
|
707
707
|
{ code: "ZTG", name: "Zeitgeist", chains: ["ZTG"], popular: !1 }
|
|
708
|
-
],
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
JPY: "jp",
|
|
713
|
-
CAD: "ca",
|
|
708
|
+
], Ut = {
|
|
709
|
+
AED: "ae",
|
|
710
|
+
ALL: "al",
|
|
711
|
+
ARS: "ar",
|
|
714
712
|
AUD: "au",
|
|
715
713
|
BRL: "br",
|
|
714
|
+
CAD: "ca",
|
|
716
715
|
CHF: "ch",
|
|
717
|
-
|
|
716
|
+
CLP: "cl",
|
|
717
|
+
CZK: "cz",
|
|
718
|
+
DKK: "dk",
|
|
719
|
+
EUR: "eu",
|
|
720
|
+
GBP: "gb",
|
|
721
|
+
HKD: "hk",
|
|
722
|
+
IDR: "id",
|
|
718
723
|
INR: "in",
|
|
719
|
-
|
|
720
|
-
|
|
724
|
+
JPY: "jp",
|
|
725
|
+
KRW: "kr",
|
|
726
|
+
MXN: "mx",
|
|
727
|
+
NGN: "ng",
|
|
728
|
+
NOK: "no",
|
|
729
|
+
NZD: "nz",
|
|
730
|
+
PHP: "ph",
|
|
731
|
+
PLN: "pl",
|
|
732
|
+
QAR: "qa",
|
|
733
|
+
SAR: "sa",
|
|
734
|
+
SEK: "se",
|
|
735
|
+
SGD: "sg",
|
|
736
|
+
THB: "th",
|
|
737
|
+
TRY: "tr",
|
|
738
|
+
TWD: "tw",
|
|
739
|
+
USD: "us",
|
|
740
|
+
VND: "vn",
|
|
741
|
+
ZAR: "za"
|
|
721
742
|
};
|
|
722
743
|
function yt(t, a = "") {
|
|
723
744
|
return `${a}/crypto-icons/${t.toLowerCase()}.svg`;
|
|
724
745
|
}
|
|
725
|
-
function
|
|
726
|
-
const n =
|
|
746
|
+
function Kt(t, a = "") {
|
|
747
|
+
const n = Ut[t] || "us";
|
|
727
748
|
return `${a}/flags/${n}.svg`;
|
|
728
749
|
}
|
|
729
750
|
function _e(t, a = "") {
|
|
@@ -764,7 +785,7 @@ function Aa(t, a) {
|
|
|
764
785
|
var n, s;
|
|
765
786
|
return ((n = it[t]) == null ? void 0 : n[a]) ?? ((s = it.USDC) == null ? void 0 : s[a]) ?? 1;
|
|
766
787
|
}
|
|
767
|
-
function
|
|
788
|
+
function Ft(t) {
|
|
768
789
|
return parseFloat(t.replace(/,/g, "")) || 0;
|
|
769
790
|
}
|
|
770
791
|
function wa(t) {
|
|
@@ -775,9 +796,9 @@ function wa(t) {
|
|
|
775
796
|
const a = t.toPrecision(4);
|
|
776
797
|
return parseFloat(a).toString();
|
|
777
798
|
}
|
|
778
|
-
const
|
|
799
|
+
const Fe = (t) => /^#([0-9A-Fa-f]{3}){1,2}$/.test(t), dt = 10, ut = 1e-4, _t = (() => {
|
|
779
800
|
const t = [];
|
|
780
|
-
for (const a of
|
|
801
|
+
for (const a of Ht)
|
|
781
802
|
for (const n of a.chains)
|
|
782
803
|
t.push({ code: a.code, name: a.name, chain: n, popular: a.popular });
|
|
783
804
|
return t;
|
|
@@ -799,7 +820,7 @@ function Xe({ currencyCode: t, size: a = 16, baseUrl: n = "" }) {
|
|
|
799
820
|
return /* @__PURE__ */ e(
|
|
800
821
|
"img",
|
|
801
822
|
{
|
|
802
|
-
src:
|
|
823
|
+
src: Kt(t, n),
|
|
803
824
|
alt: t,
|
|
804
825
|
width: a,
|
|
805
826
|
height: a,
|
|
@@ -844,7 +865,7 @@ function Gt({ size: t = 32 }) {
|
|
|
844
865
|
}
|
|
845
866
|
);
|
|
846
867
|
}
|
|
847
|
-
function
|
|
868
|
+
function Yt({ size: t = 32 }) {
|
|
848
869
|
return /* @__PURE__ */ l(
|
|
849
870
|
"div",
|
|
850
871
|
{
|
|
@@ -857,7 +878,7 @@ function jt({ size: t = 32 }) {
|
|
|
857
878
|
}
|
|
858
879
|
);
|
|
859
880
|
}
|
|
860
|
-
function
|
|
881
|
+
function jt({ size: t = 32 }) {
|
|
861
882
|
return /* @__PURE__ */ e(
|
|
862
883
|
"div",
|
|
863
884
|
{
|
|
@@ -928,9 +949,9 @@ function Jt(t, a = 32) {
|
|
|
928
949
|
case "card":
|
|
929
950
|
return /* @__PURE__ */ e(Vt, { size: a });
|
|
930
951
|
case "googlepay":
|
|
931
|
-
return /* @__PURE__ */ e(jt, { size: a });
|
|
932
|
-
case "paypal":
|
|
933
952
|
return /* @__PURE__ */ e(Yt, { size: a });
|
|
953
|
+
case "paypal":
|
|
954
|
+
return /* @__PURE__ */ e(jt, { size: a });
|
|
934
955
|
case "bank":
|
|
935
956
|
return /* @__PURE__ */ e(Xt, { size: a });
|
|
936
957
|
default:
|
|
@@ -943,7 +964,7 @@ function Le({
|
|
|
943
964
|
children: n
|
|
944
965
|
}) {
|
|
945
966
|
const [s, r] = N(!1), [u, m] = N(!1);
|
|
946
|
-
|
|
967
|
+
H(() => {
|
|
947
968
|
if (t)
|
|
948
969
|
r(!0), requestAnimationFrame(() => requestAnimationFrame(() => m(!0)));
|
|
949
970
|
else if (s) {
|
|
@@ -1018,7 +1039,7 @@ function zt({
|
|
|
1018
1039
|
onSelect: n,
|
|
1019
1040
|
onClose: s
|
|
1020
1041
|
}) {
|
|
1021
|
-
const [r, u] = N(""), m =
|
|
1042
|
+
const [r, u] = N(""), m = K(() => {
|
|
1022
1043
|
const i = r.trim().toLowerCase();
|
|
1023
1044
|
return i ? t.filter(
|
|
1024
1045
|
(o) => o.id.toLowerCase().includes(i) || o.name.toLowerCase().includes(i) || o.description && o.description.toLowerCase().includes(i)
|
|
@@ -1085,7 +1106,7 @@ function ea({
|
|
|
1085
1106
|
onSelect: n,
|
|
1086
1107
|
fiatCurrency: s
|
|
1087
1108
|
}) {
|
|
1088
|
-
const [r, u] = N(!1), m =
|
|
1109
|
+
const [r, u] = N(!1), m = K(
|
|
1089
1110
|
() => t.filter((o) => o.supportedFiats.includes(s)),
|
|
1090
1111
|
[t, s]
|
|
1091
1112
|
), i = m.find((o) => o.id === a) || m[0];
|
|
@@ -1152,19 +1173,19 @@ function ta({
|
|
|
1152
1173
|
}) {
|
|
1153
1174
|
var g;
|
|
1154
1175
|
const { order: r, orderStatus: u, goToStep: m, goBack: i } = pe(), [o, d] = N(!1), [h, f] = N(null), x = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
|
|
1155
|
-
if (
|
|
1176
|
+
if (H(() => {
|
|
1156
1177
|
if ((r == null ? void 0 : r.checkout.method) === "redirect" && n && !x) {
|
|
1157
1178
|
f(Math.ceil(s / 1e3));
|
|
1158
1179
|
const p = setTimeout(() => {
|
|
1159
1180
|
window.location.href = r.checkout.url;
|
|
1160
1181
|
}, s), b = setInterval(() => {
|
|
1161
|
-
f((
|
|
1182
|
+
f((R) => R && R > 1 ? R - 1 : null);
|
|
1162
1183
|
}, 1e3);
|
|
1163
1184
|
return () => {
|
|
1164
1185
|
clearTimeout(p), clearInterval(b);
|
|
1165
1186
|
};
|
|
1166
1187
|
}
|
|
1167
|
-
}, [r, n, s, x]),
|
|
1188
|
+
}, [r, n, s, x]), H(() => {
|
|
1168
1189
|
u && (u.status === "completed" ? m("complete") : ["failed", "cancelled", "expired"].includes(u.status) && m("error"));
|
|
1169
1190
|
}, [u == null ? void 0 : u.status, m]), !r)
|
|
1170
1191
|
return /* @__PURE__ */ l(
|
|
@@ -1380,7 +1401,7 @@ function aa(t, a) {
|
|
|
1380
1401
|
}
|
|
1381
1402
|
function na({ className: t = "" }) {
|
|
1382
1403
|
const { orderStatus: a, orderStatusLoading: n, goToStep: s } = pe();
|
|
1383
|
-
|
|
1404
|
+
H(() => {
|
|
1384
1405
|
a && (a.status === "completed" ? s("complete") : ["failed", "cancelled", "expired", "refunded"].includes(a.status) && s("error"));
|
|
1385
1406
|
}, [a == null ? void 0 : a.status, s]);
|
|
1386
1407
|
const r = () => {
|
|
@@ -1808,14 +1829,14 @@ function ia() {
|
|
|
1808
1829
|
] });
|
|
1809
1830
|
}
|
|
1810
1831
|
function da({ onClose: t, onSelect: a, currencies: n, assetBaseUrl: s = "" }) {
|
|
1811
|
-
const [r, u] = N(""), m =
|
|
1832
|
+
const [r, u] = N(""), m = K(() => {
|
|
1812
1833
|
if (!n || n.length === 0) return st;
|
|
1813
1834
|
const o = new Map(st.map((d) => [d.code, d.name]));
|
|
1814
1835
|
return n.map((d) => ({
|
|
1815
1836
|
code: d.code,
|
|
1816
1837
|
name: d.name || o.get(d.code) || d.code
|
|
1817
1838
|
}));
|
|
1818
|
-
}, [n]), i =
|
|
1839
|
+
}, [n]), i = K(() => {
|
|
1819
1840
|
const o = r.trim().toLowerCase();
|
|
1820
1841
|
return o ? m.filter(
|
|
1821
1842
|
(d) => d.code.toLowerCase().includes(o) || d.name.toLowerCase().includes(o)
|
|
@@ -1854,7 +1875,7 @@ function da({ onClose: t, onSelect: a, currencies: n, assetBaseUrl: s = "" }) {
|
|
|
1854
1875
|
] });
|
|
1855
1876
|
}
|
|
1856
1877
|
function ua({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: s = "" }) {
|
|
1857
|
-
const [r, u] = N(""), m =
|
|
1878
|
+
const [r, u] = N(""), m = K(() => {
|
|
1858
1879
|
if (!n || n.length === 0) return _t;
|
|
1859
1880
|
const o = [];
|
|
1860
1881
|
for (const d of n) {
|
|
@@ -1874,16 +1895,16 @@ function ua({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: s = "" }) {
|
|
|
1874
1895
|
}
|
|
1875
1896
|
}
|
|
1876
1897
|
return o;
|
|
1877
|
-
}, [n]), i =
|
|
1898
|
+
}, [n]), i = K(() => {
|
|
1878
1899
|
var f;
|
|
1879
1900
|
const o = r.trim().toLowerCase();
|
|
1880
1901
|
if (!o) return m;
|
|
1881
1902
|
const d = o.split(/\s+/), h = [];
|
|
1882
1903
|
for (const x of m) {
|
|
1883
|
-
const g = Ie[x.chain], p = g ? g.name.toLowerCase() : "", b = ((f = g == null ? void 0 : g.shortName) == null ? void 0 : f.toLowerCase()) || "",
|
|
1904
|
+
const g = Ie[x.chain], p = g ? g.name.toLowerCase() : "", b = ((f = g == null ? void 0 : g.shortName) == null ? void 0 : f.toLowerCase()) || "", R = x.chain.toLowerCase(), P = x.code.toLowerCase(), w = x.name.toLowerCase(), G = [P, w, p, b, R];
|
|
1884
1905
|
if (!d.every((z) => G.some((c) => c.includes(z)))) continue;
|
|
1885
|
-
let
|
|
1886
|
-
P === o ?
|
|
1906
|
+
let Y = 0;
|
|
1907
|
+
P === o ? Y += 100 : P.startsWith(d[0]) && (Y += 50), x.popular && (Y += 10), d.length > 1 && (p.includes(d[1]) || b.includes(d[1]) || R.includes(d[1])) && (Y += 25), h.push({ item: x, score: Y });
|
|
1887
1908
|
}
|
|
1888
1909
|
return h.sort((x, g) => g.score - x.score), h.map((x) => x.item);
|
|
1889
1910
|
}, [m, r]);
|
|
@@ -2063,25 +2084,25 @@ function fa({
|
|
|
2063
2084
|
const {
|
|
2064
2085
|
state: p,
|
|
2065
2086
|
dispatch: b,
|
|
2066
|
-
config:
|
|
2087
|
+
config: R,
|
|
2067
2088
|
configLoading: P,
|
|
2068
2089
|
quotes: w,
|
|
2069
2090
|
quotesLoading: G,
|
|
2070
2091
|
quotesError: Q,
|
|
2071
|
-
fetchQuotes:
|
|
2092
|
+
fetchQuotes: Y,
|
|
2072
2093
|
createOrder: z,
|
|
2073
2094
|
orderLoading: c,
|
|
2074
2095
|
amountError: O,
|
|
2075
2096
|
fieldLocks: C,
|
|
2076
2097
|
apiConfig: L,
|
|
2077
|
-
assetBaseUrl:
|
|
2078
|
-
} = pe(), [X, $] = N(a === "dark"), [Ne, he] = N(n), [fe,
|
|
2079
|
-
|
|
2098
|
+
assetBaseUrl: F
|
|
2099
|
+
} = pe(), [X, $] = N(a === "dark"), [Ne, he] = N(n), [fe, j] = N(null), [ye, ae] = N(!1), [Ce, se] = N(!1), [ce, be] = N(!1), [V, ne] = N(null), [re, Ee] = N(!0), [Ae, we] = N(!1), [q, ie] = N(!1), Oe = U(null), xe = U(), v = U(p.flowType);
|
|
2100
|
+
H(() => {
|
|
2080
2101
|
$(a === "dark");
|
|
2081
|
-
}, [a]),
|
|
2102
|
+
}, [a]), H(() => {
|
|
2082
2103
|
const y = setTimeout(() => Ee(!1), P ? 0 : 800);
|
|
2083
2104
|
return () => clearTimeout(y);
|
|
2084
|
-
}, [P]),
|
|
2105
|
+
}, [P]), H(() => {
|
|
2085
2106
|
if (v.current !== p.flowType && !re) {
|
|
2086
2107
|
v.current = p.flowType, we(!0), ae(!1), se(!1);
|
|
2087
2108
|
const y = setTimeout(() => we(!1), 350);
|
|
@@ -2089,20 +2110,20 @@ function fa({
|
|
|
2089
2110
|
}
|
|
2090
2111
|
v.current = p.flowType;
|
|
2091
2112
|
}, [p.flowType, re]);
|
|
2092
|
-
const E = p.flowType, S = E === "buy", k = p.cryptoCurrency || "BTC",
|
|
2093
|
-
de && k &&
|
|
2094
|
-
const gt =
|
|
2113
|
+
const E = p.flowType, S = E === "buy", k = p.cryptoCurrency || "BTC", T = p.fiatCurrency || "USD", D = S ? p.fiatAmount : p.cryptoAmount, W = Ft(D), de = (ze = w == null ? void 0 : w.bestQuote) != null && ze.exchangeRate ? parseFloat(w.bestQuote.exchangeRate) : null, Se = U(null);
|
|
2114
|
+
de && k && T && (Se.current = { rate: de, crypto: k, fiat: T });
|
|
2115
|
+
const gt = K(() => {
|
|
2095
2116
|
if (w != null && w.bestQuote) {
|
|
2096
2117
|
const y = S ? w.bestQuote.cryptoAmount : w.bestQuote.fiatAmount;
|
|
2097
2118
|
if (y) return y;
|
|
2098
2119
|
}
|
|
2099
2120
|
return "0";
|
|
2100
|
-
}, [w, S]), vt =
|
|
2101
|
-
var B, ee,
|
|
2102
|
-
const y = de || ((B = Se.current) == null ? void 0 : B.rate), A = de ? k : (ee = Se.current) == null ? void 0 : ee.crypto, I = de ?
|
|
2121
|
+
}, [w, S]), vt = K(() => {
|
|
2122
|
+
var B, ee, He;
|
|
2123
|
+
const y = de || ((B = Se.current) == null ? void 0 : B.rate), A = de ? k : (ee = Se.current) == null ? void 0 : ee.crypto, I = de ? T : (He = Se.current) == null ? void 0 : He.fiat;
|
|
2103
2124
|
return !y || !A || !I ? "" : `1 ${A} ≈ ${y.toFixed(2)} ${I}`;
|
|
2104
|
-
}, [k,
|
|
2105
|
-
|
|
2125
|
+
}, [k, T, de]);
|
|
2126
|
+
H(() => {
|
|
2106
2127
|
const y = p.walletAddress.trim(), A = p.network;
|
|
2107
2128
|
if (!y || y.length < 10) {
|
|
2108
2129
|
ne(null), b({ type: "SET_WALLET_ERROR", message: "" });
|
|
@@ -2111,17 +2132,17 @@ function fa({
|
|
|
2111
2132
|
return be(!0), ne(null), clearTimeout(xe.current), xe.current = setTimeout(async () => {
|
|
2112
2133
|
var I, B, ee;
|
|
2113
2134
|
try {
|
|
2114
|
-
const
|
|
2135
|
+
const Ue = await (await fetch(`${L.apiUrl}/public/validate/address`, {
|
|
2115
2136
|
method: "POST",
|
|
2116
2137
|
headers: { "Content-Type": "application/json" },
|
|
2117
2138
|
body: JSON.stringify({ address: y, ...A ? { network: A } : {} })
|
|
2118
|
-
})).json(),
|
|
2119
|
-
if (
|
|
2139
|
+
})).json(), Ke = ((I = Ue.data) == null ? void 0 : I.attributes) || Ue.data || Ue;
|
|
2140
|
+
if (Ke.isValid)
|
|
2120
2141
|
ne(!0), b({ type: "SET_WALLET_ERROR", message: "" });
|
|
2121
2142
|
else {
|
|
2122
2143
|
ne(!1);
|
|
2123
|
-
const
|
|
2124
|
-
b({ type: "SET_WALLET_ERROR", message:
|
|
2144
|
+
const Rt = ((B = Ke.errors) == null ? void 0 : B[0]) || ((ee = Ke.details) == null ? void 0 : ee.formatMessage) || "Invalid wallet address";
|
|
2145
|
+
b({ type: "SET_WALLET_ERROR", message: Rt });
|
|
2125
2146
|
}
|
|
2126
2147
|
} catch {
|
|
2127
2148
|
ne(null);
|
|
@@ -2130,7 +2151,7 @@ function fa({
|
|
|
2130
2151
|
}
|
|
2131
2152
|
}, 500), () => clearTimeout(xe.current);
|
|
2132
2153
|
}, [p.walletAddress, p.network, L.apiUrl]);
|
|
2133
|
-
const Ge = !
|
|
2154
|
+
const Ge = !D || W === 0, Ye = W > 0 && (S ? W < dt : W < ut), je = !!O || Ye || ye && Ge, Nt = W > 0 && !O && !Ye, Pe = p.walletAddress.trim().length >= 10 && V !== !1 && !ce, Re = Nt && Pe && !!p.cryptoCurrency && !!p.network, Ct = (y) => {
|
|
2134
2155
|
let A = y.target.value.replace(/[^0-9.,]/g, "");
|
|
2135
2156
|
const I = S ? 2 : 6, B = A.indexOf(".");
|
|
2136
2157
|
B !== -1 && A.length - B - 1 > I && (A = A.slice(0, B + I + 1)), b(S ? { type: "SET_FIAT_AMOUNT", amount: A } : { type: "SET_CRYPTO_AMOUNT", amount: A });
|
|
@@ -2152,9 +2173,9 @@ function fa({
|
|
|
2152
2173
|
},
|
|
2153
2174
|
[b]
|
|
2154
2175
|
), wt = () => {
|
|
2155
|
-
|
|
2176
|
+
Re && (ie(!0), Y());
|
|
2156
2177
|
};
|
|
2157
|
-
|
|
2178
|
+
H(() => {
|
|
2158
2179
|
var y;
|
|
2159
2180
|
if (!(!q || G)) {
|
|
2160
2181
|
if (w != null && w.bestQuote)
|
|
@@ -2169,18 +2190,18 @@ function fa({
|
|
|
2169
2190
|
}
|
|
2170
2191
|
}
|
|
2171
2192
|
}, [q, w, G, Q, b, z]);
|
|
2172
|
-
const We = X ? "theme-dark" : "theme-light",
|
|
2193
|
+
const We = X ? "theme-dark" : "theme-light", De = ct.find((y) => y.id === Ne) || ct[0], St = De.accent === null, Qe = (s ? Fe(s) : !1) ? { "--t-accent": s, "--t-cta-bg": s, "--t-cta-text": "#ffffff" } : St ? {
|
|
2173
2194
|
"--t-accent": X ? "#ffffff" : "#111111",
|
|
2174
2195
|
"--t-cta-bg": X ? "#ffffff" : "#111111",
|
|
2175
2196
|
"--t-cta-text": X ? "#000000" : "#ffffff"
|
|
2176
2197
|
} : {
|
|
2177
|
-
"--t-accent":
|
|
2178
|
-
"--t-cta-bg":
|
|
2198
|
+
"--t-accent": De.accent,
|
|
2199
|
+
"--t-cta-bg": De.accent,
|
|
2179
2200
|
"--t-cta-text": "#ffffff"
|
|
2180
2201
|
}, oe = {};
|
|
2181
|
-
r &&
|
|
2182
|
-
const
|
|
2183
|
-
m &&
|
|
2202
|
+
r && Fe(r) ? oe.backgroundColor = r : oe.backgroundColor = "var(--t-bg)", u && (oe.backgroundImage = `url(${u})`, oe.backgroundSize = "cover", oe.backgroundPosition = "center");
|
|
2203
|
+
const Te = {};
|
|
2204
|
+
m && Fe(m) && (Te.border = `1px solid ${m}`), i && (Te.borderRadius = i);
|
|
2184
2205
|
const Ze = p.step === "checkout" ? /* @__PURE__ */ e(ta, { autoRedirect: d }) : p.step === "processing" ? /* @__PURE__ */ e(na, {}) : p.step === "complete" ? /* @__PURE__ */ e(ra, { explorerUrl: h, doneButtonText: f, onDone: g }) : p.step === "error" ? /* @__PURE__ */ e(oa, { supportEmail: x }) : p.step === "confirm" ? /* @__PURE__ */ e(la, {}) : null;
|
|
2185
2206
|
if (Ze)
|
|
2186
2207
|
return /* @__PURE__ */ e(
|
|
@@ -2191,7 +2212,7 @@ function fa({
|
|
|
2191
2212
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
2192
2213
|
...oe,
|
|
2193
2214
|
...Qe,
|
|
2194
|
-
...
|
|
2215
|
+
...Te
|
|
2195
2216
|
},
|
|
2196
2217
|
children: Ze
|
|
2197
2218
|
}
|
|
@@ -2205,10 +2226,10 @@ function fa({
|
|
|
2205
2226
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
2206
2227
|
...oe,
|
|
2207
2228
|
...Qe,
|
|
2208
|
-
...
|
|
2229
|
+
...Te
|
|
2209
2230
|
},
|
|
2210
2231
|
children: [
|
|
2211
|
-
/* @__PURE__ */ e("div", { className: `flex justify-end items-center px-5 pt-3 ${o ? "pb-1" : "pb-5"}`, children: /* @__PURE__ */ e(Qt, { onClick: () =>
|
|
2232
|
+
/* @__PURE__ */ e("div", { className: `flex justify-end items-center px-5 pt-3 ${o ? "pb-1" : "pb-5"}`, children: /* @__PURE__ */ e(Qt, { onClick: () => j("settings") }) }),
|
|
2212
2233
|
o ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center pt-3 pb-5", children: [
|
|
2213
2234
|
/* @__PURE__ */ l("div", { className: "flex", style: { width: 165 }, children: [
|
|
2214
2235
|
/* @__PURE__ */ e(
|
|
@@ -2253,7 +2274,7 @@ function fa({
|
|
|
2253
2274
|
style: {
|
|
2254
2275
|
background: "var(--t-surface)",
|
|
2255
2276
|
borderRadius: 5,
|
|
2256
|
-
border: ye &&
|
|
2277
|
+
border: ye && je ? "1px solid #EF4444" : "1px solid transparent"
|
|
2257
2278
|
},
|
|
2258
2279
|
children: [
|
|
2259
2280
|
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "You spend" }),
|
|
@@ -2263,7 +2284,7 @@ function fa({
|
|
|
2263
2284
|
{
|
|
2264
2285
|
ref: Oe,
|
|
2265
2286
|
type: "text",
|
|
2266
|
-
value:
|
|
2287
|
+
value: D,
|
|
2267
2288
|
onChange: Ct,
|
|
2268
2289
|
onBlur: () => ae(!0),
|
|
2269
2290
|
placeholder: S ? "250" : "0.01",
|
|
@@ -2276,7 +2297,7 @@ function fa({
|
|
|
2276
2297
|
S ? /* @__PURE__ */ l(
|
|
2277
2298
|
"button",
|
|
2278
2299
|
{
|
|
2279
|
-
onClick: () =>
|
|
2300
|
+
onClick: () => j("fiat"),
|
|
2280
2301
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
2281
2302
|
style: {
|
|
2282
2303
|
background: "var(--t-pill-bg)",
|
|
@@ -2287,8 +2308,8 @@ function fa({
|
|
|
2287
2308
|
},
|
|
2288
2309
|
disabled: !!((et = C == null ? void 0 : C.sourceCurrency) != null && et.locked),
|
|
2289
2310
|
children: [
|
|
2290
|
-
/* @__PURE__ */ e(Xe, { currencyCode:
|
|
2291
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2311
|
+
/* @__PURE__ */ e(Xe, { currencyCode: T, size: 16, baseUrl: F }),
|
|
2312
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: T }),
|
|
2292
2313
|
/* @__PURE__ */ e(ge, {})
|
|
2293
2314
|
]
|
|
2294
2315
|
}
|
|
@@ -2296,7 +2317,7 @@ function fa({
|
|
|
2296
2317
|
/* @__PURE__ */ l(
|
|
2297
2318
|
"button",
|
|
2298
2319
|
{
|
|
2299
|
-
onClick: () =>
|
|
2320
|
+
onClick: () => j("crypto"),
|
|
2300
2321
|
className: "flex items-center gap-1.5 transition-colors",
|
|
2301
2322
|
style: {
|
|
2302
2323
|
background: "var(--t-pill-bg)",
|
|
@@ -2307,7 +2328,7 @@ function fa({
|
|
|
2307
2328
|
},
|
|
2308
2329
|
disabled: !!((tt = C == null ? void 0 : C.destinationCurrency) != null && tt.locked),
|
|
2309
2330
|
children: [
|
|
2310
|
-
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl:
|
|
2331
|
+
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl: F }),
|
|
2311
2332
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: k }),
|
|
2312
2333
|
/* @__PURE__ */ e(ge, {})
|
|
2313
2334
|
]
|
|
@@ -2317,7 +2338,7 @@ function fa({
|
|
|
2317
2338
|
/* @__PURE__ */ e(
|
|
2318
2339
|
"img",
|
|
2319
2340
|
{
|
|
2320
|
-
src: _e(Z,
|
|
2341
|
+
src: _e(Z, F),
|
|
2321
2342
|
alt: Z,
|
|
2322
2343
|
width: 14,
|
|
2323
2344
|
height: 14,
|
|
@@ -2332,7 +2353,7 @@ function fa({
|
|
|
2332
2353
|
]
|
|
2333
2354
|
}
|
|
2334
2355
|
),
|
|
2335
|
-
ye &&
|
|
2356
|
+
ye && je && /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5 px-[2px]", style: { color: "#EF4444" }, children: O || (Ge ? "Amount should be more than 0" : S ? `Minimum amount is ${dt} ${T}` : `Minimum amount is ${ut} ${k}`) }),
|
|
2336
2357
|
/* @__PURE__ */ l(
|
|
2337
2358
|
"div",
|
|
2338
2359
|
{
|
|
@@ -2361,7 +2382,7 @@ function fa({
|
|
|
2361
2382
|
/* @__PURE__ */ l(
|
|
2362
2383
|
"button",
|
|
2363
2384
|
{
|
|
2364
|
-
onClick: () =>
|
|
2385
|
+
onClick: () => j("crypto"),
|
|
2365
2386
|
className: "flex items-center gap-1.5 transition-colors",
|
|
2366
2387
|
style: {
|
|
2367
2388
|
background: "var(--t-pill-bg)",
|
|
@@ -2372,7 +2393,7 @@ function fa({
|
|
|
2372
2393
|
},
|
|
2373
2394
|
disabled: !!((at = C == null ? void 0 : C.destinationCurrency) != null && at.locked),
|
|
2374
2395
|
children: [
|
|
2375
|
-
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl:
|
|
2396
|
+
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl: F }),
|
|
2376
2397
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: k }),
|
|
2377
2398
|
/* @__PURE__ */ e(ge, {})
|
|
2378
2399
|
]
|
|
@@ -2382,7 +2403,7 @@ function fa({
|
|
|
2382
2403
|
/* @__PURE__ */ e(
|
|
2383
2404
|
"img",
|
|
2384
2405
|
{
|
|
2385
|
-
src: _e(Z,
|
|
2406
|
+
src: _e(Z, F),
|
|
2386
2407
|
alt: Z,
|
|
2387
2408
|
width: 14,
|
|
2388
2409
|
height: 14,
|
|
@@ -2395,7 +2416,7 @@ function fa({
|
|
|
2395
2416
|
] }) : /* @__PURE__ */ l(
|
|
2396
2417
|
"button",
|
|
2397
2418
|
{
|
|
2398
|
-
onClick: () =>
|
|
2419
|
+
onClick: () => j("fiat"),
|
|
2399
2420
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
2400
2421
|
style: {
|
|
2401
2422
|
background: "var(--t-pill-bg)",
|
|
@@ -2406,8 +2427,8 @@ function fa({
|
|
|
2406
2427
|
},
|
|
2407
2428
|
disabled: !!((nt = C == null ? void 0 : C.sourceCurrency) != null && nt.locked),
|
|
2408
2429
|
children: [
|
|
2409
|
-
/* @__PURE__ */ e(Xe, { currencyCode:
|
|
2410
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2430
|
+
/* @__PURE__ */ e(Xe, { currencyCode: T, size: 16, baseUrl: F }),
|
|
2431
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: T }),
|
|
2411
2432
|
/* @__PURE__ */ e(ge, {})
|
|
2412
2433
|
]
|
|
2413
2434
|
}
|
|
@@ -2422,15 +2443,15 @@ function fa({
|
|
|
2422
2443
|
className: "flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",
|
|
2423
2444
|
style: {
|
|
2424
2445
|
background: "var(--t-surface)",
|
|
2425
|
-
...(rt =
|
|
2446
|
+
...(rt = R == null ? void 0 : R.paymentMethods) != null && rt.length ? {} : { borderBottomLeftRadius: 5, borderBottomRightRadius: 5 }
|
|
2426
2447
|
},
|
|
2427
2448
|
children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: "var(--t-text-secondary)" }, children: vt || " " })
|
|
2428
2449
|
}
|
|
2429
2450
|
),
|
|
2430
|
-
(
|
|
2451
|
+
(R == null ? void 0 : R.paymentMethods) && R.paymentMethods.length > 0 && /* @__PURE__ */ e("div", { className: "mt-[2px]", children: /* @__PURE__ */ e(
|
|
2431
2452
|
ea,
|
|
2432
2453
|
{
|
|
2433
|
-
methods:
|
|
2454
|
+
methods: R.paymentMethods,
|
|
2434
2455
|
selectedId: p.paymentMethodId,
|
|
2435
2456
|
onSelect: At,
|
|
2436
2457
|
fiatCurrency: p.fiatCurrency
|
|
@@ -2466,7 +2487,7 @@ function fa({
|
|
|
2466
2487
|
/* @__PURE__ */ e(
|
|
2467
2488
|
"button",
|
|
2468
2489
|
{
|
|
2469
|
-
disabled: !
|
|
2490
|
+
disabled: !Re || c || q,
|
|
2470
2491
|
onClick: wt,
|
|
2471
2492
|
className: "w-full font-semibold text-[16px] transition-all",
|
|
2472
2493
|
style: {
|
|
@@ -2474,15 +2495,15 @@ function fa({
|
|
|
2474
2495
|
borderRadius: 5,
|
|
2475
2496
|
background: "var(--t-cta-bg)",
|
|
2476
2497
|
color: "var(--t-cta-text)",
|
|
2477
|
-
opacity:
|
|
2478
|
-
cursor:
|
|
2498
|
+
opacity: Re && !c && !q ? 1 : 0.4,
|
|
2499
|
+
cursor: Re && !c && !q ? "pointer" : "not-allowed"
|
|
2479
2500
|
},
|
|
2480
2501
|
children: q ? "Getting best price..." : c ? "Processing..." : S ? `Buy ${k}` : `Sell ${k}`
|
|
2481
2502
|
}
|
|
2482
2503
|
),
|
|
2483
2504
|
/* @__PURE__ */ e("div", { className: "text-center py-3", children: /* @__PURE__ */ e("span", { className: "text-[11px]", style: { color: "var(--t-text-tertiary)" }, children: "Powered by NowRamp" }) })
|
|
2484
2505
|
] }, E),
|
|
2485
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "fiat", onClose: () =>
|
|
2506
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "fiat", onClose: () => j(null), children: (y) => {
|
|
2486
2507
|
var A;
|
|
2487
2508
|
return /* @__PURE__ */ e(
|
|
2488
2509
|
da,
|
|
@@ -2491,12 +2512,12 @@ function fa({
|
|
|
2491
2512
|
onSelect: (I) => {
|
|
2492
2513
|
bt(I), y();
|
|
2493
2514
|
},
|
|
2494
|
-
currencies: (A =
|
|
2495
|
-
assetBaseUrl:
|
|
2515
|
+
currencies: (A = R == null ? void 0 : R.fiats) == null ? void 0 : A.map((I) => ({ code: I.code, name: I.code })),
|
|
2516
|
+
assetBaseUrl: F
|
|
2496
2517
|
}
|
|
2497
2518
|
);
|
|
2498
2519
|
} }),
|
|
2499
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "crypto", onClose: () =>
|
|
2520
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "crypto", onClose: () => j(null), children: (y) => {
|
|
2500
2521
|
var A;
|
|
2501
2522
|
return /* @__PURE__ */ e(
|
|
2502
2523
|
ua,
|
|
@@ -2505,7 +2526,7 @@ function fa({
|
|
|
2505
2526
|
onSelect: (I, B) => {
|
|
2506
2527
|
Et(I, B), y();
|
|
2507
2528
|
},
|
|
2508
|
-
cryptos: (A =
|
|
2529
|
+
cryptos: (A = R == null ? void 0 : R.cryptos) == null ? void 0 : A.map((I) => {
|
|
2509
2530
|
var B;
|
|
2510
2531
|
return {
|
|
2511
2532
|
code: I.code,
|
|
@@ -2513,11 +2534,11 @@ function fa({
|
|
|
2513
2534
|
networks: (B = I.networks) == null ? void 0 : B.map((ee) => ({ code: ee.id, name: ee.name }))
|
|
2514
2535
|
};
|
|
2515
2536
|
}),
|
|
2516
|
-
assetBaseUrl:
|
|
2537
|
+
assetBaseUrl: F
|
|
2517
2538
|
}
|
|
2518
2539
|
);
|
|
2519
2540
|
} }),
|
|
2520
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "settings", onClose: () =>
|
|
2541
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "settings", onClose: () => j(null), children: (y) => /* @__PURE__ */ e(
|
|
2521
2542
|
ha,
|
|
2522
2543
|
{
|
|
2523
2544
|
onClose: y,
|
|
@@ -2550,23 +2571,23 @@ function ya({
|
|
|
2550
2571
|
statusPollInterval: g,
|
|
2551
2572
|
onComplete: p,
|
|
2552
2573
|
onError: b,
|
|
2553
|
-
className:
|
|
2574
|
+
className: R,
|
|
2554
2575
|
theme: P,
|
|
2555
2576
|
skinId: w,
|
|
2556
2577
|
accentColor: G,
|
|
2557
2578
|
bgColor: Q,
|
|
2558
|
-
bgImage:
|
|
2579
|
+
bgImage: Y,
|
|
2559
2580
|
borderColor: z,
|
|
2560
2581
|
borderRadius: c,
|
|
2561
2582
|
showFlowToggle: O,
|
|
2562
2583
|
autoRedirect: C,
|
|
2563
2584
|
explorerUrl: L,
|
|
2564
|
-
doneButtonText:
|
|
2585
|
+
doneButtonText: F,
|
|
2565
2586
|
supportEmail: X,
|
|
2566
2587
|
onDone: $
|
|
2567
2588
|
}) {
|
|
2568
2589
|
return /* @__PURE__ */ e(
|
|
2569
|
-
|
|
2590
|
+
Dt,
|
|
2570
2591
|
{
|
|
2571
2592
|
projectId: t,
|
|
2572
2593
|
apiUrl: a,
|
|
@@ -2587,18 +2608,18 @@ function ya({
|
|
|
2587
2608
|
children: /* @__PURE__ */ e(
|
|
2588
2609
|
fa,
|
|
2589
2610
|
{
|
|
2590
|
-
className:
|
|
2611
|
+
className: R,
|
|
2591
2612
|
theme: P,
|
|
2592
2613
|
skinId: w,
|
|
2593
2614
|
accentColor: G,
|
|
2594
2615
|
bgColor: Q,
|
|
2595
|
-
bgImage:
|
|
2616
|
+
bgImage: Y,
|
|
2596
2617
|
borderColor: z,
|
|
2597
2618
|
borderRadius: c,
|
|
2598
2619
|
showFlowToggle: O,
|
|
2599
2620
|
autoRedirect: C,
|
|
2600
2621
|
explorerUrl: L,
|
|
2601
|
-
doneButtonText:
|
|
2622
|
+
doneButtonText: F,
|
|
2602
2623
|
supportEmail: X,
|
|
2603
2624
|
onDone: $
|
|
2604
2625
|
}
|
|
@@ -2606,14 +2627,14 @@ function ya({
|
|
|
2606
2627
|
}
|
|
2607
2628
|
);
|
|
2608
2629
|
}
|
|
2609
|
-
function
|
|
2630
|
+
function Ra({
|
|
2610
2631
|
submitButtonText: t,
|
|
2611
2632
|
rateRefreshInterval: a,
|
|
2612
2633
|
...n
|
|
2613
2634
|
}) {
|
|
2614
2635
|
return /* @__PURE__ */ e(ya, { ...n });
|
|
2615
2636
|
}
|
|
2616
|
-
function
|
|
2637
|
+
function Ta({
|
|
2617
2638
|
skin: t,
|
|
2618
2639
|
active: a,
|
|
2619
2640
|
onClick: n,
|
|
@@ -2699,7 +2720,7 @@ function ka({
|
|
|
2699
2720
|
quotesLoading: s,
|
|
2700
2721
|
cryptoCurrency: r
|
|
2701
2722
|
}) {
|
|
2702
|
-
const [u, m] = N(""), i =
|
|
2723
|
+
const [u, m] = N(""), i = K(() => {
|
|
2703
2724
|
if (!(n != null && n.quotes)) return [];
|
|
2704
2725
|
const o = u.trim().toLowerCase();
|
|
2705
2726
|
return o ? n.quotes.filter((d) => d.gatewayName.toLowerCase().includes(o)) : n.quotes;
|
|
@@ -2772,9 +2793,9 @@ export {
|
|
|
2772
2793
|
Ie as BLOCKCHAINS,
|
|
2773
2794
|
Xt as BankIcon,
|
|
2774
2795
|
_t as CRYPTO_CHAIN_COMBOS,
|
|
2775
|
-
|
|
2796
|
+
Ht as CRYPTO_CURRENCIES,
|
|
2776
2797
|
Vt as CardIcon,
|
|
2777
|
-
|
|
2798
|
+
Ra as CheckoutForm,
|
|
2778
2799
|
ta as CheckoutStep,
|
|
2779
2800
|
ge as ChevronDown,
|
|
2780
2801
|
Wt as ChevronRight,
|
|
@@ -2788,34 +2809,34 @@ export {
|
|
|
2788
2809
|
Zt as DarkModeIcon,
|
|
2789
2810
|
oa as ErrorStep,
|
|
2790
2811
|
st as FIAT_CURRENCIES,
|
|
2791
|
-
|
|
2812
|
+
Ut as FIAT_TO_COUNTRY,
|
|
2792
2813
|
da as FiatCurrencyModal,
|
|
2793
2814
|
Xe as FiatFlag,
|
|
2794
2815
|
ia as FormSkeleton,
|
|
2795
2816
|
$e as GenericCoinIcon,
|
|
2796
|
-
|
|
2817
|
+
Yt as GooglePayIcon,
|
|
2797
2818
|
it as MOCK_RATES,
|
|
2798
2819
|
Qt as MenuIcon,
|
|
2799
2820
|
Le as Modal,
|
|
2800
|
-
|
|
2821
|
+
jt as PayPalIcon,
|
|
2801
2822
|
ea as PaymentMethodSelector,
|
|
2802
2823
|
na as ProcessingStep,
|
|
2803
2824
|
ya as RampForm,
|
|
2804
|
-
|
|
2825
|
+
Dt as RampProvider,
|
|
2805
2826
|
$t as RevolutIcon,
|
|
2806
2827
|
ct as SKINS,
|
|
2807
2828
|
Be as SearchInput,
|
|
2808
2829
|
ha as SettingsScreen,
|
|
2809
2830
|
M as Skeleton,
|
|
2810
|
-
|
|
2831
|
+
Ta as SkinSwatch,
|
|
2811
2832
|
ma as ToggleSwitch,
|
|
2812
2833
|
wa as formatOutput,
|
|
2813
2834
|
_e as getChainIconUrl,
|
|
2814
2835
|
yt as getCryptoIconUrl,
|
|
2815
|
-
|
|
2836
|
+
Kt as getFiatFlagUrl,
|
|
2816
2837
|
Aa as getMockRate,
|
|
2817
2838
|
Jt as getPaymentIcon,
|
|
2818
|
-
|
|
2839
|
+
Ft as parseAmount,
|
|
2819
2840
|
Bt as useCheckoutIntent,
|
|
2820
2841
|
Mt as useQuotes,
|
|
2821
2842
|
pe as useRamp,
|