@nowramp/form 0.1.72 → 0.1.74
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 +728 -723
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +8 -8
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,111 +9,111 @@
|
|
|
9
9
|
document.head.appendChild(s);
|
|
10
10
|
})();
|
|
11
11
|
import { jsx as e, jsxs as o, Fragment as J } from "react/jsx-runtime";
|
|
12
|
-
import
|
|
12
|
+
import me, { useState as S, useRef as B, useCallback as O, useEffect as W, useMemo as Y, useReducer as ua, useContext as ma, createContext as fa } from "react";
|
|
13
13
|
import { RampApi as Qe } from "@nowramp/sdk";
|
|
14
14
|
import { createPortal as Ut } from "react-dom";
|
|
15
15
|
function ha(t, a, n) {
|
|
16
|
-
const [r,
|
|
16
|
+
const [r, l] = S(null), [c, m] = S(!0), [s, u] = S(null), f = B(null);
|
|
17
17
|
(!f.current || f.current !== t) && (f.current = new Qe({ apiKey: "", ...t }));
|
|
18
|
-
const h =
|
|
18
|
+
const h = O(async () => {
|
|
19
19
|
if (!t.projectId) {
|
|
20
|
-
|
|
20
|
+
u(new Error("projectId is required")), m(!1);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
m(!0),
|
|
23
|
+
m(!0), u(null);
|
|
24
24
|
try {
|
|
25
|
-
const
|
|
26
|
-
a && (
|
|
27
|
-
const p = await f.current.getSupported(
|
|
28
|
-
|
|
29
|
-
} catch (
|
|
30
|
-
d
|
|
25
|
+
const d = {};
|
|
26
|
+
a && (d.orderType = a), n && (d.country = n);
|
|
27
|
+
const p = await f.current.getSupported(d);
|
|
28
|
+
l(p);
|
|
29
|
+
} catch (d) {
|
|
30
|
+
u(d instanceof Error ? d : new Error("Failed to fetch config"));
|
|
31
31
|
} finally {
|
|
32
32
|
m(!1);
|
|
33
33
|
}
|
|
34
34
|
}, [t.projectId, a, n]);
|
|
35
|
-
return
|
|
35
|
+
return W(() => {
|
|
36
36
|
h();
|
|
37
37
|
}, [h]), { config: r, loading: c, error: s, refetch: h };
|
|
38
38
|
}
|
|
39
39
|
function pa(t, a) {
|
|
40
|
-
const [n, r] =
|
|
41
|
-
(!
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
40
|
+
const [n, r] = S(null), [l, c] = S(!1), [m, s] = S(null), u = B(null), f = B(""), h = `${t.apiUrl}|${t.projectId}`;
|
|
41
|
+
(!u.current || f.current !== h) && (u.current = new Qe({ apiKey: "", ...t }), f.current = h);
|
|
42
|
+
const d = B(0);
|
|
43
|
+
W(() => {
|
|
44
|
+
const C = ++d.current;
|
|
45
45
|
if (!a || !t.projectId) {
|
|
46
46
|
r(null), c(!1);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
c(!0), s(null),
|
|
49
|
+
c(!0), s(null), u.current.getQuotes(a).then(
|
|
50
50
|
(A) => {
|
|
51
|
-
|
|
51
|
+
d.current === C && (r(A), c(!1));
|
|
52
52
|
},
|
|
53
53
|
(A) => {
|
|
54
|
-
|
|
54
|
+
d.current === C && (s(A instanceof Error ? A : new Error("Failed to fetch quotes")), r(null), c(!1));
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
}, [t.projectId, a == null ? void 0 : a.fiatCurrency, a == null ? void 0 : a.fiatAmount, a == null ? void 0 : a.cryptoAmount, a == null ? void 0 : a.cryptoCurrency, a == null ? void 0 : a.network, a == null ? void 0 : a.paymentMethodId, a == null ? void 0 : a.country, a == null ? void 0 : a.orderType]);
|
|
58
|
-
const p =
|
|
58
|
+
const p = O(async () => {
|
|
59
59
|
if (!(!a || !t.projectId)) {
|
|
60
60
|
c(!0), s(null);
|
|
61
61
|
try {
|
|
62
|
-
const
|
|
63
|
-
r(
|
|
64
|
-
} catch (
|
|
65
|
-
s(
|
|
62
|
+
const C = await u.current.getQuotes(a);
|
|
63
|
+
r(C);
|
|
64
|
+
} catch (C) {
|
|
65
|
+
s(C instanceof Error ? C : new Error("Failed to fetch quotes"));
|
|
66
66
|
} finally {
|
|
67
67
|
c(!1);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}, [t.projectId, a]);
|
|
71
|
-
return { quotes: n, loading:
|
|
71
|
+
return { quotes: n, loading: l, error: m, refetch: p };
|
|
72
72
|
}
|
|
73
73
|
function ya(t) {
|
|
74
|
-
const [a, n] =
|
|
75
|
-
(!s.current ||
|
|
76
|
-
const h =
|
|
77
|
-
|
|
74
|
+
const [a, n] = S(null), [r, l] = S(!1), [c, m] = S(null), s = B(null), u = B(""), f = `${t.apiUrl}|${t.projectId}`;
|
|
75
|
+
(!s.current || u.current !== f) && (s.current = new Qe({ apiKey: "", ...t }), u.current = f);
|
|
76
|
+
const h = O(async (p) => {
|
|
77
|
+
l(!0), m(null);
|
|
78
78
|
try {
|
|
79
|
-
const
|
|
80
|
-
return n(
|
|
81
|
-
} catch (
|
|
82
|
-
const A =
|
|
79
|
+
const C = await s.current.createCheckoutIntent(p);
|
|
80
|
+
return n(C), C;
|
|
81
|
+
} catch (C) {
|
|
82
|
+
const A = C instanceof Error ? C : new Error("Failed to create checkout intent");
|
|
83
83
|
throw m(A), A;
|
|
84
84
|
} finally {
|
|
85
|
-
|
|
85
|
+
l(!1);
|
|
86
86
|
}
|
|
87
|
-
}, []),
|
|
87
|
+
}, []), d = O(() => {
|
|
88
88
|
n(null), m(null);
|
|
89
89
|
}, []);
|
|
90
|
-
return { order: a, loading: r, error: c, createOrder: h, reset:
|
|
90
|
+
return { order: a, loading: r, error: c, createOrder: h, reset: d };
|
|
91
91
|
}
|
|
92
92
|
function xa(t, a, n) {
|
|
93
|
-
const [r,
|
|
93
|
+
const [r, l] = S(null), [c, m] = S(!1), [s, u] = S(null), f = B(null);
|
|
94
94
|
f.current || (f.current = new Qe({ apiKey: "", projectId: "", ...t }));
|
|
95
|
-
const h =
|
|
95
|
+
const h = O(async () => {
|
|
96
96
|
if (a) {
|
|
97
|
-
m(!0),
|
|
97
|
+
m(!0), u(null);
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
} catch (
|
|
102
|
-
d
|
|
99
|
+
const d = await f.current.getTransaction(a);
|
|
100
|
+
l(d);
|
|
101
|
+
} catch (d) {
|
|
102
|
+
u(d instanceof Error ? d : new Error("Failed to fetch status"));
|
|
103
103
|
} finally {
|
|
104
104
|
m(!1);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}, [a]);
|
|
108
|
-
return
|
|
108
|
+
return W(() => {
|
|
109
109
|
if (!a) return;
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
const p = setTimeout(h,
|
|
110
|
+
const d = (n == null ? void 0 : n.initialDelay) ?? 0;
|
|
111
|
+
if (d > 0) {
|
|
112
|
+
const p = setTimeout(h, d);
|
|
113
113
|
return () => clearTimeout(p);
|
|
114
114
|
}
|
|
115
115
|
h();
|
|
116
|
-
}, [h, a, n == null ? void 0 : n.initialDelay]),
|
|
116
|
+
}, [h, a, n == null ? void 0 : n.initialDelay]), W(() => {
|
|
117
117
|
if (!a || !(n != null && n.pollInterval) || !r || ["completed", "failed", "cancelled", "expired", "refunded"].includes(r.status))
|
|
118
118
|
return;
|
|
119
119
|
const p = setInterval(h, n.pollInterval);
|
|
@@ -409,208 +409,217 @@ function Ca({
|
|
|
409
409
|
apiUrl: a = "https://api.nowramp.com",
|
|
410
410
|
assetBaseUrl: n = "",
|
|
411
411
|
flowType: r = "buy",
|
|
412
|
-
customerId:
|
|
412
|
+
customerId: l = "",
|
|
413
413
|
brandId: c,
|
|
414
414
|
defaultFiatCurrency: m = "USD",
|
|
415
415
|
defaultCryptoCurrency: s = "BTC",
|
|
416
|
-
defaultNetwork:
|
|
416
|
+
defaultNetwork: u = "",
|
|
417
417
|
defaultFiatAmount: f = "",
|
|
418
418
|
defaultCryptoAmount: h = "",
|
|
419
|
-
defaultWalletAddress:
|
|
419
|
+
defaultWalletAddress: d = "",
|
|
420
420
|
defaultGateway: p,
|
|
421
|
-
defaultCountry:
|
|
421
|
+
defaultCountry: C,
|
|
422
422
|
fieldLocks: A,
|
|
423
|
-
statusPollInterval:
|
|
423
|
+
statusPollInterval: w = 5e3,
|
|
424
424
|
onComplete: R,
|
|
425
|
-
onError:
|
|
426
|
-
children:
|
|
425
|
+
onError: P,
|
|
426
|
+
children: re
|
|
427
427
|
}) {
|
|
428
|
-
const
|
|
428
|
+
const j = Y(() => ({ apiUrl: a, projectId: t }), [a, t]), Z = u || (s ? s.toLowerCase() : ""), q = r === "sell", $ = q ? !!h : !!f, x = (q ? !!($ && s && Z) : !!($ && s && Z && d)) && p ? "confirm" : "amount", k = f || (r === "buy" ? "250" : ""), [i, I] = ua(ga, {
|
|
429
429
|
...Vt,
|
|
430
|
-
step:
|
|
430
|
+
step: x,
|
|
431
431
|
flowType: r,
|
|
432
432
|
fiatCurrency: m,
|
|
433
433
|
cryptoCurrency: s,
|
|
434
434
|
network: Z,
|
|
435
|
-
fiatAmount: Dt(
|
|
435
|
+
fiatAmount: Dt(k, 2),
|
|
436
436
|
cryptoAmount: Dt(h, 6),
|
|
437
|
-
walletAddress:
|
|
438
|
-
customerId:
|
|
437
|
+
walletAddress: d,
|
|
438
|
+
customerId: l,
|
|
439
439
|
// If defaultCountry is provided, set it immediately with 'manual' source to skip auto-detection
|
|
440
|
-
...
|
|
441
|
-
}),
|
|
442
|
-
config:
|
|
443
|
-
loading:
|
|
444
|
-
error:
|
|
445
|
-
} = ha(
|
|
446
|
-
|
|
447
|
-
var
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
const b = (
|
|
453
|
-
U !==
|
|
454
|
-
}, [
|
|
455
|
-
const
|
|
456
|
-
|
|
440
|
+
...C ? { country: C.toLowerCase(), countrySource: "manual" } : {}
|
|
441
|
+
}), N = i.flowType === "sell", {
|
|
442
|
+
config: v,
|
|
443
|
+
loading: pe,
|
|
444
|
+
error: ye
|
|
445
|
+
} = ha(j, i.flowType, i.country || void 0), xe = B(!1);
|
|
446
|
+
me.useEffect(() => {
|
|
447
|
+
var L;
|
|
448
|
+
if (xe.current || !(v != null && v.detectedCountry) || i.country) return;
|
|
449
|
+
xe.current = !0;
|
|
450
|
+
const y = v.detectedCountry.toLowerCase();
|
|
451
|
+
I({ type: "SET_COUNTRY_AUTO", country: y });
|
|
452
|
+
const b = (L = v.fiats) == null ? void 0 : L.map((F) => F.code), U = ot(y, b);
|
|
453
|
+
U !== i.fiatCurrency && I({ type: "SET_FIAT_CURRENCY", currency: U });
|
|
454
|
+
}, [v, i.country, i.fiatCurrency]);
|
|
455
|
+
const le = B(!1);
|
|
456
|
+
me.useEffect(() => {
|
|
457
457
|
var U;
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
const
|
|
461
|
-
b !==
|
|
462
|
-
}, [
|
|
463
|
-
const
|
|
464
|
-
|
|
458
|
+
if (le.current || !C || !((U = v == null ? void 0 : v.fiats) != null && U.length)) return;
|
|
459
|
+
le.current = !0;
|
|
460
|
+
const y = v.fiats.map((L) => L.code), b = ot(C, y);
|
|
461
|
+
b !== i.fiatCurrency && I({ type: "SET_FIAT_CURRENCY", currency: b });
|
|
462
|
+
}, [C, v, i.fiatCurrency]);
|
|
463
|
+
const de = B(i.country);
|
|
464
|
+
me.useEffect(() => {
|
|
465
465
|
var U;
|
|
466
|
-
if (
|
|
467
|
-
const
|
|
468
|
-
b !==
|
|
469
|
-
}, [
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
466
|
+
if (i.country === de.current || (de.current = i.country, i.countrySource !== "manual") || !((U = v == null ? void 0 : v.fiats) != null && U.length)) return;
|
|
467
|
+
const y = v.fiats.map((L) => L.code), b = ot(i.country, y);
|
|
468
|
+
b !== i.fiatCurrency && I({ type: "SET_FIAT_CURRENCY", currency: b });
|
|
469
|
+
}, [i.country, i.countrySource, v, i.fiatCurrency]);
|
|
470
|
+
const D = B(i.fiatCurrency);
|
|
471
|
+
me.useEffect(() => {
|
|
472
|
+
var L;
|
|
473
|
+
if (i.fiatCurrency === D.current || (D.current = i.fiatCurrency, N || !((L = v == null ? void 0 : v.fiats) != null && L.length) || !i.fiatAmount)) return;
|
|
474
|
+
const y = v.fiats.find((F) => F.code === i.fiatCurrency);
|
|
475
|
+
if (!(y != null && y.minAmount)) return;
|
|
476
|
+
const b = parseFloat(i.fiatAmount), U = parseFloat(y.minAmount);
|
|
477
|
+
!isNaN(b) && !isNaN(U) && b < U && I({ type: "SET_FIAT_AMOUNT", amount: String(Math.ceil(U)) });
|
|
478
|
+
}, [i.fiatCurrency, i.fiatAmount, v, N]), me.useEffect(() => {
|
|
479
|
+
var U, L, F;
|
|
480
|
+
if (!v || !i.cryptoCurrency || i.network) return;
|
|
481
|
+
const y = (U = v.cryptos) == null ? void 0 : U.find((K) => K.code === i.cryptoCurrency), b = ((L = y == null ? void 0 : y.networks) == null ? void 0 : L.find((K) => K.isDefault)) || ((F = y == null ? void 0 : y.networks) == null ? void 0 : F[0]);
|
|
482
|
+
b != null && b.id && I({ type: "SET_NETWORK", network: b.id });
|
|
483
|
+
}, [v, i.cryptoCurrency, i.network]), me.useEffect(() => {
|
|
484
|
+
var F, K;
|
|
485
|
+
if (!((F = v == null ? void 0 : v.paymentMethods) != null && F.length)) return;
|
|
486
|
+
const y = i.fiatCurrency, b = v.paymentMethods;
|
|
487
|
+
if (i.paymentMethodId && b.some(
|
|
488
|
+
(_) => _.id === i.paymentMethodId && _.supportedFiats.includes(y)
|
|
480
489
|
))
|
|
481
490
|
return;
|
|
482
|
-
const
|
|
483
|
-
(
|
|
484
|
-
) || b.find((
|
|
485
|
-
|
|
486
|
-
}, [
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
if (!
|
|
490
|
-
const F = parseFloat(
|
|
491
|
+
const L = b.find(
|
|
492
|
+
(M) => M.supportedFiats.includes(y) && (M.id.includes("card") || M.id.includes("debit"))
|
|
493
|
+
) || b.find((M) => M.supportedFiats.includes(y));
|
|
494
|
+
I({ type: "SET_PAYMENT_METHOD", methodId: (L == null ? void 0 : L.id) || ((K = b[0]) == null ? void 0 : K.id) || "" });
|
|
495
|
+
}, [v, i.fiatCurrency, i.paymentMethodId]);
|
|
496
|
+
const ee = Y(() => {
|
|
497
|
+
if (N) {
|
|
498
|
+
if (!i.cryptoAmount) return null;
|
|
499
|
+
const F = parseFloat(i.cryptoAmount);
|
|
491
500
|
return isNaN(F) || F <= 0 ? "Enter a valid amount" : null;
|
|
492
501
|
}
|
|
493
|
-
if (!
|
|
494
|
-
const
|
|
495
|
-
if (isNaN(
|
|
496
|
-
const b =
|
|
502
|
+
if (!v || !i.fiatAmount) return null;
|
|
503
|
+
const y = parseFloat(i.fiatAmount);
|
|
504
|
+
if (isNaN(y)) return null;
|
|
505
|
+
const b = v.fiats.find((F) => F.code === i.fiatCurrency);
|
|
497
506
|
if (!b) return null;
|
|
498
|
-
const U = parseFloat(b.minAmount),
|
|
499
|
-
return !isNaN(U) &&
|
|
500
|
-
}, [
|
|
501
|
-
const
|
|
502
|
-
return !
|
|
503
|
-
fiatCurrency:
|
|
504
|
-
...
|
|
505
|
-
cryptoCurrency:
|
|
506
|
-
network:
|
|
507
|
-
paymentMethodId:
|
|
508
|
-
country:
|
|
509
|
-
orderType:
|
|
507
|
+
const U = parseFloat(b.minAmount), L = parseFloat(b.maxAmount);
|
|
508
|
+
return !isNaN(U) && y < U ? `Minimum amount is ${b.minAmount} ${i.fiatCurrency}` : !isNaN(L) && y > L ? `Maximum amount is ${b.maxAmount} ${i.fiatCurrency}` : null;
|
|
509
|
+
}, [v, i.fiatAmount, i.fiatCurrency, i.cryptoAmount, N]), X = Y(() => {
|
|
510
|
+
const y = N ? !!i.cryptoAmount : !!i.fiatAmount;
|
|
511
|
+
return !v || !y || !i.cryptoCurrency || !i.network || ee || v.detectedCountry && i.countrySource === "" && !C ? null : {
|
|
512
|
+
fiatCurrency: i.fiatCurrency,
|
|
513
|
+
...N ? { cryptoAmount: i.cryptoAmount } : { fiatAmount: i.fiatAmount },
|
|
514
|
+
cryptoCurrency: i.cryptoCurrency,
|
|
515
|
+
network: i.network,
|
|
516
|
+
paymentMethodId: i.paymentMethodId || void 0,
|
|
517
|
+
country: i.country || void 0,
|
|
518
|
+
orderType: i.flowType
|
|
510
519
|
};
|
|
511
|
-
}, [
|
|
512
|
-
quotes:
|
|
513
|
-
loading:
|
|
520
|
+
}, [v, i.fiatCurrency, i.fiatAmount, i.cryptoAmount, i.cryptoCurrency, i.network, i.paymentMethodId, i.country, i.countrySource, ee, N, i.flowType, C]), {
|
|
521
|
+
quotes: Q,
|
|
522
|
+
loading: be,
|
|
514
523
|
error: Ne,
|
|
515
|
-
refetch:
|
|
516
|
-
} = pa(
|
|
517
|
-
order:
|
|
518
|
-
loading:
|
|
519
|
-
error:
|
|
520
|
-
createOrder:
|
|
521
|
-
} = ya(
|
|
522
|
-
status:
|
|
523
|
-
loading:
|
|
524
|
+
refetch: Ue
|
|
525
|
+
} = pa(j, X), {
|
|
526
|
+
order: oe,
|
|
527
|
+
loading: G,
|
|
528
|
+
error: ge,
|
|
529
|
+
createOrder: De
|
|
530
|
+
} = ya(j), _e = 15e3, {
|
|
531
|
+
status: te,
|
|
532
|
+
loading: ze
|
|
524
533
|
} = xa(
|
|
525
534
|
{ apiUrl: a },
|
|
526
|
-
(
|
|
527
|
-
{ pollInterval:
|
|
535
|
+
(oe == null ? void 0 : oe.orderId) ?? null,
|
|
536
|
+
{ pollInterval: w, initialDelay: _e }
|
|
528
537
|
);
|
|
529
|
-
|
|
530
|
-
(
|
|
531
|
-
}, [
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
}, [
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
var b, U,
|
|
543
|
-
const
|
|
544
|
-
if (!
|
|
545
|
-
const F = [!
|
|
546
|
-
|
|
538
|
+
me.useEffect(() => {
|
|
539
|
+
(te == null ? void 0 : te.status) === "completed" && R && R(te);
|
|
540
|
+
}, [te == null ? void 0 : te.status, R]), me.useEffect(() => {
|
|
541
|
+
const y = ye || ge;
|
|
542
|
+
y && P && P(y);
|
|
543
|
+
}, [ye, ge, P]);
|
|
544
|
+
const Ee = p || (v == null ? void 0 : v.defaultGateway) || null, we = B(Ee);
|
|
545
|
+
we.current = Ee;
|
|
546
|
+
const Fe = B(Q);
|
|
547
|
+
Fe.current = Q;
|
|
548
|
+
const Me = B(c);
|
|
549
|
+
Me.current = c;
|
|
550
|
+
const Ce = O(async () => {
|
|
551
|
+
var b, U, L;
|
|
552
|
+
const y = ((b = i.selectedQuote) == null ? void 0 : b.gatewayId) || ((L = (U = Fe.current) == null ? void 0 : U.bestQuote) == null ? void 0 : L.gatewayId) || we.current;
|
|
553
|
+
if (!y || !i.walletAddress) {
|
|
554
|
+
const F = [!y && "gateway", !i.walletAddress && "walletAddress"].filter(Boolean).join(", ");
|
|
555
|
+
I({ type: "SET_ERROR", message: `Missing required fields: ${F}` });
|
|
547
556
|
return;
|
|
548
557
|
}
|
|
549
558
|
try {
|
|
550
|
-
await
|
|
551
|
-
gateway:
|
|
552
|
-
customerId:
|
|
553
|
-
fiatCurrency:
|
|
554
|
-
...
|
|
555
|
-
cryptoCurrency:
|
|
556
|
-
network:
|
|
557
|
-
walletAddress:
|
|
558
|
-
paymentMethodId:
|
|
559
|
-
email:
|
|
560
|
-
orderType:
|
|
561
|
-
...
|
|
562
|
-
}),
|
|
559
|
+
await De({
|
|
560
|
+
gateway: y,
|
|
561
|
+
customerId: i.customerId || void 0,
|
|
562
|
+
fiatCurrency: i.fiatCurrency,
|
|
563
|
+
...N ? { cryptoAmount: i.cryptoAmount } : { fiatAmount: i.fiatAmount },
|
|
564
|
+
cryptoCurrency: i.cryptoCurrency,
|
|
565
|
+
network: i.network,
|
|
566
|
+
walletAddress: i.walletAddress,
|
|
567
|
+
paymentMethodId: i.paymentMethodId || void 0,
|
|
568
|
+
email: i.email || void 0,
|
|
569
|
+
orderType: i.flowType,
|
|
570
|
+
...Me.current ? { metadata: { brand: Me.current } } : {}
|
|
571
|
+
}), I({ type: "SET_STEP", step: "checkout" });
|
|
563
572
|
} catch (F) {
|
|
564
|
-
const
|
|
565
|
-
/wallet|address/i.test(
|
|
573
|
+
const K = F instanceof Error ? F.message : "Failed to create order";
|
|
574
|
+
/wallet|address/i.test(K) ? I({ type: "SET_WALLET_ERROR", message: K.replace(/^Failed to create checkout intent:\s*/i, "") }) : I({ type: "SET_ERROR", message: K });
|
|
566
575
|
}
|
|
567
|
-
}, [
|
|
568
|
-
|
|
569
|
-
}, []),
|
|
570
|
-
const
|
|
571
|
-
b > 0 &&
|
|
572
|
-
}, [
|
|
573
|
-
const
|
|
574
|
-
switch (
|
|
576
|
+
}, [i, De, N]), Ie = O((y) => {
|
|
577
|
+
I({ type: "SET_STEP", step: y });
|
|
578
|
+
}, []), Je = O(() => {
|
|
579
|
+
const y = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], b = y.indexOf(i.step);
|
|
580
|
+
b > 0 && I({ type: "SET_STEP", step: y[b - 1] });
|
|
581
|
+
}, [i.step, N]), qe = Y(() => {
|
|
582
|
+
const y = N ? !!i.cryptoAmount : !!i.fiatAmount;
|
|
583
|
+
switch (i.step) {
|
|
575
584
|
case "confirm":
|
|
576
|
-
return !!(
|
|
585
|
+
return !!(y && i.cryptoCurrency && i.network && i.walletAddress && !ee);
|
|
577
586
|
case "amount":
|
|
578
|
-
return !!(
|
|
587
|
+
return !!(y && i.cryptoCurrency && i.network && !ee);
|
|
579
588
|
case "quotes":
|
|
580
|
-
return !!
|
|
589
|
+
return !!i.selectedQuote;
|
|
581
590
|
case "wallet":
|
|
582
|
-
return !!
|
|
591
|
+
return !!i.walletAddress;
|
|
583
592
|
default:
|
|
584
593
|
return !1;
|
|
585
594
|
}
|
|
586
|
-
}, [
|
|
587
|
-
apiConfig:
|
|
595
|
+
}, [i, ee, N]), Ve = {
|
|
596
|
+
apiConfig: j,
|
|
588
597
|
assetBaseUrl: n,
|
|
589
|
-
config:
|
|
590
|
-
configLoading:
|
|
591
|
-
configError:
|
|
592
|
-
state:
|
|
593
|
-
dispatch:
|
|
594
|
-
quotes:
|
|
595
|
-
quotesLoading:
|
|
598
|
+
config: v,
|
|
599
|
+
configLoading: pe,
|
|
600
|
+
configError: ye,
|
|
601
|
+
state: i,
|
|
602
|
+
dispatch: I,
|
|
603
|
+
quotes: Q,
|
|
604
|
+
quotesLoading: be,
|
|
596
605
|
quotesError: Ne,
|
|
597
|
-
fetchQuotes:
|
|
598
|
-
order:
|
|
599
|
-
orderLoading:
|
|
600
|
-
orderError:
|
|
601
|
-
createOrder:
|
|
602
|
-
orderStatus:
|
|
603
|
-
orderStatusLoading:
|
|
606
|
+
fetchQuotes: Ue,
|
|
607
|
+
order: oe,
|
|
608
|
+
orderLoading: G,
|
|
609
|
+
orderError: ge,
|
|
610
|
+
createOrder: Ce,
|
|
611
|
+
orderStatus: te,
|
|
612
|
+
orderStatusLoading: ze,
|
|
604
613
|
fieldLocks: A || null,
|
|
605
|
-
defaultGateway:
|
|
606
|
-
amountError:
|
|
607
|
-
goToStep:
|
|
608
|
-
goBack:
|
|
609
|
-
canProceed:
|
|
614
|
+
defaultGateway: Ee,
|
|
615
|
+
amountError: ee,
|
|
616
|
+
goToStep: Ie,
|
|
617
|
+
goBack: Je,
|
|
618
|
+
canProceed: qe
|
|
610
619
|
};
|
|
611
|
-
return /* @__PURE__ */ e(jt.Provider, { value:
|
|
620
|
+
return /* @__PURE__ */ e(jt.Provider, { value: Ve, children: re });
|
|
612
621
|
}
|
|
613
|
-
function
|
|
622
|
+
function ke() {
|
|
614
623
|
const t = ma(jt);
|
|
615
624
|
if (!t)
|
|
616
625
|
throw new Error("useRamp must be used within a RampProvider");
|
|
@@ -1096,7 +1105,7 @@ function lt(t) {
|
|
|
1096
1105
|
const a = t.toPrecision(4);
|
|
1097
1106
|
return parseFloat(a).toString();
|
|
1098
1107
|
}
|
|
1099
|
-
const
|
|
1108
|
+
const se = (t) => /^#([0-9A-Fa-f]{3}){1,2}$/.test(t), Bt = 10, Ot = 1e-4, wa = (() => {
|
|
1100
1109
|
const t = [];
|
|
1101
1110
|
for (const a of Gt)
|
|
1102
1111
|
for (const n of a.chains)
|
|
@@ -1108,18 +1117,16 @@ function Wt({
|
|
|
1108
1117
|
alt: a,
|
|
1109
1118
|
size: n,
|
|
1110
1119
|
className: r = "",
|
|
1111
|
-
background:
|
|
1120
|
+
background: l
|
|
1112
1121
|
}) {
|
|
1113
|
-
const [c, m] =
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
}, [t]);
|
|
1117
|
-
const f = I(() => m(!0), []), h = I(() => d(!0), []);
|
|
1122
|
+
const [c, m] = S(!1), [s, u] = S(!1), f = B(t);
|
|
1123
|
+
f.current !== t && (f.current = t, m(!1), u(!1));
|
|
1124
|
+
const h = O(() => m(!0), []), d = O(() => u(!0), []);
|
|
1118
1125
|
return /* @__PURE__ */ o(
|
|
1119
1126
|
"div",
|
|
1120
1127
|
{
|
|
1121
1128
|
className: `relative rounded-full shrink-0 ${r}`,
|
|
1122
|
-
style: { width: n, height: n, background:
|
|
1129
|
+
style: { width: n, height: n, background: l },
|
|
1123
1130
|
children: [
|
|
1124
1131
|
!c && !s && /* @__PURE__ */ e(
|
|
1125
1132
|
"div",
|
|
@@ -1146,8 +1153,8 @@ function Wt({
|
|
|
1146
1153
|
alt: a,
|
|
1147
1154
|
width: n,
|
|
1148
1155
|
height: n,
|
|
1149
|
-
onLoad:
|
|
1150
|
-
onError:
|
|
1156
|
+
onLoad: h,
|
|
1157
|
+
onError: d,
|
|
1151
1158
|
className: `rounded-full ${c ? "opacity-100" : "opacity-0"}`,
|
|
1152
1159
|
style: { width: n, height: n, transition: "opacity 0.15s ease-in" }
|
|
1153
1160
|
}
|
|
@@ -1283,7 +1290,7 @@ function Da({ size: t = 32 }) {
|
|
|
1283
1290
|
);
|
|
1284
1291
|
}
|
|
1285
1292
|
function Fa({ size: t = 32 }) {
|
|
1286
|
-
const a = t * 0.56, n = a * 0.65, r = Math.max(2, a * 0.1),
|
|
1293
|
+
const a = t * 0.56, n = a * 0.65, r = Math.max(2, a * 0.1), l = a * 0.2;
|
|
1287
1294
|
return /* @__PURE__ */ o("div", { className: "flex items-center justify-center shrink-0", style: { width: t, height: t }, children: [
|
|
1288
1295
|
/* @__PURE__ */ e(
|
|
1289
1296
|
"div",
|
|
@@ -1316,7 +1323,7 @@ function Fa({ size: t = 32 }) {
|
|
|
1316
1323
|
height: n,
|
|
1317
1324
|
background: "#252525",
|
|
1318
1325
|
borderRadius: r,
|
|
1319
|
-
marginLeft: -
|
|
1326
|
+
marginLeft: -l,
|
|
1320
1327
|
position: "relative",
|
|
1321
1328
|
zIndex: 1,
|
|
1322
1329
|
display: "flex",
|
|
@@ -1427,11 +1434,11 @@ function Pa({
|
|
|
1427
1434
|
onOpenModal: n,
|
|
1428
1435
|
fiatCurrency: r
|
|
1429
1436
|
}) {
|
|
1430
|
-
const
|
|
1437
|
+
const l = Y(
|
|
1431
1438
|
() => t.filter((m) => m.supportedFiats.includes(r)),
|
|
1432
1439
|
[t, r]
|
|
1433
|
-
), c =
|
|
1434
|
-
return
|
|
1440
|
+
), c = l.find((m) => m.id === a) || l[0];
|
|
1441
|
+
return l.length === 0 ? /* @__PURE__ */ e(
|
|
1435
1442
|
"div",
|
|
1436
1443
|
{
|
|
1437
1444
|
className: "flex items-center justify-between px-[18px] pt-[12px] pb-[14px]",
|
|
@@ -1479,22 +1486,22 @@ function Ka({
|
|
|
1479
1486
|
redirectDelay: n = 3e3
|
|
1480
1487
|
}) {
|
|
1481
1488
|
var p;
|
|
1482
|
-
const { order: r, orderStatus:
|
|
1483
|
-
if (
|
|
1484
|
-
if ((r == null ? void 0 : r.checkout.method) === "redirect" && a && !
|
|
1489
|
+
const { order: r, orderStatus: l, goToStep: c, goBack: m } = ke(), [s, u] = S(!1), [f, h] = S(null), d = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
|
|
1490
|
+
if (W(() => {
|
|
1491
|
+
if ((r == null ? void 0 : r.checkout.method) === "redirect" && a && !d) {
|
|
1485
1492
|
h(Math.ceil(n / 1e3));
|
|
1486
|
-
const
|
|
1493
|
+
const C = setTimeout(() => {
|
|
1487
1494
|
window.location.href = r.checkout.url;
|
|
1488
1495
|
}, n), A = setInterval(() => {
|
|
1489
|
-
h((
|
|
1496
|
+
h((w) => w && w > 1 ? w - 1 : null);
|
|
1490
1497
|
}, 1e3);
|
|
1491
1498
|
return () => {
|
|
1492
|
-
clearTimeout(
|
|
1499
|
+
clearTimeout(C), clearInterval(A);
|
|
1493
1500
|
};
|
|
1494
1501
|
}
|
|
1495
|
-
}, [r, a, n,
|
|
1496
|
-
|
|
1497
|
-
}, [
|
|
1502
|
+
}, [r, a, n, d]), W(() => {
|
|
1503
|
+
l && (l.status === "completed" ? c("complete") : ["failed", "cancelled", "expired"].includes(l.status) && c("error"));
|
|
1504
|
+
}, [l == null ? void 0 : l.status, c]), !r)
|
|
1498
1505
|
return /* @__PURE__ */ o(
|
|
1499
1506
|
"div",
|
|
1500
1507
|
{
|
|
@@ -1521,7 +1528,7 @@ function Ka({
|
|
|
1521
1528
|
]
|
|
1522
1529
|
}
|
|
1523
1530
|
);
|
|
1524
|
-
if (
|
|
1531
|
+
if (d)
|
|
1525
1532
|
return /* @__PURE__ */ o(
|
|
1526
1533
|
"div",
|
|
1527
1534
|
{
|
|
@@ -1548,7 +1555,7 @@ function Ka({
|
|
|
1548
1555
|
}
|
|
1549
1556
|
);
|
|
1550
1557
|
if (r.checkout.method === "iframe") {
|
|
1551
|
-
const
|
|
1558
|
+
const C = r.checkout.url, A = ((p = r.checkout.allowedFeatures) == null ? void 0 : p.join("; ")) || "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";
|
|
1552
1559
|
return Ut(
|
|
1553
1560
|
/* @__PURE__ */ o(
|
|
1554
1561
|
"div",
|
|
@@ -1620,7 +1627,7 @@ function Ka({
|
|
|
1620
1627
|
/* @__PURE__ */ e(
|
|
1621
1628
|
"iframe",
|
|
1622
1629
|
{
|
|
1623
|
-
src:
|
|
1630
|
+
src: C,
|
|
1624
1631
|
style: {
|
|
1625
1632
|
display: s ? "block" : "none",
|
|
1626
1633
|
width: "100%",
|
|
@@ -1628,7 +1635,7 @@ function Ka({
|
|
|
1628
1635
|
border: "none"
|
|
1629
1636
|
},
|
|
1630
1637
|
allow: A,
|
|
1631
|
-
onLoad: () =>
|
|
1638
|
+
onLoad: () => u(!0),
|
|
1632
1639
|
title: "Provider Checkout"
|
|
1633
1640
|
}
|
|
1634
1641
|
)
|
|
@@ -1696,7 +1703,7 @@ function Ka({
|
|
|
1696
1703
|
}
|
|
1697
1704
|
);
|
|
1698
1705
|
if (r.checkout.method === "widget" && r.widgetConfig) {
|
|
1699
|
-
const
|
|
1706
|
+
const C = _a(r.checkout.url, r.widgetConfig);
|
|
1700
1707
|
return Ut(
|
|
1701
1708
|
/* @__PURE__ */ o(
|
|
1702
1709
|
"div",
|
|
@@ -1768,7 +1775,7 @@ function Ka({
|
|
|
1768
1775
|
/* @__PURE__ */ e(
|
|
1769
1776
|
"iframe",
|
|
1770
1777
|
{
|
|
1771
|
-
src:
|
|
1778
|
+
src: C,
|
|
1772
1779
|
style: {
|
|
1773
1780
|
display: s ? "block" : "none",
|
|
1774
1781
|
width: "100%",
|
|
@@ -1776,7 +1783,7 @@ function Ka({
|
|
|
1776
1783
|
border: "none"
|
|
1777
1784
|
},
|
|
1778
1785
|
allow: "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",
|
|
1779
|
-
onLoad: () =>
|
|
1786
|
+
onLoad: () => u(!0),
|
|
1780
1787
|
title: "Payment Checkout"
|
|
1781
1788
|
}
|
|
1782
1789
|
)
|
|
@@ -1816,16 +1823,16 @@ function Ka({
|
|
|
1816
1823
|
}
|
|
1817
1824
|
function _a(t, a) {
|
|
1818
1825
|
const n = new URL("/en/partner/widget", t);
|
|
1819
|
-
for (const [r,
|
|
1820
|
-
|
|
1826
|
+
for (const [r, l] of Object.entries(a))
|
|
1827
|
+
l != null && l !== "" && n.searchParams.set(r, String(l));
|
|
1821
1828
|
return n.toString();
|
|
1822
1829
|
}
|
|
1823
1830
|
function Va({ className: t = "" }) {
|
|
1824
|
-
const { orderStatus: a, orderStatusLoading: n, goToStep: r } =
|
|
1825
|
-
|
|
1831
|
+
const { orderStatus: a, orderStatusLoading: n, goToStep: r } = ke();
|
|
1832
|
+
W(() => {
|
|
1826
1833
|
a && (a.status === "completed" ? r("complete") : ["failed", "cancelled", "expired", "refunded"].includes(a.status) && r("error"));
|
|
1827
1834
|
}, [a == null ? void 0 : a.status, r]);
|
|
1828
|
-
const
|
|
1835
|
+
const l = () => {
|
|
1829
1836
|
if (!a) return "Processing your order...";
|
|
1830
1837
|
switch (a.status) {
|
|
1831
1838
|
case "pending":
|
|
@@ -1838,28 +1845,28 @@ function Va({ className: t = "" }) {
|
|
|
1838
1845
|
};
|
|
1839
1846
|
return /* @__PURE__ */ o("div", { className: `flex flex-col items-center justify-center px-8 py-12 text-center ${t}`, children: [
|
|
1840
1847
|
/* @__PURE__ */ e("div", { className: "mb-6", children: /* @__PURE__ */ e("div", { className: "nramp-spinner-large nramp-spinner" }) }),
|
|
1841
|
-
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-3", style: { color: "var(--t-text)" }, children:
|
|
1848
|
+
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-3", style: { color: "var(--t-text)" }, children: l() }),
|
|
1842
1849
|
n && /* @__PURE__ */ e("p", { className: "text-[13px] mb-4", style: { color: "var(--t-text-muted)" }, children: "Checking status..." }),
|
|
1843
1850
|
a && /* @__PURE__ */ o("div", { className: "w-full mt-6 text-left", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: [
|
|
1844
|
-
/* @__PURE__ */ e(
|
|
1845
|
-
/* @__PURE__ */ e(
|
|
1851
|
+
/* @__PURE__ */ e(Te, { label: "Order ID", value: a.orderId, mono: !0 }),
|
|
1852
|
+
/* @__PURE__ */ e(Te, { label: "Provider", value: a.gateway }),
|
|
1846
1853
|
/* @__PURE__ */ e(
|
|
1847
|
-
|
|
1854
|
+
Te,
|
|
1848
1855
|
{
|
|
1849
1856
|
label: "Amount",
|
|
1850
1857
|
value: `${a.fiatAmount} ${a.fiatCurrency}`
|
|
1851
1858
|
}
|
|
1852
1859
|
),
|
|
1853
1860
|
/* @__PURE__ */ e(
|
|
1854
|
-
|
|
1861
|
+
Te,
|
|
1855
1862
|
{
|
|
1856
1863
|
label: "Receiving",
|
|
1857
1864
|
value: `${a.cryptoAmount || "..."} ${a.cryptoCurrency}`
|
|
1858
1865
|
}
|
|
1859
1866
|
),
|
|
1860
|
-
/* @__PURE__ */ e(
|
|
1867
|
+
/* @__PURE__ */ e(Te, { label: "Network", value: a.network }),
|
|
1861
1868
|
/* @__PURE__ */ e(
|
|
1862
|
-
|
|
1869
|
+
Te,
|
|
1863
1870
|
{
|
|
1864
1871
|
label: "To Address",
|
|
1865
1872
|
value: `${a.walletAddress.slice(0, 10)}...${a.walletAddress.slice(-8)}`,
|
|
@@ -1873,7 +1880,7 @@ function Va({ className: t = "" }) {
|
|
|
1873
1880
|
] })
|
|
1874
1881
|
] });
|
|
1875
1882
|
}
|
|
1876
|
-
function
|
|
1883
|
+
function Te({ label: t, value: a, mono: n }) {
|
|
1877
1884
|
return /* @__PURE__ */ o(
|
|
1878
1885
|
"div",
|
|
1879
1886
|
{
|
|
@@ -1899,10 +1906,10 @@ function ja({
|
|
|
1899
1906
|
onDone: n,
|
|
1900
1907
|
doneButtonText: r = "Done"
|
|
1901
1908
|
}) {
|
|
1902
|
-
const { orderStatus:
|
|
1903
|
-
if (!(
|
|
1909
|
+
const { orderStatus: l, state: c, dispatch: m } = ke(), s = c.flowType === "sell", u = () => {
|
|
1910
|
+
if (!(l != null && l.transactionHash)) return null;
|
|
1904
1911
|
if (!a) {
|
|
1905
|
-
const
|
|
1912
|
+
const d = {
|
|
1906
1913
|
ethereum: "https://etherscan.io/tx/{txHash}",
|
|
1907
1914
|
polygon: "https://polygonscan.com/tx/{txHash}",
|
|
1908
1915
|
arbitrum: "https://arbiscan.io/tx/{txHash}",
|
|
@@ -1913,12 +1920,12 @@ function ja({
|
|
|
1913
1920
|
avalanche: "https://snowtrace.io/tx/{txHash}",
|
|
1914
1921
|
fantom: "https://ftmscan.com/tx/{txHash}"
|
|
1915
1922
|
};
|
|
1916
|
-
return (
|
|
1923
|
+
return (d[c.network] || d.ethereum).replace("{txHash}", l.transactionHash);
|
|
1917
1924
|
}
|
|
1918
|
-
return a.replace("{txHash}",
|
|
1925
|
+
return a.replace("{txHash}", l.transactionHash);
|
|
1919
1926
|
}, f = () => {
|
|
1920
1927
|
n ? n() : m({ type: "RESET" });
|
|
1921
|
-
}, h =
|
|
1928
|
+
}, h = u();
|
|
1922
1929
|
return /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 text-center ${t}`, children: [
|
|
1923
1930
|
/* @__PURE__ */ e(
|
|
1924
1931
|
"div",
|
|
@@ -1929,47 +1936,47 @@ function ja({
|
|
|
1929
1936
|
}
|
|
1930
1937
|
),
|
|
1931
1938
|
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children: s ? "Sale Complete!" : "Purchase Complete!" }),
|
|
1932
|
-
/* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: s ? `Your ${(
|
|
1933
|
-
|
|
1939
|
+
/* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: s ? `Your ${(l == null ? void 0 : l.fiatCurrency) || c.fiatCurrency} payout is being processed.` : `Your ${(l == null ? void 0 : l.cryptoCurrency) || c.cryptoCurrency} has been sent to your wallet.` }),
|
|
1940
|
+
l && /* @__PURE__ */ o("div", { className: "w-full text-left mb-6", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: [
|
|
1934
1941
|
/* @__PURE__ */ e(
|
|
1935
|
-
|
|
1942
|
+
fe,
|
|
1936
1943
|
{
|
|
1937
1944
|
label: s ? "Amount Sold" : "Amount Received",
|
|
1938
|
-
value: `${
|
|
1945
|
+
value: `${l.cryptoAmount} ${l.cryptoCurrency}`,
|
|
1939
1946
|
highlight: !0
|
|
1940
1947
|
}
|
|
1941
1948
|
),
|
|
1942
1949
|
/* @__PURE__ */ e(
|
|
1943
|
-
|
|
1950
|
+
fe,
|
|
1944
1951
|
{
|
|
1945
1952
|
label: s ? "Payout Amount" : "Amount Paid",
|
|
1946
|
-
value: `${
|
|
1953
|
+
value: `${l.fiatAmount} ${l.fiatCurrency}`
|
|
1947
1954
|
}
|
|
1948
1955
|
),
|
|
1949
|
-
/* @__PURE__ */ e(
|
|
1956
|
+
/* @__PURE__ */ e(fe, { label: "Network", value: l.network }),
|
|
1950
1957
|
/* @__PURE__ */ e(
|
|
1951
|
-
|
|
1958
|
+
fe,
|
|
1952
1959
|
{
|
|
1953
1960
|
label: "Wallet",
|
|
1954
|
-
value: `${
|
|
1961
|
+
value: `${l.walletAddress.slice(0, 10)}...${l.walletAddress.slice(-8)}`,
|
|
1955
1962
|
mono: !0
|
|
1956
1963
|
}
|
|
1957
1964
|
),
|
|
1958
|
-
|
|
1959
|
-
|
|
1965
|
+
l.transactionHash && /* @__PURE__ */ e(
|
|
1966
|
+
fe,
|
|
1960
1967
|
{
|
|
1961
1968
|
label: "Transaction",
|
|
1962
|
-
value: `${
|
|
1969
|
+
value: `${l.transactionHash.slice(0, 10)}...${l.transactionHash.slice(-8)}`,
|
|
1963
1970
|
mono: !0
|
|
1964
1971
|
}
|
|
1965
1972
|
),
|
|
1966
|
-
/* @__PURE__ */ e(
|
|
1967
|
-
/* @__PURE__ */ e(
|
|
1968
|
-
|
|
1969
|
-
|
|
1973
|
+
/* @__PURE__ */ e(fe, { label: "Provider", value: l.gateway }),
|
|
1974
|
+
/* @__PURE__ */ e(fe, { label: "Order ID", value: l.orderId, mono: !0 }),
|
|
1975
|
+
l.completedAt && /* @__PURE__ */ e(
|
|
1976
|
+
fe,
|
|
1970
1977
|
{
|
|
1971
1978
|
label: "Completed",
|
|
1972
|
-
value: new Date(
|
|
1979
|
+
value: new Date(l.completedAt).toLocaleString()
|
|
1973
1980
|
}
|
|
1974
1981
|
)
|
|
1975
1982
|
] }),
|
|
@@ -1997,7 +2004,7 @@ function ja({
|
|
|
1997
2004
|
] })
|
|
1998
2005
|
] });
|
|
1999
2006
|
}
|
|
2000
|
-
function
|
|
2007
|
+
function fe({ label: t, value: a, mono: n, highlight: r }) {
|
|
2001
2008
|
return /* @__PURE__ */ o(
|
|
2002
2009
|
"div",
|
|
2003
2010
|
{
|
|
@@ -2022,9 +2029,9 @@ function Ga({
|
|
|
2022
2029
|
onRetry: a,
|
|
2023
2030
|
supportEmail: n = "support@nowramp.com"
|
|
2024
2031
|
}) {
|
|
2025
|
-
const { state: r, orderStatus:
|
|
2026
|
-
if (
|
|
2027
|
-
switch (
|
|
2032
|
+
const { state: r, orderStatus: l, dispatch: c, goToStep: m } = ke(), s = r.flowType === "sell", u = () => {
|
|
2033
|
+
if (l)
|
|
2034
|
+
switch (l.status) {
|
|
2028
2035
|
case "failed":
|
|
2029
2036
|
return "Payment Failed";
|
|
2030
2037
|
case "cancelled":
|
|
@@ -2039,8 +2046,8 @@ function Ga({
|
|
|
2039
2046
|
return "Something Went Wrong";
|
|
2040
2047
|
}, f = () => {
|
|
2041
2048
|
if (r.errorMessage) return r.errorMessage;
|
|
2042
|
-
if (
|
|
2043
|
-
switch (
|
|
2049
|
+
if (l)
|
|
2050
|
+
switch (l.status) {
|
|
2044
2051
|
case "failed":
|
|
2045
2052
|
return s ? "Your sale could not be processed. Please try again." : "Your payment could not be processed. Please try again or use a different payment method.";
|
|
2046
2053
|
case "cancelled":
|
|
@@ -2055,7 +2062,7 @@ function Ga({
|
|
|
2055
2062
|
return "An unexpected error occurred. Please try again.";
|
|
2056
2063
|
}, h = () => {
|
|
2057
2064
|
c({ type: "CLEAR_ERROR" }), a ? a() : (c({ type: "RESET" }), m("amount"));
|
|
2058
|
-
},
|
|
2065
|
+
}, d = () => {
|
|
2059
2066
|
c({ type: "RESET" }), m("amount");
|
|
2060
2067
|
};
|
|
2061
2068
|
return /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 text-center ${t}`, children: [
|
|
@@ -2067,11 +2074,11 @@ function Ga({
|
|
|
2067
2074
|
children: /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: "32", height: "32", fill: "white", children: /* @__PURE__ */ e("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" }) })
|
|
2068
2075
|
}
|
|
2069
2076
|
),
|
|
2070
|
-
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children:
|
|
2077
|
+
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children: u() }),
|
|
2071
2078
|
/* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: f() }),
|
|
2072
|
-
|
|
2079
|
+
l && /* @__PURE__ */ e("div", { className: "w-full text-left mb-6", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: /* @__PURE__ */ o("div", { className: "flex justify-between items-center py-2", children: [
|
|
2073
2080
|
/* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: "Order ID" }),
|
|
2074
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium font-mono", style: { color: "var(--t-text)" }, children:
|
|
2081
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium font-mono", style: { color: "var(--t-text)" }, children: l.orderId })
|
|
2075
2082
|
] }) }),
|
|
2076
2083
|
/* @__PURE__ */ o("div", { className: "w-full flex flex-col gap-2", children: [
|
|
2077
2084
|
/* @__PURE__ */ e(
|
|
@@ -2088,7 +2095,7 @@ function Ga({
|
|
|
2088
2095
|
{
|
|
2089
2096
|
className: "w-full font-semibold text-[14px] transition-all",
|
|
2090
2097
|
style: { height: 48, borderRadius: 5, background: "var(--t-surface)", color: "var(--t-text)" },
|
|
2091
|
-
onClick:
|
|
2098
|
+
onClick: d,
|
|
2092
2099
|
children: "Start Over"
|
|
2093
2100
|
}
|
|
2094
2101
|
)
|
|
@@ -2107,9 +2114,9 @@ function Ga({
|
|
|
2107
2114
|
}
|
|
2108
2115
|
)
|
|
2109
2116
|
] }),
|
|
2110
|
-
|
|
2117
|
+
l && /* @__PURE__ */ o("p", { className: "text-[12px] mt-1", style: { color: "var(--t-text-muted)" }, children: [
|
|
2111
2118
|
"Reference: ",
|
|
2112
|
-
|
|
2119
|
+
l.orderId
|
|
2113
2120
|
] })
|
|
2114
2121
|
] })
|
|
2115
2122
|
] });
|
|
@@ -2121,27 +2128,27 @@ function $a({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2121
2128
|
var q;
|
|
2122
2129
|
const {
|
|
2123
2130
|
config: r,
|
|
2124
|
-
configLoading:
|
|
2131
|
+
configLoading: l,
|
|
2125
2132
|
state: c,
|
|
2126
2133
|
defaultGateway: m,
|
|
2127
2134
|
quotes: s,
|
|
2128
|
-
fetchQuotes:
|
|
2135
|
+
fetchQuotes: u,
|
|
2129
2136
|
createOrder: f,
|
|
2130
2137
|
orderLoading: h
|
|
2131
|
-
} =
|
|
2132
|
-
|
|
2138
|
+
} = ke(), d = c.flowType === "sell", [p, C] = S(null), A = r == null ? void 0 : r.gateways.find(($) => $.id === m), w = (q = s == null ? void 0 : s.bestQuote) != null && q.exchangeRate ? parseFloat(s.bestQuote.exchangeRate) : null, R = parseFloat(c.fiatAmount) || 0, P = !!(a && n && !d && Xt(c.cryptoCurrency) && w), re = P && c.cryptoCurrency.toUpperCase().includes(c.fiatCurrency.toUpperCase()), j = P && R > 0 ? lt(re ? R : R / w) : null, Z = async () => {
|
|
2139
|
+
C(null);
|
|
2133
2140
|
try {
|
|
2134
|
-
|
|
2141
|
+
u(), await f();
|
|
2135
2142
|
} catch ($) {
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2143
|
+
const he = $ instanceof Error ? $.message : "Failed to create order";
|
|
2144
|
+
C(he);
|
|
2138
2145
|
}
|
|
2139
2146
|
};
|
|
2140
|
-
return
|
|
2147
|
+
return l ? /* @__PURE__ */ o("div", { className: `flex flex-col items-center justify-center p-12 ${t}`, children: [
|
|
2141
2148
|
/* @__PURE__ */ e("div", { className: "nramp-spinner" }),
|
|
2142
2149
|
/* @__PURE__ */ e("p", { className: "text-[14px] mt-4", style: { color: "var(--t-text-secondary)" }, children: "Loading..." })
|
|
2143
2150
|
] }) : /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 ${t}`, children: [
|
|
2144
|
-
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-6", style: { color: "var(--t-text)" }, children:
|
|
2151
|
+
/* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-6", style: { color: "var(--t-text)" }, children: d ? "Confirm Sale" : "Confirm Purchase" }),
|
|
2145
2152
|
/* @__PURE__ */ o("div", { className: "w-full text-left mb-6", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: [
|
|
2146
2153
|
A && /* @__PURE__ */ o("div", { className: "flex justify-between items-center py-2", style: { borderBottom: "1px solid var(--t-divider)" }, children: [
|
|
2147
2154
|
/* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: "Provider" }),
|
|
@@ -2150,7 +2157,7 @@ function $a({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2150
2157
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: A.name })
|
|
2151
2158
|
] })
|
|
2152
2159
|
] }),
|
|
2153
|
-
|
|
2160
|
+
d ? /* @__PURE__ */ o(J, { children: [
|
|
2154
2161
|
/* @__PURE__ */ e(Se, { label: "You sell", value: `${c.cryptoAmount} ${c.cryptoCurrency}`, highlight: !0 }),
|
|
2155
2162
|
/* @__PURE__ */ e(Se, { label: "You receive", value: `${c.fiatCurrency} payout` })
|
|
2156
2163
|
] }) : /* @__PURE__ */ o(J, { children: [
|
|
@@ -2159,13 +2166,13 @@ function $a({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2159
2166
|
Se,
|
|
2160
2167
|
{
|
|
2161
2168
|
label: "You receive",
|
|
2162
|
-
value:
|
|
2169
|
+
value: j ? `${j} ${c.cryptoCurrency}` : `${c.cryptoCurrency} on ${c.network}`
|
|
2163
2170
|
}
|
|
2164
2171
|
),
|
|
2165
2172
|
/* @__PURE__ */ e(Se, { label: "Wallet", value: Kt(c.walletAddress), mono: !0 }),
|
|
2166
|
-
|
|
2173
|
+
P && j && /* @__PURE__ */ o("div", { className: "py-2 text-[11px]", style: { color: "var(--t-text-muted)", lineHeight: "15px" }, children: [
|
|
2167
2174
|
"Charged amount from provider may differ. The rest up to ",
|
|
2168
|
-
|
|
2175
|
+
j,
|
|
2169
2176
|
" ",
|
|
2170
2177
|
c.cryptoCurrency,
|
|
2171
2178
|
" will be credited to your ",
|
|
@@ -2174,7 +2181,7 @@ function $a({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2174
2181
|
] })
|
|
2175
2182
|
] }),
|
|
2176
2183
|
/* @__PURE__ */ e(Se, { label: "Network", value: c.network }),
|
|
2177
|
-
|
|
2184
|
+
d && c.walletAddress && /* @__PURE__ */ e(Se, { label: "Refund address", value: Kt(c.walletAddress), mono: !0 })
|
|
2178
2185
|
] }),
|
|
2179
2186
|
p && /* @__PURE__ */ e("p", { className: "text-[12px] mb-4", style: { color: "#EF4444" }, children: p }),
|
|
2180
2187
|
/* @__PURE__ */ e(
|
|
@@ -2187,7 +2194,7 @@ function $a({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2187
2194
|
children: h ? /* @__PURE__ */ o(J, { children: [
|
|
2188
2195
|
/* @__PURE__ */ e("span", { className: "nramp-spinner-inline" }),
|
|
2189
2196
|
"Processing..."
|
|
2190
|
-
] }) :
|
|
2197
|
+
] }) : d ? "Confirm & Sell" : "Confirm & Pay"
|
|
2191
2198
|
}
|
|
2192
2199
|
)
|
|
2193
2200
|
] });
|
|
@@ -2210,25 +2217,25 @@ function He({
|
|
|
2210
2217
|
onClose: a,
|
|
2211
2218
|
children: n
|
|
2212
2219
|
}) {
|
|
2213
|
-
const [r,
|
|
2214
|
-
|
|
2220
|
+
const [r, l] = S(!1), [c, m] = S(!1);
|
|
2221
|
+
W(() => {
|
|
2215
2222
|
if (t)
|
|
2216
|
-
|
|
2223
|
+
l(!0), requestAnimationFrame(() => requestAnimationFrame(() => m(!0)));
|
|
2217
2224
|
else if (r) {
|
|
2218
2225
|
m(!1);
|
|
2219
|
-
const
|
|
2220
|
-
return () => clearTimeout(
|
|
2226
|
+
const u = setTimeout(() => l(!1), 250);
|
|
2227
|
+
return () => clearTimeout(u);
|
|
2221
2228
|
}
|
|
2222
2229
|
}, [t]);
|
|
2223
|
-
const s =
|
|
2230
|
+
const s = O(() => {
|
|
2224
2231
|
m(!1), setTimeout(() => a(), 250);
|
|
2225
2232
|
}, [a]);
|
|
2226
|
-
return
|
|
2233
|
+
return W(() => {
|
|
2227
2234
|
if (!t) return;
|
|
2228
|
-
const
|
|
2235
|
+
const u = (f) => {
|
|
2229
2236
|
f.key === "Escape" && s();
|
|
2230
2237
|
};
|
|
2231
|
-
return window.addEventListener("keydown",
|
|
2238
|
+
return window.addEventListener("keydown", u), () => window.removeEventListener("keydown", u);
|
|
2232
2239
|
}, [t, s]), r ? /* @__PURE__ */ e(
|
|
2233
2240
|
"div",
|
|
2234
2241
|
{
|
|
@@ -2247,7 +2254,7 @@ function He({
|
|
|
2247
2254
|
}
|
|
2248
2255
|
function Xa({ char: t, height: a = 38 }) {
|
|
2249
2256
|
const n = "0123456789", r = n.indexOf(t);
|
|
2250
|
-
return r === -1 ? /* @__PURE__ */ e("span", { children: t }) : /* @__PURE__ */ e("span", { className: "digit-slot", style: { height: a, lineHeight: `${a}px` }, children: /* @__PURE__ */ e("span", { className: "digit-slot-inner block", style: { transform: `translateY(-${r * a}px)` }, children: n.split("").map((
|
|
2257
|
+
return r === -1 ? /* @__PURE__ */ e("span", { children: t }) : /* @__PURE__ */ e("span", { className: "digit-slot", style: { height: a, lineHeight: `${a}px` }, children: /* @__PURE__ */ e("span", { className: "digit-slot-inner block", style: { transform: `translateY(-${r * a}px)` }, children: n.split("").map((l) => /* @__PURE__ */ e("span", { className: "block", style: { height: a, lineHeight: `${a}px` }, children: l }, l)) }) });
|
|
2251
2258
|
}
|
|
2252
2259
|
function Wa({
|
|
2253
2260
|
value: t,
|
|
@@ -2255,9 +2262,9 @@ function Wa({
|
|
|
2255
2262
|
className: n = "",
|
|
2256
2263
|
style: r = {}
|
|
2257
2264
|
}) {
|
|
2258
|
-
return /* @__PURE__ */ e("span", { className: n, style: { display: "inline-flex", ...r }, children: t.split("").map((
|
|
2265
|
+
return /* @__PURE__ */ e("span", { className: n, style: { display: "inline-flex", ...r }, children: t.split("").map((l, c) => /* @__PURE__ */ e(Xa, { char: l, height: a }, c)) });
|
|
2259
2266
|
}
|
|
2260
|
-
function
|
|
2267
|
+
function V({
|
|
2261
2268
|
w: t,
|
|
2262
2269
|
h: a,
|
|
2263
2270
|
className: n = ""
|
|
@@ -2267,33 +2274,33 @@ function K({
|
|
|
2267
2274
|
function Ya() {
|
|
2268
2275
|
return /* @__PURE__ */ o("div", { className: "flex-1 px-5 flex flex-col", children: [
|
|
2269
2276
|
/* @__PURE__ */ o("div", { className: "px-[18px] pt-[14px] pb-[18px]", style: { background: "var(--t-surface)", borderRadius: 5 }, children: [
|
|
2270
|
-
/* @__PURE__ */ e(
|
|
2277
|
+
/* @__PURE__ */ e(V, { w: 70, h: 14, className: "mb-3" }),
|
|
2271
2278
|
/* @__PURE__ */ o("div", { className: "flex justify-between items-center", children: [
|
|
2272
|
-
/* @__PURE__ */ e(
|
|
2273
|
-
/* @__PURE__ */ e(
|
|
2279
|
+
/* @__PURE__ */ e(V, { w: 120, h: 32 }),
|
|
2280
|
+
/* @__PURE__ */ e(V, { w: 75, h: 32 })
|
|
2274
2281
|
] })
|
|
2275
2282
|
] }),
|
|
2276
2283
|
/* @__PURE__ */ o("div", { className: "px-[18px] pt-[12px] pb-[18px]", style: { background: "var(--t-surface)", borderRadius: 5, marginTop: 4 }, children: [
|
|
2277
|
-
/* @__PURE__ */ e(
|
|
2284
|
+
/* @__PURE__ */ e(V, { w: 50, h: 14, className: "mb-3" }),
|
|
2278
2285
|
/* @__PURE__ */ o("div", { className: "flex justify-between items-center", children: [
|
|
2279
|
-
/* @__PURE__ */ e(
|
|
2280
|
-
/* @__PURE__ */ e(
|
|
2286
|
+
/* @__PURE__ */ e(V, { w: 180, h: 32 }),
|
|
2287
|
+
/* @__PURE__ */ e(V, { w: 85, h: 32 })
|
|
2281
2288
|
] })
|
|
2282
2289
|
] }),
|
|
2283
2290
|
/* @__PURE__ */ o("div", { className: "flex justify-between mt-3 px-[2px]", children: [
|
|
2284
|
-
/* @__PURE__ */ e(
|
|
2285
|
-
/* @__PURE__ */ e(
|
|
2291
|
+
/* @__PURE__ */ e(V, { w: 140, h: 12 }),
|
|
2292
|
+
/* @__PURE__ */ e(V, { w: 90, h: 12 })
|
|
2286
2293
|
] }),
|
|
2287
2294
|
/* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
2288
|
-
/* @__PURE__ */ e(
|
|
2289
|
-
/* @__PURE__ */ e(
|
|
2295
|
+
/* @__PURE__ */ e(V, { w: 65, h: 14, className: "mb-2.5" }),
|
|
2296
|
+
/* @__PURE__ */ e(V, { w: "100%", h: 47 })
|
|
2290
2297
|
] }),
|
|
2291
2298
|
/* @__PURE__ */ e("div", { className: "flex-1" }),
|
|
2292
|
-
/* @__PURE__ */ e(
|
|
2299
|
+
/* @__PURE__ */ e(V, { w: "100%", h: 60, className: "mb-2" }),
|
|
2293
2300
|
/* @__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" }) })
|
|
2294
2301
|
] });
|
|
2295
2302
|
}
|
|
2296
|
-
function
|
|
2303
|
+
function Le({ onClick: t }) {
|
|
2297
2304
|
return /* @__PURE__ */ e(
|
|
2298
2305
|
"button",
|
|
2299
2306
|
{
|
|
@@ -2311,7 +2318,7 @@ function Ke({
|
|
|
2311
2318
|
onChange: a,
|
|
2312
2319
|
placeholder: n = ""
|
|
2313
2320
|
}) {
|
|
2314
|
-
const [r,
|
|
2321
|
+
const [r, l] = S(!1);
|
|
2315
2322
|
return /* @__PURE__ */ o("div", { className: "relative mx-5 mb-5", children: [
|
|
2316
2323
|
/* @__PURE__ */ e(
|
|
2317
2324
|
"input",
|
|
@@ -2319,8 +2326,8 @@ function Ke({
|
|
|
2319
2326
|
type: "text",
|
|
2320
2327
|
value: t,
|
|
2321
2328
|
onChange: (c) => a(c.target.value),
|
|
2322
|
-
onFocus: () =>
|
|
2323
|
-
onBlur: () =>
|
|
2329
|
+
onFocus: () => l(!0),
|
|
2330
|
+
onBlur: () => l(!1),
|
|
2324
2331
|
placeholder: n,
|
|
2325
2332
|
style: { height: 47, borderRadius: 4.5, border: `1px solid ${r ? "var(--t-border-focus)" : "var(--t-border)"}`, outline: "none", boxShadow: "none", color: "var(--t-text)", padding: `0 ${t ? 40 : 14}px 0 14px`, fontSize: 14, backgroundColor: "transparent" },
|
|
2326
2333
|
className: "w-full outline-none transition-colors"
|
|
@@ -2342,23 +2349,23 @@ function Za({
|
|
|
2342
2349
|
onSelect: a,
|
|
2343
2350
|
currencies: n,
|
|
2344
2351
|
assetBaseUrl: r = "",
|
|
2345
|
-
selectedCode:
|
|
2352
|
+
selectedCode: l
|
|
2346
2353
|
}) {
|
|
2347
|
-
const [c, m] =
|
|
2354
|
+
const [c, m] = S(""), s = Y(() => {
|
|
2348
2355
|
if (!n || n.length === 0) return Ft;
|
|
2349
2356
|
const f = new Map(Ft.map((h) => [h.code, h.name]));
|
|
2350
2357
|
return n.map((h) => ({
|
|
2351
2358
|
code: h.code,
|
|
2352
2359
|
name: h.name || f.get(h.code) || h.code
|
|
2353
2360
|
}));
|
|
2354
|
-
}, [n]),
|
|
2361
|
+
}, [n]), u = Y(() => {
|
|
2355
2362
|
const f = c.trim().toLowerCase();
|
|
2356
2363
|
if (!f) {
|
|
2357
|
-
if (
|
|
2358
|
-
const h = s.find((
|
|
2364
|
+
if (l) {
|
|
2365
|
+
const h = s.find((d) => d.code === l);
|
|
2359
2366
|
if (h) {
|
|
2360
|
-
const
|
|
2361
|
-
return [h, ...
|
|
2367
|
+
const d = s.filter((p) => p.code !== l);
|
|
2368
|
+
return [h, ...d];
|
|
2362
2369
|
}
|
|
2363
2370
|
}
|
|
2364
2371
|
return s;
|
|
@@ -2366,9 +2373,9 @@ function Za({
|
|
|
2366
2373
|
return s.filter(
|
|
2367
2374
|
(h) => h.code.toLowerCase().includes(f) || h.name.toLowerCase().includes(f)
|
|
2368
2375
|
);
|
|
2369
|
-
}, [s, c,
|
|
2376
|
+
}, [s, c, l]);
|
|
2370
2377
|
return /* @__PURE__ */ o(J, { children: [
|
|
2371
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(
|
|
2378
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
2372
2379
|
/* @__PURE__ */ e(
|
|
2373
2380
|
"h2",
|
|
2374
2381
|
{
|
|
@@ -2385,8 +2392,8 @@ function Za({
|
|
|
2385
2392
|
),
|
|
2386
2393
|
/* @__PURE__ */ e(Ke, { value: c, onChange: m }),
|
|
2387
2394
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2395
|
+
u.map((f, h) => {
|
|
2396
|
+
const d = f.name !== f.code ? f.name : "", p = l === f.code;
|
|
2390
2397
|
return /* @__PURE__ */ o("div", { children: [
|
|
2391
2398
|
/* @__PURE__ */ o(
|
|
2392
2399
|
"button",
|
|
@@ -2398,7 +2405,7 @@ function Za({
|
|
|
2398
2405
|
/* @__PURE__ */ e(ct, { currencyCode: f.code, size: 32, baseUrl: r }),
|
|
2399
2406
|
/* @__PURE__ */ o("div", { className: "text-left flex-1 flex items-center gap-2", children: [
|
|
2400
2407
|
/* @__PURE__ */ e("span", { className: "font-semibold text-[15px]", children: f.code }),
|
|
2401
|
-
|
|
2408
|
+
d && /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: d })
|
|
2402
2409
|
] }),
|
|
2403
2410
|
p && /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: /* @__PURE__ */ e(
|
|
2404
2411
|
"path",
|
|
@@ -2413,7 +2420,7 @@ function Za({
|
|
|
2413
2420
|
]
|
|
2414
2421
|
}
|
|
2415
2422
|
),
|
|
2416
|
-
h <
|
|
2423
|
+
h < u.length - 1 && /* @__PURE__ */ e(
|
|
2417
2424
|
"div",
|
|
2418
2425
|
{
|
|
2419
2426
|
style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" }
|
|
@@ -2421,17 +2428,15 @@ function Za({
|
|
|
2421
2428
|
)
|
|
2422
2429
|
] }, f.code);
|
|
2423
2430
|
}),
|
|
2424
|
-
|
|
2431
|
+
u.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
|
|
2425
2432
|
] })
|
|
2426
2433
|
] });
|
|
2427
2434
|
}
|
|
2428
|
-
function _t({ src: t, alt: a, size: n, className: r, style:
|
|
2429
|
-
const [c, m] =
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
}, [
|
|
2433
|
-
const f = I(() => m(!0), []), h = I(() => d(!0), []);
|
|
2434
|
-
return /* @__PURE__ */ o("div", { className: r, style: { ...i, width: n, height: n, position: "relative" }, children: [
|
|
2435
|
+
function _t({ src: t, alt: a, size: n, className: r, style: l }) {
|
|
2436
|
+
const [c, m] = S(!1), [s, u] = S(!1), f = B(t);
|
|
2437
|
+
f.current !== t && (f.current = t, m(!1), u(!1));
|
|
2438
|
+
const h = O(() => m(!0), []), d = O(() => u(!0), []);
|
|
2439
|
+
return /* @__PURE__ */ o("div", { className: r, style: { ...l, width: n, height: n, position: "relative" }, children: [
|
|
2435
2440
|
!c && !s && /* @__PURE__ */ e(
|
|
2436
2441
|
"div",
|
|
2437
2442
|
{
|
|
@@ -2453,59 +2458,59 @@ function _t({ src: t, alt: a, size: n, className: r, style: i }) {
|
|
|
2453
2458
|
alt: a,
|
|
2454
2459
|
width: n,
|
|
2455
2460
|
height: n,
|
|
2456
|
-
onLoad:
|
|
2457
|
-
onError:
|
|
2461
|
+
onLoad: h,
|
|
2462
|
+
onError: d,
|
|
2458
2463
|
className: `rounded-full ${c ? "opacity-100" : "opacity-0"}`,
|
|
2459
2464
|
style: { width: n, height: n, transition: "opacity 0.15s ease-in" }
|
|
2460
2465
|
}
|
|
2461
2466
|
)
|
|
2462
2467
|
] });
|
|
2463
2468
|
}
|
|
2464
|
-
function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selectedCode:
|
|
2465
|
-
const [m, s] =
|
|
2469
|
+
function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selectedCode: l, selectedChain: c }) {
|
|
2470
|
+
const [m, s] = S(""), u = Y(() => {
|
|
2466
2471
|
if (!n || n.length === 0) return wa;
|
|
2467
|
-
const
|
|
2472
|
+
const d = [];
|
|
2468
2473
|
for (const p of n) {
|
|
2469
|
-
const
|
|
2470
|
-
if (
|
|
2471
|
-
|
|
2474
|
+
const C = p.networks || [], A = p.name || va[p.code] || p.code;
|
|
2475
|
+
if (C.length === 0)
|
|
2476
|
+
d.push({ code: p.code, name: A, chain: p.code, popular: !1 });
|
|
2472
2477
|
else
|
|
2473
|
-
for (const
|
|
2474
|
-
const R =
|
|
2475
|
-
|
|
2478
|
+
for (const w of C) {
|
|
2479
|
+
const R = w.code || w.id || w.name || p.code;
|
|
2480
|
+
d.push({
|
|
2476
2481
|
code: p.code,
|
|
2477
2482
|
name: A,
|
|
2478
2483
|
chain: R,
|
|
2479
|
-
chainName:
|
|
2484
|
+
chainName: w.name,
|
|
2480
2485
|
popular: !1
|
|
2481
2486
|
});
|
|
2482
2487
|
}
|
|
2483
2488
|
}
|
|
2484
|
-
return
|
|
2485
|
-
}, [n]), f =
|
|
2489
|
+
return d;
|
|
2490
|
+
}, [n]), f = O((d, p) => l === d && c === p, [l, c]), h = Y(() => {
|
|
2486
2491
|
var A;
|
|
2487
|
-
const
|
|
2488
|
-
if (!
|
|
2489
|
-
if (
|
|
2490
|
-
const
|
|
2491
|
-
if (
|
|
2492
|
-
const R =
|
|
2493
|
-
return [
|
|
2492
|
+
const d = m.trim().toLowerCase();
|
|
2493
|
+
if (!d) {
|
|
2494
|
+
if (l && c) {
|
|
2495
|
+
const w = u.find((R) => R.code === l && R.chain === c);
|
|
2496
|
+
if (w) {
|
|
2497
|
+
const R = u.filter((P) => !(P.code === l && P.chain === c));
|
|
2498
|
+
return [w, ...R];
|
|
2494
2499
|
}
|
|
2495
2500
|
}
|
|
2496
|
-
return
|
|
2501
|
+
return u;
|
|
2497
2502
|
}
|
|
2498
|
-
const p =
|
|
2499
|
-
for (const
|
|
2500
|
-
const R = Ze(
|
|
2501
|
-
if (!p.every((
|
|
2502
|
-
let
|
|
2503
|
-
Z ===
|
|
2503
|
+
const p = d.split(/\s+/), C = [];
|
|
2504
|
+
for (const w of u) {
|
|
2505
|
+
const R = Ze(w.chain), P = R ? R.name.toLowerCase() : "", re = ((A = R == null ? void 0 : R.shortName) == null ? void 0 : A.toLowerCase()) || "", j = w.chain.toLowerCase(), Z = w.code.toLowerCase(), q = w.name.toLowerCase(), $ = [Z, q, P, re, j];
|
|
2506
|
+
if (!p.every((k) => $.some((i) => i.includes(k)))) continue;
|
|
2507
|
+
let x = 0;
|
|
2508
|
+
Z === d ? x += 100 : Z.startsWith(p[0]) && (x += 50), w.popular && (x += 10), p.length > 1 && (P.includes(p[1]) || re.includes(p[1]) || j.includes(p[1])) && (x += 25), C.push({ item: w, score: x });
|
|
2504
2509
|
}
|
|
2505
|
-
return
|
|
2506
|
-
}, [
|
|
2510
|
+
return C.sort((w, R) => R.score - w.score), C.map((w) => w.item);
|
|
2511
|
+
}, [u, m, l, c]);
|
|
2507
2512
|
return /* @__PURE__ */ o(J, { children: [
|
|
2508
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(
|
|
2513
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
2509
2514
|
/* @__PURE__ */ e(
|
|
2510
2515
|
"h2",
|
|
2511
2516
|
{
|
|
@@ -2516,13 +2521,13 @@ function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
2516
2521
|
),
|
|
2517
2522
|
/* @__PURE__ */ e(Ke, { value: m, onChange: s }),
|
|
2518
2523
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
|
|
2519
|
-
h.map((
|
|
2520
|
-
const
|
|
2524
|
+
h.map((d, p) => {
|
|
2525
|
+
const C = Ze(d.chain), A = (C == null ? void 0 : C.name) || d.chainName || d.chain, w = d.name !== d.code ? d.name : "", R = f(d.code, d.chain);
|
|
2521
2526
|
return /* @__PURE__ */ o("div", { children: [
|
|
2522
2527
|
/* @__PURE__ */ o(
|
|
2523
2528
|
"button",
|
|
2524
2529
|
{
|
|
2525
|
-
onClick: () => a(
|
|
2530
|
+
onClick: () => a(d.code, d.chain),
|
|
2526
2531
|
className: "flex items-center w-full transition-colors rounded-lg hover-item",
|
|
2527
2532
|
style: { gap: 14, padding: "18px 8px", margin: "0 -8px" },
|
|
2528
2533
|
children: [
|
|
@@ -2535,8 +2540,8 @@ function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
2535
2540
|
children: /* @__PURE__ */ e(
|
|
2536
2541
|
_t,
|
|
2537
2542
|
{
|
|
2538
|
-
src: $t(
|
|
2539
|
-
alt:
|
|
2543
|
+
src: $t(d.code, r),
|
|
2544
|
+
alt: d.code,
|
|
2540
2545
|
size: 32
|
|
2541
2546
|
}
|
|
2542
2547
|
)
|
|
@@ -2556,8 +2561,8 @@ function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
2556
2561
|
children: /* @__PURE__ */ e(
|
|
2557
2562
|
_t,
|
|
2558
2563
|
{
|
|
2559
|
-
src: it(
|
|
2560
|
-
alt:
|
|
2564
|
+
src: it(d.chain, r),
|
|
2565
|
+
alt: d.chain,
|
|
2561
2566
|
size: 16
|
|
2562
2567
|
}
|
|
2563
2568
|
)
|
|
@@ -2570,15 +2575,15 @@ function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
2570
2575
|
{
|
|
2571
2576
|
className: "font-semibold text-[15px]",
|
|
2572
2577
|
style: { color: "var(--t-text)" },
|
|
2573
|
-
children:
|
|
2578
|
+
children: d.code
|
|
2574
2579
|
}
|
|
2575
2580
|
),
|
|
2576
|
-
|
|
2581
|
+
w && /* @__PURE__ */ e(
|
|
2577
2582
|
"span",
|
|
2578
2583
|
{
|
|
2579
2584
|
className: "text-[13px]",
|
|
2580
2585
|
style: { color: "var(--t-text-secondary)" },
|
|
2581
|
-
children:
|
|
2586
|
+
children: w
|
|
2582
2587
|
}
|
|
2583
2588
|
)
|
|
2584
2589
|
] }) }),
|
|
@@ -2599,7 +2604,7 @@ function Qa({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
2599
2604
|
}
|
|
2600
2605
|
),
|
|
2601
2606
|
p < h.length - 1 && /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" } })
|
|
2602
|
-
] }, `${
|
|
2607
|
+
] }, `${d.code}-${d.chain}`);
|
|
2603
2608
|
}),
|
|
2604
2609
|
h.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
|
|
2605
2610
|
] })
|
|
@@ -2611,24 +2616,24 @@ function za({
|
|
|
2611
2616
|
onSelect: n,
|
|
2612
2617
|
onClose: r
|
|
2613
2618
|
}) {
|
|
2614
|
-
const [
|
|
2615
|
-
const s =
|
|
2619
|
+
const [l, c] = S(""), m = Y(() => {
|
|
2620
|
+
const s = l.trim().toLowerCase();
|
|
2616
2621
|
if (!s) {
|
|
2617
2622
|
if (a) {
|
|
2618
|
-
const
|
|
2619
|
-
if (
|
|
2623
|
+
const u = t.find((f) => f.id === a);
|
|
2624
|
+
if (u) {
|
|
2620
2625
|
const f = t.filter((h) => h.id !== a);
|
|
2621
|
-
return [
|
|
2626
|
+
return [u, ...f];
|
|
2622
2627
|
}
|
|
2623
2628
|
}
|
|
2624
2629
|
return t;
|
|
2625
2630
|
}
|
|
2626
2631
|
return t.filter(
|
|
2627
|
-
(
|
|
2632
|
+
(u) => u.id.toLowerCase().includes(s) || u.name.toLowerCase().includes(s) || u.description && u.description.toLowerCase().includes(s)
|
|
2628
2633
|
);
|
|
2629
|
-
}, [t,
|
|
2634
|
+
}, [t, l, a]);
|
|
2630
2635
|
return /* @__PURE__ */ o(J, { children: [
|
|
2631
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(
|
|
2636
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: r }) }),
|
|
2632
2637
|
/* @__PURE__ */ e(
|
|
2633
2638
|
"h2",
|
|
2634
2639
|
{
|
|
@@ -2637,9 +2642,9 @@ function za({
|
|
|
2637
2642
|
children: "Choose payment method"
|
|
2638
2643
|
}
|
|
2639
2644
|
),
|
|
2640
|
-
/* @__PURE__ */ e(Ke, { value:
|
|
2645
|
+
/* @__PURE__ */ e(Ke, { value: l, onChange: c }),
|
|
2641
2646
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
|
|
2642
|
-
m.map((s,
|
|
2647
|
+
m.map((s, u) => {
|
|
2643
2648
|
const f = s.id === a, h = Yt(s.id, s.name);
|
|
2644
2649
|
return /* @__PURE__ */ o("div", { children: [
|
|
2645
2650
|
/* @__PURE__ */ o(
|
|
@@ -2688,7 +2693,7 @@ function za({
|
|
|
2688
2693
|
]
|
|
2689
2694
|
}
|
|
2690
2695
|
),
|
|
2691
|
-
|
|
2696
|
+
u < m.length - 1 && /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" } })
|
|
2692
2697
|
] }, s.id);
|
|
2693
2698
|
}),
|
|
2694
2699
|
m.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No payment methods found" })
|
|
@@ -2734,22 +2739,22 @@ function en({
|
|
|
2734
2739
|
darkMode: a,
|
|
2735
2740
|
onToggleDarkMode: n,
|
|
2736
2741
|
skinId: r,
|
|
2737
|
-
onSelectSkin:
|
|
2742
|
+
onSelectSkin: l,
|
|
2738
2743
|
showThemeToggle: c = !0,
|
|
2739
2744
|
country: m,
|
|
2740
2745
|
countryName: s,
|
|
2741
|
-
onLocationPress:
|
|
2746
|
+
onLocationPress: u,
|
|
2742
2747
|
assetBaseUrl: f = ""
|
|
2743
2748
|
}) {
|
|
2744
|
-
const [h,
|
|
2749
|
+
const [h, d] = S(!1);
|
|
2745
2750
|
return /* @__PURE__ */ o(J, { children: [
|
|
2746
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end items-center px-5 pt-5", children: /* @__PURE__ */ e(
|
|
2751
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end items-center px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
2747
2752
|
/* @__PURE__ */ o("div", { className: "px-5 flex-1 pt-6 overflow-y-auto custom-scroll", children: [
|
|
2748
|
-
|
|
2753
|
+
u && /* @__PURE__ */ o(J, { children: [
|
|
2749
2754
|
/* @__PURE__ */ e("div", { style: { borderTop: "1px solid var(--t-divider)" }, children: /* @__PURE__ */ o(
|
|
2750
2755
|
"button",
|
|
2751
2756
|
{
|
|
2752
|
-
onClick:
|
|
2757
|
+
onClick: u,
|
|
2753
2758
|
className: "flex items-center justify-between w-full py-5 transition-colors",
|
|
2754
2759
|
style: { color: "inherit", background: "none", border: "none", cursor: "pointer", padding: "20px 0" },
|
|
2755
2760
|
children: [
|
|
@@ -2762,7 +2767,7 @@ function en({
|
|
|
2762
2767
|
width: 40,
|
|
2763
2768
|
height: 40,
|
|
2764
2769
|
style: { width: 40, height: 40, borderRadius: "50%", objectFit: "cover" },
|
|
2765
|
-
onError: () =>
|
|
2770
|
+
onError: () => d(!0)
|
|
2766
2771
|
}
|
|
2767
2772
|
) : /* @__PURE__ */ e(tn, { size: 40 }),
|
|
2768
2773
|
/* @__PURE__ */ o("div", { className: "text-left", children: [
|
|
@@ -2791,7 +2796,7 @@ function en({
|
|
|
2791
2796
|
/* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider)" } })
|
|
2792
2797
|
] }),
|
|
2793
2798
|
c && /* @__PURE__ */ o(J, { children: [
|
|
2794
|
-
/* @__PURE__ */ e("div", { style: { borderTop:
|
|
2799
|
+
/* @__PURE__ */ e("div", { style: { borderTop: u ? "none" : "1px solid var(--t-divider)" }, children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between w-full py-5", children: [
|
|
2795
2800
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-3.5", children: [
|
|
2796
2801
|
/* @__PURE__ */ e(Ia, { size: 40 }),
|
|
2797
2802
|
/* @__PURE__ */ e(
|
|
@@ -2848,24 +2853,24 @@ function an({
|
|
|
2848
2853
|
assetBaseUrl: n = "",
|
|
2849
2854
|
selectedCode: r
|
|
2850
2855
|
}) {
|
|
2851
|
-
const [
|
|
2852
|
-
const s =
|
|
2856
|
+
const [l, c] = S(""), m = Y(() => {
|
|
2857
|
+
const s = l.trim().toLowerCase();
|
|
2853
2858
|
if (!s) {
|
|
2854
2859
|
if (r) {
|
|
2855
|
-
const
|
|
2860
|
+
const u = r.toLowerCase(), f = st[u];
|
|
2856
2861
|
if (f) {
|
|
2857
|
-
const h = Ye.filter((
|
|
2862
|
+
const h = Ye.filter((d) => d.code !== u);
|
|
2858
2863
|
return [f, ...h];
|
|
2859
2864
|
}
|
|
2860
2865
|
}
|
|
2861
2866
|
return Ye;
|
|
2862
2867
|
}
|
|
2863
2868
|
return Ye.filter(
|
|
2864
|
-
(
|
|
2869
|
+
(u) => u.name.toLowerCase().includes(s) || u.code.includes(s) || u.defaultFiat.toLowerCase().includes(s)
|
|
2865
2870
|
);
|
|
2866
|
-
}, [
|
|
2871
|
+
}, [l, r]);
|
|
2867
2872
|
return /* @__PURE__ */ o(J, { children: [
|
|
2868
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(
|
|
2873
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
2869
2874
|
/* @__PURE__ */ e(
|
|
2870
2875
|
"h2",
|
|
2871
2876
|
{
|
|
@@ -2880,9 +2885,9 @@ function an({
|
|
|
2880
2885
|
children: "Select your country"
|
|
2881
2886
|
}
|
|
2882
2887
|
),
|
|
2883
|
-
/* @__PURE__ */ e(Ke, { value:
|
|
2888
|
+
/* @__PURE__ */ e(Ke, { value: l, onChange: c }),
|
|
2884
2889
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
|
|
2885
|
-
m.map((s,
|
|
2890
|
+
m.map((s, u) => {
|
|
2886
2891
|
const f = (r == null ? void 0 : r.toLowerCase()) === s.code;
|
|
2887
2892
|
return /* @__PURE__ */ o("div", { children: [
|
|
2888
2893
|
/* @__PURE__ */ o(
|
|
@@ -2910,7 +2915,7 @@ function an({
|
|
|
2910
2915
|
]
|
|
2911
2916
|
}
|
|
2912
2917
|
),
|
|
2913
|
-
|
|
2918
|
+
u < m.length - 1 && /* @__PURE__ */ e(
|
|
2914
2919
|
"div",
|
|
2915
2920
|
{
|
|
2916
2921
|
style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" }
|
|
@@ -2923,7 +2928,7 @@ function an({
|
|
|
2923
2928
|
] });
|
|
2924
2929
|
}
|
|
2925
2930
|
function nn({ code: t, size: a = 32, baseUrl: n = "" }) {
|
|
2926
|
-
const [r,
|
|
2931
|
+
const [r, l] = S(!1);
|
|
2927
2932
|
return r ? /* @__PURE__ */ e(
|
|
2928
2933
|
"div",
|
|
2929
2934
|
{
|
|
@@ -2948,7 +2953,7 @@ function nn({ code: t, size: a = 32, baseUrl: n = "" }) {
|
|
|
2948
2953
|
width: a,
|
|
2949
2954
|
height: a,
|
|
2950
2955
|
style: { width: a, height: a, borderRadius: "50%", objectFit: "cover" },
|
|
2951
|
-
onError: () =>
|
|
2956
|
+
onError: () => l(!0)
|
|
2952
2957
|
}
|
|
2953
2958
|
);
|
|
2954
2959
|
}
|
|
@@ -2957,168 +2962,168 @@ function rn({
|
|
|
2957
2962
|
theme: a = "dark",
|
|
2958
2963
|
skinId: n = "mono",
|
|
2959
2964
|
accentColor: r,
|
|
2960
|
-
bgColor:
|
|
2965
|
+
bgColor: l,
|
|
2961
2966
|
bgImage: c,
|
|
2962
2967
|
borderColor: m,
|
|
2963
2968
|
borderRadius: s,
|
|
2964
|
-
surfaceColor:
|
|
2969
|
+
surfaceColor: u,
|
|
2965
2970
|
inputBgColor: f,
|
|
2966
2971
|
textColor: h,
|
|
2967
|
-
textSecondaryColor:
|
|
2972
|
+
textSecondaryColor: d,
|
|
2968
2973
|
textMutedColor: p,
|
|
2969
|
-
successColor:
|
|
2974
|
+
successColor: C,
|
|
2970
2975
|
showFlowToggle: A = !0,
|
|
2971
|
-
showSettings:
|
|
2976
|
+
showSettings: w = !0,
|
|
2972
2977
|
showThemeToggle: R = !0,
|
|
2973
|
-
autoRedirect:
|
|
2974
|
-
explorerUrl:
|
|
2975
|
-
doneButtonText:
|
|
2978
|
+
autoRedirect: P = !1,
|
|
2979
|
+
explorerUrl: re,
|
|
2980
|
+
doneButtonText: j = "Done",
|
|
2976
2981
|
supportEmail: Z,
|
|
2977
2982
|
stablecoinParity: q,
|
|
2978
2983
|
partnerName: $,
|
|
2979
|
-
onDone:
|
|
2984
|
+
onDone: he
|
|
2980
2985
|
}) {
|
|
2981
2986
|
var bt, Nt, Et, wt, At, Rt, Tt, kt, Lt;
|
|
2982
2987
|
const {
|
|
2983
|
-
state:
|
|
2984
|
-
dispatch:
|
|
2985
|
-
config:
|
|
2986
|
-
configLoading:
|
|
2987
|
-
quotes:
|
|
2988
|
-
quotesLoading:
|
|
2989
|
-
quotesError:
|
|
2990
|
-
fetchQuotes:
|
|
2991
|
-
createOrder:
|
|
2992
|
-
orderLoading:
|
|
2993
|
-
amountError:
|
|
2994
|
-
fieldLocks:
|
|
2995
|
-
apiConfig:
|
|
2996
|
-
assetBaseUrl:
|
|
2997
|
-
} =
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
}, [a]),
|
|
3001
|
-
const
|
|
3002
|
-
return () => clearTimeout(
|
|
3003
|
-
}, [
|
|
3004
|
-
if (
|
|
3005
|
-
|
|
3006
|
-
const
|
|
3007
|
-
return () => clearTimeout(
|
|
2988
|
+
state: x,
|
|
2989
|
+
dispatch: k,
|
|
2990
|
+
config: i,
|
|
2991
|
+
configLoading: I,
|
|
2992
|
+
quotes: N,
|
|
2993
|
+
quotesLoading: v,
|
|
2994
|
+
quotesError: pe,
|
|
2995
|
+
fetchQuotes: ye,
|
|
2996
|
+
createOrder: xe,
|
|
2997
|
+
orderLoading: le,
|
|
2998
|
+
amountError: de,
|
|
2999
|
+
fieldLocks: D,
|
|
3000
|
+
apiConfig: ee,
|
|
3001
|
+
assetBaseUrl: X
|
|
3002
|
+
} = ke(), [Q, be] = S(a === "dark"), [Ne, Ue] = S(n), [oe, G] = S(null), [ge, De] = S(!1), [_e, te] = S(!1), [ze, Ee] = S(!1), [we, Fe] = S(!1), [Me, Ce] = S(null), [Ie, Je] = S(!0), [qe, Ve] = S(!1), [y, b] = S(!1), U = B(null), L = B(), F = B(x.flowType);
|
|
3003
|
+
W(() => {
|
|
3004
|
+
be(a === "dark");
|
|
3005
|
+
}, [a]), W(() => {
|
|
3006
|
+
const g = setTimeout(() => Je(!1), I ? 0 : 800);
|
|
3007
|
+
return () => clearTimeout(g);
|
|
3008
|
+
}, [I]), W(() => {
|
|
3009
|
+
if (F.current !== x.flowType && !Ie) {
|
|
3010
|
+
F.current = x.flowType, Ve(!0), De(!1), te(!1);
|
|
3011
|
+
const g = setTimeout(() => Ve(!1), 350);
|
|
3012
|
+
return () => clearTimeout(g);
|
|
3008
3013
|
}
|
|
3009
|
-
|
|
3010
|
-
}, [
|
|
3011
|
-
const
|
|
3012
|
-
ue &&
|
|
3014
|
+
F.current = x.flowType;
|
|
3015
|
+
}, [x.flowType, Ie]);
|
|
3016
|
+
const K = x.flowType, M = K === "buy", _ = x.cryptoCurrency || "BTC", ae = x.fiatCurrency || "USD", et = M ? x.fiatAmount : x.cryptoAmount, z = Ea(et), ue = (bt = N == null ? void 0 : N.bestQuote) != null && bt.exchangeRate ? parseFloat(N.bestQuote.exchangeRate) : null, je = B(null);
|
|
3017
|
+
ue && _ && ae && (je.current = { rate: ue, crypto: _, fiat: ae });
|
|
3013
3018
|
const ut = Y(() => {
|
|
3014
|
-
if (
|
|
3015
|
-
const
|
|
3016
|
-
if (
|
|
3019
|
+
if (N != null && N.bestQuote) {
|
|
3020
|
+
const g = M ? N.bestQuote.cryptoAmount : N.bestQuote.fiatAmount;
|
|
3021
|
+
if (g) return g;
|
|
3017
3022
|
}
|
|
3018
3023
|
return "0";
|
|
3019
|
-
}, [
|
|
3020
|
-
var
|
|
3021
|
-
const
|
|
3022
|
-
return !
|
|
3023
|
-
}, [
|
|
3024
|
-
|
|
3025
|
-
const
|
|
3026
|
-
if (!
|
|
3027
|
-
|
|
3024
|
+
}, [N, M]), Be = !!(q && $ && M && Xt(_) && ue), Qt = Be && _.toUpperCase().includes(ae.toUpperCase()), mt = Be && z > 0 ? lt(Qt ? z : z / ue) : null, zt = Be && mt ? mt : ut, Jt = Y(() => {
|
|
3025
|
+
var H, ie, Re;
|
|
3026
|
+
const g = ue || ((H = je.current) == null ? void 0 : H.rate), E = ue ? _ : (ie = je.current) == null ? void 0 : ie.crypto, T = ue ? ae : (Re = je.current) == null ? void 0 : Re.fiat;
|
|
3027
|
+
return !g || !E || !T ? "" : `1 ${E} ≈ ${g.toFixed(2)} ${T}`;
|
|
3028
|
+
}, [_, ae, ue]);
|
|
3029
|
+
W(() => {
|
|
3030
|
+
const g = x.walletAddress.trim(), E = x.network;
|
|
3031
|
+
if (!g || g.length < 10) {
|
|
3032
|
+
Ce(null), k({ type: "SET_WALLET_ERROR", message: "" });
|
|
3028
3033
|
return;
|
|
3029
3034
|
}
|
|
3030
|
-
|
|
3035
|
+
Fe(!0), Ce(null);
|
|
3031
3036
|
const T = new AbortController();
|
|
3032
|
-
return clearTimeout(
|
|
3033
|
-
var
|
|
3037
|
+
return clearTimeout(L.current), L.current = setTimeout(async () => {
|
|
3038
|
+
var H, ie, Re;
|
|
3034
3039
|
try {
|
|
3035
|
-
const nt = await (await fetch(`${
|
|
3040
|
+
const nt = await (await fetch(`${ee.apiUrl}/public/validate/address`, {
|
|
3036
3041
|
method: "POST",
|
|
3037
3042
|
headers: { "Content-Type": "application/json" },
|
|
3038
|
-
body: JSON.stringify({ address:
|
|
3043
|
+
body: JSON.stringify({ address: g, ...E ? { network: E } : {} }),
|
|
3039
3044
|
signal: T.signal
|
|
3040
|
-
})).json(), rt = ((
|
|
3045
|
+
})).json(), rt = ((H = nt.data) == null ? void 0 : H.attributes) || nt.data || nt;
|
|
3041
3046
|
if (rt.isValid)
|
|
3042
|
-
|
|
3047
|
+
Ce(!0), k({ type: "SET_WALLET_ERROR", message: "" });
|
|
3043
3048
|
else {
|
|
3044
|
-
|
|
3045
|
-
const da = ((
|
|
3046
|
-
|
|
3049
|
+
Ce(!1);
|
|
3050
|
+
const da = ((ie = rt.errors) == null ? void 0 : ie[0]) || ((Re = rt.details) == null ? void 0 : Re.formatMessage) || "Invalid wallet address";
|
|
3051
|
+
k({ type: "SET_WALLET_ERROR", message: da });
|
|
3047
3052
|
}
|
|
3048
3053
|
} catch (at) {
|
|
3049
3054
|
if (at instanceof DOMException && at.name === "AbortError") return;
|
|
3050
|
-
|
|
3055
|
+
Ce(null);
|
|
3051
3056
|
} finally {
|
|
3052
|
-
T.signal.aborted ||
|
|
3057
|
+
T.signal.aborted || Fe(!1);
|
|
3053
3058
|
}
|
|
3054
3059
|
}, 500), () => {
|
|
3055
|
-
clearTimeout(
|
|
3060
|
+
clearTimeout(L.current), T.abort();
|
|
3056
3061
|
};
|
|
3057
|
-
}, [
|
|
3058
|
-
const ft = !et || z === 0, ht = z > 0 && (
|
|
3059
|
-
let
|
|
3060
|
-
const T =
|
|
3061
|
-
|
|
3062
|
-
}, yt = (
|
|
3063
|
-
|
|
3064
|
-
}, ta =
|
|
3065
|
-
(
|
|
3066
|
-
|
|
3062
|
+
}, [x.walletAddress, x.network, ee.apiUrl]);
|
|
3063
|
+
const ft = !et || z === 0, ht = z > 0 && (M ? z < Bt : z < Ot), pt = !!de || ht || ge && ft, qt = z > 0 && !de && !ht, tt = x.walletAddress.trim().length >= 10 && Me !== !1 && !we, Ge = qt && tt && !!x.cryptoCurrency && !!x.network, ea = (g) => {
|
|
3064
|
+
let E = g.target.value.replace(/[^0-9.,]/g, "");
|
|
3065
|
+
const T = M ? 2 : 6, H = E.indexOf(".");
|
|
3066
|
+
H !== -1 && E.length - H - 1 > T && (E = E.slice(0, H + T + 1)), k(M ? { type: "SET_FIAT_AMOUNT", amount: E } : { type: "SET_CRYPTO_AMOUNT", amount: E });
|
|
3067
|
+
}, yt = (g) => {
|
|
3068
|
+
g !== K && k({ type: "SET_FLOW_TYPE", flowType: g });
|
|
3069
|
+
}, ta = O(
|
|
3070
|
+
(g) => {
|
|
3071
|
+
k({ type: "SET_FIAT_CURRENCY", currency: g });
|
|
3067
3072
|
},
|
|
3068
|
-
[
|
|
3069
|
-
), aa =
|
|
3070
|
-
(
|
|
3071
|
-
|
|
3073
|
+
[k]
|
|
3074
|
+
), aa = O(
|
|
3075
|
+
(g, E) => {
|
|
3076
|
+
k({ type: "SET_CRYPTO_CURRENCY", currency: g }), k({ type: "SET_CRYPTO_CHAIN", chain: E });
|
|
3072
3077
|
},
|
|
3073
|
-
[
|
|
3074
|
-
), na =
|
|
3075
|
-
(
|
|
3076
|
-
|
|
3078
|
+
[k]
|
|
3079
|
+
), na = O(
|
|
3080
|
+
(g) => {
|
|
3081
|
+
k({ type: "SET_PAYMENT_METHOD", methodId: g });
|
|
3077
3082
|
},
|
|
3078
|
-
[
|
|
3079
|
-
), ra =
|
|
3080
|
-
(
|
|
3081
|
-
|
|
3083
|
+
[k]
|
|
3084
|
+
), ra = O(
|
|
3085
|
+
(g) => {
|
|
3086
|
+
k({ type: "SET_COUNTRY", country: g }), G(null);
|
|
3082
3087
|
},
|
|
3083
|
-
[
|
|
3084
|
-
), oa =
|
|
3085
|
-
|
|
3086
|
-
}, []), ia =
|
|
3087
|
-
Ge && (
|
|
3088
|
+
[k]
|
|
3089
|
+
), oa = O(() => {
|
|
3090
|
+
G(null), setTimeout(() => G("country"), 280);
|
|
3091
|
+
}, []), ia = x.country ? (Nt = st[x.country.toLowerCase()]) == null ? void 0 : Nt.name : void 0, la = () => {
|
|
3092
|
+
Ge && (b(!0), ye());
|
|
3088
3093
|
};
|
|
3089
|
-
|
|
3090
|
-
var
|
|
3091
|
-
if (!(!
|
|
3092
|
-
if (
|
|
3093
|
-
|
|
3094
|
+
W(() => {
|
|
3095
|
+
var g;
|
|
3096
|
+
if (!(!y || v)) {
|
|
3097
|
+
if (N != null && N.bestQuote)
|
|
3098
|
+
b(!1), k({ type: "SELECT_QUOTE", quote: N.bestQuote }), xe().catch(() => {
|
|
3094
3099
|
});
|
|
3095
|
-
else if (
|
|
3096
|
-
|
|
3097
|
-
else if (
|
|
3098
|
-
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3100
|
+
else if (pe)
|
|
3101
|
+
b(!1), k({ type: "SET_ERROR", message: pe.message || "No quotes available" });
|
|
3102
|
+
else if (N && !N.bestQuote) {
|
|
3103
|
+
b(!1);
|
|
3104
|
+
const E = (g = N.unavailableGateways) == null ? void 0 : g.map((H) => H.reason).filter(Boolean), T = E != null && E.length ? `No providers available: ${E.join("; ")}` : "No providers available for this currency/network combination";
|
|
3105
|
+
k({ type: "SET_ERROR", message: T });
|
|
3101
3106
|
}
|
|
3102
3107
|
}
|
|
3103
|
-
}, [
|
|
3104
|
-
const xt =
|
|
3105
|
-
const
|
|
3106
|
-
return (0.299 * T + 0.587 *
|
|
3108
|
+
}, [y, N, v, pe, k, xe]);
|
|
3109
|
+
const xt = Q ? "theme-dark" : "theme-light", $e = Mt.find((g) => g.id === Ne) || Mt[0], ca = $e.accent === null, sa = r ? se(r) : !1, gt = (g) => {
|
|
3110
|
+
const E = g.replace("#", ""), T = parseInt(E.substring(0, 2), 16), H = parseInt(E.substring(2, 4), 16), ie = parseInt(E.substring(4, 6), 16);
|
|
3111
|
+
return (0.299 * T + 0.587 * H + 0.114 * ie) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
3107
3112
|
}, Ct = sa ? { "--t-accent": r, "--t-cta-bg": r, "--t-cta-text": gt(r) } : ca ? {
|
|
3108
|
-
"--t-accent":
|
|
3109
|
-
"--t-cta-bg":
|
|
3110
|
-
"--t-cta-text":
|
|
3113
|
+
"--t-accent": Q ? "#ffffff" : "#111111",
|
|
3114
|
+
"--t-cta-bg": Q ? "#ffffff" : "#111111",
|
|
3115
|
+
"--t-cta-text": Q ? "#000000" : "#ffffff"
|
|
3111
3116
|
} : {
|
|
3112
3117
|
"--t-accent": $e.accent,
|
|
3113
3118
|
"--t-cta-bg": $e.accent,
|
|
3114
3119
|
"--t-cta-text": gt($e.accent)
|
|
3115
|
-
},
|
|
3116
|
-
|
|
3117
|
-
const
|
|
3118
|
-
|
|
3119
|
-
const Xe =
|
|
3120
|
-
m &&
|
|
3121
|
-
const vt =
|
|
3120
|
+
}, ne = {};
|
|
3121
|
+
u && se(u) && (ne["--t-surface"] = u, ne["--t-modal-bg"] = u), f && se(f) && (ne["--t-pill-bg"] = f, ne["--t-close-bg"] = f), h && se(h) && (ne["--t-text"] = h), d && se(d) && (ne["--t-text-secondary"] = d), p && se(p) && (ne["--t-text-muted"] = p, ne["--t-text-tertiary"] = p), C && se(C) && (ne["--t-success"] = C);
|
|
3122
|
+
const ve = {};
|
|
3123
|
+
l && se(l) ? ve.backgroundColor = l : ve.backgroundColor = "var(--t-bg)", c && (c.startsWith("https://") || c.startsWith("data:image/")) && (ve.backgroundImage = `url(${c})`, ve.backgroundSize = "cover", ve.backgroundPosition = "center");
|
|
3124
|
+
const Xe = Q ? "#ffffff" : "#111111", We = {};
|
|
3125
|
+
m && se(m) && (We.border = `1px solid ${m}`), s && (We.borderRadius = s);
|
|
3126
|
+
const vt = x.step === "checkout" ? /* @__PURE__ */ e(Ka, { autoRedirect: P }) : x.step === "processing" ? /* @__PURE__ */ e(Va, {}) : x.step === "complete" ? /* @__PURE__ */ e(ja, { explorerUrl: re, doneButtonText: j, onDone: he }) : x.step === "error" ? /* @__PURE__ */ e(Ga, { supportEmail: Z }) : x.step === "confirm" ? /* @__PURE__ */ e($a, { stablecoinParity: Be, partnerName: $ }) : null;
|
|
3122
3127
|
if (vt)
|
|
3123
3128
|
return /* @__PURE__ */ e(
|
|
3124
3129
|
"div",
|
|
@@ -3126,28 +3131,28 @@ function rn({
|
|
|
3126
3131
|
className: `${xt} relative w-full max-w-[390px] h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,
|
|
3127
3132
|
style: {
|
|
3128
3133
|
fontFamily: "'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
3129
|
-
...
|
|
3134
|
+
...ve,
|
|
3130
3135
|
...Ct,
|
|
3131
|
-
...
|
|
3136
|
+
...ne,
|
|
3132
3137
|
...We
|
|
3133
3138
|
},
|
|
3134
3139
|
children: vt
|
|
3135
3140
|
}
|
|
3136
3141
|
);
|
|
3137
|
-
const
|
|
3142
|
+
const ce = x.network, Ae = ce ? Ze(ce) : null, St = (Ae == null ? void 0 : Ae.shortName) || (Ae == null ? void 0 : Ae.name) || ce;
|
|
3138
3143
|
return /* @__PURE__ */ o(
|
|
3139
3144
|
"div",
|
|
3140
3145
|
{
|
|
3141
3146
|
className: `${xt} relative w-full max-w-[390px] min-h-[640px] overflow-hidden flex flex-col select-none transition-colors duration-300 ${t}`,
|
|
3142
3147
|
style: {
|
|
3143
3148
|
fontFamily: "'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
3144
|
-
...
|
|
3149
|
+
...ve,
|
|
3145
3150
|
...Ct,
|
|
3146
|
-
...
|
|
3151
|
+
...ne,
|
|
3147
3152
|
...We
|
|
3148
3153
|
},
|
|
3149
3154
|
children: [
|
|
3150
|
-
|
|
3155
|
+
w && /* @__PURE__ */ e("div", { className: `flex justify-end items-center px-5 pt-3 ${A ? "pb-1" : "pb-5"}`, children: /* @__PURE__ */ e(Ma, { onClick: () => G("settings") }) }),
|
|
3151
3156
|
A ? /* @__PURE__ */ o("div", { className: "flex flex-col items-center pt-3 pb-5", children: [
|
|
3152
3157
|
/* @__PURE__ */ o("div", { className: "flex", style: { width: 165 }, children: [
|
|
3153
3158
|
/* @__PURE__ */ e(
|
|
@@ -3155,7 +3160,7 @@ function rn({
|
|
|
3155
3160
|
{
|
|
3156
3161
|
onClick: () => yt("buy"),
|
|
3157
3162
|
className: "flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",
|
|
3158
|
-
style: { color:
|
|
3163
|
+
style: { color: K === "buy" ? "var(--t-text)" : "var(--t-text-secondary)" },
|
|
3159
3164
|
children: "Buy"
|
|
3160
3165
|
}
|
|
3161
3166
|
),
|
|
@@ -3164,7 +3169,7 @@ function rn({
|
|
|
3164
3169
|
{
|
|
3165
3170
|
onClick: () => yt("sell"),
|
|
3166
3171
|
className: "flex-1 pb-2.5 text-[16px] font-medium text-center transition-colors duration-200",
|
|
3167
|
-
style: { color:
|
|
3172
|
+
style: { color: K === "sell" ? "var(--t-text)" : "var(--t-text-secondary)" },
|
|
3168
3173
|
children: "Sell"
|
|
3169
3174
|
}
|
|
3170
3175
|
)
|
|
@@ -3177,14 +3182,14 @@ function rn({
|
|
|
3177
3182
|
className: "absolute top-0 h-full transition-all duration-300 ease-in-out",
|
|
3178
3183
|
style: {
|
|
3179
3184
|
width: "50%",
|
|
3180
|
-
left:
|
|
3185
|
+
left: K === "buy" ? "0%" : "50%",
|
|
3181
3186
|
background: "var(--t-accent)"
|
|
3182
3187
|
}
|
|
3183
3188
|
}
|
|
3184
3189
|
)
|
|
3185
3190
|
] })
|
|
3186
3191
|
] }) : null,
|
|
3187
|
-
Ie || qe ||
|
|
3192
|
+
Ie || qe || I ? /* @__PURE__ */ e(Ya, {}) : /* @__PURE__ */ o("div", { className: "flex-1 overflow-hidden px-5 flex flex-col tab-fade-in", children: [
|
|
3188
3193
|
/* @__PURE__ */ o(
|
|
3189
3194
|
"div",
|
|
3190
3195
|
{
|
|
@@ -3192,7 +3197,7 @@ function rn({
|
|
|
3192
3197
|
style: {
|
|
3193
3198
|
background: "var(--t-surface)",
|
|
3194
3199
|
borderRadius: 5,
|
|
3195
|
-
border:
|
|
3200
|
+
border: ge && pt ? "1px solid #EF4444" : "1px solid transparent",
|
|
3196
3201
|
minHeight: 102
|
|
3197
3202
|
},
|
|
3198
3203
|
children: [
|
|
@@ -3201,22 +3206,22 @@ function rn({
|
|
|
3201
3206
|
/* @__PURE__ */ e(
|
|
3202
3207
|
"input",
|
|
3203
3208
|
{
|
|
3204
|
-
ref:
|
|
3209
|
+
ref: U,
|
|
3205
3210
|
type: "text",
|
|
3206
3211
|
value: et,
|
|
3207
3212
|
onChange: ea,
|
|
3208
|
-
onBlur: () =>
|
|
3209
|
-
placeholder:
|
|
3213
|
+
onBlur: () => De(!0),
|
|
3214
|
+
placeholder: M ? "250" : "0.01",
|
|
3210
3215
|
className: "bg-transparent outline-none w-0 flex-1 mr-3",
|
|
3211
3216
|
style: { color: "var(--t-text)", fontSize: 24, fontWeight: 600, lineHeight: "32px", padding: 0, border: "none", borderRadius: 0, backgroundColor: "transparent", height: "auto", width: 0 },
|
|
3212
3217
|
inputMode: "decimal",
|
|
3213
|
-
disabled: !!((Et =
|
|
3218
|
+
disabled: !!((Et = D == null ? void 0 : D.sourceAmount) != null && Et.locked)
|
|
3214
3219
|
}
|
|
3215
3220
|
),
|
|
3216
|
-
|
|
3221
|
+
M ? /* @__PURE__ */ o(
|
|
3217
3222
|
"button",
|
|
3218
3223
|
{
|
|
3219
|
-
onClick: () =>
|
|
3224
|
+
onClick: () => G("fiat"),
|
|
3220
3225
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
3221
3226
|
style: {
|
|
3222
3227
|
background: "var(--t-pill-bg)",
|
|
@@ -3225,10 +3230,10 @@ function rn({
|
|
|
3225
3230
|
paddingLeft: 10,
|
|
3226
3231
|
paddingRight: 10
|
|
3227
3232
|
},
|
|
3228
|
-
disabled: !!((wt =
|
|
3233
|
+
disabled: !!((wt = D == null ? void 0 : D.sourceCurrency) != null && wt.locked),
|
|
3229
3234
|
children: [
|
|
3230
|
-
/* @__PURE__ */ e(ct, { currencyCode:
|
|
3231
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children:
|
|
3235
|
+
/* @__PURE__ */ e(ct, { currencyCode: ae, size: 16, baseUrl: X }),
|
|
3236
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children: ae }),
|
|
3232
3237
|
/* @__PURE__ */ e(Pe, {})
|
|
3233
3238
|
]
|
|
3234
3239
|
}
|
|
@@ -3236,7 +3241,7 @@ function rn({
|
|
|
3236
3241
|
/* @__PURE__ */ o(
|
|
3237
3242
|
"button",
|
|
3238
3243
|
{
|
|
3239
|
-
onClick: () =>
|
|
3244
|
+
onClick: () => G("crypto"),
|
|
3240
3245
|
className: "flex items-center gap-1.5 transition-colors",
|
|
3241
3246
|
style: {
|
|
3242
3247
|
background: "var(--t-pill-bg)",
|
|
@@ -3245,20 +3250,20 @@ function rn({
|
|
|
3245
3250
|
paddingLeft: 10,
|
|
3246
3251
|
paddingRight: 10
|
|
3247
3252
|
},
|
|
3248
|
-
disabled: !!((At =
|
|
3253
|
+
disabled: !!((At = D == null ? void 0 : D.destinationCurrency) != null && At.locked),
|
|
3249
3254
|
children: [
|
|
3250
|
-
/* @__PURE__ */ e(Ht, { ticker:
|
|
3251
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children:
|
|
3255
|
+
/* @__PURE__ */ e(Ht, { ticker: _, size: 16, baseUrl: X }),
|
|
3256
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children: _ }),
|
|
3252
3257
|
/* @__PURE__ */ e(Pe, {})
|
|
3253
3258
|
]
|
|
3254
3259
|
}
|
|
3255
3260
|
),
|
|
3256
|
-
|
|
3261
|
+
ce && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 mt-1.5 mr-0.5", children: [
|
|
3257
3262
|
/* @__PURE__ */ e("div", { className: "rounded-full", style: { width: 14, height: 14, background: "#ffffff" }, children: /* @__PURE__ */ e(
|
|
3258
3263
|
"img",
|
|
3259
3264
|
{
|
|
3260
|
-
src: it(
|
|
3261
|
-
alt:
|
|
3265
|
+
src: it(ce, X),
|
|
3266
|
+
alt: ce,
|
|
3262
3267
|
width: 14,
|
|
3263
3268
|
height: 14,
|
|
3264
3269
|
className: "rounded-full",
|
|
@@ -3272,7 +3277,7 @@ function rn({
|
|
|
3272
3277
|
]
|
|
3273
3278
|
}
|
|
3274
3279
|
),
|
|
3275
|
-
|
|
3280
|
+
ge && pt && /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5 px-[2px]", style: { color: "#EF4444" }, children: de || (ft ? "Amount should be more than 0" : M ? `Minimum amount is ${Bt} ${ae}` : `Minimum amount is ${Ot} ${_}`) }),
|
|
3276
3281
|
/* @__PURE__ */ o(
|
|
3277
3282
|
"div",
|
|
3278
3283
|
{
|
|
@@ -3289,7 +3294,7 @@ function rn({
|
|
|
3289
3294
|
children: [
|
|
3290
3295
|
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "You get" }),
|
|
3291
3296
|
/* @__PURE__ */ o("div", { className: "flex items-start justify-between", children: [
|
|
3292
|
-
|
|
3297
|
+
v && !y ? /* @__PURE__ */ e(V, { w: 180, h: 32 }) : /* @__PURE__ */ e(
|
|
3293
3298
|
Wa,
|
|
3294
3299
|
{
|
|
3295
3300
|
value: z > 0 ? zt : "0",
|
|
@@ -3298,11 +3303,11 @@ function rn({
|
|
|
3298
3303
|
style: { color: z > 0 ? "var(--t-text)" : "var(--t-text-muted)", fontSize: 24 }
|
|
3299
3304
|
}
|
|
3300
3305
|
),
|
|
3301
|
-
|
|
3306
|
+
M ? /* @__PURE__ */ o("div", { className: "flex flex-col items-end shrink-0", children: [
|
|
3302
3307
|
/* @__PURE__ */ o(
|
|
3303
3308
|
"button",
|
|
3304
3309
|
{
|
|
3305
|
-
onClick: () =>
|
|
3310
|
+
onClick: () => G("crypto"),
|
|
3306
3311
|
className: "flex items-center gap-1.5 transition-colors",
|
|
3307
3312
|
style: {
|
|
3308
3313
|
background: "var(--t-pill-bg)",
|
|
@@ -3311,20 +3316,20 @@ function rn({
|
|
|
3311
3316
|
paddingLeft: 10,
|
|
3312
3317
|
paddingRight: 10
|
|
3313
3318
|
},
|
|
3314
|
-
disabled: !!((Rt =
|
|
3319
|
+
disabled: !!((Rt = D == null ? void 0 : D.destinationCurrency) != null && Rt.locked),
|
|
3315
3320
|
children: [
|
|
3316
|
-
/* @__PURE__ */ e(Ht, { ticker:
|
|
3317
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children:
|
|
3321
|
+
/* @__PURE__ */ e(Ht, { ticker: _, size: 16, baseUrl: X }),
|
|
3322
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children: _ }),
|
|
3318
3323
|
/* @__PURE__ */ e(Pe, {})
|
|
3319
3324
|
]
|
|
3320
3325
|
}
|
|
3321
3326
|
),
|
|
3322
|
-
|
|
3327
|
+
ce && /* @__PURE__ */ o("div", { className: "flex items-center gap-1 mt-1.5 mr-0.5", children: [
|
|
3323
3328
|
/* @__PURE__ */ e("div", { className: "rounded-full", style: { width: 14, height: 14, background: "#ffffff" }, children: /* @__PURE__ */ e(
|
|
3324
3329
|
"img",
|
|
3325
3330
|
{
|
|
3326
|
-
src: it(
|
|
3327
|
-
alt:
|
|
3331
|
+
src: it(ce, X),
|
|
3332
|
+
alt: ce,
|
|
3328
3333
|
width: 14,
|
|
3329
3334
|
height: 14,
|
|
3330
3335
|
className: "rounded-full",
|
|
@@ -3336,7 +3341,7 @@ function rn({
|
|
|
3336
3341
|
] }) : /* @__PURE__ */ o(
|
|
3337
3342
|
"button",
|
|
3338
3343
|
{
|
|
3339
|
-
onClick: () =>
|
|
3344
|
+
onClick: () => G("fiat"),
|
|
3340
3345
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
3341
3346
|
style: {
|
|
3342
3347
|
background: "var(--t-pill-bg)",
|
|
@@ -3345,10 +3350,10 @@ function rn({
|
|
|
3345
3350
|
paddingLeft: 10,
|
|
3346
3351
|
paddingRight: 10
|
|
3347
3352
|
},
|
|
3348
|
-
disabled: !!((Tt =
|
|
3353
|
+
disabled: !!((Tt = D == null ? void 0 : D.sourceCurrency) != null && Tt.locked),
|
|
3349
3354
|
children: [
|
|
3350
|
-
/* @__PURE__ */ e(ct, { currencyCode:
|
|
3351
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children:
|
|
3355
|
+
/* @__PURE__ */ e(ct, { currencyCode: ae, size: 16, baseUrl: X }),
|
|
3356
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Xe }, children: ae }),
|
|
3352
3357
|
/* @__PURE__ */ e(Pe, {})
|
|
3353
3358
|
]
|
|
3354
3359
|
}
|
|
@@ -3357,7 +3362,7 @@ function rn({
|
|
|
3357
3362
|
]
|
|
3358
3363
|
}
|
|
3359
3364
|
),
|
|
3360
|
-
Be && z > 0 && (
|
|
3365
|
+
Be && z > 0 && (N == null ? void 0 : N.bestQuote) && /* @__PURE__ */ o(
|
|
3361
3366
|
"div",
|
|
3362
3367
|
{
|
|
3363
3368
|
className: "flex items-start gap-2 mt-[2px] px-[14px] py-[10px]",
|
|
@@ -3371,11 +3376,11 @@ function rn({
|
|
|
3371
3376
|
"You will be charged for ",
|
|
3372
3377
|
ut,
|
|
3373
3378
|
" ",
|
|
3374
|
-
|
|
3379
|
+
_,
|
|
3375
3380
|
", the rest up to ",
|
|
3376
3381
|
lt(z),
|
|
3377
3382
|
" ",
|
|
3378
|
-
|
|
3383
|
+
ae,
|
|
3379
3384
|
" will be credited to your ",
|
|
3380
3385
|
$,
|
|
3381
3386
|
" account"
|
|
@@ -3389,38 +3394,38 @@ function rn({
|
|
|
3389
3394
|
className: "flex items-center justify-between mt-[2px] px-[18px] pt-[12px] pb-[14px]",
|
|
3390
3395
|
style: {
|
|
3391
3396
|
background: "var(--t-surface)",
|
|
3392
|
-
...(kt =
|
|
3397
|
+
...(kt = i == null ? void 0 : i.paymentMethods) != null && kt.length ? {} : { borderBottomLeftRadius: 5, borderBottomRightRadius: 5 }
|
|
3393
3398
|
},
|
|
3394
|
-
children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color:
|
|
3399
|
+
children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: C ? "var(--t-success)" : "var(--t-text-secondary)" }, children: Jt || " " })
|
|
3395
3400
|
}
|
|
3396
3401
|
),
|
|
3397
|
-
(
|
|
3402
|
+
(i == null ? void 0 : i.paymentMethods) && i.paymentMethods.length > 0 && /* @__PURE__ */ e("div", { className: "mt-[2px]", children: /* @__PURE__ */ e(
|
|
3398
3403
|
Pa,
|
|
3399
3404
|
{
|
|
3400
|
-
methods:
|
|
3401
|
-
selectedId:
|
|
3402
|
-
onOpenModal: () =>
|
|
3403
|
-
fiatCurrency:
|
|
3405
|
+
methods: i.paymentMethods,
|
|
3406
|
+
selectedId: x.paymentMethodId,
|
|
3407
|
+
onOpenModal: () => G("payment"),
|
|
3408
|
+
fiatCurrency: x.fiatCurrency
|
|
3404
3409
|
}
|
|
3405
3410
|
) }),
|
|
3406
3411
|
/* @__PURE__ */ o("div", { className: "mt-8", children: [
|
|
3407
|
-
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children:
|
|
3412
|
+
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: M ? "Receiving wallet address" : "Sending wallet address" }),
|
|
3408
3413
|
/* @__PURE__ */ e(
|
|
3409
3414
|
"input",
|
|
3410
3415
|
{
|
|
3411
3416
|
type: "text",
|
|
3412
|
-
value:
|
|
3413
|
-
onChange: (
|
|
3414
|
-
onFocus: () =>
|
|
3417
|
+
value: x.walletAddress,
|
|
3418
|
+
onChange: (g) => k({ type: "SET_WALLET_ADDRESS", address: g.target.value }),
|
|
3419
|
+
onFocus: () => Ee(!0),
|
|
3415
3420
|
onBlur: () => {
|
|
3416
|
-
|
|
3421
|
+
Ee(!1), te(!0);
|
|
3417
3422
|
},
|
|
3418
|
-
placeholder:
|
|
3423
|
+
placeholder: M ? "Enter your receiving address" : "Enter your sending address",
|
|
3419
3424
|
spellCheck: !1,
|
|
3420
3425
|
autoComplete: "off",
|
|
3421
3426
|
className: "w-full bg-transparent text-[13px] outline-none transition-colors",
|
|
3422
3427
|
style: {
|
|
3423
|
-
border:
|
|
3428
|
+
border: x.walletError || _e && !tt ? "1px solid #EF4444" : ze ? "1px solid var(--t-border-focus)" : "1px solid var(--t-border)",
|
|
3424
3429
|
outline: "none",
|
|
3425
3430
|
boxShadow: "none",
|
|
3426
3431
|
borderRadius: 3.5,
|
|
@@ -3430,16 +3435,16 @@ function rn({
|
|
|
3430
3435
|
fontSize: 13,
|
|
3431
3436
|
backgroundColor: "transparent"
|
|
3432
3437
|
},
|
|
3433
|
-
disabled: !!((Lt =
|
|
3438
|
+
disabled: !!((Lt = D == null ? void 0 : D.destinationAddress) != null && Lt.locked)
|
|
3434
3439
|
}
|
|
3435
3440
|
),
|
|
3436
|
-
|
|
3441
|
+
x.walletError ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: x.walletError }) : _e && !tt && !we ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: "Enter a valid wallet address" }) : we && x.walletAddress.trim().length >= 10 ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "var(--t-text-muted)" }, children: "Validating address..." }) : null
|
|
3437
3442
|
] }),
|
|
3438
3443
|
/* @__PURE__ */ e("div", { className: "flex-1", style: { minHeight: 16 } }),
|
|
3439
3444
|
/* @__PURE__ */ e(
|
|
3440
3445
|
"button",
|
|
3441
3446
|
{
|
|
3442
|
-
disabled: !Ge ||
|
|
3447
|
+
disabled: !Ge || le || y,
|
|
3443
3448
|
onClick: la,
|
|
3444
3449
|
className: "w-full font-semibold text-[16px] transition-all",
|
|
3445
3450
|
style: {
|
|
@@ -3447,92 +3452,92 @@ function rn({
|
|
|
3447
3452
|
borderRadius: 5,
|
|
3448
3453
|
background: "var(--t-cta-bg)",
|
|
3449
3454
|
color: "var(--t-cta-text)",
|
|
3450
|
-
opacity: Ge && !
|
|
3451
|
-
cursor: Ge && !
|
|
3455
|
+
opacity: Ge && !le && !y ? 1 : 0.4,
|
|
3456
|
+
cursor: Ge && !le && !y ? "pointer" : "not-allowed"
|
|
3452
3457
|
},
|
|
3453
|
-
children:
|
|
3458
|
+
children: y ? "Getting best price..." : le ? "Processing..." : M ? `Buy ${_}` : `Sell ${_}`
|
|
3454
3459
|
}
|
|
3455
3460
|
),
|
|
3456
3461
|
/* @__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" }) })
|
|
3457
|
-
] },
|
|
3458
|
-
/* @__PURE__ */ e(He, { isOpen:
|
|
3459
|
-
var
|
|
3462
|
+
] }, K),
|
|
3463
|
+
/* @__PURE__ */ e(He, { isOpen: oe === "fiat", onClose: () => G(null), children: (g) => {
|
|
3464
|
+
var E;
|
|
3460
3465
|
return /* @__PURE__ */ e(
|
|
3461
3466
|
Za,
|
|
3462
3467
|
{
|
|
3463
|
-
onClose:
|
|
3468
|
+
onClose: g,
|
|
3464
3469
|
onSelect: (T) => {
|
|
3465
|
-
ta(T),
|
|
3470
|
+
ta(T), g();
|
|
3466
3471
|
},
|
|
3467
|
-
currencies: (
|
|
3468
|
-
assetBaseUrl:
|
|
3469
|
-
selectedCode:
|
|
3472
|
+
currencies: (E = i == null ? void 0 : i.fiats) == null ? void 0 : E.map((T) => ({ code: T.code, name: T.code })),
|
|
3473
|
+
assetBaseUrl: X,
|
|
3474
|
+
selectedCode: x.fiatCurrency
|
|
3470
3475
|
}
|
|
3471
3476
|
);
|
|
3472
3477
|
} }),
|
|
3473
|
-
/* @__PURE__ */ e(He, { isOpen:
|
|
3474
|
-
var
|
|
3478
|
+
/* @__PURE__ */ e(He, { isOpen: oe === "crypto", onClose: () => G(null), children: (g) => {
|
|
3479
|
+
var E;
|
|
3475
3480
|
return /* @__PURE__ */ e(
|
|
3476
3481
|
Qa,
|
|
3477
3482
|
{
|
|
3478
|
-
onClose:
|
|
3479
|
-
onSelect: (T,
|
|
3480
|
-
aa(T,
|
|
3483
|
+
onClose: g,
|
|
3484
|
+
onSelect: (T, H) => {
|
|
3485
|
+
aa(T, H), g();
|
|
3481
3486
|
},
|
|
3482
|
-
cryptos: (
|
|
3483
|
-
var
|
|
3487
|
+
cryptos: (E = i == null ? void 0 : i.cryptos) == null ? void 0 : E.map((T) => {
|
|
3488
|
+
var H;
|
|
3484
3489
|
return {
|
|
3485
3490
|
code: T.code,
|
|
3486
3491
|
name: T.code,
|
|
3487
|
-
networks: (
|
|
3492
|
+
networks: (H = T.networks) == null ? void 0 : H.map((ie) => ({ code: ie.id, name: ie.name }))
|
|
3488
3493
|
};
|
|
3489
3494
|
}),
|
|
3490
|
-
assetBaseUrl:
|
|
3491
|
-
selectedCode:
|
|
3492
|
-
selectedChain:
|
|
3495
|
+
assetBaseUrl: X,
|
|
3496
|
+
selectedCode: x.cryptoCurrency,
|
|
3497
|
+
selectedChain: x.network
|
|
3493
3498
|
}
|
|
3494
3499
|
);
|
|
3495
3500
|
} }),
|
|
3496
|
-
/* @__PURE__ */ e(He, { isOpen:
|
|
3497
|
-
var
|
|
3501
|
+
/* @__PURE__ */ e(He, { isOpen: oe === "payment", onClose: () => G(null), children: (g) => {
|
|
3502
|
+
var E;
|
|
3498
3503
|
return /* @__PURE__ */ e(
|
|
3499
3504
|
za,
|
|
3500
3505
|
{
|
|
3501
|
-
methods: ((
|
|
3502
|
-
selectedId:
|
|
3506
|
+
methods: ((E = i == null ? void 0 : i.paymentMethods) == null ? void 0 : E.filter((T) => T.supportedFiats.includes(x.fiatCurrency))) || [],
|
|
3507
|
+
selectedId: x.paymentMethodId,
|
|
3503
3508
|
onSelect: (T) => {
|
|
3504
|
-
na(T),
|
|
3509
|
+
na(T), g();
|
|
3505
3510
|
},
|
|
3506
|
-
onClose:
|
|
3511
|
+
onClose: g
|
|
3507
3512
|
}
|
|
3508
3513
|
);
|
|
3509
3514
|
} }),
|
|
3510
|
-
/* @__PURE__ */ e(He, { isOpen:
|
|
3515
|
+
/* @__PURE__ */ e(He, { isOpen: oe === "settings", onClose: () => G(null), children: (g) => /* @__PURE__ */ e(
|
|
3511
3516
|
en,
|
|
3512
3517
|
{
|
|
3513
|
-
onClose:
|
|
3514
|
-
darkMode:
|
|
3515
|
-
onToggleDarkMode:
|
|
3516
|
-
skinId:
|
|
3517
|
-
onSelectSkin: (
|
|
3518
|
-
|
|
3518
|
+
onClose: g,
|
|
3519
|
+
darkMode: Q,
|
|
3520
|
+
onToggleDarkMode: be,
|
|
3521
|
+
skinId: Ne,
|
|
3522
|
+
onSelectSkin: (E) => {
|
|
3523
|
+
Ue(E);
|
|
3519
3524
|
},
|
|
3520
3525
|
showThemeToggle: R,
|
|
3521
|
-
country:
|
|
3526
|
+
country: x.country,
|
|
3522
3527
|
countryName: ia,
|
|
3523
3528
|
onLocationPress: oa,
|
|
3524
|
-
assetBaseUrl:
|
|
3529
|
+
assetBaseUrl: X
|
|
3525
3530
|
}
|
|
3526
3531
|
) }),
|
|
3527
|
-
/* @__PURE__ */ e(He, { isOpen:
|
|
3532
|
+
/* @__PURE__ */ e(He, { isOpen: oe === "country", onClose: () => G(null), children: (g) => /* @__PURE__ */ e(
|
|
3528
3533
|
an,
|
|
3529
3534
|
{
|
|
3530
|
-
onClose:
|
|
3531
|
-
onSelect: (
|
|
3532
|
-
ra(
|
|
3535
|
+
onClose: g,
|
|
3536
|
+
onSelect: (E) => {
|
|
3537
|
+
ra(E), g();
|
|
3533
3538
|
},
|
|
3534
|
-
assetBaseUrl:
|
|
3535
|
-
selectedCode:
|
|
3539
|
+
assetBaseUrl: X,
|
|
3540
|
+
selectedCode: x.country
|
|
3536
3541
|
}
|
|
3537
3542
|
) })
|
|
3538
3543
|
]
|
|
@@ -3544,44 +3549,44 @@ function on({
|
|
|
3544
3549
|
apiUrl: a,
|
|
3545
3550
|
assetBaseUrl: n,
|
|
3546
3551
|
flowType: r,
|
|
3547
|
-
customerId:
|
|
3552
|
+
customerId: l,
|
|
3548
3553
|
brandId: c,
|
|
3549
3554
|
defaultFiatCurrency: m,
|
|
3550
3555
|
defaultCryptoCurrency: s,
|
|
3551
|
-
defaultNetwork:
|
|
3556
|
+
defaultNetwork: u,
|
|
3552
3557
|
defaultFiatAmount: f,
|
|
3553
3558
|
defaultCryptoAmount: h,
|
|
3554
|
-
defaultWalletAddress:
|
|
3559
|
+
defaultWalletAddress: d,
|
|
3555
3560
|
defaultGateway: p,
|
|
3556
|
-
defaultCountry:
|
|
3561
|
+
defaultCountry: C,
|
|
3557
3562
|
fieldLocks: A,
|
|
3558
|
-
statusPollInterval:
|
|
3563
|
+
statusPollInterval: w,
|
|
3559
3564
|
onComplete: R,
|
|
3560
|
-
onError:
|
|
3561
|
-
className:
|
|
3562
|
-
theme:
|
|
3565
|
+
onError: P,
|
|
3566
|
+
className: re,
|
|
3567
|
+
theme: j,
|
|
3563
3568
|
skinId: Z,
|
|
3564
3569
|
accentColor: q,
|
|
3565
3570
|
bgColor: $,
|
|
3566
|
-
bgImage:
|
|
3567
|
-
borderColor:
|
|
3568
|
-
borderRadius:
|
|
3569
|
-
surfaceColor:
|
|
3570
|
-
inputBgColor:
|
|
3571
|
-
textColor:
|
|
3572
|
-
textSecondaryColor:
|
|
3573
|
-
textMutedColor:
|
|
3574
|
-
successColor:
|
|
3575
|
-
showFlowToggle:
|
|
3576
|
-
showSettings:
|
|
3577
|
-
showThemeToggle:
|
|
3578
|
-
autoRedirect:
|
|
3579
|
-
explorerUrl:
|
|
3580
|
-
doneButtonText:
|
|
3581
|
-
supportEmail:
|
|
3582
|
-
stablecoinParity:
|
|
3583
|
-
partnerName:
|
|
3584
|
-
onDone:
|
|
3571
|
+
bgImage: he,
|
|
3572
|
+
borderColor: x,
|
|
3573
|
+
borderRadius: k,
|
|
3574
|
+
surfaceColor: i,
|
|
3575
|
+
inputBgColor: I,
|
|
3576
|
+
textColor: N,
|
|
3577
|
+
textSecondaryColor: v,
|
|
3578
|
+
textMutedColor: pe,
|
|
3579
|
+
successColor: ye,
|
|
3580
|
+
showFlowToggle: xe,
|
|
3581
|
+
showSettings: le,
|
|
3582
|
+
showThemeToggle: de,
|
|
3583
|
+
autoRedirect: D,
|
|
3584
|
+
explorerUrl: ee,
|
|
3585
|
+
doneButtonText: X,
|
|
3586
|
+
supportEmail: Q,
|
|
3587
|
+
stablecoinParity: be,
|
|
3588
|
+
partnerName: Ne,
|
|
3589
|
+
onDone: Ue
|
|
3585
3590
|
}) {
|
|
3586
3591
|
return /* @__PURE__ */ e(
|
|
3587
3592
|
Ca,
|
|
@@ -3590,47 +3595,47 @@ function on({
|
|
|
3590
3595
|
apiUrl: a,
|
|
3591
3596
|
assetBaseUrl: n,
|
|
3592
3597
|
flowType: r,
|
|
3593
|
-
customerId:
|
|
3598
|
+
customerId: l,
|
|
3594
3599
|
brandId: c,
|
|
3595
3600
|
defaultFiatCurrency: m,
|
|
3596
3601
|
defaultCryptoCurrency: s,
|
|
3597
|
-
defaultNetwork:
|
|
3602
|
+
defaultNetwork: u,
|
|
3598
3603
|
defaultFiatAmount: f,
|
|
3599
3604
|
defaultCryptoAmount: h,
|
|
3600
|
-
defaultWalletAddress:
|
|
3605
|
+
defaultWalletAddress: d,
|
|
3601
3606
|
defaultGateway: p,
|
|
3602
|
-
defaultCountry:
|
|
3607
|
+
defaultCountry: C,
|
|
3603
3608
|
fieldLocks: A,
|
|
3604
|
-
statusPollInterval:
|
|
3609
|
+
statusPollInterval: w,
|
|
3605
3610
|
onComplete: R,
|
|
3606
|
-
onError:
|
|
3611
|
+
onError: P,
|
|
3607
3612
|
children: /* @__PURE__ */ e(
|
|
3608
3613
|
rn,
|
|
3609
3614
|
{
|
|
3610
|
-
className:
|
|
3611
|
-
theme:
|
|
3615
|
+
className: re,
|
|
3616
|
+
theme: j,
|
|
3612
3617
|
skinId: Z,
|
|
3613
3618
|
accentColor: q,
|
|
3614
3619
|
bgColor: $,
|
|
3615
|
-
bgImage:
|
|
3616
|
-
borderColor:
|
|
3617
|
-
borderRadius:
|
|
3618
|
-
surfaceColor:
|
|
3619
|
-
inputBgColor:
|
|
3620
|
-
textColor:
|
|
3621
|
-
textSecondaryColor:
|
|
3622
|
-
textMutedColor:
|
|
3623
|
-
successColor:
|
|
3624
|
-
showFlowToggle:
|
|
3625
|
-
showSettings:
|
|
3626
|
-
showThemeToggle:
|
|
3627
|
-
autoRedirect:
|
|
3628
|
-
explorerUrl:
|
|
3629
|
-
doneButtonText:
|
|
3630
|
-
supportEmail:
|
|
3631
|
-
stablecoinParity:
|
|
3632
|
-
partnerName:
|
|
3633
|
-
onDone:
|
|
3620
|
+
bgImage: he,
|
|
3621
|
+
borderColor: x,
|
|
3622
|
+
borderRadius: k,
|
|
3623
|
+
surfaceColor: i,
|
|
3624
|
+
inputBgColor: I,
|
|
3625
|
+
textColor: N,
|
|
3626
|
+
textSecondaryColor: v,
|
|
3627
|
+
textMutedColor: pe,
|
|
3628
|
+
successColor: ye,
|
|
3629
|
+
showFlowToggle: xe,
|
|
3630
|
+
showSettings: le,
|
|
3631
|
+
showThemeToggle: de,
|
|
3632
|
+
autoRedirect: D,
|
|
3633
|
+
explorerUrl: ee,
|
|
3634
|
+
doneButtonText: X,
|
|
3635
|
+
supportEmail: Q,
|
|
3636
|
+
stablecoinParity: be,
|
|
3637
|
+
partnerName: Ne,
|
|
3638
|
+
onDone: Ue
|
|
3634
3639
|
}
|
|
3635
3640
|
)
|
|
3636
3641
|
}
|
|
@@ -3648,7 +3653,7 @@ function xn({
|
|
|
3648
3653
|
active: a,
|
|
3649
3654
|
onClick: n,
|
|
3650
3655
|
darkMode: r,
|
|
3651
|
-
dimmed:
|
|
3656
|
+
dimmed: l
|
|
3652
3657
|
}) {
|
|
3653
3658
|
const c = t.accent === null, m = 32;
|
|
3654
3659
|
return /* @__PURE__ */ o(
|
|
@@ -3656,7 +3661,7 @@ function xn({
|
|
|
3656
3661
|
{
|
|
3657
3662
|
onClick: n,
|
|
3658
3663
|
className: "relative shrink-0",
|
|
3659
|
-
style: { width: m, height: m, opacity:
|
|
3664
|
+
style: { width: m, height: m, opacity: l ? 0.4 : 1, transition: "opacity 0.2s" },
|
|
3660
3665
|
children: [
|
|
3661
3666
|
c ? /* @__PURE__ */ o("svg", { width: m, height: m, viewBox: "0 0 32 32", children: [
|
|
3662
3667
|
/* @__PURE__ */ e("clipPath", { id: "mono-left", children: /* @__PURE__ */ e("rect", { x: "0", y: "0", width: "16", height: "32" }) }),
|
|
@@ -3665,7 +3670,7 @@ function xn({
|
|
|
3665
3670
|
/* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: "#ffffff", clipPath: "url(#mono-right)" }),
|
|
3666
3671
|
/* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: "none", stroke: r ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.1)", strokeWidth: "1" })
|
|
3667
3672
|
] }) : /* @__PURE__ */ e("svg", { width: m, height: m, viewBox: "0 0 32 32", children: /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: t.accent }) }),
|
|
3668
|
-
a && !
|
|
3673
|
+
a && !l && /* @__PURE__ */ e(
|
|
3669
3674
|
"div",
|
|
3670
3675
|
{
|
|
3671
3676
|
className: "absolute inset-0 rounded-full",
|
|
@@ -3708,14 +3713,14 @@ function sn() {
|
|
|
3708
3713
|
background: "var(--t-surface)"
|
|
3709
3714
|
},
|
|
3710
3715
|
children: [
|
|
3711
|
-
/* @__PURE__ */ e(
|
|
3716
|
+
/* @__PURE__ */ e(V, { w: 36, h: 36, className: "rounded-full shrink-0" }),
|
|
3712
3717
|
/* @__PURE__ */ o("div", { className: "flex-1", children: [
|
|
3713
|
-
/* @__PURE__ */ e(
|
|
3714
|
-
/* @__PURE__ */ e(
|
|
3718
|
+
/* @__PURE__ */ e(V, { w: 90, h: 14, className: "mb-1.5" }),
|
|
3719
|
+
/* @__PURE__ */ e(V, { w: 60, h: 12 })
|
|
3715
3720
|
] }),
|
|
3716
3721
|
/* @__PURE__ */ o("div", { className: "text-right", children: [
|
|
3717
|
-
/* @__PURE__ */ e(
|
|
3718
|
-
/* @__PURE__ */ e(
|
|
3722
|
+
/* @__PURE__ */ e(V, { w: 40, h: 10, className: "mb-1.5" }),
|
|
3723
|
+
/* @__PURE__ */ e(V, { w: 80, h: 14 })
|
|
3719
3724
|
] })
|
|
3720
3725
|
]
|
|
3721
3726
|
},
|
|
@@ -3727,15 +3732,15 @@ function gn({
|
|
|
3727
3732
|
onSelect: a,
|
|
3728
3733
|
quotes: n,
|
|
3729
3734
|
quotesLoading: r,
|
|
3730
|
-
cryptoCurrency:
|
|
3735
|
+
cryptoCurrency: l
|
|
3731
3736
|
}) {
|
|
3732
|
-
const [c, m] =
|
|
3737
|
+
const [c, m] = S(""), s = Y(() => {
|
|
3733
3738
|
if (!(n != null && n.quotes)) return [];
|
|
3734
|
-
const
|
|
3735
|
-
return
|
|
3739
|
+
const u = c.trim().toLowerCase();
|
|
3740
|
+
return u ? n.quotes.filter((f) => f.gatewayName.toLowerCase().includes(u)) : n.quotes;
|
|
3736
3741
|
}, [n, c]);
|
|
3737
3742
|
return /* @__PURE__ */ o(J, { children: [
|
|
3738
|
-
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(
|
|
3743
|
+
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
3739
3744
|
/* @__PURE__ */ e(
|
|
3740
3745
|
"h2",
|
|
3741
3746
|
{
|
|
@@ -3746,12 +3751,12 @@ function gn({
|
|
|
3746
3751
|
),
|
|
3747
3752
|
/* @__PURE__ */ e(Ke, { value: c, onChange: m }),
|
|
3748
3753
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5 space-y-2", children: [
|
|
3749
|
-
r ? /* @__PURE__ */ e(sn, {}) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: n && n.quotes.length === 0 ? "No quotes available for this request" : "No providers found" }) : s.map((
|
|
3750
|
-
const h = f === 0,
|
|
3754
|
+
r ? /* @__PURE__ */ e(sn, {}) : s.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: n && n.quotes.length === 0 ? "No quotes available for this request" : "No providers found" }) : s.map((u, f) => {
|
|
3755
|
+
const h = f === 0, d = parseFloat(u.cryptoAmount), p = d >= 1 ? d.toFixed(4) : d.toPrecision(6);
|
|
3751
3756
|
return /* @__PURE__ */ o(
|
|
3752
3757
|
"button",
|
|
3753
3758
|
{
|
|
3754
|
-
onClick: () => a(
|
|
3759
|
+
onClick: () => a(u),
|
|
3755
3760
|
className: "w-full flex items-center gap-3.5 transition-colors",
|
|
3756
3761
|
style: {
|
|
3757
3762
|
borderRadius: h ? 4.5 : 5,
|
|
@@ -3762,35 +3767,35 @@ function gn({
|
|
|
3762
3767
|
background: h ? "transparent" : "var(--t-surface)"
|
|
3763
3768
|
},
|
|
3764
3769
|
children: [
|
|
3765
|
-
/* @__PURE__ */ e(cn, { quote:
|
|
3770
|
+
/* @__PURE__ */ e(cn, { quote: u }),
|
|
3766
3771
|
/* @__PURE__ */ o("div", { className: "text-left flex-1 min-w-0", children: [
|
|
3767
|
-
/* @__PURE__ */ e("div", { className: "font-medium text-[15px]", style: { color: "var(--t-text)" }, children:
|
|
3768
|
-
/* @__PURE__ */ e(ln, { quote:
|
|
3772
|
+
/* @__PURE__ */ e("div", { className: "font-medium text-[15px]", style: { color: "var(--t-text)" }, children: u.gatewayName }),
|
|
3773
|
+
/* @__PURE__ */ e(ln, { quote: u })
|
|
3769
3774
|
] }),
|
|
3770
3775
|
/* @__PURE__ */ o("div", { className: "text-right shrink-0", children: [
|
|
3771
3776
|
/* @__PURE__ */ e("div", { className: "text-[11px]", style: { color: "var(--t-text-secondary)" }, children: "You get" }),
|
|
3772
3777
|
/* @__PURE__ */ o("div", { className: "font-medium text-[14px]", style: { color: "var(--t-text)" }, children: [
|
|
3773
|
-
|
|
3778
|
+
l,
|
|
3774
3779
|
" ",
|
|
3775
3780
|
p
|
|
3776
3781
|
] })
|
|
3777
3782
|
] })
|
|
3778
3783
|
]
|
|
3779
3784
|
},
|
|
3780
|
-
|
|
3785
|
+
u.gatewayId
|
|
3781
3786
|
);
|
|
3782
3787
|
}),
|
|
3783
|
-
!r && (n == null ? void 0 : n.unavailableGateways) && n.unavailableGateways.length > 0 && /* @__PURE__ */ e("div", { className: "pt-3", children: n.unavailableGateways.map((
|
|
3788
|
+
!r && (n == null ? void 0 : n.unavailableGateways) && n.unavailableGateways.length > 0 && /* @__PURE__ */ e("div", { className: "pt-3", children: n.unavailableGateways.map((u) => /* @__PURE__ */ o(
|
|
3784
3789
|
"div",
|
|
3785
3790
|
{
|
|
3786
3791
|
className: "flex items-center justify-between py-2 text-[12px]",
|
|
3787
3792
|
style: { color: "var(--t-text-muted)" },
|
|
3788
3793
|
children: [
|
|
3789
|
-
/* @__PURE__ */ e("span", { children:
|
|
3790
|
-
/* @__PURE__ */ e("span", { children:
|
|
3794
|
+
/* @__PURE__ */ e("span", { children: u.gatewayName }),
|
|
3795
|
+
/* @__PURE__ */ e("span", { children: u.reason })
|
|
3791
3796
|
]
|
|
3792
3797
|
},
|
|
3793
|
-
|
|
3798
|
+
u.gatewayId
|
|
3794
3799
|
)) })
|
|
3795
3800
|
] })
|
|
3796
3801
|
] });
|
|
@@ -3811,7 +3816,7 @@ export {
|
|
|
3811
3816
|
Pe as ChevronDown,
|
|
3812
3817
|
Pt as ChevronRight,
|
|
3813
3818
|
gn as ChooseRampModal,
|
|
3814
|
-
|
|
3819
|
+
Le as CloseButton,
|
|
3815
3820
|
pn as CoinifyIcon,
|
|
3816
3821
|
ja as CompleteStep,
|
|
3817
3822
|
$a as ConfirmStep,
|
|
@@ -3839,7 +3844,7 @@ export {
|
|
|
3839
3844
|
Mt as SKINS,
|
|
3840
3845
|
Ke as SearchInput,
|
|
3841
3846
|
en as SettingsScreen,
|
|
3842
|
-
|
|
3847
|
+
V as Skeleton,
|
|
3843
3848
|
xn as SkinSwatch,
|
|
3844
3849
|
Ja as ToggleSwitch,
|
|
3845
3850
|
lt as formatOutput,
|
|
@@ -3853,7 +3858,7 @@ export {
|
|
|
3853
3858
|
Ea as parseAmount,
|
|
3854
3859
|
ya as useCheckoutIntent,
|
|
3855
3860
|
pa as useQuotes,
|
|
3856
|
-
|
|
3861
|
+
ke as useRamp,
|
|
3857
3862
|
ha as useRampConfig,
|
|
3858
3863
|
xa as useTransaction
|
|
3859
3864
|
};
|