@blocklet/payment-react 1.18.56 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/checkout/donate.d.ts +1 -15
- package/es/checkout/donate.js +301 -189
- package/es/checkout/form.d.ts +1 -15
- package/es/checkout/form.js +5 -13
- package/es/checkout/table.js +3 -3
- package/es/components/blockchain/gas.d.ts +1 -5
- package/es/components/blockchain/gas.js +10 -2
- package/es/components/blockchain/tx.d.ts +1 -8
- package/es/components/blockchain/tx.js +28 -7
- package/es/components/confirm.d.ts +1 -10
- package/es/components/confirm.js +4 -10
- package/es/components/country-select.d.ts +3 -2
- package/es/components/country-select.js +375 -352
- package/es/components/input.d.ts +11 -20
- package/es/components/input.js +46 -43
- package/es/components/lazy-loader.js +1 -2
- package/es/components/link.d.ts +2 -9
- package/es/components/link.js +9 -6
- package/es/components/livemode.d.ts +2 -8
- package/es/components/livemode.js +1 -5
- package/es/components/loading-button.d.ts +6 -1
- package/es/components/loading-button.js +56 -66
- package/es/components/over-due-invoice-payment.d.ts +0 -18
- package/es/components/over-due-invoice-payment.js +138 -95
- package/es/components/payment-beneficiaries.d.ts +2 -7
- package/es/components/payment-beneficiaries.js +86 -40
- package/es/components/pricing-item.d.ts +0 -5
- package/es/components/pricing-item.js +1 -4
- package/es/components/pricing-table.d.ts +2 -10
- package/es/components/pricing-table.js +8 -7
- package/es/components/resume-subscription.d.ts +0 -10
- package/es/components/resume-subscription.js +42 -21
- package/es/components/truncated-text.d.ts +2 -9
- package/es/components/truncated-text.js +0 -5
- package/es/contexts/donate.d.ts +0 -7
- package/es/contexts/donate.js +10 -8
- package/es/contexts/payment.d.ts +1 -4
- package/es/contexts/payment.js +7 -2
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +151 -73
- package/es/history/payment/list.js +115 -38
- package/es/hooks/keyboard.d.ts +1 -1
- package/es/hooks/keyboard.js +2 -4
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.js +2 -4
- package/es/libs/validator.js +2 -4
- package/es/payment/amount.d.ts +2 -7
- package/es/payment/amount.js +1 -5
- package/es/payment/donation-form.d.ts +2 -10
- package/es/payment/donation-form.js +196 -160
- package/es/payment/error.d.ts +2 -8
- package/es/payment/error.js +40 -20
- package/es/payment/footer.d.ts +2 -3
- package/es/payment/footer.js +19 -6
- package/es/payment/form/addon.js +14 -4
- package/es/payment/form/address.d.ts +2 -9
- package/es/payment/form/address.js +3 -6
- package/es/payment/form/currency.js +45 -25
- package/es/payment/form/index.d.ts +2 -8
- package/es/payment/form/index.js +107 -65
- package/es/payment/form/phone.js +2 -4
- package/es/payment/form/stripe/form.d.ts +2 -8
- package/es/payment/form/stripe/form.js +1 -3
- package/es/payment/header.js +38 -16
- package/es/payment/index.d.ts +2 -9
- package/es/payment/index.js +5 -14
- package/es/payment/product-card.d.ts +2 -11
- package/es/payment/product-card.js +84 -50
- package/es/payment/product-donation.js +175 -114
- package/es/payment/product-item.d.ts +2 -9
- package/es/payment/product-item.js +185 -142
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +27 -7
- package/es/payment/skeleton/overview.js +22 -2
- package/es/payment/skeleton/payment.js +33 -5
- package/es/payment/success.d.ts +2 -9
- package/es/payment/success.js +41 -14
- package/es/payment/summary.d.ts +2 -17
- package/es/payment/summary.js +184 -111
- package/es/theme/index.d.ts +0 -5
- package/es/theme/index.js +2 -5
- package/es/theme/typography.d.ts +2 -2
- package/lib/checkout/donate.d.ts +1 -15
- package/lib/checkout/donate.js +75 -54
- package/lib/checkout/form.d.ts +1 -15
- package/lib/checkout/form.js +7 -15
- package/lib/checkout/table.js +4 -4
- package/lib/components/blockchain/gas.d.ts +1 -5
- package/lib/components/blockchain/gas.js +3 -2
- package/lib/components/blockchain/tx.d.ts +1 -8
- package/lib/components/blockchain/tx.js +11 -7
- package/lib/components/confirm.d.ts +1 -10
- package/lib/components/confirm.js +5 -11
- package/lib/components/country-select.d.ts +3 -2
- package/lib/components/country-select.js +23 -22
- package/lib/components/input.d.ts +11 -20
- package/lib/components/input.js +20 -23
- package/lib/components/lazy-loader.js +1 -1
- package/lib/components/link.d.ts +2 -9
- package/lib/components/link.js +3 -8
- package/lib/components/livemode.d.ts +2 -8
- package/lib/components/livemode.js +3 -7
- package/lib/components/loading-button.d.ts +6 -1
- package/lib/components/loading-button.js +9 -17
- package/lib/components/over-due-invoice-payment.d.ts +0 -18
- package/lib/components/over-due-invoice-payment.js +31 -33
- package/lib/components/payment-beneficiaries.d.ts +2 -7
- package/lib/components/payment-beneficiaries.js +12 -11
- package/lib/components/pricing-item.d.ts +0 -5
- package/lib/components/pricing-item.js +2 -5
- package/lib/components/pricing-table.d.ts +2 -10
- package/lib/components/pricing-table.js +5 -11
- package/lib/components/resume-subscription.d.ts +0 -10
- package/lib/components/resume-subscription.js +16 -16
- package/lib/components/table.js +1 -1
- package/lib/components/truncated-text.d.ts +2 -9
- package/lib/components/truncated-text.js +1 -6
- package/lib/contexts/donate.d.ts +0 -7
- package/lib/contexts/donate.js +4 -7
- package/lib/contexts/payment.d.ts +1 -4
- package/lib/contexts/payment.js +4 -7
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +49 -37
- package/lib/history/payment/list.js +30 -16
- package/lib/hooks/keyboard.d.ts +1 -1
- package/lib/hooks/mobile.js +1 -1
- package/lib/hooks/subscription.js +1 -1
- package/lib/index.js +2 -2
- package/lib/libs/api.js +1 -1
- package/lib/libs/dayjs.js +1 -1
- package/lib/libs/phone-validator.js +0 -2
- package/lib/libs/theme.js +1 -1
- package/lib/libs/util.js +1 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +1 -1
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +1 -1
- package/lib/payment/amount.d.ts +2 -7
- package/lib/payment/amount.js +2 -6
- package/lib/payment/donation-form.d.ts +2 -10
- package/lib/payment/donation-form.js +33 -38
- package/lib/payment/error.d.ts +2 -8
- package/lib/payment/error.js +11 -13
- package/lib/payment/footer.d.ts +2 -3
- package/lib/payment/footer.js +5 -5
- package/lib/payment/form/addon.js +5 -3
- package/lib/payment/form/address.d.ts +2 -9
- package/lib/payment/form/address.js +5 -8
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +2 -8
- package/lib/payment/form/index.js +19 -15
- package/lib/payment/form/phone.js +1 -1
- package/lib/payment/form/stripe/form.d.ts +2 -8
- package/lib/payment/form/stripe/form.js +3 -6
- package/lib/payment/header.js +8 -4
- package/lib/payment/index.d.ts +2 -9
- package/lib/payment/index.js +7 -16
- package/lib/payment/product-card.d.ts +2 -11
- package/lib/payment/product-card.js +13 -20
- package/lib/payment/product-donation.js +71 -66
- package/lib/payment/product-item.d.ts +2 -9
- package/lib/payment/product-item.js +24 -25
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +8 -4
- package/lib/payment/skeleton/overview.js +6 -2
- package/lib/payment/skeleton/payment.js +9 -3
- package/lib/payment/success.d.ts +2 -9
- package/lib/payment/success.js +12 -15
- package/lib/payment/summary.d.ts +2 -17
- package/lib/payment/summary.js +44 -45
- package/lib/theme/index.d.ts +0 -5
- package/lib/theme/index.js +2 -5
- package/lib/theme/typography.d.ts +2 -2
- package/package.json +40 -40
- package/src/checkout/donate.tsx +103 -35
- package/src/checkout/form.tsx +5 -14
- package/src/checkout/table.tsx +3 -3
- package/src/components/blockchain/gas.tsx +5 -3
- package/src/components/blockchain/tx.tsx +22 -8
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/input.tsx +49 -45
- package/src/components/link.tsx +9 -7
- package/src/components/livemode.tsx +2 -6
- package/src/components/loading-button.tsx +63 -76
- package/src/components/over-due-invoice-payment.tsx +43 -28
- package/src/components/payment-beneficiaries.tsx +33 -14
- package/src/components/pricing-item.tsx +1 -4
- package/src/components/pricing-table.tsx +8 -8
- package/src/components/resume-subscription.tsx +20 -14
- package/src/components/table.tsx +2 -2
- package/src/components/truncated-text.tsx +0 -6
- package/src/contexts/donate.tsx +6 -7
- package/src/contexts/payment.tsx +7 -3
- package/src/history/invoice/list.tsx +74 -35
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/payment/amount.tsx +1 -6
- package/src/payment/donation-form.tsx +47 -29
- package/src/payment/error.tsx +16 -8
- package/src/payment/footer.tsx +11 -3
- package/src/payment/form/addon.tsx +6 -1
- package/src/payment/form/address.tsx +3 -7
- package/src/payment/form/currency.tsx +12 -2
- package/src/payment/form/index.tsx +30 -12
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +10 -21
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +46 -24
- package/src/payment/product-skeleton.tsx +3 -2
- package/src/payment/skeleton/donation.tsx +12 -2
- package/src/payment/skeleton/overview.tsx +12 -2
- package/src/payment/skeleton/payment.tsx +16 -3
- package/src/payment/success.tsx +26 -15
- package/src/payment/summary.tsx +74 -42
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -367,9 +367,27 @@ const InvoiceList = React.memo((props) => {
|
|
|
367
367
|
}
|
|
368
368
|
if (data && data.list.length === 0) {
|
|
369
369
|
if (data.subscription && ["active", "trialing"].includes(data.subscription.status)) {
|
|
370
|
-
return /* @__PURE__ */ jsx(
|
|
370
|
+
return /* @__PURE__ */ jsx(
|
|
371
|
+
Typography,
|
|
372
|
+
{
|
|
373
|
+
sx: {
|
|
374
|
+
color: "text.secondary",
|
|
375
|
+
my: 0.5
|
|
376
|
+
},
|
|
377
|
+
children: t("payment.customer.invoice.next", { date: formatToDatetime(data.subscription.current_period_end * 1e3) })
|
|
378
|
+
}
|
|
379
|
+
);
|
|
371
380
|
}
|
|
372
|
-
return /* @__PURE__ */ jsx(
|
|
381
|
+
return /* @__PURE__ */ jsx(
|
|
382
|
+
Typography,
|
|
383
|
+
{
|
|
384
|
+
sx: {
|
|
385
|
+
color: "text.secondary",
|
|
386
|
+
my: 0.5
|
|
387
|
+
},
|
|
388
|
+
children: t("payment.customer.invoice.empty")
|
|
389
|
+
}
|
|
390
|
+
);
|
|
373
391
|
}
|
|
374
392
|
const hasMore = data && data.list.length < data.count;
|
|
375
393
|
const grouped = groupByDate(data.list);
|
|
@@ -386,75 +404,124 @@ const InvoiceList = React.memo((props) => {
|
|
|
386
404
|
Stack,
|
|
387
405
|
{
|
|
388
406
|
direction: "row",
|
|
389
|
-
sx: {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
407
|
+
sx: {
|
|
408
|
+
gap: {
|
|
409
|
+
xs: 0.5,
|
|
410
|
+
sm: 1.5,
|
|
411
|
+
md: 3
|
|
412
|
+
},
|
|
413
|
+
alignItems: "center",
|
|
414
|
+
flexWrap: "nowrap",
|
|
415
|
+
my: 1
|
|
394
416
|
},
|
|
395
|
-
alignItems: "center",
|
|
396
|
-
flexWrap: "nowrap",
|
|
397
417
|
children: [
|
|
398
|
-
/* @__PURE__ */ jsx(
|
|
399
|
-
|
|
418
|
+
/* @__PURE__ */ jsx(
|
|
419
|
+
Box,
|
|
400
420
|
{
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
421
|
+
sx: {
|
|
422
|
+
flex: 2
|
|
423
|
+
},
|
|
424
|
+
children: /* @__PURE__ */ jsx(
|
|
425
|
+
"a",
|
|
426
|
+
{
|
|
427
|
+
href: link.url,
|
|
428
|
+
target: link.external ? "_blank" : target,
|
|
429
|
+
rel: "noreferrer",
|
|
430
|
+
onClick: (e) => handleLinkClick(e, link),
|
|
431
|
+
children: /* @__PURE__ */ jsxs(
|
|
432
|
+
Stack,
|
|
433
|
+
{
|
|
434
|
+
direction: "row",
|
|
435
|
+
spacing: 0.5,
|
|
436
|
+
sx: {
|
|
437
|
+
alignItems: "center"
|
|
438
|
+
},
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", children: invoice.number }),
|
|
441
|
+
link.external && /* @__PURE__ */ jsx(
|
|
442
|
+
OpenInNewOutlined,
|
|
443
|
+
{
|
|
444
|
+
fontSize: "small",
|
|
445
|
+
sx: {
|
|
446
|
+
color: "text.secondary",
|
|
447
|
+
display: { xs: "none", md: "inline-flex" }
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
]
|
|
414
452
|
}
|
|
415
|
-
|
|
416
|
-
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
),
|
|
458
|
+
/* @__PURE__ */ jsx(
|
|
459
|
+
Box,
|
|
460
|
+
{
|
|
461
|
+
sx: {
|
|
462
|
+
flex: 1,
|
|
463
|
+
textAlign: "right"
|
|
464
|
+
},
|
|
465
|
+
children: /* @__PURE__ */ jsxs(Typography, { sx: isVoid ? { textDecoration: "line-through" } : {}, children: [
|
|
466
|
+
formatBNStr(invoice.total, invoice.paymentCurrency.decimal),
|
|
467
|
+
"\xA0",
|
|
468
|
+
invoice.paymentCurrency.symbol
|
|
417
469
|
] })
|
|
418
470
|
}
|
|
419
|
-
)
|
|
420
|
-
/* @__PURE__ */ jsx(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsx(
|
|
473
|
+
Box,
|
|
474
|
+
{
|
|
475
|
+
sx: {
|
|
476
|
+
flex: 1,
|
|
477
|
+
textAlign: "right"
|
|
478
|
+
},
|
|
479
|
+
children: /* @__PURE__ */ jsx(Typography, { children: formatToDate(invoice.created_at, locale, "HH:mm:ss") })
|
|
480
|
+
}
|
|
481
|
+
),
|
|
426
482
|
!action && /* @__PURE__ */ jsx(
|
|
427
483
|
Box,
|
|
428
484
|
{
|
|
429
|
-
flex: 2,
|
|
430
485
|
className: "invoice-description",
|
|
431
|
-
|
|
432
|
-
|
|
486
|
+
sx: {
|
|
487
|
+
flex: 2,
|
|
488
|
+
textAlign: "right",
|
|
489
|
+
display: { xs: "none", lg: "inline-flex" }
|
|
490
|
+
},
|
|
433
491
|
children: /* @__PURE__ */ jsx(Typography, { children: invoice.description || invoice.id })
|
|
434
492
|
}
|
|
435
493
|
),
|
|
436
|
-
/* @__PURE__ */ jsx(
|
|
437
|
-
|
|
438
|
-
{
|
|
439
|
-
variant: "contained",
|
|
440
|
-
color: "primary",
|
|
441
|
-
size: "small",
|
|
442
|
-
onClick: () => onPay(invoice.id),
|
|
443
|
-
sx: { whiteSpace: "nowrap" },
|
|
444
|
-
children: t("payment.customer.invoice.pay")
|
|
445
|
-
}
|
|
446
|
-
) : /* @__PURE__ */ jsx(
|
|
447
|
-
Button,
|
|
494
|
+
/* @__PURE__ */ jsx(
|
|
495
|
+
Box,
|
|
448
496
|
{
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
497
|
+
sx: {
|
|
498
|
+
flex: 1,
|
|
499
|
+
textAlign: "right"
|
|
500
|
+
},
|
|
501
|
+
children: action ? connect ? /* @__PURE__ */ jsx(
|
|
502
|
+
Button,
|
|
503
|
+
{
|
|
504
|
+
variant: "contained",
|
|
505
|
+
color: "primary",
|
|
506
|
+
size: "small",
|
|
507
|
+
onClick: () => onPay(invoice.id),
|
|
508
|
+
sx: { whiteSpace: "nowrap" },
|
|
509
|
+
children: t("payment.customer.invoice.pay")
|
|
510
|
+
}
|
|
511
|
+
) : /* @__PURE__ */ jsx(
|
|
512
|
+
Button,
|
|
513
|
+
{
|
|
514
|
+
component: "a",
|
|
515
|
+
variant: "contained",
|
|
516
|
+
size: "small",
|
|
517
|
+
onClick: (e) => handleLinkClick(e, link),
|
|
518
|
+
sx: { whiteSpace: "nowrap" },
|
|
519
|
+
rel: "noreferrer",
|
|
520
|
+
children: t("payment.customer.invoice.pay")
|
|
521
|
+
}
|
|
522
|
+
) : isVoid ? /* @__PURE__ */ jsx(Tooltip, { title: t("payment.customer.invoice.noPaymentRequired"), arrow: true, placement: "top", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Status, { label: invoice.status, color: getInvoiceStatusColor(invoice.status) }) }) }) : /* @__PURE__ */ jsx(Status, { label: invoice.status, color: getInvoiceStatusColor(invoice.status) })
|
|
456
523
|
}
|
|
457
|
-
)
|
|
524
|
+
)
|
|
458
525
|
]
|
|
459
526
|
},
|
|
460
527
|
invoice.id
|
|
@@ -463,11 +530,37 @@ const InvoiceList = React.memo((props) => {
|
|
|
463
530
|
] }, date)),
|
|
464
531
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
465
532
|
hasMore && /* @__PURE__ */ jsx(Button, { variant: "text", type: "button", color: "inherit", onClick: loadMore, disabled: loadingMore, children: loadingMore ? t("common.loadingMore", { resource: t("payment.customer.invoices") }) : t("common.loadMore", { resource: t("payment.customer.invoices") }) }),
|
|
466
|
-
!hasMore && data.count > size && /* @__PURE__ */ jsx(
|
|
533
|
+
!hasMore && data.count > size && /* @__PURE__ */ jsx(
|
|
534
|
+
Typography,
|
|
535
|
+
{
|
|
536
|
+
sx: {
|
|
537
|
+
color: "text.secondary"
|
|
538
|
+
},
|
|
539
|
+
children: t("common.noMore", { resource: t("payment.customer.invoices") })
|
|
540
|
+
}
|
|
541
|
+
)
|
|
467
542
|
] })
|
|
468
543
|
] });
|
|
469
544
|
});
|
|
470
|
-
export default function CustomerInvoiceList(
|
|
545
|
+
export default function CustomerInvoiceList(rawProps) {
|
|
546
|
+
const props = Object.assign(
|
|
547
|
+
{
|
|
548
|
+
customer_id: "",
|
|
549
|
+
subscription_id: "",
|
|
550
|
+
currency_id: "",
|
|
551
|
+
include_staking: false,
|
|
552
|
+
include_recovered_from: false,
|
|
553
|
+
status: "open,paid,uncollectible",
|
|
554
|
+
pageSize: 10,
|
|
555
|
+
target: "_self",
|
|
556
|
+
action: "",
|
|
557
|
+
type: "list",
|
|
558
|
+
onTableDataChange: () => {
|
|
559
|
+
},
|
|
560
|
+
relatedSubscription: false
|
|
561
|
+
},
|
|
562
|
+
rawProps
|
|
563
|
+
);
|
|
471
564
|
const { action, type } = props;
|
|
472
565
|
const { t, locale } = useLocaleContext();
|
|
473
566
|
const { connect } = usePaymentContext();
|
|
@@ -509,21 +602,6 @@ export default function CustomerInvoiceList(props) {
|
|
|
509
602
|
}
|
|
510
603
|
return /* @__PURE__ */ jsx(InvoiceList, { ...props, onPay });
|
|
511
604
|
}
|
|
512
|
-
CustomerInvoiceList.defaultProps = {
|
|
513
|
-
customer_id: "",
|
|
514
|
-
subscription_id: "",
|
|
515
|
-
currency_id: "",
|
|
516
|
-
include_staking: false,
|
|
517
|
-
include_recovered_from: false,
|
|
518
|
-
status: "open,paid,uncollectible",
|
|
519
|
-
pageSize: 10,
|
|
520
|
-
target: "_self",
|
|
521
|
-
action: "",
|
|
522
|
-
type: "list",
|
|
523
|
-
onTableDataChange: () => {
|
|
524
|
-
},
|
|
525
|
-
relatedSubscription: false
|
|
526
|
-
};
|
|
527
605
|
const Root = styled(Stack)`
|
|
528
606
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
|
529
607
|
svg.MuiSvgIcon-root {
|
|
@@ -40,45 +40,122 @@ export default function CustomerPaymentList({ customer_id }) {
|
|
|
40
40
|
return /* @__PURE__ */ jsx(CircularProgress, {});
|
|
41
41
|
}
|
|
42
42
|
if (data && data.list.length === 0) {
|
|
43
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
Typography,
|
|
45
|
+
{
|
|
46
|
+
sx: {
|
|
47
|
+
color: "text.secondary"
|
|
48
|
+
},
|
|
49
|
+
children: t("payment.customer.payment.empty")
|
|
50
|
+
}
|
|
51
|
+
);
|
|
44
52
|
}
|
|
45
53
|
const hasMore = data && data.list.length < data.count;
|
|
46
54
|
const grouped = groupByDate(data.list);
|
|
47
|
-
return /* @__PURE__ */ jsxs(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
sx: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
55
|
+
return /* @__PURE__ */ jsxs(
|
|
56
|
+
Stack,
|
|
57
|
+
{
|
|
58
|
+
direction: "column",
|
|
59
|
+
sx: {
|
|
60
|
+
gap: 1,
|
|
61
|
+
mt: 1
|
|
62
|
+
},
|
|
63
|
+
children: [
|
|
64
|
+
Object.entries(grouped).map(([date, payments]) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
65
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: "bold", color: "text.secondary", mt: 2, mb: 1 }, children: date }),
|
|
66
|
+
payments.map((item) => /* @__PURE__ */ jsxs(
|
|
67
|
+
Stack,
|
|
68
|
+
{
|
|
69
|
+
direction: {
|
|
70
|
+
xs: "column",
|
|
71
|
+
sm: "row"
|
|
72
|
+
},
|
|
73
|
+
sx: {
|
|
74
|
+
gap: {
|
|
75
|
+
xs: 0.5,
|
|
76
|
+
sm: 1.5,
|
|
77
|
+
md: 3
|
|
78
|
+
},
|
|
79
|
+
flexWrap: "nowrap",
|
|
80
|
+
my: 1
|
|
81
|
+
},
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Box,
|
|
85
|
+
{
|
|
86
|
+
sx: {
|
|
87
|
+
flex: 3
|
|
88
|
+
},
|
|
89
|
+
children: /* @__PURE__ */ jsx(Typography, { children: formatToDate(item.created_at) })
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
Box,
|
|
94
|
+
{
|
|
95
|
+
sx: {
|
|
96
|
+
flex: 2
|
|
97
|
+
},
|
|
98
|
+
children: /* @__PURE__ */ jsxs(
|
|
99
|
+
Typography,
|
|
100
|
+
{
|
|
101
|
+
sx: {
|
|
102
|
+
textAlign: "right"
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
formatBNStr(item.amount_received, item.paymentCurrency.decimal),
|
|
106
|
+
"\xA0",
|
|
107
|
+
item.paymentCurrency.symbol
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
Box,
|
|
115
|
+
{
|
|
116
|
+
sx: {
|
|
117
|
+
flex: 3
|
|
118
|
+
},
|
|
119
|
+
children: /* @__PURE__ */ jsx(Status, { label: item.status, color: getPaymentIntentStatusColor(item.status) })
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
Box,
|
|
124
|
+
{
|
|
125
|
+
sx: {
|
|
126
|
+
flex: 3
|
|
127
|
+
},
|
|
128
|
+
children: /* @__PURE__ */ jsx(Typography, { children: item.description || "-" })
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
Box,
|
|
133
|
+
{
|
|
134
|
+
sx: {
|
|
135
|
+
flex: 3,
|
|
136
|
+
minWidth: "220px"
|
|
137
|
+
},
|
|
138
|
+
children: (item.payment_details?.arcblock?.tx_hash || item.payment_details?.ethereum?.tx_hash || item.payment_details?.base?.tx_hash) && /* @__PURE__ */ jsx(TxLink, { details: item.payment_details, method: item.paymentMethod, mode: "customer" })
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
item.id
|
|
144
|
+
))
|
|
145
|
+
] }, date)),
|
|
146
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
147
|
+
hasMore && /* @__PURE__ */ jsx(Button, { variant: "text", type: "button", color: "inherit", onClick: loadMore, disabled: loadingMore, children: loadingMore ? t("common.loadingMore", { resource: t("payment.customer.payments") }) : t("common.loadMore", { resource: t("payment.customer.payments") }) }),
|
|
148
|
+
!hasMore && data.count > pageSize && /* @__PURE__ */ jsx(
|
|
149
|
+
Typography,
|
|
150
|
+
{
|
|
151
|
+
sx: {
|
|
152
|
+
color: "text.secondary"
|
|
153
|
+
},
|
|
154
|
+
children: t("common.noMore", { resource: t("payment.customer.payments") })
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
84
161
|
}
|
package/es/hooks/keyboard.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type TabNavigationOptions<T> = {
|
|
|
13
13
|
/** a selector to find navigable elements */
|
|
14
14
|
selector?: string;
|
|
15
15
|
/** an element container reference, limiting the query DOM range to improve performance */
|
|
16
|
-
containerRef?: RefObject<HTMLElement>;
|
|
16
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
17
17
|
/** the type of the current value, can be 'index' or 'value' */
|
|
18
18
|
valueType?: 'index' | 'value';
|
|
19
19
|
};
|
package/es/hooks/keyboard.js
CHANGED
|
@@ -19,8 +19,7 @@ export const useTabNavigation = (items, onSelect, options) => {
|
|
|
19
19
|
}, [containerRef, selector]);
|
|
20
20
|
const determineCurrentIndex = useCallback(() => {
|
|
21
21
|
const allOptions = includeCustom ? [...items, "custom"] : items;
|
|
22
|
-
if (allOptions.length === 0)
|
|
23
|
-
return -1;
|
|
22
|
+
if (allOptions.length === 0) return -1;
|
|
24
23
|
if (!hasTabbed.current) {
|
|
25
24
|
if (isCustomSelected && includeCustom) {
|
|
26
25
|
return items.length;
|
|
@@ -60,8 +59,7 @@ export const useTabNavigation = (items, onSelect, options) => {
|
|
|
60
59
|
);
|
|
61
60
|
const handleKeyDown = useCallback(
|
|
62
61
|
(e) => {
|
|
63
|
-
if (!enabled || e.key !== "Tab")
|
|
64
|
-
return;
|
|
62
|
+
if (!enabled || e.key !== "Tab") return;
|
|
65
63
|
e.preventDefault();
|
|
66
64
|
e.stopPropagation();
|
|
67
65
|
const currentIndex = determineCurrentIndex();
|
|
@@ -27,8 +27,7 @@ export class CachedRequest {
|
|
|
27
27
|
getCachedData() {
|
|
28
28
|
const cache = this.getCache();
|
|
29
29
|
const data = this.options.strategy === "memory" ? cache.get(this.cacheKey) : cache.getItem(this.cacheKey);
|
|
30
|
-
if (!data)
|
|
31
|
-
return null;
|
|
30
|
+
if (!data) return null;
|
|
32
31
|
const parsed = JSON.parse(data);
|
|
33
32
|
if (this.options.ttl && parsed.timestamp) {
|
|
34
33
|
const isExpired = Date.now() - parsed.timestamp > this.options.ttl;
|
|
@@ -61,8 +60,7 @@ export class CachedRequest {
|
|
|
61
60
|
}
|
|
62
61
|
fetch(forceRefresh = false) {
|
|
63
62
|
const cachedData = !forceRefresh && this.getCachedData();
|
|
64
|
-
if (cachedData)
|
|
65
|
-
return Promise.resolve(cachedData);
|
|
63
|
+
if (cachedData) return Promise.resolve(cachedData);
|
|
66
64
|
const globalItem = globalCache.get(this.cacheKey);
|
|
67
65
|
if (globalItem?.promise) {
|
|
68
66
|
return globalItem.promise;
|
package/es/libs/util.js
CHANGED
|
@@ -971,14 +971,12 @@ export function getUserProfileLink(userDid, locale = "en") {
|
|
|
971
971
|
);
|
|
972
972
|
}
|
|
973
973
|
export function parseMarkedText(text) {
|
|
974
|
-
if (!text)
|
|
975
|
-
return [];
|
|
974
|
+
if (!text) return [];
|
|
976
975
|
const parts = text.split(/(#([^#]*)#)/);
|
|
977
976
|
const result = [];
|
|
978
977
|
for (let i = 0; i < parts.length; i++) {
|
|
979
978
|
const part = parts[i];
|
|
980
|
-
if (!part)
|
|
981
|
-
continue;
|
|
979
|
+
if (!part) continue;
|
|
982
980
|
if (i % 3 === 0) {
|
|
983
981
|
result.push({ type: "text", content: part });
|
|
984
982
|
} else if (i % 3 === 1 && part.startsWith("#") && part.endsWith("#")) {
|
package/es/libs/validator.js
CHANGED
|
@@ -58,8 +58,7 @@ const POSTAL_CODE_SUPPORTED_COUNTRIES = [
|
|
|
58
58
|
"ZM"
|
|
59
59
|
];
|
|
60
60
|
export function validatePostalCode(postalCode, country) {
|
|
61
|
-
if (!postalCode)
|
|
62
|
-
return true;
|
|
61
|
+
if (!postalCode) return true;
|
|
63
62
|
const countryUpper = country?.toUpperCase();
|
|
64
63
|
const isSupported = country && POSTAL_CODE_SUPPORTED_COUNTRIES.includes(countryUpper);
|
|
65
64
|
try {
|
|
@@ -70,8 +69,7 @@ export function validatePostalCode(postalCode, country) {
|
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
export function getFieldValidation(fieldName, validations, locale = "en") {
|
|
73
|
-
if (!validations || !validations[fieldName])
|
|
74
|
-
return {};
|
|
72
|
+
if (!validations || !validations[fieldName]) return {};
|
|
75
73
|
const fieldValidation = validations[fieldName];
|
|
76
74
|
const rules = {};
|
|
77
75
|
if (fieldValidation.pattern) {
|
package/es/payment/amount.d.ts
CHANGED
|
@@ -2,10 +2,5 @@ import type { TypographyProps } from '@mui/material';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
amount: string;
|
|
4
4
|
} & TypographyProps;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var defaultProps: {
|
|
8
|
-
sx: {};
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export default PaymentAmount;
|
|
5
|
+
export default function PaymentAmount({ amount, sx }: Props): import("react").JSX.Element;
|
|
6
|
+
export {};
|
package/es/payment/amount.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from "@mui/material";
|
|
3
|
-
export default function PaymentAmount({ amount, sx }) {
|
|
3
|
+
export default function PaymentAmount({ amount, sx = {} }) {
|
|
4
4
|
return /* @__PURE__ */ jsx(
|
|
5
5
|
Typography,
|
|
6
6
|
{
|
|
@@ -17,7 +17,3 @@ export default function PaymentAmount({ amount, sx }) {
|
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
-
PaymentAmount.defaultProps = {
|
|
21
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
22
|
-
sx: {}
|
|
23
|
-
};
|
|
@@ -8,17 +8,9 @@ type Props = CheckoutContext & CheckoutCallbacks & {
|
|
|
8
8
|
formRender?: Record<string, any>;
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
declare namespace DonationForm {
|
|
13
|
-
var defaultProps: {
|
|
14
|
-
completed: boolean;
|
|
15
|
-
error: null;
|
|
16
|
-
showCheckoutSummary: boolean;
|
|
17
|
-
formRender: {};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export default DonationForm;
|
|
11
|
+
export default function DonationForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, formRender, id, }: Props): import("react").JSX.Element;
|
|
21
12
|
type RootProps = {
|
|
22
13
|
mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
23
14
|
} & BoxProps;
|
|
24
15
|
export declare const Root: React.FC<RootProps>;
|
|
16
|
+
export {};
|