@nowramp/form 0.2.0 → 0.2.1
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 +272 -260
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +7 -7
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
document.head.appendChild(s);
|
|
10
10
|
})();
|
|
11
11
|
import { jsx as e, jsxs as i, Fragment as Z } from "react/jsx-runtime";
|
|
12
|
-
import ke, { useState as w, useRef as
|
|
12
|
+
import ke, { useState as w, useRef as M, useCallback as O, useEffect as U, useMemo as W, useReducer as an, useContext as ga, createContext as xa } from "react";
|
|
13
13
|
import { RampApi as gt } from "@nowramp/sdk";
|
|
14
14
|
import { createPortal as oa } from "react-dom";
|
|
15
15
|
function nn(t, a, n) {
|
|
16
|
-
const [r, o] = w(null), [c, u] = w(!0), [l, d] = w(null), s =
|
|
16
|
+
const [r, o] = w(null), [c, u] = w(!0), [l, d] = w(null), s = M(null);
|
|
17
17
|
(!s.current || s.current !== t) && (s.current = new gt({ apiKey: "", ...t }));
|
|
18
18
|
const h = O(async () => {
|
|
19
19
|
if (!t.projectId) {
|
|
@@ -32,15 +32,15 @@ function nn(t, a, n) {
|
|
|
32
32
|
u(!1);
|
|
33
33
|
}
|
|
34
34
|
}, [t.projectId, a, n]);
|
|
35
|
-
return
|
|
35
|
+
return U(() => {
|
|
36
36
|
h();
|
|
37
37
|
}, [h]), { config: r, loading: c, error: l, refetch: h };
|
|
38
38
|
}
|
|
39
39
|
function rn(t, a) {
|
|
40
|
-
const [n, r] = w(null), [o, c] = w(!1), [u, l] = w(null), d =
|
|
40
|
+
const [n, r] = w(null), [o, c] = w(!1), [u, l] = w(null), d = M(null), s = M(""), h = `${t.apiUrl}|${t.projectId}`;
|
|
41
41
|
(!d.current || s.current !== h) && (d.current = new gt({ apiKey: "", ...t }), s.current = h);
|
|
42
|
-
const p =
|
|
43
|
-
|
|
42
|
+
const p = M(0);
|
|
43
|
+
U(() => {
|
|
44
44
|
const g = ++p.current;
|
|
45
45
|
if (!a || !t.projectId) {
|
|
46
46
|
r(null), c(!1);
|
|
@@ -71,7 +71,7 @@ function rn(t, a) {
|
|
|
71
71
|
return { quotes: n, loading: o, error: u, refetch: f };
|
|
72
72
|
}
|
|
73
73
|
function on(t) {
|
|
74
|
-
const [a, n] = w(null), [r, o] = w(!1), [c, u] = w(null), l =
|
|
74
|
+
const [a, n] = w(null), [r, o] = w(!1), [c, u] = w(null), l = M(null), d = M(""), s = `${t.apiUrl}|${t.projectId}`;
|
|
75
75
|
(!l.current || d.current !== s) && (l.current = new gt({ apiKey: "", ...t }), d.current = s);
|
|
76
76
|
const h = O(async (f) => {
|
|
77
77
|
o(!0), u(null);
|
|
@@ -90,7 +90,7 @@ function on(t) {
|
|
|
90
90
|
return { order: a, loading: r, error: c, createOrder: h, reset: p };
|
|
91
91
|
}
|
|
92
92
|
function ln(t, a, n) {
|
|
93
|
-
const [r, o] = w(null), [c, u] = w(!1), [l, d] = w(null), s =
|
|
93
|
+
const [r, o] = w(null), [c, u] = w(!1), [l, d] = w(null), s = M(null);
|
|
94
94
|
s.current || (s.current = new gt({ apiKey: "", projectId: "", ...t }));
|
|
95
95
|
const h = O(async () => {
|
|
96
96
|
if (a) {
|
|
@@ -105,7 +105,7 @@ function ln(t, a, n) {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}, [a]);
|
|
108
|
-
return
|
|
108
|
+
return U(() => {
|
|
109
109
|
if (!a) return;
|
|
110
110
|
const p = (n == null ? void 0 : n.initialDelay) ?? 0;
|
|
111
111
|
if (p > 0) {
|
|
@@ -113,7 +113,7 @@ function ln(t, a, n) {
|
|
|
113
113
|
return () => clearTimeout(f);
|
|
114
114
|
}
|
|
115
115
|
h();
|
|
116
|
-
}, [h, a, n == null ? void 0 : n.initialDelay]),
|
|
116
|
+
}, [h, a, n == null ? void 0 : n.initialDelay]), U(() => {
|
|
117
117
|
if (!a || !(n != null && n.pollInterval) || !r || ["completed", "failed", "cancelled", "expired", "refunded"].includes(r.status))
|
|
118
118
|
return;
|
|
119
119
|
const f = setInterval(h, n.pollInterval);
|
|
@@ -495,6 +495,12 @@ function gn(t, a) {
|
|
|
495
495
|
selectedQuote: a.quote,
|
|
496
496
|
selectedProvider: a.quote.gatewayId
|
|
497
497
|
};
|
|
498
|
+
case "CLEAR_QUOTE":
|
|
499
|
+
return {
|
|
500
|
+
...t,
|
|
501
|
+
selectedQuote: null,
|
|
502
|
+
selectedProvider: null
|
|
503
|
+
};
|
|
498
504
|
case "SET_CUSTOMER_ID":
|
|
499
505
|
return { ...t, customerId: a.customerId };
|
|
500
506
|
case "SET_EMAIL":
|
|
@@ -515,7 +521,7 @@ function gn(t, a) {
|
|
|
515
521
|
}
|
|
516
522
|
const Ca = xa(null);
|
|
517
523
|
function xn(t) {
|
|
518
|
-
const a =
|
|
524
|
+
const a = M(t.defaultFiatCurrency !== void 0), {
|
|
519
525
|
projectId: n,
|
|
520
526
|
apiUrl: r = "https://api.nowramp.com",
|
|
521
527
|
assetBaseUrl: o = "",
|
|
@@ -533,16 +539,16 @@ function xn(t) {
|
|
|
533
539
|
fieldLocks: y,
|
|
534
540
|
partnerMetadata: E,
|
|
535
541
|
statusPollInterval: K = 5e3,
|
|
536
|
-
onComplete:
|
|
542
|
+
onComplete: te,
|
|
537
543
|
onError: z,
|
|
538
544
|
children: ie
|
|
539
|
-
} = t, J = W(() => ({ apiUrl: r, projectId: n }), [r, n]),
|
|
545
|
+
} = t, J = W(() => ({ apiUrl: r, projectId: n }), [r, n]), ee = h || (s === "BTC" ? "bitcoin" : s ? s.toLowerCase() : ""), be = c === "sell", ae = be ? !!f : !!p, C = (be ? !!(ae && s && ee) : !!(ae && s && ee && g)) && k ? "confirm" : "amount", F = p || (c === "buy" ? "250" : ""), [m, D] = an(gn, {
|
|
540
546
|
...va,
|
|
541
547
|
step: C,
|
|
542
548
|
flowType: c,
|
|
543
549
|
fiatCurrency: d,
|
|
544
550
|
cryptoCurrency: s,
|
|
545
|
-
network:
|
|
551
|
+
network: ee,
|
|
546
552
|
fiatAmount: ia(F, 2),
|
|
547
553
|
cryptoAmount: ia(f, 6),
|
|
548
554
|
walletAddress: g,
|
|
@@ -550,81 +556,81 @@ function xn(t) {
|
|
|
550
556
|
// If defaultCountry is provided, set it immediately with 'manual' source to skip auto-detection
|
|
551
557
|
...R ? { country: R.toLowerCase(), countrySource: "manual" } : {}
|
|
552
558
|
}), N = m.flowType === "sell", {
|
|
553
|
-
config:
|
|
554
|
-
loading:
|
|
559
|
+
config: b,
|
|
560
|
+
loading: ne,
|
|
555
561
|
error: pe
|
|
556
|
-
} = nn(J, m.flowType, m.country || void 0),
|
|
562
|
+
} = nn(J, m.flowType, m.country || void 0), Se = M(!1);
|
|
557
563
|
ke.useEffect(() => {
|
|
558
|
-
var
|
|
559
|
-
if (
|
|
560
|
-
|
|
561
|
-
const v =
|
|
562
|
-
|
|
563
|
-
const A = (
|
|
564
|
-
|
|
565
|
-
}, [
|
|
566
|
-
const Te =
|
|
564
|
+
var B, I;
|
|
565
|
+
if (Se.current || !(b != null && b.detectedCountry) || m.country) return;
|
|
566
|
+
Se.current = !0;
|
|
567
|
+
const v = b.detectedCountry.toLowerCase();
|
|
568
|
+
D({ type: "SET_COUNTRY_AUTO", country: v });
|
|
569
|
+
const A = (B = b.fiats) == null ? void 0 : B.map((_) => _.code), T = Mt(v, A);
|
|
570
|
+
T !== m.fiatCurrency && !((I = y == null ? void 0 : y.sourceCurrency) != null && I.locked) && !a.current && D({ type: "SET_FIAT_CURRENCY", currency: T });
|
|
571
|
+
}, [b, m.country, m.fiatCurrency, y]);
|
|
572
|
+
const Te = M(!1);
|
|
567
573
|
ke.useEffect(() => {
|
|
568
|
-
var
|
|
569
|
-
if (Te.current || !R || !((
|
|
574
|
+
var T, B;
|
|
575
|
+
if (Te.current || !R || !((T = b == null ? void 0 : b.fiats) != null && T.length)) return;
|
|
570
576
|
Te.current = !0;
|
|
571
|
-
const v =
|
|
572
|
-
A !== m.fiatCurrency && !((
|
|
573
|
-
}, [R,
|
|
574
|
-
const he =
|
|
577
|
+
const v = b.fiats.map((I) => I.code), A = Mt(R, v);
|
|
578
|
+
A !== m.fiatCurrency && !((B = y == null ? void 0 : y.sourceCurrency) != null && B.locked) && !a.current && D({ type: "SET_FIAT_CURRENCY", currency: A });
|
|
579
|
+
}, [R, b, m.fiatCurrency, y]);
|
|
580
|
+
const he = M(m.country);
|
|
575
581
|
ke.useEffect(() => {
|
|
576
|
-
var
|
|
577
|
-
if (m.country === he.current || (he.current = m.country, m.countrySource === "manual" && (_e.current = !1), m.countrySource !== "manual") || !((
|
|
578
|
-
const v =
|
|
579
|
-
A !== m.fiatCurrency && !((
|
|
580
|
-
}, [m.country, m.countrySource,
|
|
581
|
-
const le =
|
|
582
|
+
var T, B;
|
|
583
|
+
if (m.country === he.current || (he.current = m.country, m.countrySource === "manual" && (_e.current = !1), m.countrySource !== "manual") || !((T = b == null ? void 0 : b.fiats) != null && T.length)) return;
|
|
584
|
+
const v = b.fiats.map((I) => I.code), A = Mt(m.country, v);
|
|
585
|
+
A !== m.fiatCurrency && !((B = y == null ? void 0 : y.sourceCurrency) != null && B.locked) && D({ type: "SET_FIAT_CURRENCY", currency: A });
|
|
586
|
+
}, [m.country, m.countrySource, b, m.fiatCurrency, y]);
|
|
587
|
+
const le = M(m.fiatCurrency);
|
|
582
588
|
ke.useEffect(() => {
|
|
583
|
-
var
|
|
584
|
-
if (m.fiatCurrency === le.current || (le.current = m.fiatCurrency, N || !((
|
|
585
|
-
const v =
|
|
589
|
+
var B;
|
|
590
|
+
if (m.fiatCurrency === le.current || (le.current = m.fiatCurrency, N || !((B = b == null ? void 0 : b.fiats) != null && B.length) || !m.fiatAmount)) return;
|
|
591
|
+
const v = b.fiats.find((I) => I.code === m.fiatCurrency);
|
|
586
592
|
if (!(v != null && v.minAmount)) return;
|
|
587
|
-
const A = parseFloat(m.fiatAmount),
|
|
588
|
-
!isNaN(A) && !isNaN(
|
|
589
|
-
}, [m.fiatCurrency, m.fiatAmount,
|
|
593
|
+
const A = parseFloat(m.fiatAmount), T = parseFloat(v.minAmount);
|
|
594
|
+
!isNaN(A) && !isNaN(T) && A < T && D({ type: "SET_FIAT_AMOUNT", amount: String(Math.ceil(T)) });
|
|
595
|
+
}, [m.fiatCurrency, m.fiatAmount, b, N]);
|
|
590
596
|
const { availableFiats: ce, availableCryptos: X, availablePaymentMethods: fe } = W(() => {
|
|
591
|
-
var
|
|
592
|
-
if (!
|
|
597
|
+
var T, B, I;
|
|
598
|
+
if (!b)
|
|
593
599
|
return { availableFiats: [], availableCryptos: [], availablePaymentMethods: [] };
|
|
594
600
|
let v;
|
|
595
601
|
if (m.cryptoCurrency && m.network) {
|
|
596
|
-
const _ = (
|
|
602
|
+
const _ = (T = b.cryptos) == null ? void 0 : T.find((ge) => ge.code === m.cryptoCurrency), ue = (B = _ == null ? void 0 : _.networks) == null ? void 0 : B.find((ge) => ge.id === m.network);
|
|
597
603
|
!_ || !ue ? v = [] : v = ue.providers;
|
|
598
604
|
}
|
|
599
605
|
let A;
|
|
600
606
|
if (m.fiatCurrency) {
|
|
601
|
-
const _ = (
|
|
607
|
+
const _ = (I = b.fiats) == null ? void 0 : I.find((ue) => ue.code === m.fiatCurrency);
|
|
602
608
|
_ ? A = _.providers : A = [];
|
|
603
609
|
}
|
|
604
610
|
return {
|
|
605
|
-
availableFiats: cn(
|
|
606
|
-
availableCryptos: sn(
|
|
611
|
+
availableFiats: cn(b.fiats ?? [], v),
|
|
612
|
+
availableCryptos: sn(b.cryptos ?? [], A),
|
|
607
613
|
availablePaymentMethods: dn(
|
|
608
|
-
|
|
614
|
+
b.paymentMethods ?? [],
|
|
609
615
|
v,
|
|
610
616
|
m.fiatCurrency
|
|
611
617
|
)
|
|
612
618
|
};
|
|
613
|
-
}, [
|
|
614
|
-
var v, A,
|
|
615
|
-
return
|
|
616
|
-
|
|
619
|
+
}, [b, m.cryptoCurrency, m.network, m.fiatCurrency]), Qe = W(() => {
|
|
620
|
+
var v, A, T;
|
|
621
|
+
return ne || !b ? !1 : mn(
|
|
622
|
+
b,
|
|
617
623
|
{ cryptoCurrency: m.cryptoCurrency, network: m.network, fiatCurrency: m.fiatCurrency },
|
|
618
624
|
{
|
|
619
625
|
cryptoLocked: !!((v = y == null ? void 0 : y.destinationCurrency) != null && v.locked),
|
|
620
626
|
networkLocked: !!((A = y == null ? void 0 : y.network) != null && A.locked),
|
|
621
|
-
fiatLocked: !!((
|
|
627
|
+
fiatLocked: !!((T = y == null ? void 0 : y.sourceCurrency) != null && T.locked)
|
|
622
628
|
},
|
|
623
629
|
{ availableFiats: ce, availableCryptos: X, availablePaymentMethods: fe }
|
|
624
630
|
);
|
|
625
631
|
}, [
|
|
626
|
-
|
|
627
|
-
|
|
632
|
+
ne,
|
|
633
|
+
b,
|
|
628
634
|
y,
|
|
629
635
|
m.cryptoCurrency,
|
|
630
636
|
m.network,
|
|
@@ -634,8 +640,8 @@ function xn(t) {
|
|
|
634
640
|
fe
|
|
635
641
|
]);
|
|
636
642
|
ke.useEffect(() => {
|
|
637
|
-
var A,
|
|
638
|
-
if (
|
|
643
|
+
var A, T, B;
|
|
644
|
+
if (ne || ce.length === 0 && X.length === 0) return;
|
|
639
645
|
const v = un(
|
|
640
646
|
{
|
|
641
647
|
cryptoCurrency: m.cryptoCurrency,
|
|
@@ -646,13 +652,13 @@ function xn(t) {
|
|
|
646
652
|
{ availableFiats: ce, availableCryptos: X, availablePaymentMethods: fe },
|
|
647
653
|
{
|
|
648
654
|
cryptoLocked: !!((A = y == null ? void 0 : y.destinationCurrency) != null && A.locked),
|
|
649
|
-
networkLocked: !!((
|
|
650
|
-
fiatLocked: !!((
|
|
655
|
+
networkLocked: !!((T = y == null ? void 0 : y.network) != null && T.locked),
|
|
656
|
+
fiatLocked: !!((B = y == null ? void 0 : y.sourceCurrency) != null && B.locked)
|
|
651
657
|
}
|
|
652
658
|
);
|
|
653
|
-
v && (v.cryptoCurrency !== void 0 &&
|
|
659
|
+
v && (v.cryptoCurrency !== void 0 && D({ type: "SET_CRYPTO_CURRENCY", currency: v.cryptoCurrency }), v.network !== void 0 && D({ type: "SET_NETWORK", network: v.network }), v.fiatCurrency !== void 0 && D({ type: "SET_FIAT_CURRENCY", currency: v.fiatCurrency }), v.paymentMethodId !== void 0 && D({ type: "SET_PAYMENT_METHOD", methodId: v.paymentMethodId }));
|
|
654
660
|
}, [
|
|
655
|
-
|
|
661
|
+
ne,
|
|
656
662
|
ce,
|
|
657
663
|
X,
|
|
658
664
|
fe,
|
|
@@ -661,24 +667,24 @@ function xn(t) {
|
|
|
661
667
|
m.fiatCurrency,
|
|
662
668
|
m.paymentMethodId,
|
|
663
669
|
y,
|
|
664
|
-
|
|
670
|
+
D
|
|
665
671
|
]);
|
|
666
|
-
const
|
|
672
|
+
const oe = W(() => {
|
|
667
673
|
if (N) {
|
|
668
674
|
if (!m.cryptoAmount) return null;
|
|
669
|
-
const
|
|
670
|
-
return isNaN(
|
|
675
|
+
const I = parseFloat(m.cryptoAmount);
|
|
676
|
+
return isNaN(I) || I <= 0 ? "Enter a valid amount" : null;
|
|
671
677
|
}
|
|
672
|
-
if (!
|
|
678
|
+
if (!b || !m.fiatAmount) return null;
|
|
673
679
|
const v = parseFloat(m.fiatAmount);
|
|
674
680
|
if (isNaN(v)) return null;
|
|
675
|
-
const A =
|
|
681
|
+
const A = b.fiats.find((I) => I.code === m.fiatCurrency);
|
|
676
682
|
if (!A) return null;
|
|
677
|
-
const
|
|
678
|
-
return !isNaN(
|
|
679
|
-
}, [
|
|
683
|
+
const T = parseFloat(A.minAmount), B = parseFloat(A.maxAmount);
|
|
684
|
+
return !isNaN(T) && v < T ? `Minimum amount is ${A.minAmount} ${m.fiatCurrency}` : !isNaN(B) && v > B ? `Maximum amount is ${A.maxAmount} ${m.fiatCurrency}` : null;
|
|
685
|
+
}, [b, m.fiatAmount, m.fiatCurrency, m.cryptoAmount, N]), ye = W(() => {
|
|
680
686
|
const v = N ? !!m.cryptoAmount : !!m.fiatAmount;
|
|
681
|
-
return !
|
|
687
|
+
return !b || !v || !m.fiatCurrency || !m.cryptoCurrency || !m.network || oe || b.detectedCountry && m.countrySource === "" && !R ? null : {
|
|
682
688
|
fiatCurrency: m.fiatCurrency,
|
|
683
689
|
...N ? { cryptoAmount: m.cryptoAmount } : { fiatAmount: m.fiatAmount },
|
|
684
690
|
cryptoCurrency: m.cryptoCurrency,
|
|
@@ -687,15 +693,15 @@ function xn(t) {
|
|
|
687
693
|
country: m.country || void 0,
|
|
688
694
|
orderType: m.flowType
|
|
689
695
|
};
|
|
690
|
-
}, [
|
|
696
|
+
}, [b, m.fiatCurrency, m.fiatAmount, m.cryptoAmount, m.cryptoCurrency, m.network, m.paymentMethodId, m.country, m.countrySource, oe, N, m.flowType, R]), {
|
|
691
697
|
quotes: G,
|
|
692
698
|
loading: Ke,
|
|
693
699
|
error: ze,
|
|
694
700
|
refetch: vt
|
|
695
|
-
} = rn(J, ye), se = pn(Ke, G, ye), _e =
|
|
701
|
+
} = rn(J, ye), se = pn(Ke, G, ye), _e = M(!1);
|
|
696
702
|
ke.useEffect(() => {
|
|
697
703
|
var v;
|
|
698
|
-
_e.current || m.countrySource === "auto" && ((v = y == null ? void 0 : y.sourceCurrency) != null && v.locked || a.current || Ke || !ye || ze || !G || G.bestQuote || m.fiatCurrency !== "USD" && (_e.current = !0,
|
|
704
|
+
_e.current || m.countrySource === "auto" && ((v = y == null ? void 0 : y.sourceCurrency) != null && v.locked || a.current || Ke || !ye || ze || !G || G.bestQuote || m.fiatCurrency !== "USD" && (_e.current = !0, D({ type: "SET_FIAT_CURRENCY", currency: "USD" }), D({ type: "SET_FIAT_AMOUNT", amount: "250" })));
|
|
699
705
|
}, [G, Ke, ze, ye, m.countrySource, m.fiatCurrency]);
|
|
700
706
|
const {
|
|
701
707
|
order: Le,
|
|
@@ -709,29 +715,29 @@ function xn(t) {
|
|
|
709
715
|
{ apiUrl: r },
|
|
710
716
|
(Le == null ? void 0 : Le.orderId) ?? null,
|
|
711
717
|
{ pollInterval: K, initialDelay: lt }
|
|
712
|
-
), Je =
|
|
718
|
+
), Je = M(null);
|
|
713
719
|
ke.useEffect(() => {
|
|
714
|
-
!($ != null && $.status) || !
|
|
715
|
-
}, [$ == null ? void 0 : $.status, $ == null ? void 0 : $.orderId,
|
|
720
|
+
!($ != null && $.status) || !te || yn.includes($.status) && Je.current !== $.orderId && (Je.current = $.orderId, te($));
|
|
721
|
+
}, [$ == null ? void 0 : $.status, $ == null ? void 0 : $.orderId, te]), ke.useEffect(() => {
|
|
716
722
|
const v = pe || de;
|
|
717
723
|
v && z && z(v);
|
|
718
724
|
}, [pe, de, z]);
|
|
719
|
-
const Fe = k || (
|
|
725
|
+
const Fe = k || (b == null ? void 0 : b.defaultGateway) || null, ct = W(() => {
|
|
720
726
|
if (!se || !(G != null && G.unavailableGateways)) return null;
|
|
721
727
|
const v = G.preferredGatewayId || Fe;
|
|
722
728
|
return hn(G.unavailableGateways, v);
|
|
723
|
-
}, [se, G, Fe]), je =
|
|
729
|
+
}, [se, G, Fe]), je = M(Fe);
|
|
724
730
|
je.current = Fe;
|
|
725
|
-
const qe =
|
|
731
|
+
const qe = M(G);
|
|
726
732
|
qe.current = G;
|
|
727
|
-
const et =
|
|
733
|
+
const et = M(l);
|
|
728
734
|
et.current = l;
|
|
729
735
|
const Ue = O(async () => {
|
|
730
|
-
var A,
|
|
731
|
-
const v = ((A = m.selectedQuote) == null ? void 0 : A.gatewayId) || ((
|
|
736
|
+
var A, T, B;
|
|
737
|
+
const v = ((A = m.selectedQuote) == null ? void 0 : A.gatewayId) || ((B = (T = qe.current) == null ? void 0 : T.bestQuote) == null ? void 0 : B.gatewayId) || je.current;
|
|
732
738
|
if (!v || !m.walletAddress) {
|
|
733
|
-
const
|
|
734
|
-
|
|
739
|
+
const I = [!v && "gateway", !m.walletAddress && "walletAddress"].filter(Boolean).join(", ");
|
|
740
|
+
D({ type: "SET_ERROR", message: `Missing required fields: ${I}` });
|
|
735
741
|
return;
|
|
736
742
|
}
|
|
737
743
|
try {
|
|
@@ -748,23 +754,23 @@ function xn(t) {
|
|
|
748
754
|
orderType: m.flowType,
|
|
749
755
|
...et.current ? { metadata: { brand: et.current } } : {},
|
|
750
756
|
...E && Object.keys(E).length > 0 ? { partnerMetadata: E } : {}
|
|
751
|
-
}),
|
|
752
|
-
} catch (
|
|
753
|
-
const _ =
|
|
754
|
-
/wallet|address/i.test(_) ?
|
|
757
|
+
}), D({ type: "SET_STEP", step: "checkout" });
|
|
758
|
+
} catch (I) {
|
|
759
|
+
const _ = I instanceof Error ? I.message : "Failed to create order";
|
|
760
|
+
/wallet|address/i.test(_) ? D({ type: "SET_WALLET_ERROR", message: _.replace(/^Failed to create checkout intent:\s*/i, "") }) : D({ type: "SET_ERROR", message: _ });
|
|
755
761
|
}
|
|
756
762
|
}, [m, j, N, E]), tt = O((v) => {
|
|
757
|
-
|
|
763
|
+
D({ type: "SET_STEP", step: v });
|
|
758
764
|
}, []), St = O(() => {
|
|
759
765
|
const v = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], A = v.indexOf(m.step);
|
|
760
|
-
A > 0 &&
|
|
766
|
+
A > 0 && D({ type: "SET_STEP", step: v[A - 1] });
|
|
761
767
|
}, [m.step, N]), wt = W(() => {
|
|
762
768
|
const v = N ? !!m.cryptoAmount : !!m.fiatAmount;
|
|
763
769
|
switch (m.step) {
|
|
764
770
|
case "confirm":
|
|
765
|
-
return !!(v && m.cryptoCurrency && m.network && m.walletAddress && !
|
|
771
|
+
return !!(v && m.cryptoCurrency && m.network && m.walletAddress && !oe);
|
|
766
772
|
case "amount":
|
|
767
|
-
return !!(v && m.cryptoCurrency && m.network && !
|
|
773
|
+
return !!(v && m.cryptoCurrency && m.network && !oe);
|
|
768
774
|
case "quotes":
|
|
769
775
|
return !!m.selectedQuote;
|
|
770
776
|
case "wallet":
|
|
@@ -772,14 +778,14 @@ function xn(t) {
|
|
|
772
778
|
default:
|
|
773
779
|
return !1;
|
|
774
780
|
}
|
|
775
|
-
}, [m,
|
|
781
|
+
}, [m, oe, N]), st = {
|
|
776
782
|
apiConfig: J,
|
|
777
783
|
assetBaseUrl: o,
|
|
778
|
-
config:
|
|
779
|
-
configLoading:
|
|
784
|
+
config: b,
|
|
785
|
+
configLoading: ne,
|
|
780
786
|
configError: pe,
|
|
781
787
|
state: m,
|
|
782
|
-
dispatch:
|
|
788
|
+
dispatch: D,
|
|
783
789
|
quotes: G,
|
|
784
790
|
quotesLoading: Ke,
|
|
785
791
|
quotesError: ze,
|
|
@@ -798,7 +804,7 @@ function xn(t) {
|
|
|
798
804
|
selectionUnsupported: Qe,
|
|
799
805
|
quotesEmpty: se,
|
|
800
806
|
bestUnavailableReason: ct,
|
|
801
|
-
amountError:
|
|
807
|
+
amountError: oe,
|
|
802
808
|
goToStep: tt,
|
|
803
809
|
goBack: St,
|
|
804
810
|
canProceed: wt
|
|
@@ -1100,7 +1106,7 @@ function vn({
|
|
|
1100
1106
|
children: a
|
|
1101
1107
|
}) {
|
|
1102
1108
|
const [n, r] = w(t), [o, c] = w(Be[t] || it);
|
|
1103
|
-
|
|
1109
|
+
U(() => {
|
|
1104
1110
|
if (r(t), Be[t])
|
|
1105
1111
|
c(Be[t]);
|
|
1106
1112
|
else {
|
|
@@ -1239,7 +1245,7 @@ function bn({
|
|
|
1239
1245
|
}) {
|
|
1240
1246
|
var g;
|
|
1241
1247
|
const { order: r, orderStatus: o, goToStep: c, goBack: u } = Xe(), l = P(), [d, s] = w(!1), [h, p] = w(null), f = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
|
|
1242
|
-
if (
|
|
1248
|
+
if (U(() => {
|
|
1243
1249
|
if ((r == null ? void 0 : r.checkout.method) === "redirect" && a && !f) {
|
|
1244
1250
|
p(Math.ceil(n / 1e3));
|
|
1245
1251
|
const k = setTimeout(() => {
|
|
@@ -1251,7 +1257,7 @@ function bn({
|
|
|
1251
1257
|
clearTimeout(k), clearInterval(R);
|
|
1252
1258
|
};
|
|
1253
1259
|
}
|
|
1254
|
-
}, [r, a, n, f]),
|
|
1260
|
+
}, [r, a, n, f]), U(() => {
|
|
1255
1261
|
o && (o.status === "completed" ? c("complete") : ["failed", "cancelled", "expired"].includes(o.status) && c("error"));
|
|
1256
1262
|
}, [o == null ? void 0 : o.status, c]), !r)
|
|
1257
1263
|
return /* @__PURE__ */ i(
|
|
@@ -1535,7 +1541,7 @@ function Sn(t, a) {
|
|
|
1535
1541
|
}
|
|
1536
1542
|
function wn({ className: t = "" }) {
|
|
1537
1543
|
const { orderStatus: a, orderStatusLoading: n, goToStep: r } = Xe(), o = P();
|
|
1538
|
-
|
|
1544
|
+
U(() => {
|
|
1539
1545
|
a && (a.status === "completed" ? r("complete") : ["failed", "cancelled", "expired", "refunded"].includes(a.status) && r("error"));
|
|
1540
1546
|
}, [a == null ? void 0 : a.status, r]);
|
|
1541
1547
|
const c = () => {
|
|
@@ -2333,7 +2339,7 @@ function Bt(t) {
|
|
|
2333
2339
|
const a = t.toPrecision(4);
|
|
2334
2340
|
return parseFloat(a).toString();
|
|
2335
2341
|
}
|
|
2336
|
-
const
|
|
2342
|
+
const Ce = (t) => /^#([0-9A-Fa-f]{3}){1,2}$/.test(t), ua = 10, ma = 1e-4, Fn = (() => {
|
|
2337
2343
|
const t = [];
|
|
2338
2344
|
for (const a of wa)
|
|
2339
2345
|
for (const n of a.chains)
|
|
@@ -2354,13 +2360,13 @@ function Un({ className: t = "", stablecoinParity: a, partnerName: n }) {
|
|
|
2354
2360
|
fetchQuotes: d,
|
|
2355
2361
|
createOrder: s,
|
|
2356
2362
|
orderLoading: h
|
|
2357
|
-
} = Xe(), p = P(), f = c.flowType === "sell", [g, k] = w(null), R = r == null ? void 0 : r.gateways.find((
|
|
2363
|
+
} = Xe(), p = P(), f = c.flowType === "sell", [g, k] = w(null), R = r == null ? void 0 : r.gateways.find((ee) => ee.id === u), y = (J = l == null ? void 0 : l.bestQuote) != null && J.exchangeRate ? parseFloat(l.bestQuote.exchangeRate) : null, E = parseFloat(c.fiatAmount) || 0, K = !!(a && n && !f && Ea(c.cryptoCurrency) && y), te = K && c.cryptoCurrency.toUpperCase().includes(c.fiatCurrency.toUpperCase()), z = K && E > 0 ? Bt(te ? E : E / y) : null, ie = async () => {
|
|
2358
2364
|
k(null);
|
|
2359
2365
|
try {
|
|
2360
2366
|
d(), await s();
|
|
2361
|
-
} catch (
|
|
2362
|
-
const
|
|
2363
|
-
k(
|
|
2367
|
+
} catch (ee) {
|
|
2368
|
+
const be = ee instanceof Error ? ee.message : p("error.createOrderFailed");
|
|
2369
|
+
k(be);
|
|
2364
2370
|
}
|
|
2365
2371
|
};
|
|
2366
2372
|
return o ? /* @__PURE__ */ i("div", { className: `flex flex-col items-center justify-center p-12 ${t}`, children: [
|
|
@@ -2430,7 +2436,7 @@ function Pe({
|
|
|
2430
2436
|
variant: r = "bottom"
|
|
2431
2437
|
}) {
|
|
2432
2438
|
const [o, c] = w(!1), [u, l] = w(!1);
|
|
2433
|
-
|
|
2439
|
+
U(() => {
|
|
2434
2440
|
if (t)
|
|
2435
2441
|
c(!0), requestAnimationFrame(() => requestAnimationFrame(() => l(!0)));
|
|
2436
2442
|
else if (o) {
|
|
@@ -2442,7 +2448,7 @@ function Pe({
|
|
|
2442
2448
|
const d = O(() => {
|
|
2443
2449
|
l(!1), setTimeout(() => a(), 250);
|
|
2444
2450
|
}, [a]);
|
|
2445
|
-
return
|
|
2451
|
+
return U(() => {
|
|
2446
2452
|
if (!t) return;
|
|
2447
2453
|
const p = (f) => {
|
|
2448
2454
|
f.key === "Escape" && d();
|
|
@@ -2508,7 +2514,7 @@ function Ra({
|
|
|
2508
2514
|
className: r = "",
|
|
2509
2515
|
background: o
|
|
2510
2516
|
}) {
|
|
2511
|
-
const [c, u] = w(!1), [l, d] = w(!1), s =
|
|
2517
|
+
const [c, u] = w(!1), [l, d] = w(!1), s = M(t);
|
|
2512
2518
|
s.current !== t && (s.current = t, u(!1), d(!1));
|
|
2513
2519
|
const h = O(() => u(!0), []), p = O(() => d(!0), []);
|
|
2514
2520
|
return /* @__PURE__ */ i(
|
|
@@ -2920,9 +2926,9 @@ function $n({ type: t, title: a, description: n, visible: r, onDismiss: o }) {
|
|
|
2920
2926
|
u(!1), d(!1), o();
|
|
2921
2927
|
}, 200);
|
|
2922
2928
|
}, [o]);
|
|
2923
|
-
return
|
|
2929
|
+
return U(() => {
|
|
2924
2930
|
r && (u(!0), d(!1));
|
|
2925
|
-
}, [r]),
|
|
2931
|
+
}, [r]), U(() => {
|
|
2926
2932
|
if (!r || !c) return;
|
|
2927
2933
|
const p = setTimeout(s, 5e3);
|
|
2928
2934
|
return () => clearTimeout(p);
|
|
@@ -3149,7 +3155,7 @@ function Qn({
|
|
|
3149
3155
|
}
|
|
3150
3156
|
const ha = ["BTC", "ETH", "SOL"];
|
|
3151
3157
|
function fa({ src: t, alt: a, size: n, className: r, style: o }) {
|
|
3152
|
-
const [c, u] = w(!1), [l, d] = w(!1), s =
|
|
3158
|
+
const [c, u] = w(!1), [l, d] = w(!1), s = M(t);
|
|
3153
3159
|
s.current !== t && (s.current = t, u(!1), d(!1));
|
|
3154
3160
|
const h = O(() => u(!0), []), p = O(() => d(!0), []);
|
|
3155
3161
|
return /* @__PURE__ */ i("div", { className: r, style: { ...o, width: n, height: n, position: "relative" }, children: [
|
|
@@ -3218,10 +3224,10 @@ function zn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
|
|
|
3218
3224
|
}
|
|
3219
3225
|
const g = f.split(/\s+/), k = [];
|
|
3220
3226
|
for (const y of s) {
|
|
3221
|
-
const E = yt(y.chain), K = E ? E.name.toLowerCase() : "",
|
|
3222
|
-
if (!g.every((
|
|
3223
|
-
let
|
|
3224
|
-
ie === f ?
|
|
3227
|
+
const E = yt(y.chain), K = E ? E.name.toLowerCase() : "", te = ((R = E == null ? void 0 : E.shortName) == null ? void 0 : R.toLowerCase()) || "", z = y.chain.toLowerCase(), ie = y.code.toLowerCase(), J = y.name.toLowerCase(), ee = [ie, J, K, te, z];
|
|
3228
|
+
if (!g.every((L) => ee.some((C) => C.includes(L)))) continue;
|
|
3229
|
+
let ae = 0;
|
|
3230
|
+
ie === f ? ae += 100 : ie.startsWith(g[0]) && (ae += 50), y.popular && (ae += 10), g.length > 1 && (K.includes(g[1]) || te.includes(g[1]) || z.includes(g[1])) && (ae += 25), k.push({ item: y, score: ae });
|
|
3225
3231
|
}
|
|
3226
3232
|
return k.sort((y, E) => E.score - y.score), k.map((y) => y.item);
|
|
3227
3233
|
}, [s, l, o, c]);
|
|
@@ -4364,8 +4370,8 @@ function wr({
|
|
|
4364
4370
|
onBlur: l,
|
|
4365
4371
|
focused: d
|
|
4366
4372
|
}) {
|
|
4367
|
-
const s = P(), h = o && t.trim().length >= 10, [p, f] = w(!1), g =
|
|
4368
|
-
return
|
|
4373
|
+
const s = P(), h = o && t.trim().length >= 10, [p, f] = w(!1), g = M(r);
|
|
4374
|
+
return U(() => {
|
|
4369
4375
|
if (r && !g.current) {
|
|
4370
4376
|
f(!0);
|
|
4371
4377
|
const k = setTimeout(() => f(!1), 400);
|
|
@@ -4596,25 +4602,25 @@ function Rr({
|
|
|
4596
4602
|
showThemeToggle: y = !0,
|
|
4597
4603
|
autoRedirect: E = !1,
|
|
4598
4604
|
explorerUrl: K,
|
|
4599
|
-
doneButtonText:
|
|
4605
|
+
doneButtonText: te,
|
|
4600
4606
|
supportEmail: z,
|
|
4601
4607
|
stablecoinParity: ie,
|
|
4602
4608
|
partnerName: J,
|
|
4603
|
-
containerHeight:
|
|
4604
|
-
locale:
|
|
4605
|
-
onDone:
|
|
4609
|
+
containerHeight: ee,
|
|
4610
|
+
locale: be,
|
|
4611
|
+
onDone: ae
|
|
4606
4612
|
}) {
|
|
4607
4613
|
var na, ra;
|
|
4608
|
-
const
|
|
4614
|
+
const L = P(), {
|
|
4609
4615
|
state: C,
|
|
4610
4616
|
dispatch: F,
|
|
4611
4617
|
config: m,
|
|
4612
|
-
configLoading:
|
|
4618
|
+
configLoading: D,
|
|
4613
4619
|
quotes: N,
|
|
4614
|
-
quotesLoading:
|
|
4615
|
-
quotesError:
|
|
4620
|
+
quotesLoading: b,
|
|
4621
|
+
quotesError: ne,
|
|
4616
4622
|
fetchQuotes: pe,
|
|
4617
|
-
createOrder:
|
|
4623
|
+
createOrder: Se,
|
|
4618
4624
|
orderLoading: Te,
|
|
4619
4625
|
amountError: he,
|
|
4620
4626
|
fieldLocks: le,
|
|
@@ -4622,21 +4628,23 @@ function Rr({
|
|
|
4622
4628
|
assetBaseUrl: X,
|
|
4623
4629
|
availableFiats: fe,
|
|
4624
4630
|
availableCryptos: Qe,
|
|
4625
|
-
availablePaymentMethods:
|
|
4631
|
+
availablePaymentMethods: oe,
|
|
4626
4632
|
selectionUnsupported: ye,
|
|
4627
4633
|
quotesEmpty: G,
|
|
4628
4634
|
bestUnavailableReason: Ke
|
|
4629
|
-
} = Xe(), { locale: ze, setLocale: vt } = _t(), [se, _e] = w(a === "dark"), [Le, Ct] = w(n), [de, j] = w(null), [lt, $] = w(!1), [bt, Je] = w(!1), [Fe, ct] = w(!1), [je, qe] = w(!1), [et, Ue] = w(null), [tt, St] = w(!0), [wt, st] = w(!1), [v, A] = w(!1), [
|
|
4630
|
-
|
|
4631
|
-
N && N !== Zt.current &&
|
|
4632
|
-
}, [N]),
|
|
4633
|
-
|
|
4634
|
-
}, [
|
|
4635
|
+
} = Xe(), { locale: ze, setLocale: vt } = _t(), [se, _e] = w(a === "dark"), [Le, Ct] = w(n), [de, j] = w(null), [lt, $] = w(!1), [bt, Je] = w(!1), [Fe, ct] = w(!1), [je, qe] = w(!1), [et, Ue] = w(null), [tt, St] = w(!0), [wt, st] = w(!1), [v, A] = w(!1), [T, B] = w(!1), [I, _] = w(null), [ue, ge] = w(!1), [La, kt] = w(30), [Fa, Gt] = w(!1), [Ua, $t] = w(!1), Ia = M(null), Nt = M(), Et = M(C.flowType), Ma = ee ?? 640, Zt = M(N);
|
|
4636
|
+
U(() => {
|
|
4637
|
+
N && N !== Zt.current && B(!1), Zt.current = N;
|
|
4638
|
+
}, [N]), U(() => {
|
|
4639
|
+
b && !T && F({ type: "CLEAR_QUOTE" });
|
|
4640
|
+
}, [b, T, F]), U(() => {
|
|
4641
|
+
T || v || N != null && N.bestQuote && F({ type: "SELECT_QUOTE", quote: N.bestQuote });
|
|
4642
|
+
}, [N == null ? void 0 : N.bestQuote, T, v, F]), U(() => {
|
|
4635
4643
|
_e(a === "dark");
|
|
4636
|
-
}, [a]),
|
|
4637
|
-
const x = setTimeout(() => St(!1),
|
|
4644
|
+
}, [a]), U(() => {
|
|
4645
|
+
const x = setTimeout(() => St(!1), D ? 0 : 800);
|
|
4638
4646
|
return () => clearTimeout(x);
|
|
4639
|
-
}, [
|
|
4647
|
+
}, [D]), U(() => {
|
|
4640
4648
|
if (Et.current !== C.flowType && !tt) {
|
|
4641
4649
|
Et.current = C.flowType, st(!0), $(!1), Je(!1);
|
|
4642
4650
|
const x = setTimeout(() => st(!1), 350);
|
|
@@ -4644,18 +4652,20 @@ function Rr({
|
|
|
4644
4652
|
}
|
|
4645
4653
|
Et.current = C.flowType;
|
|
4646
4654
|
}, [C.flowType, tt]);
|
|
4647
|
-
const dt = C.flowType, H = dt === "buy",
|
|
4648
|
-
we &&
|
|
4649
|
-
(G ||
|
|
4650
|
-
}, [G,
|
|
4655
|
+
const dt = C.flowType, H = dt === "buy", re = C.cryptoCurrency || "BTC", xe = C.fiatCurrency || "USD", Rt = H ? C.fiatAmount : C.cryptoAmount, q = Ln(Rt), ve = C.selectedQuote || (N == null ? void 0 : N.bestQuote) || null, we = ve != null && ve.exchangeRate ? parseFloat(ve.exchangeRate) : null, at = M(null);
|
|
4656
|
+
we && re && xe && (at.current = { rate: we, crypto: re, fiat: xe }), U(() => {
|
|
4657
|
+
(G || ne) && (at.current = null);
|
|
4658
|
+
}, [G, ne]), U(() => {
|
|
4659
|
+
q || (ge(!1), C.selectedQuote && F({ type: "CLEAR_QUOTE" }));
|
|
4660
|
+
}, [q, C.selectedQuote, F]);
|
|
4651
4661
|
const Ie = W(() => {
|
|
4652
|
-
if (
|
|
4653
|
-
const x = H ?
|
|
4662
|
+
if (ve) {
|
|
4663
|
+
const x = H ? ve.cryptoAmount : ve.fiatAmount;
|
|
4654
4664
|
if (x) return x;
|
|
4655
4665
|
}
|
|
4656
4666
|
return "0";
|
|
4657
|
-
}, [
|
|
4658
|
-
|
|
4667
|
+
}, [ve, H]), At = M(Ie);
|
|
4668
|
+
U(() => {
|
|
4659
4669
|
if (Ie !== At.current && Ie !== "0" && At.current !== "0") {
|
|
4660
4670
|
Gt(!0);
|
|
4661
4671
|
const x = setTimeout(() => Gt(!1), 500);
|
|
@@ -4663,13 +4673,13 @@ function Rr({
|
|
|
4663
4673
|
}
|
|
4664
4674
|
At.current = Ie;
|
|
4665
4675
|
}, [Ie]);
|
|
4666
|
-
const nt = !!(ie && J && H && Ea(
|
|
4676
|
+
const nt = !!(ie && J && H && Ea(re) && we), Da = nt && re.toUpperCase().includes(xe.toUpperCase()), Xt = nt && q > 0 ? Bt(Da ? q : q / we) : null, Ba = nt && Xt ? Xt : Ie, Ha = W(() => {
|
|
4667
4677
|
var Y, De, Ge;
|
|
4668
|
-
const x = we || ((Y = at.current) == null ? void 0 : Y.rate),
|
|
4669
|
-
return !x || !
|
|
4670
|
-
}, [
|
|
4671
|
-
|
|
4672
|
-
const x = C.walletAddress.trim(),
|
|
4678
|
+
const x = we || ((Y = at.current) == null ? void 0 : Y.rate), S = we ? re : (De = at.current) == null ? void 0 : De.crypto, V = we ? xe : (Ge = at.current) == null ? void 0 : Ge.fiat;
|
|
4679
|
+
return !x || !S || !V ? "" : `1 ${S} ≈ ${x.toFixed(2)} ${V}`;
|
|
4680
|
+
}, [re, xe, we]);
|
|
4681
|
+
U(() => {
|
|
4682
|
+
const x = C.walletAddress.trim(), S = C.network;
|
|
4673
4683
|
if (!x || x.length < 10) {
|
|
4674
4684
|
Ue(null), F({ type: "SET_WALLET_ERROR", message: "" });
|
|
4675
4685
|
return;
|
|
@@ -4682,14 +4692,14 @@ function Rr({
|
|
|
4682
4692
|
const Ut = await (await fetch(`${ce.apiUrl}/public/validate/address`, {
|
|
4683
4693
|
method: "POST",
|
|
4684
4694
|
headers: { "Content-Type": "application/json" },
|
|
4685
|
-
body: JSON.stringify({ address: x, ...
|
|
4695
|
+
body: JSON.stringify({ address: x, ...S ? { network: S } : {} }),
|
|
4686
4696
|
signal: V.signal
|
|
4687
4697
|
})).json(), It = ((Y = Ut.data) == null ? void 0 : Y.attributes) || Ut.data || Ut;
|
|
4688
4698
|
if (It.isValid)
|
|
4689
4699
|
Ue(!0), F({ type: "SET_WALLET_ERROR", message: "" });
|
|
4690
4700
|
else {
|
|
4691
4701
|
Ue(!1);
|
|
4692
|
-
const tn = ((De = It.errors) == null ? void 0 : De[0]) || ((Ge = It.details) == null ? void 0 : Ge.formatMessage) ||
|
|
4702
|
+
const tn = ((De = It.errors) == null ? void 0 : De[0]) || ((Ge = It.details) == null ? void 0 : Ge.formatMessage) || L("wallet.invalidServer");
|
|
4693
4703
|
F({ type: "SET_WALLET_ERROR", message: tn });
|
|
4694
4704
|
}
|
|
4695
4705
|
} catch (Ft) {
|
|
@@ -4702,10 +4712,10 @@ function Rr({
|
|
|
4702
4712
|
clearTimeout(Nt.current), V.abort();
|
|
4703
4713
|
};
|
|
4704
4714
|
}, [C.walletAddress, C.network, ce.apiUrl]);
|
|
4705
|
-
const ut = !Rt ||
|
|
4706
|
-
let
|
|
4707
|
-
const V = H ? 2 : 6, Y =
|
|
4708
|
-
Y !== -1 &&
|
|
4715
|
+
const ut = !Rt || q === 0, Tt = q > 0 && (H ? q < ua : q < ma), Pa = !!he || Tt || lt && ut, Oa = q > 0 && !he && !Tt, Yt = C.walletAddress.trim().length >= 10 && et !== !1 && !je, Qt = Oa && (H ? Yt : !0) && !!C.cryptoCurrency && !!C.network, Ka = (x) => {
|
|
4716
|
+
let S = x.target.value.replace(/[^0-9.,]/g, "");
|
|
4717
|
+
const V = H ? 2 : 6, Y = S.indexOf(".");
|
|
4718
|
+
Y !== -1 && S.length - Y - 1 > V && (S = S.slice(0, Y + V + 1)), F(H ? { type: "SET_FIAT_AMOUNT", amount: S } : { type: "SET_CRYPTO_AMOUNT", amount: S });
|
|
4709
4719
|
}, _a = (x) => {
|
|
4710
4720
|
x !== dt && F({ type: "SET_FLOW_TYPE", flowType: x, fieldLocks: le });
|
|
4711
4721
|
}, ja = O(
|
|
@@ -4714,8 +4724,8 @@ function Rr({
|
|
|
4714
4724
|
},
|
|
4715
4725
|
[F]
|
|
4716
4726
|
), Va = O(
|
|
4717
|
-
(x,
|
|
4718
|
-
F({ type: "SET_CRYPTO_CURRENCY", currency: x }), F({ type: "SET_CRYPTO_CHAIN", chain:
|
|
4727
|
+
(x, S) => {
|
|
4728
|
+
F({ type: "SET_CRYPTO_CURRENCY", currency: x }), F({ type: "SET_CRYPTO_CHAIN", chain: S });
|
|
4719
4729
|
},
|
|
4720
4730
|
[F]
|
|
4721
4731
|
), Wa = O(
|
|
@@ -4738,51 +4748,51 @@ function Rr({
|
|
|
4738
4748
|
return;
|
|
4739
4749
|
}
|
|
4740
4750
|
if (C.selectedQuote) {
|
|
4741
|
-
|
|
4742
|
-
_({ type: "error", title:
|
|
4751
|
+
Se().catch((x) => {
|
|
4752
|
+
_({ type: "error", title: L("toast.orderFailed"), desc: x instanceof Error ? x.message : L("toast.couldNotCreate") });
|
|
4743
4753
|
});
|
|
4744
4754
|
return;
|
|
4745
4755
|
}
|
|
4746
4756
|
A(!0), pe();
|
|
4747
4757
|
};
|
|
4748
|
-
|
|
4758
|
+
U(() => {
|
|
4749
4759
|
var x;
|
|
4750
|
-
if (!(!v ||
|
|
4760
|
+
if (!(!v || b)) {
|
|
4751
4761
|
if (N != null && N.bestQuote)
|
|
4752
|
-
A(!1), F({ type: "SELECT_QUOTE", quote: N.bestQuote }),
|
|
4753
|
-
_({ type: "error", title:
|
|
4762
|
+
A(!1), F({ type: "SELECT_QUOTE", quote: N.bestQuote }), Se().catch((S) => {
|
|
4763
|
+
_({ type: "error", title: L("toast.orderFailed"), desc: S instanceof Error ? S.message : L("toast.couldNotCreate") });
|
|
4754
4764
|
});
|
|
4755
|
-
else if (
|
|
4765
|
+
else if (ne) {
|
|
4756
4766
|
A(!1);
|
|
4757
|
-
const
|
|
4758
|
-
F({ type: "SET_ERROR", message:
|
|
4767
|
+
const S = ne.message || L("error.noProviders");
|
|
4768
|
+
F({ type: "SET_ERROR", message: S }), _({ type: "error", title: L("toast.quoteError"), desc: S });
|
|
4759
4769
|
} else if (N && !N.bestQuote) {
|
|
4760
4770
|
A(!1);
|
|
4761
|
-
const
|
|
4762
|
-
F({ type: "SET_ERROR", message: V }), _({ type: "error", title:
|
|
4771
|
+
const S = (x = N.unavailableGateways) == null ? void 0 : x.map((Y) => Y.reason).filter(Boolean), V = S != null && S.length ? `${L("error.noProviders")}: ${S.join("; ")}` : L("error.noProviders");
|
|
4772
|
+
F({ type: "SET_ERROR", message: V }), _({ type: "error", title: L("toast.noProviders"), desc: V });
|
|
4763
4773
|
}
|
|
4764
4774
|
}
|
|
4765
|
-
}, [v, N,
|
|
4766
|
-
const zt =
|
|
4767
|
-
|
|
4775
|
+
}, [v, N, b, ne, F, Se]);
|
|
4776
|
+
const zt = M(C.step);
|
|
4777
|
+
U(() => {
|
|
4768
4778
|
const x = zt.current;
|
|
4769
|
-
zt.current = C.step, x !== C.step && (C.step === "checkout" ? _({ type: "success", title:
|
|
4779
|
+
zt.current = C.step, x !== C.step && (C.step === "checkout" ? _({ type: "success", title: L("toast.orderCreated"), desc: L("toast.redirecting") }) : C.step === "error" && C.errorMessage && _({ type: "error", title: L("toast.somethingWrong"), desc: C.errorMessage }));
|
|
4770
4780
|
}, [C.step, C.errorMessage]);
|
|
4771
4781
|
const Ve = C.step === "amount";
|
|
4772
|
-
|
|
4773
|
-
Ve ||
|
|
4774
|
-
}, [Ve]),
|
|
4782
|
+
U(() => {
|
|
4783
|
+
Ve || ge(!1);
|
|
4784
|
+
}, [Ve]), U(() => {
|
|
4775
4785
|
if (!ue || !Ve) return;
|
|
4776
4786
|
kt(30);
|
|
4777
4787
|
const x = setInterval(() => {
|
|
4778
|
-
kt((
|
|
4788
|
+
kt((S) => S <= 1 ? (pe(), 30) : S - 1);
|
|
4779
4789
|
}, 1e3);
|
|
4780
4790
|
return () => clearInterval(x);
|
|
4781
|
-
}, [ue, Ve, pe]),
|
|
4782
|
-
ue && Ve && !
|
|
4783
|
-
}, [
|
|
4784
|
-
const Jt = se ? "theme-dark" : "theme-light", mt = sa.find((x) => x.id === Le) || sa[0], Qa = mt.accent === null, za = r ?
|
|
4785
|
-
const
|
|
4791
|
+
}, [ue, Ve, pe]), U(() => {
|
|
4792
|
+
ue && Ve && !b && kt(30);
|
|
4793
|
+
}, [b, ue, Ve]);
|
|
4794
|
+
const Jt = se ? "theme-dark" : "theme-light", mt = sa.find((x) => x.id === Le) || sa[0], Qa = mt.accent === null, za = r ? Ce(r) : !1, qt = (x) => {
|
|
4795
|
+
const S = x.replace("#", ""), V = parseInt(S.substring(0, 2), 16), Y = parseInt(S.substring(2, 4), 16), De = parseInt(S.substring(4, 6), 16);
|
|
4786
4796
|
return (0.299 * V + 0.587 * Y + 0.114 * De) / 255 > 0.5 ? "#000000" : "#ffffff";
|
|
4787
4797
|
}, ea = za ? { "--t-accent": r, "--t-cta-bg": r, "--t-cta-text": qt(r) } : Qa ? {
|
|
4788
4798
|
"--t-accent": se ? "#ffffff" : "#111111",
|
|
@@ -4793,12 +4803,12 @@ function Rr({
|
|
|
4793
4803
|
"--t-cta-bg": mt.accent,
|
|
4794
4804
|
"--t-cta-text": qt(mt.accent)
|
|
4795
4805
|
}, me = {};
|
|
4796
|
-
d &&
|
|
4806
|
+
d && Ce(d) && (me["--t-surface"] = d, me["--t-modal-bg"] = d), s && Ce(s) && (me["--t-pill-bg"] = s, me["--t-close-bg"] = s), h && Ce(h) && (me["--t-text"] = h), p && Ce(p) && (me["--t-text-secondary"] = p), f && Ce(f) && (me["--t-text-muted"] = f, me["--t-text-tertiary"] = f), g && Ce(g) && (me["--t-success"] = g);
|
|
4797
4807
|
const Me = {};
|
|
4798
|
-
o &&
|
|
4808
|
+
o && Ce(o) ? Me.backgroundColor = o : Me.backgroundColor = "var(--t-bg)", c && (c.startsWith("https://") || c.startsWith("data:image/")) && (Me.backgroundImage = `url(${c})`, Me.backgroundSize = "cover", Me.backgroundPosition = "center");
|
|
4799
4809
|
const pt = {};
|
|
4800
|
-
u &&
|
|
4801
|
-
const rt = C.network, We = rt ? yt(rt) : null, ta = (We == null ? void 0 : We.shortName) || (We == null ? void 0 : We.name) || rt, Ja = he || (lt && (Tt || ut) ? ut ?
|
|
4810
|
+
u && Ce(u) && (pt.border = `1px solid ${u}`), l && (pt.borderRadius = l);
|
|
4811
|
+
const rt = C.network, We = rt ? yt(rt) : null, ta = (We == null ? void 0 : We.shortName) || (We == null ? void 0 : We.name) || rt, Ja = he || (lt && (Tt || ut) ? ut ? L("error.amountZero") : H ? L("error.minAmountFiat", { min: String(ua), currency: xe }) : L("error.minAmountCrypto", { min: String(ma), currency: re }) : void 0), qa = C.walletError ? C.walletError : bt && !Yt && !je ? L("wallet.invalid") : void 0, Lt = oe.filter((x) => x.supportedFiats.includes(C.fiatCurrency)), en = Lt.find((x) => x.id === C.paymentMethodId) || Lt[0], aa = C.step === "checkout" ? /* @__PURE__ */ e(bn, { autoRedirect: E }) : C.step === "processing" ? /* @__PURE__ */ e(wn, {}) : C.step === "complete" ? /* @__PURE__ */ e(kn, { explorerUrl: K, doneButtonText: te, onDone: ae }) : C.step === "error" ? /* @__PURE__ */ e(Nn, { supportEmail: z, onDone: ae, doneButtonText: te }) : C.step === "confirm" ? /* @__PURE__ */ e(Un, { stablecoinParity: nt, partnerName: J }) : null;
|
|
4802
4812
|
return aa ? /* @__PURE__ */ e(
|
|
4803
4813
|
"div",
|
|
4804
4814
|
{
|
|
@@ -4839,13 +4849,13 @@ function Rr({
|
|
|
4839
4849
|
darkMode: se
|
|
4840
4850
|
}
|
|
4841
4851
|
),
|
|
4842
|
-
tt || wt ||
|
|
4852
|
+
tt || wt || D ? /* @__PURE__ */ e("div", { className: "pt-[88px] px-3 flex-1 flex flex-col", children: D ? /* @__PURE__ */ e(In, {}) : /* @__PURE__ */ e(Zn, {}) }) : /* @__PURE__ */ i("div", { className: "flex-1 overflow-hidden pt-[88px] px-3 flex flex-col gap-1 tab-fade-in", children: [
|
|
4843
4853
|
/* @__PURE__ */ e(
|
|
4844
4854
|
ur,
|
|
4845
4855
|
{
|
|
4846
4856
|
amount: Rt,
|
|
4847
4857
|
onAmountChange: Ka,
|
|
4848
|
-
currencyCode: H ?
|
|
4858
|
+
currencyCode: H ? xe : re,
|
|
4849
4859
|
isBuy: H,
|
|
4850
4860
|
onOpenModal: () => j(H ? "fiat" : "crypto"),
|
|
4851
4861
|
assetBaseUrl: X,
|
|
@@ -4863,31 +4873,33 @@ function Rr({
|
|
|
4863
4873
|
hr,
|
|
4864
4874
|
{
|
|
4865
4875
|
amount: Ba,
|
|
4866
|
-
currencyCode: H ?
|
|
4876
|
+
currencyCode: H ? re : xe,
|
|
4867
4877
|
chainCode: H ? rt : void 0,
|
|
4868
4878
|
chainDisplay: H ? ta : void 0,
|
|
4869
4879
|
isBuy: H,
|
|
4870
4880
|
onOpenModal: () => j(H ? "crypto" : "fiat"),
|
|
4871
4881
|
displayRate: Ha,
|
|
4872
4882
|
assetBaseUrl: X,
|
|
4873
|
-
quotesLoading:
|
|
4874
|
-
onOpenRateBreakdown: () =>
|
|
4883
|
+
quotesLoading: b,
|
|
4884
|
+
onOpenRateBreakdown: () => {
|
|
4885
|
+
q > 0 && ge(!0);
|
|
4886
|
+
},
|
|
4875
4887
|
fieldLocks: le,
|
|
4876
|
-
spendNumeric:
|
|
4888
|
+
spendNumeric: q,
|
|
4877
4889
|
getChainIconUrl: H ? Dt : void 0,
|
|
4878
4890
|
autoSelectPending: v,
|
|
4879
4891
|
rateFlash: Fa
|
|
4880
4892
|
}
|
|
4881
4893
|
),
|
|
4882
|
-
G &&
|
|
4894
|
+
G && q > 0 && /* @__PURE__ */ e(
|
|
4883
4895
|
"div",
|
|
4884
4896
|
{
|
|
4885
4897
|
className: "px-4 py-2.5 mt-1",
|
|
4886
4898
|
style: { background: "var(--t-surface)", borderRadius: "var(--t-card-radius)", fontSize: 12, color: "var(--t-error)", lineHeight: "16px" },
|
|
4887
|
-
children: Ke ||
|
|
4899
|
+
children: Ke || L("error.noProviders")
|
|
4888
4900
|
}
|
|
4889
4901
|
),
|
|
4890
|
-
nt &&
|
|
4902
|
+
nt && q > 0 && (N == null ? void 0 : N.bestQuote) && /* @__PURE__ */ i(
|
|
4891
4903
|
"div",
|
|
4892
4904
|
{
|
|
4893
4905
|
className: "flex items-start gap-2 mt-1 px-4 py-2.5",
|
|
@@ -4897,27 +4909,27 @@ function Rr({
|
|
|
4897
4909
|
/* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
4898
4910
|
/* @__PURE__ */ e("path", { d: "M8 7v4M8 5.5v-.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
4899
4911
|
] }),
|
|
4900
|
-
/* @__PURE__ */ e("span", { children:
|
|
4912
|
+
/* @__PURE__ */ e("span", { children: L("parity.info", { receiveAmount: Ie, crypto: re, spendAmount: Bt(q), fiat: xe, partner: J || "" }) })
|
|
4901
4913
|
]
|
|
4902
4914
|
}
|
|
4903
4915
|
),
|
|
4904
|
-
(N ||
|
|
4916
|
+
(N || b) && /* @__PURE__ */ e(
|
|
4905
4917
|
yr,
|
|
4906
4918
|
{
|
|
4907
4919
|
selectedQuote: C.selectedQuote,
|
|
4908
|
-
quotesLoading:
|
|
4920
|
+
quotesLoading: b,
|
|
4909
4921
|
onOpenModal: () => j("provider"),
|
|
4910
4922
|
assetBaseUrl: X
|
|
4911
4923
|
}
|
|
4912
4924
|
),
|
|
4913
|
-
(
|
|
4925
|
+
(oe.length > 0 || (m == null ? void 0 : m.paymentMethods) && m.paymentMethods.length > 0) && (Lt.length > 0 ? /* @__PURE__ */ e(
|
|
4914
4926
|
fr,
|
|
4915
4927
|
{
|
|
4916
4928
|
selectedMethod: en,
|
|
4917
4929
|
onOpenModal: () => j("payment"),
|
|
4918
4930
|
darkMode: se,
|
|
4919
4931
|
getMethodIcon: Wt,
|
|
4920
|
-
getMethodDisplayName: (x,
|
|
4932
|
+
getMethodDisplayName: (x, S) => Vt(x, S, L, !0)
|
|
4921
4933
|
}
|
|
4922
4934
|
) : /* @__PURE__ */ e(
|
|
4923
4935
|
"div",
|
|
@@ -4928,7 +4940,7 @@ function Rr({
|
|
|
4928
4940
|
borderRadius: "var(--t-card-radius)",
|
|
4929
4941
|
height: 56
|
|
4930
4942
|
},
|
|
4931
|
-
children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: "var(--t-text-muted)" }, children:
|
|
4943
|
+
children: /* @__PURE__ */ e("span", { className: "text-[12px]", style: { color: "var(--t-text-muted)" }, children: L("payment.noneAvailable") })
|
|
4932
4944
|
}
|
|
4933
4945
|
)),
|
|
4934
4946
|
H && /* @__PURE__ */ e(
|
|
@@ -4936,7 +4948,7 @@ function Rr({
|
|
|
4936
4948
|
{
|
|
4937
4949
|
address: C.walletAddress,
|
|
4938
4950
|
onChange: (x) => F({ type: "SET_WALLET_ADDRESS", address: x }),
|
|
4939
|
-
placeholder:
|
|
4951
|
+
placeholder: L("wallet.placeholderBuy"),
|
|
4940
4952
|
isBuy: H,
|
|
4941
4953
|
error: qa,
|
|
4942
4954
|
validating: je,
|
|
@@ -4949,12 +4961,12 @@ function Rr({
|
|
|
4949
4961
|
}
|
|
4950
4962
|
),
|
|
4951
4963
|
/* @__PURE__ */ e("div", { className: "flex-1", style: { minHeight: 16 } }),
|
|
4952
|
-
ye && /* @__PURE__ */ e("div", { className: "text-[12px] text-center mb-2", style: { color: "var(--t-error)" }, children:
|
|
4964
|
+
ye && /* @__PURE__ */ e("div", { className: "text-[12px] text-center mb-2", style: { color: "var(--t-error)" }, children: L(H ? "error.currencyUnavailableBuy" : "error.currencyUnavailableSell") }),
|
|
4953
4965
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-3 pb-3", children: [
|
|
4954
4966
|
/* @__PURE__ */ e(
|
|
4955
4967
|
kr,
|
|
4956
4968
|
{
|
|
4957
|
-
label: H ?
|
|
4969
|
+
label: H ? L("cta.buy", { crypto: re }) : L("cta.sell", { crypto: re }),
|
|
4958
4970
|
disabled: !Qt || Te || v || ye || G,
|
|
4959
4971
|
loading: Te || v,
|
|
4960
4972
|
onClick: Ya
|
|
@@ -4963,34 +4975,34 @@ function Rr({
|
|
|
4963
4975
|
/* @__PURE__ */ e(Nr, {})
|
|
4964
4976
|
] })
|
|
4965
4977
|
] }, dt),
|
|
4966
|
-
|
|
4978
|
+
I && /* @__PURE__ */ e(
|
|
4967
4979
|
$n,
|
|
4968
4980
|
{
|
|
4969
|
-
type:
|
|
4970
|
-
title:
|
|
4971
|
-
description:
|
|
4972
|
-
visible: !!
|
|
4981
|
+
type: I.type,
|
|
4982
|
+
title: I.title,
|
|
4983
|
+
description: I.desc,
|
|
4984
|
+
visible: !!I,
|
|
4973
4985
|
onDismiss: () => _(null)
|
|
4974
4986
|
}
|
|
4975
4987
|
),
|
|
4976
|
-
/* @__PURE__ */ e(Xn, { isOpen: ue, onClose: () =>
|
|
4988
|
+
/* @__PURE__ */ e(Xn, { isOpen: ue, onClose: () => ge(!1), children: /* @__PURE__ */ e(
|
|
4977
4989
|
Er,
|
|
4978
4990
|
{
|
|
4979
|
-
quote:
|
|
4991
|
+
quote: ve,
|
|
4980
4992
|
isOpen: ue,
|
|
4981
|
-
onClose: () =>
|
|
4993
|
+
onClose: () => ge(!1),
|
|
4982
4994
|
countdown: La,
|
|
4983
|
-
quotesLoading:
|
|
4995
|
+
quotesLoading: b
|
|
4984
4996
|
}
|
|
4985
4997
|
) }),
|
|
4986
4998
|
/* @__PURE__ */ e(Pe, { isOpen: de === "fiat", onClose: () => j(null), children: (x) => /* @__PURE__ */ e(
|
|
4987
4999
|
Qn,
|
|
4988
5000
|
{
|
|
4989
5001
|
onClose: x,
|
|
4990
|
-
onSelect: (
|
|
4991
|
-
ja(
|
|
5002
|
+
onSelect: (S) => {
|
|
5003
|
+
ja(S), x();
|
|
4992
5004
|
},
|
|
4993
|
-
currencies: fe.map((
|
|
5005
|
+
currencies: fe.map((S) => ({ code: S.code, name: S.code })),
|
|
4994
5006
|
assetBaseUrl: X,
|
|
4995
5007
|
selectedCode: C.fiatCurrency
|
|
4996
5008
|
}
|
|
@@ -4999,15 +5011,15 @@ function Rr({
|
|
|
4999
5011
|
zn,
|
|
5000
5012
|
{
|
|
5001
5013
|
onClose: x,
|
|
5002
|
-
onSelect: (
|
|
5003
|
-
Va(
|
|
5014
|
+
onSelect: (S, V) => {
|
|
5015
|
+
Va(S, V), x();
|
|
5004
5016
|
},
|
|
5005
|
-
cryptos: Qe.map((
|
|
5017
|
+
cryptos: Qe.map((S) => {
|
|
5006
5018
|
var V;
|
|
5007
5019
|
return {
|
|
5008
|
-
code:
|
|
5009
|
-
name:
|
|
5010
|
-
networks: (V =
|
|
5020
|
+
code: S.code,
|
|
5021
|
+
name: S.code,
|
|
5022
|
+
networks: (V = S.networks) == null ? void 0 : V.map((Y) => ({ code: Y.id, name: Y.name }))
|
|
5011
5023
|
};
|
|
5012
5024
|
}),
|
|
5013
5025
|
assetBaseUrl: X,
|
|
@@ -5018,10 +5030,10 @@ function Rr({
|
|
|
5018
5030
|
/* @__PURE__ */ e(Pe, { isOpen: de === "payment", onClose: () => j(null), children: (x) => /* @__PURE__ */ e(
|
|
5019
5031
|
ar,
|
|
5020
5032
|
{
|
|
5021
|
-
methods:
|
|
5033
|
+
methods: oe,
|
|
5022
5034
|
selectedId: C.paymentMethodId,
|
|
5023
|
-
onSelect: (
|
|
5024
|
-
Wa(
|
|
5035
|
+
onSelect: (S) => {
|
|
5036
|
+
Wa(S), x();
|
|
5025
5037
|
},
|
|
5026
5038
|
onClose: x
|
|
5027
5039
|
}
|
|
@@ -5030,12 +5042,12 @@ function Rr({
|
|
|
5030
5042
|
Sr,
|
|
5031
5043
|
{
|
|
5032
5044
|
quotes: N,
|
|
5033
|
-
quotesLoading:
|
|
5034
|
-
cryptoCurrency:
|
|
5045
|
+
quotesLoading: b,
|
|
5046
|
+
cryptoCurrency: re,
|
|
5035
5047
|
selectedGatewayId: C.selectedProvider,
|
|
5036
5048
|
assetBaseUrl: X,
|
|
5037
|
-
onSelect: (
|
|
5038
|
-
|
|
5049
|
+
onSelect: (S) => {
|
|
5050
|
+
B(!0), F({ type: "SELECT_QUOTE", quote: S }), x();
|
|
5039
5051
|
},
|
|
5040
5052
|
onClose: x
|
|
5041
5053
|
}
|
|
@@ -5047,8 +5059,8 @@ function Rr({
|
|
|
5047
5059
|
darkMode: se,
|
|
5048
5060
|
onToggleDarkMode: _e,
|
|
5049
5061
|
skinId: Le,
|
|
5050
|
-
onSelectSkin: (
|
|
5051
|
-
Ct(
|
|
5062
|
+
onSelectSkin: (S) => {
|
|
5063
|
+
Ct(S);
|
|
5052
5064
|
},
|
|
5053
5065
|
showThemeToggle: y,
|
|
5054
5066
|
country: C.country,
|
|
@@ -5062,8 +5074,8 @@ function Rr({
|
|
|
5062
5074
|
lr,
|
|
5063
5075
|
{
|
|
5064
5076
|
onClose: x,
|
|
5065
|
-
onSelect: (
|
|
5066
|
-
Ga(
|
|
5077
|
+
onSelect: (S) => {
|
|
5078
|
+
Ga(S), x();
|
|
5067
5079
|
},
|
|
5068
5080
|
assetBaseUrl: X,
|
|
5069
5081
|
selectedCode: C.country
|
|
@@ -5073,8 +5085,8 @@ function Rr({
|
|
|
5073
5085
|
sr,
|
|
5074
5086
|
{
|
|
5075
5087
|
onClose: x,
|
|
5076
|
-
onSelect: (
|
|
5077
|
-
vt(
|
|
5088
|
+
onSelect: (S) => {
|
|
5089
|
+
vt(S), x();
|
|
5078
5090
|
},
|
|
5079
5091
|
selectedCode: ze
|
|
5080
5092
|
}
|
|
@@ -5103,23 +5115,23 @@ function Ar({
|
|
|
5103
5115
|
statusPollInterval: y,
|
|
5104
5116
|
onComplete: E,
|
|
5105
5117
|
onError: K,
|
|
5106
|
-
className:
|
|
5118
|
+
className: te,
|
|
5107
5119
|
theme: z,
|
|
5108
5120
|
skinId: ie,
|
|
5109
5121
|
accentColor: J,
|
|
5110
|
-
bgColor:
|
|
5111
|
-
bgImage:
|
|
5112
|
-
borderColor:
|
|
5113
|
-
borderRadius:
|
|
5122
|
+
bgColor: ee,
|
|
5123
|
+
bgImage: be,
|
|
5124
|
+
borderColor: ae,
|
|
5125
|
+
borderRadius: L,
|
|
5114
5126
|
surfaceColor: C,
|
|
5115
5127
|
inputBgColor: F,
|
|
5116
5128
|
textColor: m,
|
|
5117
|
-
textSecondaryColor:
|
|
5129
|
+
textSecondaryColor: D,
|
|
5118
5130
|
textMutedColor: N,
|
|
5119
|
-
successColor:
|
|
5120
|
-
showFlowToggle:
|
|
5131
|
+
successColor: b,
|
|
5132
|
+
showFlowToggle: ne,
|
|
5121
5133
|
showSettings: pe,
|
|
5122
|
-
showThemeToggle:
|
|
5134
|
+
showThemeToggle: Se,
|
|
5123
5135
|
autoRedirect: Te,
|
|
5124
5136
|
explorerUrl: he,
|
|
5125
5137
|
doneButtonText: le,
|
|
@@ -5127,7 +5139,7 @@ function Ar({
|
|
|
5127
5139
|
stablecoinParity: X,
|
|
5128
5140
|
partnerName: fe,
|
|
5129
5141
|
containerHeight: Qe,
|
|
5130
|
-
locale:
|
|
5142
|
+
locale: oe,
|
|
5131
5143
|
onDone: ye
|
|
5132
5144
|
}) {
|
|
5133
5145
|
return /* @__PURE__ */ e(
|
|
@@ -5152,26 +5164,26 @@ function Ar({
|
|
|
5152
5164
|
statusPollInterval: y,
|
|
5153
5165
|
onComplete: E,
|
|
5154
5166
|
onError: K,
|
|
5155
|
-
children: /* @__PURE__ */ e(vn, { defaultLocale:
|
|
5167
|
+
children: /* @__PURE__ */ e(vn, { defaultLocale: oe || "en", children: /* @__PURE__ */ e(
|
|
5156
5168
|
Rr,
|
|
5157
5169
|
{
|
|
5158
|
-
className:
|
|
5170
|
+
className: te,
|
|
5159
5171
|
theme: z,
|
|
5160
5172
|
skinId: ie,
|
|
5161
5173
|
accentColor: J,
|
|
5162
|
-
bgColor:
|
|
5163
|
-
bgImage:
|
|
5164
|
-
borderColor:
|
|
5165
|
-
borderRadius:
|
|
5174
|
+
bgColor: ee,
|
|
5175
|
+
bgImage: be,
|
|
5176
|
+
borderColor: ae,
|
|
5177
|
+
borderRadius: L,
|
|
5166
5178
|
surfaceColor: C,
|
|
5167
5179
|
inputBgColor: F,
|
|
5168
5180
|
textColor: m,
|
|
5169
|
-
textSecondaryColor:
|
|
5181
|
+
textSecondaryColor: D,
|
|
5170
5182
|
textMutedColor: N,
|
|
5171
|
-
successColor:
|
|
5172
|
-
showFlowToggle:
|
|
5183
|
+
successColor: b,
|
|
5184
|
+
showFlowToggle: ne,
|
|
5173
5185
|
showSettings: pe,
|
|
5174
|
-
showThemeToggle:
|
|
5186
|
+
showThemeToggle: Se,
|
|
5175
5187
|
autoRedirect: Te,
|
|
5176
5188
|
explorerUrl: he,
|
|
5177
5189
|
doneButtonText: le,
|