@nowramp/form 0.1.31 → 0.1.33

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
@@ -12,93 +12,93 @@ import { jsx as e, jsxs as o, Fragment as le } from "react/jsx-runtime";
12
12
  import Ue, { useState as C, useRef as U, useCallback as $, useEffect as H, useMemo as X, useReducer as St, useContext as wt, createContext as Tt } from "react";
13
13
  import { RampApi as ke } from "@nowramp/sdk";
14
14
  function Rt(t, a) {
15
- const [n, l] = C(null), [r, i] = C(!0), [m, d] = C(null), c = U(null);
15
+ const [n, l] = C(null), [r, d] = C(!0), [u, m] = C(null), c = U(null);
16
16
  (!c.current || c.current !== t) && (c.current = new ke({ apiKey: "", ...t }));
17
- const u = $(async () => {
17
+ const i = $(async () => {
18
18
  if (!t.projectId) {
19
- d(new Error("projectId is required")), i(!1);
19
+ m(new Error("projectId is required")), d(!1);
20
20
  return;
21
21
  }
22
- i(!0), d(null);
22
+ d(!0), m(null);
23
23
  try {
24
24
  const p = await c.current.getSupported(a);
25
25
  l(p);
26
26
  } catch (p) {
27
- d(p instanceof Error ? p : new Error("Failed to fetch config"));
27
+ m(p instanceof Error ? p : new Error("Failed to fetch config"));
28
28
  } finally {
29
- i(!1);
29
+ d(!1);
30
30
  }
31
31
  }, [t.projectId, a]);
32
32
  return H(() => {
33
- u();
34
- }, [u]), { config: n, loading: r, error: m, refetch: u };
33
+ i();
34
+ }, [i]), { config: n, loading: r, error: u, refetch: i };
35
35
  }
36
36
  function kt(t, a) {
37
- const [n, l] = C(null), [r, i] = C(!1), [m, d] = C(null), c = U(null), u = U(""), p = `${t.apiUrl}|${t.projectId}`;
38
- (!c.current || u.current !== p) && (c.current = new ke({ apiKey: "", ...t }), u.current = p);
37
+ const [n, l] = C(null), [r, d] = C(!1), [u, m] = C(null), c = U(null), i = U(""), p = `${t.apiUrl}|${t.projectId}`;
38
+ (!c.current || i.current !== p) && (c.current = new ke({ apiKey: "", ...t }), i.current = p);
39
39
  const f = U(0);
40
40
  H(() => {
41
41
  const g = ++f.current;
42
42
  if (!a || !t.projectId) {
43
- l(null), i(!1);
43
+ l(null), d(!1);
44
44
  return;
45
45
  }
46
- i(!0), d(null), c.current.getQuotes(a).then(
46
+ d(!0), m(null), c.current.getQuotes(a).then(
47
47
  (h) => {
48
- f.current === g && (l(h), i(!1));
48
+ f.current === g && (l(h), d(!1));
49
49
  },
50
50
  (h) => {
51
- f.current === g && (d(h instanceof Error ? h : new Error("Failed to fetch quotes")), l(null), i(!1));
51
+ f.current === g && (m(h instanceof Error ? h : new Error("Failed to fetch quotes")), l(null), d(!1));
52
52
  }
53
53
  );
54
54
  }, [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]);
55
55
  const x = $(async () => {
56
56
  if (!(!a || !t.projectId)) {
57
- i(!0), d(null);
57
+ d(!0), m(null);
58
58
  try {
59
59
  const g = await c.current.getQuotes(a);
60
60
  l(g);
61
61
  } catch (g) {
62
- d(g instanceof Error ? g : new Error("Failed to fetch quotes"));
62
+ m(g instanceof Error ? g : new Error("Failed to fetch quotes"));
63
63
  } finally {
64
- i(!1);
64
+ d(!1);
65
65
  }
66
66
  }
67
67
  }, [t.projectId, a]);
68
- return { quotes: n, loading: r, error: m, refetch: x };
68
+ return { quotes: n, loading: r, error: u, refetch: x };
69
69
  }
70
70
  function Lt(t) {
71
- const [a, n] = C(null), [l, r] = C(!1), [i, m] = C(null), d = U(null), c = U(""), u = `${t.apiUrl}|${t.projectId}`;
72
- (!d.current || c.current !== u) && (d.current = new ke({ apiKey: "", ...t }), c.current = u);
71
+ const [a, n] = C(null), [l, r] = C(!1), [d, u] = C(null), m = U(null), c = U(""), i = `${t.apiUrl}|${t.projectId}`;
72
+ (!m.current || c.current !== i) && (m.current = new ke({ apiKey: "", ...t }), c.current = i);
73
73
  const p = $(async (x) => {
74
- r(!0), m(null);
74
+ r(!0), u(null);
75
75
  try {
76
- const g = await d.current.createCheckoutIntent(x);
76
+ const g = await m.current.createCheckoutIntent(x);
77
77
  return n(g), g;
78
78
  } catch (g) {
79
79
  const h = g instanceof Error ? g : new Error("Failed to create checkout intent");
80
- throw m(h), h;
80
+ throw u(h), h;
81
81
  } finally {
82
82
  r(!1);
83
83
  }
84
84
  }, []), f = $(() => {
85
- n(null), m(null);
85
+ n(null), u(null);
86
86
  }, []);
87
- return { order: a, loading: l, error: i, createOrder: p, reset: f };
87
+ return { order: a, loading: l, error: d, createOrder: p, reset: f };
88
88
  }
89
89
  function It(t, a, n) {
90
- const [l, r] = C(null), [i, m] = C(!1), [d, c] = C(null), u = U(null);
91
- u.current || (u.current = new ke({ apiKey: "", projectId: "", ...t }));
90
+ const [l, r] = C(null), [d, u] = C(!1), [m, c] = C(null), i = U(null);
91
+ i.current || (i.current = new ke({ apiKey: "", projectId: "", ...t }));
92
92
  const p = $(async () => {
93
93
  if (a) {
94
- m(!0), c(null);
94
+ u(!0), c(null);
95
95
  try {
96
- const f = await u.current.getTransaction(a);
96
+ const f = await i.current.getTransaction(a);
97
97
  r(f);
98
98
  } catch (f) {
99
99
  c(f instanceof Error ? f : new Error("Failed to fetch status"));
100
100
  } finally {
101
- m(!1);
101
+ u(!1);
102
102
  }
103
103
  }
104
104
  }, [a]);
@@ -115,7 +115,7 @@ function It(t, a, n) {
115
115
  return;
116
116
  const x = setInterval(p, n.pollInterval);
117
117
  return () => clearInterval(x);
118
- }, [a, n == null ? void 0 : n.pollInterval, l == null ? void 0 : l.status, p]), { status: l, loading: i, error: d, refetch: p };
118
+ }, [a, n == null ? void 0 : n.pollInterval, l == null ? void 0 : l.status, p]), { status: l, loading: d, error: m, refetch: p };
119
119
  }
120
120
  function rt(t, a) {
121
121
  if (!t) return t;
@@ -203,11 +203,11 @@ function Mt({
203
203
  assetBaseUrl: n = "",
204
204
  flowType: l = "buy",
205
205
  customerId: r = "",
206
- defaultFiatCurrency: i = "USD",
207
- defaultCryptoCurrency: m = "BTC",
208
- defaultNetwork: d = "",
206
+ defaultFiatCurrency: d = "USD",
207
+ defaultCryptoCurrency: u = "BTC",
208
+ defaultNetwork: m = "",
209
209
  defaultFiatAmount: c = "",
210
- defaultCryptoAmount: u = "",
210
+ defaultCryptoAmount: i = "",
211
211
  defaultWalletAddress: p = "",
212
212
  defaultGateway: f,
213
213
  fieldLocks: x,
@@ -216,15 +216,15 @@ function Mt({
216
216
  onError: b,
217
217
  children: L
218
218
  }) {
219
- const O = X(() => ({ apiUrl: a, projectId: t }), [a, t]), A = d || (m ? m.toLowerCase() : ""), G = l === "sell", j = G ? !!u : !!c, Z = (G ? !!(j && m && A) : !!(j && m && A && p)) && f ? "confirm" : "amount", [s, P] = St(Bt, {
219
+ const O = X(() => ({ apiUrl: a, projectId: t }), [a, t]), A = m || (u ? u.toLowerCase() : ""), G = l === "sell", j = G ? !!i : !!c, Z = (G ? !!(j && u && A) : !!(j && u && A && p)) && f ? "confirm" : "amount", [s, P] = St(Bt, {
220
220
  ...mt,
221
221
  step: Z,
222
222
  flowType: l,
223
- fiatCurrency: i,
224
- cryptoCurrency: m,
223
+ fiatCurrency: d,
224
+ cryptoCurrency: u,
225
225
  network: A,
226
226
  fiatAmount: rt(c, 2),
227
- cryptoAmount: rt(u, 6),
227
+ cryptoAmount: rt(i, 6),
228
228
  walletAddress: p,
229
229
  customerId: r
230
230
  }), v = s.flowType === "sell", {
@@ -374,7 +374,7 @@ function Ot({
374
374
  redirectDelay: l = 3e3
375
375
  }) {
376
376
  var g;
377
- const { order: r, orderStatus: i, goToStep: m, goBack: d } = he(), [c, u] = C(!1), [p, f] = C(null), x = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
377
+ const { order: r, orderStatus: d, goToStep: u, goBack: m } = he(), [c, i] = C(!1), [p, f] = C(null), x = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
378
378
  if (H(() => {
379
379
  if ((r == null ? void 0 : r.checkout.method) === "redirect" && n && !x) {
380
380
  f(Math.ceil(l / 1e3));
@@ -388,8 +388,8 @@ function Ot({
388
388
  };
389
389
  }
390
390
  }, [r, n, l, x]), H(() => {
391
- i && (i.status === "completed" ? m("complete") : ["failed", "cancelled", "expired"].includes(i.status) && m("error"));
392
- }, [i == null ? void 0 : i.status, m]), !r)
391
+ d && (d.status === "completed" ? u("complete") : ["failed", "cancelled", "expired"].includes(d.status) && u("error"));
392
+ }, [d == null ? void 0 : d.status, u]), !r)
393
393
  return /* @__PURE__ */ o("div", { className: `flex flex-col items-center justify-center p-8 ${t}`, style: { color: "var(--t-text)" }, children: [
394
394
  /* @__PURE__ */ e("p", { className: "text-[15px] mb-4", children: "No order found" }),
395
395
  /* @__PURE__ */ e(
@@ -397,7 +397,7 @@ function Ot({
397
397
  {
398
398
  className: "font-semibold text-[14px] transition-all",
399
399
  style: { height: 48, borderRadius: 5, background: "var(--t-surface)", color: "var(--t-text)", paddingLeft: 24, paddingRight: 24 },
400
- onClick: d,
400
+ onClick: m,
401
401
  children: "Go Back"
402
402
  }
403
403
  )
@@ -412,7 +412,7 @@ function Ot({
412
412
  {
413
413
  className: "w-full font-semibold text-[16px] transition-all",
414
414
  style: { height: 60, borderRadius: 5, background: "var(--t-cta-bg)", color: "var(--t-cta-text)" },
415
- onClick: d,
415
+ onClick: m,
416
416
  children: "Start Over"
417
417
  }
418
418
  )
@@ -434,7 +434,7 @@ function Ot({
434
434
  border: "none"
435
435
  },
436
436
  allow: ((g = r.checkout.allowedFeatures) == null ? void 0 : g.join("; ")) || "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",
437
- onLoad: () => u(!0),
437
+ onLoad: () => i(!0),
438
438
  title: "Provider Checkout"
439
439
  }
440
440
  )
@@ -472,7 +472,7 @@ function Ot({
472
472
  {
473
473
  className: "w-full font-semibold text-[14px] mt-2 transition-all",
474
474
  style: { height: 48, borderRadius: 5, background: "var(--t-surface)", color: "var(--t-text)" },
475
- onClick: d,
475
+ onClick: m,
476
476
  children: "Cancel"
477
477
  }
478
478
  )
@@ -495,7 +495,7 @@ function Ot({
495
495
  border: "none"
496
496
  },
497
497
  allow: "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",
498
- onLoad: () => u(!0),
498
+ onLoad: () => i(!0),
499
499
  title: "Payment Checkout"
500
500
  }
501
501
  )
@@ -508,7 +508,7 @@ function Ot({
508
508
  {
509
509
  className: "font-semibold text-[14px] transition-all",
510
510
  style: { height: 48, borderRadius: 5, background: "var(--t-surface)", color: "var(--t-text)", paddingLeft: 24, paddingRight: 24 },
511
- onClick: d,
511
+ onClick: m,
512
512
  children: "Go Back"
513
513
  }
514
514
  )
@@ -599,7 +599,7 @@ function Ut({
599
599
  onDone: n,
600
600
  doneButtonText: l = "Done"
601
601
  }) {
602
- const { orderStatus: r, state: i, dispatch: m } = he(), d = i.flowType === "sell", c = () => {
602
+ const { orderStatus: r, state: d, dispatch: u } = he(), m = d.flowType === "sell", c = () => {
603
603
  if (!(r != null && r.transactionHash)) return null;
604
604
  if (!a) {
605
605
  const f = {
@@ -613,11 +613,11 @@ function Ut({
613
613
  avalanche: "https://snowtrace.io/tx/{txHash}",
614
614
  fantom: "https://ftmscan.com/tx/{txHash}"
615
615
  };
616
- return (f[i.network] || f.ethereum).replace("{txHash}", r.transactionHash);
616
+ return (f[d.network] || f.ethereum).replace("{txHash}", r.transactionHash);
617
617
  }
618
618
  return a.replace("{txHash}", r.transactionHash);
619
- }, u = () => {
620
- n ? n() : m({ type: "RESET" });
619
+ }, i = () => {
620
+ n ? n() : u({ type: "RESET" });
621
621
  }, p = c();
622
622
  return /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 text-center ${t}`, children: [
623
623
  /* @__PURE__ */ e(
@@ -628,13 +628,13 @@ function Ut({
628
628
  children: /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", width: "32", height: "32", fill: "white", children: /* @__PURE__ */ e("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" }) })
629
629
  }
630
630
  ),
631
- /* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children: d ? "Sale Complete!" : "Purchase Complete!" }),
632
- /* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: d ? `Your ${(r == null ? void 0 : r.fiatCurrency) || i.fiatCurrency} payout is being processed.` : `Your ${(r == null ? void 0 : r.cryptoCurrency) || i.cryptoCurrency} has been sent to your wallet.` }),
631
+ /* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children: m ? "Sale Complete!" : "Purchase Complete!" }),
632
+ /* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: m ? `Your ${(r == null ? void 0 : r.fiatCurrency) || d.fiatCurrency} payout is being processed.` : `Your ${(r == null ? void 0 : r.cryptoCurrency) || d.cryptoCurrency} has been sent to your wallet.` }),
633
633
  r && /* @__PURE__ */ o("div", { className: "w-full text-left mb-6", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: [
634
634
  /* @__PURE__ */ e(
635
635
  q,
636
636
  {
637
- label: d ? "Amount Sold" : "Amount Received",
637
+ label: m ? "Amount Sold" : "Amount Received",
638
638
  value: `${r.cryptoAmount} ${r.cryptoCurrency}`,
639
639
  highlight: !0
640
640
  }
@@ -642,7 +642,7 @@ function Ut({
642
642
  /* @__PURE__ */ e(
643
643
  q,
644
644
  {
645
- label: d ? "Payout Amount" : "Amount Paid",
645
+ label: m ? "Payout Amount" : "Amount Paid",
646
646
  value: `${r.fiatAmount} ${r.fiatCurrency}`
647
647
  }
648
648
  ),
@@ -690,7 +690,7 @@ function Ut({
690
690
  {
691
691
  className: "w-full font-semibold text-[16px] transition-all",
692
692
  style: { height: 60, borderRadius: 5, background: "var(--t-cta-bg)", color: "var(--t-cta-text)" },
693
- onClick: u,
693
+ onClick: i,
694
694
  children: l
695
695
  }
696
696
  )
@@ -722,7 +722,7 @@ function Dt({
722
722
  onRetry: a,
723
723
  supportEmail: n = "support@nowramp.com"
724
724
  }) {
725
- const { state: l, orderStatus: r, dispatch: i, goToStep: m } = he(), d = l.flowType === "sell", c = () => {
725
+ const { state: l, orderStatus: r, dispatch: d, goToStep: u } = he(), m = l.flowType === "sell", c = () => {
726
726
  if (r)
727
727
  switch (r.status) {
728
728
  case "failed":
@@ -737,26 +737,26 @@ function Dt({
737
737
  return "Something Went Wrong";
738
738
  }
739
739
  return "Something Went Wrong";
740
- }, u = () => {
740
+ }, i = () => {
741
741
  if (l.errorMessage) return l.errorMessage;
742
742
  if (r)
743
743
  switch (r.status) {
744
744
  case "failed":
745
- return d ? "Your sale could not be processed. Please try again." : "Your payment could not be processed. Please try again or use a different payment method.";
745
+ return m ? "Your sale could not be processed. Please try again." : "Your payment could not be processed. Please try again or use a different payment method.";
746
746
  case "cancelled":
747
- return d ? "Your sale was cancelled. No crypto was transferred." : "Your order was cancelled. No payment was processed.";
747
+ return m ? "Your sale was cancelled. No crypto was transferred." : "Your order was cancelled. No payment was processed.";
748
748
  case "expired":
749
- return d ? "Your order has expired. Please start a new sale." : "Your order has expired. Please start a new purchase.";
749
+ return m ? "Your order has expired. Please start a new sale." : "Your order has expired. Please start a new purchase.";
750
750
  case "refunded":
751
- return d ? "Your crypto has been returned. The funds should appear in your wallet shortly." : "Your payment has been refunded. The funds should appear in your account within 5-10 business days.";
751
+ return m ? "Your crypto has been returned. The funds should appear in your wallet shortly." : "Your payment has been refunded. The funds should appear in your account within 5-10 business days.";
752
752
  default:
753
753
  return "An unexpected error occurred. Please try again.";
754
754
  }
755
755
  return "An unexpected error occurred. Please try again.";
756
756
  }, p = () => {
757
- i({ type: "CLEAR_ERROR" }), a ? a() : (i({ type: "RESET" }), m("amount"));
757
+ d({ type: "CLEAR_ERROR" }), a ? a() : (d({ type: "RESET" }), u("amount"));
758
758
  }, f = () => {
759
- i({ type: "RESET" }), m("amount");
759
+ d({ type: "RESET" }), u("amount");
760
760
  };
761
761
  return /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 text-center ${t}`, children: [
762
762
  /* @__PURE__ */ e(
@@ -768,7 +768,7 @@ function Dt({
768
768
  }
769
769
  ),
770
770
  /* @__PURE__ */ e("h2", { className: "text-[20px] font-semibold mb-2", style: { color: "var(--t-text)" }, children: c() }),
771
- /* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: u() }),
771
+ /* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: i() }),
772
772
  r && /* @__PURE__ */ o("div", { className: "w-full text-left mb-6", style: { background: "var(--t-surface)", borderRadius: 5, padding: 16 }, children: [
773
773
  /* @__PURE__ */ o("div", { className: "flex justify-between items-center py-2", style: { borderBottom: "1px solid var(--t-divider)" }, children: [
774
774
  /* @__PURE__ */ e("span", { className: "text-[13px]", style: { color: "var(--t-text-secondary)" }, children: "Order ID" }),
@@ -836,13 +836,13 @@ function Ft({ className: t = "" }) {
836
836
  configLoading: n,
837
837
  state: l,
838
838
  defaultGateway: r,
839
- fetchQuotes: i,
840
- createOrder: m,
841
- orderLoading: d
842
- } = he(), c = l.flowType === "sell", [u, p] = C(null), f = a == null ? void 0 : a.gateways.find((g) => g.id === r), x = async () => {
839
+ fetchQuotes: d,
840
+ createOrder: u,
841
+ orderLoading: m
842
+ } = he(), c = l.flowType === "sell", [i, p] = C(null), f = a == null ? void 0 : a.gateways.find((g) => g.id === r), x = async () => {
843
843
  p(null);
844
844
  try {
845
- i(), await m();
845
+ d(), await u();
846
846
  } catch (g) {
847
847
  const h = g instanceof Error ? g.message : "Failed to create order";
848
848
  p(h);
@@ -872,15 +872,15 @@ function Ft({ className: t = "" }) {
872
872
  /* @__PURE__ */ e(oe, { label: "Network", value: l.network }),
873
873
  c && l.walletAddress && /* @__PURE__ */ e(oe, { label: "Refund address", value: ot(l.walletAddress), mono: !0 })
874
874
  ] }),
875
- u && /* @__PURE__ */ e("p", { className: "text-[12px] mb-4", style: { color: "#EF4444" }, children: u }),
875
+ i && /* @__PURE__ */ e("p", { className: "text-[12px] mb-4", style: { color: "#EF4444" }, children: i }),
876
876
  /* @__PURE__ */ e(
877
877
  "button",
878
878
  {
879
879
  className: "w-full font-semibold text-[16px] transition-all flex items-center justify-center gap-2",
880
- style: { height: 60, borderRadius: 5, background: "var(--t-cta-bg)", color: "var(--t-cta-text)", opacity: d ? 0.7 : 1 },
881
- disabled: d,
880
+ style: { height: 60, borderRadius: 5, background: "var(--t-cta-bg)", color: "var(--t-cta-text)", opacity: m ? 0.7 : 1 },
881
+ disabled: m,
882
882
  onClick: x,
883
- children: d ? /* @__PURE__ */ o(le, { children: [
883
+ children: m ? /* @__PURE__ */ o(le, { children: [
884
884
  /* @__PURE__ */ e("span", { className: "nramp-spinner-inline" }),
885
885
  "Processing..."
886
886
  ] }) : c ? "Confirm & Sell" : "Confirm & Pay"
@@ -906,30 +906,30 @@ function De({
906
906
  onClose: a,
907
907
  children: n
908
908
  }) {
909
- const [l, r] = C(!1), [i, m] = C(!1);
909
+ const [l, r] = C(!1), [d, u] = C(!1);
910
910
  H(() => {
911
911
  if (t)
912
- r(!0), requestAnimationFrame(() => requestAnimationFrame(() => m(!0)));
912
+ r(!0), requestAnimationFrame(() => requestAnimationFrame(() => u(!0)));
913
913
  else if (l) {
914
- m(!1);
914
+ u(!1);
915
915
  const c = setTimeout(() => r(!1), 250);
916
916
  return () => clearTimeout(c);
917
917
  }
918
918
  }, [t]);
919
- const d = $(() => {
920
- m(!1), setTimeout(() => a(), 250);
919
+ const m = $(() => {
920
+ u(!1), setTimeout(() => a(), 250);
921
921
  }, [a]);
922
922
  return l ? /* @__PURE__ */ e(
923
923
  "div",
924
924
  {
925
925
  className: "absolute inset-0 z-20 transition-opacity duration-250",
926
- style: { opacity: i ? 1 : 0 },
926
+ style: { opacity: d ? 1 : 0 },
927
927
  children: /* @__PURE__ */ e(
928
928
  "div",
929
929
  {
930
930
  className: "absolute inset-0 flex flex-col transition-transform duration-250 ease-out",
931
- style: { background: "var(--t-modal-bg)", transform: i ? "translateY(0)" : "translateY(24px)" },
932
- children: typeof n == "function" ? n(d) : n
931
+ style: { background: "var(--t-modal-bg)", transform: d ? "translateY(0)" : "translateY(24px)" },
932
+ children: typeof n == "function" ? n(m) : n
933
933
  }
934
934
  )
935
935
  }
@@ -945,7 +945,7 @@ function _t({
945
945
  className: n = "",
946
946
  style: l = {}
947
947
  }) {
948
- return /* @__PURE__ */ e("span", { className: n, style: { display: "inline-flex", ...l }, children: t.split("").map((r, i) => /* @__PURE__ */ e(Kt, { char: r, height: a }, i)) });
948
+ return /* @__PURE__ */ e("span", { className: n, style: { display: "inline-flex", ...l }, children: t.split("").map((r, d) => /* @__PURE__ */ e(Kt, { char: r, height: a }, d)) });
949
949
  }
950
950
  function B({
951
951
  w: t,
@@ -1583,20 +1583,20 @@ function Xe({
1583
1583
  )
1584
1584
  ] });
1585
1585
  }
1586
- function na({ onClose: t, onSelect: a, currencies: n }) {
1587
- const [l, r] = C(""), i = X(() => {
1586
+ function na({ onClose: t, onSelect: a, currencies: n, assetBaseUrl: l = "" }) {
1587
+ const [r, d] = C(""), u = X(() => {
1588
1588
  if (!n || n.length === 0) return lt;
1589
- const d = new Map(lt.map((c) => [c.code, c.name]));
1590
- return n.map((c) => ({
1591
- code: c.code,
1592
- name: c.name || d.get(c.code) || c.code
1589
+ const c = new Map(lt.map((i) => [i.code, i.name]));
1590
+ return n.map((i) => ({
1591
+ code: i.code,
1592
+ name: i.name || c.get(i.code) || i.code
1593
1593
  }));
1594
1594
  }, [n]), m = X(() => {
1595
- const d = l.trim().toLowerCase();
1596
- return d ? i.filter(
1597
- (c) => c.code.toLowerCase().includes(d) || c.name.toLowerCase().includes(d)
1598
- ) : i;
1599
- }, [i, l]);
1595
+ const c = r.trim().toLowerCase();
1596
+ return c ? u.filter(
1597
+ (i) => i.code.toLowerCase().includes(c) || i.name.toLowerCase().includes(c)
1598
+ ) : u;
1599
+ }, [u, r]);
1600
1600
  return /* @__PURE__ */ o(le, { children: [
1601
1601
  /* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
1602
1602
  /* @__PURE__ */ e(
@@ -1607,42 +1607,42 @@ function na({ onClose: t, onSelect: a, currencies: n }) {
1607
1607
  children: "Select fiat currency"
1608
1608
  }
1609
1609
  ),
1610
- /* @__PURE__ */ e(Xe, { value: l, onChange: r }),
1610
+ /* @__PURE__ */ e(Xe, { value: r, onChange: d }),
1611
1611
  /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
1612
- m.map((d) => /* @__PURE__ */ o(
1612
+ m.map((c) => /* @__PURE__ */ o(
1613
1613
  "button",
1614
1614
  {
1615
- onClick: () => a(d.code),
1615
+ onClick: () => a(c.code),
1616
1616
  className: "flex items-center gap-3.5 w-full py-3.5 transition-colors",
1617
1617
  style: { color: "var(--t-text)" },
1618
1618
  children: [
1619
- /* @__PURE__ */ e(_e, { currencyCode: d.code, size: 32 }),
1619
+ /* @__PURE__ */ e(_e, { currencyCode: c.code, size: 32, baseUrl: l }),
1620
1620
  /* @__PURE__ */ o("div", { className: "text-left", children: [
1621
- /* @__PURE__ */ e("div", { className: "font-semibold text-[15px] leading-tight", children: d.code }),
1622
- /* @__PURE__ */ e("div", { className: "text-[13px] mt-0.5", style: { color: "var(--t-text-secondary)" }, children: d.name })
1621
+ /* @__PURE__ */ e("div", { className: "font-semibold text-[15px] leading-tight", children: c.code }),
1622
+ /* @__PURE__ */ e("div", { className: "text-[13px] mt-0.5", style: { color: "var(--t-text-secondary)" }, children: c.name })
1623
1623
  ] })
1624
1624
  ]
1625
1625
  },
1626
- d.code
1626
+ c.code
1627
1627
  )),
1628
1628
  m.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
1629
1629
  ] })
1630
1630
  ] });
1631
1631
  }
1632
1632
  function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
1633
- const [r, i] = C(""), m = X(() => {
1633
+ const [r, d] = C(""), u = X(() => {
1634
1634
  if (!n || n.length === 0) return Vt;
1635
1635
  const c = [];
1636
- for (const u of n) {
1637
- const p = u.networks || [];
1636
+ for (const i of n) {
1637
+ const p = i.networks || [];
1638
1638
  if (p.length === 0)
1639
- c.push({ code: u.code, name: u.name || u.code, chain: u.code, popular: !1 });
1639
+ c.push({ code: i.code, name: i.name || i.code, chain: i.code, popular: !1 });
1640
1640
  else
1641
1641
  for (const f of p) {
1642
- const x = f.code || f.id || f.name || u.code;
1642
+ const x = f.code || f.id || f.name || i.code;
1643
1643
  c.push({
1644
- code: u.code,
1645
- name: u.name || u.code,
1644
+ code: i.code,
1645
+ name: i.name || i.code,
1646
1646
  chain: x,
1647
1647
  chainName: f.name,
1648
1648
  popular: !1
@@ -1650,19 +1650,19 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
1650
1650
  }
1651
1651
  }
1652
1652
  return c;
1653
- }, [n]), d = X(() => {
1653
+ }, [n]), m = X(() => {
1654
1654
  var f;
1655
1655
  const c = r.trim().toLowerCase();
1656
- if (!c) return m;
1657
- const u = c.split(/\s+/), p = [];
1658
- for (const x of m) {
1656
+ if (!c) return u;
1657
+ const i = c.split(/\s+/), p = [];
1658
+ for (const x of u) {
1659
1659
  const g = Re[x.chain], h = g ? g.name.toLowerCase() : "", b = ((f = g == null ? void 0 : g.shortName) == null ? void 0 : f.toLowerCase()) || "", L = x.chain.toLowerCase(), O = x.code.toLowerCase(), A = x.name.toLowerCase(), G = [O, A, h, b, L];
1660
- if (!u.every((Z) => G.some((s) => s.includes(Z)))) continue;
1660
+ if (!i.every((Z) => G.some((s) => s.includes(Z)))) continue;
1661
1661
  let W = 0;
1662
- O === c ? W += 100 : O.startsWith(u[0]) && (W += 50), x.popular && (W += 10), u.length > 1 && (h.includes(u[1]) || b.includes(u[1]) || L.includes(u[1])) && (W += 25), p.push({ item: x, score: W });
1662
+ O === c ? W += 100 : O.startsWith(i[0]) && (W += 50), x.popular && (W += 10), i.length > 1 && (h.includes(i[1]) || b.includes(i[1]) || L.includes(i[1])) && (W += 25), p.push({ item: x, score: W });
1663
1663
  }
1664
1664
  return p.sort((x, g) => g.score - x.score), p.map((x) => x.item);
1665
- }, [m, r]);
1665
+ }, [u, r]);
1666
1666
  return /* @__PURE__ */ o(le, { children: [
1667
1667
  /* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
1668
1668
  /* @__PURE__ */ e(
@@ -1673,10 +1673,10 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
1673
1673
  children: "Select crypto currency"
1674
1674
  }
1675
1675
  ),
1676
- /* @__PURE__ */ e(Xe, { value: r, onChange: i }),
1676
+ /* @__PURE__ */ e(Xe, { value: r, onChange: d }),
1677
1677
  /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
1678
- d.map((c) => {
1679
- const u = Re[c.chain], p = (u == null ? void 0 : u.name) || c.chainName || c.chain;
1678
+ m.map((c) => {
1679
+ const i = Re[c.chain], p = (i == null ? void 0 : i.name) || c.chainName || c.chain;
1680
1680
  return /* @__PURE__ */ o(
1681
1681
  "button",
1682
1682
  {
@@ -1730,7 +1730,7 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
1730
1730
  `${c.code}-${c.chain}`
1731
1731
  );
1732
1732
  }),
1733
- d.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
1733
+ m.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-10 text-[14px]", style: { color: "var(--t-text-muted)" }, children: "No currencies found" })
1734
1734
  ] })
1735
1735
  ] });
1736
1736
  }
@@ -1793,11 +1793,11 @@ function ca({
1793
1793
  /* @__PURE__ */ e(oa, { checked: a, onChange: n, accentColor: "#4CD964" })
1794
1794
  ] }) }),
1795
1795
  /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider)" } }),
1796
- la.map((i) => /* @__PURE__ */ o("div", { children: [
1796
+ la.map((d) => /* @__PURE__ */ o("div", { children: [
1797
1797
  /* @__PURE__ */ o(
1798
1798
  "a",
1799
1799
  {
1800
- href: i.href,
1800
+ href: d.href,
1801
1801
  target: "_blank",
1802
1802
  rel: "noopener noreferrer",
1803
1803
  className: "flex items-center justify-between w-full py-5 transition-colors",
@@ -1807,7 +1807,7 @@ function ca({
1807
1807
  {
1808
1808
  className: "font-medium text-[15px]",
1809
1809
  style: { color: "var(--t-text)" },
1810
- children: i.label
1810
+ children: d.label
1811
1811
  }
1812
1812
  ),
1813
1813
  /* @__PURE__ */ e(ea, {})
@@ -1815,7 +1815,7 @@ function ca({
1815
1815
  }
1816
1816
  ),
1817
1817
  /* @__PURE__ */ e("div", { style: { height: 1, background: "var(--t-divider)" } })
1818
- ] }, i.label))
1818
+ ] }, d.label))
1819
1819
  ] })
1820
1820
  ] });
1821
1821
  }
@@ -1825,11 +1825,11 @@ function sa({
1825
1825
  skinId: n = "mono",
1826
1826
  accentColor: l,
1827
1827
  bgColor: r,
1828
- bgImage: i,
1829
- borderColor: m,
1830
- borderRadius: d,
1828
+ bgImage: d,
1829
+ borderColor: u,
1830
+ borderRadius: m,
1831
1831
  showFlowToggle: c = !0,
1832
- autoRedirect: u = !1,
1832
+ autoRedirect: i = !1,
1833
1833
  explorerUrl: p,
1834
1834
  doneButtonText: f = "Done",
1835
1835
  supportEmail: x,
@@ -1949,10 +1949,10 @@ function sa({
1949
1949
  "--t-cta-bg": Me.accent,
1950
1950
  "--t-cta-text": "#ffffff"
1951
1951
  }, re = {};
1952
- r && Fe(r) ? re.backgroundColor = r : re.backgroundColor = "var(--t-bg)", i && (re.backgroundImage = `url(${i})`, re.backgroundSize = "cover", re.backgroundPosition = "center");
1952
+ r && Fe(r) ? re.backgroundColor = r : re.backgroundColor = "var(--t-bg)", d && (re.backgroundImage = `url(${d})`, re.backgroundSize = "cover", re.backgroundPosition = "center");
1953
1953
  const we = {};
1954
- m && Fe(m) && (we.border = `1px solid ${m}`), d && (we.borderRadius = d);
1955
- const Qe = h.step === "checkout" ? /* @__PURE__ */ e(Ot, { autoRedirect: u }) : h.step === "processing" ? /* @__PURE__ */ e(Ht, {}) : h.step === "complete" ? /* @__PURE__ */ e(Ut, { explorerUrl: p, doneButtonText: f, onDone: g }) : h.step === "error" ? /* @__PURE__ */ e(Dt, { supportEmail: x }) : h.step === "confirm" ? /* @__PURE__ */ e(Ft, {}) : null;
1954
+ u && Fe(u) && (we.border = `1px solid ${u}`), m && (we.borderRadius = m);
1955
+ const Qe = h.step === "checkout" ? /* @__PURE__ */ e(Ot, { autoRedirect: i }) : h.step === "processing" ? /* @__PURE__ */ e(Ht, {}) : h.step === "complete" ? /* @__PURE__ */ e(Ut, { explorerUrl: p, doneButtonText: f, onDone: g }) : h.step === "error" ? /* @__PURE__ */ e(Dt, { supportEmail: x }) : h.step === "confirm" ? /* @__PURE__ */ e(Ft, {}) : null;
1956
1956
  if (Qe)
1957
1957
  return /* @__PURE__ */ e(
1958
1958
  "div",
@@ -2250,7 +2250,8 @@ function sa({
2250
2250
  onSelect: (T) => {
2251
2251
  Nt(T), y();
2252
2252
  },
2253
- currencies: (E = L == null ? void 0 : L.fiats) == null ? void 0 : E.map((T) => ({ code: T.code, name: T.code }))
2253
+ currencies: (E = L == null ? void 0 : L.fiats) == null ? void 0 : E.map((T) => ({ code: T.code, name: T.code })),
2254
+ assetBaseUrl: D
2254
2255
  }
2255
2256
  );
2256
2257
  } }),
@@ -2297,11 +2298,11 @@ function ia({
2297
2298
  assetBaseUrl: n,
2298
2299
  flowType: l,
2299
2300
  customerId: r,
2300
- defaultFiatCurrency: i,
2301
- defaultCryptoCurrency: m,
2302
- defaultNetwork: d,
2301
+ defaultFiatCurrency: d,
2302
+ defaultCryptoCurrency: u,
2303
+ defaultNetwork: m,
2303
2304
  defaultFiatAmount: c,
2304
- defaultCryptoAmount: u,
2305
+ defaultCryptoAmount: i,
2305
2306
  defaultWalletAddress: p,
2306
2307
  defaultGateway: f,
2307
2308
  fieldLocks: x,
@@ -2331,11 +2332,11 @@ function ia({
2331
2332
  assetBaseUrl: n,
2332
2333
  flowType: l,
2333
2334
  customerId: r,
2334
- defaultFiatCurrency: i,
2335
- defaultCryptoCurrency: m,
2336
- defaultNetwork: d,
2335
+ defaultFiatCurrency: d,
2336
+ defaultCryptoCurrency: u,
2337
+ defaultNetwork: m,
2337
2338
  defaultFiatAmount: c,
2338
- defaultCryptoAmount: u,
2339
+ defaultCryptoAmount: i,
2339
2340
  defaultWalletAddress: p,
2340
2341
  defaultGateway: f,
2341
2342
  fieldLocks: x,
@@ -2378,21 +2379,21 @@ function ba({
2378
2379
  darkMode: l,
2379
2380
  dimmed: r
2380
2381
  }) {
2381
- const i = t.accent === null, m = 32;
2382
+ const d = t.accent === null, u = 32;
2382
2383
  return /* @__PURE__ */ o(
2383
2384
  "button",
2384
2385
  {
2385
2386
  onClick: n,
2386
2387
  className: "relative shrink-0",
2387
- style: { width: m, height: m, opacity: r ? 0.4 : 1, transition: "opacity 0.2s" },
2388
+ style: { width: u, height: u, opacity: r ? 0.4 : 1, transition: "opacity 0.2s" },
2388
2389
  children: [
2389
- i ? /* @__PURE__ */ o("svg", { width: m, height: m, viewBox: "0 0 32 32", children: [
2390
+ d ? /* @__PURE__ */ o("svg", { width: u, height: u, viewBox: "0 0 32 32", children: [
2390
2391
  /* @__PURE__ */ e("clipPath", { id: "mono-left", children: /* @__PURE__ */ e("rect", { x: "0", y: "0", width: "16", height: "32" }) }),
2391
2392
  /* @__PURE__ */ e("clipPath", { id: "mono-right", children: /* @__PURE__ */ e("rect", { x: "16", y: "0", width: "16", height: "32" }) }),
2392
2393
  /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: "#111111", clipPath: "url(#mono-left)" }),
2393
2394
  /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: "#ffffff", clipPath: "url(#mono-right)" }),
2394
2395
  /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: "none", stroke: l ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.1)", strokeWidth: "1" })
2395
- ] }) : /* @__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 }) }),
2396
+ ] }) : /* @__PURE__ */ e("svg", { width: u, height: u, viewBox: "0 0 32 32", children: /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "15", fill: t.accent }) }),
2396
2397
  a && !r && /* @__PURE__ */ e(
2397
2398
  "div",
2398
2399
  {
@@ -2457,11 +2458,11 @@ function Ea({
2457
2458
  quotesLoading: l,
2458
2459
  cryptoCurrency: r
2459
2460
  }) {
2460
- const [i, m] = C(""), d = X(() => {
2461
+ const [d, u] = C(""), m = X(() => {
2461
2462
  if (!(n != null && n.quotes)) return [];
2462
- const c = i.trim().toLowerCase();
2463
- return c ? n.quotes.filter((u) => u.gatewayName.toLowerCase().includes(c)) : n.quotes;
2464
- }, [n, i]);
2463
+ const c = d.trim().toLowerCase();
2464
+ return c ? n.quotes.filter((i) => i.gatewayName.toLowerCase().includes(c)) : n.quotes;
2465
+ }, [n, d]);
2465
2466
  return /* @__PURE__ */ o(le, { children: [
2466
2467
  /* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
2467
2468
  /* @__PURE__ */ e(
@@ -2472,10 +2473,10 @@ function Ea({
2472
2473
  children: "Choose Ramp"
2473
2474
  }
2474
2475
  ),
2475
- /* @__PURE__ */ e(Xe, { value: i, onChange: m }),
2476
+ /* @__PURE__ */ e(Xe, { value: d, onChange: u }),
2476
2477
  /* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5 space-y-2", children: [
2477
- l ? /* @__PURE__ */ e(ma, {}) : d.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" }) : d.map((c, u) => {
2478
- const p = u === 0, f = parseFloat(c.cryptoAmount), x = f >= 1 ? f.toFixed(4) : f.toPrecision(6);
2478
+ l ? /* @__PURE__ */ e(ma, {}) : m.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" }) : m.map((c, i) => {
2479
+ const p = i === 0, f = parseFloat(c.cryptoAmount), x = f >= 1 ? f.toFixed(4) : f.toPrecision(6);
2479
2480
  return /* @__PURE__ */ o(
2480
2481
  "button",
2481
2482
  {