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