payment-kit 1.14.3 → 1.14.4
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/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@arcblock/validator": "^1.18.124",
|
|
53
53
|
"@blocklet/js-sdk": "1.16.28",
|
|
54
54
|
"@blocklet/logger": "1.16.28",
|
|
55
|
-
"@blocklet/payment-react": "1.14.
|
|
55
|
+
"@blocklet/payment-react": "1.14.4",
|
|
56
56
|
"@blocklet/sdk": "1.16.28",
|
|
57
57
|
"@blocklet/ui-react": "^2.10.3",
|
|
58
58
|
"@blocklet/uploader": "^0.1.20",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@abtnode/types": "1.16.28",
|
|
120
120
|
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
121
|
-
"@blocklet/payment-types": "1.14.
|
|
121
|
+
"@blocklet/payment-types": "1.14.4",
|
|
122
122
|
"@types/cookie-parser": "^1.4.7",
|
|
123
123
|
"@types/cors": "^2.8.17",
|
|
124
124
|
"@types/debug": "^4.1.12",
|
|
@@ -160,5 +160,5 @@
|
|
|
160
160
|
"parser": "typescript"
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
|
-
"gitHead": "
|
|
163
|
+
"gitHead": "53bfd2bc1dd91c6369220db1040ab8e060e61104"
|
|
164
164
|
}
|
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
api,
|
|
6
6
|
formatBNStr,
|
|
7
7
|
formatError,
|
|
8
|
+
formatPrettyMsLocale,
|
|
8
9
|
formatSubscriptionProduct,
|
|
9
10
|
formatTime,
|
|
10
11
|
formatToDate,
|
|
12
|
+
formatToDatetime,
|
|
11
13
|
getDidConnectQueryParams,
|
|
12
14
|
getInvoiceStatusColor,
|
|
13
15
|
getPrefix,
|
|
@@ -25,11 +27,13 @@ import {
|
|
|
25
27
|
ListItem,
|
|
26
28
|
ListSubheader,
|
|
27
29
|
Stack,
|
|
30
|
+
Tooltip,
|
|
28
31
|
Typography,
|
|
29
32
|
} from '@mui/material';
|
|
30
33
|
import { useRequest } from 'ahooks';
|
|
31
34
|
import { useMemo } from 'react';
|
|
32
35
|
import { joinURL, withQuery } from 'ufo';
|
|
36
|
+
import prettyMs from 'pretty-ms-i18n';
|
|
33
37
|
|
|
34
38
|
const fetchInvoiceData = (params: Record<string, any> = {}): Promise<Paginated<TInvoiceExpanded>> => {
|
|
35
39
|
const search = new URLSearchParams();
|
|
@@ -112,7 +116,33 @@ export default function SubscriptionEmbed() {
|
|
|
112
116
|
},
|
|
113
117
|
];
|
|
114
118
|
|
|
115
|
-
if (subscription.status === '
|
|
119
|
+
if (subscription.status === 'trialing') {
|
|
120
|
+
const endTimestamp = subscription.current_period_end * 1000;
|
|
121
|
+
const remainingTime = endTimestamp - Date.now();
|
|
122
|
+
|
|
123
|
+
infoList.push({
|
|
124
|
+
name: t('payment.customer.subscriptions.trialLeft'),
|
|
125
|
+
value: (
|
|
126
|
+
<Typography
|
|
127
|
+
sx={{
|
|
128
|
+
color: 'success.main',
|
|
129
|
+
fontWeight: 'bold',
|
|
130
|
+
marginRight: '10px',
|
|
131
|
+
}}>
|
|
132
|
+
<Tooltip title={formatToDatetime(endTimestamp, locale)} placement="top-end" enterTouchDelay={0}>
|
|
133
|
+
<Typography component="span" sx={{ cursor: 'pointer' }}>
|
|
134
|
+
{prettyMs(remainingTime, {
|
|
135
|
+
locale: formatPrettyMsLocale(locale),
|
|
136
|
+
compact: true,
|
|
137
|
+
})}
|
|
138
|
+
</Typography>
|
|
139
|
+
</Tooltip>
|
|
140
|
+
</Typography>
|
|
141
|
+
),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (subscription.status === 'active') {
|
|
116
146
|
infoList.push({
|
|
117
147
|
name: t('payment.customer.subscriptions.nextInvoice'),
|
|
118
148
|
value: (
|