payment-kit 1.18.14 → 1.18.16

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.
Files changed (31) hide show
  1. package/api/src/index.ts +2 -0
  2. package/api/src/libs/invoice.ts +5 -3
  3. package/api/src/routes/connect/change-payment.ts +9 -1
  4. package/api/src/routes/connect/change-plan.ts +9 -1
  5. package/api/src/routes/connect/collect-batch.ts +7 -5
  6. package/api/src/routes/connect/recharge-account.ts +124 -0
  7. package/api/src/routes/connect/setup.ts +8 -1
  8. package/api/src/routes/connect/shared.ts +110 -48
  9. package/api/src/routes/connect/subscribe.ts +11 -1
  10. package/api/src/routes/customers.ts +149 -6
  11. package/api/src/routes/invoices.ts +46 -0
  12. package/api/src/routes/payment-currencies.ts +5 -2
  13. package/api/src/routes/subscriptions.ts +0 -3
  14. package/blocklet.yml +1 -1
  15. package/package.json +8 -8
  16. package/src/app.tsx +11 -3
  17. package/src/components/info-card.tsx +3 -1
  18. package/src/components/info-row.tsx +1 -0
  19. package/src/components/invoice/recharge.tsx +85 -56
  20. package/src/components/invoice/table.tsx +7 -1
  21. package/src/components/subscription/portal/actions.tsx +1 -1
  22. package/src/components/subscription/portal/list.tsx +6 -0
  23. package/src/locales/en.tsx +9 -0
  24. package/src/locales/zh.tsx +9 -0
  25. package/src/pages/admin/settings/vault-config/index.tsx +21 -6
  26. package/src/pages/customer/index.tsx +160 -265
  27. package/src/pages/customer/invoice/detail.tsx +24 -16
  28. package/src/pages/customer/invoice/past-due.tsx +45 -23
  29. package/src/pages/customer/recharge/account.tsx +515 -0
  30. package/src/pages/customer/{recharge.tsx → recharge/subscription.tsx} +11 -11
  31. package/src/pages/customer/subscription/embed.tsx +16 -1
@@ -36,6 +36,7 @@ type Props = {
36
36
  onlyActive?: boolean;
37
37
  changeActive?: (active: boolean) => void;
38
38
  setStatusState?: (state: boolean) => void;
39
+ setHasSubscriptions?: (state: boolean) => void;
39
40
  } & Omit<StackProps, 'onChange'>;
40
41
 
41
42
  const pageSize = 5;
@@ -48,6 +49,7 @@ export default function CurrentSubscriptions({
48
49
  onlyActive,
49
50
  changeActive = () => {},
50
51
  setStatusState = () => {},
52
+ setHasSubscriptions = () => {},
51
53
  ...rest
52
54
  }: Props) {
53
55
  const { t } = useLocaleContext();
@@ -64,6 +66,9 @@ export default function CurrentSubscriptions({
64
66
  onSuccess(res) {
65
67
  if (res.totalCount > 0 || res.count > 0) {
66
68
  setStatusState(true);
69
+ setHasSubscriptions(true);
70
+ } else {
71
+ setHasSubscriptions(false);
67
72
  }
68
73
  },
69
74
  ...(isMobile
@@ -279,4 +284,5 @@ CurrentSubscriptions.defaultProps = {
279
284
  onlyActive: false,
280
285
  changeActive: null,
281
286
  setStatusState: null,
287
+ setHasSubscriptions: null,
282
288
  };
@@ -796,6 +796,8 @@ export default flat({
796
796
  estimatedDuration: '{duration} {unit} est.',
797
797
  intervals: 'intervals',
798
798
  history: 'Fund History',
799
+ relatedSubscriptions: 'Related Subscriptions',
800
+ rechargeTooltip: 'Click to recharge balance',
799
801
  },
800
802
  delegation: {
801
803
  title:
@@ -855,6 +857,13 @@ export default flat({
855
857
  viewReference: 'View Reference',
856
858
  title: 'Revenue',
857
859
  },
860
+ pastDue: {
861
+ warning: 'You have due invoices, please pay them to keep your services active',
862
+ invoices: 'Due Invoices',
863
+ payNow: 'Pay Now',
864
+ alert: 'You have due invoices. Please pay them promptly to avoid service interruption.',
865
+ title: 'Settle Due Invoices',
866
+ },
858
867
  },
859
868
  integrations: {
860
869
  basicFeatures: 'Basic Features',
@@ -774,6 +774,8 @@ export default flat({
774
774
  custom: '自定义',
775
775
  intervals: '个周期',
776
776
  history: '充值记录',
777
+ relatedSubscriptions: '关联订阅',
778
+ rechargeTooltip: '点击充值余额',
777
779
  },
778
780
  delegation: {
779
781
  title: '检测到你未完成账户的授权,为了不影响订阅的扣费,请尽快完成授权',
@@ -828,6 +830,13 @@ export default flat({
828
830
  viewReference: '查看打赏原文',
829
831
  title: '收款记录',
830
832
  },
833
+ pastDue: {
834
+ warning: '您有欠费账单,请及时付款以保持服务正常运行',
835
+ invoices: '欠费账单',
836
+ payNow: '立即付款',
837
+ alert: '您有欠费账单需要处理,请及时付款以避免服务中断',
838
+ title: '结清欠费账单',
839
+ },
831
840
  },
832
841
  integrations: {
833
842
  basicFeatures: '基础功能',
@@ -104,7 +104,10 @@ export default function VaultConfig() {
104
104
  name: 'symbol',
105
105
  options: {
106
106
  customBodyRenderLite: (dataIndex: number) => {
107
- const item = data.list[dataIndex];
107
+ const item = data.list?.[dataIndex];
108
+ if (!item) {
109
+ return '-';
110
+ }
108
111
  return (
109
112
  <Stack direction="row" spacing={1} alignItems="center">
110
113
  <Avatar src={item.logo} alt={item.symbol} style={{ width: 24, height: 24 }} />
@@ -126,7 +129,10 @@ export default function VaultConfig() {
126
129
  name: 'id',
127
130
  options: {
128
131
  customBodyRenderLite: (dataIndex: number) => {
129
- const item = data.list[dataIndex];
132
+ const item = data.list?.[dataIndex];
133
+ if (!item) {
134
+ return '-';
135
+ }
130
136
  return (
131
137
  <Typography variant="body1">
132
138
  {formatBNStr(data.balances?.[item.id] || '0', item.decimal)} {item.symbol}
@@ -140,7 +146,10 @@ export default function VaultConfig() {
140
146
  name: 'vault_enabled',
141
147
  options: {
142
148
  customBodyRenderLite: (dataIndex: number) => {
143
- const item = data.list[dataIndex];
149
+ const item = data.list?.[dataIndex];
150
+ if (!item) {
151
+ return '-';
152
+ }
144
153
  const enabled = item.vault_config?.enabled;
145
154
  return (
146
155
  <Stack direction="row" spacing={1} alignItems="center">
@@ -165,7 +174,10 @@ export default function VaultConfig() {
165
174
  name: 'deposit_threshold',
166
175
  options: {
167
176
  customBodyRenderLite: (dataIndex: number) => {
168
- const item = data.list[dataIndex];
177
+ const item = data.list?.[dataIndex];
178
+ if (!item) {
179
+ return '-';
180
+ }
169
181
  if (!item?.vault_config) {
170
182
  return (
171
183
  <Typography variant="body2" color="text.secondary">
@@ -231,7 +243,10 @@ export default function VaultConfig() {
231
243
  name: 'actions',
232
244
  options: {
233
245
  customBodyRenderLite: (dataIndex: number) => {
234
- const item = data.list[dataIndex];
246
+ const item = data.list?.[dataIndex];
247
+ if (!item) {
248
+ return null;
249
+ }
235
250
  const enabled = item.vault_config?.enabled;
236
251
  return (
237
252
  <Button
@@ -307,7 +322,7 @@ export default function VaultConfig() {
307
322
  )}
308
323
  </Box>
309
324
  <Table
310
- data={data.list}
325
+ data={Array.isArray(data.list) ? data.list : []}
311
326
  columns={columns}
312
327
  options={{
313
328
  pagination: false,