@nice2dev/ui-money 1.2.1 → 1.3.0
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/CHANGELOG.md +415 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +940 -898
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Z = (t, e, r) =>
|
|
4
|
-
import
|
|
5
|
-
import { jsxs as
|
|
6
|
-
import { useNiceTranslation as
|
|
7
|
-
const
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var st = (t, e, r) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var Z = (t, e, r) => st(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import ot, { useState as j, useRef as Re, useEffect as lt, useMemo as B, useCallback as Y, forwardRef as se, useId as Ne } from "react";
|
|
5
|
+
import { jsxs as _, jsx as c, Fragment as dt } from "react/jsx-runtime";
|
|
6
|
+
import { useNiceTranslation as oe, useEngage as ut, NiceIcon as ve, useControllableState as Ue, NiceTutorialButton as mt, resolveTutorial as pt } from "@nice2dev/ui-core";
|
|
7
|
+
const _e = [
|
|
8
8
|
// ── Majors ─────────────────────────────────────
|
|
9
9
|
{ code: "USD", numeric: 840, symbol: "$", name: "US Dollar", decimals: 2, symbolFirst: !0 },
|
|
10
10
|
{ code: "EUR", numeric: 978, symbol: "€", name: "Euro", decimals: 2, symbolFirst: !0 },
|
|
@@ -226,56 +226,56 @@ const fe = [
|
|
|
226
226
|
{ code: "ETH", numeric: 0, symbol: "Ξ", name: "Ether", decimals: 8, symbolFirst: !0 },
|
|
227
227
|
{ code: "USDC", numeric: 0, symbol: "USDC", name: "USD Coin", decimals: 6 },
|
|
228
228
|
{ code: "USDT", numeric: 0, symbol: "USDT", name: "Tether", decimals: 6 }
|
|
229
|
-
],
|
|
230
|
-
function
|
|
231
|
-
return
|
|
229
|
+
], Ye = new Map(_e.map((t) => [t.code, t]));
|
|
230
|
+
function te(t) {
|
|
231
|
+
return Ye.get(t.toUpperCase());
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
const e =
|
|
236
|
-
e >= 0 ?
|
|
233
|
+
function cr(t) {
|
|
234
|
+
Ye.set(t.code.toUpperCase(), t);
|
|
235
|
+
const e = _e.findIndex((r) => r.code === t.code);
|
|
236
|
+
e >= 0 ? _e[e] = t : _e.push(t);
|
|
237
237
|
}
|
|
238
238
|
function ae(t, e) {
|
|
239
|
-
const r =
|
|
239
|
+
const r = te(e), n = (r == null ? void 0 : r.decimals) ?? 2, a = Math.pow(10, n);
|
|
240
240
|
return { amount: (t < 0 ? -1 : 1) * Math.round(Math.abs(t) * a), currency: e.toUpperCase() };
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
const e =
|
|
242
|
+
function Ge(t) {
|
|
243
|
+
const e = te(t.currency), r = (e == null ? void 0 : e.decimals) ?? 2;
|
|
244
244
|
return t.amount / Math.pow(10, r);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function yt(t, e) {
|
|
247
247
|
return t.currency.toUpperCase() === e.currency.toUpperCase();
|
|
248
248
|
}
|
|
249
|
-
function
|
|
250
|
-
if (!
|
|
249
|
+
function Te(t, e, r) {
|
|
250
|
+
if (!yt(t, e))
|
|
251
251
|
throw new Error(`Cannot ${r} different currencies: ${t.currency} vs ${e.currency}`);
|
|
252
252
|
}
|
|
253
253
|
function ye(t, e) {
|
|
254
|
-
return
|
|
254
|
+
return Te(t, e, "add"), { amount: t.amount + e.amount, currency: t.currency };
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function ht(t, e) {
|
|
257
|
+
return Te(t, e, "subtract"), { amount: t.amount - e.amount, currency: t.currency };
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Ae(t, e) {
|
|
260
260
|
return {
|
|
261
261
|
amount: (t.amount * e < 0 ? -1 : 1) * Math.round(Math.abs(t.amount * e)),
|
|
262
262
|
currency: t.currency
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
return
|
|
265
|
+
function ir(t, e) {
|
|
266
|
+
return Te(t, e, "compare"), t.amount - e.amount;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function sr(t) {
|
|
269
269
|
return t.amount === 0;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function or(t) {
|
|
272
272
|
return t.amount < 0;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function lr(t) {
|
|
275
275
|
return { amount: -t.amount, currency: t.currency };
|
|
276
276
|
}
|
|
277
277
|
function ie(t, e = {}) {
|
|
278
|
-
const r =
|
|
278
|
+
const r = te(t.currency), n = e.decimals ?? (r == null ? void 0 : r.decimals) ?? 2, a = t.amount / Math.pow(10, n);
|
|
279
279
|
try {
|
|
280
280
|
return new Intl.NumberFormat(e.locale, {
|
|
281
281
|
style: "currency",
|
|
@@ -285,11 +285,11 @@ function ie(t, e = {}) {
|
|
|
285
285
|
currencyDisplay: e.currencyDisplay ?? "symbol"
|
|
286
286
|
}).format(a);
|
|
287
287
|
} catch {
|
|
288
|
-
const
|
|
289
|
-
return r != null && r.symbolFirst ? `${
|
|
288
|
+
const s = (r == null ? void 0 : r.symbol) ?? t.currency, d = a.toFixed(n);
|
|
289
|
+
return r != null && r.symbolFirst ? `${s}${d}` : `${d} ${s}`;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function ft(t, e) {
|
|
293
293
|
if (!t)
|
|
294
294
|
return null;
|
|
295
295
|
let r = t.replace(/[^\d.,-]/g, "").trim();
|
|
@@ -297,75 +297,75 @@ function ut(t, e) {
|
|
|
297
297
|
return null;
|
|
298
298
|
const n = r.startsWith("-");
|
|
299
299
|
n && (r = r.slice(1));
|
|
300
|
-
const a = r.lastIndexOf("."),
|
|
301
|
-
let
|
|
302
|
-
d === -1 ?
|
|
303
|
-
const l = `${
|
|
300
|
+
const a = r.lastIndexOf("."), s = r.lastIndexOf(","), d = Math.max(a, s);
|
|
301
|
+
let i, o = "";
|
|
302
|
+
d === -1 ? i = r : (i = r.slice(0, d).replace(/[.,]/g, ""), o = r.slice(d + 1).replace(/[.,]/g, ""));
|
|
303
|
+
const l = `${i}.${o || "0"}`, y = parseFloat(l);
|
|
304
304
|
return Number.isFinite(y) ? ae(n ? -y : y, e) : null;
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function Me(t) {
|
|
307
307
|
const e = (t || "").replace(/\D/g, "");
|
|
308
308
|
return e ? /^4/.test(e) ? "visa" : /^(5[1-5]|2(2[2-9]|[3-6]\d|7[01]|720))/.test(e) ? "mastercard" : /^3[47]/.test(e) ? "amex" : /^(6011|65|64[4-9]|622(12[6-9]|1[3-9]\d|[2-8]\d\d|9[01]\d|92[0-5]))/.test(e) ? "discover" : /^3(0[0-5]|[68])/.test(e) ? "diners" : /^35(2[89]|[3-8])/.test(e) ? "jcb" : /^62/.test(e) ? "unionpay" : /^(50|5[6-9]|6[0-9])/.test(e) ? "maestro" : /^(2200|2201|2202|2203|2204)/.test(e) ? "mir" : /^(4011|4312|4389|4514|4576|5041|5066|5067|509|6277|6362|6363|650|6516|6550)/.test(e) ? "elo" : /^(606282|3841)/.test(e) ? "hipercard" : "unknown" : "unknown";
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function Ze(t) {
|
|
311
311
|
const e = (t || "").replace(/\D/g, "");
|
|
312
312
|
if (e.length < 12 || e.length > 19)
|
|
313
313
|
return !1;
|
|
314
314
|
let r = 0, n = !1;
|
|
315
315
|
for (let a = e.length - 1; a >= 0; a--) {
|
|
316
|
-
let
|
|
317
|
-
n && (
|
|
316
|
+
let s = e.charCodeAt(a) - 48;
|
|
317
|
+
n && (s *= 2, s > 9 && (s -= 9)), r += s, n = !n;
|
|
318
318
|
}
|
|
319
319
|
return r % 10 === 0;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
const r = (t || "").replace(/\D/g, ""), n = e ??
|
|
321
|
+
function bt(t, e) {
|
|
322
|
+
const r = (t || "").replace(/\D/g, ""), n = e ?? Me(r);
|
|
323
323
|
return n === "amex" ? [r.slice(0, 4), r.slice(4, 10), r.slice(10, 15)].filter(Boolean).join(" ") : n === "diners" ? [r.slice(0, 4), r.slice(4, 10), r.slice(10, 14)].filter(Boolean).join(" ") : (r.match(/.{1,4}/g) ?? []).join(" ").trim();
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function dr(t, e) {
|
|
326
326
|
const r = (t || "").replace(/\D/g, "");
|
|
327
327
|
if (r.length < 4)
|
|
328
328
|
return r;
|
|
329
|
-
const n = r.slice(-4), a = "*".repeat(r.length - 4) + n,
|
|
330
|
-
return
|
|
329
|
+
const n = r.slice(-4), a = "*".repeat(r.length - 4) + n, s = e ?? Me(r);
|
|
330
|
+
return s === "amex" ? [a.slice(0, 4), a.slice(4, 10), a.slice(10, 15)].filter(Boolean).join(" ") : s === "diners" ? [a.slice(0, 4), a.slice(4, 10), a.slice(10, 14)].filter(Boolean).join(" ") : (a.match(/.{1,4}/g) ?? []).join(" ").trim();
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Je(t) {
|
|
333
333
|
const e = (t || "").replace(/\D/g, "");
|
|
334
334
|
if (e.length < 3)
|
|
335
335
|
return null;
|
|
336
336
|
const r = e.slice(0, 2), n = e.length >= 4 ? e.slice(-2) : e.slice(2, 4), a = parseInt(r, 10);
|
|
337
337
|
return !Number.isFinite(a) || a < 1 || a > 12 ? null : `${r}/${n}`;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
const r =
|
|
339
|
+
function Xe(t, e = /* @__PURE__ */ new Date()) {
|
|
340
|
+
const r = Je(t);
|
|
341
341
|
if (!r)
|
|
342
342
|
return !1;
|
|
343
|
-
const [n, a] = r.split("/"),
|
|
344
|
-
return new Date(d,
|
|
343
|
+
const [n, a] = r.split("/"), s = parseInt(n, 10), d = 2e3 + parseInt(a, 10);
|
|
344
|
+
return new Date(d, s, 0, 23, 59, 59, 999).getTime() >= e.getTime();
|
|
345
345
|
}
|
|
346
346
|
function be(t) {
|
|
347
347
|
return t === "amex" ? 4 : 3;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Le(t, e = {}) {
|
|
350
350
|
var l;
|
|
351
|
-
const r = {}, n =
|
|
351
|
+
const r = {}, n = Me(t.number), a = Ze(t.number);
|
|
352
352
|
a || (r.number = "Invalid card number");
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
|
|
353
|
+
const s = Xe(t.expiry, e.now);
|
|
354
|
+
s || (r.expiry = "Invalid or expired");
|
|
355
|
+
const i = (t.cvc || "").replace(/\D/g, "").length === be(n);
|
|
356
|
+
i || (r.cvc = `CVC must be ${be(n)} digits`);
|
|
357
357
|
const o = !e.requireHolder || (((l = t.holderName) == null ? void 0 : l.trim().length) ?? 0) >= 2;
|
|
358
358
|
return o || (r.holderName = "Cardholder name required"), {
|
|
359
359
|
brand: n,
|
|
360
360
|
numberValid: a,
|
|
361
|
-
expiryValid:
|
|
362
|
-
cvcValid:
|
|
361
|
+
expiryValid: s,
|
|
362
|
+
cvcValid: i,
|
|
363
363
|
holderValid: o,
|
|
364
|
-
isValid: a &&
|
|
364
|
+
isValid: a && s && i && o,
|
|
365
365
|
errors: r
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
class
|
|
368
|
+
class ur {
|
|
369
369
|
constructor(e) {
|
|
370
370
|
Z(this, "id", "static");
|
|
371
371
|
this.rates = e;
|
|
@@ -374,15 +374,15 @@ class ir {
|
|
|
374
374
|
const n = e.toUpperCase(), a = r.toUpperCase();
|
|
375
375
|
if (n === a)
|
|
376
376
|
return { base: n, quote: a, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
return
|
|
377
|
+
const s = this.rates.find((l) => l.base === n && l.quote === a);
|
|
378
|
+
if (s)
|
|
379
|
+
return s;
|
|
380
380
|
const d = this.rates.find((l) => l.base === a && l.quote === n);
|
|
381
381
|
if (d)
|
|
382
382
|
return { base: n, quote: a, rate: 1 / d.rate, asOf: d.asOf };
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
const l =
|
|
383
|
+
const i = this.rates.find((l) => l.base === n && l.quote === "USD") ?? this.rates.find((l) => l.base === "USD" && l.quote === n), o = this.rates.find((l) => l.base === "USD" && l.quote === a) ?? this.rates.find((l) => l.base === a && l.quote === "USD");
|
|
384
|
+
if (i && o) {
|
|
385
|
+
const l = i.base === "USD" ? 1 / i.rate : i.rate, y = o.base === "USD" ? o.rate : 1 / o.rate;
|
|
386
386
|
return {
|
|
387
387
|
base: n,
|
|
388
388
|
quote: a,
|
|
@@ -393,7 +393,7 @@ class ir {
|
|
|
393
393
|
throw new Error(`No FX rate for ${n}/${a}`);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
class
|
|
396
|
+
class Ie {
|
|
397
397
|
constructor(e = {}) {
|
|
398
398
|
Z(this, "cache", /* @__PURE__ */ new Map());
|
|
399
399
|
Z(this, "fetchImpl");
|
|
@@ -414,77 +414,77 @@ class Ce {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
class
|
|
417
|
+
class _t extends Ie {
|
|
418
418
|
constructor(r = {}) {
|
|
419
419
|
super(r);
|
|
420
420
|
Z(this, "id", "frankfurter");
|
|
421
421
|
}
|
|
422
422
|
async getRate(r, n) {
|
|
423
|
-
const a = r.toUpperCase(),
|
|
424
|
-
if (a ===
|
|
425
|
-
return { base: a, quote:
|
|
426
|
-
const d = this.getCached(a,
|
|
423
|
+
const a = r.toUpperCase(), s = n.toUpperCase();
|
|
424
|
+
if (a === s)
|
|
425
|
+
return { base: a, quote: s, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
426
|
+
const d = this.getCached(a, s);
|
|
427
427
|
if (d)
|
|
428
428
|
return d;
|
|
429
|
-
const
|
|
429
|
+
const i = `https://api.frankfurter.app/latest?from=${a}&to=${s}`, o = await this.fetchImpl(i);
|
|
430
430
|
if (!o.ok)
|
|
431
431
|
throw new Error(`Frankfurter HTTP ${o.status}`);
|
|
432
|
-
const l = await o.json(), y = l.rates[
|
|
432
|
+
const l = await o.json(), y = l.rates[s];
|
|
433
433
|
if (y == null)
|
|
434
|
-
throw new Error(`Frankfurter: no rate for ${a}/${
|
|
435
|
-
const
|
|
436
|
-
return this.setCached(
|
|
434
|
+
throw new Error(`Frankfurter: no rate for ${a}/${s}`);
|
|
435
|
+
const N = { base: a, quote: s, rate: y, asOf: l.date };
|
|
436
|
+
return this.setCached(N), N;
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
|
-
class
|
|
439
|
+
class gt extends Ie {
|
|
440
440
|
constructor(r, n = {}) {
|
|
441
441
|
super(n);
|
|
442
442
|
Z(this, "id", "openexchangerates");
|
|
443
443
|
this.appId = r;
|
|
444
444
|
}
|
|
445
445
|
async getRate(r, n) {
|
|
446
|
-
const a = r.toUpperCase(),
|
|
447
|
-
if (a ===
|
|
448
|
-
return { base: a, quote:
|
|
449
|
-
const d = this.getCached(a,
|
|
446
|
+
const a = r.toUpperCase(), s = n.toUpperCase();
|
|
447
|
+
if (a === s)
|
|
448
|
+
return { base: a, quote: s, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
449
|
+
const d = this.getCached(a, s);
|
|
450
450
|
if (d)
|
|
451
451
|
return d;
|
|
452
|
-
const
|
|
452
|
+
const i = `https://openexchangerates.org/api/latest.json?app_id=${this.appId}`, o = await this.fetchImpl(i);
|
|
453
453
|
if (!o.ok)
|
|
454
454
|
throw new Error(`OpenExchangeRates HTTP ${o.status}`);
|
|
455
|
-
const l = await o.json(), y = l.rates[a],
|
|
456
|
-
if (y == null ||
|
|
457
|
-
throw new Error(`OpenExchangeRates: missing rate for ${a} or ${
|
|
455
|
+
const l = await o.json(), y = l.rates[a], N = l.rates[s];
|
|
456
|
+
if (y == null || N == null)
|
|
457
|
+
throw new Error(`OpenExchangeRates: missing rate for ${a} or ${s}`);
|
|
458
458
|
const f = {
|
|
459
459
|
base: a,
|
|
460
|
-
quote:
|
|
461
|
-
rate:
|
|
460
|
+
quote: s,
|
|
461
|
+
rate: N / y,
|
|
462
462
|
asOf: new Date(l.timestamp * 1e3).toISOString()
|
|
463
463
|
};
|
|
464
464
|
return this.setCached(f), f;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
class
|
|
467
|
+
class vt extends Ie {
|
|
468
468
|
constructor(r = {}) {
|
|
469
469
|
super(r);
|
|
470
470
|
Z(this, "id", "exchangerate.host");
|
|
471
471
|
}
|
|
472
472
|
async getRate(r, n) {
|
|
473
473
|
var f;
|
|
474
|
-
const a = r.toUpperCase(),
|
|
475
|
-
if (a ===
|
|
476
|
-
return { base: a, quote:
|
|
477
|
-
const d = this.getCached(a,
|
|
474
|
+
const a = r.toUpperCase(), s = n.toUpperCase();
|
|
475
|
+
if (a === s)
|
|
476
|
+
return { base: a, quote: s, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
477
|
+
const d = this.getCached(a, s);
|
|
478
478
|
if (d)
|
|
479
479
|
return d;
|
|
480
|
-
const
|
|
480
|
+
const i = `https://api.exchangerate.host/convert?from=${a}&to=${s}`, o = await this.fetchImpl(i);
|
|
481
481
|
if (!o.ok)
|
|
482
482
|
throw new Error(`exchangerate.host HTTP ${o.status}`);
|
|
483
|
-
const l = await o.json(), y = ((f = l.info) == null ? void 0 : f.rate) ?? l.result,
|
|
484
|
-
return this.setCached(
|
|
483
|
+
const l = await o.json(), y = ((f = l.info) == null ? void 0 : f.rate) ?? l.result, N = { base: a, quote: s, rate: y, asOf: l.date };
|
|
484
|
+
return this.setCached(N), N;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
class
|
|
487
|
+
class Nt extends Ie {
|
|
488
488
|
constructor(r = {}) {
|
|
489
489
|
super(r);
|
|
490
490
|
Z(this, "id", "nbp");
|
|
@@ -492,57 +492,57 @@ class bt extends Ce {
|
|
|
492
492
|
this.table = r.table ?? "A";
|
|
493
493
|
}
|
|
494
494
|
async getRate(r, n) {
|
|
495
|
-
const a = r.toUpperCase(),
|
|
496
|
-
if (a ===
|
|
497
|
-
return { base: a, quote:
|
|
498
|
-
const d = this.getCached(a,
|
|
495
|
+
const a = r.toUpperCase(), s = n.toUpperCase();
|
|
496
|
+
if (a === s)
|
|
497
|
+
return { base: a, quote: s, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
498
|
+
const d = this.getCached(a, s);
|
|
499
499
|
if (d)
|
|
500
500
|
return d;
|
|
501
|
-
const
|
|
502
|
-
var
|
|
503
|
-
if (
|
|
501
|
+
const i = async (N) => {
|
|
502
|
+
var k;
|
|
503
|
+
if (N === "PLN")
|
|
504
504
|
return { rate: 1, date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) };
|
|
505
|
-
const f = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${
|
|
505
|
+
const f = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${N}/?format=json`, u = await this.fetchImpl(f);
|
|
506
506
|
if (!u.ok)
|
|
507
507
|
return null;
|
|
508
|
-
const
|
|
509
|
-
return
|
|
510
|
-
}, o = await
|
|
508
|
+
const h = (k = (await u.json()).rates) == null ? void 0 : k[0];
|
|
509
|
+
return h ? { rate: h.mid ?? h.ask ?? 0, date: h.effectiveDate } : null;
|
|
510
|
+
}, o = await i(a), l = await i(s);
|
|
511
511
|
if (!o || !l || o.rate === 0)
|
|
512
|
-
throw new Error(`NBP: missing rate for ${a} or ${
|
|
512
|
+
throw new Error(`NBP: missing rate for ${a} or ${s}`);
|
|
513
513
|
const y = {
|
|
514
514
|
base: a,
|
|
515
|
-
quote:
|
|
515
|
+
quote: s,
|
|
516
516
|
rate: o.rate / l.rate,
|
|
517
517
|
asOf: o.date
|
|
518
518
|
};
|
|
519
519
|
return this.setCached(y), y;
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
class
|
|
522
|
+
class wt extends _t {
|
|
523
523
|
constructor() {
|
|
524
524
|
super(...arguments);
|
|
525
525
|
Z(this, "id", "ecb");
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
class
|
|
528
|
+
class kt extends vt {
|
|
529
529
|
constructor() {
|
|
530
530
|
super(...arguments);
|
|
531
531
|
Z(this, "id", "free-forex");
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
const
|
|
535
|
-
async function
|
|
534
|
+
const mr = (t = {}) => new Nt(t), pr = (t = {}) => new wt(t), yr = (t) => new gt(t.apiKey, t), hr = (t = {}) => new kt(t);
|
|
535
|
+
async function Ct(t, e, r) {
|
|
536
536
|
const n = e.toUpperCase();
|
|
537
537
|
if (t.currency.toUpperCase() === n)
|
|
538
538
|
return t;
|
|
539
|
-
const a =
|
|
539
|
+
const a = te(t.currency), s = te(n), d = (a == null ? void 0 : a.decimals) ?? 2, i = (s == null ? void 0 : s.decimals) ?? 2, { rate: o } = await r.getRate(t.currency, n), y = t.amount / Math.pow(10, d) * o;
|
|
540
540
|
return {
|
|
541
541
|
currency: n,
|
|
542
|
-
amount: Math.round(y * Math.pow(10,
|
|
542
|
+
amount: Math.round(y * Math.pow(10, i))
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
class
|
|
545
|
+
class Dt {
|
|
546
546
|
constructor(e = {}) {
|
|
547
547
|
Z(this, "id");
|
|
548
548
|
Z(this, "name");
|
|
@@ -583,10 +583,10 @@ class vt {
|
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const
|
|
588
|
-
const
|
|
589
|
-
return
|
|
586
|
+
function W(t, e, r, n, a) {
|
|
587
|
+
const s = (d) => {
|
|
588
|
+
const i = n == null ? void 0 : n[d];
|
|
589
|
+
return i || (async () => {
|
|
590
590
|
throw new Error(
|
|
591
591
|
`[ui-money] ${e} adapter is not wired. Pass an \`executor.${String(d)}\` implementation that calls the ${e} SDK.`
|
|
592
592
|
);
|
|
@@ -597,14 +597,14 @@ function V(t, e, r, n, a) {
|
|
|
597
597
|
name: e,
|
|
598
598
|
supportedCurrencies: r,
|
|
599
599
|
minimums: a,
|
|
600
|
-
authorize:
|
|
601
|
-
capture:
|
|
602
|
-
cancel:
|
|
603
|
-
refund:
|
|
600
|
+
authorize: s("authorize"),
|
|
601
|
+
capture: s("capture"),
|
|
602
|
+
cancel: s("cancel"),
|
|
603
|
+
refund: s("refund")
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
|
-
function
|
|
607
|
-
return
|
|
606
|
+
function Pt(t) {
|
|
607
|
+
return W("stripe", "Stripe", "*", t, {
|
|
608
608
|
USD: 50,
|
|
609
609
|
EUR: 50,
|
|
610
610
|
GBP: 30,
|
|
@@ -618,8 +618,8 @@ function Nt(t) {
|
|
|
618
618
|
PLN: 200
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
return
|
|
621
|
+
function Mt(t) {
|
|
622
|
+
return W(
|
|
623
623
|
"paypal",
|
|
624
624
|
"PayPal",
|
|
625
625
|
[
|
|
@@ -649,83 +649,83 @@ function wt(t) {
|
|
|
649
649
|
t
|
|
650
650
|
);
|
|
651
651
|
}
|
|
652
|
-
function
|
|
653
|
-
return
|
|
652
|
+
function It(t) {
|
|
653
|
+
return W("adyen", "Adyen", "*", t);
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
return
|
|
655
|
+
function St(t) {
|
|
656
|
+
return W("square", "Square", ["USD", "CAD", "GBP", "AUD", "JPY", "EUR"], t);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
658
|
+
function $t(t) {
|
|
659
|
+
return W("mollie", "Mollie", "*", t);
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
return
|
|
661
|
+
function xt(t) {
|
|
662
|
+
return W("braintree", "Braintree", "*", t);
|
|
663
663
|
}
|
|
664
|
-
function
|
|
665
|
-
return
|
|
664
|
+
function Rt(t) {
|
|
665
|
+
return W("razorpay", "Razorpay", ["INR", "USD", "EUR", "GBP", "AED"], t);
|
|
666
666
|
}
|
|
667
|
-
function
|
|
668
|
-
return
|
|
667
|
+
function Ut(t) {
|
|
668
|
+
return W(
|
|
669
669
|
"payu",
|
|
670
670
|
"PayU",
|
|
671
671
|
["PLN", "EUR", "USD", "CZK", "HUF", "RON", "BGN", "TRY"],
|
|
672
672
|
t
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return
|
|
675
|
+
function At(t) {
|
|
676
|
+
return W("przelewy24", "Przelewy24", ["PLN", "EUR"], t);
|
|
677
677
|
}
|
|
678
|
-
function
|
|
679
|
-
return
|
|
678
|
+
function Et(t = {}) {
|
|
679
|
+
return W("tpay", "Tpay", ["PLN", "EUR", "USD", "GBP"], t);
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
681
|
+
function Tt(t = {}) {
|
|
682
|
+
return W("autopay", "Autopay", ["PLN", "EUR", "USD", "GBP", "CZK"], t);
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function Ft(t = {}) {
|
|
685
685
|
const { acquirer: e = "native", ...r } = t;
|
|
686
|
-
return
|
|
686
|
+
return W(`blik:${e}`, `BLIK (${e})`, ["PLN"], r);
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
688
|
+
function Ot(t) {
|
|
689
|
+
return W(
|
|
690
690
|
"klarna",
|
|
691
691
|
"Klarna",
|
|
692
692
|
["USD", "EUR", "GBP", "SEK", "NOK", "DKK", "CHF", "AUD", "CAD", "NZD", "PLN"],
|
|
693
693
|
t
|
|
694
694
|
);
|
|
695
695
|
}
|
|
696
|
-
function
|
|
697
|
-
return
|
|
696
|
+
function qt(t) {
|
|
697
|
+
return W(
|
|
698
698
|
"coinbase-commerce",
|
|
699
699
|
"Coinbase Commerce",
|
|
700
700
|
["BTC", "ETH", "USDC", "USDT", "USD", "EUR"],
|
|
701
701
|
t
|
|
702
702
|
);
|
|
703
703
|
}
|
|
704
|
-
const
|
|
705
|
-
mock: () => new
|
|
706
|
-
stripe: () =>
|
|
707
|
-
paypal: () =>
|
|
708
|
-
adyen: () =>
|
|
709
|
-
square: () =>
|
|
710
|
-
mollie: () =>
|
|
711
|
-
braintree: () =>
|
|
712
|
-
razorpay: () =>
|
|
713
|
-
payu: () =>
|
|
714
|
-
przelewy24: () =>
|
|
715
|
-
tpay: () =>
|
|
716
|
-
autopay: () =>
|
|
717
|
-
blik: () =>
|
|
718
|
-
klarna: () =>
|
|
719
|
-
"coinbase-commerce": () =>
|
|
704
|
+
const Kt = {
|
|
705
|
+
mock: () => new Dt(),
|
|
706
|
+
stripe: () => Pt(),
|
|
707
|
+
paypal: () => Mt(),
|
|
708
|
+
adyen: () => It(),
|
|
709
|
+
square: () => St(),
|
|
710
|
+
mollie: () => $t(),
|
|
711
|
+
braintree: () => xt(),
|
|
712
|
+
razorpay: () => Rt(),
|
|
713
|
+
payu: () => Ut(),
|
|
714
|
+
przelewy24: () => At(),
|
|
715
|
+
tpay: () => Et(),
|
|
716
|
+
autopay: () => Tt(),
|
|
717
|
+
blik: () => Ft(),
|
|
718
|
+
klarna: () => Ot(),
|
|
719
|
+
"coinbase-commerce": () => qt()
|
|
720
720
|
};
|
|
721
|
-
function
|
|
722
|
-
const e =
|
|
721
|
+
function Bt(t) {
|
|
722
|
+
const e = Kt[t];
|
|
723
723
|
return e ? e().supportedCurrencies : "*";
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Lt(t) {
|
|
726
726
|
return `/api/payments/${t}/webhook`;
|
|
727
727
|
}
|
|
728
|
-
const
|
|
728
|
+
const zt = [
|
|
729
729
|
{
|
|
730
730
|
id: "stripe",
|
|
731
731
|
name: "Stripe",
|
|
@@ -936,62 +936,62 @@ const qt = [
|
|
|
936
936
|
supportedMethods: ["wallet"],
|
|
937
937
|
hasTestMode: !0
|
|
938
938
|
}
|
|
939
|
-
],
|
|
940
|
-
|
|
939
|
+
], Pe = /* @__PURE__ */ Object.fromEntries(
|
|
940
|
+
zt.map((t) => {
|
|
941
941
|
const { currencyKey: e, ...r } = t, n = {
|
|
942
942
|
...r,
|
|
943
|
-
supportedCurrencies:
|
|
944
|
-
webhookPath:
|
|
943
|
+
supportedCurrencies: Bt(e ?? t.id),
|
|
944
|
+
webhookPath: Lt(t.id)
|
|
945
945
|
};
|
|
946
946
|
return [t.id, n];
|
|
947
947
|
})
|
|
948
|
-
),
|
|
949
|
-
|
|
948
|
+
), Ht = /* @__PURE__ */ Object.values(
|
|
949
|
+
Pe
|
|
950
950
|
);
|
|
951
|
-
function
|
|
952
|
-
return
|
|
951
|
+
function fr(t) {
|
|
952
|
+
return Pe[t];
|
|
953
953
|
}
|
|
954
|
-
function
|
|
955
|
-
const r =
|
|
954
|
+
function br(t, e) {
|
|
955
|
+
const r = B(
|
|
956
956
|
() => "amount" in t ? t : ae(
|
|
957
957
|
t.major,
|
|
958
958
|
t.currency
|
|
959
959
|
),
|
|
960
960
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
961
961
|
[]
|
|
962
|
-
), [n, a] =
|
|
962
|
+
), [n, a] = j(r), s = Y(
|
|
963
963
|
(f) => a((u) => ae(f, u.currency)),
|
|
964
964
|
[]
|
|
965
965
|
), d = Y((f) => {
|
|
966
966
|
a((u) => ({ ...u, currency: f.toUpperCase() }));
|
|
967
|
-
}, []),
|
|
968
|
-
(f) => a((u) =>
|
|
967
|
+
}, []), i = Y((f) => a((u) => ye(u, f)), []), o = Y(
|
|
968
|
+
(f) => a((u) => ht(u, f)),
|
|
969
969
|
[]
|
|
970
970
|
), l = Y(
|
|
971
|
-
(f) => a((u) =>
|
|
971
|
+
(f) => a((u) => Ae(u, f)),
|
|
972
972
|
[]
|
|
973
|
-
), y =
|
|
974
|
-
return { money: n, setMoney: a, setMajor:
|
|
973
|
+
), y = B(() => ie(n, { locale: e }), [n, e]), N = B(() => Ge(n), [n]);
|
|
974
|
+
return { money: n, setMoney: a, setMajor: s, setCurrency: d, add: i, subtract: o, scale: l, formatted: y, major: N };
|
|
975
975
|
}
|
|
976
|
-
function
|
|
977
|
-
const [n, a] =
|
|
978
|
-
return
|
|
979
|
-
if (
|
|
976
|
+
function Ee(t, e, r) {
|
|
977
|
+
const [n, a] = j(null), [s, d] = j(null), [i, o] = j(!1), l = Re(0), y = t == null ? void 0 : t.amount, N = t == null ? void 0 : t.currency;
|
|
978
|
+
return lt(() => {
|
|
979
|
+
if (y === void 0 || N === void 0) {
|
|
980
980
|
a(null);
|
|
981
981
|
return;
|
|
982
982
|
}
|
|
983
|
-
const
|
|
984
|
-
o(!0), d(null),
|
|
985
|
-
l.current ===
|
|
986
|
-
}).catch((
|
|
987
|
-
l.current ===
|
|
983
|
+
const f = ++l.current;
|
|
984
|
+
o(!0), d(null), Ct({ amount: y, currency: N }, e, r).then((u) => {
|
|
985
|
+
l.current === f && a(u);
|
|
986
|
+
}).catch((u) => {
|
|
987
|
+
l.current === f && (d(u instanceof Error ? u : new Error(String(u))), a(null));
|
|
988
988
|
}).finally(() => {
|
|
989
|
-
l.current ===
|
|
989
|
+
l.current === f && o(!1);
|
|
990
990
|
});
|
|
991
|
-
}, [
|
|
991
|
+
}, [y, N, e, r]), { converted: n, loading: i, error: s };
|
|
992
992
|
}
|
|
993
|
-
function
|
|
994
|
-
const [e, r] =
|
|
993
|
+
function jt(t) {
|
|
994
|
+
const [e, r] = j("idle"), [n, a] = j(null), [s, d] = j(null), i = Y(() => {
|
|
995
995
|
r("idle"), a(null), d(null);
|
|
996
996
|
}, []), o = Y(
|
|
997
997
|
async (f) => {
|
|
@@ -1000,23 +1000,23 @@ function Ot(t) {
|
|
|
1000
1000
|
const u = await t.authorize(f);
|
|
1001
1001
|
return a(u), r(u.status), u;
|
|
1002
1002
|
} catch (u) {
|
|
1003
|
-
const
|
|
1004
|
-
throw d(
|
|
1003
|
+
const b = u instanceof Error ? u : new Error(String(u));
|
|
1004
|
+
throw d(b), r("failed"), b;
|
|
1005
1005
|
}
|
|
1006
1006
|
},
|
|
1007
1007
|
[t]
|
|
1008
1008
|
), l = Y(
|
|
1009
1009
|
async (f, u) => {
|
|
1010
|
-
const
|
|
1011
|
-
if (!
|
|
1010
|
+
const b = f ?? (n == null ? void 0 : n.id);
|
|
1011
|
+
if (!b)
|
|
1012
1012
|
throw new Error("No authorization id to capture");
|
|
1013
1013
|
r("capturing");
|
|
1014
1014
|
try {
|
|
1015
|
-
const
|
|
1016
|
-
return a(
|
|
1017
|
-
} catch (
|
|
1018
|
-
const
|
|
1019
|
-
throw d(
|
|
1015
|
+
const h = await t.capture(b, u);
|
|
1016
|
+
return a(h), r(h.status), h;
|
|
1017
|
+
} catch (h) {
|
|
1018
|
+
const k = h instanceof Error ? h : new Error(String(h));
|
|
1019
|
+
throw d(k), r("failed"), k;
|
|
1020
1020
|
}
|
|
1021
1021
|
},
|
|
1022
1022
|
[t, n == null ? void 0 : n.id]
|
|
@@ -1025,562 +1025,602 @@ function Ot(t) {
|
|
|
1025
1025
|
const u = f ?? (n == null ? void 0 : n.id);
|
|
1026
1026
|
if (!u)
|
|
1027
1027
|
throw new Error("No payment id to cancel");
|
|
1028
|
-
const
|
|
1029
|
-
return a(
|
|
1028
|
+
const b = await t.cancel(u);
|
|
1029
|
+
return a(b), r(b.status), b;
|
|
1030
1030
|
},
|
|
1031
1031
|
[t, n == null ? void 0 : n.id]
|
|
1032
|
-
),
|
|
1032
|
+
), N = Y(
|
|
1033
1033
|
async (f, u) => {
|
|
1034
|
-
const
|
|
1035
|
-
if (!
|
|
1034
|
+
const b = f ?? (n == null ? void 0 : n.id);
|
|
1035
|
+
if (!b)
|
|
1036
1036
|
throw new Error("No payment id to refund");
|
|
1037
|
-
const
|
|
1038
|
-
return a(
|
|
1037
|
+
const h = await t.refund(b, u);
|
|
1038
|
+
return a(h), r(h.status), h;
|
|
1039
1039
|
},
|
|
1040
1040
|
[t, n == null ? void 0 : n.id]
|
|
1041
1041
|
);
|
|
1042
|
-
return { status: e, response: n, error:
|
|
1042
|
+
return { status: e, response: n, error: s, authorize: o, capture: l, cancel: y, refund: N, reset: i };
|
|
1043
1043
|
}
|
|
1044
|
-
const
|
|
1044
|
+
const ze = /* @__PURE__ */ se(
|
|
1045
1045
|
function({
|
|
1046
1046
|
value: e,
|
|
1047
1047
|
amount: r,
|
|
1048
1048
|
currency: n,
|
|
1049
1049
|
locale: a,
|
|
1050
|
-
display:
|
|
1050
|
+
display: s = "symbol",
|
|
1051
1051
|
highlightNegative: d = !0,
|
|
1052
|
-
zeroPlaceholder:
|
|
1052
|
+
zeroPlaceholder: i,
|
|
1053
1053
|
convertTo: o,
|
|
1054
1054
|
exchangeProvider: l,
|
|
1055
1055
|
className: y,
|
|
1056
|
-
style:
|
|
1056
|
+
style: N,
|
|
1057
1057
|
"aria-label": f
|
|
1058
1058
|
}, u) {
|
|
1059
|
-
const
|
|
1059
|
+
const { t: b } = oe(), h = B(() => {
|
|
1060
1060
|
if (e)
|
|
1061
1061
|
return e;
|
|
1062
1062
|
if (r != null && n) {
|
|
1063
|
-
const
|
|
1063
|
+
const v = te(n), S = (v == null ? void 0 : v.decimals) ?? 2;
|
|
1064
1064
|
return {
|
|
1065
|
-
amount: Math.round(r * Math.pow(10,
|
|
1065
|
+
amount: Math.round(r * Math.pow(10, S)),
|
|
1066
1066
|
currency: n.toUpperCase()
|
|
1067
1067
|
};
|
|
1068
1068
|
}
|
|
1069
1069
|
return null;
|
|
1070
|
-
}, [e, r, n]),
|
|
1071
|
-
o && l ?
|
|
1070
|
+
}, [e, r, n]), k = B(() => h ? h.amount === 0 && i != null ? i : ie(h, { locale: a, currencyDisplay: s }) : "", [h, a, s, i]), { converted: R } = Ee(
|
|
1071
|
+
o && l ? h : null,
|
|
1072
1072
|
o ?? "",
|
|
1073
1073
|
l
|
|
1074
1074
|
);
|
|
1075
|
-
if (!
|
|
1075
|
+
if (!h)
|
|
1076
1076
|
return null;
|
|
1077
|
-
const
|
|
1078
|
-
return /* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */ c("span", { className: "nice-money__value", children:
|
|
1080
|
-
|
|
1081
|
-
"
|
|
1082
|
-
|
|
1083
|
-
|
|
1077
|
+
const m = h.amount < 0, g = "nice-money" + (d && m ? " nice-money--negative" : "") + (y ? ` ${y}` : "");
|
|
1078
|
+
return /* @__PURE__ */ _("span", { ref: u, className: g, style: N, "aria-label": f, children: [
|
|
1079
|
+
/* @__PURE__ */ c("span", { className: "nice-money__value", children: k }),
|
|
1080
|
+
R && /* @__PURE__ */ _(
|
|
1081
|
+
"span",
|
|
1082
|
+
{
|
|
1083
|
+
className: "nice-money__converted",
|
|
1084
|
+
"aria-label": b("money.convertedTo", "Converted to {currency}").replace(
|
|
1085
|
+
"{currency}",
|
|
1086
|
+
String(R.currency)
|
|
1087
|
+
),
|
|
1088
|
+
children: [
|
|
1089
|
+
" ≈ ",
|
|
1090
|
+
ie(R, { locale: a })
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1093
|
+
)
|
|
1084
1094
|
] });
|
|
1085
1095
|
}
|
|
1086
|
-
),
|
|
1096
|
+
), _r = _e.map((t) => t.code).sort(), Qe = /* @__PURE__ */ se(function({
|
|
1087
1097
|
value: e,
|
|
1088
1098
|
onChange: r,
|
|
1089
|
-
options: n =
|
|
1099
|
+
options: n = _e,
|
|
1090
1100
|
recents: a = [],
|
|
1091
|
-
searchable:
|
|
1101
|
+
searchable: s,
|
|
1092
1102
|
showCode: d = !0,
|
|
1093
|
-
showSymbol:
|
|
1103
|
+
showSymbol: i = !0,
|
|
1094
1104
|
compact: o = !1,
|
|
1095
1105
|
disabled: l,
|
|
1096
1106
|
readOnly: y,
|
|
1097
|
-
loading:
|
|
1107
|
+
loading: N,
|
|
1098
1108
|
accessMode: f,
|
|
1099
1109
|
label: u,
|
|
1100
|
-
helperText:
|
|
1101
|
-
error:
|
|
1102
|
-
required:
|
|
1103
|
-
size:
|
|
1104
|
-
labelPlacement:
|
|
1105
|
-
labelWidth:
|
|
1106
|
-
controlWidth:
|
|
1107
|
-
className:
|
|
1108
|
-
style:
|
|
1110
|
+
helperText: b,
|
|
1111
|
+
error: h,
|
|
1112
|
+
required: k,
|
|
1113
|
+
size: R = "md",
|
|
1114
|
+
labelPlacement: m = "top",
|
|
1115
|
+
labelWidth: g,
|
|
1116
|
+
controlWidth: v,
|
|
1117
|
+
className: S,
|
|
1118
|
+
style: E,
|
|
1109
1119
|
id: M,
|
|
1110
|
-
name:
|
|
1111
|
-
title:
|
|
1112
|
-
"data-testid":
|
|
1113
|
-
"aria-label":
|
|
1114
|
-
placeholder:
|
|
1115
|
-
},
|
|
1116
|
-
const { t:
|
|
1117
|
-
if (!
|
|
1120
|
+
name: I,
|
|
1121
|
+
title: q,
|
|
1122
|
+
"data-testid": $,
|
|
1123
|
+
"aria-label": ee,
|
|
1124
|
+
placeholder: A
|
|
1125
|
+
}, P) {
|
|
1126
|
+
const { t: T } = oe(), K = f === "hidden", Q = l || f === "disabled" || N, re = y || f === "readOnly", G = Ne(), X = M ?? `nice-cs-${G}`, [V, ne] = j(""), F = s ?? n.length > 8, C = B(() => {
|
|
1127
|
+
if (!V.trim())
|
|
1118
1128
|
return n;
|
|
1119
|
-
const
|
|
1129
|
+
const x = V.trim().toLowerCase();
|
|
1120
1130
|
return n.filter(
|
|
1121
|
-
(
|
|
1131
|
+
(U) => U.code.toLowerCase().includes(x) || U.name.toLowerCase().includes(x) || U.symbol.toLowerCase().includes(x)
|
|
1122
1132
|
);
|
|
1123
|
-
}, [n,
|
|
1124
|
-
const
|
|
1125
|
-
return a.map((
|
|
1126
|
-
}, [a]),
|
|
1127
|
-
(
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1133
|
+
}, [n, V]), p = B(() => {
|
|
1134
|
+
const x = /* @__PURE__ */ new Set();
|
|
1135
|
+
return a.map((U) => te(U)).filter((U) => !!U && !x.has(U.code) && !!x.add(U.code));
|
|
1136
|
+
}, [a]), O = Y(
|
|
1137
|
+
(x) => {
|
|
1138
|
+
const U = x.target.value, de = te(U);
|
|
1139
|
+
de && (r == null || r(U, de));
|
|
1130
1140
|
},
|
|
1131
1141
|
[r]
|
|
1132
|
-
),
|
|
1142
|
+
), L = (x) => {
|
|
1133
1143
|
if (o)
|
|
1134
|
-
return `${
|
|
1135
|
-
const
|
|
1136
|
-
return
|
|
1137
|
-
},
|
|
1138
|
-
width: typeof
|
|
1144
|
+
return `${i ? x.symbol + " " : ""}${x.code}`;
|
|
1145
|
+
const U = [];
|
|
1146
|
+
return i && U.push(x.symbol), d && U.push(x.code), U.push("—", x.name), U.join(" ");
|
|
1147
|
+
}, D = `nice-currency-selector nice-currency-selector--${R} nice-currency-selector--label-${m}` + (o ? " nice-currency-selector--compact" : "") + (h ? " nice-currency-selector--error" : "") + (Q ? " nice-currency-selector--disabled" : "") + (S ? ` ${S}` : ""), z = m === "left" && g != null ? { width: typeof g == "number" ? `${g}px` : g, flex: "none" } : void 0, le = v != null ? {
|
|
1148
|
+
width: typeof v == "number" ? `${v}px` : v,
|
|
1139
1149
|
flex: "none"
|
|
1140
1150
|
} : void 0;
|
|
1141
|
-
return
|
|
1142
|
-
u && /* @__PURE__ */
|
|
1151
|
+
return K ? null : /* @__PURE__ */ _("div", { ref: P, className: D, style: E, title: q, "data-testid": $, children: [
|
|
1152
|
+
u && /* @__PURE__ */ _("label", { htmlFor: X, className: "nice-currency-selector__label", style: z, children: [
|
|
1143
1153
|
u,
|
|
1144
|
-
|
|
1154
|
+
k && /* @__PURE__ */ c("span", { className: "nice-currency-selector__required", "aria-hidden": !0, children: "*" })
|
|
1145
1155
|
] }),
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
|
|
1156
|
+
/* @__PURE__ */ _("div", { className: "nice-currency-selector__inner", style: le, children: [
|
|
1157
|
+
F && /* @__PURE__ */ c(
|
|
1148
1158
|
"input",
|
|
1149
1159
|
{
|
|
1150
1160
|
type: "search",
|
|
1151
1161
|
className: "nice-currency-selector__search",
|
|
1152
|
-
placeholder:
|
|
1153
|
-
value:
|
|
1154
|
-
onChange: (
|
|
1155
|
-
disabled: Q ||
|
|
1156
|
-
"aria-label":
|
|
1162
|
+
placeholder: T("currencySelector.searchCurrency", "Search currency…"),
|
|
1163
|
+
value: V,
|
|
1164
|
+
onChange: (x) => ne(x.target.value),
|
|
1165
|
+
disabled: Q || re,
|
|
1166
|
+
"aria-label": T("currencySelector.searchCurrency2", "Search currency")
|
|
1157
1167
|
}
|
|
1158
1168
|
),
|
|
1159
|
-
/* @__PURE__ */
|
|
1169
|
+
/* @__PURE__ */ _(
|
|
1160
1170
|
"select",
|
|
1161
1171
|
{
|
|
1162
|
-
id:
|
|
1163
|
-
name:
|
|
1172
|
+
id: X,
|
|
1173
|
+
name: I,
|
|
1164
1174
|
className: "nice-currency-selector__select",
|
|
1165
1175
|
value: e ?? "",
|
|
1166
|
-
onChange:
|
|
1167
|
-
disabled: Q ||
|
|
1168
|
-
required:
|
|
1169
|
-
"aria-invalid": !!
|
|
1170
|
-
"aria-label":
|
|
1176
|
+
onChange: O,
|
|
1177
|
+
disabled: Q || re,
|
|
1178
|
+
required: k,
|
|
1179
|
+
"aria-invalid": !!h,
|
|
1180
|
+
"aria-label": ee ?? (typeof u == "string" ? u : T("currencySelector.currency", "Currency")),
|
|
1171
1181
|
children: [
|
|
1172
|
-
!e && /* @__PURE__ */ c("option", { value: "", children:
|
|
1173
|
-
|
|
1174
|
-
/* @__PURE__ */ c("optgroup", { label:
|
|
1182
|
+
!e && /* @__PURE__ */ c("option", { value: "", children: A ?? T("currencySelector.selectCurrency", "Select currency…") }),
|
|
1183
|
+
p.length > 0 && /* @__PURE__ */ c("optgroup", { label: T("currencySelector.recent", "Recent"), children: p.map((x) => /* @__PURE__ */ c("option", { value: x.code, children: L(x) }, `r-${x.code}`)) }),
|
|
1184
|
+
/* @__PURE__ */ c("optgroup", { label: p.length > 0 ? T("currencySelector.all", "All") : "", children: C.map((x) => /* @__PURE__ */ c("option", { value: x.code, children: L(x) }, x.code)) })
|
|
1175
1185
|
]
|
|
1176
1186
|
}
|
|
1177
1187
|
)
|
|
1178
1188
|
] }),
|
|
1179
|
-
(
|
|
1189
|
+
(h || b) && /* @__PURE__ */ c(
|
|
1180
1190
|
"span",
|
|
1181
1191
|
{
|
|
1182
|
-
className:
|
|
1183
|
-
children:
|
|
1192
|
+
className: h ? "nice-currency-selector__error" : "nice-currency-selector__helper",
|
|
1193
|
+
children: h ?? b
|
|
1184
1194
|
}
|
|
1185
1195
|
)
|
|
1186
1196
|
] });
|
|
1187
|
-
}),
|
|
1197
|
+
}), Ve = /* @__PURE__ */ se(
|
|
1188
1198
|
function({
|
|
1189
1199
|
value: e,
|
|
1190
1200
|
onChange: r,
|
|
1191
1201
|
currency: n,
|
|
1192
1202
|
onCurrencyChange: a,
|
|
1193
|
-
currencies:
|
|
1203
|
+
currencies: s,
|
|
1194
1204
|
hideCurrencySelector: d,
|
|
1195
|
-
min:
|
|
1205
|
+
min: i,
|
|
1196
1206
|
max: o,
|
|
1197
1207
|
step: l,
|
|
1198
1208
|
locale: y,
|
|
1199
|
-
placeholder:
|
|
1209
|
+
placeholder: N,
|
|
1200
1210
|
label: f,
|
|
1201
1211
|
helperText: u,
|
|
1202
|
-
error:
|
|
1203
|
-
size:
|
|
1204
|
-
disabled:
|
|
1205
|
-
readOnly:
|
|
1206
|
-
required:
|
|
1207
|
-
loading:
|
|
1208
|
-
accessMode:
|
|
1209
|
-
labelPlacement:
|
|
1210
|
-
errorPlacement:
|
|
1212
|
+
error: b,
|
|
1213
|
+
size: h = "md",
|
|
1214
|
+
disabled: k,
|
|
1215
|
+
readOnly: R,
|
|
1216
|
+
required: m,
|
|
1217
|
+
loading: g,
|
|
1218
|
+
accessMode: v,
|
|
1219
|
+
labelPlacement: S = "top",
|
|
1220
|
+
errorPlacement: E = "bottom",
|
|
1211
1221
|
labelWidth: M,
|
|
1212
|
-
controlWidth:
|
|
1213
|
-
submitOnEnter:
|
|
1214
|
-
onSubmit:
|
|
1215
|
-
showFormattedPreview:
|
|
1216
|
-
showSteppers:
|
|
1217
|
-
className:
|
|
1218
|
-
style:
|
|
1219
|
-
id:
|
|
1222
|
+
controlWidth: I,
|
|
1223
|
+
submitOnEnter: q,
|
|
1224
|
+
onSubmit: $,
|
|
1225
|
+
showFormattedPreview: ee = !0,
|
|
1226
|
+
showSteppers: A = !1,
|
|
1227
|
+
className: P,
|
|
1228
|
+
style: T,
|
|
1229
|
+
id: K,
|
|
1220
1230
|
name: Q,
|
|
1221
|
-
title:
|
|
1222
|
-
"data-testid":
|
|
1223
|
-
onBlur:
|
|
1224
|
-
onFocus:
|
|
1225
|
-
liveGrouping:
|
|
1226
|
-
multiplierShortcuts:
|
|
1227
|
-
onValidationError:
|
|
1228
|
-
},
|
|
1229
|
-
const { t:
|
|
1230
|
-
() => e ? (e.amount / Math.pow(10,
|
|
1231
|
-
), [
|
|
1232
|
-
|
|
1233
|
-
if (
|
|
1231
|
+
title: re,
|
|
1232
|
+
"data-testid": G,
|
|
1233
|
+
onBlur: X,
|
|
1234
|
+
onFocus: V,
|
|
1235
|
+
liveGrouping: ne,
|
|
1236
|
+
multiplierShortcuts: F = !0,
|
|
1237
|
+
onValidationError: C
|
|
1238
|
+
}, p) {
|
|
1239
|
+
const { t: O } = oe(), L = k || v === "disabled" || g, D = R || v === "readOnly", z = v === "hidden", le = Ne(), x = K ?? `nice-money-${le}`, U = ((e == null ? void 0 : e.currency) ?? n ?? "USD").toUpperCase(), de = te(U), J = (de == null ? void 0 : de.decimals) ?? 2, Se = l ?? 1 / Math.pow(10, J), [we, he] = j(
|
|
1240
|
+
() => e ? (e.amount / Math.pow(10, J)).toFixed(J) : ""
|
|
1241
|
+
), [ke, Fe] = j(!1);
|
|
1242
|
+
ot.useEffect(() => {
|
|
1243
|
+
if (ke)
|
|
1234
1244
|
return;
|
|
1235
1245
|
if (e == null) {
|
|
1236
|
-
|
|
1246
|
+
he("");
|
|
1237
1247
|
return;
|
|
1238
1248
|
}
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
}, [e,
|
|
1242
|
-
const
|
|
1243
|
-
(
|
|
1244
|
-
let
|
|
1245
|
-
if (
|
|
1246
|
-
const ue =
|
|
1249
|
+
const w = te(e.currency), H = (w == null ? void 0 : w.decimals) ?? 2;
|
|
1250
|
+
he((e.amount / Math.pow(10, H)).toFixed(H));
|
|
1251
|
+
}, [e, ke]);
|
|
1252
|
+
const Oe = Y(
|
|
1253
|
+
(w) => {
|
|
1254
|
+
let H = w;
|
|
1255
|
+
if (F) {
|
|
1256
|
+
const ue = w.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);
|
|
1247
1257
|
if (ue) {
|
|
1248
|
-
const me = ue[2].toLowerCase() === "k" ? 1e3 : ue[2].toLowerCase() === "m" ? 1e6 : 1e9,
|
|
1249
|
-
if (!Number.isFinite(
|
|
1250
|
-
|
|
1258
|
+
const me = ue[2].toLowerCase() === "k" ? 1e3 : ue[2].toLowerCase() === "m" ? 1e6 : 1e9, Be = Number(ue[1].replace(",", ".")) * me;
|
|
1259
|
+
if (!Number.isFinite(Be)) {
|
|
1260
|
+
C == null || C(new Error("overflow"));
|
|
1251
1261
|
return;
|
|
1252
1262
|
}
|
|
1253
|
-
|
|
1263
|
+
H = String(Be);
|
|
1254
1264
|
}
|
|
1255
1265
|
}
|
|
1256
|
-
const
|
|
1257
|
-
if (!
|
|
1266
|
+
const ce = ft(H, U);
|
|
1267
|
+
if (!ce) {
|
|
1258
1268
|
r == null || r(null);
|
|
1259
1269
|
return;
|
|
1260
1270
|
}
|
|
1261
|
-
if (!Number.isSafeInteger(
|
|
1262
|
-
|
|
1271
|
+
if (!Number.isSafeInteger(ce.amount)) {
|
|
1272
|
+
C == null || C(new Error("overflow: amount exceeds Number.MAX_SAFE_INTEGER"));
|
|
1263
1273
|
return;
|
|
1264
1274
|
}
|
|
1265
|
-
const
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1275
|
+
const pe = ce.amount / Math.pow(10, J);
|
|
1276
|
+
if (i != null && pe < i) {
|
|
1277
|
+
C == null || C(new Error(`min: ${i}`)), r == null || r(ae(i, U));
|
|
1268
1278
|
return;
|
|
1269
1279
|
}
|
|
1270
|
-
if (o != null &&
|
|
1271
|
-
|
|
1280
|
+
if (o != null && pe > o) {
|
|
1281
|
+
C == null || C(new Error(`max: ${o}`)), r == null || r(ae(o, U));
|
|
1272
1282
|
return;
|
|
1273
1283
|
}
|
|
1274
|
-
r == null || r(
|
|
1284
|
+
r == null || r(ce);
|
|
1285
|
+
},
|
|
1286
|
+
[U, J, i, o, r, F, C]
|
|
1287
|
+
), We = Y(
|
|
1288
|
+
(w) => {
|
|
1289
|
+
const H = w.target.value;
|
|
1290
|
+
he(H), Oe(H);
|
|
1275
1291
|
},
|
|
1276
|
-
[
|
|
1277
|
-
),
|
|
1278
|
-
(
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1292
|
+
[Oe]
|
|
1293
|
+
), Ce = Y(
|
|
1294
|
+
(w) => {
|
|
1295
|
+
const H = Math.min(o ?? 1 / 0, Math.max(i ?? -1 / 0, w));
|
|
1296
|
+
he(H.toFixed(J)), r == null || r(ae(H, U));
|
|
1281
1297
|
},
|
|
1282
|
-
[
|
|
1283
|
-
),
|
|
1284
|
-
(
|
|
1285
|
-
|
|
1286
|
-
|
|
1298
|
+
[J, i, o, U, r]
|
|
1299
|
+
), $e = Y(
|
|
1300
|
+
(w) => Ce((e ? e.amount / Math.pow(10, J) : 0) + w),
|
|
1301
|
+
[e, J, Ce]
|
|
1302
|
+
), qe = Re(null), ge = Re(null), et = A && !L && !D;
|
|
1303
|
+
ut(qe, {
|
|
1304
|
+
kind: A ? "value" : "text",
|
|
1305
|
+
disabled: L || D,
|
|
1306
|
+
restoreOnCancel: A,
|
|
1307
|
+
onEngage: () => {
|
|
1308
|
+
ge.current = { value: e ?? null, draft: we };
|
|
1287
1309
|
},
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1310
|
+
onRelease: (w) => {
|
|
1311
|
+
w && A && ge.current && (he(ge.current.draft), r == null || r(ge.current.value)), ge.current = null;
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
const De = B(() => {
|
|
1315
|
+
var w, H;
|
|
1291
1316
|
try {
|
|
1292
|
-
const
|
|
1293
|
-
return { group:
|
|
1317
|
+
const ce = new Intl.NumberFormat(y).formatToParts(12345.6), pe = ((w = ce.find((me) => me.type === "group")) == null ? void 0 : w.value) ?? ",", ue = ((H = ce.find((me) => me.type === "decimal")) == null ? void 0 : H.value) ?? ".";
|
|
1318
|
+
return { group: pe, decimal: ue };
|
|
1294
1319
|
} catch {
|
|
1295
1320
|
return { group: ",", decimal: "." };
|
|
1296
1321
|
}
|
|
1297
|
-
}, [y]),
|
|
1298
|
-
if (!
|
|
1299
|
-
return
|
|
1300
|
-
const
|
|
1301
|
-
new RegExp(`[${
|
|
1322
|
+
}, [y]), Ke = ne ?? !!De.group, tt = B(() => {
|
|
1323
|
+
if (!Ke || ke === !1)
|
|
1324
|
+
return we;
|
|
1325
|
+
const w = De.decimal, H = De.group, ce = we.replace(
|
|
1326
|
+
new RegExp(`[${H.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`, "g"),
|
|
1302
1327
|
""
|
|
1303
|
-
), [
|
|
1304
|
-
if (!
|
|
1305
|
-
return
|
|
1306
|
-
const me =
|
|
1307
|
-
return ue != null ? `${me}${
|
|
1308
|
-
}, [
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1328
|
+
), [pe, ue] = ce.split(w);
|
|
1329
|
+
if (!pe)
|
|
1330
|
+
return ce;
|
|
1331
|
+
const me = pe.replace(/\B(?=(\d{3})+(?!\d))/g, H);
|
|
1332
|
+
return ue != null ? `${me}${w}${ue}` : me;
|
|
1333
|
+
}, [we, ke, Ke, De]), xe = B(() => e ? ie(e, { locale: y }) : "", [e, y]), fe = typeof b == "string" ? b : void 0, rt = `nice-money-input nice-money-input--${h} nice-money-input--label-${S} nice-money-input--error-${E}` + (fe ? " nice-money-input--error" : "") + (L ? " nice-money-input--disabled" : "") + (g ? " nice-money-input--loading" : "") + (P ? ` ${P}` : ""), nt = (w) => {
|
|
1334
|
+
if (q && w.key === "Enter" && $) {
|
|
1335
|
+
w.preventDefault(), $();
|
|
1336
|
+
return;
|
|
1337
|
+
}
|
|
1338
|
+
if (!et)
|
|
1339
|
+
return;
|
|
1340
|
+
const H = w.key === "ArrowUp" ? 1 : w.key === "ArrowDown" ? -1 : w.key === "PageUp" ? 10 : w.key === "PageDown" ? -10 : 0;
|
|
1341
|
+
H ? (w.preventDefault(), $e(H * Se)) : w.key === "Home" && i != null ? (w.preventDefault(), Ce(i)) : w.key === "End" && o != null && (w.preventDefault(), Ce(o));
|
|
1342
|
+
}, at = S === "left" && M != null ? { width: typeof M == "number" ? `${M}px` : M, flex: "none" } : void 0, ct = I != null ? {
|
|
1343
|
+
width: typeof I == "number" ? `${I}px` : I,
|
|
1312
1344
|
flex: "none"
|
|
1313
1345
|
} : void 0;
|
|
1314
|
-
return
|
|
1315
|
-
f && /* @__PURE__ */
|
|
1346
|
+
return z ? null : /* @__PURE__ */ _("div", { ref: p, className: rt, style: T, title: re, "data-testid": G, children: [
|
|
1347
|
+
f && /* @__PURE__ */ _("label", { htmlFor: x, className: "nice-money-input__label", style: at, children: [
|
|
1316
1348
|
f,
|
|
1317
|
-
|
|
1349
|
+
m && /* @__PURE__ */ c("span", { className: "nice-money-input__required", "aria-hidden": !0, children: "*" })
|
|
1318
1350
|
] }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1351
|
+
/* @__PURE__ */ _("div", { className: "nice-money-input__row", style: ct, children: [
|
|
1320
1352
|
!d && /* @__PURE__ */ c(
|
|
1321
|
-
|
|
1353
|
+
Qe,
|
|
1322
1354
|
{
|
|
1323
|
-
value:
|
|
1355
|
+
value: U,
|
|
1324
1356
|
compact: !0,
|
|
1325
|
-
options:
|
|
1326
|
-
onChange: (
|
|
1327
|
-
disabled:
|
|
1357
|
+
options: s ? s.map(te).filter((w) => !!w) : void 0,
|
|
1358
|
+
onChange: (w) => a == null ? void 0 : a(w),
|
|
1359
|
+
disabled: L || D,
|
|
1328
1360
|
className: "nice-money-input__currency",
|
|
1329
|
-
"aria-label":
|
|
1361
|
+
"aria-label": O("moneyInput.currency", "Currency")
|
|
1330
1362
|
}
|
|
1331
1363
|
),
|
|
1332
|
-
d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (
|
|
1333
|
-
|
|
1364
|
+
d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (de == null ? void 0 : de.symbol) ?? U }),
|
|
1365
|
+
A && /* @__PURE__ */ c(
|
|
1334
1366
|
"button",
|
|
1335
1367
|
{
|
|
1336
1368
|
type: "button",
|
|
1337
1369
|
className: "nice-money-input__step nice-money-input__step--down",
|
|
1338
|
-
onClick: () =>
|
|
1339
|
-
disabled:
|
|
1340
|
-
"aria-label":
|
|
1370
|
+
onClick: () => $e(-Se),
|
|
1371
|
+
disabled: L || D || i != null && e != null && e.amount / Math.pow(10, J) <= i,
|
|
1372
|
+
"aria-label": O("moneyInput.decreaseAmount", "Decrease amount"),
|
|
1341
1373
|
tabIndex: -1,
|
|
1342
|
-
children: "
|
|
1374
|
+
children: /* @__PURE__ */ c(ve, { name: "minus", size: 14 })
|
|
1343
1375
|
}
|
|
1344
1376
|
),
|
|
1345
1377
|
/* @__PURE__ */ c(
|
|
1346
1378
|
"input",
|
|
1347
1379
|
{
|
|
1348
|
-
|
|
1380
|
+
ref: qe,
|
|
1381
|
+
id: x,
|
|
1349
1382
|
name: Q,
|
|
1350
1383
|
type: "text",
|
|
1351
1384
|
inputMode: "decimal",
|
|
1352
1385
|
autoComplete: "transaction-amount",
|
|
1353
1386
|
className: "nice-money-input__amount",
|
|
1354
|
-
value:
|
|
1355
|
-
onChange:
|
|
1356
|
-
onKeyDown:
|
|
1357
|
-
onFocus: (
|
|
1358
|
-
|
|
1387
|
+
value: tt,
|
|
1388
|
+
onChange: We,
|
|
1389
|
+
onKeyDown: nt,
|
|
1390
|
+
onFocus: (w) => {
|
|
1391
|
+
Fe(!0), V == null || V(w);
|
|
1359
1392
|
},
|
|
1360
|
-
onBlur: (
|
|
1361
|
-
|
|
1393
|
+
onBlur: (w) => {
|
|
1394
|
+
Fe(!1), e && he((e.amount / Math.pow(10, J)).toFixed(J)), X == null || X(w);
|
|
1362
1395
|
},
|
|
1363
|
-
placeholder:
|
|
1364
|
-
disabled:
|
|
1365
|
-
readOnly:
|
|
1366
|
-
required:
|
|
1367
|
-
"aria-invalid": !!
|
|
1368
|
-
"aria-describedby":
|
|
1396
|
+
placeholder: N ?? `0${J > 0 ? "." + "0".repeat(J) : ""}`,
|
|
1397
|
+
disabled: L,
|
|
1398
|
+
readOnly: D,
|
|
1399
|
+
required: m,
|
|
1400
|
+
"aria-invalid": !!fe,
|
|
1401
|
+
"aria-describedby": fe || u ? `${x}-help` : void 0,
|
|
1402
|
+
...A && {
|
|
1403
|
+
role: "spinbutton",
|
|
1404
|
+
"aria-valuenow": e ? e.amount / Math.pow(10, J) : void 0,
|
|
1405
|
+
"aria-valuemin": i,
|
|
1406
|
+
"aria-valuemax": o,
|
|
1407
|
+
"aria-valuetext": xe || void 0
|
|
1408
|
+
}
|
|
1369
1409
|
}
|
|
1370
1410
|
),
|
|
1371
|
-
|
|
1411
|
+
A && /* @__PURE__ */ c(
|
|
1372
1412
|
"button",
|
|
1373
1413
|
{
|
|
1374
1414
|
type: "button",
|
|
1375
1415
|
className: "nice-money-input__step nice-money-input__step--up",
|
|
1376
|
-
onClick: () =>
|
|
1377
|
-
disabled:
|
|
1378
|
-
"aria-label":
|
|
1416
|
+
onClick: () => $e(Se),
|
|
1417
|
+
disabled: L || D || o != null && e != null && e.amount / Math.pow(10, J) >= o,
|
|
1418
|
+
"aria-label": O("moneyInput.increaseAmount", "Increase amount"),
|
|
1379
1419
|
tabIndex: -1,
|
|
1380
|
-
children: "
|
|
1420
|
+
children: /* @__PURE__ */ c(ve, { name: "plus", size: 14 })
|
|
1381
1421
|
}
|
|
1382
1422
|
),
|
|
1383
|
-
|
|
1423
|
+
g && /* @__PURE__ */ c("span", { className: "nice-money-input__spinner", "aria-hidden": !0, children: /* @__PURE__ */ c(ve, { name: "refresh", size: 14 }) })
|
|
1384
1424
|
] }),
|
|
1385
|
-
|
|
1386
|
-
(
|
|
1425
|
+
ee && xe && /* @__PURE__ */ c("span", { className: "nice-money-input__preview", "aria-live": "polite", children: xe }),
|
|
1426
|
+
(fe || u) && /* @__PURE__ */ c(
|
|
1387
1427
|
"span",
|
|
1388
1428
|
{
|
|
1389
|
-
id: `${
|
|
1390
|
-
className:
|
|
1391
|
-
children:
|
|
1429
|
+
id: `${x}-help`,
|
|
1430
|
+
className: fe ? "nice-money-input__error" : "nice-money-input__helper",
|
|
1431
|
+
children: fe ?? u
|
|
1392
1432
|
}
|
|
1393
1433
|
)
|
|
1394
1434
|
] });
|
|
1395
1435
|
}
|
|
1396
|
-
),
|
|
1397
|
-
value: e =
|
|
1436
|
+
), Yt = { number: "", expiry: "", cvc: "" }, Gt = /* @__PURE__ */ se(function({
|
|
1437
|
+
value: e = Yt,
|
|
1398
1438
|
onChange: r,
|
|
1399
1439
|
showHolderName: n = !0,
|
|
1400
1440
|
requireHolderName: a,
|
|
1401
|
-
showPostalCode:
|
|
1441
|
+
showPostalCode: s = !1,
|
|
1402
1442
|
acceptedBrands: d,
|
|
1403
|
-
showBrandIcon:
|
|
1443
|
+
showBrandIcon: i = !0,
|
|
1404
1444
|
size: o = "md",
|
|
1405
1445
|
disabled: l,
|
|
1406
1446
|
readOnly: y,
|
|
1407
|
-
loading:
|
|
1447
|
+
loading: N,
|
|
1408
1448
|
accessMode: f,
|
|
1409
1449
|
label: u,
|
|
1410
|
-
helperText:
|
|
1411
|
-
error:
|
|
1412
|
-
required:
|
|
1413
|
-
className:
|
|
1414
|
-
style:
|
|
1415
|
-
id:
|
|
1416
|
-
title:
|
|
1417
|
-
"data-testid":
|
|
1418
|
-
},
|
|
1419
|
-
const { t: M } =
|
|
1450
|
+
helperText: b,
|
|
1451
|
+
error: h,
|
|
1452
|
+
required: k,
|
|
1453
|
+
className: R,
|
|
1454
|
+
style: m,
|
|
1455
|
+
id: g,
|
|
1456
|
+
title: v,
|
|
1457
|
+
"data-testid": S
|
|
1458
|
+
}, E) {
|
|
1459
|
+
const { t: M } = oe(), I = f === "hidden", q = l || f === "disabled" || N, $ = y || f === "readOnly", ee = Ne(), A = g ?? `nice-cc-${ee}`, [P, T] = j({
|
|
1420
1460
|
number: !1,
|
|
1421
1461
|
expiry: !1,
|
|
1422
1462
|
cvc: !1,
|
|
1423
1463
|
holder: !1,
|
|
1424
1464
|
postal: !1
|
|
1425
|
-
}),
|
|
1426
|
-
() =>
|
|
1465
|
+
}), K = B(() => Me(e.number), [e.number]), Q = B(
|
|
1466
|
+
() => Le(e, { requireHolder: a ?? n }),
|
|
1427
1467
|
[e, a, n]
|
|
1428
|
-
),
|
|
1429
|
-
(
|
|
1430
|
-
const
|
|
1431
|
-
r == null || r(
|
|
1468
|
+
), re = !d || d.includes(K) || K === "unknown", G = Y(
|
|
1469
|
+
(D) => {
|
|
1470
|
+
const z = { ...e, ...D }, le = Le(z, { requireHolder: a ?? n });
|
|
1471
|
+
r == null || r(z, le);
|
|
1432
1472
|
},
|
|
1433
1473
|
[e, a, n, r]
|
|
1434
|
-
),
|
|
1435
|
-
(
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1474
|
+
), X = Y(
|
|
1475
|
+
(D) => {
|
|
1476
|
+
const z = D.target.value.replace(/\D/g, "").slice(0, 19);
|
|
1477
|
+
G({ number: z });
|
|
1438
1478
|
},
|
|
1439
|
-
[
|
|
1440
|
-
),
|
|
1441
|
-
(
|
|
1442
|
-
const
|
|
1443
|
-
let
|
|
1444
|
-
|
|
1479
|
+
[G]
|
|
1480
|
+
), V = Y(
|
|
1481
|
+
(D) => {
|
|
1482
|
+
const z = D.target.value.replace(/\D/g, "").slice(0, 4);
|
|
1483
|
+
let le = z;
|
|
1484
|
+
z.length >= 3 ? le = `${z.slice(0, 2)}/${z.slice(2)}` : z.length === 2 && (le = `${z}/`), G({ expiry: le });
|
|
1445
1485
|
},
|
|
1446
|
-
[
|
|
1447
|
-
),
|
|
1448
|
-
(
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1486
|
+
[G]
|
|
1487
|
+
), ne = Y(
|
|
1488
|
+
(D) => {
|
|
1489
|
+
const z = D.target.value.replace(/\D/g, "").slice(0, be(K));
|
|
1490
|
+
G({ cvc: z });
|
|
1451
1491
|
},
|
|
1452
|
-
[
|
|
1453
|
-
),
|
|
1454
|
-
return
|
|
1455
|
-
u && /* @__PURE__ */
|
|
1492
|
+
[K, G]
|
|
1493
|
+
), F = B(() => bt(e.number, K), [e.number, K]), C = P.number && e.number.length > 0 && (Ze(e.number) ? re ? void 0 : "Card brand not accepted" : Q.errors.number), p = P.expiry && e.expiry.length > 0 && !Xe(e.expiry) ? Q.errors.expiry : void 0, O = P.cvc && e.cvc.length > 0 && e.cvc.length !== be(K) ? Q.errors.cvc : void 0, L = `nice-credit-card nice-credit-card--${o}` + (q ? " nice-credit-card--disabled" : "") + (N ? " nice-credit-card--loading" : "") + (h ? " nice-credit-card--error" : "") + (R ? ` ${R}` : "");
|
|
1494
|
+
return I ? null : /* @__PURE__ */ _("div", { ref: E, className: L, style: m, title: v, "data-testid": S, children: [
|
|
1495
|
+
u && /* @__PURE__ */ _("div", { className: "nice-credit-card__title", children: [
|
|
1456
1496
|
u,
|
|
1457
|
-
|
|
1497
|
+
k && /* @__PURE__ */ c("span", { className: "nice-credit-card__required", "aria-hidden": !0, children: "*" })
|
|
1458
1498
|
] }),
|
|
1459
|
-
/* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field nice-credit-card__field--number", children: [
|
|
1460
1500
|
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardNumber", "Card number") }),
|
|
1461
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ _("span", { className: "nice-credit-card__input-wrapper", children: [
|
|
1462
1502
|
/* @__PURE__ */ c(
|
|
1463
1503
|
"input",
|
|
1464
1504
|
{
|
|
1465
|
-
id: `${
|
|
1505
|
+
id: `${A}-number`,
|
|
1466
1506
|
type: "text",
|
|
1467
1507
|
inputMode: "numeric",
|
|
1468
1508
|
autoComplete: "cc-number",
|
|
1469
|
-
placeholder:
|
|
1470
|
-
value:
|
|
1471
|
-
onChange:
|
|
1472
|
-
onBlur: () =>
|
|
1473
|
-
disabled:
|
|
1474
|
-
readOnly:
|
|
1475
|
-
"aria-invalid": !!
|
|
1476
|
-
"aria-describedby":
|
|
1509
|
+
placeholder: K === "amex" ? "3782 822463 10005" : "1234 1234 1234 1234",
|
|
1510
|
+
value: F,
|
|
1511
|
+
onChange: X,
|
|
1512
|
+
onBlur: () => T((D) => ({ ...D, number: !0 })),
|
|
1513
|
+
disabled: q,
|
|
1514
|
+
readOnly: $,
|
|
1515
|
+
"aria-invalid": !!C,
|
|
1516
|
+
"aria-describedby": C ? `${A}-number-err` : void 0,
|
|
1477
1517
|
className: "nice-credit-card__input",
|
|
1478
|
-
maxLength:
|
|
1518
|
+
maxLength: K === "amex" ? 17 : 23
|
|
1479
1519
|
}
|
|
1480
1520
|
),
|
|
1481
|
-
|
|
1521
|
+
i && /* @__PURE__ */ c(Zt, { brand: K })
|
|
1482
1522
|
] }),
|
|
1483
|
-
|
|
1523
|
+
C && /* @__PURE__ */ c("span", { id: `${A}-number-err`, className: "nice-credit-card__error", children: C })
|
|
1484
1524
|
] }) }),
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1525
|
+
/* @__PURE__ */ _("div", { className: "nice-credit-card__row nice-credit-card__row--split", children: [
|
|
1526
|
+
/* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
|
|
1487
1527
|
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.expiry", "Expiry") }),
|
|
1488
1528
|
/* @__PURE__ */ c(
|
|
1489
1529
|
"input",
|
|
1490
1530
|
{
|
|
1491
|
-
id: `${
|
|
1531
|
+
id: `${A}-expiry`,
|
|
1492
1532
|
type: "text",
|
|
1493
1533
|
inputMode: "numeric",
|
|
1494
1534
|
autoComplete: "cc-exp",
|
|
1495
1535
|
placeholder: M("creditCardInput.mmYy", "MM/YY"),
|
|
1496
1536
|
value: e.expiry,
|
|
1497
|
-
onChange:
|
|
1537
|
+
onChange: V,
|
|
1498
1538
|
onBlur: () => {
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1539
|
+
T((z) => ({ ...z, expiry: !0 }));
|
|
1540
|
+
const D = Je(e.expiry);
|
|
1541
|
+
D && D !== e.expiry && G({ expiry: D });
|
|
1502
1542
|
},
|
|
1503
|
-
disabled:
|
|
1504
|
-
readOnly:
|
|
1505
|
-
"aria-invalid": !!
|
|
1506
|
-
"aria-describedby":
|
|
1543
|
+
disabled: q,
|
|
1544
|
+
readOnly: $,
|
|
1545
|
+
"aria-invalid": !!p,
|
|
1546
|
+
"aria-describedby": p ? `${A}-expiry-err` : void 0,
|
|
1507
1547
|
className: "nice-credit-card__input",
|
|
1508
1548
|
maxLength: 5
|
|
1509
1549
|
}
|
|
1510
1550
|
),
|
|
1511
|
-
|
|
1551
|
+
p && /* @__PURE__ */ c("span", { id: `${A}-expiry-err`, className: "nice-credit-card__error", children: p })
|
|
1512
1552
|
] }),
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children:
|
|
1553
|
+
/* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
|
|
1554
|
+
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: K === "amex" ? M("creditCardInput.cid", "CID") : M("creditCardInput.cvc", "CVC") }),
|
|
1515
1555
|
/* @__PURE__ */ c(
|
|
1516
1556
|
"input",
|
|
1517
1557
|
{
|
|
1518
|
-
id: `${
|
|
1558
|
+
id: `${A}-cvc`,
|
|
1519
1559
|
type: "text",
|
|
1520
1560
|
inputMode: "numeric",
|
|
1521
1561
|
autoComplete: "cc-csc",
|
|
1522
|
-
placeholder: "•".repeat(be(
|
|
1562
|
+
placeholder: "•".repeat(be(K)),
|
|
1523
1563
|
value: e.cvc,
|
|
1524
|
-
onChange:
|
|
1525
|
-
onBlur: () =>
|
|
1526
|
-
disabled:
|
|
1527
|
-
readOnly:
|
|
1528
|
-
"aria-invalid": !!
|
|
1529
|
-
"aria-describedby":
|
|
1564
|
+
onChange: ne,
|
|
1565
|
+
onBlur: () => T((D) => ({ ...D, cvc: !0 })),
|
|
1566
|
+
disabled: q,
|
|
1567
|
+
readOnly: $,
|
|
1568
|
+
"aria-invalid": !!O,
|
|
1569
|
+
"aria-describedby": O ? `${A}-cvc-err` : void 0,
|
|
1530
1570
|
className: "nice-credit-card__input",
|
|
1531
|
-
maxLength: be(
|
|
1571
|
+
maxLength: be(K)
|
|
1532
1572
|
}
|
|
1533
1573
|
),
|
|
1534
|
-
|
|
1574
|
+
O && /* @__PURE__ */ c("span", { id: `${A}-cvc-err`, className: "nice-credit-card__error", children: O })
|
|
1535
1575
|
] })
|
|
1536
1576
|
] }),
|
|
1537
|
-
n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */
|
|
1577
|
+
n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
|
|
1538
1578
|
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardholderName", "Cardholder name") }),
|
|
1539
1579
|
/* @__PURE__ */ c(
|
|
1540
1580
|
"input",
|
|
1541
1581
|
{
|
|
1542
|
-
id: `${
|
|
1582
|
+
id: `${A}-holder`,
|
|
1543
1583
|
type: "text",
|
|
1544
1584
|
autoComplete: "cc-name",
|
|
1545
1585
|
placeholder: M("creditCardInput.janeDoe", "Jane Doe"),
|
|
1546
1586
|
value: e.holderName ?? "",
|
|
1547
|
-
onChange: (
|
|
1548
|
-
onBlur: () =>
|
|
1549
|
-
disabled:
|
|
1550
|
-
readOnly:
|
|
1587
|
+
onChange: (D) => G({ holderName: D.target.value }),
|
|
1588
|
+
onBlur: () => T((D) => ({ ...D, holder: !0 })),
|
|
1589
|
+
disabled: q,
|
|
1590
|
+
readOnly: $,
|
|
1551
1591
|
className: "nice-credit-card__input",
|
|
1552
1592
|
maxLength: 120
|
|
1553
1593
|
}
|
|
1554
1594
|
)
|
|
1555
1595
|
] }) }),
|
|
1556
|
-
|
|
1596
|
+
s && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
|
|
1557
1597
|
/* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.postalCode", "Postal code") }),
|
|
1558
1598
|
/* @__PURE__ */ c(
|
|
1559
1599
|
"input",
|
|
1560
1600
|
{
|
|
1561
|
-
id: `${
|
|
1601
|
+
id: `${A}-postal`,
|
|
1562
1602
|
type: "text",
|
|
1563
1603
|
autoComplete: "postal-code",
|
|
1564
1604
|
value: e.postalCode ?? "",
|
|
1565
|
-
onChange: (
|
|
1566
|
-
onBlur: () =>
|
|
1567
|
-
disabled:
|
|
1568
|
-
readOnly:
|
|
1605
|
+
onChange: (D) => G({ postalCode: D.target.value }),
|
|
1606
|
+
onBlur: () => T((D) => ({ ...D, postal: !0 })),
|
|
1607
|
+
disabled: q,
|
|
1608
|
+
readOnly: $,
|
|
1569
1609
|
className: "nice-credit-card__input",
|
|
1570
1610
|
maxLength: 16
|
|
1571
1611
|
}
|
|
1572
1612
|
)
|
|
1573
1613
|
] }) }),
|
|
1574
|
-
(
|
|
1614
|
+
(h || b) && /* @__PURE__ */ c(
|
|
1575
1615
|
"div",
|
|
1576
1616
|
{
|
|
1577
|
-
className:
|
|
1578
|
-
role:
|
|
1579
|
-
children:
|
|
1617
|
+
className: h ? "nice-credit-card__form-error" : "nice-credit-card__helper",
|
|
1618
|
+
role: h ? "alert" : void 0,
|
|
1619
|
+
children: h ?? b
|
|
1580
1620
|
}
|
|
1581
1621
|
)
|
|
1582
1622
|
] });
|
|
1583
|
-
}),
|
|
1623
|
+
}), He = {
|
|
1584
1624
|
visa: "VISA",
|
|
1585
1625
|
mastercard: "MasterCard",
|
|
1586
1626
|
amex: "AMEX",
|
|
@@ -1594,148 +1634,143 @@ const Ke = /* @__PURE__ */ se(
|
|
|
1594
1634
|
hipercard: "Hipercard",
|
|
1595
1635
|
unknown: ""
|
|
1596
1636
|
};
|
|
1597
|
-
function
|
|
1637
|
+
function Zt({ brand: t }) {
|
|
1598
1638
|
return t === "unknown" ? null : /* @__PURE__ */ c(
|
|
1599
1639
|
"span",
|
|
1600
1640
|
{
|
|
1601
1641
|
className: `nice-credit-card__brand nice-credit-card__brand--${t}`,
|
|
1602
|
-
"aria-label":
|
|
1603
|
-
children:
|
|
1642
|
+
"aria-label": He[t],
|
|
1643
|
+
children: He[t]
|
|
1604
1644
|
}
|
|
1605
1645
|
);
|
|
1606
1646
|
}
|
|
1607
|
-
const
|
|
1647
|
+
const gr = /* @__PURE__ */ se(
|
|
1608
1648
|
function({
|
|
1609
1649
|
processor: e,
|
|
1610
1650
|
amount: r,
|
|
1611
1651
|
editableAmount: n,
|
|
1612
1652
|
customer: a,
|
|
1613
|
-
currencies:
|
|
1653
|
+
currencies: s,
|
|
1614
1654
|
description: d,
|
|
1615
|
-
metadata:
|
|
1655
|
+
metadata: i,
|
|
1616
1656
|
autoCapture: o = !0,
|
|
1617
|
-
submitLabel: l
|
|
1657
|
+
submitLabel: l,
|
|
1618
1658
|
onSuccess: y,
|
|
1619
|
-
onError:
|
|
1659
|
+
onError: N,
|
|
1620
1660
|
consents: f,
|
|
1621
1661
|
className: u,
|
|
1622
|
-
style:
|
|
1623
|
-
},
|
|
1624
|
-
const { t:
|
|
1625
|
-
var
|
|
1626
|
-
const
|
|
1627
|
-
return
|
|
1628
|
-
}, [e,
|
|
1629
|
-
var
|
|
1630
|
-
const
|
|
1631
|
-
return
|
|
1632
|
-
}, [e,
|
|
1633
|
-
async (
|
|
1634
|
-
if (
|
|
1635
|
-
|
|
1662
|
+
style: b
|
|
1663
|
+
}, h) {
|
|
1664
|
+
const { t: k } = oe(), R = l ?? k("paymentForm.pay", "Pay"), [m, g] = j(r), [v, S] = j(r.currency), [E, M] = j({ number: "", expiry: "", cvc: "" }), [I, q] = j(null), [$, ee] = j(!1), [A, P] = j(null), T = jt(e), K = B(() => e.supportedCurrencies === "*" ? !0 : e.supportedCurrencies.includes(m.currency.toUpperCase()), [e, m.currency]), Q = B(() => {
|
|
1665
|
+
var C;
|
|
1666
|
+
const F = (C = e.minimums) == null ? void 0 : C[m.currency.toUpperCase()];
|
|
1667
|
+
return F == null || m.amount >= F;
|
|
1668
|
+
}, [e, m]), re = B(() => {
|
|
1669
|
+
var C;
|
|
1670
|
+
const F = (C = e.minimums) == null ? void 0 : C[m.currency.toUpperCase()];
|
|
1671
|
+
return F == null ? null : { amount: F, currency: m.currency };
|
|
1672
|
+
}, [e, m.currency]), G = !!(I != null && I.isValid), X = !$ && K && Q && G, V = Y(
|
|
1673
|
+
async (F) => {
|
|
1674
|
+
if (F.preventDefault(), !!X) {
|
|
1675
|
+
P(null), ee(!0);
|
|
1636
1676
|
try {
|
|
1637
|
-
const
|
|
1638
|
-
amount:
|
|
1639
|
-
card:
|
|
1677
|
+
const C = {
|
|
1678
|
+
amount: m,
|
|
1679
|
+
card: E,
|
|
1640
1680
|
customer: a,
|
|
1641
1681
|
description: d,
|
|
1642
|
-
metadata:
|
|
1643
|
-
idempotencyKey:
|
|
1644
|
-
},
|
|
1645
|
-
if (o &&
|
|
1646
|
-
const
|
|
1647
|
-
y == null || y(
|
|
1682
|
+
metadata: i,
|
|
1683
|
+
idempotencyKey: Jt()
|
|
1684
|
+
}, p = await T.authorize(C);
|
|
1685
|
+
if (o && p.status === "authorized") {
|
|
1686
|
+
const O = await T.capture(p.id, m);
|
|
1687
|
+
y == null || y(O);
|
|
1648
1688
|
} else
|
|
1649
|
-
y == null || y(
|
|
1650
|
-
} catch (
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1689
|
+
y == null || y(p);
|
|
1690
|
+
} catch (C) {
|
|
1691
|
+
const p = C instanceof Error ? C : new Error(String(C));
|
|
1692
|
+
P(p.message), N == null || N(p);
|
|
1653
1693
|
} finally {
|
|
1654
|
-
|
|
1694
|
+
ee(!1);
|
|
1655
1695
|
}
|
|
1656
1696
|
}
|
|
1657
1697
|
},
|
|
1658
1698
|
[
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1699
|
+
X,
|
|
1700
|
+
m,
|
|
1701
|
+
E,
|
|
1662
1702
|
a,
|
|
1663
1703
|
d,
|
|
1664
|
-
|
|
1704
|
+
i,
|
|
1665
1705
|
o,
|
|
1666
|
-
|
|
1706
|
+
T,
|
|
1667
1707
|
y,
|
|
1668
|
-
|
|
1708
|
+
N
|
|
1669
1709
|
]
|
|
1670
|
-
),
|
|
1671
|
-
return /* @__PURE__ */
|
|
1710
|
+
), ne = te(m.currency);
|
|
1711
|
+
return /* @__PURE__ */ _(
|
|
1672
1712
|
"form",
|
|
1673
1713
|
{
|
|
1674
|
-
ref:
|
|
1714
|
+
ref: h,
|
|
1675
1715
|
className: "nice-payment-form" + (u ? ` ${u}` : ""),
|
|
1676
|
-
style:
|
|
1677
|
-
onSubmit:
|
|
1716
|
+
style: b,
|
|
1717
|
+
onSubmit: V,
|
|
1678
1718
|
"aria-busy": $,
|
|
1679
1719
|
children: [
|
|
1680
1720
|
/* @__PURE__ */ c("div", { className: "nice-payment-form__amount", children: n ? /* @__PURE__ */ c(
|
|
1681
|
-
|
|
1721
|
+
Ve,
|
|
1682
1722
|
{
|
|
1683
|
-
label:
|
|
1684
|
-
value:
|
|
1685
|
-
currency:
|
|
1686
|
-
currencies:
|
|
1687
|
-
onChange: (
|
|
1688
|
-
onCurrencyChange: (
|
|
1689
|
-
|
|
1723
|
+
label: k("paymentForm.amount", "Amount"),
|
|
1724
|
+
value: m,
|
|
1725
|
+
currency: v,
|
|
1726
|
+
currencies: s,
|
|
1727
|
+
onChange: (F) => F && g(F),
|
|
1728
|
+
onCurrencyChange: (F) => {
|
|
1729
|
+
S(F), g((C) => ({ ...C, currency: F }));
|
|
1690
1730
|
},
|
|
1691
1731
|
disabled: $,
|
|
1692
1732
|
required: !0,
|
|
1693
1733
|
showFormattedPreview: !0
|
|
1694
1734
|
}
|
|
1695
|
-
) : /* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */ c("span", { className: "nice-payment-form__total-label", children:
|
|
1697
|
-
/* @__PURE__ */ c(
|
|
1735
|
+
) : /* @__PURE__ */ _("div", { className: "nice-payment-form__total", children: [
|
|
1736
|
+
/* @__PURE__ */ c("span", { className: "nice-payment-form__total-label", children: k("paymentForm.total", "Total") }),
|
|
1737
|
+
/* @__PURE__ */ c(ze, { value: m })
|
|
1698
1738
|
] }) }),
|
|
1699
1739
|
d && /* @__PURE__ */ c("p", { className: "nice-payment-form__description", children: d }),
|
|
1700
1740
|
/* @__PURE__ */ c("div", { className: "nice-payment-form__card", children: /* @__PURE__ */ c(
|
|
1701
|
-
|
|
1741
|
+
Gt,
|
|
1702
1742
|
{
|
|
1703
|
-
value:
|
|
1704
|
-
onChange: (
|
|
1705
|
-
|
|
1743
|
+
value: E,
|
|
1744
|
+
onChange: (F, C) => {
|
|
1745
|
+
M(F), q(C);
|
|
1706
1746
|
},
|
|
1707
1747
|
disabled: $
|
|
1708
1748
|
}
|
|
1709
1749
|
) }),
|
|
1710
|
-
!
|
|
1711
|
-
|
|
1712
|
-
"
|
|
1713
|
-
(J == null ? void 0 : J.name) ?? p.currency,
|
|
1714
|
-
"."
|
|
1715
|
-
] }),
|
|
1716
|
-
!F && Q && /* @__PURE__ */ b("div", { className: "nice-payment-form__warning", role: "alert", children: [
|
|
1717
|
-
N("paymentForm.minimumChargeForIs", "Minimum charge for {name} is").replace(
|
|
1750
|
+
!K && /* @__PURE__ */ c("div", { className: "nice-payment-form__warning", role: "alert", children: k("paymentForm.doesNotAccept", "{provider} does not accept {currency}.").replace("{provider}", String(e.name)).replace("{currency}", String((ne == null ? void 0 : ne.name) ?? m.currency)) }),
|
|
1751
|
+
!Q && re && /* @__PURE__ */ _("div", { className: "nice-payment-form__warning", role: "alert", children: [
|
|
1752
|
+
k("paymentForm.minimumChargeForIs", "Minimum charge for {name} is").replace(
|
|
1718
1753
|
"{name}",
|
|
1719
1754
|
String(e.name)
|
|
1720
1755
|
),
|
|
1721
1756
|
" ",
|
|
1722
|
-
/* @__PURE__ */ c(
|
|
1757
|
+
/* @__PURE__ */ c(ze, { value: re }),
|
|
1723
1758
|
"."
|
|
1724
1759
|
] }),
|
|
1725
1760
|
f && /* @__PURE__ */ c("div", { className: "nice-payment-form__consents", children: f }),
|
|
1726
|
-
|
|
1761
|
+
A && /* @__PURE__ */ c("div", { className: "nice-payment-form__error", role: "alert", children: A }),
|
|
1727
1762
|
/* @__PURE__ */ c(
|
|
1728
1763
|
"button",
|
|
1729
1764
|
{
|
|
1730
1765
|
type: "submit",
|
|
1731
1766
|
className: "nice-payment-form__submit",
|
|
1732
|
-
disabled: !
|
|
1733
|
-
"aria-disabled": !
|
|
1734
|
-
children: $ ? "Processing…" :
|
|
1767
|
+
disabled: !X,
|
|
1768
|
+
"aria-disabled": !X,
|
|
1769
|
+
children: $ ? k("paymentForm.processing", "Processing…") : R
|
|
1735
1770
|
}
|
|
1736
1771
|
),
|
|
1737
|
-
/* @__PURE__ */
|
|
1738
|
-
|
|
1772
|
+
/* @__PURE__ */ _("p", { className: "nice-payment-form__processor", children: [
|
|
1773
|
+
k("paymentForm.securedBy", "Secured by"),
|
|
1739
1774
|
" ",
|
|
1740
1775
|
/* @__PURE__ */ c("strong", { children: e.name })
|
|
1741
1776
|
] })
|
|
@@ -1744,26 +1779,26 @@ const yr = /* @__PURE__ */ se(
|
|
|
1744
1779
|
);
|
|
1745
1780
|
}
|
|
1746
1781
|
);
|
|
1747
|
-
function
|
|
1782
|
+
function Jt() {
|
|
1748
1783
|
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `idem_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`;
|
|
1749
1784
|
}
|
|
1750
|
-
const
|
|
1785
|
+
const vr = /* @__PURE__ */ se(
|
|
1751
1786
|
function({
|
|
1752
1787
|
price: e,
|
|
1753
1788
|
originalPrice: r,
|
|
1754
1789
|
period: n,
|
|
1755
1790
|
prefix: a,
|
|
1756
|
-
suffix:
|
|
1791
|
+
suffix: s,
|
|
1757
1792
|
showDiscountBadge: d = !0,
|
|
1758
|
-
size:
|
|
1793
|
+
size: i = "md",
|
|
1759
1794
|
locale: o,
|
|
1760
1795
|
className: l,
|
|
1761
1796
|
style: y
|
|
1762
|
-
},
|
|
1763
|
-
const { t: f } =
|
|
1764
|
-
return /* @__PURE__ */
|
|
1797
|
+
}, N) {
|
|
1798
|
+
const { t: f } = oe(), u = r && r.currency === e.currency && r.amount > e.amount, b = B(() => !u || !r ? null : Math.round((r.amount - e.amount) / r.amount * 100), [u, r, e.amount]), h = `nice-price-tag nice-price-tag--${i}` + (l ? ` ${l}` : "");
|
|
1799
|
+
return /* @__PURE__ */ _("div", { ref: N, className: h, style: y, children: [
|
|
1765
1800
|
a && /* @__PURE__ */ c("span", { className: "nice-price-tag__prefix", children: a }),
|
|
1766
|
-
/* @__PURE__ */
|
|
1801
|
+
/* @__PURE__ */ _("span", { className: "nice-price-tag__main", children: [
|
|
1767
1802
|
/* @__PURE__ */ c("span", { className: "nice-price-tag__amount", children: ie(e, { locale: o }) }),
|
|
1768
1803
|
n && /* @__PURE__ */ c("span", { className: "nice-price-tag__period", children: n })
|
|
1769
1804
|
] }),
|
|
@@ -1775,259 +1810,266 @@ const hr = /* @__PURE__ */ se(
|
|
|
1775
1810
|
children: /* @__PURE__ */ c("s", { children: ie(r, { locale: o }) })
|
|
1776
1811
|
}
|
|
1777
1812
|
),
|
|
1778
|
-
u && d &&
|
|
1779
|
-
"
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1813
|
+
u && d && b != null && b > 0 && /* @__PURE__ */ _(
|
|
1814
|
+
"span",
|
|
1815
|
+
{
|
|
1816
|
+
className: "nice-price-tag__discount",
|
|
1817
|
+
"aria-label": f("priceTag.percentOff", "{pct} percent off").replace("{pct}", String(b)),
|
|
1818
|
+
children: [
|
|
1819
|
+
"−",
|
|
1820
|
+
b,
|
|
1821
|
+
"%"
|
|
1822
|
+
]
|
|
1823
|
+
}
|
|
1824
|
+
),
|
|
1825
|
+
s && /* @__PURE__ */ c("span", { className: "nice-price-tag__suffix", children: s })
|
|
1784
1826
|
] });
|
|
1785
1827
|
}
|
|
1786
|
-
),
|
|
1828
|
+
), Xt = { amount: 0, currency: "USD" }, Nr = /* @__PURE__ */ se(function({
|
|
1787
1829
|
source: e,
|
|
1788
1830
|
defaultSource: r,
|
|
1789
1831
|
onSourceChange: n,
|
|
1790
1832
|
targetCurrency: a,
|
|
1791
|
-
defaultTargetCurrency:
|
|
1833
|
+
defaultTargetCurrency: s,
|
|
1792
1834
|
onTargetCurrencyChange: d,
|
|
1793
|
-
provider:
|
|
1835
|
+
provider: i,
|
|
1794
1836
|
locale: o,
|
|
1795
1837
|
showRateLine: l = !0,
|
|
1796
1838
|
className: y,
|
|
1797
|
-
style:
|
|
1839
|
+
style: N
|
|
1798
1840
|
}, f) {
|
|
1799
|
-
const { t: u } =
|
|
1841
|
+
const { t: u } = oe(), [b, h] = Ue({
|
|
1800
1842
|
value: e,
|
|
1801
1843
|
defaultValue: r,
|
|
1802
|
-
fallbackValue:
|
|
1844
|
+
fallbackValue: Xt,
|
|
1803
1845
|
onChange: n,
|
|
1804
1846
|
componentName: "NiceCurrencyConverter"
|
|
1805
|
-
}), [
|
|
1847
|
+
}), [k, R] = Ue({
|
|
1806
1848
|
value: a,
|
|
1807
|
-
defaultValue:
|
|
1808
|
-
fallbackValue:
|
|
1849
|
+
defaultValue: s,
|
|
1850
|
+
fallbackValue: b.currency,
|
|
1809
1851
|
onChange: d,
|
|
1810
1852
|
componentName: "NiceCurrencyConverter"
|
|
1811
|
-
}), { converted:
|
|
1812
|
-
() => ({ amount: Math.pow(10, 2), currency:
|
|
1813
|
-
[
|
|
1814
|
-
), { converted:
|
|
1815
|
-
l ?
|
|
1816
|
-
|
|
1817
|
-
|
|
1853
|
+
}), { converted: m, loading: g, error: v } = Ee(b, k, i), S = B(
|
|
1854
|
+
() => ({ amount: Math.pow(10, 2), currency: b.currency }),
|
|
1855
|
+
[b.currency]
|
|
1856
|
+
), { converted: E } = Ee(
|
|
1857
|
+
l ? S : null,
|
|
1858
|
+
k,
|
|
1859
|
+
i
|
|
1818
1860
|
);
|
|
1819
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ _(
|
|
1820
1862
|
"div",
|
|
1821
1863
|
{
|
|
1822
1864
|
ref: f,
|
|
1823
1865
|
className: "nice-currency-converter" + (y ? ` ${y}` : ""),
|
|
1824
|
-
style:
|
|
1866
|
+
style: N,
|
|
1825
1867
|
children: [
|
|
1826
1868
|
/* @__PURE__ */ c("div", { className: "nice-currency-converter__row", children: /* @__PURE__ */ c(
|
|
1827
|
-
|
|
1869
|
+
Ve,
|
|
1828
1870
|
{
|
|
1829
1871
|
label: u("currencyConverter.from", "From"),
|
|
1830
|
-
value:
|
|
1831
|
-
onChange: (M) => M &&
|
|
1832
|
-
currency:
|
|
1833
|
-
onCurrencyChange: (M) =>
|
|
1872
|
+
value: b,
|
|
1873
|
+
onChange: (M) => M && h(M),
|
|
1874
|
+
currency: b.currency,
|
|
1875
|
+
onCurrencyChange: (M) => h({ ...b, currency: M }),
|
|
1834
1876
|
showFormattedPreview: !1
|
|
1835
1877
|
}
|
|
1836
1878
|
) }),
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */ c("label", { className: "nice-currency-converter__label", children: "To" }),
|
|
1839
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ _("div", { className: "nice-currency-converter__row", children: [
|
|
1880
|
+
/* @__PURE__ */ c("label", { className: "nice-currency-converter__label", children: u("currencyConverter.to", "To") }),
|
|
1881
|
+
/* @__PURE__ */ _("div", { className: "nice-currency-converter__output", children: [
|
|
1840
1882
|
/* @__PURE__ */ c(
|
|
1841
|
-
|
|
1883
|
+
Qe,
|
|
1842
1884
|
{
|
|
1843
|
-
value:
|
|
1844
|
-
onChange: (M) =>
|
|
1885
|
+
value: k,
|
|
1886
|
+
onChange: (M) => R(M),
|
|
1845
1887
|
compact: !0
|
|
1846
1888
|
}
|
|
1847
1889
|
),
|
|
1848
|
-
/* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children:
|
|
1890
|
+
/* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children: g ? "…" : v ? "—" : m ? ie(m, { locale: o }) : "" })
|
|
1849
1891
|
] })
|
|
1850
1892
|
] }),
|
|
1851
|
-
l &&
|
|
1893
|
+
l && E && /* @__PURE__ */ _("p", { className: "nice-currency-converter__rate", children: [
|
|
1852
1894
|
"1 ",
|
|
1853
|
-
|
|
1895
|
+
b.currency,
|
|
1854
1896
|
" = ",
|
|
1855
|
-
ie(
|
|
1897
|
+
ie(E, { locale: o }),
|
|
1856
1898
|
" ",
|
|
1857
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ _("span", { className: "nice-currency-converter__inverse", children: [
|
|
1858
1900
|
"· 1 ",
|
|
1859
|
-
|
|
1901
|
+
k,
|
|
1860
1902
|
" =",
|
|
1861
1903
|
" ",
|
|
1862
|
-
ie(ae(1 /
|
|
1904
|
+
ie(ae(1 / Ge(E), b.currency), { locale: o })
|
|
1863
1905
|
] })
|
|
1864
1906
|
] }),
|
|
1865
|
-
|
|
1907
|
+
v && /* @__PURE__ */ c("p", { className: "nice-currency-converter__error", role: "alert", children: v.message })
|
|
1866
1908
|
]
|
|
1867
1909
|
}
|
|
1868
1910
|
);
|
|
1869
|
-
}),
|
|
1870
|
-
function
|
|
1911
|
+
}), Qt = [];
|
|
1912
|
+
function je(t) {
|
|
1871
1913
|
return { amount: Math.round(t.amount), currency: t.currency };
|
|
1872
1914
|
}
|
|
1873
|
-
const
|
|
1915
|
+
const wr = /* @__PURE__ */ se(
|
|
1874
1916
|
function({
|
|
1875
|
-
lines: e =
|
|
1917
|
+
lines: e = Qt,
|
|
1876
1918
|
locale: r,
|
|
1877
1919
|
rounding: n = "line",
|
|
1878
1920
|
showTotals: a = !0,
|
|
1879
|
-
showGrandTotal:
|
|
1921
|
+
showGrandTotal: s = !0,
|
|
1880
1922
|
hideRateColumn: d = !1,
|
|
1881
|
-
labels:
|
|
1923
|
+
labels: i,
|
|
1882
1924
|
density: o = "comfortable",
|
|
1883
1925
|
className: l,
|
|
1884
1926
|
style: y,
|
|
1885
|
-
id:
|
|
1927
|
+
id: N
|
|
1886
1928
|
}, f) {
|
|
1887
|
-
const u = {
|
|
1888
|
-
label: (
|
|
1889
|
-
rate: (
|
|
1890
|
-
net: (
|
|
1891
|
-
vat: (
|
|
1892
|
-
gross: (
|
|
1893
|
-
total: (
|
|
1894
|
-
},
|
|
1929
|
+
const { t: u } = oe(), b = {
|
|
1930
|
+
label: (i == null ? void 0 : i.label) ?? u("taxBreakdown.item", "Item"),
|
|
1931
|
+
rate: (i == null ? void 0 : i.rate) ?? "VAT",
|
|
1932
|
+
net: (i == null ? void 0 : i.net) ?? "Net",
|
|
1933
|
+
vat: (i == null ? void 0 : i.vat) ?? "Tax",
|
|
1934
|
+
gross: (i == null ? void 0 : i.gross) ?? "Gross",
|
|
1935
|
+
total: (i == null ? void 0 : i.total) ?? "Total"
|
|
1936
|
+
}, h = B(() => {
|
|
1895
1937
|
if (n === "total") {
|
|
1896
|
-
const
|
|
1897
|
-
for (const
|
|
1898
|
-
let
|
|
1899
|
-
|
|
1938
|
+
const m = /* @__PURE__ */ new Map();
|
|
1939
|
+
for (const v of e) {
|
|
1940
|
+
let S = m.get(v.vatRate);
|
|
1941
|
+
S || (S = [], m.set(v.vatRate, S)), S.push(v.netAmount);
|
|
1900
1942
|
}
|
|
1901
|
-
const
|
|
1902
|
-
for (const [
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1943
|
+
const g = [];
|
|
1944
|
+
for (const [v, S] of m) {
|
|
1945
|
+
const E = S.reduce((q, $) => ye(q, $), ae(0, S[0].currency)), M = je(Ae(E, v)), I = ye(E, M);
|
|
1946
|
+
g.push({ rate: v, net: E, vat: M, gross: I });
|
|
1905
1947
|
}
|
|
1906
|
-
return
|
|
1948
|
+
return g;
|
|
1907
1949
|
}
|
|
1908
|
-
return e.map((
|
|
1909
|
-
const
|
|
1910
|
-
return { label:
|
|
1950
|
+
return e.map((m) => {
|
|
1951
|
+
const g = je(Ae(m.netAmount, m.vatRate)), v = ye(m.netAmount, g);
|
|
1952
|
+
return { label: m.label, rate: m.vatRate, net: m.netAmount, vat: g, gross: v };
|
|
1911
1953
|
});
|
|
1912
|
-
}, [e, n]),
|
|
1913
|
-
if (
|
|
1954
|
+
}, [e, n]), k = B(() => {
|
|
1955
|
+
if (h.length === 0)
|
|
1914
1956
|
return null;
|
|
1915
|
-
const
|
|
1916
|
-
let
|
|
1917
|
-
for (const
|
|
1918
|
-
|
|
1919
|
-
return { net:
|
|
1920
|
-
}, [
|
|
1921
|
-
return /* @__PURE__ */
|
|
1957
|
+
const m = h[0].net.currency;
|
|
1958
|
+
let g = ae(0, m), v = ae(0, m), S = ae(0, m);
|
|
1959
|
+
for (const E of h)
|
|
1960
|
+
g = ye(g, E.net), v = ye(v, E.vat), S = ye(S, E.gross);
|
|
1961
|
+
return { net: g, vat: v, gross: S };
|
|
1962
|
+
}, [h]), R = (m) => ie(m, { locale: r });
|
|
1963
|
+
return /* @__PURE__ */ _(
|
|
1922
1964
|
"table",
|
|
1923
1965
|
{
|
|
1924
1966
|
ref: f,
|
|
1925
|
-
id:
|
|
1967
|
+
id: N,
|
|
1926
1968
|
className: `nice-tax-breakdown nice-tax-breakdown--${o} ${l ?? ""}`,
|
|
1927
1969
|
style: y,
|
|
1928
1970
|
role: "table",
|
|
1929
|
-
"aria-label":
|
|
1971
|
+
"aria-label": b.total,
|
|
1930
1972
|
children: [
|
|
1931
|
-
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */
|
|
1932
|
-
|
|
1933
|
-
!d && /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__rate", children:
|
|
1934
|
-
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children:
|
|
1935
|
-
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children:
|
|
1936
|
-
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children:
|
|
1973
|
+
/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ _("tr", { children: [
|
|
1974
|
+
h.some((m) => m.label !== void 0) && /* @__PURE__ */ c("th", { scope: "col", children: b.label }),
|
|
1975
|
+
!d && /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__rate", children: b.rate }),
|
|
1976
|
+
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: b.net }),
|
|
1977
|
+
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: b.vat }),
|
|
1978
|
+
/* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: b.gross })
|
|
1937
1979
|
] }) }),
|
|
1938
|
-
/* @__PURE__ */ c("tbody", { children:
|
|
1939
|
-
|
|
1940
|
-
!d && /* @__PURE__ */
|
|
1941
|
-
(
|
|
1980
|
+
/* @__PURE__ */ c("tbody", { children: h.map((m, g) => /* @__PURE__ */ _("tr", { children: [
|
|
1981
|
+
h.some((v) => v.label !== void 0) && /* @__PURE__ */ c("td", { children: m.label ?? "" }),
|
|
1982
|
+
!d && /* @__PURE__ */ _("td", { className: "nice-tax-breakdown__rate", children: [
|
|
1983
|
+
(m.rate * 100).toLocaleString(r, { maximumFractionDigits: 2 }),
|
|
1942
1984
|
"%"
|
|
1943
1985
|
] }),
|
|
1944
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1945
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1946
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1947
|
-
] }, `${
|
|
1948
|
-
a &&
|
|
1949
|
-
|
|
1950
|
-
!d && /* @__PURE__ */ c("td", { children:
|
|
1951
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1952
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1953
|
-
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children:
|
|
1986
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(m.net) }),
|
|
1987
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(m.vat) }),
|
|
1988
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(m.gross) })
|
|
1989
|
+
] }, `${m.rate}-${g}`)) }),
|
|
1990
|
+
a && k && /* @__PURE__ */ c("tfoot", { children: s && /* @__PURE__ */ _("tr", { className: "nice-tax-breakdown__totals", children: [
|
|
1991
|
+
h.some((m) => m.label !== void 0) && /* @__PURE__ */ c("td", { children: b.total }),
|
|
1992
|
+
!d && /* @__PURE__ */ c("td", { children: h.some((m) => m.label !== void 0) ? null : b.total }),
|
|
1993
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(k.net) }),
|
|
1994
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(k.vat) }),
|
|
1995
|
+
/* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: R(k.gross) })
|
|
1954
1996
|
] }) })
|
|
1955
1997
|
]
|
|
1956
1998
|
}
|
|
1957
1999
|
);
|
|
1958
2000
|
}
|
|
1959
|
-
),
|
|
1960
|
-
const { t: n } =
|
|
1961
|
-
methods: a =
|
|
1962
|
-
value:
|
|
2001
|
+
), Vt = [], kr = /* @__PURE__ */ se(function(e, r) {
|
|
2002
|
+
const { t: n } = oe(), {
|
|
2003
|
+
methods: a = Vt,
|
|
2004
|
+
value: s,
|
|
1963
2005
|
onChange: d,
|
|
1964
|
-
layout:
|
|
2006
|
+
layout: i = "list",
|
|
1965
2007
|
columns: o = 2,
|
|
1966
2008
|
currency: l,
|
|
1967
2009
|
label: y,
|
|
1968
|
-
name:
|
|
2010
|
+
name: N,
|
|
1969
2011
|
readOnly: f = !1,
|
|
1970
2012
|
className: u,
|
|
1971
|
-
style:
|
|
1972
|
-
id:
|
|
1973
|
-
accessMode:
|
|
1974
|
-
"data-testid":
|
|
1975
|
-
} = e,
|
|
2013
|
+
style: b,
|
|
2014
|
+
id: h,
|
|
2015
|
+
accessMode: k,
|
|
2016
|
+
"data-testid": R
|
|
2017
|
+
} = e, m = Ne(), g = N ?? `nice-pm-${m}`, v = B(() => {
|
|
1976
2018
|
if (!l)
|
|
1977
2019
|
return a;
|
|
1978
|
-
const
|
|
2020
|
+
const I = l.toUpperCase();
|
|
1979
2021
|
return a.filter(
|
|
1980
|
-
(
|
|
2022
|
+
(q) => !q.currencies || q.currencies.map(($) => $.toUpperCase()).includes(I)
|
|
1981
2023
|
);
|
|
1982
2024
|
}, [a, l]);
|
|
1983
|
-
if (
|
|
2025
|
+
if (k === "hidden")
|
|
1984
2026
|
return null;
|
|
1985
|
-
const
|
|
1986
|
-
return /* @__PURE__ */
|
|
2027
|
+
const S = f || k === "disabled" || k === "readOnly", E = `nice-payment-method-selector nice-payment-method-selector--${i}` + (u ? ` ${u}` : ""), M = i === "grid" ? { gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))` } : void 0;
|
|
2028
|
+
return /* @__PURE__ */ _("div", { ref: r, id: h, className: E, style: b, "data-testid": R, children: [
|
|
1987
2029
|
y && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__label", children: y }),
|
|
1988
|
-
/* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ _(
|
|
1989
2031
|
"div",
|
|
1990
2032
|
{
|
|
1991
2033
|
className: "nice-payment-method-selector__options",
|
|
1992
2034
|
style: M,
|
|
1993
2035
|
role: "radiogroup",
|
|
1994
|
-
"aria-label": y ?? "Payment method",
|
|
2036
|
+
"aria-label": y ?? n("paymentMethodSelector.paymentMethod", "Payment method"),
|
|
1995
2037
|
children: [
|
|
1996
|
-
|
|
1997
|
-
const
|
|
1998
|
-
return /* @__PURE__ */
|
|
2038
|
+
v.map((I) => {
|
|
2039
|
+
const q = I.id === s, $ = S || I.disabled;
|
|
2040
|
+
return /* @__PURE__ */ _(
|
|
1999
2041
|
"label",
|
|
2000
2042
|
{
|
|
2001
|
-
className: "nice-payment-method-selector__option" + (
|
|
2043
|
+
className: "nice-payment-method-selector__option" + (q ? " nice-payment-method-selector__option--selected" : "") + ($ ? " nice-payment-method-selector__option--disabled" : ""),
|
|
2002
2044
|
children: [
|
|
2003
2045
|
/* @__PURE__ */ c(
|
|
2004
2046
|
"input",
|
|
2005
2047
|
{
|
|
2006
2048
|
type: "radio",
|
|
2007
2049
|
className: "nice-payment-method-selector__radio",
|
|
2008
|
-
name:
|
|
2009
|
-
value:
|
|
2010
|
-
checked:
|
|
2011
|
-
disabled:
|
|
2012
|
-
onChange: () => d == null ? void 0 : d(
|
|
2050
|
+
name: g,
|
|
2051
|
+
value: I.id,
|
|
2052
|
+
checked: q,
|
|
2053
|
+
disabled: $,
|
|
2054
|
+
onChange: () => d == null ? void 0 : d(I.id)
|
|
2013
2055
|
}
|
|
2014
2056
|
),
|
|
2015
|
-
|
|
2016
|
-
/* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */ c("span", { className: "nice-payment-method-selector__name", children:
|
|
2018
|
-
|
|
2057
|
+
I.icon && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__icon", children: I.icon }),
|
|
2058
|
+
/* @__PURE__ */ _("span", { className: "nice-payment-method-selector__text", children: [
|
|
2059
|
+
/* @__PURE__ */ c("span", { className: "nice-payment-method-selector__name", children: I.label }),
|
|
2060
|
+
I.description && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__desc", children: I.description })
|
|
2019
2061
|
] })
|
|
2020
2062
|
]
|
|
2021
2063
|
},
|
|
2022
|
-
|
|
2064
|
+
I.id
|
|
2023
2065
|
);
|
|
2024
2066
|
}),
|
|
2025
|
-
|
|
2067
|
+
v.length === 0 && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__empty", children: n("paymentMethodSelector.noMethodsAvailable", "No methods available.") })
|
|
2026
2068
|
]
|
|
2027
2069
|
}
|
|
2028
2070
|
)
|
|
2029
2071
|
] });
|
|
2030
|
-
}),
|
|
2072
|
+
}), Wt = [
|
|
2031
2073
|
{
|
|
2032
2074
|
target: ".nice-payment-provider-config",
|
|
2033
2075
|
titleKey: "tutorial.paymentProviderConfig.intro.title",
|
|
@@ -2036,83 +2078,83 @@ const fr = /* @__PURE__ */ se(
|
|
|
2036
2078
|
content: "Pick a provider, fill its credentials (secrets are masked), choose test/live, enable methods and copy the webhook URL.",
|
|
2037
2079
|
placement: "auto"
|
|
2038
2080
|
}
|
|
2039
|
-
],
|
|
2081
|
+
], er = {
|
|
2040
2082
|
providerId: "",
|
|
2041
2083
|
mode: "test",
|
|
2042
2084
|
credentials: {},
|
|
2043
2085
|
enabledMethods: []
|
|
2044
|
-
},
|
|
2045
|
-
const { t: n } =
|
|
2086
|
+
}, Cr = /* @__PURE__ */ se(function(e, r) {
|
|
2087
|
+
const { t: n } = oe(), {
|
|
2046
2088
|
value: a,
|
|
2047
|
-
defaultValue:
|
|
2089
|
+
defaultValue: s,
|
|
2048
2090
|
onChange: d,
|
|
2049
|
-
providers:
|
|
2091
|
+
providers: i,
|
|
2050
2092
|
onTestConnection: o,
|
|
2051
2093
|
showWebhookUrl: l = !0,
|
|
2052
2094
|
baseUrl: y,
|
|
2053
|
-
readOnly:
|
|
2054
|
-
testLabel: f = "Test connection",
|
|
2095
|
+
readOnly: N = !1,
|
|
2096
|
+
testLabel: f = n("paymentProviderConfig.testConnection", "Test connection"),
|
|
2055
2097
|
tutorial: u,
|
|
2056
|
-
className:
|
|
2057
|
-
style:
|
|
2058
|
-
id:
|
|
2059
|
-
accessMode:
|
|
2060
|
-
"data-testid":
|
|
2061
|
-
} = e, [
|
|
2098
|
+
className: b,
|
|
2099
|
+
style: h,
|
|
2100
|
+
id: k,
|
|
2101
|
+
accessMode: R,
|
|
2102
|
+
"data-testid": m
|
|
2103
|
+
} = e, [g, v] = Ue({
|
|
2062
2104
|
value: a,
|
|
2063
|
-
defaultValue:
|
|
2064
|
-
fallbackValue:
|
|
2105
|
+
defaultValue: s,
|
|
2106
|
+
fallbackValue: er,
|
|
2065
2107
|
onChange: d,
|
|
2066
2108
|
componentName: "NicePaymentProviderConfig"
|
|
2067
|
-
}),
|
|
2068
|
-
if (
|
|
2109
|
+
}), S = Ne(), [E, M] = j(/* @__PURE__ */ new Set()), [I, q] = j(!1), [$, ee] = j(null), A = B(() => i ? i.map((p) => Pe[p]).filter((p) => !!p) : Ht, [i]), P = Pe[g.providerId];
|
|
2110
|
+
if (R === "hidden")
|
|
2069
2111
|
return null;
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2072
|
-
}, Q = (
|
|
2073
|
-
|
|
2074
|
-
},
|
|
2075
|
-
const
|
|
2076
|
-
|
|
2077
|
-
},
|
|
2078
|
-
M((
|
|
2079
|
-
const
|
|
2080
|
-
return
|
|
2112
|
+
const T = N || R === "disabled" || R === "readOnly", K = (p) => {
|
|
2113
|
+
ee(null), M(/* @__PURE__ */ new Set()), v({ providerId: p, mode: g.mode, credentials: {}, enabledMethods: [] });
|
|
2114
|
+
}, Q = (p, O) => {
|
|
2115
|
+
v({ ...g, credentials: { ...g.credentials, [p]: O } });
|
|
2116
|
+
}, re = (p) => {
|
|
2117
|
+
const O = new Set(g.enabledMethods ?? []);
|
|
2118
|
+
O.has(p) ? O.delete(p) : O.add(p), v({ ...g, enabledMethods: [...O] });
|
|
2119
|
+
}, G = (p) => {
|
|
2120
|
+
M((O) => {
|
|
2121
|
+
const L = new Set(O);
|
|
2122
|
+
return L.has(p) ? L.delete(p) : L.add(p), L;
|
|
2081
2123
|
});
|
|
2082
|
-
},
|
|
2124
|
+
}, X = async () => {
|
|
2083
2125
|
if (o) {
|
|
2084
|
-
|
|
2126
|
+
q(!0), ee(null);
|
|
2085
2127
|
try {
|
|
2086
|
-
|
|
2087
|
-
} catch (
|
|
2088
|
-
|
|
2128
|
+
ee(await o(g));
|
|
2129
|
+
} catch (p) {
|
|
2130
|
+
ee({ ok: !1, message: p instanceof Error ? p.message : String(p) });
|
|
2089
2131
|
} finally {
|
|
2090
|
-
|
|
2132
|
+
q(!1);
|
|
2091
2133
|
}
|
|
2092
2134
|
}
|
|
2093
|
-
},
|
|
2094
|
-
(
|
|
2135
|
+
}, V = P != null && P.webhookPath ? `${(y ?? "").replace(/\/$/, "")}${P.webhookPath}` : "", ne = (P == null ? void 0 : P.supportedCurrencies) === "*" ? n("paymentProviderConfig.allCurrencies", "All currencies") : ((P == null ? void 0 : P.supportedCurrencies) ?? []).join(", "), F = "nice-payment-provider-config" + (b ? ` ${b}` : ""), C = ((P == null ? void 0 : P.credentials) ?? []).filter(
|
|
2136
|
+
(p) => !p.testOnly || g.mode === "test"
|
|
2095
2137
|
);
|
|
2096
|
-
return /* @__PURE__ */
|
|
2097
|
-
u && /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__tutorial", children: /* @__PURE__ */ c(
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2138
|
+
return /* @__PURE__ */ _("div", { ref: r, id: k, className: F, style: h, "data-testid": m, children: [
|
|
2139
|
+
u && /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__tutorial", children: /* @__PURE__ */ c(mt, { steps: pt(u, Wt) }) }),
|
|
2140
|
+
/* @__PURE__ */ _("div", { className: "nice-payment-provider-config__row", children: [
|
|
2141
|
+
/* @__PURE__ */ _("label", { className: "nice-payment-provider-config__field", children: [
|
|
2100
2142
|
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.provider", "Provider") }),
|
|
2101
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ _(
|
|
2102
2144
|
"select",
|
|
2103
2145
|
{
|
|
2104
2146
|
className: "nice-payment-provider-config__select",
|
|
2105
|
-
value:
|
|
2106
|
-
disabled:
|
|
2107
|
-
onChange: (
|
|
2147
|
+
value: g.providerId,
|
|
2148
|
+
disabled: T,
|
|
2149
|
+
onChange: (p) => K(p.target.value),
|
|
2108
2150
|
children: [
|
|
2109
|
-
/* @__PURE__ */ c("option", { value: "", children: "— select provider —" }),
|
|
2110
|
-
|
|
2151
|
+
/* @__PURE__ */ c("option", { value: "", children: n("paymentProviderConfig.selectProvider", "— select provider —") }),
|
|
2152
|
+
A.map((p) => /* @__PURE__ */ c("option", { value: p.id, children: p.name }, p.id))
|
|
2111
2153
|
]
|
|
2112
2154
|
}
|
|
2113
2155
|
)
|
|
2114
2156
|
] }),
|
|
2115
|
-
(
|
|
2157
|
+
(P == null ? void 0 : P.hasTestMode) && /* @__PURE__ */ _(
|
|
2116
2158
|
"div",
|
|
2117
2159
|
{
|
|
2118
2160
|
className: "nice-payment-provider-config__mode",
|
|
@@ -2123,9 +2165,9 @@ const fr = /* @__PURE__ */ se(
|
|
|
2123
2165
|
"button",
|
|
2124
2166
|
{
|
|
2125
2167
|
type: "button",
|
|
2126
|
-
className: "nice-payment-provider-config__mode-btn" + (
|
|
2127
|
-
onClick: () =>
|
|
2128
|
-
disabled:
|
|
2168
|
+
className: "nice-payment-provider-config__mode-btn" + (g.mode === "test" ? " nice-payment-provider-config__mode-btn--active" : ""),
|
|
2169
|
+
onClick: () => v({ ...g, mode: "test" }),
|
|
2170
|
+
disabled: T,
|
|
2129
2171
|
children: n("paymentProviderConfig.test", "Test")
|
|
2130
2172
|
}
|
|
2131
2173
|
),
|
|
@@ -2133,9 +2175,9 @@ const fr = /* @__PURE__ */ se(
|
|
|
2133
2175
|
"button",
|
|
2134
2176
|
{
|
|
2135
2177
|
type: "button",
|
|
2136
|
-
className: "nice-payment-provider-config__mode-btn" + (
|
|
2137
|
-
onClick: () =>
|
|
2138
|
-
disabled:
|
|
2178
|
+
className: "nice-payment-provider-config__mode-btn" + (g.mode === "live" ? " nice-payment-provider-config__mode-btn--active" : ""),
|
|
2179
|
+
onClick: () => v({ ...g, mode: "live" }),
|
|
2180
|
+
disabled: T,
|
|
2139
2181
|
children: n("paymentProviderConfig.live", "Live")
|
|
2140
2182
|
}
|
|
2141
2183
|
)
|
|
@@ -2143,84 +2185,84 @@ const fr = /* @__PURE__ */ se(
|
|
|
2143
2185
|
}
|
|
2144
2186
|
)
|
|
2145
2187
|
] }),
|
|
2146
|
-
|
|
2147
|
-
/* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__badge", children:
|
|
2149
|
-
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__currencies", children:
|
|
2188
|
+
P && /* @__PURE__ */ _(dt, { children: [
|
|
2189
|
+
/* @__PURE__ */ _("div", { className: "nice-payment-provider-config__meta", children: [
|
|
2190
|
+
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__badge", children: P.type }),
|
|
2191
|
+
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__currencies", children: ne })
|
|
2150
2192
|
] }),
|
|
2151
|
-
/* @__PURE__ */ c("div", { className: "nice-payment-provider-config__credentials", children:
|
|
2152
|
-
const
|
|
2153
|
-
return /* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
|
|
2156
|
-
|
|
2193
|
+
/* @__PURE__ */ c("div", { className: "nice-payment-provider-config__credentials", children: C.map((p) => {
|
|
2194
|
+
const O = `${S}-${p.key}`, L = p.secret, D = E.has(p.key);
|
|
2195
|
+
return /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__field", children: [
|
|
2196
|
+
/* @__PURE__ */ _("label", { className: "nice-payment-provider-config__field-label", htmlFor: O, children: [
|
|
2197
|
+
p.label,
|
|
2198
|
+
p.required && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__required", children: " *" })
|
|
2157
2199
|
] }),
|
|
2158
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ _("div", { className: "nice-payment-provider-config__input-wrap", children: [
|
|
2159
2201
|
/* @__PURE__ */ c(
|
|
2160
2202
|
"input",
|
|
2161
2203
|
{
|
|
2162
|
-
id:
|
|
2163
|
-
type:
|
|
2204
|
+
id: O,
|
|
2205
|
+
type: L && !D ? "password" : "text",
|
|
2164
2206
|
className: "nice-payment-provider-config__input",
|
|
2165
|
-
value:
|
|
2166
|
-
readOnly:
|
|
2167
|
-
autoComplete:
|
|
2168
|
-
onChange: (
|
|
2207
|
+
value: g.credentials[p.key] ?? "",
|
|
2208
|
+
readOnly: T,
|
|
2209
|
+
autoComplete: L ? "new-password" : "off",
|
|
2210
|
+
onChange: (z) => Q(p.key, z.target.value)
|
|
2169
2211
|
}
|
|
2170
2212
|
),
|
|
2171
|
-
|
|
2213
|
+
L && /* @__PURE__ */ c(
|
|
2172
2214
|
"button",
|
|
2173
2215
|
{
|
|
2174
2216
|
type: "button",
|
|
2175
2217
|
className: "nice-payment-provider-config__reveal",
|
|
2176
|
-
onClick: () =>
|
|
2177
|
-
"aria-label":
|
|
2178
|
-
"aria-pressed":
|
|
2179
|
-
children: /* @__PURE__ */ c(
|
|
2218
|
+
onClick: () => G(p.key),
|
|
2219
|
+
"aria-label": D ? n("paymentProviderConfig.hide", "Hide") : n("paymentProviderConfig.reveal", "Reveal"),
|
|
2220
|
+
"aria-pressed": D,
|
|
2221
|
+
children: /* @__PURE__ */ c(ve, { name: D ? "eye-off" : "eye", size: 14 })
|
|
2180
2222
|
}
|
|
2181
2223
|
)
|
|
2182
2224
|
] }),
|
|
2183
|
-
|
|
2184
|
-
] },
|
|
2225
|
+
p.help && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__help", children: p.help })
|
|
2226
|
+
] }, p.key);
|
|
2185
2227
|
}) }),
|
|
2186
|
-
|
|
2228
|
+
P.supportedMethods && P.supportedMethods.length > 0 && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__methods", children: [
|
|
2187
2229
|
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.enabledMethods", "Enabled methods") }),
|
|
2188
|
-
/* @__PURE__ */ c("div", { className: "nice-payment-provider-config__method-list", children:
|
|
2230
|
+
/* @__PURE__ */ c("div", { className: "nice-payment-provider-config__method-list", children: P.supportedMethods.map((p) => /* @__PURE__ */ _("label", { className: "nice-payment-provider-config__method", children: [
|
|
2189
2231
|
/* @__PURE__ */ c(
|
|
2190
2232
|
"input",
|
|
2191
2233
|
{
|
|
2192
2234
|
type: "checkbox",
|
|
2193
|
-
checked: (
|
|
2194
|
-
disabled:
|
|
2195
|
-
onChange: () =>
|
|
2235
|
+
checked: (g.enabledMethods ?? []).includes(p),
|
|
2236
|
+
disabled: T,
|
|
2237
|
+
onChange: () => re(p)
|
|
2196
2238
|
}
|
|
2197
2239
|
),
|
|
2198
|
-
|
|
2199
|
-
] },
|
|
2240
|
+
p
|
|
2241
|
+
] }, p)) })
|
|
2200
2242
|
] }),
|
|
2201
|
-
l &&
|
|
2243
|
+
l && P.webhookPath && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__field", children: [
|
|
2202
2244
|
/* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.webhookUrl", "Webhook URL") }),
|
|
2203
|
-
/* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children:
|
|
2245
|
+
/* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children: V })
|
|
2204
2246
|
] }),
|
|
2205
|
-
o && /* @__PURE__ */
|
|
2247
|
+
o && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__test", children: [
|
|
2206
2248
|
/* @__PURE__ */ c(
|
|
2207
2249
|
"button",
|
|
2208
2250
|
{
|
|
2209
2251
|
type: "button",
|
|
2210
2252
|
className: "nice-payment-provider-config__test-btn",
|
|
2211
|
-
onClick: () => void
|
|
2212
|
-
disabled:
|
|
2213
|
-
children:
|
|
2253
|
+
onClick: () => void X(),
|
|
2254
|
+
disabled: T || I,
|
|
2255
|
+
children: I ? n("paymentProviderConfig.testing", "Testing…") : f
|
|
2214
2256
|
}
|
|
2215
2257
|
),
|
|
2216
|
-
|
|
2258
|
+
$ && /* @__PURE__ */ _(
|
|
2217
2259
|
"span",
|
|
2218
2260
|
{
|
|
2219
|
-
className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + (
|
|
2261
|
+
className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + ($.ok ? "ok" : "error"),
|
|
2220
2262
|
children: [
|
|
2221
|
-
/* @__PURE__ */ c(
|
|
2263
|
+
/* @__PURE__ */ c(ve, { name: $.ok ? "check" : "close", size: 14 }),
|
|
2222
2264
|
" ",
|
|
2223
|
-
|
|
2265
|
+
$.message ?? ($.ok ? n("paymentProviderConfig.ok", "OK") : n("paymentProviderConfig.failed", "Failed"))
|
|
2224
2266
|
]
|
|
2225
2267
|
}
|
|
2226
2268
|
)
|
|
@@ -2229,71 +2271,71 @@ const fr = /* @__PURE__ */ se(
|
|
|
2229
2271
|
] });
|
|
2230
2272
|
});
|
|
2231
2273
|
export {
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2274
|
+
wt as EcbRatesProvider,
|
|
2275
|
+
vt as ExchangeRateHostProvider,
|
|
2276
|
+
_t as FrankfurterProvider,
|
|
2277
|
+
kt as FreeForexApiProvider,
|
|
2278
|
+
Dt as MockPaymentProcessor,
|
|
2279
|
+
_e as NICE_CURRENCY_CATALOG,
|
|
2280
|
+
_r as NICE_CURRENCY_CODES,
|
|
2281
|
+
Kt as NICE_PAYMENT_PROCESSORS,
|
|
2282
|
+
Ht as NICE_PAYMENT_PROVIDER_LIST,
|
|
2283
|
+
Pe as NICE_PAYMENT_PROVIDER_PROFILES,
|
|
2284
|
+
Nt as NbpRatesProvider,
|
|
2285
|
+
Gt as NiceCreditCardInput,
|
|
2286
|
+
Nr as NiceCurrencyConverter,
|
|
2287
|
+
Qe as NiceCurrencySelector,
|
|
2288
|
+
ze as NiceMoney,
|
|
2289
|
+
Ve as NiceMoneyInput,
|
|
2290
|
+
gr as NicePaymentForm,
|
|
2291
|
+
kr as NicePaymentMethodSelector,
|
|
2292
|
+
Cr as NicePaymentProviderConfig,
|
|
2293
|
+
vr as NicePriceTag,
|
|
2294
|
+
wr as NiceTaxBreakdown,
|
|
2295
|
+
gt as OpenExchangeRatesProvider,
|
|
2296
|
+
ur as StaticExchangeRateProvider,
|
|
2255
2297
|
ye as addMoney,
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2298
|
+
ir as compareMoney,
|
|
2299
|
+
Ct as convertMoney,
|
|
2300
|
+
pr as createEcbRatesProvider,
|
|
2301
|
+
hr as createFreeForexApiProvider,
|
|
2302
|
+
mr as createNbpRatesProvider,
|
|
2303
|
+
yr as createOpenExchangeRatesProvider,
|
|
2304
|
+
Me as detectCardBrand,
|
|
2263
2305
|
be as expectedCvcLength,
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2306
|
+
te as findCurrency,
|
|
2307
|
+
fr as findPaymentProviderProfile,
|
|
2308
|
+
bt as formatCardNumber,
|
|
2267
2309
|
ie as formatMoney,
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2310
|
+
Ge as fromMoney,
|
|
2311
|
+
Xe as isExpiryValid,
|
|
2312
|
+
or as isNegative,
|
|
2313
|
+
sr as isZero,
|
|
2314
|
+
Ze as luhnCheck,
|
|
2315
|
+
It as makeAdyenAdapter,
|
|
2316
|
+
Tt as makeAutopayAdapter,
|
|
2317
|
+
Ft as makeBlikAdapter,
|
|
2318
|
+
xt as makeBraintreeAdapter,
|
|
2319
|
+
qt as makeCoinbaseCommerceAdapter,
|
|
2320
|
+
Ot as makeKlarnaAdapter,
|
|
2321
|
+
$t as makeMollieAdapter,
|
|
2322
|
+
Mt as makePayPalAdapter,
|
|
2323
|
+
Ut as makePayUAdapter,
|
|
2324
|
+
At as makePrzelewy24Adapter,
|
|
2325
|
+
Rt as makeRazorpayAdapter,
|
|
2326
|
+
St as makeSquareAdapter,
|
|
2327
|
+
Pt as makeStripeAdapter,
|
|
2328
|
+
Et as makeTpayAdapter,
|
|
2329
|
+
dr as maskCardNumber,
|
|
2330
|
+
Ae as multiplyMoney,
|
|
2331
|
+
lr as negateMoney,
|
|
2332
|
+
Je as normaliseExpiry,
|
|
2333
|
+
ft as parseMoney,
|
|
2334
|
+
cr as registerCurrency,
|
|
2335
|
+
ht as subtractMoney,
|
|
2294
2336
|
ae as toMoney,
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2337
|
+
Ee as useNiceExchangeRate,
|
|
2338
|
+
br as useNiceMoney,
|
|
2339
|
+
jt as useNicePayment,
|
|
2340
|
+
Le as validateCreditCard
|
|
2299
2341
|
};
|