payment-kit 1.13.230 → 1.13.232

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.13.230
17
+ version: 1.13.232
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.13.230",
3
+ "version": "1.13.232",
4
4
  "scripts": {
5
5
  "dev": "cross-env COMPONENT_STORE_URL=https://test.store.blocklet.dev blocklet dev --open",
6
6
  "eject": "vite eject",
@@ -51,7 +51,7 @@
51
51
  "@arcblock/ux": "^2.9.68",
52
52
  "@arcblock/validator": "^1.18.115",
53
53
  "@blocklet/logger": "1.16.25",
54
- "@blocklet/payment-react": "1.13.230",
54
+ "@blocklet/payment-react": "1.13.232",
55
55
  "@blocklet/sdk": "1.16.25",
56
56
  "@blocklet/ui-react": "^2.9.68",
57
57
  "@blocklet/uploader": "^0.0.76",
@@ -116,7 +116,7 @@
116
116
  "devDependencies": {
117
117
  "@abtnode/types": "1.16.25",
118
118
  "@arcblock/eslint-config-ts": "^0.3.0",
119
- "@blocklet/payment-types": "1.13.230",
119
+ "@blocklet/payment-types": "1.13.232",
120
120
  "@types/cookie-parser": "^1.4.7",
121
121
  "@types/cors": "^2.8.17",
122
122
  "@types/dotenv-flow": "^3.3.3",
@@ -155,5 +155,5 @@
155
155
  "parser": "typescript"
156
156
  }
157
157
  },
158
- "gitHead": "c7209ae95049960f39b4e9eb65714626fb56ceab"
158
+ "gitHead": "250cff1f7b3b483e089a5f19587e58556d7ef063"
159
159
  }
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
3
+ import { PaymentProvider } from '@blocklet/payment-react';
3
4
  import Dashboard from '@blocklet/ui-react/lib/Dashboard';
4
5
  import { styled } from '@mui/system';
5
6
  import { useEffect } from 'react';
@@ -52,7 +53,7 @@ const Root = styled(Dashboard)`
52
53
 
53
54
  export default function Layout(props: any) {
54
55
  const { t } = useLocaleContext();
55
- const { session, events } = useSessionContext();
56
+ const { session, connectApi, events } = useSessionContext();
56
57
 
57
58
  useEffect(() => {
58
59
  events.once('logout', () => {
@@ -68,7 +69,11 @@ export default function Layout(props: any) {
68
69
  }, [session.initialized]);
69
70
 
70
71
  if (session.user) {
71
- return <Root {...props} footerProps={{ className: 'dashboard-footer' }} />;
72
+ return (
73
+ <PaymentProvider session={session} connect={connectApi}>
74
+ <Root {...props} footerProps={{ className: 'dashboard-footer' }} />
75
+ </PaymentProvider>
76
+ );
72
77
  }
73
78
 
74
79
  return t('common.redirecting');
@@ -1,5 +1,5 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
- import { PaymentProvider, Switch, usePaymentContext } from '@blocklet/payment-react';
2
+ import { Switch, usePaymentContext } from '@blocklet/payment-react';
3
3
  import { Box, Chip, Stack } from '@mui/material';
4
4
  import React, { isValidElement, useEffect } from 'react';
5
5
  import { useNavigate, useParams } from 'react-router-dom';
@@ -72,7 +72,7 @@ function Admin() {
72
72
  const group2 = [{ label: t('admin.developers'), value: 'developers' }];
73
73
 
74
74
  return (
75
- <Layout>
75
+ <>
76
76
  <ProgressBar pending={isPending} />
77
77
  <Stack
78
78
  direction="row"
@@ -103,13 +103,13 @@ function Admin() {
103
103
  </Stack>
104
104
  </Stack>
105
105
  <div className="page-content">{isValidElement(TabComponent) ? TabComponent : <TabComponent />}</div>
106
- </Layout>
106
+ </>
107
107
  );
108
108
  }
109
109
 
110
110
  export default function WrappedAdmin() {
111
111
  const navigate = useNavigate();
112
- const { session, connectApi } = useSessionContext();
112
+ const { session } = useSessionContext();
113
113
 
114
114
  useEffect(() => {
115
115
  if (session.user && ['owner', 'admin'].includes(session.user.role) === false) {
@@ -118,8 +118,8 @@ export default function WrappedAdmin() {
118
118
  }, [session.user]);
119
119
 
120
120
  return (
121
- <PaymentProvider session={session} connect={connectApi}>
121
+ <Layout>
122
122
  <Admin />
123
- </PaymentProvider>
123
+ </Layout>
124
124
  );
125
125
  }
@@ -1,5 +1,4 @@
1
1
  import { PaymentProvider } from '@blocklet/payment-react';
2
- import { Box } from '@mui/material';
3
2
  import React from 'react';
4
3
  import { useParams } from 'react-router-dom';
5
4
 
@@ -16,11 +15,7 @@ function Checkout() {
16
15
  // @ts-ignore
17
16
  const TabComponent = pages[action];
18
17
 
19
- return (
20
- <Box>
21
- <TabComponent id={id} />
22
- </Box>
23
- );
18
+ return <TabComponent id={id} />;
24
19
  }
25
20
 
26
21
  export default function WrappedAdmin() {
@@ -1,7 +1,7 @@
1
1
  import DID from '@arcblock/ux/lib/DID';
2
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
3
3
  import Toast from '@arcblock/ux/lib/Toast';
4
- import { CustomerInvoiceList, PaymentProvider, formatError, getPrefix } from '@blocklet/payment-react';
4
+ import { CustomerInvoiceList, formatError, getPrefix } from '@blocklet/payment-react';
5
5
  import type { GroupedBN, TCustomerExpanded } from '@blocklet/payment-types';
6
6
  import { Edit } from '@mui/icons-material';
7
7
  import { Alert, Box, Button, CircularProgress, Grid, Stack, Tooltip } from '@mui/material';
@@ -31,7 +31,7 @@ const fetchData = (): Promise<Result> => {
31
31
 
32
32
  export default function CustomerHome() {
33
33
  const { t } = useLocaleContext();
34
- const { events, session, connectApi } = useSessionContext();
34
+ const { events } = useSessionContext();
35
35
  const [state, setState] = useSetState({ editing: false, loading: false });
36
36
  const navigate = useNavigate();
37
37
  const { isPending, startTransition } = useTransitionContext();
@@ -174,20 +174,18 @@ export default function CustomerHome() {
174
174
  </Box>
175
175
  <Box className="section">
176
176
  <SectionHeader title={t('payment.customer.summary')} />
177
- <PaymentProvider session={session} connect={connectApi}>
178
- <Stack
179
- className="section-body"
180
- direction="column"
181
- spacing={2}
182
- justifyContent="flex-start"
183
- sx={{ width: '100%' }}>
184
- <InfoMetric label={t('admin.customer.spent')} value={<BalanceList data={data.summary.paid} />} />
185
- <InfoMetric label={t('admin.customer.stake')} value={<BalanceList data={data.summary.stake} />} />
186
- <InfoMetric label={t('admin.customer.token')} value={<BalanceList data={data.summary.token} />} />
187
- <InfoMetric label={t('admin.customer.due')} value={<BalanceList data={data.summary.due} />} />
188
- <InfoMetric label={t('admin.customer.refund')} value={<BalanceList data={data.summary.refunded} />} />
189
- </Stack>
190
- </PaymentProvider>
177
+ <Stack
178
+ className="section-body"
179
+ direction="column"
180
+ spacing={2}
181
+ justifyContent="flex-start"
182
+ sx={{ width: '100%' }}>
183
+ <InfoMetric label={t('admin.customer.spent')} value={<BalanceList data={data.summary.paid} />} />
184
+ <InfoMetric label={t('admin.customer.stake')} value={<BalanceList data={data.summary.stake} />} />
185
+ <InfoMetric label={t('admin.customer.token')} value={<BalanceList data={data.summary.token} />} />
186
+ <InfoMetric label={t('admin.customer.due')} value={<BalanceList data={data.summary.due} />} />
187
+ <InfoMetric label={t('admin.customer.refund')} value={<BalanceList data={data.summary.refunded} />} />
188
+ </Stack>
191
189
  </Box>
192
190
  </Root>
193
191
  </Grid>
@@ -1,12 +1,6 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
2
  import Toast from '@arcblock/ux/lib/Toast';
3
- import {
4
- CustomerInvoiceList,
5
- PaymentProvider,
6
- formatError,
7
- getPrefix,
8
- usePaymentContext,
9
- } from '@blocklet/payment-react';
3
+ import { CustomerInvoiceList, formatError, getPrefix, usePaymentContext } from '@blocklet/payment-react';
10
4
  import type { TCustomerExpanded } from '@blocklet/payment-types';
11
5
  import { ArrowBackOutlined } from '@mui/icons-material';
12
6
  import { Alert, Box, Button, CircularProgress, Stack, Typography } from '@mui/material';
@@ -24,7 +18,7 @@ const fetchData = (): Promise<TCustomerExpanded> => {
24
18
  return api.get('/api/customers/me').then((res) => res.data);
25
19
  };
26
20
 
27
- export function CustomerInvoicePastDue() {
21
+ export default function CustomerInvoicePastDue() {
28
22
  const { t } = useLocaleContext();
29
23
  const { events } = useSessionContext();
30
24
  const { connect } = usePaymentContext();
@@ -126,13 +120,3 @@ const Root = styled(Stack)`
126
120
  text-decoration: underline;
127
121
  }
128
122
  `;
129
-
130
- export default function PastDueWrapper() {
131
- const { session, connectApi } = useSessionContext();
132
-
133
- return (
134
- <PaymentProvider session={session} connect={connectApi}>
135
- <CustomerInvoicePastDue />
136
- </PaymentProvider>
137
- );
138
- }
@@ -6,7 +6,6 @@ import Toast from '@arcblock/ux/lib/Toast';
6
6
  import {
7
7
  AddressForm,
8
8
  CurrencySelector,
9
- PaymentProvider,
10
9
  PaymentSummary,
11
10
  StripeForm,
12
11
  api,
@@ -33,7 +32,6 @@ import { joinURL } from 'ufo';
33
32
 
34
33
  import SectionHeader from '../../../components/section/header';
35
34
  import SubscriptionDescription from '../../../components/subscription/description';
36
- import { useSessionContext } from '../../../contexts/session';
37
35
 
38
36
  const fetchData = async (id: string): Promise<{ subscription: TSubscriptionExpanded; customer: TCustomer }> => {
39
37
  const [subscription, customer] = await Promise.all([
@@ -311,7 +309,6 @@ export default function DataWrapper() {
311
309
  const { t } = useLocaleContext();
312
310
  const { id } = useParams() as { id: string };
313
311
  const { loading, error, data, runAsync } = useRequest(() => fetchData(id));
314
- const { session, connectApi } = useSessionContext();
315
312
 
316
313
  if (error) {
317
314
  return <Alert severity="error">{error.message}</Alert>;
@@ -325,11 +322,7 @@ export default function DataWrapper() {
325
322
  return <Alert severity="error">{t('payment.customer.changePlan.subscriptionNotFound')}</Alert>;
326
323
  }
327
324
 
328
- return (
329
- <PaymentProvider session={session} connect={connectApi}>
330
- <FormWrapper subscription={data.subscription} customer={data.customer} onComplete={runAsync} />
331
- </PaymentProvider>
332
- );
325
+ return <FormWrapper subscription={data.subscription} customer={data.customer} onComplete={runAsync} />;
333
326
  }
334
327
 
335
328
  const Root = styled(Stack)`