@blocklet/payment-react 1.22.32 → 1.23.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/.aigne/doc-smith/translation-cache.yaml +2 -2
- package/.aigne/doc-smith/upload-cache.yaml +342 -0
- package/docs/assets/diagram/auto-topup-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/auto-topup-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/auto-topup-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/components-business-overdue-invoice-payment-01.ja.jpg +0 -0
- package/docs/assets/diagram/components-business-overdue-invoice-payment-01.jpg +0 -0
- package/docs/assets/diagram/components-business-overdue-invoice-payment-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/components-business-overdue-invoice-payment-01.zh.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-donate-01.ja.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-donate-01.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-donate-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-donate-01.zh.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-table-01.ja.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-table-01.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-table-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/components-checkout-checkout-table-01.zh.jpg +0 -0
- package/docs/assets/diagram/components-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/components-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/components-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-01.ja.jpg +0 -0
- package/docs/assets/diagram/overview-01.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh.jpg +0 -0
- package/docs/assets/diagram/payment-provider-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/payment-provider-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/payment-provider-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/phone-input-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/phone-input-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/phone-input-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/providers-01.ja.jpg +0 -0
- package/docs/assets/diagram/providers-01.jpg +0 -0
- package/docs/assets/diagram/providers-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/providers-01.zh.jpg +0 -0
- package/docs/assets/diagram/resume-subscription-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/resume-subscription-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/resume-subscription-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/use-subscription-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/use-subscription-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/use-subscription-diagram-0.zh.jpg +0 -0
- package/docs/components-business-auto-topup.ja.md +2 -2
- package/docs/components-business-auto-topup.md +1 -1
- package/docs/components-business-auto-topup.zh-TW.md +2 -2
- package/docs/components-business-auto-topup.zh.md +2 -2
- package/docs/components-business-overdue-invoice-payment.ja.md +3 -39
- package/docs/components-business-overdue-invoice-payment.md +99 -90
- package/docs/components-business-overdue-invoice-payment.zh-TW.md +3 -40
- package/docs/components-business-overdue-invoice-payment.zh.md +3 -40
- package/docs/components-business-resume-subscription.ja.md +2 -2
- package/docs/components-business-resume-subscription.md +1 -1
- package/docs/components-business-resume-subscription.zh-TW.md +2 -2
- package/docs/components-business-resume-subscription.zh.md +2 -2
- package/docs/components-checkout-checkout-donate.ja.md +3 -36
- package/docs/components-checkout-checkout-donate.md +135 -128
- package/docs/components-checkout-checkout-donate.zh-TW.md +3 -36
- package/docs/components-checkout-checkout-donate.zh.md +3 -36
- package/docs/components-checkout-checkout-form.md +63 -82
- package/docs/components-checkout-checkout-table.ja.md +3 -35
- package/docs/components-checkout-checkout-table.md +112 -72
- package/docs/components-checkout-checkout-table.zh-TW.md +3 -35
- package/docs/components-checkout-checkout-table.zh.md +3 -36
- package/docs/components-checkout.md +11 -49
- package/docs/components-ui-form-elements-phone-input.ja.md +2 -2
- package/docs/components-ui-form-elements-phone-input.md +1 -1
- package/docs/components-ui-form-elements-phone-input.zh-TW.md +2 -2
- package/docs/components-ui-form-elements-phone-input.zh.md +2 -2
- package/docs/components.ja.md +2 -2
- package/docs/components.md +1 -1
- package/docs/components.zh-TW.md +2 -2
- package/docs/components.zh.md +2 -2
- package/docs/hooks-use-subscription.ja.md +2 -2
- package/docs/hooks-use-subscription.md +1 -1
- package/docs/hooks-use-subscription.zh-TW.md +2 -2
- package/docs/hooks-use-subscription.zh.md +2 -2
- package/docs/overview.ja.md +3 -39
- package/docs/overview.md +25 -56
- package/docs/overview.zh-TW.md +3 -39
- package/docs/overview.zh.md +3 -39
- package/docs/providers-payment-provider.ja.md +2 -2
- package/docs/providers-payment-provider.md +1 -1
- package/docs/providers-payment-provider.zh-TW.md +2 -2
- package/docs/providers-payment-provider.zh.md +2 -2
- package/docs/providers.ja.md +3 -23
- package/docs/providers.md +11 -29
- package/docs/providers.zh-TW.md +3 -23
- package/docs/providers.zh.md +3 -23
- package/es/history/credit/transactions-list.js +31 -49
- package/es/locales/en.js +20 -4
- package/es/locales/zh.js +20 -4
- package/lib/history/credit/transactions-list.js +63 -66
- package/lib/locales/en.js +20 -4
- package/lib/locales/zh.js +20 -4
- package/package.json +3 -3
- package/src/history/credit/transactions-list.tsx +54 -64
- package/src/locales/en.tsx +20 -4
- package/src/locales/zh.tsx +20 -4
package/docs/providers.zh-TW.md
CHANGED
|
@@ -4,29 +4,9 @@ Context Provider 是 `@blocklet/payment-react` 的一個核心概念。它們作
|
|
|
4
4
|
|
|
5
5
|
要使用此函式庫中的大多數元件,您必須用適當的 provider 包裝您的應用程式或相關頁面。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Your-Application: {
|
|
11
|
-
shape: rectangle
|
|
12
|
-
|
|
13
|
-
PaymentProvider: {
|
|
14
|
-
label: "PaymentProvider"
|
|
15
|
-
shape: rectangle
|
|
16
|
-
|
|
17
|
-
CheckoutForm: {
|
|
18
|
-
label: "CheckoutForm"
|
|
19
|
-
}
|
|
20
|
-
CustomerInvoiceList: {
|
|
21
|
-
label: "CustomerInvoiceList"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
Your-Application -> PaymentProvider: "包裝"
|
|
27
|
-
PaymentProvider -> CheckoutForm: "提供 context"
|
|
28
|
-
PaymentProvider -> CustomerInvoiceList: "提供 context"
|
|
29
|
-
```
|
|
7
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
|
|
8
|
+

|
|
9
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
30
10
|
|
|
31
11
|
此函式庫提供兩個主要的 provider,每個都有不同的用途。請選擇適合您需求的 provider。
|
|
32
12
|
|
package/docs/providers.zh.md
CHANGED
|
@@ -4,29 +4,9 @@ Context 提供者是 `@blocklet/payment-react` 的一个核心概念。它们充
|
|
|
4
4
|
|
|
5
5
|
要使用此库中的大多数组件,您必须使用适当的提供者来包装您的应用程序或相关页面。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
您的应用程序: {
|
|
11
|
-
shape: rectangle
|
|
12
|
-
|
|
13
|
-
PaymentProvider: {
|
|
14
|
-
label: "PaymentProvider"
|
|
15
|
-
shape: rectangle
|
|
16
|
-
|
|
17
|
-
CheckoutForm: {
|
|
18
|
-
label: "CheckoutForm"
|
|
19
|
-
}
|
|
20
|
-
CustomerInvoiceList: {
|
|
21
|
-
label: "CustomerInvoiceList"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
您的应用程序 -> PaymentProvider: "包装"
|
|
27
|
-
PaymentProvider -> CheckoutForm: "提供上下文"
|
|
28
|
-
PaymentProvider -> CustomerInvoiceList: "提供上下文"
|
|
29
|
-
```
|
|
7
|
+
<!-- DIAGRAM_IMAGE_START:architecture:16:9::1765377042 -->
|
|
8
|
+

|
|
9
|
+
<!-- DIAGRAM_IMAGE_END -->
|
|
30
10
|
|
|
31
11
|
该库提供了两个主要的提供者,每个都有不同的用途。选择适合您需求的一个。
|
|
32
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
|
-
import { Box, Typography, Grid, Stack, Link, Button
|
|
3
|
+
import { Box, Typography, Grid, Stack, Link, Button } from "@mui/material";
|
|
4
4
|
import { useRequest } from "ahooks";
|
|
5
5
|
import { useNavigate } from "react-router-dom";
|
|
6
6
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
@@ -12,7 +12,6 @@ import { usePaymentContext } from "../../contexts/payment.js";
|
|
|
12
12
|
import api from "../../libs/api.js";
|
|
13
13
|
import Table from "../../components/table.js";
|
|
14
14
|
import { createLink, handleNavigation } from "../../libs/navigation.js";
|
|
15
|
-
import SourceDataViewer from "../../components/source-data-viewer.js";
|
|
16
15
|
const fetchData = (params = {}) => {
|
|
17
16
|
const search = new URLSearchParams();
|
|
18
17
|
Object.keys(params).forEach((key) => {
|
|
@@ -42,6 +41,16 @@ const getInvoiceDetailLink = (invoiceId, inDashboard) => {
|
|
|
42
41
|
connect: false
|
|
43
42
|
};
|
|
44
43
|
};
|
|
44
|
+
const getTransactionDetailLink = (transactionId, inDashboard) => {
|
|
45
|
+
let path = `/customer/credit-transaction/${transactionId}`;
|
|
46
|
+
if (inDashboard) {
|
|
47
|
+
path = `/admin/customers/${transactionId}`;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
link: createLink(path),
|
|
51
|
+
connect: false
|
|
52
|
+
};
|
|
53
|
+
};
|
|
45
54
|
const TransactionsTable = React.memo((props) => {
|
|
46
55
|
const {
|
|
47
56
|
pageSize,
|
|
@@ -69,7 +78,6 @@ const TransactionsTable = React.memo((props) => {
|
|
|
69
78
|
start: void 0,
|
|
70
79
|
end: void 0
|
|
71
80
|
});
|
|
72
|
-
const [sourceDataPopover, setSourceDataPopover] = useState({ anchorEl: null, data: null });
|
|
73
81
|
const handleDateRangeChange = useCallback((newValue) => {
|
|
74
82
|
setFilters(newValue);
|
|
75
83
|
setSearch((prev) => ({
|
|
@@ -104,6 +112,15 @@ const TransactionsTable = React.memo((props) => {
|
|
|
104
112
|
prevData.current = data;
|
|
105
113
|
}
|
|
106
114
|
}, [data]);
|
|
115
|
+
const handleTransactionClick = (e, item) => {
|
|
116
|
+
if (item.activity_type === "grant") {
|
|
117
|
+
const { link } = getGrantDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
118
|
+
handleNavigation(e, link, navigate, { target: link.external ? "_blank" : "_self" });
|
|
119
|
+
} else {
|
|
120
|
+
const { link } = getTransactionDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
121
|
+
handleNavigation(e, link, navigate, { target: link.external ? "_blank" : "_self" });
|
|
122
|
+
}
|
|
123
|
+
};
|
|
107
124
|
const columns = [
|
|
108
125
|
{
|
|
109
126
|
label: t("common.amount"),
|
|
@@ -118,13 +135,13 @@ const TransactionsTable = React.memo((props) => {
|
|
|
118
135
|
const unit = !isGrant && item.meter?.unit ? item.meter.unit : currency?.symbol;
|
|
119
136
|
const displayAmount = formatBNStr(amount, currency?.decimal || 0);
|
|
120
137
|
if (!includeGrants) {
|
|
121
|
-
return /* @__PURE__ */ jsxs(Typography, { children: [
|
|
138
|
+
return /* @__PURE__ */ jsx(Box, { onClick: (e) => handleTransactionClick(e, item), children: /* @__PURE__ */ jsxs(Typography, { children: [
|
|
122
139
|
displayAmount,
|
|
123
140
|
" ",
|
|
124
141
|
unit
|
|
125
|
-
] });
|
|
142
|
+
] }) });
|
|
126
143
|
}
|
|
127
|
-
return /* @__PURE__ */ jsxs(
|
|
144
|
+
return /* @__PURE__ */ jsx(Box, { onClick: (e) => handleTransactionClick(e, item), children: /* @__PURE__ */ jsxs(
|
|
128
145
|
Typography,
|
|
129
146
|
{
|
|
130
147
|
sx: {
|
|
@@ -138,7 +155,7 @@ const TransactionsTable = React.memo((props) => {
|
|
|
138
155
|
unit
|
|
139
156
|
]
|
|
140
157
|
}
|
|
141
|
-
);
|
|
158
|
+
) });
|
|
142
159
|
}
|
|
143
160
|
}
|
|
144
161
|
},
|
|
@@ -177,7 +194,7 @@ const TransactionsTable = React.memo((props) => {
|
|
|
177
194
|
const item = data?.list[index];
|
|
178
195
|
const isGrant = item.activity_type === "grant";
|
|
179
196
|
const description = isGrant ? item.name || item.description || "Credit Granted" : item.subscription?.description || item.description || `${item.meter_event_name} usage`;
|
|
180
|
-
return /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { fontWeight: 400 }, children: description });
|
|
197
|
+
return /* @__PURE__ */ jsx(Box, { onClick: (e) => handleTransactionClick(e, item), children: /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { fontWeight: 400 }, children: description }) });
|
|
181
198
|
}
|
|
182
199
|
}
|
|
183
200
|
},
|
|
@@ -202,7 +219,7 @@ const TransactionsTable = React.memo((props) => {
|
|
|
202
219
|
options: {
|
|
203
220
|
customBodyRenderLite: (_, index) => {
|
|
204
221
|
const item = data?.list[index];
|
|
205
|
-
return /* @__PURE__ */ jsx(
|
|
222
|
+
return /* @__PURE__ */ jsx(Box, { onClick: (e) => handleTransactionClick(e, item), children: /* @__PURE__ */ jsx(
|
|
206
223
|
Typography,
|
|
207
224
|
{
|
|
208
225
|
variant: "body2",
|
|
@@ -212,7 +229,7 @@ const TransactionsTable = React.memo((props) => {
|
|
|
212
229
|
},
|
|
213
230
|
children: formatToDate(item.created_at, locale, "YYYY-MM-DD HH:mm")
|
|
214
231
|
}
|
|
215
|
-
);
|
|
232
|
+
) });
|
|
216
233
|
}
|
|
217
234
|
}
|
|
218
235
|
},
|
|
@@ -224,7 +241,6 @@ const TransactionsTable = React.memo((props) => {
|
|
|
224
241
|
const item = data?.list[index];
|
|
225
242
|
const isGrant = item.activity_type === "grant";
|
|
226
243
|
const invoiceId = isGrant ? item.metadata?.invoice_id : null;
|
|
227
|
-
const sourceData = !isGrant && item.meterEvent?.source_data;
|
|
228
244
|
return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
|
|
229
245
|
isGrant && invoiceId && /* @__PURE__ */ jsx(
|
|
230
246
|
Button,
|
|
@@ -240,7 +256,7 @@ const TransactionsTable = React.memo((props) => {
|
|
|
240
256
|
children: t("common.viewInvoice")
|
|
241
257
|
}
|
|
242
258
|
),
|
|
243
|
-
|
|
259
|
+
!isGrant && /* @__PURE__ */ jsx(
|
|
244
260
|
Button,
|
|
245
261
|
{
|
|
246
262
|
variant: "text",
|
|
@@ -248,12 +264,10 @@ const TransactionsTable = React.memo((props) => {
|
|
|
248
264
|
color: "primary",
|
|
249
265
|
onClick: (e) => {
|
|
250
266
|
e.preventDefault();
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
data: sourceData
|
|
254
|
-
});
|
|
267
|
+
const link = getTransactionDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
268
|
+
handleNavigation(e, link.link, navigate);
|
|
255
269
|
},
|
|
256
|
-
children: t("common.
|
|
270
|
+
children: t("common.viewDetail")
|
|
257
271
|
}
|
|
258
272
|
)
|
|
259
273
|
] });
|
|
@@ -311,38 +325,6 @@ const TransactionsTable = React.memo((props) => {
|
|
|
311
325
|
mobileTDFlexDirection: "row",
|
|
312
326
|
emptyNodeText: t("admin.creditTransactions.noTransactions")
|
|
313
327
|
}
|
|
314
|
-
),
|
|
315
|
-
/* @__PURE__ */ jsx(
|
|
316
|
-
Popover,
|
|
317
|
-
{
|
|
318
|
-
open: Boolean(sourceDataPopover.anchorEl),
|
|
319
|
-
anchorEl: sourceDataPopover.anchorEl,
|
|
320
|
-
onClose: () => setSourceDataPopover({ anchorEl: null, data: null }),
|
|
321
|
-
anchorOrigin: {
|
|
322
|
-
vertical: "bottom",
|
|
323
|
-
horizontal: "left"
|
|
324
|
-
},
|
|
325
|
-
transformOrigin: {
|
|
326
|
-
vertical: "top",
|
|
327
|
-
horizontal: "left"
|
|
328
|
-
},
|
|
329
|
-
slotProps: {
|
|
330
|
-
paper: {
|
|
331
|
-
sx: {
|
|
332
|
-
minWidth: {
|
|
333
|
-
xs: 0,
|
|
334
|
-
md: 320
|
|
335
|
-
},
|
|
336
|
-
maxHeight: 450,
|
|
337
|
-
p: {
|
|
338
|
-
xs: 1,
|
|
339
|
-
md: 3
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
children: sourceDataPopover.data && /* @__PURE__ */ jsx(SourceDataViewer, { data: sourceDataPopover.data, showGroups: true })
|
|
345
|
-
}
|
|
346
328
|
)
|
|
347
329
|
] });
|
|
348
330
|
});
|
package/es/locales/en.js
CHANGED
|
@@ -12,6 +12,7 @@ export default flat({
|
|
|
12
12
|
options: "Options",
|
|
13
13
|
advanced: "Advanced options",
|
|
14
14
|
login: "Login to access this page",
|
|
15
|
+
accessDenied: "You do not have permission to access other customer data",
|
|
15
16
|
settings: "Settings",
|
|
16
17
|
preview: "Preview",
|
|
17
18
|
required: "Required",
|
|
@@ -55,6 +56,21 @@ export default flat({
|
|
|
55
56
|
stakeTxHash: "Stake Transaction",
|
|
56
57
|
slashTxHash: "Slash Transaction",
|
|
57
58
|
transferTxHash: "Transfer Transaction",
|
|
59
|
+
mintTxHash: "Mint Transaction",
|
|
60
|
+
pending: "Pending",
|
|
61
|
+
failed: "Failed",
|
|
62
|
+
completed: "Completed",
|
|
63
|
+
creditTransaction: "Credit Transaction",
|
|
64
|
+
creditAmount: "Credit Amount",
|
|
65
|
+
remainingBalance: "Remaining Balance",
|
|
66
|
+
transferStatus: "Transaction Status",
|
|
67
|
+
sourceData: "Source Data",
|
|
68
|
+
viewGrant: "View Grant",
|
|
69
|
+
viewSubscription: "View Subscription",
|
|
70
|
+
view: "View",
|
|
71
|
+
meterEvent: "Meter Event",
|
|
72
|
+
source: "Source",
|
|
73
|
+
viewDetail: "View Detail",
|
|
58
74
|
customer: "Customer",
|
|
59
75
|
currency: "Currency",
|
|
60
76
|
custom: "Custom",
|
|
@@ -235,10 +251,10 @@ export default flat({
|
|
|
235
251
|
},
|
|
236
252
|
credit: {
|
|
237
253
|
normal: {
|
|
238
|
-
oneTime: "
|
|
239
|
-
oneTimeWithExpiry: "
|
|
240
|
-
recurring: "
|
|
241
|
-
recurringWithExpiry: "
|
|
254
|
+
oneTime: "Top up {amount} {symbol} credit.",
|
|
255
|
+
oneTimeWithExpiry: "Top up {amount} {symbol} credit, valid for {duration} {unit}.",
|
|
256
|
+
recurring: "Top up {amount} {symbol} credit {period}.",
|
|
257
|
+
recurringWithExpiry: "Top up {amount} {symbol} credit {period}, valid for {duration} {unit}."
|
|
242
258
|
},
|
|
243
259
|
pending: {
|
|
244
260
|
notEnough: "Your outstanding balance is {amount} {symbol}. To settle it, a minimum purchase of {quantity} units is required.",
|
package/es/locales/zh.js
CHANGED
|
@@ -16,6 +16,7 @@ export default flat({
|
|
|
16
16
|
required: "\u5FC5\u586B",
|
|
17
17
|
setup: "\u8BBE\u7F6E",
|
|
18
18
|
login: "\u767B\u5F55\u4EE5\u8BBF\u95EE\u6B64\u9875\u9762",
|
|
19
|
+
accessDenied: "\u60A8\u65E0\u6743\u8BBF\u95EE\u5176\u4ED6\u5BA2\u6237\u7684\u6570\u636E",
|
|
19
20
|
amount: "\u91D1\u989D",
|
|
20
21
|
total: "\u603B\u8BA1",
|
|
21
22
|
subtotal: "\u5C0F\u8BA1",
|
|
@@ -55,6 +56,21 @@ export default flat({
|
|
|
55
56
|
stakeTxHash: "\u8D28\u62BC\u4EA4\u6613",
|
|
56
57
|
slashTxHash: "\u7F5A\u6CA1\u4EA4\u6613",
|
|
57
58
|
transferTxHash: "\u6263\u6B3E\u4EA4\u6613",
|
|
59
|
+
mintTxHash: "\u94F8\u9020\u4EA4\u6613",
|
|
60
|
+
pending: "\u5904\u7406\u4E2D",
|
|
61
|
+
failed: "\u5931\u8D25",
|
|
62
|
+
completed: "\u5DF2\u5B8C\u6210",
|
|
63
|
+
creditTransaction: "\u4FE1\u7528\u4EA4\u6613",
|
|
64
|
+
creditAmount: "\u4FE1\u7528\u989D\u5EA6",
|
|
65
|
+
remainingBalance: "\u5269\u4F59\u4F59\u989D",
|
|
66
|
+
transferStatus: "\u4EA4\u6613\u72B6\u6001",
|
|
67
|
+
sourceData: "\u6E90\u6570\u636E",
|
|
68
|
+
viewGrant: "\u67E5\u770B\u989D\u5EA6",
|
|
69
|
+
viewSubscription: "\u67E5\u770B\u8BA2\u9605",
|
|
70
|
+
view: "\u67E5\u770B",
|
|
71
|
+
meterEvent: "\u8BA1\u91CF\u4E8B\u4EF6",
|
|
72
|
+
source: "\u6765\u6E90",
|
|
73
|
+
viewDetail: "\u67E5\u770B\u8BE6\u60C5",
|
|
58
74
|
customer: "\u5BA2\u6237",
|
|
59
75
|
currency: "\u5E01\u79CD",
|
|
60
76
|
custom: "\u81EA\u5B9A\u4E49",
|
|
@@ -272,10 +288,10 @@ export default flat({
|
|
|
272
288
|
},
|
|
273
289
|
credit: {
|
|
274
290
|
normal: {
|
|
275
|
-
oneTime: "\
|
|
276
|
-
oneTimeWithExpiry: "\
|
|
277
|
-
recurring: "
|
|
278
|
-
recurringWithExpiry: "
|
|
291
|
+
oneTime: "\u5145\u503C {amount} {symbol} \u989D\u5EA6\u3002",
|
|
292
|
+
oneTimeWithExpiry: "\u5145\u503C {amount} {symbol} \u989D\u5EA6\uFF0C\u6709\u6548\u671F {duration} {unit}\u3002",
|
|
293
|
+
recurring: "{period}\u5145\u503C {amount} {symbol} \u989D\u5EA6\u3002",
|
|
294
|
+
recurringWithExpiry: "{period}\u5145\u503C {amount} {symbol} \u989D\u5EA6\uFF0C\u6709\u6548\u671F {duration} {unit}\u3002"
|
|
279
295
|
},
|
|
280
296
|
pending: {
|
|
281
297
|
notEnough: "\u60A8\u5F53\u524D\u6B20\u8D39 {amount} {symbol}\uFF0C\u81F3\u5C11\u9700\u8981\u8D2D\u4E70 {quantity} \u6570\u91CF\u3002",
|
|
@@ -18,7 +18,6 @@ var _payment = require("../../contexts/payment");
|
|
|
18
18
|
var _api = _interopRequireDefault(require("../../libs/api"));
|
|
19
19
|
var _table = _interopRequireDefault(require("../../components/table"));
|
|
20
20
|
var _navigation = require("../../libs/navigation");
|
|
21
|
-
var _sourceDataViewer = _interopRequireDefault(require("../../components/source-data-viewer"));
|
|
22
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
22
|
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); }
|
|
24
23
|
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; }
|
|
@@ -51,6 +50,16 @@ const getInvoiceDetailLink = (invoiceId, inDashboard) => {
|
|
|
51
50
|
connect: false
|
|
52
51
|
};
|
|
53
52
|
};
|
|
53
|
+
const getTransactionDetailLink = (transactionId, inDashboard) => {
|
|
54
|
+
let path = `/customer/credit-transaction/${transactionId}`;
|
|
55
|
+
if (inDashboard) {
|
|
56
|
+
path = `/admin/customers/${transactionId}`;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
link: (0, _navigation.createLink)(path),
|
|
60
|
+
connect: false
|
|
61
|
+
};
|
|
62
|
+
};
|
|
54
63
|
const TransactionsTable = _react.default.memo(props => {
|
|
55
64
|
const {
|
|
56
65
|
pageSize,
|
|
@@ -83,10 +92,6 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
83
92
|
start: void 0,
|
|
84
93
|
end: void 0
|
|
85
94
|
});
|
|
86
|
-
const [sourceDataPopover, setSourceDataPopover] = (0, _react.useState)({
|
|
87
|
-
anchorEl: null,
|
|
88
|
-
data: null
|
|
89
|
-
});
|
|
90
95
|
const handleDateRangeChange = (0, _react.useCallback)(newValue => {
|
|
91
96
|
setFilters(newValue);
|
|
92
97
|
setSearch(prev => ({
|
|
@@ -124,6 +129,23 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
124
129
|
prevData.current = data;
|
|
125
130
|
}
|
|
126
131
|
}, [data]);
|
|
132
|
+
const handleTransactionClick = (e, item) => {
|
|
133
|
+
if (item.activity_type === "grant") {
|
|
134
|
+
const {
|
|
135
|
+
link
|
|
136
|
+
} = getGrantDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
137
|
+
(0, _navigation.handleNavigation)(e, link, navigate, {
|
|
138
|
+
target: link.external ? "_blank" : "_self"
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
const {
|
|
142
|
+
link
|
|
143
|
+
} = getTransactionDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
144
|
+
(0, _navigation.handleNavigation)(e, link, navigate, {
|
|
145
|
+
target: link.external ? "_blank" : "_self"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
127
149
|
const columns = [{
|
|
128
150
|
label: t("common.amount"),
|
|
129
151
|
name: "credit_amount",
|
|
@@ -137,15 +159,21 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
137
159
|
const unit = !isGrant && item.meter?.unit ? item.meter.unit : currency?.symbol;
|
|
138
160
|
const displayAmount = (0, _util.formatBNStr)(amount, currency?.decimal || 0);
|
|
139
161
|
if (!includeGrants) {
|
|
140
|
-
return /* @__PURE__ */(0, _jsxRuntime.
|
|
141
|
-
|
|
162
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
163
|
+
onClick: e => handleTransactionClick(e, item),
|
|
164
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
165
|
+
children: [displayAmount, " ", unit]
|
|
166
|
+
})
|
|
142
167
|
});
|
|
143
168
|
}
|
|
144
|
-
return /* @__PURE__ */(0, _jsxRuntime.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
169
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
170
|
+
onClick: e => handleTransactionClick(e, item),
|
|
171
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
172
|
+
sx: {
|
|
173
|
+
color: isGrant ? "success.main" : "error.main"
|
|
174
|
+
},
|
|
175
|
+
children: [isGrant ? "+" : "-", " ", displayAmount, " ", unit]
|
|
176
|
+
})
|
|
149
177
|
});
|
|
150
178
|
}
|
|
151
179
|
}
|
|
@@ -186,12 +214,15 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
186
214
|
const item = data?.list[index];
|
|
187
215
|
const isGrant = item.activity_type === "grant";
|
|
188
216
|
const description = isGrant ? item.name || item.description || "Credit Granted" : item.subscription?.description || item.description || `${item.meter_event_name} usage`;
|
|
189
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
217
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
218
|
+
onClick: e => handleTransactionClick(e, item),
|
|
219
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
220
|
+
variant: "body2",
|
|
221
|
+
sx: {
|
|
222
|
+
fontWeight: 400
|
|
223
|
+
},
|
|
224
|
+
children: description
|
|
225
|
+
})
|
|
195
226
|
});
|
|
196
227
|
}
|
|
197
228
|
}
|
|
@@ -225,13 +256,16 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
225
256
|
options: {
|
|
226
257
|
customBodyRenderLite: (_, index) => {
|
|
227
258
|
const item = data?.list[index];
|
|
228
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
259
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
260
|
+
onClick: e => handleTransactionClick(e, item),
|
|
261
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
262
|
+
variant: "body2",
|
|
263
|
+
sx: {
|
|
264
|
+
color: "text.secondary",
|
|
265
|
+
fontSize: "0.875rem"
|
|
266
|
+
},
|
|
267
|
+
children: (0, _util.formatToDate)(item.created_at, locale, "YYYY-MM-DD HH:mm")
|
|
268
|
+
})
|
|
235
269
|
});
|
|
236
270
|
}
|
|
237
271
|
}
|
|
@@ -243,7 +277,6 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
243
277
|
const item = data?.list[index];
|
|
244
278
|
const isGrant = item.activity_type === "grant";
|
|
245
279
|
const invoiceId = isGrant ? item.metadata?.invoice_id : null;
|
|
246
|
-
const sourceData = !isGrant && item.meterEvent?.source_data;
|
|
247
280
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
248
281
|
sx: {
|
|
249
282
|
display: "flex",
|
|
@@ -260,18 +293,16 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
260
293
|
(0, _navigation.handleNavigation)(e, link.link, navigate);
|
|
261
294
|
},
|
|
262
295
|
children: t("common.viewInvoice")
|
|
263
|
-
}),
|
|
296
|
+
}), !isGrant && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
264
297
|
variant: "text",
|
|
265
298
|
size: "small",
|
|
266
299
|
color: "primary",
|
|
267
300
|
onClick: e => {
|
|
268
301
|
e.preventDefault();
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
data: sourceData
|
|
272
|
-
});
|
|
302
|
+
const link = getTransactionDetailLink(item.id, isAdmin && mode === "dashboard");
|
|
303
|
+
(0, _navigation.handleNavigation)(e, link.link, navigate);
|
|
273
304
|
},
|
|
274
|
-
children: t("common.
|
|
305
|
+
children: t("common.viewDetail")
|
|
275
306
|
})]
|
|
276
307
|
});
|
|
277
308
|
}
|
|
@@ -344,40 +375,6 @@ const TransactionsTable = _react.default.memo(props => {
|
|
|
344
375
|
showMobile: false,
|
|
345
376
|
mobileTDFlexDirection: "row",
|
|
346
377
|
emptyNodeText: t("admin.creditTransactions.noTransactions")
|
|
347
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
348
|
-
open: Boolean(sourceDataPopover.anchorEl),
|
|
349
|
-
anchorEl: sourceDataPopover.anchorEl,
|
|
350
|
-
onClose: () => setSourceDataPopover({
|
|
351
|
-
anchorEl: null,
|
|
352
|
-
data: null
|
|
353
|
-
}),
|
|
354
|
-
anchorOrigin: {
|
|
355
|
-
vertical: "bottom",
|
|
356
|
-
horizontal: "left"
|
|
357
|
-
},
|
|
358
|
-
transformOrigin: {
|
|
359
|
-
vertical: "top",
|
|
360
|
-
horizontal: "left"
|
|
361
|
-
},
|
|
362
|
-
slotProps: {
|
|
363
|
-
paper: {
|
|
364
|
-
sx: {
|
|
365
|
-
minWidth: {
|
|
366
|
-
xs: 0,
|
|
367
|
-
md: 320
|
|
368
|
-
},
|
|
369
|
-
maxHeight: 450,
|
|
370
|
-
p: {
|
|
371
|
-
xs: 1,
|
|
372
|
-
md: 3
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
children: sourceDataPopover.data && /* @__PURE__ */(0, _jsxRuntime.jsx)(_sourceDataViewer.default, {
|
|
378
|
-
data: sourceDataPopover.data,
|
|
379
|
-
showGroups: true
|
|
380
|
-
})
|
|
381
378
|
})]
|
|
382
379
|
});
|
|
383
380
|
});
|
package/lib/locales/en.js
CHANGED
|
@@ -19,6 +19,7 @@ module.exports = (0, _flat.default)({
|
|
|
19
19
|
options: "Options",
|
|
20
20
|
advanced: "Advanced options",
|
|
21
21
|
login: "Login to access this page",
|
|
22
|
+
accessDenied: "You do not have permission to access other customer data",
|
|
22
23
|
settings: "Settings",
|
|
23
24
|
preview: "Preview",
|
|
24
25
|
required: "Required",
|
|
@@ -62,6 +63,21 @@ module.exports = (0, _flat.default)({
|
|
|
62
63
|
stakeTxHash: "Stake Transaction",
|
|
63
64
|
slashTxHash: "Slash Transaction",
|
|
64
65
|
transferTxHash: "Transfer Transaction",
|
|
66
|
+
mintTxHash: "Mint Transaction",
|
|
67
|
+
pending: "Pending",
|
|
68
|
+
failed: "Failed",
|
|
69
|
+
completed: "Completed",
|
|
70
|
+
creditTransaction: "Credit Transaction",
|
|
71
|
+
creditAmount: "Credit Amount",
|
|
72
|
+
remainingBalance: "Remaining Balance",
|
|
73
|
+
transferStatus: "Transaction Status",
|
|
74
|
+
sourceData: "Source Data",
|
|
75
|
+
viewGrant: "View Grant",
|
|
76
|
+
viewSubscription: "View Subscription",
|
|
77
|
+
view: "View",
|
|
78
|
+
meterEvent: "Meter Event",
|
|
79
|
+
source: "Source",
|
|
80
|
+
viewDetail: "View Detail",
|
|
65
81
|
customer: "Customer",
|
|
66
82
|
currency: "Currency",
|
|
67
83
|
custom: "Custom",
|
|
@@ -242,10 +258,10 @@ module.exports = (0, _flat.default)({
|
|
|
242
258
|
},
|
|
243
259
|
credit: {
|
|
244
260
|
normal: {
|
|
245
|
-
oneTime: "
|
|
246
|
-
oneTimeWithExpiry: "
|
|
247
|
-
recurring: "
|
|
248
|
-
recurringWithExpiry: "
|
|
261
|
+
oneTime: "Top up {amount} {symbol} credit.",
|
|
262
|
+
oneTimeWithExpiry: "Top up {amount} {symbol} credit, valid for {duration} {unit}.",
|
|
263
|
+
recurring: "Top up {amount} {symbol} credit {period}.",
|
|
264
|
+
recurringWithExpiry: "Top up {amount} {symbol} credit {period}, valid for {duration} {unit}."
|
|
249
265
|
},
|
|
250
266
|
pending: {
|
|
251
267
|
notEnough: "Your outstanding balance is {amount} {symbol}. To settle it, a minimum purchase of {quantity} units is required.",
|
package/lib/locales/zh.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = (0, _flat.default)({
|
|
|
23
23
|
required: "\u5FC5\u586B",
|
|
24
24
|
setup: "\u8BBE\u7F6E",
|
|
25
25
|
login: "\u767B\u5F55\u4EE5\u8BBF\u95EE\u6B64\u9875\u9762",
|
|
26
|
+
accessDenied: "\u60A8\u65E0\u6743\u8BBF\u95EE\u5176\u4ED6\u5BA2\u6237\u7684\u6570\u636E",
|
|
26
27
|
amount: "\u91D1\u989D",
|
|
27
28
|
total: "\u603B\u8BA1",
|
|
28
29
|
subtotal: "\u5C0F\u8BA1",
|
|
@@ -62,6 +63,21 @@ module.exports = (0, _flat.default)({
|
|
|
62
63
|
stakeTxHash: "\u8D28\u62BC\u4EA4\u6613",
|
|
63
64
|
slashTxHash: "\u7F5A\u6CA1\u4EA4\u6613",
|
|
64
65
|
transferTxHash: "\u6263\u6B3E\u4EA4\u6613",
|
|
66
|
+
mintTxHash: "\u94F8\u9020\u4EA4\u6613",
|
|
67
|
+
pending: "\u5904\u7406\u4E2D",
|
|
68
|
+
failed: "\u5931\u8D25",
|
|
69
|
+
completed: "\u5DF2\u5B8C\u6210",
|
|
70
|
+
creditTransaction: "\u4FE1\u7528\u4EA4\u6613",
|
|
71
|
+
creditAmount: "\u4FE1\u7528\u989D\u5EA6",
|
|
72
|
+
remainingBalance: "\u5269\u4F59\u4F59\u989D",
|
|
73
|
+
transferStatus: "\u4EA4\u6613\u72B6\u6001",
|
|
74
|
+
sourceData: "\u6E90\u6570\u636E",
|
|
75
|
+
viewGrant: "\u67E5\u770B\u989D\u5EA6",
|
|
76
|
+
viewSubscription: "\u67E5\u770B\u8BA2\u9605",
|
|
77
|
+
view: "\u67E5\u770B",
|
|
78
|
+
meterEvent: "\u8BA1\u91CF\u4E8B\u4EF6",
|
|
79
|
+
source: "\u6765\u6E90",
|
|
80
|
+
viewDetail: "\u67E5\u770B\u8BE6\u60C5",
|
|
65
81
|
customer: "\u5BA2\u6237",
|
|
66
82
|
currency: "\u5E01\u79CD",
|
|
67
83
|
custom: "\u81EA\u5B9A\u4E49",
|
|
@@ -279,10 +295,10 @@ module.exports = (0, _flat.default)({
|
|
|
279
295
|
},
|
|
280
296
|
credit: {
|
|
281
297
|
normal: {
|
|
282
|
-
oneTime: "\
|
|
283
|
-
oneTimeWithExpiry: "\
|
|
284
|
-
recurring: "
|
|
285
|
-
recurringWithExpiry: "
|
|
298
|
+
oneTime: "\u5145\u503C {amount} {symbol} \u989D\u5EA6\u3002",
|
|
299
|
+
oneTimeWithExpiry: "\u5145\u503C {amount} {symbol} \u989D\u5EA6\uFF0C\u6709\u6548\u671F {duration} {unit}\u3002",
|
|
300
|
+
recurring: "{period}\u5145\u503C {amount} {symbol} \u989D\u5EA6\u3002",
|
|
301
|
+
recurringWithExpiry: "{period}\u5145\u503C {amount} {symbol} \u989D\u5EA6\uFF0C\u6709\u6548\u671F {duration} {unit}\u3002"
|
|
286
302
|
},
|
|
287
303
|
pending: {
|
|
288
304
|
notEnough: "\u60A8\u5F53\u524D\u6B20\u8D39 {amount} {symbol}\uFF0C\u81F3\u5C11\u9700\u8981\u8D2D\u4E70 {quantity} \u6570\u91CF\u3002",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.1",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@babel/core": "^7.27.4",
|
|
97
97
|
"@babel/preset-env": "^7.27.2",
|
|
98
98
|
"@babel/preset-react": "^7.27.1",
|
|
99
|
-
"@blocklet/payment-types": "1.
|
|
99
|
+
"@blocklet/payment-types": "1.23.1",
|
|
100
100
|
"@storybook/addon-essentials": "^7.6.20",
|
|
101
101
|
"@storybook/addon-interactions": "^7.6.20",
|
|
102
102
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"vite-plugin-babel": "^1.3.1",
|
|
128
128
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "393e83d16adecbe9aa9d145732c45b2198a2e8b9"
|
|
131
131
|
}
|