@blocklet/payment-react 1.18.56 → 1.19.1
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 +29 -10
- 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/date-range-picker.d.ts +13 -0
- package/es/components/date-range-picker.js +279 -0
- package/es/components/input.d.ts +14 -20
- package/es/components/input.js +51 -44
- package/es/components/label.d.ts +7 -0
- package/es/components/label.js +49 -0
- 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/credit/grants-list.d.ts +14 -0
- package/es/history/credit/grants-list.js +215 -0
- package/es/history/credit/transactions-list.d.ts +13 -0
- package/es/history/credit/transactions-list.js +255 -0
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +172 -74
- 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/index.d.ts +5 -1
- package/es/index.js +10 -1
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.d.ts +2 -0
- package/es/libs/util.js +14 -4
- package/es/libs/validator.js +2 -4
- package/es/locales/en.js +20 -2
- package/es/locales/zh.js +20 -2
- 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 +151 -71
- 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 +23 -17
- 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 +9 -9
- package/es/payment/product-item.js +320 -145
- 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 +4 -17
- package/es/payment/summary.js +193 -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 +15 -10
- 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/date-range-picker.d.ts +13 -0
- package/lib/components/date-range-picker.js +329 -0
- package/lib/components/input.d.ts +14 -20
- package/lib/components/input.js +28 -27
- package/lib/components/label.d.ts +7 -0
- package/lib/components/label.js +60 -0
- 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/credit/grants-list.d.ts +14 -0
- package/lib/history/credit/grants-list.js +277 -0
- package/lib/history/credit/transactions-list.d.ts +13 -0
- package/lib/history/credit/transactions-list.js +301 -0
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +73 -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.d.ts +5 -1
- package/lib/index.js +41 -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.d.ts +2 -0
- package/lib/libs/util.js +15 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +21 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +21 -3
- 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 +64 -21
- 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 +27 -18
- 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 +9 -9
- package/lib/payment/product-item.js +168 -29
- 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 +4 -17
- package/lib/payment/summary.js +53 -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 +19 -11
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/date-range-picker.tsx +310 -0
- package/src/components/input.tsx +61 -46
- package/src/components/label.tsx +58 -0
- 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/credit/grants-list.tsx +276 -0
- package/src/history/credit/transactions-list.tsx +317 -0
- package/src/history/invoice/list.tsx +92 -36
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/index.ts +9 -0
- package/src/libs/util.ts +14 -0
- package/src/locales/en.tsx +20 -0
- package/src/locales/zh.tsx +19 -0
- 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 +121 -45
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +27 -22
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +198 -28
- 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 +87 -44
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -22,8 +22,8 @@ var _util = require("../../libs/util");
|
|
|
22
22
|
var _table = _interopRequireDefault(require("../../components/table"));
|
|
23
23
|
var _navigation = require("../../libs/navigation");
|
|
24
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
26
|
-
function _interopRequireDefault(
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
27
|
const groupByDate = items => {
|
|
28
28
|
const grouped = {};
|
|
29
29
|
items.forEach(item => {
|
|
@@ -168,6 +168,30 @@ const InvoiceTable = _react.default.memo(props => {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
+
}, {
|
|
172
|
+
label: t("common.paymentMethod"),
|
|
173
|
+
name: "paymentMethod",
|
|
174
|
+
options: {
|
|
175
|
+
customBodyRenderLite: (_, index) => {
|
|
176
|
+
const invoice = data?.list[index];
|
|
177
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
178
|
+
sx: {
|
|
179
|
+
display: "flex",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
whiteSpace: "nowrap"
|
|
182
|
+
},
|
|
183
|
+
onClick: e => handleLinkClick(e, invoice),
|
|
184
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
185
|
+
src: invoice.paymentMethod.logo,
|
|
186
|
+
sx: {
|
|
187
|
+
width: 18,
|
|
188
|
+
height: 18,
|
|
189
|
+
mr: 1
|
|
190
|
+
}
|
|
191
|
+
}), invoice.paymentMethod.name]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
171
195
|
}, {
|
|
172
196
|
label: t("common.type"),
|
|
173
197
|
name: "billing_reason",
|
|
@@ -432,8 +456,8 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
432
456
|
if (data && data.list.length === 0) {
|
|
433
457
|
if (data.subscription && ["active", "trialing"].includes(data.subscription.status)) {
|
|
434
458
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
435
|
-
color: "text.secondary",
|
|
436
459
|
sx: {
|
|
460
|
+
color: "text.secondary",
|
|
437
461
|
my: 0.5
|
|
438
462
|
},
|
|
439
463
|
children: t("payment.customer.invoice.next", {
|
|
@@ -442,8 +466,8 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
442
466
|
});
|
|
443
467
|
}
|
|
444
468
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
445
|
-
color: "text.secondary",
|
|
446
469
|
sx: {
|
|
470
|
+
color: "text.secondary",
|
|
447
471
|
my: 0.5
|
|
448
472
|
},
|
|
449
473
|
children: t("payment.customer.invoice.empty")
|
|
@@ -480,17 +504,19 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
480
504
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
481
505
|
direction: "row",
|
|
482
506
|
sx: {
|
|
507
|
+
gap: {
|
|
508
|
+
xs: 0.5,
|
|
509
|
+
sm: 1.5,
|
|
510
|
+
md: 3
|
|
511
|
+
},
|
|
512
|
+
alignItems: "center",
|
|
513
|
+
flexWrap: "nowrap",
|
|
483
514
|
my: 1
|
|
484
515
|
},
|
|
485
|
-
gap: {
|
|
486
|
-
xs: 0.5,
|
|
487
|
-
sm: 1.5,
|
|
488
|
-
md: 3
|
|
489
|
-
},
|
|
490
|
-
alignItems: "center",
|
|
491
|
-
flexWrap: "nowrap",
|
|
492
516
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
493
|
-
|
|
517
|
+
sx: {
|
|
518
|
+
flex: 2
|
|
519
|
+
},
|
|
494
520
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
|
|
495
521
|
href: link.url,
|
|
496
522
|
target: link.external ? "_blank" : target,
|
|
@@ -498,8 +524,10 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
498
524
|
onClick: e => handleLinkClick(e, link),
|
|
499
525
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
500
526
|
direction: "row",
|
|
501
|
-
alignItems: "center",
|
|
502
527
|
spacing: 0.5,
|
|
528
|
+
sx: {
|
|
529
|
+
alignItems: "center"
|
|
530
|
+
},
|
|
503
531
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
504
532
|
component: "span",
|
|
505
533
|
children: invoice.number
|
|
@@ -516,8 +544,10 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
516
544
|
})
|
|
517
545
|
})
|
|
518
546
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
519
|
-
|
|
520
|
-
|
|
547
|
+
sx: {
|
|
548
|
+
flex: 1,
|
|
549
|
+
textAlign: "right"
|
|
550
|
+
},
|
|
521
551
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
522
552
|
sx: isVoid ? {
|
|
523
553
|
textDecoration: "line-through"
|
|
@@ -525,16 +555,18 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
525
555
|
children: [(0, _util.formatBNStr)(invoice.total, invoice.paymentCurrency.decimal), "\xA0", invoice.paymentCurrency.symbol]
|
|
526
556
|
})
|
|
527
557
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
528
|
-
|
|
529
|
-
|
|
558
|
+
sx: {
|
|
559
|
+
flex: 1,
|
|
560
|
+
textAlign: "right"
|
|
561
|
+
},
|
|
530
562
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
531
563
|
children: (0, _util.formatToDate)(invoice.created_at, locale, "HH:mm:ss")
|
|
532
564
|
})
|
|
533
565
|
}), !action && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
534
|
-
flex: 2,
|
|
535
566
|
className: "invoice-description",
|
|
536
|
-
textAlign: "right",
|
|
537
567
|
sx: {
|
|
568
|
+
flex: 2,
|
|
569
|
+
textAlign: "right",
|
|
538
570
|
display: {
|
|
539
571
|
xs: "none",
|
|
540
572
|
lg: "inline-flex"
|
|
@@ -544,8 +576,10 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
544
576
|
children: invoice.description || invoice.id
|
|
545
577
|
})
|
|
546
578
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
547
|
-
|
|
548
|
-
|
|
579
|
+
sx: {
|
|
580
|
+
flex: 1,
|
|
581
|
+
textAlign: "right"
|
|
582
|
+
},
|
|
549
583
|
children: action ? connect ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
550
584
|
variant: "contained",
|
|
551
585
|
color: "primary",
|
|
@@ -595,7 +629,9 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
595
629
|
resource: t("payment.customer.invoices")
|
|
596
630
|
})
|
|
597
631
|
}), !hasMore && data.count > size && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
598
|
-
|
|
632
|
+
sx: {
|
|
633
|
+
color: "text.secondary"
|
|
634
|
+
},
|
|
599
635
|
children: t("common.noMore", {
|
|
600
636
|
resource: t("payment.customer.invoices")
|
|
601
637
|
})
|
|
@@ -603,7 +639,21 @@ const InvoiceList = _react.default.memo(props => {
|
|
|
603
639
|
})]
|
|
604
640
|
});
|
|
605
641
|
});
|
|
606
|
-
function CustomerInvoiceList(
|
|
642
|
+
function CustomerInvoiceList(rawProps) {
|
|
643
|
+
const props = Object.assign({
|
|
644
|
+
customer_id: "",
|
|
645
|
+
subscription_id: "",
|
|
646
|
+
currency_id: "",
|
|
647
|
+
include_staking: false,
|
|
648
|
+
include_recovered_from: false,
|
|
649
|
+
status: "open,paid,uncollectible",
|
|
650
|
+
pageSize: 10,
|
|
651
|
+
target: "_self",
|
|
652
|
+
action: "",
|
|
653
|
+
type: "list",
|
|
654
|
+
onTableDataChange: () => {},
|
|
655
|
+
relatedSubscription: false
|
|
656
|
+
}, rawProps);
|
|
607
657
|
const {
|
|
608
658
|
action,
|
|
609
659
|
type
|
|
@@ -672,20 +722,6 @@ function CustomerInvoiceList(props) {
|
|
|
672
722
|
onPay
|
|
673
723
|
});
|
|
674
724
|
}
|
|
675
|
-
CustomerInvoiceList.defaultProps = {
|
|
676
|
-
customer_id: "",
|
|
677
|
-
subscription_id: "",
|
|
678
|
-
currency_id: "",
|
|
679
|
-
include_staking: false,
|
|
680
|
-
include_recovered_from: false,
|
|
681
|
-
status: "open,paid,uncollectible",
|
|
682
|
-
pageSize: 10,
|
|
683
|
-
target: "_self",
|
|
684
|
-
action: "",
|
|
685
|
-
type: "list",
|
|
686
|
-
onTableDataChange: () => {},
|
|
687
|
-
relatedSubscription: false
|
|
688
|
-
};
|
|
689
725
|
const Root = (0, _system.styled)(_material.Stack)`
|
|
690
726
|
@media (max-width: ${({
|
|
691
727
|
theme
|
|
@@ -12,7 +12,7 @@ var _tx = _interopRequireDefault(require("../../components/blockchain/tx"));
|
|
|
12
12
|
var _status = _interopRequireDefault(require("../../components/status"));
|
|
13
13
|
var _api = _interopRequireDefault(require("../../libs/api"));
|
|
14
14
|
var _util = require("../../libs/util");
|
|
15
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
const groupByDate = items => {
|
|
17
17
|
const grouped = {};
|
|
18
18
|
items.forEach(item => {
|
|
@@ -58,7 +58,9 @@ function CustomerPaymentList({
|
|
|
58
58
|
}
|
|
59
59
|
if (data && data.list.length === 0) {
|
|
60
60
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
61
|
-
|
|
61
|
+
sx: {
|
|
62
|
+
color: "text.secondary"
|
|
63
|
+
},
|
|
62
64
|
children: t("payment.customer.payment.empty")
|
|
63
65
|
});
|
|
64
66
|
}
|
|
@@ -66,8 +68,8 @@ function CustomerPaymentList({
|
|
|
66
68
|
const grouped = groupByDate(data.list);
|
|
67
69
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
68
70
|
direction: "column",
|
|
69
|
-
gap: 1,
|
|
70
71
|
sx: {
|
|
72
|
+
gap: 1,
|
|
71
73
|
mt: 1
|
|
72
74
|
},
|
|
73
75
|
children: [Object.entries(grouped).map(([date, payments]) => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
@@ -85,39 +87,49 @@ function CustomerPaymentList({
|
|
|
85
87
|
sm: "row"
|
|
86
88
|
},
|
|
87
89
|
sx: {
|
|
90
|
+
gap: {
|
|
91
|
+
xs: 0.5,
|
|
92
|
+
sm: 1.5,
|
|
93
|
+
md: 3
|
|
94
|
+
},
|
|
95
|
+
flexWrap: "nowrap",
|
|
88
96
|
my: 1
|
|
89
97
|
},
|
|
90
|
-
gap: {
|
|
91
|
-
xs: 0.5,
|
|
92
|
-
sm: 1.5,
|
|
93
|
-
md: 3
|
|
94
|
-
},
|
|
95
|
-
flexWrap: "nowrap",
|
|
96
98
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
97
|
-
|
|
99
|
+
sx: {
|
|
100
|
+
flex: 3
|
|
101
|
+
},
|
|
98
102
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
99
103
|
children: (0, _util.formatToDate)(item.created_at)
|
|
100
104
|
})
|
|
101
105
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
102
|
-
|
|
106
|
+
sx: {
|
|
107
|
+
flex: 2
|
|
108
|
+
},
|
|
103
109
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
104
|
-
|
|
110
|
+
sx: {
|
|
111
|
+
textAlign: "right"
|
|
112
|
+
},
|
|
105
113
|
children: [(0, _util.formatBNStr)(item.amount_received, item.paymentCurrency.decimal), "\xA0", item.paymentCurrency.symbol]
|
|
106
114
|
})
|
|
107
115
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
108
|
-
|
|
116
|
+
sx: {
|
|
117
|
+
flex: 3
|
|
118
|
+
},
|
|
109
119
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
|
|
110
120
|
label: item.status,
|
|
111
121
|
color: (0, _util.getPaymentIntentStatusColor)(item.status)
|
|
112
122
|
})
|
|
113
123
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
114
|
-
|
|
124
|
+
sx: {
|
|
125
|
+
flex: 3
|
|
126
|
+
},
|
|
115
127
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
116
128
|
children: item.description || "-"
|
|
117
129
|
})
|
|
118
130
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
119
|
-
flex: 3,
|
|
120
131
|
sx: {
|
|
132
|
+
flex: 3,
|
|
121
133
|
minWidth: "220px"
|
|
122
134
|
},
|
|
123
135
|
children: (item.payment_details?.arcblock?.tx_hash || item.payment_details?.ethereum?.tx_hash || item.payment_details?.base?.tx_hash) && /* @__PURE__ */(0, _jsxRuntime.jsx)(_tx.default, {
|
|
@@ -140,7 +152,9 @@ function CustomerPaymentList({
|
|
|
140
152
|
resource: t("payment.customer.payments")
|
|
141
153
|
})
|
|
142
154
|
}), !hasMore && data.count > pageSize && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
143
|
-
|
|
155
|
+
sx: {
|
|
156
|
+
color: "text.secondary"
|
|
157
|
+
},
|
|
144
158
|
children: t("common.noMore", {
|
|
145
159
|
resource: t("payment.customer.payments")
|
|
146
160
|
})
|
package/lib/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/lib/hooks/mobile.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useMobile = useMobile;
|
|
7
7
|
var _styles = require("@mui/material/styles");
|
|
8
8
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const MOBILE_POINT = "md";
|
|
11
11
|
function useMobile(mobilePoint = MOBILE_POINT) {
|
|
12
12
|
const theme = (0, _styles.useTheme)();
|
|
@@ -7,7 +7,7 @@ exports.useSubscription = useSubscription;
|
|
|
7
7
|
var _ws = require("@arcblock/ws");
|
|
8
8
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const RELAY_SOCKET_PREFIX = "/.well-known/service/relay";
|
|
12
12
|
const getAppId = () => (0, _get.default)(window, "blocklet.appPid") || (0, _get.default)(window, "blocklet.appId") || "";
|
|
13
13
|
const getRelayChannel = token => `relay:${getAppId()}:${token}`;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import TxGas from './components/blockchain/gas';
|
|
|
5
5
|
import TxLink from './components/blockchain/tx';
|
|
6
6
|
import ConfirmDialog from './components/confirm';
|
|
7
7
|
import FormInput from './components/input';
|
|
8
|
+
import FormLabel from './components/label';
|
|
8
9
|
import Livemode from './components/livemode';
|
|
9
10
|
import PricingTable from './components/pricing-table';
|
|
10
11
|
import Table from './components/table';
|
|
@@ -13,6 +14,8 @@ import Status from './components/status';
|
|
|
13
14
|
import Switch from './components/switch-button';
|
|
14
15
|
import CustomerInvoiceList from './history/invoice/list';
|
|
15
16
|
import CustomerPaymentList from './history/payment/list';
|
|
17
|
+
import CreditGrantsList, { StatusChip as CreditStatusChip } from './history/credit/grants-list';
|
|
18
|
+
import CreditTransactionsList from './history/credit/transactions-list';
|
|
16
19
|
import api from './libs/api';
|
|
17
20
|
import dayjs from './libs/dayjs';
|
|
18
21
|
import Amount from './payment/amount';
|
|
@@ -32,6 +35,7 @@ import OverdueInvoicePayment from './components/over-due-invoice-payment';
|
|
|
32
35
|
import PaymentBeneficiaries from './components/payment-beneficiaries';
|
|
33
36
|
import LoadingButton from './components/loading-button';
|
|
34
37
|
import ResumeSubscription from './components/resume-subscription';
|
|
38
|
+
import DateRangePicker from './components/date-range-picker';
|
|
35
39
|
export { PaymentThemeProvider } from './theme';
|
|
36
40
|
export * from './libs/util';
|
|
37
41
|
export * from './libs/connect';
|
|
@@ -46,4 +50,4 @@ export * from './hooks/scroll';
|
|
|
46
50
|
export * from './hooks/keyboard';
|
|
47
51
|
export * from './libs/validator';
|
|
48
52
|
export { translations, createTranslator } from './locales';
|
|
49
|
-
export { createLazyComponent, api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, TruncatedText, Link, OverdueInvoicePayment, PaymentBeneficiaries, LoadingButton, DonateDetails, ResumeSubscription, };
|
|
53
|
+
export { createLazyComponent, api, dayjs, FormInput, FormLabel, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, TruncatedText, Link, OverdueInvoicePayment, PaymentBeneficiaries, LoadingButton, DonateDetails, ResumeSubscription, CreditGrantsList, CreditTransactionsList, DateRangePicker, CreditStatusChip, };
|
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var _exportNames = {
|
|
|
12
12
|
TxLink: true,
|
|
13
13
|
ConfirmDialog: true,
|
|
14
14
|
FormInput: true,
|
|
15
|
+
FormLabel: true,
|
|
15
16
|
Livemode: true,
|
|
16
17
|
PricingTable: true,
|
|
17
18
|
Table: true,
|
|
@@ -20,6 +21,9 @@ var _exportNames = {
|
|
|
20
21
|
Switch: true,
|
|
21
22
|
CustomerInvoiceList: true,
|
|
22
23
|
CustomerPaymentList: true,
|
|
24
|
+
CreditGrantsList: true,
|
|
25
|
+
CreditStatusChip: true,
|
|
26
|
+
CreditTransactionsList: true,
|
|
23
27
|
api: true,
|
|
24
28
|
dayjs: true,
|
|
25
29
|
Amount: true,
|
|
@@ -39,6 +43,7 @@ var _exportNames = {
|
|
|
39
43
|
PaymentBeneficiaries: true,
|
|
40
44
|
LoadingButton: true,
|
|
41
45
|
ResumeSubscription: true,
|
|
46
|
+
DateRangePicker: true,
|
|
42
47
|
PaymentThemeProvider: true,
|
|
43
48
|
translations: true,
|
|
44
49
|
createTranslator: true
|
|
@@ -85,6 +90,24 @@ Object.defineProperty(exports, "CountrySelect", {
|
|
|
85
90
|
return _countrySelect.default;
|
|
86
91
|
}
|
|
87
92
|
});
|
|
93
|
+
Object.defineProperty(exports, "CreditGrantsList", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () {
|
|
96
|
+
return _grantsList.default;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, "CreditStatusChip", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return _grantsList.StatusChip;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(exports, "CreditTransactionsList", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return _transactionsList.default;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
88
111
|
Object.defineProperty(exports, "CurrencySelector", {
|
|
89
112
|
enumerable: true,
|
|
90
113
|
get: function () {
|
|
@@ -103,6 +126,12 @@ Object.defineProperty(exports, "CustomerPaymentList", {
|
|
|
103
126
|
return _list2.default;
|
|
104
127
|
}
|
|
105
128
|
});
|
|
129
|
+
Object.defineProperty(exports, "DateRangePicker", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return _dateRangePicker.default;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
106
135
|
Object.defineProperty(exports, "DonateDetails", {
|
|
107
136
|
enumerable: true,
|
|
108
137
|
get: function () {
|
|
@@ -115,6 +144,12 @@ Object.defineProperty(exports, "FormInput", {
|
|
|
115
144
|
return _input.default;
|
|
116
145
|
}
|
|
117
146
|
});
|
|
147
|
+
Object.defineProperty(exports, "FormLabel", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return _label.default;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
118
153
|
Object.defineProperty(exports, "Link", {
|
|
119
154
|
enumerable: true,
|
|
120
155
|
get: function () {
|
|
@@ -278,6 +313,7 @@ var _gas = _interopRequireDefault(require("./components/blockchain/gas"));
|
|
|
278
313
|
var _tx = _interopRequireDefault(require("./components/blockchain/tx"));
|
|
279
314
|
var _confirm = _interopRequireDefault(require("./components/confirm"));
|
|
280
315
|
var _input = _interopRequireDefault(require("./components/input"));
|
|
316
|
+
var _label = _interopRequireDefault(require("./components/label"));
|
|
281
317
|
var _livemode = _interopRequireDefault(require("./components/livemode"));
|
|
282
318
|
var _pricingTable = _interopRequireDefault(require("./components/pricing-table"));
|
|
283
319
|
var _table2 = _interopRequireDefault(require("./components/table"));
|
|
@@ -286,6 +322,8 @@ var _status = _interopRequireDefault(require("./components/status"));
|
|
|
286
322
|
var _switchButton = _interopRequireDefault(require("./components/switch-button"));
|
|
287
323
|
var _list = _interopRequireDefault(require("./history/invoice/list"));
|
|
288
324
|
var _list2 = _interopRequireDefault(require("./history/payment/list"));
|
|
325
|
+
var _grantsList = _interopRequireWildcard(require("./history/credit/grants-list"));
|
|
326
|
+
var _transactionsList = _interopRequireDefault(require("./history/credit/transactions-list"));
|
|
289
327
|
var _api = _interopRequireDefault(require("./libs/api"));
|
|
290
328
|
var _dayjs = _interopRequireDefault(require("./libs/dayjs"));
|
|
291
329
|
var _amount = _interopRequireDefault(require("./payment/amount"));
|
|
@@ -305,6 +343,7 @@ var _overDueInvoicePayment = _interopRequireDefault(require("./components/over-d
|
|
|
305
343
|
var _paymentBeneficiaries = _interopRequireDefault(require("./components/payment-beneficiaries"));
|
|
306
344
|
var _loadingButton = _interopRequireDefault(require("./components/loading-button"));
|
|
307
345
|
var _resumeSubscription = _interopRequireDefault(require("./components/resume-subscription"));
|
|
346
|
+
var _dateRangePicker = _interopRequireDefault(require("./components/date-range-picker"));
|
|
308
347
|
var _theme = require("./theme");
|
|
309
348
|
var _util = require("./libs/util");
|
|
310
349
|
Object.keys(_util).forEach(function (key) {
|
|
@@ -451,6 +490,6 @@ Object.keys(_validator).forEach(function (key) {
|
|
|
451
490
|
});
|
|
452
491
|
});
|
|
453
492
|
var _locales = require("./locales");
|
|
454
|
-
function _interopRequireDefault(
|
|
493
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
455
494
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
456
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
495
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
package/lib/libs/api.js
CHANGED
|
@@ -8,7 +8,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
8
8
|
var _jsSdk = require("@blocklet/js-sdk");
|
|
9
9
|
var _isNull = _interopRequireDefault(require("lodash/isNull"));
|
|
10
10
|
var _util = require("./util");
|
|
11
|
-
function _interopRequireDefault(
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const api = (0, _jsSdk.createAxios)();
|
|
13
13
|
api.interceptors.request.use(config => {
|
|
14
14
|
const prefix = (0, _util.getPrefix)();
|
package/lib/libs/dayjs.js
CHANGED
|
@@ -10,7 +10,7 @@ var _localizedFormat = _interopRequireDefault(require("dayjs/plugin/localizedFor
|
|
|
10
10
|
var _relativeTime = _interopRequireDefault(require("dayjs/plugin/relativeTime"));
|
|
11
11
|
var _timezone = _interopRequireDefault(require("dayjs/plugin/timezone"));
|
|
12
12
|
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
Promise.resolve().then(() => require("dayjs/locale/en"));
|
|
15
15
|
Promise.resolve().then(() => require("dayjs/locale/zh"));
|
|
16
16
|
_dayjs.default.extend(_relativeTime.default);
|
|
@@ -83,7 +83,6 @@ const formatPhone = (phoneNumber, defaultCountry = "US") => {
|
|
|
83
83
|
AE: "971"
|
|
84
84
|
// UAE
|
|
85
85
|
};
|
|
86
|
-
|
|
87
86
|
const COUNTRY_PATTERNS = [[/^1[3-9]\d{9}$/, "86"],
|
|
88
87
|
// China mobile: 11 digits, starts with 1
|
|
89
88
|
[/^\d{10}$/, "1"],
|
|
@@ -101,7 +100,6 @@ const formatPhone = (phoneNumber, defaultCountry = "US") => {
|
|
|
101
100
|
[/^[0-9]\d{8}$/, "86"]
|
|
102
101
|
// China landline: 9 digits
|
|
103
102
|
];
|
|
104
|
-
|
|
105
103
|
let numberToFormat = cleanedNumber;
|
|
106
104
|
if (numberToFormat.startsWith("0")) {
|
|
107
105
|
numberToFormat = numberToFormat.substring(1);
|
package/lib/libs/theme.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
module.exports = create;
|
|
7
7
|
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
8
8
|
var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
function create(settings = {}) {
|
|
11
11
|
return (0, _Theme.createTheme)((0, _merge.default)({
|
|
12
12
|
typography: {
|
package/lib/libs/util.d.ts
CHANGED
|
@@ -129,3 +129,5 @@ export declare function parseMarkedText(text: string): Array<{
|
|
|
129
129
|
content: string;
|
|
130
130
|
}>;
|
|
131
131
|
export declare function getTokenBalanceLink(method: TPaymentMethod, address: string): string;
|
|
132
|
+
export declare function isCreditMetered(price: TPrice): boolean;
|
|
133
|
+
export declare function showStaking(method: TPaymentMethod, currency: TPaymentCurrency, noStake: boolean): boolean;
|
package/lib/libs/util.js
CHANGED
|
@@ -53,6 +53,7 @@ exports.getWebhookStatusColor = getWebhookStatusColor;
|
|
|
53
53
|
exports.getWordBreakStyle = getWordBreakStyle;
|
|
54
54
|
exports.hasDelegateTxHash = hasDelegateTxHash;
|
|
55
55
|
exports.hasMultipleRecurringIntervals = hasMultipleRecurringIntervals;
|
|
56
|
+
exports.isCreditMetered = isCreditMetered;
|
|
56
57
|
exports.isCrossOrigin = isCrossOrigin;
|
|
57
58
|
exports.isMobileSafari = isMobileSafari;
|
|
58
59
|
exports.isPaymentKitMounted = void 0;
|
|
@@ -61,6 +62,7 @@ exports.lazyLoad = lazyLoad;
|
|
|
61
62
|
exports.mergeExtraParams = void 0;
|
|
62
63
|
exports.openDonationSettings = openDonationSettings;
|
|
63
64
|
exports.parseMarkedText = parseMarkedText;
|
|
65
|
+
exports.showStaking = showStaking;
|
|
64
66
|
exports.sleep = sleep;
|
|
65
67
|
exports.stopEvent = stopEvent;
|
|
66
68
|
exports.truncateText = truncateText;
|
|
@@ -73,7 +75,7 @@ var _reactInternationalPhone = require("react-international-phone");
|
|
|
73
75
|
var _ufo = require("ufo");
|
|
74
76
|
var _locales = require("../locales");
|
|
75
77
|
var _dayjs = _interopRequireDefault(require("./dayjs"));
|
|
76
|
-
function _interopRequireDefault(
|
|
78
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
77
79
|
const PAYMENT_KIT_DID = exports.PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
|
|
78
80
|
const isPaymentKitMounted = () => {
|
|
79
81
|
return (window.blocklet?.componentMountPoints || []).some(x => x.did === PAYMENT_KIT_DID);
|
|
@@ -1232,4 +1234,16 @@ function getTokenBalanceLink(method, address) {
|
|
|
1232
1234
|
return (0, _ufo.joinURL)(explorerHost, "address", address);
|
|
1233
1235
|
}
|
|
1234
1236
|
return "";
|
|
1237
|
+
}
|
|
1238
|
+
function isCreditMetered(price) {
|
|
1239
|
+
return !!(price.type === "recurring" && price.recurring?.usage_type === "metered" && price.recurring?.meter_id);
|
|
1240
|
+
}
|
|
1241
|
+
function showStaking(method, currency, noStake) {
|
|
1242
|
+
if (noStake) {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
if (method.type === "arcblock") {
|
|
1246
|
+
return currency.type !== "credit";
|
|
1247
|
+
}
|
|
1248
|
+
return true;
|
|
1235
1249
|
}
|
package/lib/libs/validator.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.getFieldValidation = getFieldValidation;
|
|
|
7
7
|
exports.validatePostalCode = validatePostalCode;
|
|
8
8
|
var _isPostalCode = _interopRequireDefault(require("validator/lib/isPostalCode"));
|
|
9
9
|
var _locales = require("../locales");
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const POSTAL_CODE_SUPPORTED_COUNTRIES = ["AD", "AT", "AU", "BE", "BG", "BR", "CA", "CH", "CN", "CZ", "DE", "DK", "DZ", "EE", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "ID", "IE", "IL", "IN", "IR", "IS", "IT", "JP", "KE", "KR", "LI", "LT", "LU", "LV", "MX", "MT", "NL", "NO", "NZ", "PL", "PR", "PT", "RO", "RU", "SA", "SE", "SI", "SK", "TN", "TW", "UA", "US", "ZA", "ZM"];
|
|
12
12
|
function validatePostalCode(postalCode, country) {
|
|
13
13
|
if (!postalCode) return true;
|
package/lib/locales/en.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _flat = _interopRequireDefault(require("flat"));
|
|
8
8
|
var _constant = require("../libs/constant");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
module.exports = (0, _flat.default)({
|
|
11
11
|
common: {
|
|
12
12
|
id: "ID",
|
|
@@ -35,6 +35,10 @@ module.exports = (0, _flat.default)({
|
|
|
35
35
|
remove: "Remove",
|
|
36
36
|
removed: "Resource removed",
|
|
37
37
|
confirm: "Confirm",
|
|
38
|
+
clear: "Clear",
|
|
39
|
+
selectTimeRange: "Select time range",
|
|
40
|
+
startDate: "Start date",
|
|
41
|
+
endDate: "End date",
|
|
38
42
|
upload: "Upload",
|
|
39
43
|
change: "Change",
|
|
40
44
|
cancel: "Cancel",
|
|
@@ -107,7 +111,8 @@ module.exports = (0, _flat.default)({
|
|
|
107
111
|
scan: "Use following methods to complete this {action}",
|
|
108
112
|
confirm: "Confirm",
|
|
109
113
|
cancel: "Cancel"
|
|
110
|
-
}
|
|
114
|
+
},
|
|
115
|
+
paymentMethod: "Payment Method"
|
|
111
116
|
},
|
|
112
117
|
payment: {
|
|
113
118
|
checkout: {
|
|
@@ -211,6 +216,11 @@ module.exports = (0, _flat.default)({
|
|
|
211
216
|
add: "Add to order",
|
|
212
217
|
remove: "Remove from order"
|
|
213
218
|
},
|
|
219
|
+
credit: {
|
|
220
|
+
oneTimeInfo: "You will receive {amount} {symbol} credits after payment",
|
|
221
|
+
recurringInfo: "You will receive {amount} {symbol} credits {period}",
|
|
222
|
+
expiresIn: "credits have a validity period of {duration} {unit}"
|
|
223
|
+
},
|
|
214
224
|
expired: {
|
|
215
225
|
title: "Expired Link",
|
|
216
226
|
description: "This link has expired. This means that your payment has already been processed or your session has expired."
|
|
@@ -239,7 +249,15 @@ module.exports = (0, _flat.default)({
|
|
|
239
249
|
payer: "Account",
|
|
240
250
|
amount: "Amount",
|
|
241
251
|
failed: "Account changed, please pay manually.",
|
|
242
|
-
balanceLink: "View Balance"
|
|
252
|
+
balanceLink: "View Balance",
|
|
253
|
+
credit: {
|
|
254
|
+
title: "Confirm Credit Payment",
|
|
255
|
+
availableAmount: "Available Credit: {amount}",
|
|
256
|
+
confirmMessage: "You will use {amount} credits to subscribe to this service.",
|
|
257
|
+
meteringSubscriptionMessage: "This subscription service will deduct credits in real-time based on actual usage. You currently have {available} credits available. Confirm to continue?",
|
|
258
|
+
insufficientTitle: "Insufficient Credit",
|
|
259
|
+
insufficientMessage: "This subscription service will deduct credits in real-time based on actual usage. You currently have insufficient credits. Please top up your credits first."
|
|
260
|
+
}
|
|
243
261
|
}
|
|
244
262
|
},
|
|
245
263
|
customer: {
|
package/lib/locales/index.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.translations = exports.translate = exports.t = exports.createTranslator
|
|
|
7
7
|
var _template = _interopRequireDefault(require("lodash/template"));
|
|
8
8
|
var _en = _interopRequireDefault(require("./en"));
|
|
9
9
|
var _zh = _interopRequireDefault(require("./zh"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const translations = exports.translations = {
|
|
12
12
|
zh: _zh.default,
|
|
13
13
|
en: _en.default
|