@blocklet/payment-react 1.13.186 → 1.13.188

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
2
3
  import { OpenInNewOutlined } from "@mui/icons-material";
3
4
  import { Link, Stack, Typography } from "@mui/material";
4
5
  import { joinURL } from "ufo";
@@ -38,8 +39,9 @@ TxLink.defaultProps = {
38
39
  mode: "dashboard"
39
40
  };
40
41
  export default function TxLink(props) {
42
+ const { t } = useLocaleContext();
41
43
  if (!props.details || props.mode === "customer" && props.method.type === "stripe") {
42
- return /* @__PURE__ */ jsx(Typography, { component: "small", color: "text.secondary", children: "None" });
44
+ return /* @__PURE__ */ jsx(Typography, { component: "small", color: "text.secondary", children: t("common.none") });
43
45
  }
44
46
  const { text, link } = getTxLink(props.method, props.details);
45
47
  if (link) {
@@ -48,5 +50,5 @@ export default function TxLink(props) {
48
50
  /* @__PURE__ */ jsx(OpenInNewOutlined, { fontSize: "small" })
49
51
  ] }) });
50
52
  }
51
- return /* @__PURE__ */ jsx(Typography, { component: "small", color: "text.secondary", children: "None" });
53
+ return /* @__PURE__ */ jsx(Typography, { component: "small", color: "text.secondary", children: t("common.none") });
52
54
  }
@@ -40,7 +40,7 @@ export default function CustomerInvoiceList({
40
40
  const { data, loadMore, loadingMore, loading } = useInfiniteScroll(
41
41
  (d) => {
42
42
  const page = d ? Math.ceil(d.list.length / size) + 1 : 1;
43
- return fetchData({ page, pageSize: size, status, customer_id, currency_id, subscription_id });
43
+ return fetchData({ page, pageSize: size, status, customer_id, currency_id, subscription_id, ignoreZero: true });
44
44
  },
45
45
  {
46
46
  reloadDeps: [customer_id]
package/es/locales/en.js CHANGED
@@ -3,6 +3,7 @@ export default flat({
3
3
  common: {
4
4
  id: "ID",
5
5
  url: "URL",
6
+ none: "None",
6
7
  createdAt: "Created At",
7
8
  updatedAt: "Updated At",
8
9
  resumesAt: "Resume At",
@@ -247,6 +248,18 @@ export default flat({
247
248
  empty: "There are no subscriptions here",
248
249
  changePayment: "Change payment method"
249
250
  }
251
+ },
252
+ invoice: {
253
+ reason: {
254
+ creation: "Subscription create",
255
+ cycle: "Subscription cycle",
256
+ update: "Subscription update",
257
+ recover: "Subscription recover",
258
+ threshold: "Metered usage billing",
259
+ cancel: "Subscription cancel",
260
+ manual: "Manual invoice",
261
+ upcoming: "Upcoming invoice"
262
+ }
250
263
  }
251
264
  }
252
265
  });
package/es/locales/zh.js CHANGED
@@ -3,6 +3,7 @@ export default flat({
3
3
  common: {
4
4
  id: "ID",
5
5
  url: "URL",
6
+ none: "\u65E0",
6
7
  createdAt: "\u521B\u5EFA\u65F6\u95F4",
7
8
  updatedAt: "\u66F4\u65B0\u65F6\u95F4",
8
9
  resumesAt: "\u6062\u590D\u65F6\u95F4",
@@ -63,13 +64,13 @@ export default flat({
63
64
  week: "\u5468",
64
65
  month: "\u6708",
65
66
  year: "\u5E74",
66
- hourly: "\u6309\u5C0F\u65F6",
67
- daily: "\u6309\u5929",
68
- weekly: "\u6309\u5468",
69
- monthly: "\u6309\u6708",
70
- yearly: "\u6309\u5E74",
71
- month3: "\u6309\u5B63\u5EA6",
72
- month6: "\u6309\u534A\u5E74",
67
+ hourly: "\u6BCF\u5C0F\u65F6",
68
+ daily: "\u6BCF\u5929",
69
+ weekly: "\u6BCF\u5468",
70
+ monthly: "\u6BCF\u6708",
71
+ yearly: "\u6BCF\u5E74",
72
+ month3: "\u6BCF\u5B63\u5EA6",
73
+ month6: "\u6BCF\u534A\u5E74",
73
74
  recurring: "\u6BCF{count}{interval}",
74
75
  hours: "\u5C0F\u65F6",
75
76
  days: "\u5929",
@@ -247,6 +248,18 @@ export default flat({
247
248
  empty: "\u6CA1\u6709\u4EFB\u4F55\u8BA2\u9605",
248
249
  changePayment: "\u5207\u6362\u652F\u4ED8\u65B9\u5F0F"
249
250
  }
251
+ },
252
+ invoice: {
253
+ reason: {
254
+ creation: "\u8BA2\u9605\u521B\u5EFA",
255
+ cycle: "\u81EA\u52A8\u6263\u8D39",
256
+ update: "\u8BA2\u9605\u66F4\u65B0",
257
+ recover: "\u8BA2\u9605\u6062\u590D",
258
+ threshold: "\u7528\u91CF\u8D26\u5355",
259
+ cancel: "\u8BA2\u9605\u53D6\u6D88",
260
+ manual: "\u4EBA\u5DE5\u8D26\u5355",
261
+ upcoming: "\u672A\u6765\u8D26\u5355"
262
+ }
250
263
  }
251
264
  }
252
265
  });
package/es/util.js CHANGED
@@ -125,6 +125,14 @@ export function formatRecurring(recurring, translate = true, separator = "per",
125
125
  const interval = t(`common.${recurring.interval}`, locale);
126
126
  return translate ? t(`common.${intervals[recurring.interval]}`, locale) : separator ? t(`common.${separator}`, locale, { interval }) : interval;
127
127
  }
128
+ if (recurring.interval === "month") {
129
+ if (recurring.interval_count === 3) {
130
+ return t("common.month3", locale);
131
+ }
132
+ if (recurring.interval_count === 6) {
133
+ return t("common.month6", locale);
134
+ }
135
+ }
128
136
  return t("common.recurring", locale, {
129
137
  count: recurring.interval_count,
130
138
  interval: t(`common.${recurring.interval}s`, locale)
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  module.exports = TxLink;
7
7
  var _jsxRuntime = require("react/jsx-runtime");
8
+ var _context = require("@arcblock/ux/lib/Locale/context");
8
9
  var _iconsMaterial = require("@mui/icons-material");
9
10
  var _material = require("@mui/material");
10
11
  var _ufo = require("ufo");
@@ -43,11 +44,14 @@ TxLink.defaultProps = {
43
44
  mode: "dashboard"
44
45
  };
45
46
  function TxLink(props) {
47
+ const {
48
+ t
49
+ } = (0, _context.useLocaleContext)();
46
50
  if (!props.details || props.mode === "customer" && props.method.type === "stripe") {
47
51
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
48
52
  component: "small",
49
53
  color: "text.secondary",
50
- children: "None"
54
+ children: t("common.none")
51
55
  });
52
56
  }
53
57
  const {
@@ -77,6 +81,6 @@ function TxLink(props) {
77
81
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
78
82
  component: "small",
79
83
  color: "text.secondary",
80
- children: "None"
84
+ children: t("common.none")
81
85
  });
82
86
  }
@@ -59,7 +59,8 @@ function CustomerInvoiceList({
59
59
  status,
60
60
  customer_id,
61
61
  currency_id,
62
- subscription_id
62
+ subscription_id,
63
+ ignoreZero: true
63
64
  });
64
65
  }, {
65
66
  reloadDeps: [customer_id]
package/lib/locales/en.js CHANGED
@@ -10,6 +10,7 @@ module.exports = (0, _flat.default)({
10
10
  common: {
11
11
  id: "ID",
12
12
  url: "URL",
13
+ none: "None",
13
14
  createdAt: "Created At",
14
15
  updatedAt: "Updated At",
15
16
  resumesAt: "Resume At",
@@ -254,6 +255,18 @@ module.exports = (0, _flat.default)({
254
255
  empty: "There are no subscriptions here",
255
256
  changePayment: "Change payment method"
256
257
  }
258
+ },
259
+ invoice: {
260
+ reason: {
261
+ creation: "Subscription create",
262
+ cycle: "Subscription cycle",
263
+ update: "Subscription update",
264
+ recover: "Subscription recover",
265
+ threshold: "Metered usage billing",
266
+ cancel: "Subscription cancel",
267
+ manual: "Manual invoice",
268
+ upcoming: "Upcoming invoice"
269
+ }
257
270
  }
258
271
  }
259
272
  });
package/lib/locales/zh.js CHANGED
@@ -10,6 +10,7 @@ module.exports = (0, _flat.default)({
10
10
  common: {
11
11
  id: "ID",
12
12
  url: "URL",
13
+ none: "\u65E0",
13
14
  createdAt: "\u521B\u5EFA\u65F6\u95F4",
14
15
  updatedAt: "\u66F4\u65B0\u65F6\u95F4",
15
16
  resumesAt: "\u6062\u590D\u65F6\u95F4",
@@ -70,13 +71,13 @@ module.exports = (0, _flat.default)({
70
71
  week: "\u5468",
71
72
  month: "\u6708",
72
73
  year: "\u5E74",
73
- hourly: "\u6309\u5C0F\u65F6",
74
- daily: "\u6309\u5929",
75
- weekly: "\u6309\u5468",
76
- monthly: "\u6309\u6708",
77
- yearly: "\u6309\u5E74",
78
- month3: "\u6309\u5B63\u5EA6",
79
- month6: "\u6309\u534A\u5E74",
74
+ hourly: "\u6BCF\u5C0F\u65F6",
75
+ daily: "\u6BCF\u5929",
76
+ weekly: "\u6BCF\u5468",
77
+ monthly: "\u6BCF\u6708",
78
+ yearly: "\u6BCF\u5E74",
79
+ month3: "\u6BCF\u5B63\u5EA6",
80
+ month6: "\u6BCF\u534A\u5E74",
80
81
  recurring: "\u6BCF{count}{interval}",
81
82
  hours: "\u5C0F\u65F6",
82
83
  days: "\u5929",
@@ -254,6 +255,18 @@ module.exports = (0, _flat.default)({
254
255
  empty: "\u6CA1\u6709\u4EFB\u4F55\u8BA2\u9605",
255
256
  changePayment: "\u5207\u6362\u652F\u4ED8\u65B9\u5F0F"
256
257
  }
258
+ },
259
+ invoice: {
260
+ reason: {
261
+ creation: "\u8BA2\u9605\u521B\u5EFA",
262
+ cycle: "\u81EA\u52A8\u6263\u8D39",
263
+ update: "\u8BA2\u9605\u66F4\u65B0",
264
+ recover: "\u8BA2\u9605\u6062\u590D",
265
+ threshold: "\u7528\u91CF\u8D26\u5355",
266
+ cancel: "\u8BA2\u9605\u53D6\u6D88",
267
+ manual: "\u4EBA\u5DE5\u8D26\u5355",
268
+ upcoming: "\u672A\u6765\u8D26\u5355"
269
+ }
257
270
  }
258
271
  }
259
272
  });
package/lib/util.js CHANGED
@@ -180,6 +180,14 @@ function formatRecurring(recurring, translate = true, separator = "per", locale
180
180
  interval
181
181
  }) : interval;
182
182
  }
183
+ if (recurring.interval === "month") {
184
+ if (recurring.interval_count === 3) {
185
+ return (0, _locales.t)("common.month3", locale);
186
+ }
187
+ if (recurring.interval_count === 6) {
188
+ return (0, _locales.t)("common.month6", locale);
189
+ }
190
+ }
183
191
  return (0, _locales.t)("common.recurring", locale, {
184
192
  count: recurring.interval_count,
185
193
  interval: (0, _locales.t)(`common.${recurring.interval}s`, locale)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.13.186",
3
+ "version": "1.13.188",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -90,7 +90,7 @@
90
90
  "@babel/core": "^7.23.9",
91
91
  "@babel/preset-env": "^7.23.9",
92
92
  "@babel/preset-react": "^7.23.3",
93
- "@blocklet/payment-types": "1.13.186",
93
+ "@blocklet/payment-types": "1.13.188",
94
94
  "@storybook/addon-essentials": "^7.6.13",
95
95
  "@storybook/addon-interactions": "^7.6.13",
96
96
  "@storybook/addon-links": "^7.6.13",
@@ -119,5 +119,5 @@
119
119
  "vite-plugin-babel": "^1.2.0",
120
120
  "vite-plugin-node-polyfills": "^0.19.0"
121
121
  },
122
- "gitHead": "1200eebf624b5d09fce59f718490e321409f4b44"
122
+ "gitHead": "c6755c93da4e1d3a97352be3c6dcc3554bef0b62"
123
123
  }
@@ -1,3 +1,4 @@
1
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
1
2
  import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types';
2
3
  import { OpenInNewOutlined } from '@mui/icons-material';
3
4
  import { Link, Stack, Typography } from '@mui/material';
@@ -46,10 +47,12 @@ export default function TxLink(props: {
46
47
  method: TPaymentMethod;
47
48
  mode?: 'customer' | 'dashboard';
48
49
  }) {
50
+ const { t } = useLocaleContext();
51
+
49
52
  if (!props.details || (props.mode === 'customer' && props.method.type === 'stripe')) {
50
53
  return (
51
54
  <Typography component="small" color="text.secondary">
52
- None
55
+ {t('common.none')}
53
56
  </Typography>
54
57
  );
55
58
  }
@@ -71,7 +74,7 @@ export default function TxLink(props: {
71
74
 
72
75
  return (
73
76
  <Typography component="small" color="text.secondary">
74
- None
77
+ {t('common.none')}
75
78
  </Typography>
76
79
  );
77
80
  }
@@ -56,7 +56,7 @@ export default function CustomerInvoiceList({
56
56
  const { data, loadMore, loadingMore, loading } = useInfiniteScroll<Paginated<TInvoiceExpanded>>(
57
57
  (d) => {
58
58
  const page = d ? Math.ceil(d.list.length / size) + 1 : 1;
59
- return fetchData({ page, pageSize: size, status, customer_id, currency_id, subscription_id });
59
+ return fetchData({ page, pageSize: size, status, customer_id, currency_id, subscription_id, ignoreZero: true });
60
60
  },
61
61
  {
62
62
  reloadDeps: [customer_id],
@@ -4,6 +4,7 @@ export default flat({
4
4
  common: {
5
5
  id: 'ID',
6
6
  url: 'URL',
7
+ none: 'None',
7
8
  createdAt: 'Created At',
8
9
  updatedAt: 'Updated At',
9
10
  resumesAt: 'Resume At',
@@ -257,5 +258,17 @@ export default flat({
257
258
  changePayment: 'Change payment method',
258
259
  },
259
260
  },
261
+ invoice: {
262
+ reason: {
263
+ creation: 'Subscription create',
264
+ cycle: 'Subscription cycle',
265
+ update: 'Subscription update',
266
+ recover: 'Subscription recover',
267
+ threshold: 'Metered usage billing',
268
+ cancel: 'Subscription cancel',
269
+ manual: 'Manual invoice',
270
+ upcoming: 'Upcoming invoice',
271
+ },
272
+ },
260
273
  },
261
274
  });
@@ -4,6 +4,7 @@ export default flat({
4
4
  common: {
5
5
  id: 'ID',
6
6
  url: 'URL',
7
+ none: '无',
7
8
  createdAt: '创建时间',
8
9
  updatedAt: '更新时间',
9
10
  resumesAt: '恢复时间',
@@ -64,13 +65,13 @@ export default flat({
64
65
  week: '周',
65
66
  month: '月',
66
67
  year: '年',
67
- hourly: '按小时',
68
- daily: '按天',
69
- weekly: '按周',
70
- monthly: '按月',
71
- yearly: '按年',
72
- month3: '按季度',
73
- month6: '按半年',
68
+ hourly: '每小时',
69
+ daily: '每天',
70
+ weekly: '每周',
71
+ monthly: '每月',
72
+ yearly: '每年',
73
+ month3: '每季度',
74
+ month6: '每半年',
74
75
  recurring: '每{count}{interval}',
75
76
  hours: '小时',
76
77
  days: '天',
@@ -250,5 +251,17 @@ export default flat({
250
251
  changePayment: '切换支付方式',
251
252
  },
252
253
  },
254
+ invoice: {
255
+ reason: {
256
+ creation: '订阅创建',
257
+ cycle: '自动扣费',
258
+ update: '订阅更新',
259
+ recover: '订阅恢复',
260
+ threshold: '用量账单',
261
+ cancel: '订阅取消',
262
+ manual: '人工账单',
263
+ upcoming: '未来账单',
264
+ },
265
+ },
253
266
  },
254
267
  });
package/src/util.ts CHANGED
@@ -197,6 +197,15 @@ export function formatRecurring(
197
197
  return translate ? t(`common.${intervals[recurring.interval]}`, locale) : separator ? t(`common.${separator}`, locale, { interval }) : interval; // prettier-ignore
198
198
  }
199
199
 
200
+ if (recurring.interval === 'month') {
201
+ if (recurring.interval_count === 3) {
202
+ return t('common.month3', locale);
203
+ }
204
+ if (recurring.interval_count === 6) {
205
+ return t('common.month6', locale);
206
+ }
207
+ }
208
+
200
209
  return t('common.recurring', locale, {
201
210
  count: recurring.interval_count,
202
211
  interval: t(`common.${recurring.interval}s`, locale),