@nice2dev/ui-money 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ var it = Object.defineProperty;
2
2
  var st = (t, e, r) => e in t ? it(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var Z = (t, e, r) => st(t, typeof e != "symbol" ? e + "" : e, r);
4
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";
5
+ import { jsxs as f, jsx as c, Fragment as dt } from "react/jsx-runtime";
6
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
7
  const _e = [
8
8
  // ── Majors ─────────────────────────────────────
@@ -300,8 +300,8 @@ function ft(t, e) {
300
300
  const a = r.lastIndexOf("."), s = r.lastIndexOf(","), d = Math.max(a, s);
301
301
  let i, o = "";
302
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
- return Number.isFinite(y) ? ae(n ? -y : y, e) : null;
303
+ const l = `${i}.${o || "0"}`, p = parseFloat(l);
304
+ return Number.isFinite(p) ? ae(n ? -p : p, e) : null;
305
305
  }
306
306
  function Me(t) {
307
307
  const e = (t || "").replace(/\D/g, "");
@@ -382,11 +382,11 @@ class ur {
382
382
  return { base: n, quote: a, rate: 1 / d.rate, asOf: d.asOf };
383
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
384
  if (i && o) {
385
- const l = i.base === "USD" ? 1 / i.rate : i.rate, y = o.base === "USD" ? o.rate : 1 / o.rate;
385
+ const l = i.base === "USD" ? 1 / i.rate : i.rate, p = o.base === "USD" ? o.rate : 1 / o.rate;
386
386
  return {
387
387
  base: n,
388
388
  quote: a,
389
- rate: l * y,
389
+ rate: l * p,
390
390
  asOf: (/* @__PURE__ */ new Date()).toISOString()
391
391
  };
392
392
  }
@@ -429,10 +429,10 @@ class _t extends Ie {
429
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[s];
433
- if (y == null)
432
+ const l = await o.json(), p = l.rates[s];
433
+ if (p == null)
434
434
  throw new Error(`Frankfurter: no rate for ${a}/${s}`);
435
- const N = { base: a, quote: s, rate: y, asOf: l.date };
435
+ const N = { base: a, quote: s, rate: p, asOf: l.date };
436
436
  return this.setCached(N), N;
437
437
  }
438
438
  }
@@ -452,16 +452,16 @@ class gt extends Ie {
452
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], N = l.rates[s];
456
- if (y == null || N == null)
455
+ const l = await o.json(), p = l.rates[a], N = l.rates[s];
456
+ if (p == null || N == null)
457
457
  throw new Error(`OpenExchangeRates: missing rate for ${a} or ${s}`);
458
- const f = {
458
+ const h = {
459
459
  base: a,
460
460
  quote: s,
461
- rate: N / y,
461
+ rate: N / p,
462
462
  asOf: new Date(l.timestamp * 1e3).toISOString()
463
463
  };
464
- return this.setCached(f), f;
464
+ return this.setCached(h), h;
465
465
  }
466
466
  }
467
467
  class vt extends Ie {
@@ -470,7 +470,7 @@ class vt extends Ie {
470
470
  Z(this, "id", "exchangerate.host");
471
471
  }
472
472
  async getRate(r, n) {
473
- var f;
473
+ var h;
474
474
  const a = r.toUpperCase(), s = n.toUpperCase();
475
475
  if (a === s)
476
476
  return { base: a, quote: s, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
@@ -480,7 +480,7 @@ class vt extends Ie {
480
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, N = { base: a, quote: s, rate: y, asOf: l.date };
483
+ const l = await o.json(), p = ((h = l.info) == null ? void 0 : h.rate) ?? l.result, N = { base: a, quote: s, rate: p, asOf: l.date };
484
484
  return this.setCached(N), N;
485
485
  }
486
486
  }
@@ -499,24 +499,24 @@ class Nt extends Ie {
499
499
  if (d)
500
500
  return d;
501
501
  const i = async (N) => {
502
- var k;
502
+ var _;
503
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}/${N}/?format=json`, u = await this.fetchImpl(f);
505
+ const h = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${N}/?format=json`, u = await this.fetchImpl(h);
506
506
  if (!u.ok)
507
507
  return null;
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;
508
+ const b = (_ = (await u.json()).rates) == null ? void 0 : _[0];
509
+ return b ? { rate: b.mid ?? b.ask ?? 0, date: b.effectiveDate } : null;
510
510
  }, o = await i(a), l = await i(s);
511
511
  if (!o || !l || o.rate === 0)
512
512
  throw new Error(`NBP: missing rate for ${a} or ${s}`);
513
- const y = {
513
+ const p = {
514
514
  base: a,
515
515
  quote: s,
516
516
  rate: o.rate / l.rate,
517
517
  asOf: o.date
518
518
  };
519
- return this.setCached(y), y;
519
+ return this.setCached(p), p;
520
520
  }
521
521
  }
522
522
  class wt extends _t {
@@ -536,10 +536,10 @@ 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 = 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;
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), p = t.amount / Math.pow(10, d) * o;
540
540
  return {
541
541
  currency: n,
542
- amount: Math.round(y * Math.pow(10, i))
542
+ amount: Math.round(p * Math.pow(10, i))
543
543
  };
544
544
  }
545
545
  class Dt {
@@ -583,7 +583,7 @@ class Dt {
583
583
  };
584
584
  }
585
585
  }
586
- function W(t, e, r, n, a) {
586
+ function ee(t, e, r, n, a) {
587
587
  const s = (d) => {
588
588
  const i = n == null ? void 0 : n[d];
589
589
  return i || (async () => {
@@ -604,7 +604,7 @@ function W(t, e, r, n, a) {
604
604
  };
605
605
  }
606
606
  function Pt(t) {
607
- return W("stripe", "Stripe", "*", t, {
607
+ return ee("stripe", "Stripe", "*", t, {
608
608
  USD: 50,
609
609
  EUR: 50,
610
610
  GBP: 30,
@@ -619,7 +619,7 @@ function Pt(t) {
619
619
  });
620
620
  }
621
621
  function Mt(t) {
622
- return W(
622
+ return ee(
623
623
  "paypal",
624
624
  "PayPal",
625
625
  [
@@ -650,22 +650,22 @@ function Mt(t) {
650
650
  );
651
651
  }
652
652
  function It(t) {
653
- return W("adyen", "Adyen", "*", t);
653
+ return ee("adyen", "Adyen", "*", t);
654
654
  }
655
655
  function St(t) {
656
- return W("square", "Square", ["USD", "CAD", "GBP", "AUD", "JPY", "EUR"], t);
656
+ return ee("square", "Square", ["USD", "CAD", "GBP", "AUD", "JPY", "EUR"], t);
657
657
  }
658
658
  function $t(t) {
659
- return W("mollie", "Mollie", "*", t);
659
+ return ee("mollie", "Mollie", "*", t);
660
660
  }
661
661
  function xt(t) {
662
- return W("braintree", "Braintree", "*", t);
662
+ return ee("braintree", "Braintree", "*", t);
663
663
  }
664
664
  function Rt(t) {
665
- return W("razorpay", "Razorpay", ["INR", "USD", "EUR", "GBP", "AED"], t);
665
+ return ee("razorpay", "Razorpay", ["INR", "USD", "EUR", "GBP", "AED"], t);
666
666
  }
667
667
  function Ut(t) {
668
- return W(
668
+ return ee(
669
669
  "payu",
670
670
  "PayU",
671
671
  ["PLN", "EUR", "USD", "CZK", "HUF", "RON", "BGN", "TRY"],
@@ -673,20 +673,20 @@ function Ut(t) {
673
673
  );
674
674
  }
675
675
  function At(t) {
676
- return W("przelewy24", "Przelewy24", ["PLN", "EUR"], t);
676
+ return ee("przelewy24", "Przelewy24", ["PLN", "EUR"], t);
677
677
  }
678
678
  function Et(t = {}) {
679
- return W("tpay", "Tpay", ["PLN", "EUR", "USD", "GBP"], t);
679
+ return ee("tpay", "Tpay", ["PLN", "EUR", "USD", "GBP"], t);
680
680
  }
681
681
  function Tt(t = {}) {
682
- return W("autopay", "Autopay", ["PLN", "EUR", "USD", "GBP", "CZK"], t);
682
+ return ee("autopay", "Autopay", ["PLN", "EUR", "USD", "GBP", "CZK"], t);
683
683
  }
684
684
  function Ft(t = {}) {
685
685
  const { acquirer: e = "native", ...r } = t;
686
- return W(`blik:${e}`, `BLIK (${e})`, ["PLN"], r);
686
+ return ee(`blik:${e}`, `BLIK (${e})`, ["PLN"], r);
687
687
  }
688
688
  function Ot(t) {
689
- return W(
689
+ return ee(
690
690
  "klarna",
691
691
  "Klarna",
692
692
  ["USD", "EUR", "GBP", "SEK", "NOK", "DKK", "CHF", "AUD", "CAD", "NZD", "PLN"],
@@ -694,7 +694,7 @@ function Ot(t) {
694
694
  );
695
695
  }
696
696
  function qt(t) {
697
- return W(
697
+ return ee(
698
698
  "coinbase-commerce",
699
699
  "Coinbase Commerce",
700
700
  ["BTC", "ETH", "USDC", "USDT", "USD", "EUR"],
@@ -960,86 +960,86 @@ function br(t, e) {
960
960
  // eslint-disable-next-line react-hooks/exhaustive-deps
961
961
  []
962
962
  ), [n, a] = j(r), s = Y(
963
- (f) => a((u) => ae(f, u.currency)),
963
+ (h) => a((u) => ae(h, u.currency)),
964
964
  []
965
- ), d = Y((f) => {
966
- a((u) => ({ ...u, currency: f.toUpperCase() }));
967
- }, []), i = Y((f) => a((u) => ye(u, f)), []), o = Y(
968
- (f) => a((u) => ht(u, f)),
965
+ ), d = Y((h) => {
966
+ a((u) => ({ ...u, currency: h.toUpperCase() }));
967
+ }, []), i = Y((h) => a((u) => ye(u, h)), []), o = Y(
968
+ (h) => a((u) => ht(u, h)),
969
969
  []
970
970
  ), l = Y(
971
- (f) => a((u) => Ae(u, f)),
971
+ (h) => a((u) => Ae(u, h)),
972
972
  []
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 };
973
+ ), p = 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: p, major: N };
975
975
  }
976
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;
977
+ const [n, a] = j(null), [s, d] = j(null), [i, o] = j(!1), l = Re(0), p = t == null ? void 0 : t.amount, N = t == null ? void 0 : t.currency;
978
978
  return lt(() => {
979
- if (y === void 0 || N === void 0) {
979
+ if (p === void 0 || N === void 0) {
980
980
  a(null);
981
981
  return;
982
982
  }
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);
983
+ const h = ++l.current;
984
+ o(!0), d(null), Ct({ amount: p, currency: N }, e, r).then((u) => {
985
+ l.current === h && a(u);
986
986
  }).catch((u) => {
987
- l.current === f && (d(u instanceof Error ? u : new Error(String(u))), a(null));
987
+ l.current === h && (d(u instanceof Error ? u : new Error(String(u))), a(null));
988
988
  }).finally(() => {
989
- l.current === f && o(!1);
989
+ l.current === h && o(!1);
990
990
  });
991
- }, [y, N, e, r]), { converted: n, loading: i, error: s };
991
+ }, [p, N, e, r]), { converted: n, loading: i, error: s };
992
992
  }
993
993
  function jt(t) {
994
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
- async (f) => {
997
+ async (h) => {
998
998
  r("authorizing"), d(null);
999
999
  try {
1000
- const u = await t.authorize(f);
1000
+ const u = await t.authorize(h);
1001
1001
  return a(u), r(u.status), u;
1002
1002
  } catch (u) {
1003
- const b = u instanceof Error ? u : new Error(String(u));
1004
- throw d(b), r("failed"), b;
1003
+ const g = u instanceof Error ? u : new Error(String(u));
1004
+ throw d(g), r("failed"), g;
1005
1005
  }
1006
1006
  },
1007
1007
  [t]
1008
1008
  ), l = Y(
1009
- async (f, u) => {
1010
- const b = f ?? (n == null ? void 0 : n.id);
1011
- if (!b)
1009
+ async (h, u) => {
1010
+ const g = h ?? (n == null ? void 0 : n.id);
1011
+ if (!g)
1012
1012
  throw new Error("No authorization id to capture");
1013
1013
  r("capturing");
1014
1014
  try {
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;
1015
+ const b = await t.capture(g, u);
1016
+ return a(b), r(b.status), b;
1017
+ } catch (b) {
1018
+ const _ = b instanceof Error ? b : new Error(String(b));
1019
+ throw d(_), r("failed"), _;
1020
1020
  }
1021
1021
  },
1022
1022
  [t, n == null ? void 0 : n.id]
1023
- ), y = Y(
1024
- async (f) => {
1025
- const u = f ?? (n == null ? void 0 : n.id);
1023
+ ), p = Y(
1024
+ async (h) => {
1025
+ const u = h ?? (n == null ? void 0 : n.id);
1026
1026
  if (!u)
1027
1027
  throw new Error("No payment id to cancel");
1028
- const b = await t.cancel(u);
1029
- return a(b), r(b.status), b;
1028
+ const g = await t.cancel(u);
1029
+ return a(g), r(g.status), g;
1030
1030
  },
1031
1031
  [t, n == null ? void 0 : n.id]
1032
1032
  ), N = Y(
1033
- async (f, u) => {
1034
- const b = f ?? (n == null ? void 0 : n.id);
1035
- if (!b)
1033
+ async (h, u) => {
1034
+ const g = h ?? (n == null ? void 0 : n.id);
1035
+ if (!g)
1036
1036
  throw new Error("No payment id to refund");
1037
- const h = await t.refund(b, u);
1038
- return a(h), r(h.status), h;
1037
+ const b = await t.refund(g, u);
1038
+ return a(b), r(b.status), b;
1039
1039
  },
1040
1040
  [t, n == null ? void 0 : n.id]
1041
1041
  );
1042
- return { status: e, response: n, error: s, authorize: o, capture: l, cancel: y, refund: N, reset: i };
1042
+ return { status: e, response: n, error: s, authorize: o, capture: l, cancel: p, refund: N, reset: i };
1043
1043
  }
1044
1044
  const ze = /* @__PURE__ */ se(
1045
1045
  function({
@@ -1052,46 +1052,58 @@ const ze = /* @__PURE__ */ se(
1052
1052
  zeroPlaceholder: i,
1053
1053
  convertTo: o,
1054
1054
  exchangeProvider: l,
1055
- className: y,
1055
+ className: p,
1056
1056
  style: N,
1057
- "aria-label": f
1058
- }, u) {
1059
- const { t: b } = oe(), h = B(() => {
1057
+ "aria-label": h,
1058
+ testId: u,
1059
+ "data-testid": g
1060
+ }, b) {
1061
+ const { t: _ } = oe(), M = B(() => {
1060
1062
  if (e)
1061
1063
  return e;
1062
1064
  if (r != null && n) {
1063
- const v = te(n), S = (v == null ? void 0 : v.decimals) ?? 2;
1065
+ const I = te(n), w = (I == null ? void 0 : I.decimals) ?? 2;
1064
1066
  return {
1065
- amount: Math.round(r * Math.pow(10, S)),
1067
+ amount: Math.round(r * Math.pow(10, w)),
1066
1068
  currency: n.toUpperCase()
1067
1069
  };
1068
1070
  }
1069
1071
  return null;
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
+ }, [e, r, n]), D = B(() => M ? M.amount === 0 && i != null ? i : ie(M, { locale: a, currencyDisplay: s }) : "", [M, a, s, i]), { converted: v } = Ee(
1073
+ o && l ? M : null,
1072
1074
  o ?? "",
1073
1075
  l
1074
1076
  );
1075
- if (!h)
1077
+ if (!M)
1076
1078
  return null;
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
- )
1094
- ] });
1079
+ const y = M.amount < 0, x = "nice-money" + (d && y ? " nice-money--negative" : "") + (p ? ` ${p}` : "");
1080
+ return /* @__PURE__ */ f(
1081
+ "span",
1082
+ {
1083
+ ref: b,
1084
+ className: x,
1085
+ style: N,
1086
+ "aria-label": h,
1087
+ "data-testid": g ?? u,
1088
+ children: [
1089
+ /* @__PURE__ */ c("span", { className: "nice-money__value", children: D }),
1090
+ v && /* @__PURE__ */ f(
1091
+ "span",
1092
+ {
1093
+ className: "nice-money__converted",
1094
+ "aria-label": _("money.convertedTo", "Converted to {currency}").replace(
1095
+ "{currency}",
1096
+ String(v.currency)
1097
+ ),
1098
+ children: [
1099
+ " ≈ ",
1100
+ ie(v, { locale: a })
1101
+ ]
1102
+ }
1103
+ )
1104
+ ]
1105
+ }
1106
+ );
1095
1107
  }
1096
1108
  ), _r = _e.map((t) => t.code).sort(), Qe = /* @__PURE__ */ se(function({
1097
1109
  value: e,
@@ -1103,94 +1115,94 @@ const ze = /* @__PURE__ */ se(
1103
1115
  showSymbol: i = !0,
1104
1116
  compact: o = !1,
1105
1117
  disabled: l,
1106
- readOnly: y,
1118
+ readOnly: p,
1107
1119
  loading: N,
1108
- accessMode: f,
1120
+ accessMode: h,
1109
1121
  label: u,
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,
1119
- id: M,
1120
- name: I,
1121
- title: q,
1122
- "data-testid": $,
1123
- "aria-label": ee,
1122
+ helperText: g,
1123
+ error: b,
1124
+ required: _,
1125
+ size: M = "md",
1126
+ labelPlacement: D = "top",
1127
+ labelWidth: v,
1128
+ controlWidth: y,
1129
+ className: x,
1130
+ style: I,
1131
+ id: w,
1132
+ name: S,
1133
+ title: F,
1134
+ "data-testid": R,
1135
+ "aria-label": X,
1124
1136
  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())
1137
+ }, $) {
1138
+ const { t: T } = oe(), K = h === "hidden", V = l || h === "disabled" || N, re = p || h === "readOnly", G = Ne(), Q = w ?? `nice-cs-${G}`, [W, ne] = j(""), O = s ?? n.length > 8, C = B(() => {
1139
+ if (!W.trim())
1128
1140
  return n;
1129
- const x = V.trim().toLowerCase();
1141
+ const U = W.trim().toLowerCase();
1130
1142
  return n.filter(
1131
- (U) => U.code.toLowerCase().includes(x) || U.name.toLowerCase().includes(x) || U.symbol.toLowerCase().includes(x)
1143
+ (E) => E.code.toLowerCase().includes(U) || E.name.toLowerCase().includes(U) || E.symbol.toLowerCase().includes(U)
1132
1144
  );
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));
1145
+ }, [n, W]), m = B(() => {
1146
+ const U = /* @__PURE__ */ new Set();
1147
+ return a.map((E) => te(E)).filter((E) => !!E && !U.has(E.code) && !!U.add(E.code));
1148
+ }, [a]), q = Y(
1149
+ (U) => {
1150
+ const E = U.target.value, de = te(E);
1151
+ de && (r == null || r(E, de));
1140
1152
  },
1141
1153
  [r]
1142
- ), L = (x) => {
1154
+ ), L = (U) => {
1143
1155
  if (o)
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,
1156
+ return `${i ? U.symbol + " " : ""}${U.code}`;
1157
+ const E = [];
1158
+ return i && E.push(U.symbol), d && E.push(U.code), E.push("—", U.name), E.join(" ");
1159
+ }, P = `nice-currency-selector nice-currency-selector--${M} nice-currency-selector--label-${D}` + (o ? " nice-currency-selector--compact" : "") + (b ? " nice-currency-selector--error" : "") + (V ? " nice-currency-selector--disabled" : "") + (x ? ` ${x}` : ""), z = D === "left" && v != null ? { width: typeof v == "number" ? `${v}px` : v, flex: "none" } : void 0, le = y != null ? {
1160
+ width: typeof y == "number" ? `${y}px` : y,
1149
1161
  flex: "none"
1150
1162
  } : void 0;
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: [
1163
+ return K ? null : /* @__PURE__ */ f("div", { ref: $, className: P, style: I, title: F, "data-testid": R, children: [
1164
+ u && /* @__PURE__ */ f("label", { htmlFor: Q, className: "nice-currency-selector__label", style: z, children: [
1153
1165
  u,
1154
- k && /* @__PURE__ */ c("span", { className: "nice-currency-selector__required", "aria-hidden": !0, children: "*" })
1166
+ _ && /* @__PURE__ */ c("span", { className: "nice-currency-selector__required", "aria-hidden": !0, children: "*" })
1155
1167
  ] }),
1156
- /* @__PURE__ */ _("div", { className: "nice-currency-selector__inner", style: le, children: [
1157
- F && /* @__PURE__ */ c(
1168
+ /* @__PURE__ */ f("div", { className: "nice-currency-selector__inner", style: le, children: [
1169
+ O && /* @__PURE__ */ c(
1158
1170
  "input",
1159
1171
  {
1160
1172
  type: "search",
1161
1173
  className: "nice-currency-selector__search",
1162
1174
  placeholder: T("currencySelector.searchCurrency", "Search currency…"),
1163
- value: V,
1164
- onChange: (x) => ne(x.target.value),
1165
- disabled: Q || re,
1175
+ value: W,
1176
+ onChange: (U) => ne(U.target.value),
1177
+ disabled: V || re,
1166
1178
  "aria-label": T("currencySelector.searchCurrency2", "Search currency")
1167
1179
  }
1168
1180
  ),
1169
- /* @__PURE__ */ _(
1181
+ /* @__PURE__ */ f(
1170
1182
  "select",
1171
1183
  {
1172
- id: X,
1173
- name: I,
1184
+ id: Q,
1185
+ name: S,
1174
1186
  className: "nice-currency-selector__select",
1175
1187
  value: e ?? "",
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")),
1188
+ onChange: q,
1189
+ disabled: V || re,
1190
+ required: _,
1191
+ "aria-invalid": !!b,
1192
+ "aria-label": X ?? (typeof u == "string" ? u : T("currencySelector.currency", "Currency")),
1181
1193
  children: [
1182
1194
  !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)) })
1195
+ m.length > 0 && /* @__PURE__ */ c("optgroup", { label: T("currencySelector.recent", "Recent"), children: m.map((U) => /* @__PURE__ */ c("option", { value: U.code, children: L(U) }, `r-${U.code}`)) }),
1196
+ /* @__PURE__ */ c("optgroup", { label: m.length > 0 ? T("currencySelector.all", "All") : "", children: C.map((U) => /* @__PURE__ */ c("option", { value: U.code, children: L(U) }, U.code)) })
1185
1197
  ]
1186
1198
  }
1187
1199
  )
1188
1200
  ] }),
1189
- (h || b) && /* @__PURE__ */ c(
1201
+ (b || g) && /* @__PURE__ */ c(
1190
1202
  "span",
1191
1203
  {
1192
- className: h ? "nice-currency-selector__error" : "nice-currency-selector__helper",
1193
- children: h ?? b
1204
+ className: b ? "nice-currency-selector__error" : "nice-currency-selector__helper",
1205
+ children: b ?? g
1194
1206
  }
1195
1207
  )
1196
1208
  ] });
@@ -1205,38 +1217,38 @@ const ze = /* @__PURE__ */ se(
1205
1217
  min: i,
1206
1218
  max: o,
1207
1219
  step: l,
1208
- locale: y,
1220
+ locale: p,
1209
1221
  placeholder: N,
1210
- label: f,
1222
+ label: h,
1211
1223
  helperText: u,
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",
1221
- labelWidth: M,
1222
- controlWidth: I,
1223
- submitOnEnter: q,
1224
- onSubmit: $,
1225
- showFormattedPreview: ee = !0,
1224
+ error: g,
1225
+ size: b = "md",
1226
+ disabled: _,
1227
+ readOnly: M,
1228
+ required: D,
1229
+ loading: v,
1230
+ accessMode: y,
1231
+ labelPlacement: x = "top",
1232
+ errorPlacement: I = "bottom",
1233
+ labelWidth: w,
1234
+ controlWidth: S,
1235
+ submitOnEnter: F,
1236
+ onSubmit: R,
1237
+ showFormattedPreview: X = !0,
1226
1238
  showSteppers: A = !1,
1227
- className: P,
1239
+ className: $,
1228
1240
  style: T,
1229
1241
  id: K,
1230
- name: Q,
1242
+ name: V,
1231
1243
  title: re,
1232
1244
  "data-testid": G,
1233
- onBlur: X,
1234
- onFocus: V,
1245
+ onBlur: Q,
1246
+ onFocus: W,
1235
1247
  liveGrouping: ne,
1236
- multiplierShortcuts: F = !0,
1248
+ multiplierShortcuts: O = !0,
1237
1249
  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(
1250
+ }, m) {
1251
+ const { t: q } = oe(), L = _ || y === "disabled" || v, P = M || y === "readOnly", z = y === "hidden", le = Ne(), U = K ?? `nice-money-${le}`, E = ((e == null ? void 0 : e.currency) ?? n ?? "USD").toUpperCase(), de = te(E), J = (de == null ? void 0 : de.decimals) ?? 2, Se = l ?? 1 / Math.pow(10, J), [we, he] = j(
1240
1252
  () => e ? (e.amount / Math.pow(10, J)).toFixed(J) : ""
1241
1253
  ), [ke, Fe] = j(!1);
1242
1254
  ot.useEffect(() => {
@@ -1246,14 +1258,14 @@ const ze = /* @__PURE__ */ se(
1246
1258
  he("");
1247
1259
  return;
1248
1260
  }
1249
- const w = te(e.currency), H = (w == null ? void 0 : w.decimals) ?? 2;
1261
+ const k = te(e.currency), H = (k == null ? void 0 : k.decimals) ?? 2;
1250
1262
  he((e.amount / Math.pow(10, H)).toFixed(H));
1251
1263
  }, [e, ke]);
1252
1264
  const Oe = Y(
1253
- (w) => {
1254
- let H = w;
1255
- if (F) {
1256
- const ue = w.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);
1265
+ (k) => {
1266
+ let H = k;
1267
+ if (O) {
1268
+ const ue = k.trim().match(/^([+-]?\d+(?:[.,]\d+)?)\s*([kKmMbB])$/);
1257
1269
  if (ue) {
1258
1270
  const me = ue[2].toLowerCase() === "k" ? 1e3 : ue[2].toLowerCase() === "m" ? 1e6 : 1e9, Be = Number(ue[1].replace(",", ".")) * me;
1259
1271
  if (!Number.isFinite(Be)) {
@@ -1263,7 +1275,7 @@ const ze = /* @__PURE__ */ se(
1263
1275
  H = String(Be);
1264
1276
  }
1265
1277
  }
1266
- const ce = ft(H, U);
1278
+ const ce = ft(H, E);
1267
1279
  if (!ce) {
1268
1280
  r == null || r(null);
1269
1281
  return;
@@ -1274,102 +1286,102 @@ const ze = /* @__PURE__ */ se(
1274
1286
  }
1275
1287
  const pe = ce.amount / Math.pow(10, J);
1276
1288
  if (i != null && pe < i) {
1277
- C == null || C(new Error(`min: ${i}`)), r == null || r(ae(i, U));
1289
+ C == null || C(new Error(`min: ${i}`)), r == null || r(ae(i, E));
1278
1290
  return;
1279
1291
  }
1280
1292
  if (o != null && pe > o) {
1281
- C == null || C(new Error(`max: ${o}`)), r == null || r(ae(o, U));
1293
+ C == null || C(new Error(`max: ${o}`)), r == null || r(ae(o, E));
1282
1294
  return;
1283
1295
  }
1284
1296
  r == null || r(ce);
1285
1297
  },
1286
- [U, J, i, o, r, F, C]
1298
+ [E, J, i, o, r, O, C]
1287
1299
  ), We = Y(
1288
- (w) => {
1289
- const H = w.target.value;
1300
+ (k) => {
1301
+ const H = k.target.value;
1290
1302
  he(H), Oe(H);
1291
1303
  },
1292
1304
  [Oe]
1293
1305
  ), 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));
1306
+ (k) => {
1307
+ const H = Math.min(o ?? 1 / 0, Math.max(i ?? -1 / 0, k));
1308
+ he(H.toFixed(J)), r == null || r(ae(H, E));
1297
1309
  },
1298
- [J, i, o, U, r]
1310
+ [J, i, o, E, r]
1299
1311
  ), $e = Y(
1300
- (w) => Ce((e ? e.amount / Math.pow(10, J) : 0) + w),
1312
+ (k) => Ce((e ? e.amount / Math.pow(10, J) : 0) + k),
1301
1313
  [e, J, Ce]
1302
- ), qe = Re(null), ge = Re(null), et = A && !L && !D;
1314
+ ), qe = Re(null), ge = Re(null), et = A && !L && !P;
1303
1315
  ut(qe, {
1304
1316
  kind: A ? "value" : "text",
1305
- disabled: L || D,
1317
+ disabled: L || P,
1306
1318
  restoreOnCancel: A,
1307
1319
  onEngage: () => {
1308
1320
  ge.current = { value: e ?? null, draft: we };
1309
1321
  },
1310
- onRelease: (w) => {
1311
- w && A && ge.current && (he(ge.current.draft), r == null || r(ge.current.value)), ge.current = null;
1322
+ onRelease: (k) => {
1323
+ k && A && ge.current && (he(ge.current.draft), r == null || r(ge.current.value)), ge.current = null;
1312
1324
  }
1313
1325
  });
1314
1326
  const De = B(() => {
1315
- var w, H;
1327
+ var k, H;
1316
1328
  try {
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) ?? ".";
1329
+ const ce = new Intl.NumberFormat(p).formatToParts(12345.6), pe = ((k = ce.find((me) => me.type === "group")) == null ? void 0 : k.value) ?? ",", ue = ((H = ce.find((me) => me.type === "decimal")) == null ? void 0 : H.value) ?? ".";
1318
1330
  return { group: pe, decimal: ue };
1319
1331
  } catch {
1320
1332
  return { group: ",", decimal: "." };
1321
1333
  }
1322
- }, [y]), Ke = ne ?? !!De.group, tt = B(() => {
1334
+ }, [p]), Ke = ne ?? !!De.group, tt = B(() => {
1323
1335
  if (!Ke || ke === !1)
1324
1336
  return we;
1325
- const w = De.decimal, H = De.group, ce = we.replace(
1337
+ const k = De.decimal, H = De.group, ce = we.replace(
1326
1338
  new RegExp(`[${H.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`, "g"),
1327
1339
  ""
1328
- ), [pe, ue] = ce.split(w);
1340
+ ), [pe, ue] = ce.split(k);
1329
1341
  if (!pe)
1330
1342
  return ce;
1331
1343
  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(), $();
1344
+ return ue != null ? `${me}${k}${ue}` : me;
1345
+ }, [we, ke, Ke, De]), xe = B(() => e ? ie(e, { locale: p }) : "", [e, p]), fe = typeof g == "string" ? g : void 0, rt = `nice-money-input nice-money-input--${b} nice-money-input--label-${x} nice-money-input--error-${I}` + (fe ? " nice-money-input--error" : "") + (L ? " nice-money-input--disabled" : "") + (v ? " nice-money-input--loading" : "") + ($ ? ` ${$}` : ""), nt = (k) => {
1346
+ if (F && k.key === "Enter" && R) {
1347
+ k.preventDefault(), R();
1336
1348
  return;
1337
1349
  }
1338
1350
  if (!et)
1339
1351
  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,
1352
+ const H = k.key === "ArrowUp" ? 1 : k.key === "ArrowDown" ? -1 : k.key === "PageUp" ? 10 : k.key === "PageDown" ? -10 : 0;
1353
+ H ? (k.preventDefault(), $e(H * Se)) : k.key === "Home" && i != null ? (k.preventDefault(), Ce(i)) : k.key === "End" && o != null && (k.preventDefault(), Ce(o));
1354
+ }, at = x === "left" && w != null ? { width: typeof w == "number" ? `${w}px` : w, flex: "none" } : void 0, ct = S != null ? {
1355
+ width: typeof S == "number" ? `${S}px` : S,
1344
1356
  flex: "none"
1345
1357
  } : void 0;
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: [
1348
- f,
1349
- m && /* @__PURE__ */ c("span", { className: "nice-money-input__required", "aria-hidden": !0, children: "*" })
1358
+ return z ? null : /* @__PURE__ */ f("div", { ref: m, className: rt, style: T, title: re, "data-testid": G, children: [
1359
+ h && /* @__PURE__ */ f("label", { htmlFor: U, className: "nice-money-input__label", style: at, children: [
1360
+ h,
1361
+ D && /* @__PURE__ */ c("span", { className: "nice-money-input__required", "aria-hidden": !0, children: "*" })
1350
1362
  ] }),
1351
- /* @__PURE__ */ _("div", { className: "nice-money-input__row", style: ct, children: [
1363
+ /* @__PURE__ */ f("div", { className: "nice-money-input__row", style: ct, children: [
1352
1364
  !d && /* @__PURE__ */ c(
1353
1365
  Qe,
1354
1366
  {
1355
- value: U,
1367
+ value: E,
1356
1368
  compact: !0,
1357
- options: s ? s.map(te).filter((w) => !!w) : void 0,
1358
- onChange: (w) => a == null ? void 0 : a(w),
1359
- disabled: L || D,
1369
+ options: s ? s.map(te).filter((k) => !!k) : void 0,
1370
+ onChange: (k) => a == null ? void 0 : a(k),
1371
+ disabled: L || P,
1360
1372
  className: "nice-money-input__currency",
1361
- "aria-label": O("moneyInput.currency", "Currency")
1373
+ "aria-label": q("moneyInput.currency", "Currency")
1362
1374
  }
1363
1375
  ),
1364
- d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (de == null ? void 0 : de.symbol) ?? U }),
1376
+ d && /* @__PURE__ */ c("span", { className: "nice-money-input__symbol", "aria-hidden": !0, children: (de == null ? void 0 : de.symbol) ?? E }),
1365
1377
  A && /* @__PURE__ */ c(
1366
1378
  "button",
1367
1379
  {
1368
1380
  type: "button",
1369
1381
  className: "nice-money-input__step nice-money-input__step--down",
1370
1382
  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"),
1383
+ disabled: L || P || i != null && e != null && e.amount / Math.pow(10, J) <= i,
1384
+ "aria-label": q("moneyInput.decreaseAmount", "Decrease amount"),
1373
1385
  tabIndex: -1,
1374
1386
  children: /* @__PURE__ */ c(ve, { name: "minus", size: 14 })
1375
1387
  }
@@ -1378,8 +1390,8 @@ const ze = /* @__PURE__ */ se(
1378
1390
  "input",
1379
1391
  {
1380
1392
  ref: qe,
1381
- id: x,
1382
- name: Q,
1393
+ id: U,
1394
+ name: V,
1383
1395
  type: "text",
1384
1396
  inputMode: "decimal",
1385
1397
  autoComplete: "transaction-amount",
@@ -1387,18 +1399,18 @@ const ze = /* @__PURE__ */ se(
1387
1399
  value: tt,
1388
1400
  onChange: We,
1389
1401
  onKeyDown: nt,
1390
- onFocus: (w) => {
1391
- Fe(!0), V == null || V(w);
1402
+ onFocus: (k) => {
1403
+ Fe(!0), W == null || W(k);
1392
1404
  },
1393
- onBlur: (w) => {
1394
- Fe(!1), e && he((e.amount / Math.pow(10, J)).toFixed(J)), X == null || X(w);
1405
+ onBlur: (k) => {
1406
+ Fe(!1), e && he((e.amount / Math.pow(10, J)).toFixed(J)), Q == null || Q(k);
1395
1407
  },
1396
1408
  placeholder: N ?? `0${J > 0 ? "." + "0".repeat(J) : ""}`,
1397
1409
  disabled: L,
1398
- readOnly: D,
1399
- required: m,
1410
+ readOnly: P,
1411
+ required: D,
1400
1412
  "aria-invalid": !!fe,
1401
- "aria-describedby": fe || u ? `${x}-help` : void 0,
1413
+ "aria-describedby": fe || u ? `${U}-help` : void 0,
1402
1414
  ...A && {
1403
1415
  role: "spinbutton",
1404
1416
  "aria-valuenow": e ? e.amount / Math.pow(10, J) : void 0,
@@ -1414,19 +1426,19 @@ const ze = /* @__PURE__ */ se(
1414
1426
  type: "button",
1415
1427
  className: "nice-money-input__step nice-money-input__step--up",
1416
1428
  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"),
1429
+ disabled: L || P || o != null && e != null && e.amount / Math.pow(10, J) >= o,
1430
+ "aria-label": q("moneyInput.increaseAmount", "Increase amount"),
1419
1431
  tabIndex: -1,
1420
1432
  children: /* @__PURE__ */ c(ve, { name: "plus", size: 14 })
1421
1433
  }
1422
1434
  ),
1423
- g && /* @__PURE__ */ c("span", { className: "nice-money-input__spinner", "aria-hidden": !0, children: /* @__PURE__ */ c(ve, { name: "refresh", size: 14 }) })
1435
+ v && /* @__PURE__ */ c("span", { className: "nice-money-input__spinner", "aria-hidden": !0, children: /* @__PURE__ */ c(ve, { name: "refresh", size: 14 }) })
1424
1436
  ] }),
1425
- ee && xe && /* @__PURE__ */ c("span", { className: "nice-money-input__preview", "aria-live": "polite", children: xe }),
1437
+ X && xe && /* @__PURE__ */ c("span", { className: "nice-money-input__preview", "aria-live": "polite", children: xe }),
1426
1438
  (fe || u) && /* @__PURE__ */ c(
1427
1439
  "span",
1428
1440
  {
1429
- id: `${x}-help`,
1441
+ id: `${U}-help`,
1430
1442
  className: fe ? "nice-money-input__error" : "nice-money-input__helper",
1431
1443
  children: fe ?? u
1432
1444
  }
@@ -1443,62 +1455,62 @@ const ze = /* @__PURE__ */ se(
1443
1455
  showBrandIcon: i = !0,
1444
1456
  size: o = "md",
1445
1457
  disabled: l,
1446
- readOnly: y,
1458
+ readOnly: p,
1447
1459
  loading: N,
1448
- accessMode: f,
1460
+ accessMode: h,
1449
1461
  label: u,
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({
1462
+ helperText: g,
1463
+ error: b,
1464
+ required: _,
1465
+ className: M,
1466
+ style: D,
1467
+ id: v,
1468
+ title: y,
1469
+ "data-testid": x
1470
+ }, I) {
1471
+ const { t: w } = oe(), S = h === "hidden", F = l || h === "disabled" || N, R = p || h === "readOnly", X = Ne(), A = v ?? `nice-cc-${X}`, [$, T] = j({
1460
1472
  number: !1,
1461
1473
  expiry: !1,
1462
1474
  cvc: !1,
1463
1475
  holder: !1,
1464
1476
  postal: !1
1465
- }), K = B(() => Me(e.number), [e.number]), Q = B(
1477
+ }), K = B(() => Me(e.number), [e.number]), V = B(
1466
1478
  () => Le(e, { requireHolder: a ?? n }),
1467
1479
  [e, a, n]
1468
1480
  ), re = !d || d.includes(K) || K === "unknown", G = Y(
1469
- (D) => {
1470
- const z = { ...e, ...D }, le = Le(z, { requireHolder: a ?? n });
1481
+ (P) => {
1482
+ const z = { ...e, ...P }, le = Le(z, { requireHolder: a ?? n });
1471
1483
  r == null || r(z, le);
1472
1484
  },
1473
1485
  [e, a, n, r]
1474
- ), X = Y(
1475
- (D) => {
1476
- const z = D.target.value.replace(/\D/g, "").slice(0, 19);
1486
+ ), Q = Y(
1487
+ (P) => {
1488
+ const z = P.target.value.replace(/\D/g, "").slice(0, 19);
1477
1489
  G({ number: z });
1478
1490
  },
1479
1491
  [G]
1480
- ), V = Y(
1481
- (D) => {
1482
- const z = D.target.value.replace(/\D/g, "").slice(0, 4);
1492
+ ), W = Y(
1493
+ (P) => {
1494
+ const z = P.target.value.replace(/\D/g, "").slice(0, 4);
1483
1495
  let le = z;
1484
1496
  z.length >= 3 ? le = `${z.slice(0, 2)}/${z.slice(2)}` : z.length === 2 && (le = `${z}/`), G({ expiry: le });
1485
1497
  },
1486
1498
  [G]
1487
1499
  ), ne = Y(
1488
- (D) => {
1489
- const z = D.target.value.replace(/\D/g, "").slice(0, be(K));
1500
+ (P) => {
1501
+ const z = P.target.value.replace(/\D/g, "").slice(0, be(K));
1490
1502
  G({ cvc: z });
1491
1503
  },
1492
1504
  [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: [
1505
+ ), O = B(() => bt(e.number, K), [e.number, K]), C = $.number && e.number.length > 0 && (Ze(e.number) ? re ? void 0 : "Card brand not accepted" : V.errors.number), m = $.expiry && e.expiry.length > 0 && !Xe(e.expiry) ? V.errors.expiry : void 0, q = $.cvc && e.cvc.length > 0 && e.cvc.length !== be(K) ? V.errors.cvc : void 0, L = `nice-credit-card nice-credit-card--${o}` + (F ? " nice-credit-card--disabled" : "") + (N ? " nice-credit-card--loading" : "") + (b ? " nice-credit-card--error" : "") + (M ? ` ${M}` : "");
1506
+ return S ? null : /* @__PURE__ */ f("div", { ref: I, className: L, style: D, title: y, "data-testid": x, children: [
1507
+ u && /* @__PURE__ */ f("div", { className: "nice-credit-card__title", children: [
1496
1508
  u,
1497
- k && /* @__PURE__ */ c("span", { className: "nice-credit-card__required", "aria-hidden": !0, children: "*" })
1509
+ _ && /* @__PURE__ */ c("span", { className: "nice-credit-card__required", "aria-hidden": !0, children: "*" })
1498
1510
  ] }),
1499
- /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field nice-credit-card__field--number", children: [
1500
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardNumber", "Card number") }),
1501
- /* @__PURE__ */ _("span", { className: "nice-credit-card__input-wrapper", children: [
1511
+ /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ f("label", { className: "nice-credit-card__field nice-credit-card__field--number", children: [
1512
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: w("creditCardInput.cardNumber", "Card number") }),
1513
+ /* @__PURE__ */ f("span", { className: "nice-credit-card__input-wrapper", children: [
1502
1514
  /* @__PURE__ */ c(
1503
1515
  "input",
1504
1516
  {
@@ -1507,11 +1519,11 @@ const ze = /* @__PURE__ */ se(
1507
1519
  inputMode: "numeric",
1508
1520
  autoComplete: "cc-number",
1509
1521
  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: $,
1522
+ value: O,
1523
+ onChange: Q,
1524
+ onBlur: () => T((P) => ({ ...P, number: !0 })),
1525
+ disabled: F,
1526
+ readOnly: R,
1515
1527
  "aria-invalid": !!C,
1516
1528
  "aria-describedby": C ? `${A}-number-err` : void 0,
1517
1529
  className: "nice-credit-card__input",
@@ -1522,9 +1534,9 @@ const ze = /* @__PURE__ */ se(
1522
1534
  ] }),
1523
1535
  C && /* @__PURE__ */ c("span", { id: `${A}-number-err`, className: "nice-credit-card__error", children: C })
1524
1536
  ] }) }),
1525
- /* @__PURE__ */ _("div", { className: "nice-credit-card__row nice-credit-card__row--split", children: [
1526
- /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1527
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.expiry", "Expiry") }),
1537
+ /* @__PURE__ */ f("div", { className: "nice-credit-card__row nice-credit-card__row--split", children: [
1538
+ /* @__PURE__ */ f("label", { className: "nice-credit-card__field", children: [
1539
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: w("creditCardInput.expiry", "Expiry") }),
1528
1540
  /* @__PURE__ */ c(
1529
1541
  "input",
1530
1542
  {
@@ -1532,26 +1544,26 @@ const ze = /* @__PURE__ */ se(
1532
1544
  type: "text",
1533
1545
  inputMode: "numeric",
1534
1546
  autoComplete: "cc-exp",
1535
- placeholder: M("creditCardInput.mmYy", "MM/YY"),
1547
+ placeholder: w("creditCardInput.mmYy", "MM/YY"),
1536
1548
  value: e.expiry,
1537
- onChange: V,
1549
+ onChange: W,
1538
1550
  onBlur: () => {
1539
1551
  T((z) => ({ ...z, expiry: !0 }));
1540
- const D = Je(e.expiry);
1541
- D && D !== e.expiry && G({ expiry: D });
1552
+ const P = Je(e.expiry);
1553
+ P && P !== e.expiry && G({ expiry: P });
1542
1554
  },
1543
- disabled: q,
1544
- readOnly: $,
1545
- "aria-invalid": !!p,
1546
- "aria-describedby": p ? `${A}-expiry-err` : void 0,
1555
+ disabled: F,
1556
+ readOnly: R,
1557
+ "aria-invalid": !!m,
1558
+ "aria-describedby": m ? `${A}-expiry-err` : void 0,
1547
1559
  className: "nice-credit-card__input",
1548
1560
  maxLength: 5
1549
1561
  }
1550
1562
  ),
1551
- p && /* @__PURE__ */ c("span", { id: `${A}-expiry-err`, className: "nice-credit-card__error", children: p })
1563
+ m && /* @__PURE__ */ c("span", { id: `${A}-expiry-err`, className: "nice-credit-card__error", children: m })
1552
1564
  ] }),
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") }),
1565
+ /* @__PURE__ */ f("label", { className: "nice-credit-card__field", children: [
1566
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: K === "amex" ? w("creditCardInput.cid", "CID") : w("creditCardInput.cvc", "CVC") }),
1555
1567
  /* @__PURE__ */ c(
1556
1568
  "input",
1557
1569
  {
@@ -1562,39 +1574,39 @@ const ze = /* @__PURE__ */ se(
1562
1574
  placeholder: "•".repeat(be(K)),
1563
1575
  value: e.cvc,
1564
1576
  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,
1577
+ onBlur: () => T((P) => ({ ...P, cvc: !0 })),
1578
+ disabled: F,
1579
+ readOnly: R,
1580
+ "aria-invalid": !!q,
1581
+ "aria-describedby": q ? `${A}-cvc-err` : void 0,
1570
1582
  className: "nice-credit-card__input",
1571
1583
  maxLength: be(K)
1572
1584
  }
1573
1585
  ),
1574
- O && /* @__PURE__ */ c("span", { id: `${A}-cvc-err`, className: "nice-credit-card__error", children: O })
1586
+ q && /* @__PURE__ */ c("span", { id: `${A}-cvc-err`, className: "nice-credit-card__error", children: q })
1575
1587
  ] })
1576
1588
  ] }),
1577
- n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1578
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.cardholderName", "Cardholder name") }),
1589
+ n && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ f("label", { className: "nice-credit-card__field", children: [
1590
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: w("creditCardInput.cardholderName", "Cardholder name") }),
1579
1591
  /* @__PURE__ */ c(
1580
1592
  "input",
1581
1593
  {
1582
1594
  id: `${A}-holder`,
1583
1595
  type: "text",
1584
1596
  autoComplete: "cc-name",
1585
- placeholder: M("creditCardInput.janeDoe", "Jane Doe"),
1597
+ placeholder: w("creditCardInput.janeDoe", "Jane Doe"),
1586
1598
  value: e.holderName ?? "",
1587
- onChange: (D) => G({ holderName: D.target.value }),
1588
- onBlur: () => T((D) => ({ ...D, holder: !0 })),
1589
- disabled: q,
1590
- readOnly: $,
1599
+ onChange: (P) => G({ holderName: P.target.value }),
1600
+ onBlur: () => T((P) => ({ ...P, holder: !0 })),
1601
+ disabled: F,
1602
+ readOnly: R,
1591
1603
  className: "nice-credit-card__input",
1592
1604
  maxLength: 120
1593
1605
  }
1594
1606
  )
1595
1607
  ] }) }),
1596
- s && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ _("label", { className: "nice-credit-card__field", children: [
1597
- /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: M("creditCardInput.postalCode", "Postal code") }),
1608
+ s && /* @__PURE__ */ c("div", { className: "nice-credit-card__row", children: /* @__PURE__ */ f("label", { className: "nice-credit-card__field", children: [
1609
+ /* @__PURE__ */ c("span", { className: "nice-credit-card__label", children: w("creditCardInput.postalCode", "Postal code") }),
1598
1610
  /* @__PURE__ */ c(
1599
1611
  "input",
1600
1612
  {
@@ -1602,21 +1614,21 @@ const ze = /* @__PURE__ */ se(
1602
1614
  type: "text",
1603
1615
  autoComplete: "postal-code",
1604
1616
  value: e.postalCode ?? "",
1605
- onChange: (D) => G({ postalCode: D.target.value }),
1606
- onBlur: () => T((D) => ({ ...D, postal: !0 })),
1607
- disabled: q,
1608
- readOnly: $,
1617
+ onChange: (P) => G({ postalCode: P.target.value }),
1618
+ onBlur: () => T((P) => ({ ...P, postal: !0 })),
1619
+ disabled: F,
1620
+ readOnly: R,
1609
1621
  className: "nice-credit-card__input",
1610
1622
  maxLength: 16
1611
1623
  }
1612
1624
  )
1613
1625
  ] }) }),
1614
- (h || b) && /* @__PURE__ */ c(
1626
+ (b || g) && /* @__PURE__ */ c(
1615
1627
  "div",
1616
1628
  {
1617
- className: h ? "nice-credit-card__form-error" : "nice-credit-card__helper",
1618
- role: h ? "alert" : void 0,
1619
- children: h ?? b
1629
+ className: b ? "nice-credit-card__form-error" : "nice-credit-card__helper",
1630
+ role: b ? "alert" : void 0,
1631
+ children: b ?? g
1620
1632
  }
1621
1633
  )
1622
1634
  ] });
@@ -1655,101 +1667,101 @@ const gr = /* @__PURE__ */ se(
1655
1667
  metadata: i,
1656
1668
  autoCapture: o = !0,
1657
1669
  submitLabel: l,
1658
- onSuccess: y,
1670
+ onSuccess: p,
1659
1671
  onError: N,
1660
- consents: f,
1672
+ consents: h,
1661
1673
  className: u,
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(() => {
1674
+ style: g
1675
+ }, b) {
1676
+ const { t: _ } = oe(), M = l ?? _("paymentForm.pay", "Pay"), [D, v] = j(r), [y, x] = j(r.currency), [I, w] = j({ number: "", expiry: "", cvc: "" }), [S, F] = j(null), [R, X] = j(!1), [A, $] = j(null), T = jt(e), K = B(() => e.supportedCurrencies === "*" ? !0 : e.supportedCurrencies.includes(D.currency.toUpperCase()), [e, D.currency]), V = B(() => {
1665
1677
  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(() => {
1678
+ const O = (C = e.minimums) == null ? void 0 : C[D.currency.toUpperCase()];
1679
+ return O == null || D.amount >= O;
1680
+ }, [e, D]), re = B(() => {
1669
1681
  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);
1682
+ const O = (C = e.minimums) == null ? void 0 : C[D.currency.toUpperCase()];
1683
+ return O == null ? null : { amount: O, currency: D.currency };
1684
+ }, [e, D.currency]), G = !!(S != null && S.isValid), Q = !R && K && V && G, W = Y(
1685
+ async (O) => {
1686
+ if (O.preventDefault(), !!Q) {
1687
+ $(null), X(!0);
1676
1688
  try {
1677
1689
  const C = {
1678
- amount: m,
1679
- card: E,
1690
+ amount: D,
1691
+ card: I,
1680
1692
  customer: a,
1681
1693
  description: d,
1682
1694
  metadata: i,
1683
1695
  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);
1696
+ }, m = await T.authorize(C);
1697
+ if (o && m.status === "authorized") {
1698
+ const q = await T.capture(m.id, D);
1699
+ p == null || p(q);
1688
1700
  } else
1689
- y == null || y(p);
1701
+ p == null || p(m);
1690
1702
  } catch (C) {
1691
- const p = C instanceof Error ? C : new Error(String(C));
1692
- P(p.message), N == null || N(p);
1703
+ const m = C instanceof Error ? C : new Error(String(C));
1704
+ $(m.message), N == null || N(m);
1693
1705
  } finally {
1694
- ee(!1);
1706
+ X(!1);
1695
1707
  }
1696
1708
  }
1697
1709
  },
1698
1710
  [
1699
- X,
1700
- m,
1701
- E,
1711
+ Q,
1712
+ D,
1713
+ I,
1702
1714
  a,
1703
1715
  d,
1704
1716
  i,
1705
1717
  o,
1706
1718
  T,
1707
- y,
1719
+ p,
1708
1720
  N
1709
1721
  ]
1710
- ), ne = te(m.currency);
1711
- return /* @__PURE__ */ _(
1722
+ ), ne = te(D.currency);
1723
+ return /* @__PURE__ */ f(
1712
1724
  "form",
1713
1725
  {
1714
- ref: h,
1726
+ ref: b,
1715
1727
  className: "nice-payment-form" + (u ? ` ${u}` : ""),
1716
- style: b,
1717
- onSubmit: V,
1718
- "aria-busy": $,
1728
+ style: g,
1729
+ onSubmit: W,
1730
+ "aria-busy": R,
1719
1731
  children: [
1720
1732
  /* @__PURE__ */ c("div", { className: "nice-payment-form__amount", children: n ? /* @__PURE__ */ c(
1721
1733
  Ve,
1722
1734
  {
1723
- label: k("paymentForm.amount", "Amount"),
1724
- value: m,
1725
- currency: v,
1735
+ label: _("paymentForm.amount", "Amount"),
1736
+ value: D,
1737
+ currency: y,
1726
1738
  currencies: s,
1727
- onChange: (F) => F && g(F),
1728
- onCurrencyChange: (F) => {
1729
- S(F), g((C) => ({ ...C, currency: F }));
1739
+ onChange: (O) => O && v(O),
1740
+ onCurrencyChange: (O) => {
1741
+ x(O), v((C) => ({ ...C, currency: O }));
1730
1742
  },
1731
- disabled: $,
1743
+ disabled: R,
1732
1744
  required: !0,
1733
1745
  showFormattedPreview: !0
1734
1746
  }
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 })
1747
+ ) : /* @__PURE__ */ f("div", { className: "nice-payment-form__total", children: [
1748
+ /* @__PURE__ */ c("span", { className: "nice-payment-form__total-label", children: _("paymentForm.total", "Total") }),
1749
+ /* @__PURE__ */ c(ze, { value: D })
1738
1750
  ] }) }),
1739
1751
  d && /* @__PURE__ */ c("p", { className: "nice-payment-form__description", children: d }),
1740
1752
  /* @__PURE__ */ c("div", { className: "nice-payment-form__card", children: /* @__PURE__ */ c(
1741
1753
  Gt,
1742
1754
  {
1743
- value: E,
1744
- onChange: (F, C) => {
1745
- M(F), q(C);
1755
+ value: I,
1756
+ onChange: (O, C) => {
1757
+ w(O), F(C);
1746
1758
  },
1747
- disabled: $
1759
+ disabled: R
1748
1760
  }
1749
1761
  ) }),
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(
1762
+ !K && /* @__PURE__ */ c("div", { className: "nice-payment-form__warning", role: "alert", children: _("paymentForm.doesNotAccept", "{provider} does not accept {currency}.").replace("{provider}", String(e.name)).replace("{currency}", String((ne == null ? void 0 : ne.name) ?? D.currency)) }),
1763
+ !V && re && /* @__PURE__ */ f("div", { className: "nice-payment-form__warning", role: "alert", children: [
1764
+ _("paymentForm.minimumChargeForIs", "Minimum charge for {name} is").replace(
1753
1765
  "{name}",
1754
1766
  String(e.name)
1755
1767
  ),
@@ -1757,20 +1769,20 @@ const gr = /* @__PURE__ */ se(
1757
1769
  /* @__PURE__ */ c(ze, { value: re }),
1758
1770
  "."
1759
1771
  ] }),
1760
- f && /* @__PURE__ */ c("div", { className: "nice-payment-form__consents", children: f }),
1772
+ h && /* @__PURE__ */ c("div", { className: "nice-payment-form__consents", children: h }),
1761
1773
  A && /* @__PURE__ */ c("div", { className: "nice-payment-form__error", role: "alert", children: A }),
1762
1774
  /* @__PURE__ */ c(
1763
1775
  "button",
1764
1776
  {
1765
1777
  type: "submit",
1766
1778
  className: "nice-payment-form__submit",
1767
- disabled: !X,
1768
- "aria-disabled": !X,
1769
- children: $ ? k("paymentForm.processing", "Processing…") : R
1779
+ disabled: !Q,
1780
+ "aria-disabled": !Q,
1781
+ children: R ? _("paymentForm.processing", "Processing…") : M
1770
1782
  }
1771
1783
  ),
1772
- /* @__PURE__ */ _("p", { className: "nice-payment-form__processor", children: [
1773
- k("paymentForm.securedBy", "Secured by"),
1784
+ /* @__PURE__ */ f("p", { className: "nice-payment-form__processor", children: [
1785
+ _("paymentForm.securedBy", "Secured by"),
1774
1786
  " ",
1775
1787
  /* @__PURE__ */ c("strong", { children: e.name })
1776
1788
  ] })
@@ -1793,31 +1805,33 @@ const vr = /* @__PURE__ */ se(
1793
1805
  size: i = "md",
1794
1806
  locale: o,
1795
1807
  className: l,
1796
- style: y
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: [
1808
+ style: p,
1809
+ testId: N,
1810
+ "data-testid": h
1811
+ }, u) {
1812
+ const { t: g } = oe(), b = r && r.currency === e.currency && r.amount > e.amount, _ = B(() => !b || !r ? null : Math.round((r.amount - e.amount) / r.amount * 100), [b, r, e.amount]), M = `nice-price-tag nice-price-tag--${i}` + (l ? ` ${l}` : "");
1813
+ return /* @__PURE__ */ f("div", { ref: u, className: M, style: p, "data-testid": h ?? N, children: [
1800
1814
  a && /* @__PURE__ */ c("span", { className: "nice-price-tag__prefix", children: a }),
1801
- /* @__PURE__ */ _("span", { className: "nice-price-tag__main", children: [
1815
+ /* @__PURE__ */ f("span", { className: "nice-price-tag__main", children: [
1802
1816
  /* @__PURE__ */ c("span", { className: "nice-price-tag__amount", children: ie(e, { locale: o }) }),
1803
1817
  n && /* @__PURE__ */ c("span", { className: "nice-price-tag__period", children: n })
1804
1818
  ] }),
1805
- u && r && /* @__PURE__ */ c(
1819
+ b && r && /* @__PURE__ */ c(
1806
1820
  "span",
1807
1821
  {
1808
1822
  className: "nice-price-tag__original",
1809
- "aria-label": f("priceTag.originalPrice", "Original price"),
1823
+ "aria-label": g("priceTag.originalPrice", "Original price"),
1810
1824
  children: /* @__PURE__ */ c("s", { children: ie(r, { locale: o }) })
1811
1825
  }
1812
1826
  ),
1813
- u && d && b != null && b > 0 && /* @__PURE__ */ _(
1827
+ b && d && _ != null && _ > 0 && /* @__PURE__ */ f(
1814
1828
  "span",
1815
1829
  {
1816
1830
  className: "nice-price-tag__discount",
1817
- "aria-label": f("priceTag.percentOff", "{pct} percent off").replace("{pct}", String(b)),
1831
+ "aria-label": g("priceTag.percentOff", "{pct} percent off").replace("{pct}", String(_)),
1818
1832
  children: [
1819
1833
  "−",
1820
- b,
1834
+ _,
1821
1835
  "%"
1822
1836
  ]
1823
1837
  }
@@ -1835,76 +1849,76 @@ const vr = /* @__PURE__ */ se(
1835
1849
  provider: i,
1836
1850
  locale: o,
1837
1851
  showRateLine: l = !0,
1838
- className: y,
1852
+ className: p,
1839
1853
  style: N
1840
- }, f) {
1841
- const { t: u } = oe(), [b, h] = Ue({
1854
+ }, h) {
1855
+ const { t: u } = oe(), [g, b] = Ue({
1842
1856
  value: e,
1843
1857
  defaultValue: r,
1844
1858
  fallbackValue: Xt,
1845
1859
  onChange: n,
1846
1860
  componentName: "NiceCurrencyConverter"
1847
- }), [k, R] = Ue({
1861
+ }), [_, M] = Ue({
1848
1862
  value: a,
1849
1863
  defaultValue: s,
1850
- fallbackValue: b.currency,
1864
+ fallbackValue: g.currency,
1851
1865
  onChange: d,
1852
1866
  componentName: "NiceCurrencyConverter"
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,
1867
+ }), { converted: D, loading: v, error: y } = Ee(g, _, i), x = B(
1868
+ () => ({ amount: Math.pow(10, 2), currency: g.currency }),
1869
+ [g.currency]
1870
+ ), { converted: I } = Ee(
1871
+ l ? x : null,
1872
+ _,
1859
1873
  i
1860
1874
  );
1861
- return /* @__PURE__ */ _(
1875
+ return /* @__PURE__ */ f(
1862
1876
  "div",
1863
1877
  {
1864
- ref: f,
1865
- className: "nice-currency-converter" + (y ? ` ${y}` : ""),
1878
+ ref: h,
1879
+ className: "nice-currency-converter" + (p ? ` ${p}` : ""),
1866
1880
  style: N,
1867
1881
  children: [
1868
1882
  /* @__PURE__ */ c("div", { className: "nice-currency-converter__row", children: /* @__PURE__ */ c(
1869
1883
  Ve,
1870
1884
  {
1871
1885
  label: u("currencyConverter.from", "From"),
1872
- value: b,
1873
- onChange: (M) => M && h(M),
1874
- currency: b.currency,
1875
- onCurrencyChange: (M) => h({ ...b, currency: M }),
1886
+ value: g,
1887
+ onChange: (w) => w && b(w),
1888
+ currency: g.currency,
1889
+ onCurrencyChange: (w) => b({ ...g, currency: w }),
1876
1890
  showFormattedPreview: !1
1877
1891
  }
1878
1892
  ) }),
1879
- /* @__PURE__ */ _("div", { className: "nice-currency-converter__row", children: [
1893
+ /* @__PURE__ */ f("div", { className: "nice-currency-converter__row", children: [
1880
1894
  /* @__PURE__ */ c("label", { className: "nice-currency-converter__label", children: u("currencyConverter.to", "To") }),
1881
- /* @__PURE__ */ _("div", { className: "nice-currency-converter__output", children: [
1895
+ /* @__PURE__ */ f("div", { className: "nice-currency-converter__output", children: [
1882
1896
  /* @__PURE__ */ c(
1883
1897
  Qe,
1884
1898
  {
1885
- value: k,
1886
- onChange: (M) => R(M),
1899
+ value: _,
1900
+ onChange: (w) => M(w),
1887
1901
  compact: !0
1888
1902
  }
1889
1903
  ),
1890
- /* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children: g ? "…" : v ? "—" : m ? ie(m, { locale: o }) : "" })
1904
+ /* @__PURE__ */ c("span", { className: "nice-currency-converter__amount", children: v ? "…" : y ? "—" : D ? ie(D, { locale: o }) : "" })
1891
1905
  ] })
1892
1906
  ] }),
1893
- l && E && /* @__PURE__ */ _("p", { className: "nice-currency-converter__rate", children: [
1907
+ l && I && /* @__PURE__ */ f("p", { className: "nice-currency-converter__rate", children: [
1894
1908
  "1 ",
1895
- b.currency,
1909
+ g.currency,
1896
1910
  " = ",
1897
- ie(E, { locale: o }),
1911
+ ie(I, { locale: o }),
1898
1912
  " ",
1899
- /* @__PURE__ */ _("span", { className: "nice-currency-converter__inverse", children: [
1913
+ /* @__PURE__ */ f("span", { className: "nice-currency-converter__inverse", children: [
1900
1914
  "· 1 ",
1901
- k,
1915
+ _,
1902
1916
  " =",
1903
1917
  " ",
1904
- ie(ae(1 / Ge(E), b.currency), { locale: o })
1918
+ ie(ae(1 / Ge(I), g.currency), { locale: o })
1905
1919
  ] })
1906
1920
  ] }),
1907
- v && /* @__PURE__ */ c("p", { className: "nice-currency-converter__error", role: "alert", children: v.message })
1921
+ y && /* @__PURE__ */ c("p", { className: "nice-currency-converter__error", role: "alert", children: y.message })
1908
1922
  ]
1909
1923
  }
1910
1924
  );
@@ -1923,76 +1937,79 @@ const wr = /* @__PURE__ */ se(
1923
1937
  labels: i,
1924
1938
  density: o = "comfortable",
1925
1939
  className: l,
1926
- style: y,
1927
- id: N
1928
- }, f) {
1929
- const { t: u } = oe(), b = {
1930
- label: (i == null ? void 0 : i.label) ?? u("taxBreakdown.item", "Item"),
1940
+ style: p,
1941
+ id: N,
1942
+ testId: h,
1943
+ "data-testid": u
1944
+ }, g) {
1945
+ const { t: b } = oe(), _ = {
1946
+ label: (i == null ? void 0 : i.label) ?? b("taxBreakdown.item", "Item"),
1931
1947
  rate: (i == null ? void 0 : i.rate) ?? "VAT",
1932
1948
  net: (i == null ? void 0 : i.net) ?? "Net",
1933
1949
  vat: (i == null ? void 0 : i.vat) ?? "Tax",
1934
1950
  gross: (i == null ? void 0 : i.gross) ?? "Gross",
1935
1951
  total: (i == null ? void 0 : i.total) ?? "Total"
1936
- }, h = B(() => {
1952
+ }, M = B(() => {
1937
1953
  if (n === "total") {
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);
1954
+ const y = /* @__PURE__ */ new Map();
1955
+ for (const I of e) {
1956
+ let w = y.get(I.vatRate);
1957
+ w || (w = [], y.set(I.vatRate, w)), w.push(I.netAmount);
1942
1958
  }
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 });
1959
+ const x = [];
1960
+ for (const [I, w] of y) {
1961
+ const S = w.reduce((X, A) => ye(X, A), ae(0, w[0].currency)), F = je(Ae(S, I)), R = ye(S, F);
1962
+ x.push({ rate: I, net: S, vat: F, gross: R });
1947
1963
  }
1948
- return g;
1964
+ return x;
1949
1965
  }
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 };
1966
+ return e.map((y) => {
1967
+ const x = je(Ae(y.netAmount, y.vatRate)), I = ye(y.netAmount, x);
1968
+ return { label: y.label, rate: y.vatRate, net: y.netAmount, vat: x, gross: I };
1953
1969
  });
1954
- }, [e, n]), k = B(() => {
1955
- if (h.length === 0)
1970
+ }, [e, n]), D = B(() => {
1971
+ if (M.length === 0)
1956
1972
  return null;
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__ */ _(
1973
+ const y = M[0].net.currency;
1974
+ let x = ae(0, y), I = ae(0, y), w = ae(0, y);
1975
+ for (const S of M)
1976
+ x = ye(x, S.net), I = ye(I, S.vat), w = ye(w, S.gross);
1977
+ return { net: x, vat: I, gross: w };
1978
+ }, [M]), v = (y) => ie(y, { locale: r });
1979
+ return /* @__PURE__ */ f(
1964
1980
  "table",
1965
1981
  {
1966
- ref: f,
1982
+ ref: g,
1967
1983
  id: N,
1968
1984
  className: `nice-tax-breakdown nice-tax-breakdown--${o} ${l ?? ""}`,
1969
- style: y,
1985
+ style: p,
1970
1986
  role: "table",
1971
- "aria-label": b.total,
1987
+ "aria-label": _.total,
1988
+ "data-testid": u ?? h,
1972
1989
  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 })
1990
+ /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ f("tr", { children: [
1991
+ M.some((y) => y.label !== void 0) && /* @__PURE__ */ c("th", { scope: "col", children: _.label }),
1992
+ !d && /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__rate", children: _.rate }),
1993
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: _.net }),
1994
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: _.vat }),
1995
+ /* @__PURE__ */ c("th", { scope: "col", className: "nice-tax-breakdown__num", children: _.gross })
1979
1996
  ] }) }),
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 }),
1997
+ /* @__PURE__ */ c("tbody", { children: M.map((y, x) => /* @__PURE__ */ f("tr", { children: [
1998
+ M.some((I) => I.label !== void 0) && /* @__PURE__ */ c("td", { children: y.label ?? "" }),
1999
+ !d && /* @__PURE__ */ f("td", { className: "nice-tax-breakdown__rate", children: [
2000
+ (y.rate * 100).toLocaleString(r, { maximumFractionDigits: 2 }),
1984
2001
  "%"
1985
2002
  ] }),
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) })
2003
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(y.net) }),
2004
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(y.vat) }),
2005
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(y.gross) })
2006
+ ] }, `${y.rate}-${x}`)) }),
2007
+ a && D && /* @__PURE__ */ c("tfoot", { children: s && /* @__PURE__ */ f("tr", { className: "nice-tax-breakdown__totals", children: [
2008
+ M.some((y) => y.label !== void 0) && /* @__PURE__ */ c("td", { children: _.total }),
2009
+ !d && /* @__PURE__ */ c("td", { children: M.some((y) => y.label !== void 0) ? null : _.total }),
2010
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(D.net) }),
2011
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(D.vat) }),
2012
+ /* @__PURE__ */ c("td", { className: "nice-tax-breakdown__num", children: v(D.gross) })
1996
2013
  ] }) })
1997
2014
  ]
1998
2015
  }
@@ -2006,65 +2023,65 @@ const wr = /* @__PURE__ */ se(
2006
2023
  layout: i = "list",
2007
2024
  columns: o = 2,
2008
2025
  currency: l,
2009
- label: y,
2026
+ label: p,
2010
2027
  name: N,
2011
- readOnly: f = !1,
2028
+ readOnly: h = !1,
2012
2029
  className: u,
2013
- style: b,
2014
- id: h,
2015
- accessMode: k,
2016
- "data-testid": R
2017
- } = e, m = Ne(), g = N ?? `nice-pm-${m}`, v = B(() => {
2030
+ style: g,
2031
+ id: b,
2032
+ accessMode: _,
2033
+ "data-testid": M
2034
+ } = e, D = Ne(), v = N ?? `nice-pm-${D}`, y = B(() => {
2018
2035
  if (!l)
2019
2036
  return a;
2020
- const I = l.toUpperCase();
2037
+ const S = l.toUpperCase();
2021
2038
  return a.filter(
2022
- (q) => !q.currencies || q.currencies.map(($) => $.toUpperCase()).includes(I)
2039
+ (F) => !F.currencies || F.currencies.map((R) => R.toUpperCase()).includes(S)
2023
2040
  );
2024
2041
  }, [a, l]);
2025
- if (k === "hidden")
2042
+ if (_ === "hidden")
2026
2043
  return null;
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: [
2029
- y && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__label", children: y }),
2030
- /* @__PURE__ */ _(
2044
+ const x = h || _ === "disabled" || _ === "readOnly", I = `nice-payment-method-selector nice-payment-method-selector--${i}` + (u ? ` ${u}` : ""), w = i === "grid" ? { gridTemplateColumns: `repeat(${o}, minmax(0, 1fr))` } : void 0;
2045
+ return /* @__PURE__ */ f("div", { ref: r, id: b, className: I, style: g, "data-testid": M, children: [
2046
+ p && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__label", children: p }),
2047
+ /* @__PURE__ */ f(
2031
2048
  "div",
2032
2049
  {
2033
2050
  className: "nice-payment-method-selector__options",
2034
- style: M,
2051
+ style: w,
2035
2052
  role: "radiogroup",
2036
- "aria-label": y ?? n("paymentMethodSelector.paymentMethod", "Payment method"),
2053
+ "aria-label": p ?? n("paymentMethodSelector.paymentMethod", "Payment method"),
2037
2054
  children: [
2038
- v.map((I) => {
2039
- const q = I.id === s, $ = S || I.disabled;
2040
- return /* @__PURE__ */ _(
2055
+ y.map((S) => {
2056
+ const F = S.id === s, R = x || S.disabled;
2057
+ return /* @__PURE__ */ f(
2041
2058
  "label",
2042
2059
  {
2043
- className: "nice-payment-method-selector__option" + (q ? " nice-payment-method-selector__option--selected" : "") + ($ ? " nice-payment-method-selector__option--disabled" : ""),
2060
+ className: "nice-payment-method-selector__option" + (F ? " nice-payment-method-selector__option--selected" : "") + (R ? " nice-payment-method-selector__option--disabled" : ""),
2044
2061
  children: [
2045
2062
  /* @__PURE__ */ c(
2046
2063
  "input",
2047
2064
  {
2048
2065
  type: "radio",
2049
2066
  className: "nice-payment-method-selector__radio",
2050
- name: g,
2051
- value: I.id,
2052
- checked: q,
2053
- disabled: $,
2054
- onChange: () => d == null ? void 0 : d(I.id)
2067
+ name: v,
2068
+ value: S.id,
2069
+ checked: F,
2070
+ disabled: R,
2071
+ onChange: () => d == null ? void 0 : d(S.id)
2055
2072
  }
2056
2073
  ),
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 })
2074
+ S.icon && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__icon", children: S.icon }),
2075
+ /* @__PURE__ */ f("span", { className: "nice-payment-method-selector__text", children: [
2076
+ /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__name", children: S.label }),
2077
+ S.description && /* @__PURE__ */ c("span", { className: "nice-payment-method-selector__desc", children: S.description })
2061
2078
  ] })
2062
2079
  ]
2063
2080
  },
2064
- I.id
2081
+ S.id
2065
2082
  );
2066
2083
  }),
2067
- v.length === 0 && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__empty", children: n("paymentMethodSelector.noMethodsAvailable", "No methods available.") })
2084
+ y.length === 0 && /* @__PURE__ */ c("div", { className: "nice-payment-method-selector__empty", children: n("paymentMethodSelector.noMethodsAvailable", "No methods available.") })
2068
2085
  ]
2069
2086
  }
2070
2087
  )
@@ -2091,70 +2108,70 @@ const wr = /* @__PURE__ */ se(
2091
2108
  providers: i,
2092
2109
  onTestConnection: o,
2093
2110
  showWebhookUrl: l = !0,
2094
- baseUrl: y,
2111
+ baseUrl: p,
2095
2112
  readOnly: N = !1,
2096
- testLabel: f = n("paymentProviderConfig.testConnection", "Test connection"),
2113
+ testLabel: h = n("paymentProviderConfig.testConnection", "Test connection"),
2097
2114
  tutorial: u,
2098
- className: b,
2099
- style: h,
2100
- id: k,
2101
- accessMode: R,
2102
- "data-testid": m
2103
- } = e, [g, v] = Ue({
2115
+ className: g,
2116
+ style: b,
2117
+ id: _,
2118
+ accessMode: M,
2119
+ "data-testid": D
2120
+ } = e, [v, y] = Ue({
2104
2121
  value: a,
2105
2122
  defaultValue: s,
2106
2123
  fallbackValue: er,
2107
2124
  onChange: d,
2108
2125
  componentName: "NicePaymentProviderConfig"
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")
2126
+ }), x = Ne(), [I, w] = j(/* @__PURE__ */ new Set()), [S, F] = j(!1), [R, X] = j(null), A = B(() => i ? i.map((m) => Pe[m]).filter((m) => !!m) : Ht, [i]), $ = Pe[v.providerId];
2127
+ if (M === "hidden")
2111
2128
  return null;
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;
2129
+ const T = N || M === "disabled" || M === "readOnly", K = (m) => {
2130
+ X(null), w(/* @__PURE__ */ new Set()), y({ providerId: m, mode: v.mode, credentials: {}, enabledMethods: [] });
2131
+ }, V = (m, q) => {
2132
+ y({ ...v, credentials: { ...v.credentials, [m]: q } });
2133
+ }, re = (m) => {
2134
+ const q = new Set(v.enabledMethods ?? []);
2135
+ q.has(m) ? q.delete(m) : q.add(m), y({ ...v, enabledMethods: [...q] });
2136
+ }, G = (m) => {
2137
+ w((q) => {
2138
+ const L = new Set(q);
2139
+ return L.has(m) ? L.delete(m) : L.add(m), L;
2123
2140
  });
2124
- }, X = async () => {
2141
+ }, Q = async () => {
2125
2142
  if (o) {
2126
- q(!0), ee(null);
2143
+ F(!0), X(null);
2127
2144
  try {
2128
- ee(await o(g));
2129
- } catch (p) {
2130
- ee({ ok: !1, message: p instanceof Error ? p.message : String(p) });
2145
+ X(await o(v));
2146
+ } catch (m) {
2147
+ X({ ok: !1, message: m instanceof Error ? m.message : String(m) });
2131
2148
  } finally {
2132
- q(!1);
2149
+ F(!1);
2133
2150
  }
2134
2151
  }
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"
2152
+ }, W = $ != null && $.webhookPath ? `${(p ?? "").replace(/\/$/, "")}${$.webhookPath}` : "", ne = ($ == null ? void 0 : $.supportedCurrencies) === "*" ? n("paymentProviderConfig.allCurrencies", "All currencies") : (($ == null ? void 0 : $.supportedCurrencies) ?? []).join(", "), O = "nice-payment-provider-config" + (g ? ` ${g}` : ""), C = (($ == null ? void 0 : $.credentials) ?? []).filter(
2153
+ (m) => !m.testOnly || v.mode === "test"
2137
2154
  );
2138
- return /* @__PURE__ */ _("div", { ref: r, id: k, className: F, style: h, "data-testid": m, children: [
2155
+ return /* @__PURE__ */ f("div", { ref: r, id: _, className: O, style: b, "data-testid": D, children: [
2139
2156
  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: [
2157
+ /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__row", children: [
2158
+ /* @__PURE__ */ f("label", { className: "nice-payment-provider-config__field", children: [
2142
2159
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.provider", "Provider") }),
2143
- /* @__PURE__ */ _(
2160
+ /* @__PURE__ */ f(
2144
2161
  "select",
2145
2162
  {
2146
2163
  className: "nice-payment-provider-config__select",
2147
- value: g.providerId,
2164
+ value: v.providerId,
2148
2165
  disabled: T,
2149
- onChange: (p) => K(p.target.value),
2166
+ onChange: (m) => K(m.target.value),
2150
2167
  children: [
2151
2168
  /* @__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))
2169
+ A.map((m) => /* @__PURE__ */ c("option", { value: m.id, children: m.name }, m.id))
2153
2170
  ]
2154
2171
  }
2155
2172
  )
2156
2173
  ] }),
2157
- (P == null ? void 0 : P.hasTestMode) && /* @__PURE__ */ _(
2174
+ ($ == null ? void 0 : $.hasTestMode) && /* @__PURE__ */ f(
2158
2175
  "div",
2159
2176
  {
2160
2177
  className: "nice-payment-provider-config__mode",
@@ -2165,8 +2182,8 @@ const wr = /* @__PURE__ */ se(
2165
2182
  "button",
2166
2183
  {
2167
2184
  type: "button",
2168
- className: "nice-payment-provider-config__mode-btn" + (g.mode === "test" ? " nice-payment-provider-config__mode-btn--active" : ""),
2169
- onClick: () => v({ ...g, mode: "test" }),
2185
+ className: "nice-payment-provider-config__mode-btn" + (v.mode === "test" ? " nice-payment-provider-config__mode-btn--active" : ""),
2186
+ onClick: () => y({ ...v, mode: "test" }),
2170
2187
  disabled: T,
2171
2188
  children: n("paymentProviderConfig.test", "Test")
2172
2189
  }
@@ -2175,8 +2192,8 @@ const wr = /* @__PURE__ */ se(
2175
2192
  "button",
2176
2193
  {
2177
2194
  type: "button",
2178
- className: "nice-payment-provider-config__mode-btn" + (g.mode === "live" ? " nice-payment-provider-config__mode-btn--active" : ""),
2179
- onClick: () => v({ ...g, mode: "live" }),
2195
+ className: "nice-payment-provider-config__mode-btn" + (v.mode === "live" ? " nice-payment-provider-config__mode-btn--active" : ""),
2196
+ onClick: () => y({ ...v, mode: "live" }),
2180
2197
  disabled: T,
2181
2198
  children: n("paymentProviderConfig.live", "Live")
2182
2199
  }
@@ -2185,29 +2202,29 @@ const wr = /* @__PURE__ */ se(
2185
2202
  }
2186
2203
  )
2187
2204
  ] }),
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 }),
2205
+ $ && /* @__PURE__ */ f(dt, { children: [
2206
+ /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__meta", children: [
2207
+ /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__badge", children: $.type }),
2191
2208
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__currencies", children: ne })
2192
2209
  ] }),
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: " *" })
2210
+ /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__credentials", children: C.map((m) => {
2211
+ const q = `${x}-${m.key}`, L = m.secret, P = I.has(m.key);
2212
+ return /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__field", children: [
2213
+ /* @__PURE__ */ f("label", { className: "nice-payment-provider-config__field-label", htmlFor: q, children: [
2214
+ m.label,
2215
+ m.required && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__required", children: " *" })
2199
2216
  ] }),
2200
- /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__input-wrap", children: [
2217
+ /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__input-wrap", children: [
2201
2218
  /* @__PURE__ */ c(
2202
2219
  "input",
2203
2220
  {
2204
- id: O,
2205
- type: L && !D ? "password" : "text",
2221
+ id: q,
2222
+ type: L && !P ? "password" : "text",
2206
2223
  className: "nice-payment-provider-config__input",
2207
- value: g.credentials[p.key] ?? "",
2224
+ value: v.credentials[m.key] ?? "",
2208
2225
  readOnly: T,
2209
2226
  autoComplete: L ? "new-password" : "off",
2210
- onChange: (z) => Q(p.key, z.target.value)
2227
+ onChange: (z) => V(m.key, z.target.value)
2211
2228
  }
2212
2229
  ),
2213
2230
  L && /* @__PURE__ */ c(
@@ -2215,54 +2232,54 @@ const wr = /* @__PURE__ */ se(
2215
2232
  {
2216
2233
  type: "button",
2217
2234
  className: "nice-payment-provider-config__reveal",
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 })
2235
+ onClick: () => G(m.key),
2236
+ "aria-label": P ? n("paymentProviderConfig.hide", "Hide") : n("paymentProviderConfig.reveal", "Reveal"),
2237
+ "aria-pressed": P,
2238
+ children: /* @__PURE__ */ c(ve, { name: P ? "eye-off" : "eye", size: 14 })
2222
2239
  }
2223
2240
  )
2224
2241
  ] }),
2225
- p.help && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__help", children: p.help })
2226
- ] }, p.key);
2242
+ m.help && /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__help", children: m.help })
2243
+ ] }, m.key);
2227
2244
  }) }),
2228
- P.supportedMethods && P.supportedMethods.length > 0 && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__methods", children: [
2245
+ $.supportedMethods && $.supportedMethods.length > 0 && /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__methods", children: [
2229
2246
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.enabledMethods", "Enabled methods") }),
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: [
2247
+ /* @__PURE__ */ c("div", { className: "nice-payment-provider-config__method-list", children: $.supportedMethods.map((m) => /* @__PURE__ */ f("label", { className: "nice-payment-provider-config__method", children: [
2231
2248
  /* @__PURE__ */ c(
2232
2249
  "input",
2233
2250
  {
2234
2251
  type: "checkbox",
2235
- checked: (g.enabledMethods ?? []).includes(p),
2252
+ checked: (v.enabledMethods ?? []).includes(m),
2236
2253
  disabled: T,
2237
- onChange: () => re(p)
2254
+ onChange: () => re(m)
2238
2255
  }
2239
2256
  ),
2240
- p
2241
- ] }, p)) })
2257
+ m
2258
+ ] }, m)) })
2242
2259
  ] }),
2243
- l && P.webhookPath && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__field", children: [
2260
+ l && $.webhookPath && /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__field", children: [
2244
2261
  /* @__PURE__ */ c("span", { className: "nice-payment-provider-config__field-label", children: n("paymentProviderConfig.webhookUrl", "Webhook URL") }),
2245
- /* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children: V })
2262
+ /* @__PURE__ */ c("code", { className: "nice-payment-provider-config__webhook", children: W })
2246
2263
  ] }),
2247
- o && /* @__PURE__ */ _("div", { className: "nice-payment-provider-config__test", children: [
2264
+ o && /* @__PURE__ */ f("div", { className: "nice-payment-provider-config__test", children: [
2248
2265
  /* @__PURE__ */ c(
2249
2266
  "button",
2250
2267
  {
2251
2268
  type: "button",
2252
2269
  className: "nice-payment-provider-config__test-btn",
2253
- onClick: () => void X(),
2254
- disabled: T || I,
2255
- children: I ? n("paymentProviderConfig.testing", "Testing…") : f
2270
+ onClick: () => void Q(),
2271
+ disabled: T || S,
2272
+ children: S ? n("paymentProviderConfig.testing", "Testing…") : h
2256
2273
  }
2257
2274
  ),
2258
- $ && /* @__PURE__ */ _(
2275
+ R && /* @__PURE__ */ f(
2259
2276
  "span",
2260
2277
  {
2261
- className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + ($.ok ? "ok" : "error"),
2278
+ className: "nice-payment-provider-config__test-result nice-payment-provider-config__test-result--" + (R.ok ? "ok" : "error"),
2262
2279
  children: [
2263
- /* @__PURE__ */ c(ve, { name: $.ok ? "check" : "close", size: 14 }),
2280
+ /* @__PURE__ */ c(ve, { name: R.ok ? "check" : "close", size: 14 }),
2264
2281
  " ",
2265
- $.message ?? ($.ok ? n("paymentProviderConfig.ok", "OK") : n("paymentProviderConfig.failed", "Failed"))
2282
+ R.message ?? (R.ok ? n("paymentProviderConfig.ok", "OK") : n("paymentProviderConfig.failed", "Failed"))
2266
2283
  ]
2267
2284
  }
2268
2285
  )