@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
|
@@ -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();
|
package/es/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/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import TxGas from "./components/blockchain/gas.js";
|
|
|
5
5
|
import TxLink from "./components/blockchain/tx.js";
|
|
6
6
|
import ConfirmDialog from "./components/confirm.js";
|
|
7
7
|
import FormInput from "./components/input.js";
|
|
8
|
+
import FormLabel from "./components/label.js";
|
|
8
9
|
import Livemode from "./components/livemode.js";
|
|
9
10
|
import PricingTable from "./components/pricing-table.js";
|
|
10
11
|
import Table from "./components/table.js";
|
|
@@ -13,6 +14,8 @@ import Status from "./components/status.js";
|
|
|
13
14
|
import Switch from "./components/switch-button.js";
|
|
14
15
|
import CustomerInvoiceList from "./history/invoice/list.js";
|
|
15
16
|
import CustomerPaymentList from "./history/payment/list.js";
|
|
17
|
+
import CreditGrantsList, { StatusChip as CreditStatusChip } from "./history/credit/grants-list.js";
|
|
18
|
+
import CreditTransactionsList from "./history/credit/transactions-list.js";
|
|
16
19
|
import api from "./libs/api.js";
|
|
17
20
|
import dayjs from "./libs/dayjs.js";
|
|
18
21
|
import Amount from "./payment/amount.js";
|
|
@@ -32,6 +35,7 @@ import OverdueInvoicePayment from "./components/over-due-invoice-payment.js";
|
|
|
32
35
|
import PaymentBeneficiaries from "./components/payment-beneficiaries.js";
|
|
33
36
|
import LoadingButton from "./components/loading-button.js";
|
|
34
37
|
import ResumeSubscription from "./components/resume-subscription.js";
|
|
38
|
+
import DateRangePicker from "./components/date-range-picker.js";
|
|
35
39
|
export { PaymentThemeProvider } from "./theme/index.js";
|
|
36
40
|
export * from "./libs/util.js";
|
|
37
41
|
export * from "./libs/connect.js";
|
|
@@ -51,6 +55,7 @@ export {
|
|
|
51
55
|
api,
|
|
52
56
|
dayjs,
|
|
53
57
|
FormInput,
|
|
58
|
+
FormLabel,
|
|
54
59
|
PhoneInput,
|
|
55
60
|
AddressForm,
|
|
56
61
|
StripeForm,
|
|
@@ -81,5 +86,9 @@ export {
|
|
|
81
86
|
PaymentBeneficiaries,
|
|
82
87
|
LoadingButton,
|
|
83
88
|
DonateDetails,
|
|
84
|
-
ResumeSubscription
|
|
89
|
+
ResumeSubscription,
|
|
90
|
+
CreditGrantsList,
|
|
91
|
+
CreditTransactionsList,
|
|
92
|
+
DateRangePicker,
|
|
93
|
+
CreditStatusChip
|
|
85
94
|
};
|
|
@@ -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.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/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("#")) {
|
|
@@ -1003,3 +1001,15 @@ export function getTokenBalanceLink(method, address) {
|
|
|
1003
1001
|
}
|
|
1004
1002
|
return "";
|
|
1005
1003
|
}
|
|
1004
|
+
export function isCreditMetered(price) {
|
|
1005
|
+
return !!(price.type === "recurring" && price.recurring?.usage_type === "metered" && price.recurring?.meter_id);
|
|
1006
|
+
}
|
|
1007
|
+
export function showStaking(method, currency, noStake) {
|
|
1008
|
+
if (noStake) {
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
if (method.type === "arcblock") {
|
|
1012
|
+
return currency.type !== "credit";
|
|
1013
|
+
}
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
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/locales/en.js
CHANGED
|
@@ -28,6 +28,10 @@ export default flat({
|
|
|
28
28
|
remove: "Remove",
|
|
29
29
|
removed: "Resource removed",
|
|
30
30
|
confirm: "Confirm",
|
|
31
|
+
clear: "Clear",
|
|
32
|
+
selectTimeRange: "Select time range",
|
|
33
|
+
startDate: "Start date",
|
|
34
|
+
endDate: "End date",
|
|
31
35
|
upload: "Upload",
|
|
32
36
|
change: "Change",
|
|
33
37
|
cancel: "Cancel",
|
|
@@ -100,7 +104,8 @@ export default flat({
|
|
|
100
104
|
scan: "Use following methods to complete this {action}",
|
|
101
105
|
confirm: "Confirm",
|
|
102
106
|
cancel: "Cancel"
|
|
103
|
-
}
|
|
107
|
+
},
|
|
108
|
+
paymentMethod: "Payment Method"
|
|
104
109
|
},
|
|
105
110
|
payment: {
|
|
106
111
|
checkout: {
|
|
@@ -204,6 +209,11 @@ export default flat({
|
|
|
204
209
|
add: "Add to order",
|
|
205
210
|
remove: "Remove from order"
|
|
206
211
|
},
|
|
212
|
+
credit: {
|
|
213
|
+
oneTimeInfo: "You will receive {amount} {symbol} credits after payment",
|
|
214
|
+
recurringInfo: "You will receive {amount} {symbol} credits {period}",
|
|
215
|
+
expiresIn: "credits have a validity period of {duration} {unit}"
|
|
216
|
+
},
|
|
207
217
|
expired: {
|
|
208
218
|
title: "Expired Link",
|
|
209
219
|
description: "This link has expired. This means that your payment has already been processed or your session has expired."
|
|
@@ -232,7 +242,15 @@ export default flat({
|
|
|
232
242
|
payer: "Account",
|
|
233
243
|
amount: "Amount",
|
|
234
244
|
failed: "Account changed, please pay manually.",
|
|
235
|
-
balanceLink: "View Balance"
|
|
245
|
+
balanceLink: "View Balance",
|
|
246
|
+
credit: {
|
|
247
|
+
title: "Confirm Credit Payment",
|
|
248
|
+
availableAmount: "Available Credit: {amount}",
|
|
249
|
+
confirmMessage: "You will use {amount} credits to subscribe to this service.",
|
|
250
|
+
meteringSubscriptionMessage: "This subscription service will deduct credits in real-time based on actual usage. You currently have {available} credits available. Confirm to continue?",
|
|
251
|
+
insufficientTitle: "Insufficient Credit",
|
|
252
|
+
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."
|
|
253
|
+
}
|
|
236
254
|
}
|
|
237
255
|
},
|
|
238
256
|
customer: {
|
package/es/locales/zh.js
CHANGED
|
@@ -31,6 +31,10 @@ export default flat({
|
|
|
31
31
|
change: "\u66F4\u6362",
|
|
32
32
|
confirm: "\u786E\u8BA4",
|
|
33
33
|
cancel: "\u53D6\u6D88",
|
|
34
|
+
clear: "\u6E05\u7A7A",
|
|
35
|
+
selectTimeRange: "\u9009\u62E9\u65F6\u95F4\u8303\u56F4",
|
|
36
|
+
startDate: "\u5F00\u59CB\u65E5\u671F",
|
|
37
|
+
endDate: "\u7ED3\u675F\u65E5\u671F",
|
|
34
38
|
close: "\u5173\u95ED",
|
|
35
39
|
back: "\u8FD4\u56DE",
|
|
36
40
|
every: "\u6BCF",
|
|
@@ -100,7 +104,8 @@ export default flat({
|
|
|
100
104
|
scan: "\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u5B8C\u6210\u672C\u6B21{action}",
|
|
101
105
|
confirm: "\u786E\u8BA4",
|
|
102
106
|
cancel: "\u53D6\u6D88"
|
|
103
|
-
}
|
|
107
|
+
},
|
|
108
|
+
paymentMethod: "\u652F\u4ED8\u65B9\u5F0F"
|
|
104
109
|
},
|
|
105
110
|
payment: {
|
|
106
111
|
checkout: {
|
|
@@ -212,6 +217,11 @@ export default flat({
|
|
|
212
217
|
add: "\u6DFB\u52A0\u5230\u8BA2\u5355",
|
|
213
218
|
remove: "\u4ECE\u8BA2\u5355\u79FB\u9664"
|
|
214
219
|
},
|
|
220
|
+
credit: {
|
|
221
|
+
oneTimeInfo: "\u4ED8\u6B3E\u5B8C\u6210\u540E\u60A8\u5C06\u83B7\u5F97 {amount} {symbol} \u989D\u5EA6",
|
|
222
|
+
recurringInfo: "\u60A8\u5C06{period}\u83B7\u5F97 {amount} {symbol} \u989D\u5EA6",
|
|
223
|
+
expiresIn: "\u989D\u5EA6\u6709\u6548\u671F\u4E3A {duration} {unit}"
|
|
224
|
+
},
|
|
215
225
|
emptyItems: {
|
|
216
226
|
title: "\u6CA1\u6709\u4EFB\u4F55\u8D2D\u4E70\u9879\u76EE",
|
|
217
227
|
description: "\u53EF\u80FD\u8FD9\u4E2A\u4ED8\u6B3E\u94FE\u63A5\u6CA1\u6709\u6B63\u786E\u914D\u7F6E"
|
|
@@ -232,7 +242,15 @@ export default flat({
|
|
|
232
242
|
payer: "\u8D26\u6237\u5730\u5740",
|
|
233
243
|
amount: "\u652F\u4ED8\u91D1\u989D",
|
|
234
244
|
failed: "\u8D26\u6237\u53D1\u751F\u53D8\u5316\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u624B\u52A8\u652F\u4ED8\u3002",
|
|
235
|
-
balanceLink: "\u67E5\u770B\u4F59\u989D"
|
|
245
|
+
balanceLink: "\u67E5\u770B\u4F59\u989D",
|
|
246
|
+
credit: {
|
|
247
|
+
title: "\u786E\u8BA4\u989D\u5EA6\u652F\u4ED8",
|
|
248
|
+
availableAmount: "\u53EF\u7528\u989D\u5EA6\uFF1A{amount}",
|
|
249
|
+
confirmMessage: "\u60A8\u5C06\u4F7F\u7528 {amount} \u989D\u5EA6\u6765\u8BA2\u9605\u6B64\u670D\u52A1\u3002",
|
|
250
|
+
meteringSubscriptionMessage: "\u6B64\u8BA2\u9605\u670D\u52A1\u5C06\u6839\u636E\u5B9E\u9645\u4F7F\u7528\u60C5\u51B5\u5B9E\u65F6\u6263\u9664\u989D\u5EA6\u3002\u60A8\u5F53\u524D\u53EF\u7528\u989D\u5EA6\u4E3A {available}\uFF0C\u786E\u8BA4\u662F\u5426\u7EE7\u7EED\uFF1F",
|
|
251
|
+
insufficientTitle: "\u989D\u5EA6\u4E0D\u8DB3",
|
|
252
|
+
insufficientMessage: "\u6B64\u8BA2\u9605\u670D\u52A1\u5C06\u6839\u636E\u5B9E\u9645\u4F7F\u7528\u60C5\u51B5\u5B9E\u65F6\u6263\u9664\u989D\u5EA6\u3002\u60A8\u5F53\u524D\u53EF\u7528\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u5148\u5145\u503C\u989D\u5EA6\u3002"
|
|
253
|
+
}
|
|
236
254
|
}
|
|
237
255
|
},
|
|
238
256
|
customer: {
|
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 {};
|