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