payment-kit 1.18.52 → 1.18.54

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
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.18.52
17
+ version: 1.18.54
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.18.52",
3
+ "version": "1.18.54",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -44,31 +44,31 @@
44
44
  ]
45
45
  },
46
46
  "dependencies": {
47
- "@abtnode/cron": "^1.16.43",
48
- "@arcblock/did": "^1.20.12",
47
+ "@abtnode/cron": "^1.16.44",
48
+ "@arcblock/did": "^1.20.13",
49
49
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
50
- "@arcblock/did-connect": "^2.13.61",
51
- "@arcblock/did-util": "^1.20.12",
52
- "@arcblock/jwt": "^1.20.12",
53
- "@arcblock/ux": "^2.13.61",
54
- "@arcblock/validator": "^1.20.12",
55
- "@blocklet/did-space-js": "^1.0.57",
56
- "@blocklet/js-sdk": "^1.16.43",
57
- "@blocklet/logger": "^1.16.43",
58
- "@blocklet/payment-react": "1.18.52",
59
- "@blocklet/sdk": "^1.16.43",
60
- "@blocklet/ui-react": "^2.13.61",
50
+ "@arcblock/did-connect": "^2.13.62",
51
+ "@arcblock/did-util": "^1.20.13",
52
+ "@arcblock/jwt": "^1.20.13",
53
+ "@arcblock/ux": "^2.13.62",
54
+ "@arcblock/validator": "^1.20.13",
55
+ "@blocklet/did-space-js": "^1.0.58",
56
+ "@blocklet/js-sdk": "^1.16.44",
57
+ "@blocklet/logger": "^1.16.44",
58
+ "@blocklet/payment-react": "1.18.54",
59
+ "@blocklet/sdk": "^1.16.44",
60
+ "@blocklet/ui-react": "^2.13.62",
61
61
  "@blocklet/uploader": "^0.1.95",
62
62
  "@blocklet/xss": "^0.1.36",
63
63
  "@mui/icons-material": "^5.16.6",
64
64
  "@mui/lab": "^5.0.0-alpha.173",
65
65
  "@mui/material": "^5.16.6",
66
66
  "@mui/system": "^5.16.6",
67
- "@ocap/asset": "^1.20.12",
68
- "@ocap/client": "^1.20.12",
69
- "@ocap/mcrypto": "^1.20.12",
70
- "@ocap/util": "^1.20.12",
71
- "@ocap/wallet": "^1.20.12",
67
+ "@ocap/asset": "^1.20.13",
68
+ "@ocap/client": "^1.20.13",
69
+ "@ocap/mcrypto": "^1.20.13",
70
+ "@ocap/util": "^1.20.13",
71
+ "@ocap/wallet": "^1.20.13",
72
72
  "@stripe/react-stripe-js": "^2.7.3",
73
73
  "@stripe/stripe-js": "^2.4.0",
74
74
  "ahooks": "^3.8.0",
@@ -121,9 +121,9 @@
121
121
  "web3": "^4.16.0"
122
122
  },
123
123
  "devDependencies": {
124
- "@abtnode/types": "^1.16.43",
124
+ "@abtnode/types": "^1.16.44",
125
125
  "@arcblock/eslint-config-ts": "^0.3.3",
126
- "@blocklet/payment-types": "1.18.52",
126
+ "@blocklet/payment-types": "1.18.54",
127
127
  "@types/cookie-parser": "^1.4.7",
128
128
  "@types/cors": "^2.8.17",
129
129
  "@types/debug": "^4.1.12",
@@ -153,7 +153,7 @@
153
153
  "vite": "^5.3.5",
154
154
  "vite-node": "^2.0.4",
155
155
  "vite-plugin-babel-import": "^2.0.5",
156
- "vite-plugin-blocklet": "^0.9.32",
156
+ "vite-plugin-blocklet": "^0.9.33",
157
157
  "vite-plugin-node-polyfills": "^0.21.0",
158
158
  "vite-plugin-svgr": "^4.2.0",
159
159
  "vite-tsconfig-paths": "^4.3.2",
@@ -169,5 +169,5 @@
169
169
  "parser": "typescript"
170
170
  }
171
171
  },
172
- "gitHead": "dfa2927758a635868ca2ce251d098ab15178a409"
172
+ "gitHead": "6315d7f4272e88e6a840a1948fd9745db9011e16"
173
173
  }
@@ -47,6 +47,7 @@ type ListProps = {
47
47
  status?: string;
48
48
  customer_id?: string;
49
49
  currency_id?: string;
50
+ setHasRevenues?: (hasRevenues: boolean) => void;
50
51
  };
51
52
 
52
53
  const getListKey = (props: ListProps) => {
@@ -60,9 +61,10 @@ CustomerRevenueList.defaultProps = {
60
61
  status: '',
61
62
  currency_id: '',
62
63
  customer_id: '',
64
+ setHasRevenues: () => {},
63
65
  };
64
66
 
65
- export default function CustomerRevenueList({ currency_id, status, customer_id }: ListProps) {
67
+ export default function CustomerRevenueList({ currency_id, status, customer_id, setHasRevenues }: ListProps) {
66
68
  const { t } = useLocaleContext();
67
69
  const { isMobile } = useMobile('sm');
68
70
 
@@ -87,6 +89,9 @@ export default function CustomerRevenueList({ currency_id, status, customer_id }
87
89
  debounce(() => {
88
90
  fetchData(search).then((res: any) => {
89
91
  setData(res);
92
+ if (setHasRevenues) {
93
+ setHasRevenues(res.count > 0);
94
+ }
90
95
  });
91
96
  }, 300)();
92
97
  }, [search]);
@@ -197,6 +197,7 @@ export default function CustomerHome() {
197
197
  const navigate = useNavigate();
198
198
  const [subscriptionStatus, setSubscriptionStatus] = useState(false);
199
199
  const [hasSubscriptions, setHasSubscriptions] = useState(false);
200
+ const [hasRevenues, setHasRevenues] = useState(false);
200
201
  const { startTransition } = useTransitionContext();
201
202
  const {
202
203
  data,
@@ -433,7 +434,7 @@ export default function CustomerHome() {
433
434
  );
434
435
 
435
436
  const InvoiceCard = loadingCard ? (
436
- <CardSkeleton height={300} />
437
+ <CardSkeleton height={200} />
437
438
  ) : (
438
439
  <Box className="base-card section section-invoices">
439
440
  <Box className="section-header">
@@ -460,16 +461,15 @@ export default function CustomerHome() {
460
461
  </Box>
461
462
  );
462
463
 
463
- const RevenueCard = loadingCard ? (
464
- <CardSkeleton height={200} />
465
- ) : (
466
- <Box className="base-card section section-revenue">
467
- <Box className="section-header">
468
- <Typography variant="h3">{t('customer.payout.title')}</Typography>
464
+ const RevenueCard =
465
+ loadingCard || !hasRevenues ? null : (
466
+ <Box className="base-card section section-revenue">
467
+ <Box className="section-header">
468
+ <Typography variant="h3">{t('customer.payout.title')}</Typography>
469
+ </Box>
470
+ <CustomerRevenueList setHasRevenues={setHasRevenues} />
469
471
  </Box>
470
- <CustomerRevenueList />
471
- </Box>
472
- );
472
+ );
473
473
 
474
474
  return (
475
475
  <Content>
@@ -37,11 +37,11 @@ import {
37
37
  Typography,
38
38
  } from '@mui/material';
39
39
  import { useRequest, useSetState } from 'ahooks';
40
+ import SplitButton from '@arcblock/ux/lib/SplitButton';
40
41
  import { useMemo } from 'react';
41
42
  import { joinURL, withQuery } from 'ufo';
42
43
  import prettyMs from 'pretty-ms-i18n';
43
44
  import { isEmpty } from 'lodash';
44
- import { PaymentOutlined } from '@mui/icons-material';
45
45
  import InfoRow from '../../../components/info-row';
46
46
  import InfoCard from '../../../components/info-card';
47
47
  import { useSessionContext } from '../../../contexts/session';
@@ -82,7 +82,6 @@ export default function SubscriptionEmbed() {
82
82
  const [state, setState] = useSetState({
83
83
  batchPay: false,
84
84
  });
85
-
86
85
  const { session, connectApi } = useSessionContext();
87
86
 
88
87
  const subscriptionId = params.get('id') || '';
@@ -327,19 +326,30 @@ export default function SubscriptionEmbed() {
327
326
  {x.text[locale] || x.text.en || x.name}
328
327
  </Button>
329
328
  ))}
330
- <Button
331
- variant="contained"
332
- sx={{ width: subscription.service_actions?.length ? 'auto' : '100%' }}
333
- target="_blank"
334
- href={subscriptionPageUrl}>
335
- {t('payment.customer.subscriptions.view')}
336
- </Button>
337
- {hasPastDue && (
338
- <Tooltip title={t('admin.subscription.batchPay.button')}>
339
- <Button variant="outlined" color="error" onClick={() => setState({ batchPay: true })}>
340
- <PaymentOutlined />
341
- </Button>
342
- </Tooltip>
329
+ {hasPastDue ? (
330
+ <SplitButton
331
+ size="small"
332
+ color="error"
333
+ variant="contained"
334
+ menu={[
335
+ <SplitButton.Item key="view-subscription" component={Link} target="_blank" href={subscriptionPageUrl}>
336
+ {t('payment.customer.subscriptions.view')}
337
+ </SplitButton.Item>,
338
+ ]}>
339
+ {() => (
340
+ <Button variant="contained" color="error" onClick={() => setState({ batchPay: true })}>
341
+ {t('payment.subscription.overdue.payNow')}
342
+ </Button>
343
+ )}
344
+ </SplitButton>
345
+ ) : (
346
+ <Button
347
+ variant="contained"
348
+ sx={{ width: subscription.service_actions?.length ? 'auto' : '100%' }}
349
+ target="_blank"
350
+ href={subscriptionPageUrl}>
351
+ {t('payment.customer.subscriptions.view')}
352
+ </Button>
343
353
  )}
344
354
  </Stack>
345
355
  </Box>