@nowramp/form 0.1.39 → 0.1.40
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 +174 -174
- package/dist/index.js.map +1 -1
- package/dist/nowramp-form.iife.js +7 -7
- package/dist/nowramp-form.iife.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
document.head.appendChild(s);
|
|
10
10
|
})();
|
|
11
11
|
import { jsx as e, jsxs as l, Fragment as J } from "react/jsx-runtime";
|
|
12
|
-
import ke, { useState as
|
|
12
|
+
import ke, { useState as N, useRef as D, useCallback as _, useEffect as U, useMemo as F, useReducer as Rt, useContext as kt, createContext as Lt } from "react";
|
|
13
13
|
import { RampApi as Me } from "@nowramp/sdk";
|
|
14
14
|
function It(t, a) {
|
|
15
|
-
const [n, s] =
|
|
15
|
+
const [n, s] = N(null), [r, u] = N(!0), [m, i] = N(null), o = D(null);
|
|
16
16
|
(!o.current || o.current !== t) && (o.current = new Me({ apiKey: "", ...t }));
|
|
17
|
-
const d =
|
|
17
|
+
const d = _(async () => {
|
|
18
18
|
if (!t.projectId) {
|
|
19
19
|
i(new Error("projectId is required")), u(!1);
|
|
20
20
|
return;
|
|
@@ -29,15 +29,15 @@ function It(t, a) {
|
|
|
29
29
|
u(!1);
|
|
30
30
|
}
|
|
31
31
|
}, [t.projectId, a]);
|
|
32
|
-
return
|
|
32
|
+
return U(() => {
|
|
33
33
|
d();
|
|
34
34
|
}, [d]), { config: n, loading: r, error: m, refetch: d };
|
|
35
35
|
}
|
|
36
36
|
function Mt(t, a) {
|
|
37
|
-
const [n, s] =
|
|
37
|
+
const [n, s] = N(null), [r, u] = N(!1), [m, i] = N(null), o = D(null), d = D(""), h = `${t.apiUrl}|${t.projectId}`;
|
|
38
38
|
(!o.current || d.current !== h) && (o.current = new Me({ apiKey: "", ...t }), d.current = h);
|
|
39
|
-
const f =
|
|
40
|
-
|
|
39
|
+
const f = D(0);
|
|
40
|
+
U(() => {
|
|
41
41
|
const g = ++f.current;
|
|
42
42
|
if (!a || !t.projectId) {
|
|
43
43
|
s(null), u(!1);
|
|
@@ -52,7 +52,7 @@ function Mt(t, a) {
|
|
|
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
|
-
const x =
|
|
55
|
+
const x = _(async () => {
|
|
56
56
|
if (!(!a || !t.projectId)) {
|
|
57
57
|
u(!0), i(null);
|
|
58
58
|
try {
|
|
@@ -68,9 +68,9 @@ function Mt(t, a) {
|
|
|
68
68
|
return { quotes: n, loading: r, error: m, refetch: x };
|
|
69
69
|
}
|
|
70
70
|
function Bt(t) {
|
|
71
|
-
const [a, n] =
|
|
71
|
+
const [a, n] = N(null), [s, r] = N(!1), [u, m] = N(null), i = D(null), o = D(""), d = `${t.apiUrl}|${t.projectId}`;
|
|
72
72
|
(!i.current || o.current !== d) && (i.current = new Me({ apiKey: "", ...t }), o.current = d);
|
|
73
|
-
const h =
|
|
73
|
+
const h = _(async (x) => {
|
|
74
74
|
r(!0), m(null);
|
|
75
75
|
try {
|
|
76
76
|
const g = await i.current.createCheckoutIntent(x);
|
|
@@ -81,15 +81,15 @@ function Bt(t) {
|
|
|
81
81
|
} finally {
|
|
82
82
|
r(!1);
|
|
83
83
|
}
|
|
84
|
-
}, []), f =
|
|
84
|
+
}, []), f = _(() => {
|
|
85
85
|
n(null), m(null);
|
|
86
86
|
}, []);
|
|
87
87
|
return { order: a, loading: s, error: u, createOrder: h, reset: f };
|
|
88
88
|
}
|
|
89
89
|
function Ot(t, a, n) {
|
|
90
|
-
const [s, r] =
|
|
90
|
+
const [s, r] = N(null), [u, m] = N(!1), [i, o] = N(null), d = D(null);
|
|
91
91
|
d.current || (d.current = new Me({ apiKey: "", projectId: "", ...t }));
|
|
92
|
-
const h =
|
|
92
|
+
const h = _(async () => {
|
|
93
93
|
if (a) {
|
|
94
94
|
m(!0), o(null);
|
|
95
95
|
try {
|
|
@@ -102,7 +102,7 @@ function Ot(t, a, n) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}, [a]);
|
|
105
|
-
return
|
|
105
|
+
return U(() => {
|
|
106
106
|
if (!a) return;
|
|
107
107
|
const f = (n == null ? void 0 : n.initialDelay) ?? 0;
|
|
108
108
|
if (f > 0) {
|
|
@@ -110,7 +110,7 @@ function Ot(t, a, n) {
|
|
|
110
110
|
return () => clearTimeout(x);
|
|
111
111
|
}
|
|
112
112
|
h();
|
|
113
|
-
}, [h, a, n == null ? void 0 : n.initialDelay]),
|
|
113
|
+
}, [h, a, n == null ? void 0 : n.initialDelay]), U(() => {
|
|
114
114
|
if (!a || !(n != null && n.pollInterval) || !s || ["completed", "failed", "cancelled", "expired", "refunded"].includes(s.status))
|
|
115
115
|
return;
|
|
116
116
|
const x = setInterval(h, n.pollInterval);
|
|
@@ -217,7 +217,7 @@ function Ht({
|
|
|
217
217
|
onError: b,
|
|
218
218
|
children: T
|
|
219
219
|
}) {
|
|
220
|
-
const
|
|
220
|
+
const P = F(() => ({ apiUrl: a, projectId: t }), [a, t]), w = i || (m ? m.toLowerCase() : ""), G = s === "sell", Q = G ? !!d : !!o, z = (G ? !!(Q && m && w) : !!(Q && m && w && h)) && f ? "confirm" : "amount", [c, O] = Rt(Pt, {
|
|
221
221
|
...ht,
|
|
222
222
|
step: z,
|
|
223
223
|
flowType: s,
|
|
@@ -228,63 +228,63 @@ function Ht({
|
|
|
228
228
|
cryptoAmount: lt(d, 6),
|
|
229
229
|
walletAddress: h,
|
|
230
230
|
customerId: r
|
|
231
|
-
}),
|
|
231
|
+
}), C = c.flowType === "sell", {
|
|
232
232
|
config: L,
|
|
233
|
-
loading:
|
|
234
|
-
error:
|
|
235
|
-
} = It(
|
|
233
|
+
loading: K,
|
|
234
|
+
error: X
|
|
235
|
+
} = It(P, c.flowType);
|
|
236
236
|
ke.useEffect(() => {
|
|
237
|
-
var S,
|
|
237
|
+
var S, k, R;
|
|
238
238
|
if (!L || !c.cryptoCurrency || c.network) return;
|
|
239
|
-
const v = (S = L.cryptos) == null ? void 0 : S.find((
|
|
239
|
+
const v = (S = L.cryptos) == null ? void 0 : S.find((H) => H.code === c.cryptoCurrency), E = ((k = v == null ? void 0 : v.networks) == null ? void 0 : k.find((H) => H.isDefault)) || ((R = v == null ? void 0 : v.networks) == null ? void 0 : R[0]);
|
|
240
240
|
E != null && E.id && O({ type: "SET_NETWORK", network: E.id });
|
|
241
241
|
}, [L, c.cryptoCurrency, c.network]), ke.useEffect(() => {
|
|
242
|
-
var
|
|
243
|
-
if (!((
|
|
242
|
+
var k, R;
|
|
243
|
+
if (!((k = L == null ? void 0 : L.paymentMethods) != null && k.length)) return;
|
|
244
244
|
const v = c.fiatCurrency, E = L.paymentMethods;
|
|
245
245
|
if (c.paymentMethodId && E.some(
|
|
246
|
-
(
|
|
246
|
+
(W) => W.id === c.paymentMethodId && W.supportedFiats.includes(v)
|
|
247
247
|
))
|
|
248
248
|
return;
|
|
249
|
-
const S = E.find((
|
|
250
|
-
O({ type: "SET_PAYMENT_METHOD", methodId: (S == null ? void 0 : S.id) || ((
|
|
249
|
+
const S = E.find((H) => H.supportedFiats.includes(v));
|
|
250
|
+
O({ type: "SET_PAYMENT_METHOD", methodId: (S == null ? void 0 : S.id) || ((R = E[0]) == null ? void 0 : R.id) || "" });
|
|
251
251
|
}, [L, c.fiatCurrency, c.paymentMethodId]);
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
252
|
+
const $ = F(() => {
|
|
253
|
+
if (C) {
|
|
254
254
|
if (!c.cryptoAmount) return null;
|
|
255
|
-
const
|
|
256
|
-
return isNaN(
|
|
255
|
+
const R = parseFloat(c.cryptoAmount);
|
|
256
|
+
return isNaN(R) || R <= 0 ? "Enter a valid amount" : null;
|
|
257
257
|
}
|
|
258
258
|
if (!L || !c.fiatAmount) return null;
|
|
259
259
|
const v = parseFloat(c.fiatAmount);
|
|
260
260
|
if (isNaN(v)) return null;
|
|
261
|
-
const E = L.fiats.find((
|
|
261
|
+
const E = L.fiats.find((R) => R.code === c.fiatCurrency);
|
|
262
262
|
if (!E) return null;
|
|
263
|
-
const S = parseFloat(E.minAmount),
|
|
264
|
-
return !isNaN(S) && v < S ? `Minimum amount is ${E.minAmount} ${c.fiatCurrency}` : !isNaN(
|
|
265
|
-
}, [L, c.fiatAmount, c.fiatCurrency, c.cryptoAmount,
|
|
266
|
-
const v =
|
|
267
|
-
return !L || !v || !c.cryptoCurrency || !c.network ||
|
|
263
|
+
const S = parseFloat(E.minAmount), k = parseFloat(E.maxAmount);
|
|
264
|
+
return !isNaN(S) && v < S ? `Minimum amount is ${E.minAmount} ${c.fiatCurrency}` : !isNaN(k) && v > k ? `Maximum amount is ${E.maxAmount} ${c.fiatCurrency}` : null;
|
|
265
|
+
}, [L, c.fiatAmount, c.fiatCurrency, c.cryptoAmount, C]), Ne = F(() => {
|
|
266
|
+
const v = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
267
|
+
return !L || !v || !c.cryptoCurrency || !c.network || $ ? null : {
|
|
268
268
|
fiatCurrency: c.fiatCurrency,
|
|
269
|
-
...
|
|
269
|
+
...C ? { cryptoAmount: c.cryptoAmount } : { fiatAmount: c.fiatAmount },
|
|
270
270
|
cryptoCurrency: c.cryptoCurrency,
|
|
271
271
|
network: c.network,
|
|
272
272
|
paymentMethodId: c.paymentMethodId || void 0,
|
|
273
273
|
country: c.country || void 0,
|
|
274
274
|
orderType: c.flowType
|
|
275
275
|
};
|
|
276
|
-
}, [L, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country,
|
|
276
|
+
}, [L, c.fiatCurrency, c.fiatAmount, c.cryptoAmount, c.cryptoCurrency, c.network, c.paymentMethodId, c.country, $, C, c.flowType]), {
|
|
277
277
|
quotes: he,
|
|
278
278
|
loading: fe,
|
|
279
|
-
error:
|
|
279
|
+
error: Y,
|
|
280
280
|
refetch: ye
|
|
281
|
-
} = Mt(
|
|
281
|
+
} = Mt(P, Ne), {
|
|
282
282
|
order: ae,
|
|
283
283
|
loading: Ce,
|
|
284
284
|
error: se,
|
|
285
285
|
createOrder: ce
|
|
286
|
-
} = Bt(
|
|
287
|
-
status:
|
|
286
|
+
} = Bt(P), be = 15e3, {
|
|
287
|
+
status: V,
|
|
288
288
|
loading: ne
|
|
289
289
|
} = Ot(
|
|
290
290
|
{ apiUrl: a },
|
|
@@ -292,21 +292,21 @@ function Ht({
|
|
|
292
292
|
{ pollInterval: g, initialDelay: be }
|
|
293
293
|
);
|
|
294
294
|
ke.useEffect(() => {
|
|
295
|
-
(
|
|
296
|
-
}, [
|
|
297
|
-
const v =
|
|
295
|
+
(V == null ? void 0 : V.status) === "completed" && p && p(V);
|
|
296
|
+
}, [V == null ? void 0 : V.status, p]), ke.useEffect(() => {
|
|
297
|
+
const v = X || se;
|
|
298
298
|
v && b && b(v);
|
|
299
|
-
}, [
|
|
300
|
-
const re = f || (L == null ? void 0 : L.defaultGateway) || null, Ee =
|
|
299
|
+
}, [X, se, b]);
|
|
300
|
+
const re = f || (L == null ? void 0 : L.defaultGateway) || null, Ee = D(re);
|
|
301
301
|
Ee.current = re;
|
|
302
|
-
const Ae =
|
|
302
|
+
const Ae = D(he);
|
|
303
303
|
Ae.current = he;
|
|
304
|
-
const we =
|
|
305
|
-
var
|
|
306
|
-
const v = ((
|
|
307
|
-
if (!v ||
|
|
308
|
-
const
|
|
309
|
-
O({ type: "SET_ERROR", message: `Missing required fields: ${
|
|
304
|
+
const we = _(async () => {
|
|
305
|
+
var E, S, k;
|
|
306
|
+
const v = ((E = c.selectedQuote) == null ? void 0 : E.gatewayId) || ((k = (S = Ae.current) == null ? void 0 : S.bestQuote) == null ? void 0 : k.gatewayId) || Ee.current;
|
|
307
|
+
if (!v || !c.walletAddress) {
|
|
308
|
+
const R = [!v && "gateway", !c.walletAddress && "walletAddress"].filter(Boolean).join(", ");
|
|
309
|
+
O({ type: "SET_ERROR", message: `Missing required fields: ${R}` });
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
312
|
try {
|
|
@@ -314,30 +314,30 @@ function Ht({
|
|
|
314
314
|
gateway: v,
|
|
315
315
|
customerId: c.customerId || void 0,
|
|
316
316
|
fiatCurrency: c.fiatCurrency,
|
|
317
|
-
...
|
|
317
|
+
...C ? { cryptoAmount: c.cryptoAmount } : { fiatAmount: c.fiatAmount },
|
|
318
318
|
cryptoCurrency: c.cryptoCurrency,
|
|
319
319
|
network: c.network,
|
|
320
|
-
walletAddress: c.walletAddress
|
|
320
|
+
walletAddress: c.walletAddress,
|
|
321
321
|
paymentMethodId: c.paymentMethodId || void 0,
|
|
322
322
|
email: c.email || void 0,
|
|
323
323
|
orderType: c.flowType
|
|
324
324
|
}), O({ type: "SET_STEP", step: "checkout" });
|
|
325
|
-
} catch (
|
|
326
|
-
const
|
|
327
|
-
/wallet|address/i.test(
|
|
325
|
+
} catch (R) {
|
|
326
|
+
const H = R instanceof Error ? R.message : "Failed to create order";
|
|
327
|
+
/wallet|address/i.test(H) ? O({ type: "SET_WALLET_ERROR", message: H.replace(/^Failed to create checkout intent:\s*/i, "") }) : O({ type: "SET_ERROR", message: H });
|
|
328
328
|
}
|
|
329
|
-
}, [c, ce,
|
|
329
|
+
}, [c, ce, C]), q = _((v) => {
|
|
330
330
|
O({ type: "SET_STEP", step: v });
|
|
331
|
-
}, []), ie =
|
|
331
|
+
}, []), ie = _(() => {
|
|
332
332
|
const v = ["confirm", "amount", "quotes", "wallet", "checkout", "processing", "complete"], E = v.indexOf(c.step);
|
|
333
333
|
E > 0 && O({ type: "SET_STEP", step: v[E - 1] });
|
|
334
|
-
}, [c.step,
|
|
335
|
-
const v =
|
|
334
|
+
}, [c.step, C]), Oe = F(() => {
|
|
335
|
+
const v = C ? !!c.cryptoAmount : !!c.fiatAmount;
|
|
336
336
|
switch (c.step) {
|
|
337
337
|
case "confirm":
|
|
338
|
-
return !!(v && c.cryptoCurrency && c.network &&
|
|
338
|
+
return !!(v && c.cryptoCurrency && c.network && c.walletAddress && !$);
|
|
339
339
|
case "amount":
|
|
340
|
-
return !!(v && c.cryptoCurrency && c.network &&
|
|
340
|
+
return !!(v && c.cryptoCurrency && c.network && !$);
|
|
341
341
|
case "quotes":
|
|
342
342
|
return !!c.selectedQuote;
|
|
343
343
|
case "wallet":
|
|
@@ -345,27 +345,27 @@ function Ht({
|
|
|
345
345
|
default:
|
|
346
346
|
return !1;
|
|
347
347
|
}
|
|
348
|
-
}, [c,
|
|
349
|
-
apiConfig:
|
|
348
|
+
}, [c, $, C]), xe = {
|
|
349
|
+
apiConfig: P,
|
|
350
350
|
assetBaseUrl: n,
|
|
351
351
|
config: L,
|
|
352
|
-
configLoading:
|
|
353
|
-
configError:
|
|
352
|
+
configLoading: K,
|
|
353
|
+
configError: X,
|
|
354
354
|
state: c,
|
|
355
355
|
dispatch: O,
|
|
356
356
|
quotes: he,
|
|
357
357
|
quotesLoading: fe,
|
|
358
|
-
quotesError:
|
|
358
|
+
quotesError: Y,
|
|
359
359
|
fetchQuotes: ye,
|
|
360
360
|
order: ae,
|
|
361
361
|
orderLoading: Ce,
|
|
362
362
|
orderError: se,
|
|
363
363
|
createOrder: we,
|
|
364
|
-
orderStatus:
|
|
364
|
+
orderStatus: V,
|
|
365
365
|
orderStatusLoading: ne,
|
|
366
366
|
fieldLocks: x || null,
|
|
367
367
|
defaultGateway: re,
|
|
368
|
-
amountError:
|
|
368
|
+
amountError: $,
|
|
369
369
|
goToStep: q,
|
|
370
370
|
goBack: ie,
|
|
371
371
|
canProceed: Oe
|
|
@@ -942,8 +942,8 @@ function Le({
|
|
|
942
942
|
onClose: a,
|
|
943
943
|
children: n
|
|
944
944
|
}) {
|
|
945
|
-
const [s, r] =
|
|
946
|
-
|
|
945
|
+
const [s, r] = N(!1), [u, m] = N(!1);
|
|
946
|
+
U(() => {
|
|
947
947
|
if (t)
|
|
948
948
|
r(!0), requestAnimationFrame(() => requestAnimationFrame(() => m(!0)));
|
|
949
949
|
else if (s) {
|
|
@@ -952,7 +952,7 @@ function Le({
|
|
|
952
952
|
return () => clearTimeout(o);
|
|
953
953
|
}
|
|
954
954
|
}, [t]);
|
|
955
|
-
const i =
|
|
955
|
+
const i = _(() => {
|
|
956
956
|
m(!1), setTimeout(() => a(), 250);
|
|
957
957
|
}, [a]);
|
|
958
958
|
return s ? /* @__PURE__ */ e(
|
|
@@ -1018,7 +1018,7 @@ function zt({
|
|
|
1018
1018
|
onSelect: n,
|
|
1019
1019
|
onClose: s
|
|
1020
1020
|
}) {
|
|
1021
|
-
const [r, u] =
|
|
1021
|
+
const [r, u] = N(""), m = F(() => {
|
|
1022
1022
|
const i = r.trim().toLowerCase();
|
|
1023
1023
|
return i ? t.filter(
|
|
1024
1024
|
(o) => o.id.toLowerCase().includes(i) || o.name.toLowerCase().includes(i) || o.description && o.description.toLowerCase().includes(i)
|
|
@@ -1085,7 +1085,7 @@ function ea({
|
|
|
1085
1085
|
onSelect: n,
|
|
1086
1086
|
fiatCurrency: s
|
|
1087
1087
|
}) {
|
|
1088
|
-
const [r, u] =
|
|
1088
|
+
const [r, u] = N(!1), m = F(
|
|
1089
1089
|
() => t.filter((o) => o.supportedFiats.includes(s)),
|
|
1090
1090
|
[t, s]
|
|
1091
1091
|
), i = m.find((o) => o.id === a) || m[0];
|
|
@@ -1151,8 +1151,8 @@ function ta({
|
|
|
1151
1151
|
redirectDelay: s = 3e3
|
|
1152
1152
|
}) {
|
|
1153
1153
|
var g;
|
|
1154
|
-
const { order: r, orderStatus: u, goToStep: m, goBack: i } = pe(), [o, d] =
|
|
1155
|
-
if (
|
|
1154
|
+
const { order: r, orderStatus: u, goToStep: m, goBack: i } = pe(), [o, d] = N(!1), [h, f] = N(null), x = r != null && r.checkout.expiresAt ? Date.now() > r.checkout.expiresAt : !1;
|
|
1155
|
+
if (U(() => {
|
|
1156
1156
|
if ((r == null ? void 0 : r.checkout.method) === "redirect" && n && !x) {
|
|
1157
1157
|
f(Math.ceil(s / 1e3));
|
|
1158
1158
|
const p = setTimeout(() => {
|
|
@@ -1164,7 +1164,7 @@ function ta({
|
|
|
1164
1164
|
clearTimeout(p), clearInterval(b);
|
|
1165
1165
|
};
|
|
1166
1166
|
}
|
|
1167
|
-
}, [r, n, s, x]),
|
|
1167
|
+
}, [r, n, s, x]), U(() => {
|
|
1168
1168
|
u && (u.status === "completed" ? m("complete") : ["failed", "cancelled", "expired"].includes(u.status) && m("error"));
|
|
1169
1169
|
}, [u == null ? void 0 : u.status, m]), !r)
|
|
1170
1170
|
return /* @__PURE__ */ l(
|
|
@@ -1380,7 +1380,7 @@ function aa(t, a) {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
function na({ className: t = "" }) {
|
|
1382
1382
|
const { orderStatus: a, orderStatusLoading: n, goToStep: s } = pe();
|
|
1383
|
-
|
|
1383
|
+
U(() => {
|
|
1384
1384
|
a && (a.status === "completed" ? s("complete") : ["failed", "cancelled", "expired", "refunded"].includes(a.status) && s("error"));
|
|
1385
1385
|
}, [a == null ? void 0 : a.status, s]);
|
|
1386
1386
|
const r = () => {
|
|
@@ -1697,7 +1697,7 @@ function la({ className: t = "" }) {
|
|
|
1697
1697
|
fetchQuotes: u,
|
|
1698
1698
|
createOrder: m,
|
|
1699
1699
|
orderLoading: i
|
|
1700
|
-
} = pe(), o = s.flowType === "sell", [d, h] =
|
|
1700
|
+
} = pe(), o = s.flowType === "sell", [d, h] = N(null), f = a == null ? void 0 : a.gateways.find((g) => g.id === r), x = async () => {
|
|
1701
1701
|
h(null);
|
|
1702
1702
|
try {
|
|
1703
1703
|
u(), await m();
|
|
@@ -1808,14 +1808,14 @@ function ia() {
|
|
|
1808
1808
|
] });
|
|
1809
1809
|
}
|
|
1810
1810
|
function da({ onClose: t, onSelect: a, currencies: n, assetBaseUrl: s = "" }) {
|
|
1811
|
-
const [r, u] =
|
|
1811
|
+
const [r, u] = N(""), m = F(() => {
|
|
1812
1812
|
if (!n || n.length === 0) return st;
|
|
1813
1813
|
const o = new Map(st.map((d) => [d.code, d.name]));
|
|
1814
1814
|
return n.map((d) => ({
|
|
1815
1815
|
code: d.code,
|
|
1816
1816
|
name: d.name || o.get(d.code) || d.code
|
|
1817
1817
|
}));
|
|
1818
|
-
}, [n]), i =
|
|
1818
|
+
}, [n]), i = F(() => {
|
|
1819
1819
|
const o = r.trim().toLowerCase();
|
|
1820
1820
|
return o ? m.filter(
|
|
1821
1821
|
(d) => d.code.toLowerCase().includes(o) || d.name.toLowerCase().includes(o)
|
|
@@ -1854,7 +1854,7 @@ function da({ onClose: t, onSelect: a, currencies: n, assetBaseUrl: s = "" }) {
|
|
|
1854
1854
|
] });
|
|
1855
1855
|
}
|
|
1856
1856
|
function ua({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: s = "" }) {
|
|
1857
|
-
const [r, u] =
|
|
1857
|
+
const [r, u] = N(""), m = F(() => {
|
|
1858
1858
|
if (!n || n.length === 0) return _t;
|
|
1859
1859
|
const o = [];
|
|
1860
1860
|
for (const d of n) {
|
|
@@ -1874,16 +1874,16 @@ function ua({ onClose: t, onSelect: a, cryptos: n, assetBaseUrl: s = "" }) {
|
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
1876
|
return o;
|
|
1877
|
-
}, [n]), i =
|
|
1877
|
+
}, [n]), i = F(() => {
|
|
1878
1878
|
var f;
|
|
1879
1879
|
const o = r.trim().toLowerCase();
|
|
1880
1880
|
if (!o) return m;
|
|
1881
1881
|
const d = o.split(/\s+/), h = [];
|
|
1882
1882
|
for (const x of m) {
|
|
1883
|
-
const g = Ie[x.chain], p = g ? g.name.toLowerCase() : "", b = ((f = g == null ? void 0 : g.shortName) == null ? void 0 : f.toLowerCase()) || "", T = x.chain.toLowerCase(),
|
|
1884
|
-
if (!d.every((z) =>
|
|
1885
|
-
let
|
|
1886
|
-
|
|
1883
|
+
const g = Ie[x.chain], p = g ? g.name.toLowerCase() : "", b = ((f = g == null ? void 0 : g.shortName) == null ? void 0 : f.toLowerCase()) || "", T = x.chain.toLowerCase(), P = x.code.toLowerCase(), w = x.name.toLowerCase(), G = [P, w, p, b, T];
|
|
1884
|
+
if (!d.every((z) => G.some((c) => c.includes(z)))) continue;
|
|
1885
|
+
let j = 0;
|
|
1886
|
+
P === o ? j += 100 : P.startsWith(d[0]) && (j += 50), x.popular && (j += 10), d.length > 1 && (p.includes(d[1]) || b.includes(d[1]) || T.includes(d[1])) && (j += 25), h.push({ item: x, score: j });
|
|
1887
1887
|
}
|
|
1888
1888
|
return h.sort((x, g) => g.score - x.score), h.map((x) => x.item);
|
|
1889
1889
|
}, [m, r]);
|
|
@@ -2064,24 +2064,24 @@ function fa({
|
|
|
2064
2064
|
state: p,
|
|
2065
2065
|
dispatch: b,
|
|
2066
2066
|
config: T,
|
|
2067
|
-
configLoading:
|
|
2067
|
+
configLoading: P,
|
|
2068
2068
|
quotes: w,
|
|
2069
|
-
quotesLoading:
|
|
2069
|
+
quotesLoading: G,
|
|
2070
2070
|
quotesError: Q,
|
|
2071
|
-
fetchQuotes:
|
|
2071
|
+
fetchQuotes: j,
|
|
2072
2072
|
createOrder: z,
|
|
2073
2073
|
orderLoading: c,
|
|
2074
2074
|
amountError: O,
|
|
2075
|
-
fieldLocks:
|
|
2075
|
+
fieldLocks: C,
|
|
2076
2076
|
apiConfig: L,
|
|
2077
|
-
assetBaseUrl:
|
|
2078
|
-
} = pe(), [
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
}, [a]),
|
|
2082
|
-
const y = setTimeout(() => Ee(!1),
|
|
2077
|
+
assetBaseUrl: K
|
|
2078
|
+
} = pe(), [X, $] = N(a === "dark"), [Ne, he] = N(n), [fe, Y] = N(null), [ye, ae] = N(!1), [Ce, se] = N(!1), [ce, be] = N(!1), [V, ne] = N(null), [re, Ee] = N(!0), [Ae, we] = N(!1), [q, ie] = N(!1), Oe = D(null), xe = D(), v = D(p.flowType);
|
|
2079
|
+
U(() => {
|
|
2080
|
+
$(a === "dark");
|
|
2081
|
+
}, [a]), U(() => {
|
|
2082
|
+
const y = setTimeout(() => Ee(!1), P ? 0 : 800);
|
|
2083
2083
|
return () => clearTimeout(y);
|
|
2084
|
-
}, [
|
|
2084
|
+
}, [P]), U(() => {
|
|
2085
2085
|
if (v.current !== p.flowType && !re) {
|
|
2086
2086
|
v.current = p.flowType, we(!0), ae(!1), se(!1);
|
|
2087
2087
|
const y = setTimeout(() => we(!1), 350);
|
|
@@ -2089,20 +2089,20 @@ function fa({
|
|
|
2089
2089
|
}
|
|
2090
2090
|
v.current = p.flowType;
|
|
2091
2091
|
}, [p.flowType, re]);
|
|
2092
|
-
const E = p.flowType, S = E === "buy",
|
|
2093
|
-
de &&
|
|
2094
|
-
const gt =
|
|
2092
|
+
const E = p.flowType, S = E === "buy", k = p.cryptoCurrency || "BTC", R = p.fiatCurrency || "USD", H = S ? p.fiatAmount : p.cryptoAmount, W = Kt(H), de = (ze = w == null ? void 0 : w.bestQuote) != null && ze.exchangeRate ? parseFloat(w.bestQuote.exchangeRate) : null, Se = D(null);
|
|
2093
|
+
de && k && R && (Se.current = { rate: de, crypto: k, fiat: R });
|
|
2094
|
+
const gt = F(() => {
|
|
2095
2095
|
if (w != null && w.bestQuote) {
|
|
2096
2096
|
const y = S ? w.bestQuote.cryptoAmount : w.bestQuote.fiatAmount;
|
|
2097
2097
|
if (y) return y;
|
|
2098
2098
|
}
|
|
2099
2099
|
return "0";
|
|
2100
|
-
}, [w, S]), vt =
|
|
2100
|
+
}, [w, S]), vt = F(() => {
|
|
2101
2101
|
var B, ee, Ue;
|
|
2102
|
-
const y = de || ((B = Se.current) == null ? void 0 : B.rate), A = de ?
|
|
2102
|
+
const y = de || ((B = Se.current) == null ? void 0 : B.rate), A = de ? k : (ee = Se.current) == null ? void 0 : ee.crypto, I = de ? R : (Ue = Se.current) == null ? void 0 : Ue.fiat;
|
|
2103
2103
|
return !y || !A || !I ? "" : `1 ${A} ≈ ${y.toFixed(2)} ${I}`;
|
|
2104
|
-
}, [
|
|
2105
|
-
|
|
2104
|
+
}, [k, R, de]);
|
|
2105
|
+
U(() => {
|
|
2106
2106
|
const y = p.walletAddress.trim(), A = p.network;
|
|
2107
2107
|
if (!y || y.length < 10) {
|
|
2108
2108
|
ne(null), b({ type: "SET_WALLET_ERROR", message: "" });
|
|
@@ -2130,33 +2130,33 @@ function fa({
|
|
|
2130
2130
|
}
|
|
2131
2131
|
}, 500), () => clearTimeout(xe.current);
|
|
2132
2132
|
}, [p.walletAddress, p.network, L.apiUrl]);
|
|
2133
|
-
const Ge = !
|
|
2133
|
+
const Ge = !H || W === 0, je = W > 0 && (S ? W < dt : W < ut), Ye = !!O || je || ye && Ge, Nt = W > 0 && !O && !je, Pe = p.walletAddress.trim().length >= 10 && V !== !1 && !ce, Te = Nt && Pe && !!p.cryptoCurrency && !!p.network, Ct = (y) => {
|
|
2134
2134
|
let A = y.target.value.replace(/[^0-9.,]/g, "");
|
|
2135
2135
|
const I = S ? 2 : 6, B = A.indexOf(".");
|
|
2136
2136
|
B !== -1 && A.length - B - 1 > I && (A = A.slice(0, B + I + 1)), b(S ? { type: "SET_FIAT_AMOUNT", amount: A } : { type: "SET_CRYPTO_AMOUNT", amount: A });
|
|
2137
2137
|
}, Ve = (y) => {
|
|
2138
2138
|
y !== E && b({ type: "SET_FLOW_TYPE", flowType: y });
|
|
2139
|
-
}, bt =
|
|
2139
|
+
}, bt = _(
|
|
2140
2140
|
(y) => {
|
|
2141
2141
|
b({ type: "SET_FIAT_CURRENCY", currency: y });
|
|
2142
2142
|
},
|
|
2143
2143
|
[b]
|
|
2144
|
-
), Et =
|
|
2144
|
+
), Et = _(
|
|
2145
2145
|
(y, A) => {
|
|
2146
2146
|
b({ type: "SET_CRYPTO_CURRENCY", currency: y }), b({ type: "SET_CRYPTO_CHAIN", chain: A });
|
|
2147
2147
|
},
|
|
2148
2148
|
[b]
|
|
2149
|
-
), At =
|
|
2149
|
+
), At = _(
|
|
2150
2150
|
(y) => {
|
|
2151
2151
|
b({ type: "SET_PAYMENT_METHOD", methodId: y });
|
|
2152
2152
|
},
|
|
2153
2153
|
[b]
|
|
2154
2154
|
), wt = () => {
|
|
2155
|
-
Te && (ie(!0),
|
|
2155
|
+
Te && (ie(!0), j());
|
|
2156
2156
|
};
|
|
2157
|
-
|
|
2157
|
+
U(() => {
|
|
2158
2158
|
var y;
|
|
2159
|
-
if (!(!q ||
|
|
2159
|
+
if (!(!q || G)) {
|
|
2160
2160
|
if (w != null && w.bestQuote)
|
|
2161
2161
|
ie(!1), b({ type: "SELECT_QUOTE", quote: w.bestQuote }), z().catch(() => {
|
|
2162
2162
|
});
|
|
@@ -2168,11 +2168,11 @@ function fa({
|
|
|
2168
2168
|
b({ type: "SET_ERROR", message: I });
|
|
2169
2169
|
}
|
|
2170
2170
|
}
|
|
2171
|
-
}, [q, w,
|
|
2172
|
-
const We =
|
|
2173
|
-
"--t-accent":
|
|
2174
|
-
"--t-cta-bg":
|
|
2175
|
-
"--t-cta-text":
|
|
2171
|
+
}, [q, w, G, Q, b, z]);
|
|
2172
|
+
const We = X ? "theme-dark" : "theme-light", He = ct.find((y) => y.id === Ne) || ct[0], St = He.accent === null, Qe = (s ? Ke(s) : !1) ? { "--t-accent": s, "--t-cta-bg": s, "--t-cta-text": "#ffffff" } : St ? {
|
|
2173
|
+
"--t-accent": X ? "#ffffff" : "#111111",
|
|
2174
|
+
"--t-cta-bg": X ? "#ffffff" : "#111111",
|
|
2175
|
+
"--t-cta-text": X ? "#000000" : "#ffffff"
|
|
2176
2176
|
} : {
|
|
2177
2177
|
"--t-accent": He.accent,
|
|
2178
2178
|
"--t-cta-bg": He.accent,
|
|
@@ -2208,7 +2208,7 @@ function fa({
|
|
|
2208
2208
|
...Re
|
|
2209
2209
|
},
|
|
2210
2210
|
children: [
|
|
2211
|
-
/* @__PURE__ */ e("div", { className: `flex justify-end items-center px-5 pt-3 ${o ? "pb-1" : "pb-5"}`, children: /* @__PURE__ */ e(Qt, { onClick: () =>
|
|
2211
|
+
/* @__PURE__ */ e("div", { className: `flex justify-end items-center px-5 pt-3 ${o ? "pb-1" : "pb-5"}`, children: /* @__PURE__ */ e(Qt, { onClick: () => Y("settings") }) }),
|
|
2212
2212
|
o ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center pt-3 pb-5", children: [
|
|
2213
2213
|
/* @__PURE__ */ l("div", { className: "flex", style: { width: 165 }, children: [
|
|
2214
2214
|
/* @__PURE__ */ e(
|
|
@@ -2245,7 +2245,7 @@ function fa({
|
|
|
2245
2245
|
)
|
|
2246
2246
|
] })
|
|
2247
2247
|
] }) : null,
|
|
2248
|
-
re || Ae ||
|
|
2248
|
+
re || Ae || P ? /* @__PURE__ */ e(ia, {}) : /* @__PURE__ */ l("div", { className: "flex-1 overflow-hidden px-5 flex flex-col tab-fade-in", children: [
|
|
2249
2249
|
/* @__PURE__ */ l(
|
|
2250
2250
|
"div",
|
|
2251
2251
|
{
|
|
@@ -2263,20 +2263,20 @@ function fa({
|
|
|
2263
2263
|
{
|
|
2264
2264
|
ref: Oe,
|
|
2265
2265
|
type: "text",
|
|
2266
|
-
value:
|
|
2266
|
+
value: H,
|
|
2267
2267
|
onChange: Ct,
|
|
2268
2268
|
onBlur: () => ae(!0),
|
|
2269
2269
|
placeholder: S ? "250" : "0.01",
|
|
2270
2270
|
className: "bg-transparent outline-none w-0 flex-1 mr-3",
|
|
2271
2271
|
style: { color: "var(--t-text)", fontSize: 24, fontWeight: 600, lineHeight: "32px" },
|
|
2272
2272
|
inputMode: "decimal",
|
|
2273
|
-
disabled: !!((qe =
|
|
2273
|
+
disabled: !!((qe = C == null ? void 0 : C.sourceAmount) != null && qe.locked)
|
|
2274
2274
|
}
|
|
2275
2275
|
),
|
|
2276
2276
|
S ? /* @__PURE__ */ l(
|
|
2277
2277
|
"button",
|
|
2278
2278
|
{
|
|
2279
|
-
onClick: () =>
|
|
2279
|
+
onClick: () => Y("fiat"),
|
|
2280
2280
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
2281
2281
|
style: {
|
|
2282
2282
|
background: "var(--t-pill-bg)",
|
|
@@ -2285,10 +2285,10 @@ function fa({
|
|
|
2285
2285
|
paddingLeft: 10,
|
|
2286
2286
|
paddingRight: 10
|
|
2287
2287
|
},
|
|
2288
|
-
disabled: !!((et =
|
|
2288
|
+
disabled: !!((et = C == null ? void 0 : C.sourceCurrency) != null && et.locked),
|
|
2289
2289
|
children: [
|
|
2290
|
-
/* @__PURE__ */ e(Xe, { currencyCode:
|
|
2291
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2290
|
+
/* @__PURE__ */ e(Xe, { currencyCode: R, size: 16, baseUrl: K }),
|
|
2291
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: R }),
|
|
2292
2292
|
/* @__PURE__ */ e(ge, {})
|
|
2293
2293
|
]
|
|
2294
2294
|
}
|
|
@@ -2296,7 +2296,7 @@ function fa({
|
|
|
2296
2296
|
/* @__PURE__ */ l(
|
|
2297
2297
|
"button",
|
|
2298
2298
|
{
|
|
2299
|
-
onClick: () =>
|
|
2299
|
+
onClick: () => Y("crypto"),
|
|
2300
2300
|
className: "flex items-center gap-1.5 transition-colors",
|
|
2301
2301
|
style: {
|
|
2302
2302
|
background: "var(--t-pill-bg)",
|
|
@@ -2305,10 +2305,10 @@ function fa({
|
|
|
2305
2305
|
paddingLeft: 10,
|
|
2306
2306
|
paddingRight: 10
|
|
2307
2307
|
},
|
|
2308
|
-
disabled: !!((tt =
|
|
2308
|
+
disabled: !!((tt = C == null ? void 0 : C.destinationCurrency) != null && tt.locked),
|
|
2309
2309
|
children: [
|
|
2310
|
-
/* @__PURE__ */ e(mt, { ticker:
|
|
2311
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2310
|
+
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl: K }),
|
|
2311
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: k }),
|
|
2312
2312
|
/* @__PURE__ */ e(ge, {})
|
|
2313
2313
|
]
|
|
2314
2314
|
}
|
|
@@ -2317,7 +2317,7 @@ function fa({
|
|
|
2317
2317
|
/* @__PURE__ */ e(
|
|
2318
2318
|
"img",
|
|
2319
2319
|
{
|
|
2320
|
-
src: _e(Z,
|
|
2320
|
+
src: _e(Z, K),
|
|
2321
2321
|
alt: Z,
|
|
2322
2322
|
width: 14,
|
|
2323
2323
|
height: 14,
|
|
@@ -2332,7 +2332,7 @@ function fa({
|
|
|
2332
2332
|
]
|
|
2333
2333
|
}
|
|
2334
2334
|
),
|
|
2335
|
-
ye && Ye && /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5 px-[2px]", style: { color: "#EF4444" }, children: O || (Ge ? "Amount should be more than 0" : S ? `Minimum amount is ${dt} ${
|
|
2335
|
+
ye && Ye && /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5 px-[2px]", style: { color: "#EF4444" }, children: O || (Ge ? "Amount should be more than 0" : S ? `Minimum amount is ${dt} ${R}` : `Minimum amount is ${ut} ${k}`) }),
|
|
2336
2336
|
/* @__PURE__ */ l(
|
|
2337
2337
|
"div",
|
|
2338
2338
|
{
|
|
@@ -2348,20 +2348,20 @@ function fa({
|
|
|
2348
2348
|
children: [
|
|
2349
2349
|
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "You get" }),
|
|
2350
2350
|
/* @__PURE__ */ l("div", { className: "flex items-start justify-between", children: [
|
|
2351
|
-
|
|
2351
|
+
G ? /* @__PURE__ */ e(M, { w: 180, h: 32 }) : /* @__PURE__ */ e(
|
|
2352
2352
|
ca,
|
|
2353
2353
|
{
|
|
2354
|
-
value:
|
|
2354
|
+
value: W > 0 ? gt : "0",
|
|
2355
2355
|
height: 32,
|
|
2356
2356
|
className: "font-semibold",
|
|
2357
|
-
style: { color:
|
|
2357
|
+
style: { color: W > 0 ? "var(--t-text)" : "var(--t-text-muted)", fontSize: 24 }
|
|
2358
2358
|
}
|
|
2359
2359
|
),
|
|
2360
2360
|
S ? /* @__PURE__ */ l("div", { className: "flex flex-col items-end shrink-0", children: [
|
|
2361
2361
|
/* @__PURE__ */ l(
|
|
2362
2362
|
"button",
|
|
2363
2363
|
{
|
|
2364
|
-
onClick: () =>
|
|
2364
|
+
onClick: () => Y("crypto"),
|
|
2365
2365
|
className: "flex items-center gap-1.5 transition-colors",
|
|
2366
2366
|
style: {
|
|
2367
2367
|
background: "var(--t-pill-bg)",
|
|
@@ -2370,10 +2370,10 @@ function fa({
|
|
|
2370
2370
|
paddingLeft: 10,
|
|
2371
2371
|
paddingRight: 10
|
|
2372
2372
|
},
|
|
2373
|
-
disabled: !!((at =
|
|
2373
|
+
disabled: !!((at = C == null ? void 0 : C.destinationCurrency) != null && at.locked),
|
|
2374
2374
|
children: [
|
|
2375
|
-
/* @__PURE__ */ e(mt, { ticker:
|
|
2376
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2375
|
+
/* @__PURE__ */ e(mt, { ticker: k, size: 16, baseUrl: K }),
|
|
2376
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: k }),
|
|
2377
2377
|
/* @__PURE__ */ e(ge, {})
|
|
2378
2378
|
]
|
|
2379
2379
|
}
|
|
@@ -2382,7 +2382,7 @@ function fa({
|
|
|
2382
2382
|
/* @__PURE__ */ e(
|
|
2383
2383
|
"img",
|
|
2384
2384
|
{
|
|
2385
|
-
src: _e(Z,
|
|
2385
|
+
src: _e(Z, K),
|
|
2386
2386
|
alt: Z,
|
|
2387
2387
|
width: 14,
|
|
2388
2388
|
height: 14,
|
|
@@ -2395,7 +2395,7 @@ function fa({
|
|
|
2395
2395
|
] }) : /* @__PURE__ */ l(
|
|
2396
2396
|
"button",
|
|
2397
2397
|
{
|
|
2398
|
-
onClick: () =>
|
|
2398
|
+
onClick: () => Y("fiat"),
|
|
2399
2399
|
className: "flex items-center gap-1.5 shrink-0 transition-colors",
|
|
2400
2400
|
style: {
|
|
2401
2401
|
background: "var(--t-pill-bg)",
|
|
@@ -2404,10 +2404,10 @@ function fa({
|
|
|
2404
2404
|
paddingLeft: 10,
|
|
2405
2405
|
paddingRight: 10
|
|
2406
2406
|
},
|
|
2407
|
-
disabled: !!((nt =
|
|
2407
|
+
disabled: !!((nt = C == null ? void 0 : C.sourceCurrency) != null && nt.locked),
|
|
2408
2408
|
children: [
|
|
2409
|
-
/* @__PURE__ */ e(Xe, { currencyCode:
|
|
2410
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children:
|
|
2409
|
+
/* @__PURE__ */ e(Xe, { currencyCode: R, size: 16, baseUrl: K }),
|
|
2410
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium", style: { color: "var(--t-text)" }, children: R }),
|
|
2411
2411
|
/* @__PURE__ */ e(ge, {})
|
|
2412
2412
|
]
|
|
2413
2413
|
}
|
|
@@ -2436,8 +2436,8 @@ function fa({
|
|
|
2436
2436
|
fiatCurrency: p.fiatCurrency
|
|
2437
2437
|
}
|
|
2438
2438
|
) }),
|
|
2439
|
-
|
|
2440
|
-
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: "
|
|
2439
|
+
/* @__PURE__ */ l("div", { className: "mt-8", children: [
|
|
2440
|
+
/* @__PURE__ */ e("div", { className: "text-[13px] mb-2.5", style: { color: "var(--t-text-secondary)" }, children: S ? "Receiving wallet address" : "Sending wallet address" }),
|
|
2441
2441
|
/* @__PURE__ */ e(
|
|
2442
2442
|
"input",
|
|
2443
2443
|
{
|
|
@@ -2445,7 +2445,7 @@ function fa({
|
|
|
2445
2445
|
value: p.walletAddress,
|
|
2446
2446
|
onChange: (y) => b({ type: "SET_WALLET_ADDRESS", address: y.target.value }),
|
|
2447
2447
|
onBlur: () => se(!0),
|
|
2448
|
-
placeholder: "Enter your
|
|
2448
|
+
placeholder: S ? "Enter your receiving address" : "Enter your sending address",
|
|
2449
2449
|
spellCheck: !1,
|
|
2450
2450
|
autoComplete: "off",
|
|
2451
2451
|
className: "w-full bg-transparent text-[13px] outline-none transition-colors",
|
|
@@ -2457,7 +2457,7 @@ function fa({
|
|
|
2457
2457
|
paddingRight: 14,
|
|
2458
2458
|
color: "var(--t-text)"
|
|
2459
2459
|
},
|
|
2460
|
-
disabled: !!((ot =
|
|
2460
|
+
disabled: !!((ot = C == null ? void 0 : C.destinationAddress) != null && ot.locked)
|
|
2461
2461
|
}
|
|
2462
2462
|
),
|
|
2463
2463
|
p.walletError ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: p.walletError }) : Ce && !Pe && !ce ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "#EF4444" }, children: "Enter a valid wallet address" }) : ce && p.walletAddress.trim().length >= 10 ? /* @__PURE__ */ e("div", { className: "text-[12px] mt-1.5", style: { color: "var(--t-text-muted)" }, children: "Validating address..." }) : null
|
|
@@ -2477,12 +2477,12 @@ function fa({
|
|
|
2477
2477
|
opacity: Te && !c && !q ? 1 : 0.4,
|
|
2478
2478
|
cursor: Te && !c && !q ? "pointer" : "not-allowed"
|
|
2479
2479
|
},
|
|
2480
|
-
children: q ? "Getting best price..." : c ? "Processing..." : S ? `Buy ${
|
|
2480
|
+
children: q ? "Getting best price..." : c ? "Processing..." : S ? `Buy ${k}` : `Sell ${k}`
|
|
2481
2481
|
}
|
|
2482
2482
|
),
|
|
2483
2483
|
/* @__PURE__ */ e("div", { className: "text-center py-3", children: /* @__PURE__ */ e("span", { className: "text-[11px]", style: { color: "var(--t-text-tertiary)" }, children: "Powered by NowRamp" }) })
|
|
2484
2484
|
] }, E),
|
|
2485
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "fiat", onClose: () =>
|
|
2485
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "fiat", onClose: () => Y(null), children: (y) => {
|
|
2486
2486
|
var A;
|
|
2487
2487
|
return /* @__PURE__ */ e(
|
|
2488
2488
|
da,
|
|
@@ -2492,11 +2492,11 @@ function fa({
|
|
|
2492
2492
|
bt(I), y();
|
|
2493
2493
|
},
|
|
2494
2494
|
currencies: (A = T == null ? void 0 : T.fiats) == null ? void 0 : A.map((I) => ({ code: I.code, name: I.code })),
|
|
2495
|
-
assetBaseUrl:
|
|
2495
|
+
assetBaseUrl: K
|
|
2496
2496
|
}
|
|
2497
2497
|
);
|
|
2498
2498
|
} }),
|
|
2499
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "crypto", onClose: () =>
|
|
2499
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "crypto", onClose: () => Y(null), children: (y) => {
|
|
2500
2500
|
var A;
|
|
2501
2501
|
return /* @__PURE__ */ e(
|
|
2502
2502
|
ua,
|
|
@@ -2513,16 +2513,16 @@ function fa({
|
|
|
2513
2513
|
networks: (B = I.networks) == null ? void 0 : B.map((ee) => ({ code: ee.id, name: ee.name }))
|
|
2514
2514
|
};
|
|
2515
2515
|
}),
|
|
2516
|
-
assetBaseUrl:
|
|
2516
|
+
assetBaseUrl: K
|
|
2517
2517
|
}
|
|
2518
2518
|
);
|
|
2519
2519
|
} }),
|
|
2520
|
-
/* @__PURE__ */ e(Le, { isOpen: fe === "settings", onClose: () =>
|
|
2520
|
+
/* @__PURE__ */ e(Le, { isOpen: fe === "settings", onClose: () => Y(null), children: (y) => /* @__PURE__ */ e(
|
|
2521
2521
|
ha,
|
|
2522
2522
|
{
|
|
2523
2523
|
onClose: y,
|
|
2524
|
-
darkMode:
|
|
2525
|
-
onToggleDarkMode:
|
|
2524
|
+
darkMode: X,
|
|
2525
|
+
onToggleDarkMode: $,
|
|
2526
2526
|
skinId: Ne,
|
|
2527
2527
|
onSelectSkin: (A) => {
|
|
2528
2528
|
he(A);
|
|
@@ -2551,19 +2551,19 @@ function ya({
|
|
|
2551
2551
|
onComplete: p,
|
|
2552
2552
|
onError: b,
|
|
2553
2553
|
className: T,
|
|
2554
|
-
theme:
|
|
2554
|
+
theme: P,
|
|
2555
2555
|
skinId: w,
|
|
2556
|
-
accentColor:
|
|
2556
|
+
accentColor: G,
|
|
2557
2557
|
bgColor: Q,
|
|
2558
|
-
bgImage:
|
|
2558
|
+
bgImage: j,
|
|
2559
2559
|
borderColor: z,
|
|
2560
2560
|
borderRadius: c,
|
|
2561
2561
|
showFlowToggle: O,
|
|
2562
|
-
autoRedirect:
|
|
2562
|
+
autoRedirect: C,
|
|
2563
2563
|
explorerUrl: L,
|
|
2564
|
-
doneButtonText:
|
|
2565
|
-
supportEmail:
|
|
2566
|
-
onDone:
|
|
2564
|
+
doneButtonText: K,
|
|
2565
|
+
supportEmail: X,
|
|
2566
|
+
onDone: $
|
|
2567
2567
|
}) {
|
|
2568
2568
|
return /* @__PURE__ */ e(
|
|
2569
2569
|
Ht,
|
|
@@ -2588,19 +2588,19 @@ function ya({
|
|
|
2588
2588
|
fa,
|
|
2589
2589
|
{
|
|
2590
2590
|
className: T,
|
|
2591
|
-
theme:
|
|
2591
|
+
theme: P,
|
|
2592
2592
|
skinId: w,
|
|
2593
|
-
accentColor:
|
|
2593
|
+
accentColor: G,
|
|
2594
2594
|
bgColor: Q,
|
|
2595
|
-
bgImage:
|
|
2595
|
+
bgImage: j,
|
|
2596
2596
|
borderColor: z,
|
|
2597
2597
|
borderRadius: c,
|
|
2598
2598
|
showFlowToggle: O,
|
|
2599
|
-
autoRedirect:
|
|
2599
|
+
autoRedirect: C,
|
|
2600
2600
|
explorerUrl: L,
|
|
2601
|
-
doneButtonText:
|
|
2602
|
-
supportEmail:
|
|
2603
|
-
onDone:
|
|
2601
|
+
doneButtonText: K,
|
|
2602
|
+
supportEmail: X,
|
|
2603
|
+
onDone: $
|
|
2604
2604
|
}
|
|
2605
2605
|
)
|
|
2606
2606
|
}
|
|
@@ -2699,7 +2699,7 @@ function ka({
|
|
|
2699
2699
|
quotesLoading: s,
|
|
2700
2700
|
cryptoCurrency: r
|
|
2701
2701
|
}) {
|
|
2702
|
-
const [u, m] =
|
|
2702
|
+
const [u, m] = N(""), i = F(() => {
|
|
2703
2703
|
if (!(n != null && n.quotes)) return [];
|
|
2704
2704
|
const o = u.trim().toLowerCase();
|
|
2705
2705
|
return o ? n.quotes.filter((d) => d.gatewayName.toLowerCase().includes(o)) : n.quotes;
|