@blocklet/payment-react 1.23.0 → 1.23.2
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 +16 -0
- package/es/locales/zh.js +16 -0
- package/lib/history/credit/transactions-list.js +63 -66
- package/lib/locales/en.js +16 -0
- package/lib/locales/zh.js +16 -0
- package/package.json +9 -9
- package/src/history/credit/transactions-list.tsx +54 -64
- package/src/locales/en.tsx +16 -0
- package/src/locales/zh.tsx +16 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/* eslint-disable react/no-unstable-nested-components */
|
|
7
7
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
8
8
|
import type { Paginated, TCreditTransactionExpanded } from '@blocklet/payment-types';
|
|
9
|
-
import { Box, Typography, Grid, Stack, Link, Button
|
|
9
|
+
import { Box, Typography, Grid, Stack, Link, Button } from '@mui/material';
|
|
10
10
|
import { useRequest } from 'ahooks';
|
|
11
11
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
12
12
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -21,7 +21,6 @@ import { usePaymentContext } from '../../contexts/payment';
|
|
|
21
21
|
import api from '../../libs/api';
|
|
22
22
|
import Table from '../../components/table';
|
|
23
23
|
import { createLink, handleNavigation } from '../../libs/navigation';
|
|
24
|
-
import SourceDataViewer from '../../components/source-data-viewer';
|
|
25
24
|
|
|
26
25
|
type Result = Paginated<TCreditTransactionExpanded>;
|
|
27
26
|
|
|
@@ -73,6 +72,18 @@ const getInvoiceDetailLink = (invoiceId: string, inDashboard: boolean) => {
|
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
|
|
75
|
+
const getTransactionDetailLink = (transactionId: string, inDashboard: boolean) => {
|
|
76
|
+
let path = `/customer/credit-transaction/${transactionId}`;
|
|
77
|
+
if (inDashboard) {
|
|
78
|
+
path = `/admin/customers/${transactionId}`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
link: createLink(path),
|
|
83
|
+
connect: false,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
76
87
|
const TransactionsTable = React.memo((props: Props) => {
|
|
77
88
|
const {
|
|
78
89
|
pageSize,
|
|
@@ -110,12 +121,6 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
110
121
|
end: undefined,
|
|
111
122
|
});
|
|
112
123
|
|
|
113
|
-
// Source Data Popover state
|
|
114
|
-
const [sourceDataPopover, setSourceDataPopover] = useState<{
|
|
115
|
-
anchorEl: HTMLElement | null;
|
|
116
|
-
data: any;
|
|
117
|
-
}>({ anchorEl: null, data: null });
|
|
118
|
-
|
|
119
124
|
const handleDateRangeChange = useCallback((newValue: DateRangeValue) => {
|
|
120
125
|
setFilters(newValue);
|
|
121
126
|
setSearch((prev) => ({
|
|
@@ -158,6 +163,15 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
158
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
164
|
}, [data]);
|
|
160
165
|
|
|
166
|
+
const handleTransactionClick = (e: React.MouseEvent, item: any) => {
|
|
167
|
+
if (item.activity_type === 'grant') {
|
|
168
|
+
const { link } = getGrantDetailLink(item.id, isAdmin && mode === 'dashboard');
|
|
169
|
+
handleNavigation(e, link, navigate, { target: link.external ? '_blank' : '_self' });
|
|
170
|
+
} else {
|
|
171
|
+
const { link } = getTransactionDetailLink(item.id, isAdmin && mode === 'dashboard');
|
|
172
|
+
handleNavigation(e, link, navigate, { target: link.external ? '_blank' : '_self' });
|
|
173
|
+
}
|
|
174
|
+
};
|
|
161
175
|
const columns = [
|
|
162
176
|
{
|
|
163
177
|
label: t('common.amount'),
|
|
@@ -174,19 +188,23 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
174
188
|
|
|
175
189
|
if (!includeGrants) {
|
|
176
190
|
return (
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
191
|
+
<Box onClick={(e) => handleTransactionClick(e, item)}>
|
|
192
|
+
<Typography>
|
|
193
|
+
{displayAmount} {unit}
|
|
194
|
+
</Typography>
|
|
195
|
+
</Box>
|
|
180
196
|
);
|
|
181
197
|
}
|
|
182
198
|
|
|
183
199
|
return (
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
<Box onClick={(e) => handleTransactionClick(e, item)}>
|
|
201
|
+
<Typography
|
|
202
|
+
sx={{
|
|
203
|
+
color: isGrant ? 'success.main' : 'error.main',
|
|
204
|
+
}}>
|
|
205
|
+
{isGrant ? '+' : '-'} {displayAmount} {unit}
|
|
206
|
+
</Typography>
|
|
207
|
+
</Box>
|
|
190
208
|
);
|
|
191
209
|
},
|
|
192
210
|
},
|
|
@@ -232,9 +250,11 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
232
250
|
: item.subscription?.description || item.description || `${item.meter_event_name} usage`;
|
|
233
251
|
|
|
234
252
|
return (
|
|
235
|
-
<
|
|
236
|
-
{
|
|
237
|
-
|
|
253
|
+
<Box onClick={(e) => handleTransactionClick(e, item)}>
|
|
254
|
+
<Typography variant="body2" sx={{ fontWeight: 400 }}>
|
|
255
|
+
{description}
|
|
256
|
+
</Typography>
|
|
257
|
+
</Box>
|
|
238
258
|
);
|
|
239
259
|
},
|
|
240
260
|
},
|
|
@@ -269,14 +289,16 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
269
289
|
customBodyRenderLite: (_: string, index: number) => {
|
|
270
290
|
const item = data?.list[index] as any;
|
|
271
291
|
return (
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
292
|
+
<Box onClick={(e) => handleTransactionClick(e, item)}>
|
|
293
|
+
<Typography
|
|
294
|
+
variant="body2"
|
|
295
|
+
sx={{
|
|
296
|
+
color: 'text.secondary',
|
|
297
|
+
fontSize: '0.875rem',
|
|
298
|
+
}}>
|
|
299
|
+
{formatToDate(item.created_at, locale, 'YYYY-MM-DD HH:mm')}
|
|
300
|
+
</Typography>
|
|
301
|
+
</Box>
|
|
280
302
|
);
|
|
281
303
|
},
|
|
282
304
|
},
|
|
@@ -289,7 +311,6 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
289
311
|
const item = data?.list[index] as any;
|
|
290
312
|
const isGrant = item.activity_type === 'grant';
|
|
291
313
|
const invoiceId = isGrant ? item.metadata?.invoice_id : null;
|
|
292
|
-
const sourceData = !isGrant && item.meterEvent?.source_data;
|
|
293
314
|
|
|
294
315
|
return (
|
|
295
316
|
<Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}>
|
|
@@ -306,19 +327,17 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
306
327
|
{t('common.viewInvoice')}
|
|
307
328
|
</Button>
|
|
308
329
|
)}
|
|
309
|
-
{
|
|
330
|
+
{!isGrant && (
|
|
310
331
|
<Button
|
|
311
332
|
variant="text"
|
|
312
333
|
size="small"
|
|
313
334
|
color="primary"
|
|
314
335
|
onClick={(e) => {
|
|
315
336
|
e.preventDefault();
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
data: sourceData,
|
|
319
|
-
});
|
|
337
|
+
const link = getTransactionDetailLink(item.id, isAdmin && mode === 'dashboard');
|
|
338
|
+
handleNavigation(e, link.link, navigate);
|
|
320
339
|
}}>
|
|
321
|
-
{t('common.
|
|
340
|
+
{t('common.viewDetail')}
|
|
322
341
|
</Button>
|
|
323
342
|
)}
|
|
324
343
|
</Box>
|
|
@@ -378,35 +397,6 @@ const TransactionsTable = React.memo((props: Props) => {
|
|
|
378
397
|
mobileTDFlexDirection="row"
|
|
379
398
|
emptyNodeText={t('admin.creditTransactions.noTransactions')}
|
|
380
399
|
/>
|
|
381
|
-
<Popover
|
|
382
|
-
open={Boolean(sourceDataPopover.anchorEl)}
|
|
383
|
-
anchorEl={sourceDataPopover.anchorEl}
|
|
384
|
-
onClose={() => setSourceDataPopover({ anchorEl: null, data: null })}
|
|
385
|
-
anchorOrigin={{
|
|
386
|
-
vertical: 'bottom',
|
|
387
|
-
horizontal: 'left',
|
|
388
|
-
}}
|
|
389
|
-
transformOrigin={{
|
|
390
|
-
vertical: 'top',
|
|
391
|
-
horizontal: 'left',
|
|
392
|
-
}}
|
|
393
|
-
slotProps={{
|
|
394
|
-
paper: {
|
|
395
|
-
sx: {
|
|
396
|
-
minWidth: {
|
|
397
|
-
xs: 0,
|
|
398
|
-
md: 320,
|
|
399
|
-
},
|
|
400
|
-
maxHeight: 450,
|
|
401
|
-
p: {
|
|
402
|
-
xs: 1,
|
|
403
|
-
md: 3,
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
},
|
|
407
|
-
}}>
|
|
408
|
-
{sourceDataPopover.data && <SourceDataViewer data={sourceDataPopover.data} showGroups />}
|
|
409
|
-
</Popover>
|
|
410
400
|
</TableRoot>
|
|
411
401
|
);
|
|
412
402
|
});
|
package/src/locales/en.tsx
CHANGED
|
@@ -14,6 +14,7 @@ export default flat({
|
|
|
14
14
|
options: 'Options',
|
|
15
15
|
advanced: 'Advanced options',
|
|
16
16
|
login: 'Login to access this page',
|
|
17
|
+
accessDenied: 'You do not have permission to access other customer data',
|
|
17
18
|
settings: 'Settings',
|
|
18
19
|
preview: 'Preview',
|
|
19
20
|
required: 'Required',
|
|
@@ -57,6 +58,21 @@ export default flat({
|
|
|
57
58
|
stakeTxHash: 'Stake Transaction',
|
|
58
59
|
slashTxHash: 'Slash Transaction',
|
|
59
60
|
transferTxHash: 'Transfer Transaction',
|
|
61
|
+
mintTxHash: 'Mint Transaction',
|
|
62
|
+
pending: 'Pending',
|
|
63
|
+
failed: 'Failed',
|
|
64
|
+
completed: 'Completed',
|
|
65
|
+
creditTransaction: 'Credit Transaction',
|
|
66
|
+
creditAmount: 'Credit Amount',
|
|
67
|
+
remainingBalance: 'Remaining Balance',
|
|
68
|
+
transferStatus: 'Transaction Status',
|
|
69
|
+
sourceData: 'Source Data',
|
|
70
|
+
viewGrant: 'View Grant',
|
|
71
|
+
viewSubscription: 'View Subscription',
|
|
72
|
+
view: 'View',
|
|
73
|
+
meterEvent: 'Meter Event',
|
|
74
|
+
source: 'Source',
|
|
75
|
+
viewDetail: 'View Detail',
|
|
60
76
|
customer: 'Customer',
|
|
61
77
|
currency: 'Currency',
|
|
62
78
|
custom: 'Custom',
|
package/src/locales/zh.tsx
CHANGED
|
@@ -18,6 +18,7 @@ export default flat({
|
|
|
18
18
|
required: '必填',
|
|
19
19
|
setup: '设置',
|
|
20
20
|
login: '登录以访问此页面',
|
|
21
|
+
accessDenied: '您无权访问其他客户的数据',
|
|
21
22
|
amount: '金额',
|
|
22
23
|
total: '总计',
|
|
23
24
|
subtotal: '小计',
|
|
@@ -57,6 +58,21 @@ export default flat({
|
|
|
57
58
|
stakeTxHash: '质押交易',
|
|
58
59
|
slashTxHash: '罚没交易',
|
|
59
60
|
transferTxHash: '扣款交易',
|
|
61
|
+
mintTxHash: '铸造交易',
|
|
62
|
+
pending: '处理中',
|
|
63
|
+
failed: '失败',
|
|
64
|
+
completed: '已完成',
|
|
65
|
+
creditTransaction: '信用交易',
|
|
66
|
+
creditAmount: '信用额度',
|
|
67
|
+
remainingBalance: '剩余余额',
|
|
68
|
+
transferStatus: '交易状态',
|
|
69
|
+
sourceData: '源数据',
|
|
70
|
+
viewGrant: '查看额度',
|
|
71
|
+
viewSubscription: '查看订阅',
|
|
72
|
+
view: '查看',
|
|
73
|
+
meterEvent: '计量事件',
|
|
74
|
+
source: '来源',
|
|
75
|
+
viewDetail: '查看详情',
|
|
60
76
|
customer: '客户',
|
|
61
77
|
currency: '币种',
|
|
62
78
|
custom: '自定义',
|