@blocklet/payment-react 1.13.234 → 1.13.236

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.
@@ -54,7 +54,7 @@ export default function CustomerInvoiceList({
54
54
  target,
55
55
  action
56
56
  }) {
57
- const { t } = useLocaleContext();
57
+ const { t, locale } = useLocaleContext();
58
58
  const size = pageSize || 10;
59
59
  const { data, loadMore, loadingMore, loading } = useInfiniteScroll(
60
60
  (d) => {
@@ -100,20 +100,33 @@ export default function CustomerInvoiceList({
100
100
  sm: 1.5,
101
101
  md: 3
102
102
  },
103
+ alignItems: "center",
103
104
  flexWrap: "nowrap",
104
105
  children: [
105
106
  /* @__PURE__ */ jsx(Box, { flex: 2, children: /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
106
107
  /* @__PURE__ */ jsx(Typography, { component: "span", children: invoice.number }),
107
108
  link.external && /* @__PURE__ */ jsx(Hidden, { mdDown: true, children: /* @__PURE__ */ jsx(OpenInNewOutlined, { fontSize: "small", sx: { color: "text.secondary" } }) })
108
109
  ] }) }) }),
109
- /* @__PURE__ */ jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsx(Typography, { children: formatToDate(invoice.created_at, "en", "HH:mm:ss") }) }),
110
110
  /* @__PURE__ */ jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsxs(Typography, { children: [
111
111
  formatBNStr(invoice.total, invoice.paymentCurrency.decimal),
112
112
  "\xA0",
113
113
  invoice.paymentCurrency.symbol
114
114
  ] }) }),
115
- /* @__PURE__ */ jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsx(Status, { label: invoice.status, color: getInvoiceStatusColor(invoice.status) }) }),
116
- /* @__PURE__ */ jsx(Hidden, { mdDown: true, children: /* @__PURE__ */ jsx(Box, { flex: 2, className: "invoice-description", textAlign: "right", children: /* @__PURE__ */ jsx(Typography, { children: invoice.description || invoice.id }) }) })
115
+ /* @__PURE__ */ jsx(Box, { flex: 1, textAlign: "right", children: /* @__PURE__ */ jsx(Typography, { children: formatToDate(invoice.created_at, locale, "HH:mm:ss") }) }),
116
+ !action && /* @__PURE__ */ jsx(Hidden, { mdDown: true, children: /* @__PURE__ */ jsx(Box, { flex: 2, className: "invoice-description", textAlign: "right", children: /* @__PURE__ */ jsx(Typography, { children: invoice.description || invoice.id }) }) }),
117
+ /* @__PURE__ */ jsx(Box, { flex: 1, textAlign: "right", children: action ? /* @__PURE__ */ jsx(
118
+ Button,
119
+ {
120
+ component: "a",
121
+ variant: "contained",
122
+ color: "primary",
123
+ size: "small",
124
+ href: link.url,
125
+ target: link.external ? "_blank" : target,
126
+ rel: "noreferrer",
127
+ children: t("payment.customer.invoice.pay")
128
+ }
129
+ ) : /* @__PURE__ */ jsx(Status, { label: invoice.status, color: getInvoiceStatusColor(invoice.status) }) })
117
130
  ]
118
131
  },
119
132
  invoice.id
@@ -145,4 +158,8 @@ const Root = styled(Stack)`
145
158
  display: none !important;
146
159
  }
147
160
  }
161
+
162
+ a.MuiButton-root {
163
+ text-decoration: none !important;
164
+ }
148
165
  `;
@@ -19,10 +19,10 @@ import api from "../../api.js";
19
19
  import Status from "../../components/status.js";
20
20
  import {
21
21
  formatBNStr,
22
- formatDateTime,
23
22
  formatError,
24
23
  formatSubscriptionProduct,
25
24
  formatTime,
25
+ formatToDate,
26
26
  getInvoiceStatusColor,
27
27
  getPrefix,
28
28
  getSubscriptionStatusColor
@@ -118,14 +118,13 @@ export default function MiniInvoiceList() {
118
118
  /* @__PURE__ */ jsx(ListSubheader, { disableGutters: true, sx: { padding: 0 }, children: /* @__PURE__ */ jsx(Typography, { component: "h2", variant: "h6", fontSize: "16px", children: t("payment.customer.invoices") }) }),
119
119
  invoices.length === 0 ? /* @__PURE__ */ jsx(Typography, { color: "text.secondary", children: t("payment.customer.invoice.empty") }) : invoices.map((item) => {
120
120
  return /* @__PURE__ */ jsxs(ListItem, { disableGutters: true, sx: { display: "flex", justifyContent: "space-between" }, children: [
121
- /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 3 }, children: formatDateTime(item.created_at, locale) }),
121
+ /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 3 }, children: formatToDate(item.created_at, locale, "YYYY-MM-DD") }),
122
122
  /* @__PURE__ */ jsxs(Typography, { component: "span", sx: { flex: 1, textAlign: "right" }, children: [
123
123
  formatBNStr(item.total, item.paymentCurrency.decimal),
124
124
  "\xA0",
125
125
  item.paymentCurrency.symbol
126
126
  ] }),
127
- /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 2, textAlign: "center" }, children: /* @__PURE__ */ jsx(Status, { label: item.status, color: getInvoiceStatusColor(item.status) }) }),
128
- /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 3 }, children: /* @__PURE__ */ jsx(Typography, { children: item.description || item.id }) })
127
+ /* @__PURE__ */ jsx(Typography, { component: "span", sx: { flex: 2, textAlign: "right" }, children: /* @__PURE__ */ jsx(Status, { label: item.status, color: getInvoiceStatusColor(item.status) }) })
129
128
  ] }, item.id);
130
129
  })
131
130
  ] }) }),
package/es/locales/en.js CHANGED
@@ -197,7 +197,7 @@ export default flat({
197
197
  pastDue: {
198
198
  button: "Pay",
199
199
  invoices: "Past Due Invoices",
200
- warning: "Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore.",
200
+ warning: "Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore. Please pay these invoices one by one.",
201
201
  alert: {
202
202
  title: "You have unpaid invoices",
203
203
  description: "Seems you have unpaid invoices from previous subscriptions, new purchases are not allowed unless you have paid all past due invoices.",
package/es/locales/zh.js CHANGED
@@ -197,7 +197,7 @@ export default flat({
197
197
  pastDue: {
198
198
  button: "\u7EED\u8D39",
199
199
  invoices: "\u6B20\u8D39\u5E10\u5355",
200
- warning: "\u8BF7\u5C3D\u5FEB\u652F\u4ED8\u6B20\u8D39\u8D26\u5355\uFF0C\u5426\u5219\u4F60\u5C06\u65E0\u6CD5\u7EE7\u7EED\u4F7F\u7528\u670D\u52A1\u6216\u8D2D\u4E70\u65B0\u670D\u52A1",
200
+ warning: "\u8BF7\u5C3D\u5FEB\u652F\u4ED8\u6B20\u8D39\u8D26\u5355\uFF0C\u5426\u5219\u4F60\u5C06\u65E0\u6CD5\u7EE7\u7EED\u4F7F\u7528\u670D\u52A1\u6216\u8D2D\u4E70\u65B0\u670D\u52A1\uFF0C\u8BF7\u9010\u4E2A\u6253\u5F00\u8D26\u5355\u8BE6\u60C5\u5E76\u5B8C\u6210\u652F\u4ED8",
201
201
  alert: {
202
202
  title: "\u4F60\u6709\u6B20\u8D39\u8D26\u5355",
203
203
  description: "\u770B\u8D77\u6765\u4F60\u6709\u6B20\u8D39\u7684\u8D26\u5355\uFF0C\u5728\u4F60\u652F\u4ED8\u6240\u6709\u6B20\u8D39\u8D26\u5355\u4E4B\u524D\uFF0C\u65B0\u7684\u8D2D\u4E70\u6216\u8005\u8BA2\u9605\u5C06\u88AB\u7981\u6B62\uFF0C\u8BF7\u4E0D\u8981\u8C03\u76AE\u3002",
@@ -58,7 +58,8 @@ function CustomerInvoiceList({
58
58
  action
59
59
  }) {
60
60
  const {
61
- t
61
+ t,
62
+ locale
62
63
  } = (0, _context.useLocaleContext)();
63
64
  const size = pageSize || 10;
64
65
  const {
@@ -133,6 +134,7 @@ function CustomerInvoiceList({
133
134
  sm: 1.5,
134
135
  md: 3
135
136
  },
137
+ alignItems: "center",
136
138
  flexWrap: "nowrap",
137
139
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
138
140
  flex: 2,
@@ -158,12 +160,6 @@ function CustomerInvoiceList({
158
160
  })]
159
161
  })
160
162
  })
161
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
162
- flex: 1,
163
- textAlign: "right",
164
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
165
- children: (0, _util.formatToDate)(invoice.created_at, "en", "HH:mm:ss")
166
- })
167
163
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
168
164
  flex: 1,
169
165
  textAlign: "right",
@@ -173,11 +169,10 @@ function CustomerInvoiceList({
173
169
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
174
170
  flex: 1,
175
171
  textAlign: "right",
176
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
177
- label: invoice.status,
178
- color: (0, _util.getInvoiceStatusColor)(invoice.status)
172
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
173
+ children: (0, _util.formatToDate)(invoice.created_at, locale, "HH:mm:ss")
179
174
  })
180
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Hidden, {
175
+ }), !action && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Hidden, {
181
176
  mdDown: true,
182
177
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
183
178
  flex: 2,
@@ -187,6 +182,22 @@ function CustomerInvoiceList({
187
182
  children: invoice.description || invoice.id
188
183
  })
189
184
  })
185
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
186
+ flex: 1,
187
+ textAlign: "right",
188
+ children: action ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
189
+ component: "a",
190
+ variant: "contained",
191
+ color: "primary",
192
+ size: "small",
193
+ href: link.url,
194
+ target: link.external ? "_blank" : target,
195
+ rel: "noreferrer",
196
+ children: t("payment.customer.invoice.pay")
197
+ }) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
198
+ label: invoice.status,
199
+ color: (0, _util.getInvoiceStatusColor)(invoice.status)
200
+ })
190
201
  })]
191
202
  }, invoice.id);
192
203
  })]
@@ -230,4 +241,8 @@ const Root = (0, _system.styled)(_material.Stack)`
230
241
  display: none !important;
231
242
  }
232
243
  }
244
+
245
+ a.MuiButton-root {
246
+ text-decoration: none !important;
247
+ }
233
248
  `;
@@ -176,7 +176,7 @@ function MiniInvoiceList() {
176
176
  sx: {
177
177
  flex: 3
178
178
  },
179
- children: (0, _util.formatDateTime)(item.created_at, locale)
179
+ children: (0, _util.formatToDate)(item.created_at, locale, "YYYY-MM-DD")
180
180
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
181
181
  component: "span",
182
182
  sx: {
@@ -188,20 +188,12 @@ function MiniInvoiceList() {
188
188
  component: "span",
189
189
  sx: {
190
190
  flex: 2,
191
- textAlign: "center"
191
+ textAlign: "right"
192
192
  },
193
193
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
194
194
  label: item.status,
195
195
  color: (0, _util.getInvoiceStatusColor)(item.status)
196
196
  })
197
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
198
- component: "span",
199
- sx: {
200
- flex: 3
201
- },
202
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
203
- children: item.description || item.id
204
- })
205
197
  })]
206
198
  }, item.id);
207
199
  })]
package/lib/locales/en.js CHANGED
@@ -204,7 +204,7 @@ module.exports = (0, _flat.default)({
204
204
  pastDue: {
205
205
  button: "Pay",
206
206
  invoices: "Past Due Invoices",
207
- warning: "Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore.",
207
+ warning: "Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore. Please pay these invoices one by one.",
208
208
  alert: {
209
209
  title: "You have unpaid invoices",
210
210
  description: "Seems you have unpaid invoices from previous subscriptions, new purchases are not allowed unless you have paid all past due invoices.",
package/lib/locales/zh.js CHANGED
@@ -204,7 +204,7 @@ module.exports = (0, _flat.default)({
204
204
  pastDue: {
205
205
  button: "\u7EED\u8D39",
206
206
  invoices: "\u6B20\u8D39\u5E10\u5355",
207
- warning: "\u8BF7\u5C3D\u5FEB\u652F\u4ED8\u6B20\u8D39\u8D26\u5355\uFF0C\u5426\u5219\u4F60\u5C06\u65E0\u6CD5\u7EE7\u7EED\u4F7F\u7528\u670D\u52A1\u6216\u8D2D\u4E70\u65B0\u670D\u52A1",
207
+ warning: "\u8BF7\u5C3D\u5FEB\u652F\u4ED8\u6B20\u8D39\u8D26\u5355\uFF0C\u5426\u5219\u4F60\u5C06\u65E0\u6CD5\u7EE7\u7EED\u4F7F\u7528\u670D\u52A1\u6216\u8D2D\u4E70\u65B0\u670D\u52A1\uFF0C\u8BF7\u9010\u4E2A\u6253\u5F00\u8D26\u5355\u8BE6\u60C5\u5E76\u5B8C\u6210\u652F\u4ED8",
208
208
  alert: {
209
209
  title: "\u4F60\u6709\u6B20\u8D39\u8D26\u5355",
210
210
  description: "\u770B\u8D77\u6765\u4F60\u6709\u6B20\u8D39\u7684\u8D26\u5355\uFF0C\u5728\u4F60\u652F\u4ED8\u6240\u6709\u6B20\u8D39\u8D26\u5355\u4E4B\u524D\uFF0C\u65B0\u7684\u8D2D\u4E70\u6216\u8005\u8BA2\u9605\u5C06\u88AB\u7981\u6B62\uFF0C\u8BF7\u4E0D\u8981\u8C03\u76AE\u3002",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.13.234",
3
+ "version": "1.13.236",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -52,8 +52,8 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@arcblock/did-connect": "^2.9.68",
56
- "@arcblock/ux": "^2.9.68",
55
+ "@arcblock/did-connect": "^2.9.71",
56
+ "@arcblock/ux": "^2.9.71",
57
57
  "@mui/icons-material": "^5.15.15",
58
58
  "@mui/lab": "^5.0.0-alpha.170",
59
59
  "@mui/material": "^5.15.15",
@@ -90,7 +90,7 @@
90
90
  "@babel/core": "^7.24.4",
91
91
  "@babel/preset-env": "^7.24.4",
92
92
  "@babel/preset-react": "^7.24.1",
93
- "@blocklet/payment-types": "1.13.234",
93
+ "@blocklet/payment-types": "1.13.236",
94
94
  "@storybook/addon-essentials": "^7.6.17",
95
95
  "@storybook/addon-interactions": "^7.6.17",
96
96
  "@storybook/addon-links": "^7.6.17",
@@ -119,5 +119,5 @@
119
119
  "vite-plugin-babel": "^1.2.0",
120
120
  "vite-plugin-node-polyfills": "^0.21.0"
121
121
  },
122
- "gitHead": "7b34eb52c3c96ab9124d80da66777fcd88f023ce"
122
+ "gitHead": "458c748371a1dac07c0aa9039fb71f6fcbb68e14"
123
123
  }
@@ -74,7 +74,7 @@ export default function CustomerInvoiceList({
74
74
  target,
75
75
  action,
76
76
  }: Props) {
77
- const { t } = useLocaleContext();
77
+ const { t, locale } = useLocaleContext();
78
78
  const size = pageSize || 10;
79
79
 
80
80
  const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Result>(
@@ -137,6 +137,7 @@ export default function CustomerInvoiceList({
137
137
  sm: 1.5,
138
138
  md: 3,
139
139
  }}
140
+ alignItems="center"
140
141
  flexWrap="nowrap">
141
142
  <Box flex={2}>
142
143
  <a href={link.url} target={link.external ? '_blank' : target} rel="noreferrer">
@@ -150,9 +151,6 @@ export default function CustomerInvoiceList({
150
151
  </Stack>
151
152
  </a>
152
153
  </Box>
153
- <Box flex={1} textAlign="right">
154
- <Typography>{formatToDate(invoice.created_at, 'en', 'HH:mm:ss')}</Typography>
155
- </Box>
156
154
  <Box flex={1} textAlign="right">
157
155
  <Typography>
158
156
  {formatBNStr(invoice.total, invoice.paymentCurrency.decimal)}&nbsp;
@@ -160,13 +158,31 @@ export default function CustomerInvoiceList({
160
158
  </Typography>
161
159
  </Box>
162
160
  <Box flex={1} textAlign="right">
163
- <Status label={invoice.status} color={getInvoiceStatusColor(invoice.status)} />
161
+ <Typography>{formatToDate(invoice.created_at, locale, 'HH:mm:ss')}</Typography>
162
+ </Box>
163
+ {!action && (
164
+ <Hidden mdDown>
165
+ <Box flex={2} className="invoice-description" textAlign="right">
166
+ <Typography>{invoice.description || invoice.id}</Typography>
167
+ </Box>
168
+ </Hidden>
169
+ )}
170
+ <Box flex={1} textAlign="right">
171
+ {action ? (
172
+ <Button
173
+ component="a"
174
+ variant="contained"
175
+ color="primary"
176
+ size="small"
177
+ href={link.url}
178
+ target={link.external ? '_blank' : target}
179
+ rel="noreferrer">
180
+ {t('payment.customer.invoice.pay')}
181
+ </Button>
182
+ ) : (
183
+ <Status label={invoice.status} color={getInvoiceStatusColor(invoice.status)} />
184
+ )}
164
185
  </Box>
165
- <Hidden mdDown>
166
- <Box flex={2} className="invoice-description" textAlign="right">
167
- <Typography>{invoice.description || invoice.id}</Typography>
168
- </Box>
169
- </Hidden>
170
186
  </Stack>
171
187
  );
172
188
  })}
@@ -210,4 +226,8 @@ const Root = styled(Stack)`
210
226
  display: none !important;
211
227
  }
212
228
  }
229
+
230
+ a.MuiButton-root {
231
+ text-decoration: none !important;
232
+ }
213
233
  `;
@@ -21,10 +21,10 @@ import api from '../../api';
21
21
  import Status from '../../components/status';
22
22
  import {
23
23
  formatBNStr,
24
- formatDateTime,
25
24
  formatError,
26
25
  formatSubscriptionProduct,
27
26
  formatTime,
27
+ formatToDate,
28
28
  getInvoiceStatusColor,
29
29
  getPrefix,
30
30
  getSubscriptionStatusColor,
@@ -158,18 +158,15 @@ export default function MiniInvoiceList() {
158
158
  return (
159
159
  <ListItem key={item.id} disableGutters sx={{ display: 'flex', justifyContent: 'space-between' }}>
160
160
  <Typography component="span" sx={{ flex: 3 }}>
161
- {formatDateTime(item.created_at, locale)}
161
+ {formatToDate(item.created_at, locale, 'YYYY-MM-DD')}
162
162
  </Typography>
163
163
  <Typography component="span" sx={{ flex: 1, textAlign: 'right' }}>
164
164
  {formatBNStr(item.total, item.paymentCurrency.decimal)}&nbsp;
165
165
  {item.paymentCurrency.symbol}
166
166
  </Typography>
167
- <Typography component="span" sx={{ flex: 2, textAlign: 'center' }}>
167
+ <Typography component="span" sx={{ flex: 2, textAlign: 'right' }}>
168
168
  <Status label={item.status} color={getInvoiceStatusColor(item.status)} />
169
169
  </Typography>
170
- <Typography component="span" sx={{ flex: 3 }}>
171
- <Typography>{item.description || item.id}</Typography>
172
- </Typography>
173
170
  </ListItem>
174
171
  );
175
172
  })
@@ -203,7 +203,8 @@ export default flat({
203
203
  pastDue: {
204
204
  button: 'Pay',
205
205
  invoices: 'Past Due Invoices',
206
- warning: 'Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore.',
206
+ warning:
207
+ 'Past due invoices need to be paid immediately, otherwise you can not make new purchases anymore. Please pay these invoices one by one.',
207
208
  alert: {
208
209
  title: 'You have unpaid invoices',
209
210
  description:
@@ -199,7 +199,7 @@ export default flat({
199
199
  pastDue: {
200
200
  button: '续费',
201
201
  invoices: '欠费帐单',
202
- warning: '请尽快支付欠费账单,否则你将无法继续使用服务或购买新服务',
202
+ warning: '请尽快支付欠费账单,否则你将无法继续使用服务或购买新服务,请逐个打开账单详情并完成支付',
203
203
  alert: {
204
204
  title: '你有欠费账单',
205
205
  description: '看起来你有欠费的账单,在你支付所有欠费账单之前,新的购买或者订阅将被禁止,请不要调皮。',