payment-kit 1.15.29 → 1.15.31
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/api/src/routes/checkout-sessions.ts +13 -0
- package/blocklet.yml +6 -6
- package/package.json +17 -17
- package/screenshots/checkout.png +0 -0
- package/screenshots/customer.png +0 -0
- package/screenshots/payment.png +0 -0
- package/screenshots/setting.png +0 -0
- package/screenshots/subscription_detail.png +0 -0
- package/src/components/info-row.tsx +16 -11
- package/src/components/invoice-pdf/template.tsx +4 -2
- package/src/components/price/upsell-select.tsx +16 -1
- package/src/components/price/upsell.tsx +2 -2
- package/screenshots/440cabfd95ea93702c9c694df3dbbaf1.png +0 -0
- package/screenshots/a1d41fe1bad76c814b4a2ad5d4e1dab8.png +0 -0
- package/screenshots/a3bf97be05559c86bd5c50f2085aaf5c.png +0 -0
- package/screenshots/df305299c1d709f159fdd95c05995069.png +0 -0
- package/screenshots/e218485a93fbc18e5bd870bc323f75ad.png +0 -0
|
@@ -497,6 +497,19 @@ export async function startCheckoutSessionFromPaymentLink(id: string, req: Reque
|
|
|
497
497
|
|
|
498
498
|
doc.line_items = items;
|
|
499
499
|
|
|
500
|
+
if (req.query.upsell === '1') {
|
|
501
|
+
// add upsell to line items
|
|
502
|
+
const updatedItems = cloneDeep(doc.line_items);
|
|
503
|
+
updatedItems.forEach((item: any) => {
|
|
504
|
+
if (item?.price?.upsell) {
|
|
505
|
+
item.upsell_price_id = item.price.upsell.upsells_to_id;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
await doc.update({ line_items: updatedItems });
|
|
509
|
+
await doc.update(await getCheckoutSessionAmounts(doc));
|
|
510
|
+
doc.line_items = await Price.expand(updatedItems, { upsell: true });
|
|
511
|
+
}
|
|
512
|
+
|
|
500
513
|
res.json({
|
|
501
514
|
checkoutSession: doc.toJSON(),
|
|
502
515
|
paymentMethods: await getPaymentMethods(doc),
|
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.15.
|
|
17
|
+
version: 1.15.31
|
|
18
18
|
logo: logo.png
|
|
19
19
|
files:
|
|
20
20
|
- dist
|
|
@@ -71,11 +71,11 @@ capabilities:
|
|
|
71
71
|
clusterMode: false
|
|
72
72
|
component: true
|
|
73
73
|
screenshots:
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
74
|
+
- setting.png
|
|
75
|
+
- payment.png
|
|
76
|
+
- checkout.png
|
|
77
|
+
- subscription_detail.png
|
|
78
|
+
- customer.png
|
|
79
79
|
components:
|
|
80
80
|
- name: image-bin
|
|
81
81
|
source:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.31",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -44,29 +44,29 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@abtnode/cron": "1.16.33-beta-20241031-073543-49b1ff9b",
|
|
47
|
-
"@arcblock/did": "^1.18.
|
|
47
|
+
"@arcblock/did": "^1.18.139",
|
|
48
48
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
49
|
-
"@arcblock/did-connect": "^2.10.
|
|
50
|
-
"@arcblock/did-util": "^1.18.
|
|
51
|
-
"@arcblock/jwt": "^1.18.
|
|
52
|
-
"@arcblock/ux": "^2.10.
|
|
53
|
-
"@arcblock/validator": "^1.18.
|
|
49
|
+
"@arcblock/did-connect": "^2.10.65",
|
|
50
|
+
"@arcblock/did-util": "^1.18.139",
|
|
51
|
+
"@arcblock/jwt": "^1.18.139",
|
|
52
|
+
"@arcblock/ux": "^2.10.65",
|
|
53
|
+
"@arcblock/validator": "^1.18.139",
|
|
54
54
|
"@blocklet/js-sdk": "1.16.33-beta-20241031-073543-49b1ff9b",
|
|
55
55
|
"@blocklet/logger": "1.16.33-beta-20241031-073543-49b1ff9b",
|
|
56
|
-
"@blocklet/payment-react": "1.15.
|
|
56
|
+
"@blocklet/payment-react": "1.15.31",
|
|
57
57
|
"@blocklet/sdk": "1.16.33-beta-20241031-073543-49b1ff9b",
|
|
58
|
-
"@blocklet/ui-react": "^2.10.
|
|
58
|
+
"@blocklet/ui-react": "^2.10.65",
|
|
59
59
|
"@blocklet/uploader": "^0.1.51",
|
|
60
60
|
"@blocklet/xss": "^0.1.12",
|
|
61
61
|
"@mui/icons-material": "^5.16.6",
|
|
62
62
|
"@mui/lab": "^5.0.0-alpha.173",
|
|
63
63
|
"@mui/material": "^5.16.6",
|
|
64
64
|
"@mui/system": "^5.16.6",
|
|
65
|
-
"@ocap/asset": "^1.18.
|
|
66
|
-
"@ocap/client": "^1.18.
|
|
67
|
-
"@ocap/mcrypto": "^1.18.
|
|
68
|
-
"@ocap/util": "^1.18.
|
|
69
|
-
"@ocap/wallet": "^1.18.
|
|
65
|
+
"@ocap/asset": "^1.18.139",
|
|
66
|
+
"@ocap/client": "^1.18.139",
|
|
67
|
+
"@ocap/mcrypto": "^1.18.139",
|
|
68
|
+
"@ocap/util": "^1.18.139",
|
|
69
|
+
"@ocap/wallet": "^1.18.139",
|
|
70
70
|
"@stripe/react-stripe-js": "^2.7.3",
|
|
71
71
|
"@stripe/stripe-js": "^2.4.0",
|
|
72
72
|
"ahooks": "^3.8.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@abtnode/types": "1.16.33-beta-20241031-073543-49b1ff9b",
|
|
122
122
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
123
|
-
"@blocklet/payment-types": "1.15.
|
|
123
|
+
"@blocklet/payment-types": "1.15.31",
|
|
124
124
|
"@types/cookie-parser": "^1.4.7",
|
|
125
125
|
"@types/cors": "^2.8.17",
|
|
126
126
|
"@types/debug": "^4.1.12",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"vite": "^5.3.5",
|
|
150
150
|
"vite-node": "^2.0.4",
|
|
151
151
|
"vite-plugin-babel-import": "^2.0.5",
|
|
152
|
-
"vite-plugin-blocklet": "^0.9.
|
|
152
|
+
"vite-plugin-blocklet": "^0.9.12",
|
|
153
153
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
154
154
|
"vite-plugin-svgr": "^4.2.0",
|
|
155
155
|
"vite-tsconfig-paths": "^4.3.2",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"parser": "typescript"
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "04cb9d78d7e0927486124cfba273d627db74b18b"
|
|
169
169
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -11,6 +11,7 @@ type Props = {
|
|
|
11
11
|
sizes?: [number, number];
|
|
12
12
|
direction?: 'row' | 'column';
|
|
13
13
|
sx?: SxProps;
|
|
14
|
+
showLabel?: boolean;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
InfoRow.defaultProps = {
|
|
@@ -19,6 +20,7 @@ InfoRow.defaultProps = {
|
|
|
19
20
|
alignItems: 'center',
|
|
20
21
|
direction: 'row',
|
|
21
22
|
sx: {},
|
|
23
|
+
showLabel: true,
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export default function InfoRow(props: Props) {
|
|
@@ -39,17 +41,20 @@ export default function InfoRow(props: Props) {
|
|
|
39
41
|
},
|
|
40
42
|
}}
|
|
41
43
|
className="info-row-wrapper">
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
{props.showLabel && (
|
|
45
|
+
<Box
|
|
46
|
+
flex={sizes[0]}
|
|
47
|
+
color="text.primary"
|
|
48
|
+
fontWeight={500}
|
|
49
|
+
fontSize={14}
|
|
50
|
+
sx={{
|
|
51
|
+
flex: props.direction === 'column' ? 'none' : sizes[0],
|
|
52
|
+
mb: props.direction === 'column' ? 0.5 : 0,
|
|
53
|
+
}}>
|
|
54
|
+
{props.label}
|
|
55
|
+
</Box>
|
|
56
|
+
)}
|
|
57
|
+
|
|
53
58
|
<Box
|
|
54
59
|
flex={sizes[1]}
|
|
55
60
|
color={isNone ? 'text.disabled' : 'text.secondary'}
|
|
@@ -26,7 +26,7 @@ export function InvoiceTemplate({ data, t }: InvoicePDFProps) {
|
|
|
26
26
|
}}>
|
|
27
27
|
<div style={composeStyles('fs-20 bold')}>{t('admin.invoice.name')}</div>
|
|
28
28
|
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center' }}>
|
|
29
|
-
<img src={window.blocklet.appLogo
|
|
29
|
+
<img src={window.blocklet.appLogo} style={composeStyles('logo')} alt="logo" />
|
|
30
30
|
<span style={composeStyles('block p-10')}>{window.blocklet.appName}</span>
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
@@ -52,7 +52,9 @@ export function InvoiceTemplate({ data, t }: InvoicePDFProps) {
|
|
|
52
52
|
<span style={composeStyles('bold')}>{t('admin.invoice.paidAt')}</span>
|
|
53
53
|
</div>
|
|
54
54
|
<div style={composeStyles('w-60')}>
|
|
55
|
-
<span style={composeStyles('gray')}>
|
|
55
|
+
<span style={composeStyles('gray')}>
|
|
56
|
+
{formatTime((data.period_start || data.status_transitions?.paid_at || 0) * 1000)}
|
|
57
|
+
</span>
|
|
56
58
|
</div>
|
|
57
59
|
</div>
|
|
58
60
|
<div style={composeStyles('flex mb-5')}>
|
|
@@ -6,6 +6,7 @@ import { AddOutlined } from '@mui/icons-material';
|
|
|
6
6
|
import { Alert, CircularProgress, MenuItem, Select, Stack, Typography } from '@mui/material';
|
|
7
7
|
import { useRequest, useSetState } from 'ahooks';
|
|
8
8
|
|
|
9
|
+
import { useMemo } from 'react';
|
|
9
10
|
import AddPrice from '../product/add-price';
|
|
10
11
|
|
|
11
12
|
type Props = {
|
|
@@ -24,6 +25,20 @@ export default function UpsellSelect({ price, onSelect, onAdd }: Props) {
|
|
|
24
25
|
|
|
25
26
|
const { loading, error, data } = useRequest(() => fetchData(price.id));
|
|
26
27
|
|
|
28
|
+
const filteredData = useMemo(() => {
|
|
29
|
+
if (!data || data.length === 0) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const priceCurrencies = price.currency_options?.map((x) => x.currency_id) || [];
|
|
33
|
+
const priceLength = priceCurrencies.length;
|
|
34
|
+
return data.filter((x) => {
|
|
35
|
+
return (
|
|
36
|
+
x.currency_options.length === priceLength &&
|
|
37
|
+
x.currency_options.every((y) => priceCurrencies.includes(y.currency_id))
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
}, [data, price.id]);
|
|
41
|
+
|
|
27
42
|
if (error) {
|
|
28
43
|
return <Alert severity="error">{error.message}</Alert>;
|
|
29
44
|
}
|
|
@@ -75,7 +90,7 @@ export default function UpsellSelect({ price, onSelect, onAdd }: Props) {
|
|
|
75
90
|
<Typography>{t('admin.price.add')}</Typography>
|
|
76
91
|
</Stack>
|
|
77
92
|
</MenuItem>
|
|
78
|
-
{
|
|
93
|
+
{filteredData.map((x) => (
|
|
79
94
|
<MenuItem key={x.id} value={x.id}>
|
|
80
95
|
{formatPrice(x, x.currency)}
|
|
81
96
|
</MenuItem>
|
|
@@ -61,8 +61,8 @@ export function UpsellForm({ data, onChange }: { data: TPriceExpanded; onChange:
|
|
|
61
61
|
export default function PriceUpsell({ data, onChange }: { data: TPriceExpanded; onChange: Function }) {
|
|
62
62
|
return (
|
|
63
63
|
<Grid container>
|
|
64
|
-
<Grid item xs={12} md={
|
|
65
|
-
<InfoRow label="" value={<UpsellForm data={data} onChange={onChange} />} />
|
|
64
|
+
<Grid item xs={12} md={12}>
|
|
65
|
+
<InfoRow label="" value={<UpsellForm data={data} onChange={onChange} />} showLabel={false} />
|
|
66
66
|
</Grid>
|
|
67
67
|
</Grid>
|
|
68
68
|
);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|