@nowramp/form 0.1.82 → 0.1.83

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.js CHANGED
@@ -24,8 +24,8 @@ function Sa(t, a, n) {
24
24
  try {
25
25
  const f = {};
26
26
  a && (f.orderType = a), n && (f.country = n);
27
- const p = await m.current.getSupported(f);
28
- o(p);
27
+ const y = await m.current.getSupported(f);
28
+ o(y);
29
29
  } catch (f) {
30
30
  s(f instanceof Error ? f : new Error("Failed to fetch config"));
31
31
  } finally {
@@ -55,7 +55,7 @@ function Na(t, a) {
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 = P(async () => {
58
+ const y = P(async () => {
59
59
  if (!(!a || !t.projectId)) {
60
60
  d(!0), i(null);
61
61
  try {
@@ -68,15 +68,15 @@ function Na(t, a) {
68
68
  }
69
69
  }
70
70
  }, [t.projectId, a]);
71
- return { quotes: n, loading: o, error: u, refetch: p };
71
+ return { quotes: n, loading: o, error: u, refetch: y };
72
72
  }
73
73
  function wa(t) {
74
74
  const [a, n] = N(null), [r, o] = N(!1), [d, u] = N(null), i = I(null), s = I(""), m = `${t.apiUrl}|${t.projectId}`;
75
75
  (!i.current || s.current !== m) && (i.current = new at({ apiKey: "", ...t }), s.current = m);
76
- const h = P(async (p) => {
76
+ const h = P(async (y) => {
77
77
  o(!0), u(null);
78
78
  try {
79
- const x = await i.current.createCheckoutIntent(p);
79
+ const x = await i.current.createCheckoutIntent(y);
80
80
  return n(x), x;
81
81
  } catch (x) {
82
82
  const C = x instanceof Error ? x : new Error("Failed to create checkout intent");
@@ -109,15 +109,15 @@ function Ea(t, a, n) {
109
109
  if (!a) return;
110
110
  const f = (n == null ? void 0 : n.initialDelay) ?? 0;
111
111
  if (f > 0) {
112
- const p = setTimeout(h, f);
113
- return () => clearTimeout(p);
112
+ const y = setTimeout(h, f);
113
+ return () => clearTimeout(y);
114
114
  }
115
115
  h();
116
116
  }, [h, a, n == null ? void 0 : n.initialDelay]), Z(() => {
117
117
  if (!a || !(n != null && n.pollInterval) || !r || ["completed", "failed", "cancelled", "expired", "refunded"].includes(r.status))
118
118
  return;
119
- const p = setInterval(h, n.pollInterval);
120
- return () => clearInterval(p);
119
+ const y = setInterval(h, n.pollInterval);
120
+ return () => clearInterval(y);
121
121
  }, [a, n == null ? void 0 : n.pollInterval, r == null ? void 0 : r.status, h]), { status: r, loading: d, error: i, refetch: h };
122
122
  }
123
123
  const et = [
@@ -527,7 +527,7 @@ function Ia({
527
527
  defaultFiatAmount: m = "",
528
528
  defaultCryptoAmount: h = "",
529
529
  defaultWalletAddress: f = "",
530
- defaultGateway: p,
530
+ defaultGateway: y,
531
531
  defaultCountry: x,
532
532
  fieldLocks: C,
533
533
  statusPollInterval: E = 5e3,
@@ -535,7 +535,7 @@ function Ia({
535
535
  onError: _,
536
536
  children: ie
537
537
  }) {
538
- const G = j(() => ({ apiUrl: a, projectId: t }), [a, t]), z = s || (i ? i.toLowerCase() : ""), te = r === "sell", X = te ? !!h : !!m, v = (te ? !!(X && i && z) : !!(X && i && z && f)) && p ? "confirm" : "amount", L = m || (r === "buy" ? "250" : ""), [c, U] = xa(Ma, {
538
+ const G = j(() => ({ apiUrl: a, projectId: t }), [a, t]), z = s || (i ? i.toLowerCase() : ""), te = r === "sell", X = te ? !!h : !!m, v = (te ? !!(X && i && z) : !!(X && i && z && f)) && y ? "confirm" : "amount", L = m || (r === "buy" ? "250" : ""), [c, U] = xa(Ma, {
539
539
  ...Qt,
540
540
  step: v,
541
541
  flowType: r,
@@ -557,9 +557,9 @@ function Ia({
557
557
  var F;
558
558
  if (Se.current || !(b != null && b.detectedCountry) || c.country) return;
559
559
  Se.current = !0;
560
- const y = b.detectedCountry.toLowerCase();
561
- U({ type: "SET_COUNTRY_AUTO", country: y });
562
- const A = (F = b.fiats) == null ? void 0 : F.map((M) => M.code), R = mt(y, A);
560
+ const p = b.detectedCountry.toLowerCase();
561
+ U({ type: "SET_COUNTRY_AUTO", country: p });
562
+ const A = (F = b.fiats) == null ? void 0 : F.map((M) => M.code), R = mt(p, A);
563
563
  R !== c.fiatCurrency && U({ type: "SET_FIAT_CURRENCY", currency: R });
564
564
  }, [b, c.country, c.fiatCurrency]);
565
565
  const se = I(!1);
@@ -567,33 +567,33 @@ function Ia({
567
567
  var R;
568
568
  if (se.current || !x || !((R = b == null ? void 0 : b.fiats) != null && R.length)) return;
569
569
  se.current = !0;
570
- const y = b.fiats.map((F) => F.code), A = mt(x, y);
570
+ const p = b.fiats.map((F) => F.code), A = mt(x, p);
571
571
  A !== c.fiatCurrency && U({ type: "SET_FIAT_CURRENCY", currency: A });
572
572
  }, [x, b, c.fiatCurrency]);
573
573
  const pe = I(c.country);
574
574
  ge.useEffect(() => {
575
575
  var R;
576
576
  if (c.country === pe.current || (pe.current = c.country, c.countrySource === "manual" && (Ie.current = !1), c.countrySource !== "manual") || !((R = b == null ? void 0 : b.fiats) != null && R.length)) return;
577
- const y = b.fiats.map((F) => F.code), A = mt(c.country, y);
577
+ const p = b.fiats.map((F) => F.code), A = mt(c.country, p);
578
578
  A !== c.fiatCurrency && U({ type: "SET_FIAT_CURRENCY", currency: A });
579
579
  }, [c.country, c.countrySource, b, c.fiatCurrency]);
580
580
  const D = I(c.fiatCurrency);
581
581
  ge.useEffect(() => {
582
582
  var F;
583
583
  if (c.fiatCurrency === D.current || (D.current = c.fiatCurrency, w || !((F = b == null ? void 0 : b.fiats) != null && F.length) || !c.fiatAmount)) return;
584
- const y = b.fiats.find((M) => M.code === c.fiatCurrency);
585
- if (!(y != null && y.minAmount)) return;
586
- const A = parseFloat(c.fiatAmount), R = parseFloat(y.minAmount);
584
+ const p = b.fiats.find((M) => M.code === c.fiatCurrency);
585
+ if (!(p != null && p.minAmount)) return;
586
+ const A = parseFloat(c.fiatAmount), R = parseFloat(p.minAmount);
587
587
  !isNaN(A) && !isNaN(R) && A < R && U({ type: "SET_FIAT_AMOUNT", amount: String(Math.ceil(R)) });
588
588
  }, [c.fiatCurrency, c.fiatAmount, b, w]);
589
- const { availableFiats: ae, availableCryptos: B, availablePaymentMethods: de } = j(() => {
589
+ const { availableFiats: ae, availableCryptos: O, availablePaymentMethods: de } = j(() => {
590
590
  var R, F, M;
591
591
  if (!b)
592
592
  return { availableFiats: [], availableCryptos: [], availablePaymentMethods: [] };
593
- let y;
593
+ let p;
594
594
  if (c.cryptoCurrency && c.network) {
595
595
  const T = (R = b.cryptos) == null ? void 0 : R.find((Y) => Y.code === c.cryptoCurrency), H = (F = T == null ? void 0 : T.networks) == null ? void 0 : F.find((Y) => Y.id === c.network);
596
- !T || !H ? y = [] : y = H.providers;
596
+ !T || !H ? p = [] : p = H.providers;
597
597
  }
598
598
  let A;
599
599
  if (c.fiatCurrency) {
@@ -601,25 +601,25 @@ function Ia({
601
601
  T ? A = T.providers : A = [];
602
602
  }
603
603
  return {
604
- availableFiats: Aa(b.fiats ?? [], y),
604
+ availableFiats: Aa(b.fiats ?? [], p),
605
605
  availableCryptos: Ra(b.cryptos ?? [], A),
606
606
  availablePaymentMethods: ka(
607
607
  b.paymentMethods ?? [],
608
- y,
608
+ p,
609
609
  c.fiatCurrency
610
610
  )
611
611
  };
612
612
  }, [b, c.cryptoCurrency, c.network, c.fiatCurrency]), Me = j(() => {
613
- var y, A, R;
613
+ var p, A, R;
614
614
  return J || !b ? !1 : La(
615
615
  b,
616
616
  { cryptoCurrency: c.cryptoCurrency, network: c.network, fiatCurrency: c.fiatCurrency },
617
617
  {
618
- cryptoLocked: !!((y = C == null ? void 0 : C.destinationCurrency) != null && y.locked),
618
+ cryptoLocked: !!((p = C == null ? void 0 : C.destinationCurrency) != null && p.locked),
619
619
  networkLocked: !!((A = C == null ? void 0 : C.network) != null && A.locked),
620
620
  fiatLocked: !!((R = C == null ? void 0 : C.sourceCurrency) != null && R.locked)
621
621
  },
622
- { availableFiats: ae, availableCryptos: B, availablePaymentMethods: de }
622
+ { availableFiats: ae, availableCryptos: O, availablePaymentMethods: de }
623
623
  );
624
624
  }, [
625
625
  J,
@@ -629,31 +629,31 @@ function Ia({
629
629
  c.network,
630
630
  c.fiatCurrency,
631
631
  ae,
632
- B,
632
+ O,
633
633
  de
634
634
  ]);
635
635
  ge.useEffect(() => {
636
636
  var A, R, F;
637
- if (J || ae.length === 0 && B.length === 0) return;
638
- const y = Ta(
637
+ if (J || ae.length === 0 && O.length === 0) return;
638
+ const p = Ta(
639
639
  {
640
640
  cryptoCurrency: c.cryptoCurrency,
641
641
  network: c.network,
642
642
  fiatCurrency: c.fiatCurrency,
643
643
  paymentMethodId: c.paymentMethodId
644
644
  },
645
- { availableFiats: ae, availableCryptos: B, availablePaymentMethods: de },
645
+ { availableFiats: ae, availableCryptos: O, availablePaymentMethods: de },
646
646
  {
647
647
  cryptoLocked: !!((A = C == null ? void 0 : C.destinationCurrency) != null && A.locked),
648
648
  networkLocked: !!((R = C == null ? void 0 : C.network) != null && R.locked),
649
649
  fiatLocked: !!((F = C == null ? void 0 : C.sourceCurrency) != null && F.locked)
650
650
  }
651
651
  );
652
- y && (y.cryptoCurrency !== void 0 && U({ type: "SET_CRYPTO_CURRENCY", currency: y.cryptoCurrency }), y.network !== void 0 && U({ type: "SET_NETWORK", network: y.network }), y.fiatCurrency !== void 0 && U({ type: "SET_FIAT_CURRENCY", currency: y.fiatCurrency }), y.paymentMethodId !== void 0 && U({ type: "SET_PAYMENT_METHOD", methodId: y.paymentMethodId }));
652
+ p && (p.cryptoCurrency !== void 0 && U({ type: "SET_CRYPTO_CURRENCY", currency: p.cryptoCurrency }), p.network !== void 0 && U({ type: "SET_NETWORK", network: p.network }), p.fiatCurrency !== void 0 && U({ type: "SET_FIAT_CURRENCY", currency: p.fiatCurrency }), p.paymentMethodId !== void 0 && U({ type: "SET_PAYMENT_METHOD", methodId: p.paymentMethodId }));
653
653
  }, [
654
654
  J,
655
655
  ae,
656
- B,
656
+ O,
657
657
  de,
658
658
  c.cryptoCurrency,
659
659
  c.network,
@@ -669,15 +669,15 @@ function Ia({
669
669
  return isNaN(M) || M <= 0 ? "Enter a valid amount" : null;
670
670
  }
671
671
  if (!b || !c.fiatAmount) return null;
672
- const y = parseFloat(c.fiatAmount);
673
- if (isNaN(y)) return null;
672
+ const p = parseFloat(c.fiatAmount);
673
+ if (isNaN(p)) return null;
674
674
  const A = b.fiats.find((M) => M.code === c.fiatCurrency);
675
675
  if (!A) return null;
676
676
  const R = parseFloat(A.minAmount), F = parseFloat(A.maxAmount);
677
- return !isNaN(R) && y < R ? `Minimum amount is ${A.minAmount} ${c.fiatCurrency}` : !isNaN(F) && y > F ? `Maximum amount is ${A.maxAmount} ${c.fiatCurrency}` : null;
677
+ return !isNaN(R) && p < R ? `Minimum amount is ${A.minAmount} ${c.fiatCurrency}` : !isNaN(F) && p > F ? `Maximum amount is ${A.maxAmount} ${c.fiatCurrency}` : null;
678
678
  }, [b, c.fiatAmount, c.fiatCurrency, c.cryptoAmount, w]), ne = j(() => {
679
- const y = w ? !!c.cryptoAmount : !!c.fiatAmount;
680
- return !b || !y || !c.fiatCurrency || !c.cryptoCurrency || !c.network || Q || b.detectedCountry && c.countrySource === "" && !x ? null : {
679
+ const p = w ? !!c.cryptoAmount : !!c.fiatAmount;
680
+ return !b || !p || !c.fiatCurrency || !c.cryptoCurrency || !c.network || Q || b.detectedCountry && c.countrySource === "" && !x ? null : {
681
681
  fiatCurrency: c.fiatCurrency,
682
682
  ...w ? { cryptoAmount: c.cryptoAmount } : { fiatAmount: c.fiatAmount },
683
683
  cryptoCurrency: c.cryptoCurrency,
@@ -687,14 +687,14 @@ function Ia({
687
687
  orderType: c.flowType
688
688
  };
689
689
  }, [b, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country, c.countrySource, Q, w, c.flowType, x]), {
690
- quotes: O,
690
+ quotes: B,
691
691
  loading: Re,
692
692
  error: le,
693
693
  refetch: We
694
- } = Na(G, ne), ke = Ua(Re, O, ne), Ie = I(!1);
694
+ } = Na(G, ne), ke = Ua(Re, B, ne), Ie = I(!1);
695
695
  ge.useEffect(() => {
696
- Ie.current || c.countrySource === "auto" && (Re || !ne || le || !O || O.bestQuote || c.fiatCurrency !== "USD" && (Ie.current = !0, U({ type: "SET_FIAT_CURRENCY", currency: "USD" }), U({ type: "SET_FIAT_AMOUNT", amount: "250" })));
697
- }, [O, Re, le, ne, c.countrySource, c.fiatCurrency]);
696
+ Ie.current || c.countrySource === "auto" && (Re || !ne || le || !B || B.bestQuote || c.fiatCurrency !== "USD" && (Ie.current = !0, U({ type: "SET_FIAT_CURRENCY", currency: "USD" }), U({ type: "SET_FIAT_AMOUNT", amount: "250" })));
697
+ }, [B, Re, le, ne, c.countrySource, c.fiatCurrency]);
698
698
  const {
699
699
  order: ce,
700
700
  loading: $,
@@ -711,26 +711,30 @@ function Ia({
711
711
  ge.useEffect(() => {
712
712
  (re == null ? void 0 : re.status) === "completed" && k && k(re);
713
713
  }, [re == null ? void 0 : re.status, k]), ge.useEffect(() => {
714
- const y = be || Ne;
715
- y && _ && _(y);
714
+ const p = be || Ne;
715
+ p && _ && _(p);
716
716
  }, [be, Ne, _]);
717
- const ye = p || (b == null ? void 0 : b.defaultGateway) || null, Oe = j(() => !ke || !(O != null && O.unavailableGateways) ? null : Fa(O.unavailableGateways, ye), [ke, O, ye]), He = I(ye);
717
+ const ye = y || (b == null ? void 0 : b.defaultGateway) || null, Oe = j(() => {
718
+ if (!ke || !(B != null && B.unavailableGateways)) return null;
719
+ const p = B.preferredGatewayId || ye;
720
+ return Fa(B.unavailableGateways, p);
721
+ }, [ke, B, ye]), He = I(ye);
718
722
  He.current = ye;
719
- const Ye = I(O);
720
- Ye.current = O;
723
+ const Ye = I(B);
724
+ Ye.current = B;
721
725
  const ue = I(d);
722
726
  ue.current = d;
723
727
  const Pe = P(async () => {
724
728
  var A, R, F;
725
- const y = ((A = c.selectedQuote) == null ? void 0 : A.gatewayId) || ((F = (R = Ye.current) == null ? void 0 : R.bestQuote) == null ? void 0 : F.gatewayId) || He.current;
726
- if (!y || !c.walletAddress) {
727
- const M = [!y && "gateway", !c.walletAddress && "walletAddress"].filter(Boolean).join(", ");
729
+ const p = ((A = c.selectedQuote) == null ? void 0 : A.gatewayId) || ((F = (R = Ye.current) == null ? void 0 : R.bestQuote) == null ? void 0 : F.gatewayId) || He.current;
730
+ if (!p || !c.walletAddress) {
731
+ const M = [!p && "gateway", !c.walletAddress && "walletAddress"].filter(Boolean).join(", ");
728
732
  U({ type: "SET_ERROR", message: `Missing required fields: ${M}` });
729
733
  return;
730
734
  }
731
735
  try {
732
736
  await Be({
733
- gateway: y,
737
+ gateway: p,
734
738
  customerId: c.customerId || void 0,
735
739
  fiatCurrency: c.fiatCurrency,
736
740
  ...w ? { cryptoAmount: c.cryptoAmount } : { fiatAmount: c.fiatAmount },
@@ -746,18 +750,18 @@ function Ia({
746
750
  const T = M instanceof Error ? M.message : "Failed to create order";
747
751
  /wallet|address/i.test(T) ? U({ type: "SET_WALLET_ERROR", message: T.replace(/^Failed to create checkout intent:\s*/i, "") }) : U({ type: "SET_ERROR", message: T });
748
752
  }
749
- }, [c, Be, w]), ot = P((y) => {
750
- U({ type: "SET_STEP", step: y });
753
+ }, [c, Be, w]), ot = P((p) => {
754
+ U({ type: "SET_STEP", step: p });
751
755
  }, []), it = P(() => {
752
- const y = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], A = y.indexOf(c.step);
753
- A > 0 && U({ type: "SET_STEP", step: y[A - 1] });
756
+ const p = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], A = p.indexOf(c.step);
757
+ A > 0 && U({ type: "SET_STEP", step: p[A - 1] });
754
758
  }, [c.step, w]), Ze = j(() => {
755
- const y = w ? !!c.cryptoAmount : !!c.fiatAmount;
759
+ const p = w ? !!c.cryptoAmount : !!c.fiatAmount;
756
760
  switch (c.step) {
757
761
  case "confirm":
758
- return !!(y && c.cryptoCurrency && c.network && c.walletAddress && !Q);
762
+ return !!(p && c.cryptoCurrency && c.network && c.walletAddress && !Q);
759
763
  case "amount":
760
- return !!(y && c.cryptoCurrency && c.network && !Q);
764
+ return !!(p && c.cryptoCurrency && c.network && !Q);
761
765
  case "quotes":
762
766
  return !!c.selectedQuote;
763
767
  case "wallet":
@@ -773,7 +777,7 @@ function Ia({
773
777
  configError: be,
774
778
  state: c,
775
779
  dispatch: U,
776
- quotes: O,
780
+ quotes: B,
777
781
  quotesLoading: Re,
778
782
  quotesError: le,
779
783
  fetchQuotes: We,
@@ -786,7 +790,7 @@ function Ia({
786
790
  fieldLocks: C || null,
787
791
  defaultGateway: ye,
788
792
  availableFiats: ae,
789
- availableCryptos: B,
793
+ availableCryptos: O,
790
794
  availablePaymentMethods: de,
791
795
  selectionUnsupported: Me,
792
796
  quotesEmpty: ke,
@@ -1664,7 +1668,7 @@ function an({
1664
1668
  autoRedirect: a = !1,
1665
1669
  redirectDelay: n = 3e3
1666
1670
  }) {
1667
- var p;
1671
+ var y;
1668
1672
  const { order: r, orderStatus: o, goToStep: d, goBack: u } = Fe(), [i, s] = N(!1), [m, h] = N(null), f = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
1669
1673
  if (Z(() => {
1670
1674
  if ((r == null ? void 0 : r.checkout.method) === "redirect" && a && !f) {
@@ -1734,7 +1738,7 @@ function an({
1734
1738
  }
1735
1739
  );
1736
1740
  if (r.checkout.method === "iframe") {
1737
- const x = r.checkout.url, C = ((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";
1741
+ const x = r.checkout.url, C = ((y = r.checkout.allowedFeatures) == null ? void 0 : y.join("; ")) || "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share";
1738
1742
  return Pt(
1739
1743
  /* @__PURE__ */ l(
1740
1744
  "div",
@@ -2314,7 +2318,7 @@ function cn({ className: t = "", stablecoinParity: a, partnerName: n }) {
2314
2318
  fetchQuotes: s,
2315
2319
  createOrder: m,
2316
2320
  orderLoading: h
2317
- } = Fe(), f = d.flowType === "sell", [p, x] = N(null), C = r == null ? void 0 : r.gateways.find((X) => X.id === u), E = (te = i == null ? void 0 : i.bestQuote) != null && te.exchangeRate ? parseFloat(i.bestQuote.exchangeRate) : null, k = parseFloat(d.fiatAmount) || 0, _ = !!(a && n && !f && ea(d.cryptoCurrency) && E), ie = _ && d.cryptoCurrency.toUpperCase().includes(d.fiatCurrency.toUpperCase()), G = _ && k > 0 ? ht(ie ? k : k / E) : null, z = async () => {
2321
+ } = Fe(), f = d.flowType === "sell", [y, x] = N(null), C = r == null ? void 0 : r.gateways.find((X) => X.id === u), E = (te = i == null ? void 0 : i.bestQuote) != null && te.exchangeRate ? parseFloat(i.bestQuote.exchangeRate) : null, k = parseFloat(d.fiatAmount) || 0, _ = !!(a && n && !f && ea(d.cryptoCurrency) && E), ie = _ && d.cryptoCurrency.toUpperCase().includes(d.fiatCurrency.toUpperCase()), G = _ && k > 0 ? ht(ie ? k : k / E) : null, z = async () => {
2318
2322
  x(null);
2319
2323
  try {
2320
2324
  s(), await m();
@@ -2362,7 +2366,7 @@ function cn({ className: t = "", stablecoinParity: a, partnerName: n }) {
2362
2366
  /* @__PURE__ */ e(Ae, { label: "Network", value: d.network }),
2363
2367
  f && d.walletAddress && /* @__PURE__ */ e(Ae, { label: "Refund address", value: Yt(d.walletAddress), mono: !0 })
2364
2368
  ] }),
2365
- p && /* @__PURE__ */ e("p", { className: "text-[12px] mb-4", style: { color: "#EF4444" }, children: p }),
2369
+ y && /* @__PURE__ */ e("p", { className: "text-[12px] mb-4", style: { color: "#EF4444" }, children: y }),
2366
2370
  /* @__PURE__ */ e(
2367
2371
  "button",
2368
2372
  {
@@ -2543,7 +2547,7 @@ function mn({
2543
2547
  if (o) {
2544
2548
  const h = i.find((f) => f.code === o);
2545
2549
  if (h) {
2546
- const f = i.filter((p) => p.code !== o);
2550
+ const f = i.filter((y) => y.code !== o);
2547
2551
  return [h, ...f];
2548
2552
  }
2549
2553
  }
@@ -2572,7 +2576,7 @@ function mn({
2572
2576
  /* @__PURE__ */ e($e, { value: d, onChange: u }),
2573
2577
  /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
2574
2578
  s.map((m, h) => {
2575
- const f = m.name !== m.code ? m.name : "", p = o === m.code;
2579
+ const f = m.name !== m.code ? m.name : "", y = o === m.code;
2576
2580
  return /* @__PURE__ */ l("div", { children: [
2577
2581
  /* @__PURE__ */ l(
2578
2582
  "button",
@@ -2586,7 +2590,7 @@ function mn({
2586
2590
  /* @__PURE__ */ e("span", { className: "font-semibold text-[15px]", children: m.code }),
2587
2591
  f && /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: f })
2588
2592
  ] }),
2589
- p && /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: /* @__PURE__ */ e(
2593
+ y && /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: /* @__PURE__ */ e(
2590
2594
  "path",
2591
2595
  {
2592
2596
  d: "M13.5 4.5L6 12L2.5 8.5",
@@ -2649,15 +2653,15 @@ function fn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
2649
2653
  const [u, i] = N(""), s = j(() => {
2650
2654
  if (!n || n.length === 0) return _a;
2651
2655
  const f = [];
2652
- for (const p of n) {
2653
- const x = p.networks || [], C = p.name || Ba[p.code] || p.code;
2656
+ for (const y of n) {
2657
+ const x = y.networks || [], C = y.name || Ba[y.code] || y.code;
2654
2658
  if (x.length === 0)
2655
- f.push({ code: p.code, name: C, chain: p.code, popular: !1 });
2659
+ f.push({ code: y.code, name: C, chain: y.code, popular: !1 });
2656
2660
  else
2657
2661
  for (const E of x) {
2658
- const k = E.code || E.id || E.name || p.code;
2662
+ const k = E.code || E.id || E.name || y.code;
2659
2663
  f.push({
2660
- code: p.code,
2664
+ code: y.code,
2661
2665
  name: C,
2662
2666
  chain: k,
2663
2667
  chainName: E.name,
@@ -2666,7 +2670,7 @@ function fn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
2666
2670
  }
2667
2671
  }
2668
2672
  return f;
2669
- }, [n]), m = P((f, p) => o === f && d === p, [o, d]), h = j(() => {
2673
+ }, [n]), m = P((f, y) => o === f && d === y, [o, d]), h = j(() => {
2670
2674
  var C;
2671
2675
  const f = u.trim().toLowerCase();
2672
2676
  if (!f) {
@@ -2679,12 +2683,12 @@ function fn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
2679
2683
  }
2680
2684
  return s;
2681
2685
  }
2682
- const p = f.split(/\s+/), x = [];
2686
+ const y = f.split(/\s+/), x = [];
2683
2687
  for (const E of s) {
2684
2688
  const k = tt(E.chain), _ = k ? k.name.toLowerCase() : "", ie = ((C = k == null ? void 0 : k.shortName) == null ? void 0 : C.toLowerCase()) || "", G = E.chain.toLowerCase(), z = E.code.toLowerCase(), te = E.name.toLowerCase(), X = [z, te, _, ie, G];
2685
- if (!p.every((L) => X.some((c) => c.includes(L)))) continue;
2689
+ if (!y.every((L) => X.some((c) => c.includes(L)))) continue;
2686
2690
  let v = 0;
2687
- z === f ? v += 100 : z.startsWith(p[0]) && (v += 50), E.popular && (v += 10), p.length > 1 && (_.includes(p[1]) || ie.includes(p[1]) || G.includes(p[1])) && (v += 25), x.push({ item: E, score: v });
2691
+ z === f ? v += 100 : z.startsWith(y[0]) && (v += 50), E.popular && (v += 10), y.length > 1 && (_.includes(y[1]) || ie.includes(y[1]) || G.includes(y[1])) && (v += 25), x.push({ item: E, score: v });
2688
2692
  }
2689
2693
  return x.sort((E, k) => k.score - E.score), x.map((E) => E.item);
2690
2694
  }, [s, u, o, d]);
@@ -2700,7 +2704,7 @@ function fn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
2700
2704
  ),
2701
2705
  /* @__PURE__ */ e($e, { value: u, onChange: i }),
2702
2706
  /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
2703
- h.map((f, p) => {
2707
+ h.map((f, y) => {
2704
2708
  const x = tt(f.chain), C = (x == null ? void 0 : x.name) || f.chainName || f.chain, E = f.name !== f.code ? f.name : "", k = m(f.code, f.chain);
2705
2709
  return /* @__PURE__ */ l("div", { children: [
2706
2710
  /* @__PURE__ */ l(
@@ -2782,7 +2786,7 @@ function fn({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: r = "", selecte
2782
2786
  ]
2783
2787
  }
2784
2788
  ),
2785
- p < h.length - 1 && /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" } })
2789
+ y < h.length - 1 && /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider, rgba(255,255,255,0.08))" } })
2786
2790
  ] }, `${f.code}-${f.chain}`);
2787
2791
  }),
2788
2792
  h.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
@@ -2991,11 +2995,11 @@ function Cn({
2991
2995
  ] }) }),
2992
2996
  /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider)" } })
2993
2997
  ] }),
2994
- yn.map((p) => /* @__PURE__ */ l("div", { children: [
2998
+ yn.map((y) => /* @__PURE__ */ l("div", { children: [
2995
2999
  /* @__PURE__ */ l(
2996
3000
  "a",
2997
3001
  {
2998
- href: p.href,
3002
+ href: y.href,
2999
3003
  target: "_blank",
3000
3004
  rel: "noopener noreferrer",
3001
3005
  className: "flex items-center justify-between w-full py-5 transition-colors",
@@ -3006,7 +3010,7 @@ function Cn({
3006
3010
  {
3007
3011
  className: "font-medium text-[15px]",
3008
3012
  style: { color: "var(--t-text)" },
3009
- children: p.label
3013
+ children: y.label
3010
3014
  }
3011
3015
  ),
3012
3016
  /* @__PURE__ */ e(Xt, {})
@@ -3014,7 +3018,7 @@ function Cn({
3014
3018
  }
3015
3019
  ),
3016
3020
  /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider)" } })
3017
- ] }, p.label))
3021
+ ] }, y.label))
3018
3022
  ] })
3019
3023
  ] });
3020
3024
  }
@@ -3149,7 +3153,7 @@ function bn({
3149
3153
  inputBgColor: m,
3150
3154
  textColor: h,
3151
3155
  textSecondaryColor: f,
3152
- textMutedColor: p,
3156
+ textMutedColor: y,
3153
3157
  successColor: x,
3154
3158
  showFlowToggle: C = !0,
3155
3159
  showSettings: E = !0,
@@ -3177,14 +3181,14 @@ function bn({
3177
3181
  amountError: pe,
3178
3182
  fieldLocks: D,
3179
3183
  apiConfig: ae,
3180
- assetBaseUrl: B,
3184
+ assetBaseUrl: O,
3181
3185
  availableFiats: de,
3182
3186
  availableCryptos: Me,
3183
3187
  availablePaymentMethods: Q,
3184
3188
  selectionUnsupported: ne,
3185
- quotesEmpty: O,
3189
+ quotesEmpty: B,
3186
3190
  bestUnavailableReason: Re
3187
- } = Fe(), [le, We] = N(a === "dark"), [ke, Ie] = N(n), [ce, $] = N(null), [Ne, Be] = N(!1), [Xe, re] = N(!1), [rt, ye] = N(!1), [Oe, He] = N(!1), [Ye, ue] = N(null), [Pe, ot] = N(!0), [it, Ze] = N(!1), [me, y] = N(!1), A = I(null), R = I(), F = I(v.flowType);
3191
+ } = Fe(), [le, We] = N(a === "dark"), [ke, Ie] = N(n), [ce, $] = N(null), [Ne, Be] = N(!1), [Xe, re] = N(!1), [rt, ye] = N(!1), [Oe, He] = N(!1), [Ye, ue] = N(null), [Pe, ot] = N(!0), [it, Ze] = N(!1), [me, p] = N(!1), A = I(null), R = I(), F = I(v.flowType);
3188
3192
  Z(() => {
3189
3193
  We(a === "dark");
3190
3194
  }, [a]), Z(() => {
@@ -3200,8 +3204,8 @@ function bn({
3200
3204
  }, [v.flowType, Pe]);
3201
3205
  const M = v.flowType, T = M === "buy", H = v.cryptoCurrency || "BTC", Y = v.fiatCurrency || "USD", lt = T ? v.fiatAmount : v.cryptoAmount, q = Ka(lt), Ce = (Lt = w == null ? void 0 : w.bestQuote) != null && Lt.exchangeRate ? parseFloat(w.bestQuote.exchangeRate) : null, Ke = I(null);
3202
3206
  Ce && H && Y && (Ke.current = { rate: Ce, crypto: H, fiat: Y }), Z(() => {
3203
- (O || J) && (Ke.current = null);
3204
- }, [O, J]);
3207
+ (B || J) && (Ke.current = null);
3208
+ }, [B, J]);
3205
3209
  const xt = j(() => {
3206
3210
  if (w != null && w.bestQuote) {
3207
3211
  const g = T ? w.bestQuote.cryptoAmount : w.bestQuote.fiatAmount;
@@ -3276,18 +3280,18 @@ function bn({
3276
3280
  ), fa = P(() => {
3277
3281
  $(null), setTimeout(() => $("country"), 280);
3278
3282
  }, []), ha = v.country ? (Ut = yt[v.country.toLowerCase()]) == null ? void 0 : Ut.name : void 0, pa = () => {
3279
- Qe && (y(!0), be());
3283
+ Qe && (p(!0), be());
3280
3284
  };
3281
3285
  Z(() => {
3282
3286
  var g;
3283
3287
  if (!(!me || b)) {
3284
3288
  if (w != null && w.bestQuote)
3285
- y(!1), L({ type: "SELECT_QUOTE", quote: w.bestQuote }), Se().catch(() => {
3289
+ p(!1), L({ type: "SELECT_QUOTE", quote: w.bestQuote }), Se().catch(() => {
3286
3290
  });
3287
3291
  else if (J)
3288
- y(!1), L({ type: "SET_ERROR", message: J.message || "No quotes available" });
3292
+ p(!1), L({ type: "SET_ERROR", message: J.message || "No quotes available" });
3289
3293
  else if (w && !w.bestQuote) {
3290
- y(!1);
3294
+ p(!1);
3291
3295
  const S = (g = w.unavailableGateways) == null ? void 0 : g.map((W) => W.reason).filter(Boolean), K = S != null && S.length ? `No providers available: ${S.join("; ")}` : "No providers available for this currency/network combination";
3292
3296
  L({ type: "SET_ERROR", message: K });
3293
3297
  }
@@ -3305,7 +3309,7 @@ function bn({
3305
3309
  "--t-cta-bg": ze.accent,
3306
3310
  "--t-cta-text": At(ze.accent)
3307
3311
  }, oe = {};
3308
- s && he(s) && (oe["--t-surface"] = s, oe["--t-modal-bg"] = s), m && he(m) && (oe["--t-pill-bg"] = m, oe["--t-close-bg"] = m), h && he(h) && (oe["--t-text"] = h), f && he(f) && (oe["--t-text-secondary"] = f), p && he(p) && (oe["--t-text-muted"] = p, oe["--t-text-tertiary"] = p), x && he(x) && (oe["--t-success"] = x);
3312
+ s && he(s) && (oe["--t-surface"] = s, oe["--t-modal-bg"] = s), m && he(m) && (oe["--t-pill-bg"] = m, oe["--t-close-bg"] = m), h && he(h) && (oe["--t-text"] = h), f && he(f) && (oe["--t-text-secondary"] = f), y && he(y) && (oe["--t-text-muted"] = y, oe["--t-text-tertiary"] = y), x && he(x) && (oe["--t-success"] = x);
3309
3313
  const we = {};
3310
3314
  o && he(o) ? we.backgroundColor = o : we.backgroundColor = "var(--t-bg)", d && (d.startsWith("https://") || d.startsWith("data:image/")) && (we.backgroundImage = `url(${d})`, we.backgroundSize = "cover", we.backgroundPosition = "center");
3311
3315
  const Je = le ? "#ffffff" : "#111111", qe = {};
@@ -3419,7 +3423,7 @@ function bn({
3419
3423
  },
3420
3424
  disabled: !!((Dt = D == null ? void 0 : D.sourceCurrency) != null && Dt.locked),
3421
3425
  children: [
3422
- /* @__PURE__ */ e(pt, { currencyCode: Y, size: 16, baseUrl: B }),
3426
+ /* @__PURE__ */ e(pt, { currencyCode: Y, size: 16, baseUrl: O }),
3423
3427
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Je }, children: Y }),
3424
3428
  /* @__PURE__ */ e(Ge, {})
3425
3429
  ]
@@ -3439,7 +3443,7 @@ function bn({
3439
3443
  },
3440
3444
  disabled: !!((Mt = D == null ? void 0 : D.destinationCurrency) != null && Mt.locked),
3441
3445
  children: [
3442
- /* @__PURE__ */ e(Wt, { ticker: H, size: 16, baseUrl: B }),
3446
+ /* @__PURE__ */ e(Wt, { ticker: H, size: 16, baseUrl: O }),
3443
3447
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Je }, children: H }),
3444
3448
  /* @__PURE__ */ e(Ge, {})
3445
3449
  ]
@@ -3449,7 +3453,7 @@ function bn({
3449
3453
  /* @__PURE__ */ e("div", { className: "rounded-full", style: { width: 14, height: 14, background: "#ffffff" }, children: /* @__PURE__ */ e(
3450
3454
  "img",
3451
3455
  {
3452
- src: ft(fe, B),
3456
+ src: ft(fe, O),
3453
3457
  alt: fe,
3454
3458
  width: 14,
3455
3459
  height: 14,
@@ -3505,7 +3509,7 @@ function bn({
3505
3509
  },
3506
3510
  disabled: !!((It = D == null ? void 0 : D.destinationCurrency) != null && It.locked),
3507
3511
  children: [
3508
- /* @__PURE__ */ e(Wt, { ticker: H, size: 16, baseUrl: B }),
3512
+ /* @__PURE__ */ e(Wt, { ticker: H, size: 16, baseUrl: O }),
3509
3513
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Je }, children: H }),
3510
3514
  /* @__PURE__ */ e(Ge, {})
3511
3515
  ]
@@ -3515,7 +3519,7 @@ function bn({
3515
3519
  /* @__PURE__ */ e("div", { className: "rounded-full", style: { width: 14, height: 14, background: "#ffffff" }, children: /* @__PURE__ */ e(
3516
3520
  "img",
3517
3521
  {
3518
- src: ft(fe, B),
3522
+ src: ft(fe, O),
3519
3523
  alt: fe,
3520
3524
  width: 14,
3521
3525
  height: 14,
@@ -3539,7 +3543,7 @@ function bn({
3539
3543
  },
3540
3544
  disabled: !!((Bt = D == null ? void 0 : D.sourceCurrency) != null && Bt.locked),
3541
3545
  children: [
3542
- /* @__PURE__ */ e(pt, { currencyCode: Y, size: 16, baseUrl: B }),
3546
+ /* @__PURE__ */ e(pt, { currencyCode: Y, size: 16, baseUrl: O }),
3543
3547
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: Je }, children: Y }),
3544
3548
  /* @__PURE__ */ e(Ge, {})
3545
3549
  ]
@@ -3549,7 +3553,7 @@ function bn({
3549
3553
  ]
3550
3554
  }
3551
3555
  ),
3552
- O && q > 0 && /* @__PURE__ */ e(
3556
+ B && q > 0 && /* @__PURE__ */ e(
3553
3557
  "div",
3554
3558
  {
3555
3559
  className: "px-[18px] py-[10px] mt-[2px]",
@@ -3655,7 +3659,7 @@ function bn({
3655
3659
  /* @__PURE__ */ e(
3656
3660
  "button",
3657
3661
  {
3658
- disabled: !Qe || se || me || ne || O,
3662
+ disabled: !Qe || se || me || ne || B,
3659
3663
  onClick: pa,
3660
3664
  className: "w-full font-semibold text-[16px] transition-all",
3661
3665
  style: {
@@ -3663,8 +3667,8 @@ function bn({
3663
3667
  borderRadius: 5,
3664
3668
  background: "var(--t-cta-bg)",
3665
3669
  color: "var(--t-cta-text)",
3666
- opacity: Qe && !se && !me && !ne && !O ? 1 : 0.4,
3667
- cursor: Qe && !se && !me && !ne && !O ? "pointer" : "not-allowed"
3670
+ opacity: Qe && !se && !me && !ne && !B ? 1 : 0.4,
3671
+ cursor: Qe && !se && !me && !ne && !B ? "pointer" : "not-allowed"
3668
3672
  },
3669
3673
  children: me ? "Getting best price..." : se ? "Processing..." : T ? `Buy ${H}` : `Sell ${H}`
3670
3674
  }
@@ -3679,7 +3683,7 @@ function bn({
3679
3683
  sa(S), g();
3680
3684
  },
3681
3685
  currencies: de.map((S) => ({ code: S.code, name: S.code })),
3682
- assetBaseUrl: B,
3686
+ assetBaseUrl: O,
3683
3687
  selectedCode: v.fiatCurrency
3684
3688
  }
3685
3689
  ) }),
@@ -3698,7 +3702,7 @@ function bn({
3698
3702
  networks: (K = S.networks) == null ? void 0 : K.map((W) => ({ code: W.id, name: W.name }))
3699
3703
  };
3700
3704
  }),
3701
- assetBaseUrl: B,
3705
+ assetBaseUrl: O,
3702
3706
  selectedCode: v.cryptoCurrency,
3703
3707
  selectedChain: v.network
3704
3708
  }
@@ -3728,7 +3732,7 @@ function bn({
3728
3732
  country: v.country,
3729
3733
  countryName: ha,
3730
3734
  onLocationPress: fa,
3731
- assetBaseUrl: B
3735
+ assetBaseUrl: O
3732
3736
  }
3733
3737
  ) }),
3734
3738
  /* @__PURE__ */ e(je, { isOpen: ce === "country", onClose: () => $(null), children: (g) => /* @__PURE__ */ e(
@@ -3738,7 +3742,7 @@ function bn({
3738
3742
  onSelect: (S) => {
3739
3743
  ma(S), g();
3740
3744
  },
3741
- assetBaseUrl: B,
3745
+ assetBaseUrl: O,
3742
3746
  selectedCode: v.country
3743
3747
  }
3744
3748
  ) })
@@ -3759,7 +3763,7 @@ function Sn({
3759
3763
  defaultFiatAmount: m,
3760
3764
  defaultCryptoAmount: h,
3761
3765
  defaultWalletAddress: f,
3762
- defaultGateway: p,
3766
+ defaultGateway: y,
3763
3767
  defaultCountry: x,
3764
3768
  fieldLocks: C,
3765
3769
  statusPollInterval: E,
@@ -3784,7 +3788,7 @@ function Sn({
3784
3788
  showThemeToggle: pe,
3785
3789
  autoRedirect: D,
3786
3790
  explorerUrl: ae,
3787
- doneButtonText: B,
3791
+ doneButtonText: O,
3788
3792
  supportEmail: de,
3789
3793
  stablecoinParity: Me,
3790
3794
  partnerName: Q,
@@ -3805,7 +3809,7 @@ function Sn({
3805
3809
  defaultFiatAmount: m,
3806
3810
  defaultCryptoAmount: h,
3807
3811
  defaultWalletAddress: f,
3808
- defaultGateway: p,
3812
+ defaultGateway: y,
3809
3813
  defaultCountry: x,
3810
3814
  fieldLocks: C,
3811
3815
  statusPollInterval: E,
@@ -3833,7 +3837,7 @@ function Sn({
3833
3837
  showThemeToggle: pe,
3834
3838
  autoRedirect: D,
3835
3839
  explorerUrl: ae,
3836
- doneButtonText: B,
3840
+ doneButtonText: O,
3837
3841
  supportEmail: de,
3838
3842
  stablecoinParity: Me,
3839
3843
  partnerName: Q,
@@ -3954,7 +3958,7 @@ function Mn({
3954
3958
  /* @__PURE__ */ e($e, { value: d, onChange: u }),
3955
3959
  /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto custom-scroll px-5 space-y-2", children: [
3956
3960
  r ? /* @__PURE__ */ e(En, {}) : i.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" }) : i.map((s, m) => {
3957
- const h = m === 0, f = parseFloat(s.cryptoAmount), p = f >= 1 ? f.toFixed(4) : f.toPrecision(6);
3961
+ const h = m === 0, f = parseFloat(s.cryptoAmount), y = f >= 1 ? f.toFixed(4) : f.toPrecision(6);
3958
3962
  return /* @__PURE__ */ l(
3959
3963
  "button",
3960
3964
  {
@@ -3979,7 +3983,7 @@ function Mn({
3979
3983
  /* @__PURE__ */ l("div", { className: "font-medium text-[14px]", style: { color: "var(--t-text)" }, children: [
3980
3984
  o,
3981
3985
  " ",
3982
- p
3986
+ y
3983
3987
  ] })
3984
3988
  ] })
3985
3989
  ]