@nowramp/form 0.1.35 → 0.1.36
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 +288 -207
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +10 -10
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21,10 +21,10 @@ function Rt(t, a) {
|
|
|
21
21
|
}
|
|
22
22
|
d(!0), m(null);
|
|
23
23
|
try {
|
|
24
|
-
const
|
|
25
|
-
l(
|
|
26
|
-
} catch (
|
|
27
|
-
m(
|
|
24
|
+
const h = await c.current.getSupported(a);
|
|
25
|
+
l(h);
|
|
26
|
+
} catch (h) {
|
|
27
|
+
m(h instanceof Error ? h : new Error("Failed to fetch config"));
|
|
28
28
|
} finally {
|
|
29
29
|
d(!1);
|
|
30
30
|
}
|
|
@@ -34,8 +34,8 @@ function Rt(t, a) {
|
|
|
34
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, d] = C(!1), [u, m] = C(null), c = U(null), i = U(""),
|
|
38
|
-
(!c.current || i.current !==
|
|
37
|
+
const [n, l] = C(null), [r, d] = C(!1), [u, m] = C(null), c = U(null), i = U(""), h = `${t.apiUrl}|${t.projectId}`;
|
|
38
|
+
(!c.current || i.current !== h) && (c.current = new ke({ apiKey: "", ...t }), i.current = h);
|
|
39
39
|
const f = U(0);
|
|
40
40
|
H(() => {
|
|
41
41
|
const g = ++f.current;
|
|
@@ -44,11 +44,11 @@ function kt(t, a) {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
d(!0), m(null), c.current.getQuotes(a).then(
|
|
47
|
-
(
|
|
48
|
-
f.current === g && (l(
|
|
47
|
+
(p) => {
|
|
48
|
+
f.current === g && (l(p), d(!1));
|
|
49
49
|
},
|
|
50
|
-
(
|
|
51
|
-
f.current === g && (m(
|
|
50
|
+
(p) => {
|
|
51
|
+
f.current === g && (m(p instanceof Error ? p : 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]);
|
|
@@ -70,26 +70,26 @@ function kt(t, a) {
|
|
|
70
70
|
function Lt(t) {
|
|
71
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
72
|
(!m.current || c.current !== i) && (m.current = new ke({ apiKey: "", ...t }), c.current = i);
|
|
73
|
-
const
|
|
73
|
+
const h = $(async (x) => {
|
|
74
74
|
r(!0), u(null);
|
|
75
75
|
try {
|
|
76
76
|
const g = await m.current.createCheckoutIntent(x);
|
|
77
77
|
return n(g), g;
|
|
78
78
|
} catch (g) {
|
|
79
|
-
const
|
|
80
|
-
throw u(
|
|
79
|
+
const p = g instanceof Error ? g : new Error("Failed to create checkout intent");
|
|
80
|
+
throw u(p), p;
|
|
81
81
|
} finally {
|
|
82
82
|
r(!1);
|
|
83
83
|
}
|
|
84
84
|
}, []), f = $(() => {
|
|
85
85
|
n(null), u(null);
|
|
86
86
|
}, []);
|
|
87
|
-
return { order: a, loading: l, error: d, createOrder:
|
|
87
|
+
return { order: a, loading: l, error: d, createOrder: h, reset: f };
|
|
88
88
|
}
|
|
89
89
|
function It(t, a, n) {
|
|
90
90
|
const [l, r] = C(null), [d, u] = C(!1), [m, c] = C(null), i = U(null);
|
|
91
91
|
i.current || (i.current = new ke({ apiKey: "", projectId: "", ...t }));
|
|
92
|
-
const
|
|
92
|
+
const h = $(async () => {
|
|
93
93
|
if (a) {
|
|
94
94
|
u(!0), c(null);
|
|
95
95
|
try {
|
|
@@ -106,16 +106,16 @@ function It(t, a, n) {
|
|
|
106
106
|
if (!a) return;
|
|
107
107
|
const f = (n == null ? void 0 : n.initialDelay) ?? 0;
|
|
108
108
|
if (f > 0) {
|
|
109
|
-
const x = setTimeout(
|
|
109
|
+
const x = setTimeout(h, f);
|
|
110
110
|
return () => clearTimeout(x);
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
}, [
|
|
112
|
+
h();
|
|
113
|
+
}, [h, a, n == null ? void 0 : n.initialDelay]), H(() => {
|
|
114
114
|
if (!a || !(n != null && n.pollInterval) || !l || ["completed", "failed", "cancelled", "expired", "refunded"].includes(l.status))
|
|
115
115
|
return;
|
|
116
|
-
const x = setInterval(
|
|
116
|
+
const x = setInterval(h, n.pollInterval);
|
|
117
117
|
return () => clearInterval(x);
|
|
118
|
-
}, [a, n == null ? void 0 : n.pollInterval, l == null ? void 0 : l.status,
|
|
118
|
+
}, [a, n == null ? void 0 : n.pollInterval, l == null ? void 0 : l.status, h]), { status: l, loading: d, error: m, refetch: h };
|
|
119
119
|
}
|
|
120
120
|
function rt(t, a) {
|
|
121
121
|
if (!t) return t;
|
|
@@ -196,7 +196,7 @@ function Bt(t, a) {
|
|
|
196
196
|
return t;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
const
|
|
199
|
+
const pt = Tt(null);
|
|
200
200
|
function Mt({
|
|
201
201
|
projectId: t,
|
|
202
202
|
apiUrl: a = "https://api.nowramp.com",
|
|
@@ -208,15 +208,15 @@ function Mt({
|
|
|
208
208
|
defaultNetwork: m = "",
|
|
209
209
|
defaultFiatAmount: c = "",
|
|
210
210
|
defaultCryptoAmount: i = "",
|
|
211
|
-
defaultWalletAddress:
|
|
211
|
+
defaultWalletAddress: h = "",
|
|
212
212
|
defaultGateway: f,
|
|
213
213
|
fieldLocks: x,
|
|
214
214
|
statusPollInterval: g = 5e3,
|
|
215
|
-
onComplete:
|
|
215
|
+
onComplete: p,
|
|
216
216
|
onError: b,
|
|
217
217
|
children: L
|
|
218
218
|
}) {
|
|
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 &&
|
|
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 && h)) && f ? "confirm" : "amount", [s, P] = St(Bt, {
|
|
220
220
|
...mt,
|
|
221
221
|
step: Z,
|
|
222
222
|
flowType: l,
|
|
@@ -225,7 +225,7 @@ function Mt({
|
|
|
225
225
|
network: A,
|
|
226
226
|
fiatAmount: rt(c, 2),
|
|
227
227
|
cryptoAmount: rt(i, 6),
|
|
228
|
-
walletAddress:
|
|
228
|
+
walletAddress: h,
|
|
229
229
|
customerId: r
|
|
230
230
|
}), v = s.flowType === "sell", {
|
|
231
231
|
config: I,
|
|
@@ -263,7 +263,7 @@ function Mt({
|
|
|
263
263
|
orderType: s.flowType
|
|
264
264
|
};
|
|
265
265
|
}, [I, s.fiatCurrency, s.fiatAmount, s.cryptoAmount, s.cryptoCurrency, s.network, s.paymentMethodId, s.country, K, v, s.flowType]), {
|
|
266
|
-
quotes:
|
|
266
|
+
quotes: he,
|
|
267
267
|
loading: fe,
|
|
268
268
|
error: Y,
|
|
269
269
|
refetch: ye
|
|
@@ -281,15 +281,15 @@ function Mt({
|
|
|
281
281
|
{ pollInterval: g, initialDelay: Ne }
|
|
282
282
|
);
|
|
283
283
|
Ue.useEffect(() => {
|
|
284
|
-
(V == null ? void 0 : V.status) === "completed" &&
|
|
285
|
-
}, [V == null ? void 0 : V.status,
|
|
284
|
+
(V == null ? void 0 : V.status) === "completed" && p && p(V);
|
|
285
|
+
}, [V == null ? void 0 : V.status, p]), Ue.useEffect(() => {
|
|
286
286
|
const N = F || ce;
|
|
287
287
|
N && b && b(N);
|
|
288
288
|
}, [F, ce, b]);
|
|
289
289
|
const ae = f || (I == null ? void 0 : I.defaultGateway) || null, Ce = U(ae);
|
|
290
290
|
Ce.current = ae;
|
|
291
|
-
const be = U(
|
|
292
|
-
be.current =
|
|
291
|
+
const be = U(he);
|
|
292
|
+
be.current = he;
|
|
293
293
|
const Ee = $(async () => {
|
|
294
294
|
var S, R, k;
|
|
295
295
|
const N = ((S = s.selectedQuote) == null ? void 0 : S.gatewayId) || ((k = (R = be.current) == null ? void 0 : R.bestQuote) == null ? void 0 : k.gatewayId) || Ce.current;
|
|
@@ -301,7 +301,7 @@ function Mt({
|
|
|
301
301
|
try {
|
|
302
302
|
await se({
|
|
303
303
|
gateway: N,
|
|
304
|
-
|
|
304
|
+
customerId: s.customerId || void 0,
|
|
305
305
|
fiatCurrency: s.fiatCurrency,
|
|
306
306
|
...v ? { cryptoAmount: s.cryptoAmount } : { fiatAmount: s.fiatAmount },
|
|
307
307
|
cryptoCurrency: s.cryptoCurrency,
|
|
@@ -342,7 +342,7 @@ function Mt({
|
|
|
342
342
|
configError: F,
|
|
343
343
|
state: s,
|
|
344
344
|
dispatch: P,
|
|
345
|
-
quotes:
|
|
345
|
+
quotes: he,
|
|
346
346
|
quotesLoading: fe,
|
|
347
347
|
quotesError: Y,
|
|
348
348
|
fetchQuotes: ye,
|
|
@@ -359,10 +359,10 @@ function Mt({
|
|
|
359
359
|
goBack: ie,
|
|
360
360
|
canProceed: Ie
|
|
361
361
|
};
|
|
362
|
-
return /* @__PURE__ */ e(
|
|
362
|
+
return /* @__PURE__ */ e(pt.Provider, { value: xe, children: L });
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
const t = wt(
|
|
364
|
+
function pe() {
|
|
365
|
+
const t = wt(pt);
|
|
366
366
|
if (!t)
|
|
367
367
|
throw new Error("useRamp must be used within a RampProvider");
|
|
368
368
|
return t;
|
|
@@ -374,145 +374,226 @@ function Ot({
|
|
|
374
374
|
redirectDelay: l = 3e3
|
|
375
375
|
}) {
|
|
376
376
|
var g;
|
|
377
|
-
const { order: r, orderStatus: d, goToStep: u, goBack: m } =
|
|
377
|
+
const { order: r, orderStatus: d, goToStep: u, goBack: m } = pe(), [c, i] = C(!1), [h, 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));
|
|
381
|
-
const
|
|
381
|
+
const p = setTimeout(() => {
|
|
382
382
|
window.location.href = r.checkout.url;
|
|
383
383
|
}, l), b = setInterval(() => {
|
|
384
384
|
f((L) => L && L > 1 ? L - 1 : null);
|
|
385
385
|
}, 1e3);
|
|
386
386
|
return () => {
|
|
387
|
-
clearTimeout(
|
|
387
|
+
clearTimeout(p), clearInterval(b);
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
}, [r, n, l, x]), H(() => {
|
|
391
391
|
d && (d.status === "completed" ? u("complete") : ["failed", "cancelled", "expired"].includes(d.status) && u("error"));
|
|
392
392
|
}, [d == null ? void 0 : d.status, u]), !r)
|
|
393
|
-
return /* @__PURE__ */ o(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
393
|
+
return /* @__PURE__ */ o(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
className: `flex flex-col items-center justify-center p-8 ${t}`,
|
|
397
|
+
style: { color: "var(--t-text)" },
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ e("p", { className: "text-[15px] mb-4", children: "No order found" }),
|
|
400
|
+
/* @__PURE__ */ e(
|
|
401
|
+
"button",
|
|
402
|
+
{
|
|
403
|
+
className: "font-semibold text-[14px] transition-all",
|
|
404
|
+
style: {
|
|
405
|
+
height: 48,
|
|
406
|
+
borderRadius: 5,
|
|
407
|
+
background: "var(--t-surface)",
|
|
408
|
+
color: "var(--t-text)",
|
|
409
|
+
paddingLeft: 24,
|
|
410
|
+
paddingRight: 24
|
|
411
|
+
},
|
|
412
|
+
onClick: m,
|
|
413
|
+
children: "Go Back"
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
);
|
|
405
419
|
if (x)
|
|
406
|
-
return /* @__PURE__ */ o(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
className: "
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
+
return /* @__PURE__ */ o(
|
|
421
|
+
"div",
|
|
422
|
+
{
|
|
423
|
+
className: `flex flex-col items-center justify-center p-8 text-center ${t}`,
|
|
424
|
+
style: { color: "var(--t-text)" },
|
|
425
|
+
children: [
|
|
426
|
+
/* @__PURE__ */ e("h3", { className: "text-[18px] font-semibold mb-2", children: "Checkout expired" }),
|
|
427
|
+
/* @__PURE__ */ e("p", { className: "text-[14px] mb-6", style: { color: "var(--t-text-secondary)" }, children: "The session has expired. Please try again." }),
|
|
428
|
+
/* @__PURE__ */ e(
|
|
429
|
+
"button",
|
|
430
|
+
{
|
|
431
|
+
className: "w-full font-semibold text-[16px] transition-all",
|
|
432
|
+
style: {
|
|
433
|
+
height: 60,
|
|
434
|
+
borderRadius: 5,
|
|
435
|
+
background: "var(--t-cta-bg)",
|
|
436
|
+
color: "var(--t-cta-text)"
|
|
437
|
+
},
|
|
438
|
+
onClick: m,
|
|
439
|
+
children: "Start over"
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
]
|
|
443
|
+
}
|
|
444
|
+
);
|
|
420
445
|
if (r.checkout.method === "iframe")
|
|
421
|
-
return /* @__PURE__ */ e("div", { className: `flex flex-col flex-1 ${t}`, children: /* @__PURE__ */ o(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
},
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
446
|
+
return /* @__PURE__ */ e("div", { className: `flex flex-col flex-1 ${t}`, children: /* @__PURE__ */ o(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
className: "relative flex-1",
|
|
450
|
+
style: {
|
|
451
|
+
height: a,
|
|
452
|
+
borderRadius: 5,
|
|
453
|
+
overflow: "hidden",
|
|
454
|
+
background: "var(--t-surface)"
|
|
455
|
+
},
|
|
456
|
+
children: [
|
|
457
|
+
!c && /* @__PURE__ */ o("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
458
|
+
/* @__PURE__ */ e("div", { className: "nramp-spinner" }),
|
|
459
|
+
/* @__PURE__ */ e("p", { className: "text-[14px] mt-4", style: { color: "var(--t-text-secondary)" }, children: "Loading checkout..." })
|
|
460
|
+
] }),
|
|
461
|
+
/* @__PURE__ */ e(
|
|
462
|
+
"iframe",
|
|
463
|
+
{
|
|
464
|
+
src: r.checkout.url,
|
|
465
|
+
style: {
|
|
466
|
+
display: c ? "block" : "none",
|
|
467
|
+
width: "100%",
|
|
468
|
+
height: "100%",
|
|
469
|
+
border: "none"
|
|
470
|
+
},
|
|
471
|
+
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",
|
|
472
|
+
onLoad: () => i(!0),
|
|
473
|
+
title: "Provider Checkout"
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
) });
|
|
442
479
|
if (r.checkout.method === "redirect")
|
|
443
|
-
return /* @__PURE__ */ o(
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
+
return /* @__PURE__ */ o(
|
|
481
|
+
"div",
|
|
482
|
+
{
|
|
483
|
+
className: `flex flex-col items-center justify-center p-8 text-center ${t}`,
|
|
484
|
+
style: { color: "var(--t-text)" },
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ e("div", { className: "text-[48px] mb-4", children: "🔗" }),
|
|
487
|
+
/* @__PURE__ */ e("h3", { className: "text-[18px] font-semibold mb-2", children: "Complete Payment" }),
|
|
488
|
+
/* @__PURE__ */ o("p", { className: "text-[14px] mb-4", style: { color: "var(--t-text-secondary)" }, children: [
|
|
489
|
+
"You'll be redirected to ",
|
|
490
|
+
r.gateway,
|
|
491
|
+
" to complete your payment."
|
|
492
|
+
] }),
|
|
493
|
+
h !== null && /* @__PURE__ */ o("p", { className: "text-[13px] mb-4", style: { color: "var(--t-text-muted)" }, children: [
|
|
494
|
+
"Redirecting in ",
|
|
495
|
+
h,
|
|
496
|
+
"..."
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ o(
|
|
499
|
+
"a",
|
|
500
|
+
{
|
|
501
|
+
href: r.checkout.url,
|
|
502
|
+
className: "w-full font-semibold text-[16px] flex items-center justify-center transition-all",
|
|
503
|
+
style: {
|
|
504
|
+
height: 60,
|
|
505
|
+
borderRadius: 5,
|
|
506
|
+
background: "var(--t-cta-bg)",
|
|
507
|
+
color: "var(--t-cta-text)",
|
|
508
|
+
textDecoration: "none"
|
|
509
|
+
},
|
|
510
|
+
target: "_blank",
|
|
511
|
+
rel: "noopener noreferrer",
|
|
512
|
+
children: [
|
|
513
|
+
"Continue to ",
|
|
514
|
+
r.gateway
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ e(
|
|
519
|
+
"button",
|
|
520
|
+
{
|
|
521
|
+
className: "w-full font-semibold text-[14px] mt-2 transition-all",
|
|
522
|
+
style: {
|
|
523
|
+
height: 48,
|
|
524
|
+
borderRadius: 5,
|
|
525
|
+
background: "var(--t-surface)",
|
|
526
|
+
color: "var(--t-text)"
|
|
527
|
+
},
|
|
528
|
+
onClick: m,
|
|
529
|
+
children: "Cancel"
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
);
|
|
480
535
|
if (r.checkout.method === "widget" && r.widgetConfig) {
|
|
481
|
-
const
|
|
482
|
-
return /* @__PURE__ */ e("div", { className: `flex flex-col flex-1 ${t}`, children: /* @__PURE__ */ o(
|
|
483
|
-
|
|
484
|
-
/* @__PURE__ */ e("div", { className: "nramp-spinner" }),
|
|
485
|
-
/* @__PURE__ */ e("p", { className: "text-[14px] mt-4", style: { color: "var(--t-text-secondary)" }, children: "Loading checkout..." })
|
|
486
|
-
] }),
|
|
487
|
-
/* @__PURE__ */ e(
|
|
488
|
-
"iframe",
|
|
489
|
-
{
|
|
490
|
-
src: h,
|
|
491
|
-
style: {
|
|
492
|
-
display: c ? "block" : "none",
|
|
493
|
-
width: "100%",
|
|
494
|
-
height: "100%",
|
|
495
|
-
border: "none"
|
|
496
|
-
},
|
|
497
|
-
allow: "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",
|
|
498
|
-
onLoad: () => i(!0),
|
|
499
|
-
title: "Payment Checkout"
|
|
500
|
-
}
|
|
501
|
-
)
|
|
502
|
-
] }) });
|
|
503
|
-
}
|
|
504
|
-
return /* @__PURE__ */ o("div", { className: `flex flex-col items-center justify-center p-8 ${t}`, style: { color: "var(--t-text)" }, children: [
|
|
505
|
-
/* @__PURE__ */ e("p", { className: "text-[15px] mb-4", children: "Unknown checkout method" }),
|
|
506
|
-
/* @__PURE__ */ e(
|
|
507
|
-
"button",
|
|
536
|
+
const p = Pt(r.checkout.url, r.widgetConfig);
|
|
537
|
+
return /* @__PURE__ */ e("div", { className: `flex flex-col flex-1 ${t}`, children: /* @__PURE__ */ o(
|
|
538
|
+
"div",
|
|
508
539
|
{
|
|
509
|
-
className: "
|
|
510
|
-
style: {
|
|
511
|
-
|
|
512
|
-
|
|
540
|
+
className: "relative flex-1",
|
|
541
|
+
style: {
|
|
542
|
+
height: a,
|
|
543
|
+
borderRadius: 5,
|
|
544
|
+
overflow: "hidden",
|
|
545
|
+
background: "var(--t-surface)"
|
|
546
|
+
},
|
|
547
|
+
children: [
|
|
548
|
+
!c && /* @__PURE__ */ o("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
549
|
+
/* @__PURE__ */ e("div", { className: "nramp-spinner" }),
|
|
550
|
+
/* @__PURE__ */ e("p", { className: "text-[14px] mt-4", style: { color: "var(--t-text-secondary)" }, children: "Loading checkout..." })
|
|
551
|
+
] }),
|
|
552
|
+
/* @__PURE__ */ e(
|
|
553
|
+
"iframe",
|
|
554
|
+
{
|
|
555
|
+
src: p,
|
|
556
|
+
style: {
|
|
557
|
+
display: c ? "block" : "none",
|
|
558
|
+
width: "100%",
|
|
559
|
+
height: "100%",
|
|
560
|
+
border: "none"
|
|
561
|
+
},
|
|
562
|
+
allow: "payment; camera; microphone; geolocation; clipboard-read; clipboard-write; accelerometer; gyroscope; magnetometer; fullscreen; autoplay; encrypted-media; web-share",
|
|
563
|
+
onLoad: () => i(!0),
|
|
564
|
+
title: "Payment Checkout"
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
]
|
|
513
568
|
}
|
|
514
|
-
)
|
|
515
|
-
|
|
569
|
+
) });
|
|
570
|
+
}
|
|
571
|
+
return /* @__PURE__ */ o(
|
|
572
|
+
"div",
|
|
573
|
+
{
|
|
574
|
+
className: `flex flex-col items-center justify-center p-8 ${t}`,
|
|
575
|
+
style: { color: "var(--t-text)" },
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ e("p", { className: "text-[15px] mb-4", children: "Unknown checkout method" }),
|
|
578
|
+
/* @__PURE__ */ e(
|
|
579
|
+
"button",
|
|
580
|
+
{
|
|
581
|
+
className: "font-semibold text-[14px] transition-all",
|
|
582
|
+
style: {
|
|
583
|
+
height: 48,
|
|
584
|
+
borderRadius: 5,
|
|
585
|
+
background: "var(--t-surface)",
|
|
586
|
+
color: "var(--t-text)",
|
|
587
|
+
paddingLeft: 24,
|
|
588
|
+
paddingRight: 24
|
|
589
|
+
},
|
|
590
|
+
onClick: m,
|
|
591
|
+
children: "Go Back"
|
|
592
|
+
}
|
|
593
|
+
)
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
);
|
|
516
597
|
}
|
|
517
598
|
function Pt(t, a) {
|
|
518
599
|
const n = new URL("/en/partner/widget", t);
|
|
@@ -521,7 +602,7 @@ function Pt(t, a) {
|
|
|
521
602
|
return n.toString();
|
|
522
603
|
}
|
|
523
604
|
function Ht({ className: t = "" }) {
|
|
524
|
-
const { orderStatus: a, orderStatusLoading: n, goToStep: l } =
|
|
605
|
+
const { orderStatus: a, orderStatusLoading: n, goToStep: l } = pe();
|
|
525
606
|
H(() => {
|
|
526
607
|
a && (a.status === "completed" ? l("complete") : ["failed", "cancelled", "expired", "refunded"].includes(a.status) && l("error"));
|
|
527
608
|
}, [a == null ? void 0 : a.status, l]);
|
|
@@ -599,7 +680,7 @@ function Ut({
|
|
|
599
680
|
onDone: n,
|
|
600
681
|
doneButtonText: l = "Done"
|
|
601
682
|
}) {
|
|
602
|
-
const { orderStatus: r, state: d, dispatch: u } =
|
|
683
|
+
const { orderStatus: r, state: d, dispatch: u } = pe(), m = d.flowType === "sell", c = () => {
|
|
603
684
|
if (!(r != null && r.transactionHash)) return null;
|
|
604
685
|
if (!a) {
|
|
605
686
|
const f = {
|
|
@@ -618,7 +699,7 @@ function Ut({
|
|
|
618
699
|
return a.replace("{txHash}", r.transactionHash);
|
|
619
700
|
}, i = () => {
|
|
620
701
|
n ? n() : u({ type: "RESET" });
|
|
621
|
-
},
|
|
702
|
+
}, h = c();
|
|
622
703
|
return /* @__PURE__ */ o("div", { className: `flex flex-col items-center px-8 py-12 text-center ${t}`, children: [
|
|
623
704
|
/* @__PURE__ */ e(
|
|
624
705
|
"div",
|
|
@@ -674,10 +755,10 @@ function Ut({
|
|
|
674
755
|
)
|
|
675
756
|
] }),
|
|
676
757
|
/* @__PURE__ */ o("div", { className: "w-full flex flex-col gap-2", children: [
|
|
677
|
-
|
|
758
|
+
h && /* @__PURE__ */ e(
|
|
678
759
|
"a",
|
|
679
760
|
{
|
|
680
|
-
href:
|
|
761
|
+
href: h,
|
|
681
762
|
target: "_blank",
|
|
682
763
|
rel: "noopener noreferrer",
|
|
683
764
|
className: "w-full font-semibold text-[14px] flex items-center justify-center transition-all",
|
|
@@ -722,7 +803,7 @@ function Dt({
|
|
|
722
803
|
onRetry: a,
|
|
723
804
|
supportEmail: n = "support@nowramp.com"
|
|
724
805
|
}) {
|
|
725
|
-
const { state: l, orderStatus: r, dispatch: d, goToStep: u } =
|
|
806
|
+
const { state: l, orderStatus: r, dispatch: d, goToStep: u } = pe(), m = l.flowType === "sell", c = () => {
|
|
726
807
|
if (r)
|
|
727
808
|
switch (r.status) {
|
|
728
809
|
case "failed":
|
|
@@ -753,7 +834,7 @@ function Dt({
|
|
|
753
834
|
return "An unexpected error occurred. Please try again.";
|
|
754
835
|
}
|
|
755
836
|
return "An unexpected error occurred. Please try again.";
|
|
756
|
-
},
|
|
837
|
+
}, h = () => {
|
|
757
838
|
d({ type: "CLEAR_ERROR" }), a ? a() : (d({ type: "RESET" }), u("amount"));
|
|
758
839
|
}, f = () => {
|
|
759
840
|
d({ type: "RESET" }), u("amount");
|
|
@@ -792,7 +873,7 @@ function Dt({
|
|
|
792
873
|
{
|
|
793
874
|
className: "w-full font-semibold text-[16px] transition-all",
|
|
794
875
|
style: { height: 60, borderRadius: 5, background: "var(--t-cta-bg)", color: "var(--t-cta-text)" },
|
|
795
|
-
onClick:
|
|
876
|
+
onClick: h,
|
|
796
877
|
children: "Try Again"
|
|
797
878
|
}
|
|
798
879
|
),
|
|
@@ -839,13 +920,13 @@ function Ft({ className: t = "" }) {
|
|
|
839
920
|
fetchQuotes: d,
|
|
840
921
|
createOrder: u,
|
|
841
922
|
orderLoading: m
|
|
842
|
-
} =
|
|
843
|
-
|
|
923
|
+
} = pe(), c = l.flowType === "sell", [i, h] = C(null), f = a == null ? void 0 : a.gateways.find((g) => g.id === r), x = async () => {
|
|
924
|
+
h(null);
|
|
844
925
|
try {
|
|
845
926
|
d(), await u();
|
|
846
927
|
} catch (g) {
|
|
847
|
-
const
|
|
848
|
-
p
|
|
928
|
+
const p = g instanceof Error ? g.message : "Failed to create order";
|
|
929
|
+
h(p);
|
|
849
930
|
}
|
|
850
931
|
};
|
|
851
932
|
return n ? /* @__PURE__ */ o("div", { className: `flex flex-col items-center justify-center p-12 ${t}`, children: [
|
|
@@ -1324,7 +1405,7 @@ const Re = {
|
|
|
1324
1405
|
ARS: "ar",
|
|
1325
1406
|
ALL: "al"
|
|
1326
1407
|
};
|
|
1327
|
-
function
|
|
1408
|
+
function ht(t, a = "") {
|
|
1328
1409
|
return `${a}/crypto-icons/${t.toLowerCase()}.svg`;
|
|
1329
1410
|
}
|
|
1330
1411
|
function Wt(t, a = "") {
|
|
@@ -1391,7 +1472,7 @@ function ut({ ticker: t, size: a = 32, baseUrl: n = "" }) {
|
|
|
1391
1472
|
return /* @__PURE__ */ e(
|
|
1392
1473
|
"img",
|
|
1393
1474
|
{
|
|
1394
|
-
src:
|
|
1475
|
+
src: ht(t, n),
|
|
1395
1476
|
alt: t,
|
|
1396
1477
|
width: a,
|
|
1397
1478
|
height: a,
|
|
@@ -1634,11 +1715,11 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
|
|
|
1634
1715
|
if (!n || n.length === 0) return Vt;
|
|
1635
1716
|
const c = [];
|
|
1636
1717
|
for (const i of n) {
|
|
1637
|
-
const
|
|
1638
|
-
if (
|
|
1718
|
+
const h = i.networks || [];
|
|
1719
|
+
if (h.length === 0)
|
|
1639
1720
|
c.push({ code: i.code, name: i.name || i.code, chain: i.code, popular: !1 });
|
|
1640
1721
|
else
|
|
1641
|
-
for (const f of
|
|
1722
|
+
for (const f of h) {
|
|
1642
1723
|
const x = f.code || f.id || f.name || i.code;
|
|
1643
1724
|
c.push({
|
|
1644
1725
|
code: i.code,
|
|
@@ -1654,14 +1735,14 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
|
|
|
1654
1735
|
var f;
|
|
1655
1736
|
const c = r.trim().toLowerCase();
|
|
1656
1737
|
if (!c) return u;
|
|
1657
|
-
const i = c.split(/\s+/),
|
|
1738
|
+
const i = c.split(/\s+/), h = [];
|
|
1658
1739
|
for (const x of u) {
|
|
1659
|
-
const g = Re[x.chain],
|
|
1740
|
+
const g = Re[x.chain], p = 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, p, b, L];
|
|
1660
1741
|
if (!i.every((Z) => G.some((s) => s.includes(Z)))) continue;
|
|
1661
1742
|
let W = 0;
|
|
1662
|
-
O === c ? W += 100 : O.startsWith(i[0]) && (W += 50), x.popular && (W += 10), i.length > 1 && (
|
|
1743
|
+
O === c ? W += 100 : O.startsWith(i[0]) && (W += 50), x.popular && (W += 10), i.length > 1 && (p.includes(i[1]) || b.includes(i[1]) || L.includes(i[1])) && (W += 25), h.push({ item: x, score: W });
|
|
1663
1744
|
}
|
|
1664
|
-
return
|
|
1745
|
+
return h.sort((x, g) => g.score - x.score), h.map((x) => x.item);
|
|
1665
1746
|
}, [u, r]);
|
|
1666
1747
|
return /* @__PURE__ */ o(le, { children: [
|
|
1667
1748
|
/* @__PURE__ */ e("div", { className: "flex justify-end px-5 pt-5", children: /* @__PURE__ */ e(Le, { onClick: t }) }),
|
|
@@ -1676,7 +1757,7 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
|
|
|
1676
1757
|
/* @__PURE__ */ e(Xe, { value: r, onChange: d }),
|
|
1677
1758
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5", children: [
|
|
1678
1759
|
m.map((c) => {
|
|
1679
|
-
const i = Re[c.chain],
|
|
1760
|
+
const i = Re[c.chain], h = (i == null ? void 0 : i.name) || c.chainName || c.chain;
|
|
1680
1761
|
return /* @__PURE__ */ o(
|
|
1681
1762
|
"button",
|
|
1682
1763
|
{
|
|
@@ -1687,7 +1768,7 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
|
|
|
1687
1768
|
/* @__PURE__ */ e(
|
|
1688
1769
|
"img",
|
|
1689
1770
|
{
|
|
1690
|
-
src:
|
|
1771
|
+
src: ht(c.code, l),
|
|
1691
1772
|
alt: c.code,
|
|
1692
1773
|
width: 32,
|
|
1693
1774
|
height: 32,
|
|
@@ -1724,7 +1805,7 @@ function ra({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: l = "" }) {
|
|
|
1724
1805
|
),
|
|
1725
1806
|
/* @__PURE__ */ e("div", { className: "text-[13px] mt-0.5", style: { color: "var(--t-text-secondary)" }, children: c.name })
|
|
1726
1807
|
] }),
|
|
1727
|
-
/* @__PURE__ */ e("div", { className: "text-right shrink-0", children: /* @__PURE__ */ e("div", { className: "text-[13px]", style: { color: "var(--t-text-muted)" }, children:
|
|
1808
|
+
/* @__PURE__ */ e("div", { className: "text-right shrink-0", children: /* @__PURE__ */ e("div", { className: "text-[13px]", style: { color: "var(--t-text-muted)" }, children: h }) })
|
|
1728
1809
|
]
|
|
1729
1810
|
},
|
|
1730
1811
|
`${c.code}-${c.chain}`
|
|
@@ -1830,14 +1911,14 @@ function sa({
|
|
|
1830
1911
|
borderRadius: m,
|
|
1831
1912
|
showFlowToggle: c = !0,
|
|
1832
1913
|
autoRedirect: i = !1,
|
|
1833
|
-
explorerUrl:
|
|
1914
|
+
explorerUrl: h,
|
|
1834
1915
|
doneButtonText: f = "Done",
|
|
1835
1916
|
supportEmail: x,
|
|
1836
1917
|
onDone: g
|
|
1837
1918
|
}) {
|
|
1838
1919
|
var Je, ze, qe, et, tt, at, nt;
|
|
1839
1920
|
const {
|
|
1840
|
-
state:
|
|
1921
|
+
state: p,
|
|
1841
1922
|
dispatch: b,
|
|
1842
1923
|
config: L,
|
|
1843
1924
|
configLoading: O,
|
|
@@ -1851,21 +1932,21 @@ function sa({
|
|
|
1851
1932
|
fieldLocks: v,
|
|
1852
1933
|
apiConfig: I,
|
|
1853
1934
|
assetBaseUrl: D
|
|
1854
|
-
} =
|
|
1935
|
+
} = pe(), [F, K] = C(a === "dark"), [ge, he] = C(n), [fe, Y] = C(null), [ye, ee] = C(!1), [ve, ce] = C(!1), [se, Ne] = C(!1), [V, te] = C(null), [ae, Ce] = C(!0), [be, Ee] = C(!1), [J, ie] = C(!1), Ie = U(null), xe = U(), N = U(p.flowType);
|
|
1855
1936
|
H(() => {
|
|
1856
1937
|
K(a === "dark");
|
|
1857
1938
|
}, [a]), H(() => {
|
|
1858
1939
|
const y = setTimeout(() => Ce(!1), O ? 0 : 800);
|
|
1859
1940
|
return () => clearTimeout(y);
|
|
1860
1941
|
}, [O]), H(() => {
|
|
1861
|
-
if (N.current !==
|
|
1862
|
-
N.current =
|
|
1942
|
+
if (N.current !== p.flowType && !ae) {
|
|
1943
|
+
N.current = p.flowType, Ee(!0), ee(!1), ce(!1);
|
|
1863
1944
|
const y = setTimeout(() => Ee(!1), 350);
|
|
1864
1945
|
return () => clearTimeout(y);
|
|
1865
1946
|
}
|
|
1866
|
-
N.current =
|
|
1867
|
-
}, [
|
|
1868
|
-
const S =
|
|
1947
|
+
N.current = p.flowType;
|
|
1948
|
+
}, [p.flowType, ae]);
|
|
1949
|
+
const S = p.flowType, R = S === "buy", k = p.cryptoCurrency || "BTC", w = p.fiatCurrency || "USD", _ = R ? p.fiatAmount : p.cryptoAmount, ne = Yt(_), de = (Je = A == null ? void 0 : A.bestQuote) != null && Je.exchangeRate ? parseFloat(A.bestQuote.exchangeRate) : null, Ae = U(null);
|
|
1869
1950
|
de && k && w && (Ae.current = { rate: de, crypto: k, fiat: w });
|
|
1870
1951
|
const yt = X(() => {
|
|
1871
1952
|
if (A != null && A.bestQuote) {
|
|
@@ -1879,7 +1960,7 @@ function sa({
|
|
|
1879
1960
|
return !y || !E || !T ? "" : `1 ${E} ≈ ${y.toFixed(2)} ${T}`;
|
|
1880
1961
|
}, [k, w, de]);
|
|
1881
1962
|
H(() => {
|
|
1882
|
-
const y =
|
|
1963
|
+
const y = p.walletAddress.trim(), E = p.network;
|
|
1883
1964
|
if (!y || y.length < 10) {
|
|
1884
1965
|
te(null), b({ type: "SET_WALLET_ERROR", message: "" });
|
|
1885
1966
|
return;
|
|
@@ -1905,8 +1986,8 @@ function sa({
|
|
|
1905
1986
|
Ne(!1);
|
|
1906
1987
|
}
|
|
1907
1988
|
}, 500), () => clearTimeout(xe.current);
|
|
1908
|
-
}, [
|
|
1909
|
-
const $e = !_ || ne === 0, Ge = ne > 0 && (R ? ne < it : ne < dt), We = !!P || Ge || ye && $e, gt = ne > 0 && !P && !Ge, Be =
|
|
1989
|
+
}, [p.walletAddress, p.network, I.apiUrl]);
|
|
1990
|
+
const $e = !_ || ne === 0, Ge = ne > 0 && (R ? ne < it : ne < dt), We = !!P || Ge || ye && $e, gt = ne > 0 && !P && !Ge, Be = p.walletAddress.trim().length >= 10 && V !== !1 && !se, Se = gt && Be && !!p.cryptoCurrency && !!p.network, vt = (y) => {
|
|
1910
1991
|
let E = y.target.value.replace(/[^0-9.,]/g, "");
|
|
1911
1992
|
const T = R ? 2 : 6, M = E.indexOf(".");
|
|
1912
1993
|
M !== -1 && E.length - M - 1 > T && (E = E.slice(0, M + T + 1)), b(R ? { type: "SET_FIAT_AMOUNT", amount: E } : { type: "SET_CRYPTO_AMOUNT", amount: E });
|
|
@@ -1952,7 +2033,7 @@ function sa({
|
|
|
1952
2033
|
r && Fe(r) ? re.backgroundColor = r : re.backgroundColor = "var(--t-bg)", d && (re.backgroundImage = `url(${d})`, re.backgroundSize = "cover", re.backgroundPosition = "center");
|
|
1953
2034
|
const we = {};
|
|
1954
2035
|
u && Fe(u) && (we.border = `1px solid ${u}`), m && (we.borderRadius = m);
|
|
1955
|
-
const Qe =
|
|
2036
|
+
const Qe = p.step === "checkout" ? /* @__PURE__ */ e(Ot, { autoRedirect: i }) : p.step === "processing" ? /* @__PURE__ */ e(Ht, {}) : p.step === "complete" ? /* @__PURE__ */ e(Ut, { explorerUrl: h, doneButtonText: f, onDone: g }) : p.step === "error" ? /* @__PURE__ */ e(Dt, { supportEmail: x }) : p.step === "confirm" ? /* @__PURE__ */ e(Ft, {}) : null;
|
|
1956
2037
|
if (Qe)
|
|
1957
2038
|
return /* @__PURE__ */ e(
|
|
1958
2039
|
"div",
|
|
@@ -1967,7 +2048,7 @@ function sa({
|
|
|
1967
2048
|
children: Qe
|
|
1968
2049
|
}
|
|
1969
2050
|
);
|
|
1970
|
-
const Q =
|
|
2051
|
+
const Q = p.network, ue = Q ? Re[Q] : null, Ze = (ue == null ? void 0 : ue.shortName) || (ue == null ? void 0 : ue.name) || Q;
|
|
1971
2052
|
return /* @__PURE__ */ o(
|
|
1972
2053
|
"div",
|
|
1973
2054
|
{
|
|
@@ -2201,7 +2282,7 @@ function sa({
|
|
|
2201
2282
|
"input",
|
|
2202
2283
|
{
|
|
2203
2284
|
type: "text",
|
|
2204
|
-
value:
|
|
2285
|
+
value: p.walletAddress,
|
|
2205
2286
|
onChange: (y) => b({ type: "SET_WALLET_ADDRESS", address: y.target.value }),
|
|
2206
2287
|
onBlur: () => ce(!0),
|
|
2207
2288
|
placeholder: "Enter your wallet address",
|
|
@@ -2209,7 +2290,7 @@ function sa({
|
|
|
2209
2290
|
autoComplete: "off",
|
|
2210
2291
|
className: "w-full bg-transparent text-[13px] outline-none transition-colors",
|
|
2211
2292
|
style: {
|
|
2212
|
-
border:
|
|
2293
|
+
border: p.walletError || ve && !Be ? "1px solid #EF4444" : "1px solid var(--t-border)",
|
|
2213
2294
|
borderRadius: 3.5,
|
|
2214
2295
|
height: 47,
|
|
2215
2296
|
paddingLeft: 14,
|
|
@@ -2219,7 +2300,7 @@ function sa({
|
|
|
2219
2300
|
disabled: !!((nt = v == null ? void 0 : v.destinationAddress) != null && nt.locked)
|
|
2220
2301
|
}
|
|
2221
2302
|
),
|
|
2222
|
-
|
|
2303
|
+
p.walletError ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: p.walletError }) : ve && !Be && !se ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: "Enter a valid wallet address" }) : se && p.walletAddress.trim().length >= 10 ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "var(--t-text-muted)" }, children: "Validating address..." }) : null
|
|
2223
2304
|
] }),
|
|
2224
2305
|
/* @__PURE__ */ e("div", { className: "flex-1" }),
|
|
2225
2306
|
/* @__PURE__ */ e(
|
|
@@ -2284,7 +2365,7 @@ function sa({
|
|
|
2284
2365
|
onToggleDarkMode: K,
|
|
2285
2366
|
skinId: ge,
|
|
2286
2367
|
onSelectSkin: (E) => {
|
|
2287
|
-
|
|
2368
|
+
he(E);
|
|
2288
2369
|
}
|
|
2289
2370
|
}
|
|
2290
2371
|
) })
|
|
@@ -2303,11 +2384,11 @@ function ia({
|
|
|
2303
2384
|
defaultNetwork: m,
|
|
2304
2385
|
defaultFiatAmount: c,
|
|
2305
2386
|
defaultCryptoAmount: i,
|
|
2306
|
-
defaultWalletAddress:
|
|
2387
|
+
defaultWalletAddress: h,
|
|
2307
2388
|
defaultGateway: f,
|
|
2308
2389
|
fieldLocks: x,
|
|
2309
2390
|
statusPollInterval: g,
|
|
2310
|
-
onComplete:
|
|
2391
|
+
onComplete: p,
|
|
2311
2392
|
onError: b,
|
|
2312
2393
|
className: L,
|
|
2313
2394
|
theme: O,
|
|
@@ -2337,11 +2418,11 @@ function ia({
|
|
|
2337
2418
|
defaultNetwork: m,
|
|
2338
2419
|
defaultFiatAmount: c,
|
|
2339
2420
|
defaultCryptoAmount: i,
|
|
2340
|
-
defaultWalletAddress:
|
|
2421
|
+
defaultWalletAddress: h,
|
|
2341
2422
|
defaultGateway: f,
|
|
2342
2423
|
fieldLocks: x,
|
|
2343
2424
|
statusPollInterval: g,
|
|
2344
|
-
onComplete:
|
|
2425
|
+
onComplete: p,
|
|
2345
2426
|
onError: b,
|
|
2346
2427
|
children: /* @__PURE__ */ e(
|
|
2347
2428
|
sa,
|
|
@@ -2476,19 +2557,19 @@ function Ea({
|
|
|
2476
2557
|
/* @__PURE__ */ e(Xe, { value: d, onChange: u }),
|
|
2477
2558
|
/* @__PURE__ */ o("div", { className: "flex-1 overflow-y-auto custom-scroll px-5 space-y-2", children: [
|
|
2478
2559
|
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
|
|
2560
|
+
const h = i === 0, f = parseFloat(c.cryptoAmount), x = f >= 1 ? f.toFixed(4) : f.toPrecision(6);
|
|
2480
2561
|
return /* @__PURE__ */ o(
|
|
2481
2562
|
"button",
|
|
2482
2563
|
{
|
|
2483
2564
|
onClick: () => a(c),
|
|
2484
2565
|
className: "w-full flex items-center gap-3.5 transition-colors",
|
|
2485
2566
|
style: {
|
|
2486
|
-
borderRadius:
|
|
2487
|
-
height:
|
|
2567
|
+
borderRadius: h ? 4.5 : 5,
|
|
2568
|
+
height: h ? 63 : 64,
|
|
2488
2569
|
paddingLeft: 16,
|
|
2489
2570
|
paddingRight: 16,
|
|
2490
|
-
border:
|
|
2491
|
-
background:
|
|
2571
|
+
border: h ? "1px solid var(--t-border)" : "1px solid transparent",
|
|
2572
|
+
background: h ? "transparent" : "var(--t-surface)"
|
|
2492
2573
|
},
|
|
2493
2574
|
children: [
|
|
2494
2575
|
/* @__PURE__ */ e(ua, { quote: c }),
|
|
@@ -2569,14 +2650,14 @@ export {
|
|
|
2569
2650
|
oa as ToggleSwitch,
|
|
2570
2651
|
ga as formatOutput,
|
|
2571
2652
|
Ke as getChainIconUrl,
|
|
2572
|
-
|
|
2653
|
+
ht as getCryptoIconUrl,
|
|
2573
2654
|
Wt as getFiatFlagUrl,
|
|
2574
2655
|
xa as getMockRate,
|
|
2575
2656
|
Na as getPaymentIcon,
|
|
2576
2657
|
Yt as parseAmount,
|
|
2577
2658
|
Lt as useCheckoutIntent,
|
|
2578
2659
|
kt as useQuotes,
|
|
2579
|
-
|
|
2660
|
+
pe as useRamp,
|
|
2580
2661
|
Rt as useRampConfig,
|
|
2581
2662
|
It as useTransaction
|
|
2582
2663
|
};
|