payment-kit 1.13.36 → 1.13.38
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 +1 -1
- package/package.json +24 -24
- package/src/components/checkout/product-item.tsx +2 -2
- package/src/libs/util.ts +29 -11
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.38",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -42,25 +42,25 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@arcblock/did": "^1.18.93",
|
|
44
44
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
45
|
-
"@arcblock/did-connect": "^2.8.
|
|
45
|
+
"@arcblock/did-connect": "^2.8.5",
|
|
46
46
|
"@arcblock/did-util": "^1.18.93",
|
|
47
|
-
"@arcblock/ux": "^2.8.
|
|
47
|
+
"@arcblock/ux": "^2.8.5",
|
|
48
48
|
"@blocklet/logger": "1.16.17-beta-952ef53d",
|
|
49
49
|
"@blocklet/sdk": "1.16.17-beta-952ef53d",
|
|
50
|
-
"@blocklet/ui-react": "^2.8.
|
|
50
|
+
"@blocklet/ui-react": "^2.8.5",
|
|
51
51
|
"@blocklet/uploader": "^0.0.32",
|
|
52
|
-
"@mui/icons-material": "^5.14.
|
|
53
|
-
"@mui/lab": "^5.0.0-alpha.
|
|
54
|
-
"@mui/material": "^5.14.
|
|
55
|
-
"@mui/styles": "^5.14.
|
|
56
|
-
"@mui/system": "^5.14.
|
|
52
|
+
"@mui/icons-material": "^5.14.15",
|
|
53
|
+
"@mui/lab": "^5.0.0-alpha.150",
|
|
54
|
+
"@mui/material": "^5.14.15",
|
|
55
|
+
"@mui/styles": "^5.14.15",
|
|
56
|
+
"@mui/system": "^5.14.15",
|
|
57
57
|
"@ocap/asset": "^1.18.93",
|
|
58
58
|
"@ocap/client": "^1.18.93",
|
|
59
59
|
"@ocap/mcrypto": "^1.18.93",
|
|
60
60
|
"@ocap/util": "^1.18.93",
|
|
61
61
|
"@ocap/wallet": "^1.18.93",
|
|
62
62
|
"@stripe/react-stripe-js": "^2.3.1",
|
|
63
|
-
"@stripe/stripe-js": "^2.1.
|
|
63
|
+
"@stripe/stripe-js": "^2.1.10",
|
|
64
64
|
"ahooks": "^3.7.8",
|
|
65
65
|
"axios": "^0.27.2",
|
|
66
66
|
"body-parser": "^1.20.2",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"react-error-boundary": "^4.0.11",
|
|
89
89
|
"react-hook-form": "^7.47.0",
|
|
90
90
|
"react-international-phone": "^3.1.2",
|
|
91
|
-
"react-router-dom": "^6.
|
|
91
|
+
"react-router-dom": "^6.17.0",
|
|
92
92
|
"rimraf": "^3.0.2",
|
|
93
93
|
"sequelize": "^6.33.0",
|
|
94
94
|
"sqlite3": "^5.1.6",
|
|
95
|
-
"stripe": "^13.
|
|
95
|
+
"stripe": "^13.11.0",
|
|
96
96
|
"typewriter-effect": "^2.21.0",
|
|
97
97
|
"ufo": "^1.3.1",
|
|
98
98
|
"umzug": "^3.3.1",
|
|
@@ -103,18 +103,18 @@
|
|
|
103
103
|
"@abtnode/types": "1.16.17-beta-952ef53d",
|
|
104
104
|
"@arcblock/eslint-config": "^0.2.4",
|
|
105
105
|
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
106
|
-
"@did-pay/types": "1.13.
|
|
107
|
-
"@types/cookie-parser": "^1.4.
|
|
108
|
-
"@types/cors": "^2.8.
|
|
109
|
-
"@types/dotenv-flow": "^3.3.
|
|
110
|
-
"@types/express": "^4.17.
|
|
111
|
-
"@types/node": "^18.18.
|
|
112
|
-
"@types/react": "^18.2.
|
|
113
|
-
"@types/react-dom": "^18.2.
|
|
106
|
+
"@did-pay/types": "1.13.38",
|
|
107
|
+
"@types/cookie-parser": "^1.4.5",
|
|
108
|
+
"@types/cors": "^2.8.15",
|
|
109
|
+
"@types/dotenv-flow": "^3.3.2",
|
|
110
|
+
"@types/express": "^4.17.20",
|
|
111
|
+
"@types/node": "^18.18.7",
|
|
112
|
+
"@types/react": "^18.2.33",
|
|
113
|
+
"@types/react-dom": "^18.2.14",
|
|
114
114
|
"@vitejs/plugin-react": "^2.2.0",
|
|
115
115
|
"bumpp": "^8.2.1",
|
|
116
116
|
"cross-env": "^7.0.3",
|
|
117
|
-
"eslint": "^8.
|
|
117
|
+
"eslint": "^8.52.0",
|
|
118
118
|
"import-sort-style-module": "^6.0.0",
|
|
119
119
|
"lint-staged": "^12.5.0",
|
|
120
120
|
"nodemon": "^2.0.22",
|
|
@@ -122,9 +122,9 @@
|
|
|
122
122
|
"prettier": "^2.8.8",
|
|
123
123
|
"prettier-plugin-import-sort": "^0.0.7",
|
|
124
124
|
"ts-node": "^10.9.1",
|
|
125
|
-
"type-fest": "^4.
|
|
125
|
+
"type-fest": "^4.6.0",
|
|
126
126
|
"typescript": "^4.9.5",
|
|
127
|
-
"vite": "^4.
|
|
127
|
+
"vite": "^4.5.0",
|
|
128
128
|
"vite-plugin-blocklet": "^0.6.15",
|
|
129
129
|
"vite-plugin-node-polyfills": "^0.7.0",
|
|
130
130
|
"vite-plugin-svgr": "^2.4.0",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
"parser": "typescript"
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "961b898e9ee66e55ffcbd9247987812f6ed61fe3"
|
|
144
144
|
}
|
|
@@ -30,8 +30,8 @@ export default function ProductItem({ item, session, currency, onUpsell, onDowns
|
|
|
30
30
|
description={item.price.product?.description}
|
|
31
31
|
extra={
|
|
32
32
|
item.price.type === 'recurring' && item.price.recurring
|
|
33
|
-
? `
|
|
34
|
-
:
|
|
33
|
+
? [pricing.quantity, `billed ${formatRecurring(item.upsell_price?.recurring || item.price.recurring)} ${metered}`].filter(Boolean).join(', ') // prettier-ignore
|
|
34
|
+
: pricing.quantity
|
|
35
35
|
}
|
|
36
36
|
/>
|
|
37
37
|
<Stack direction="column" alignItems="flex-end" flex={1}>
|
package/src/libs/util.ts
CHANGED
|
@@ -258,33 +258,51 @@ export function formatLineItemPricing(
|
|
|
258
258
|
item: TLineItemExpanded,
|
|
259
259
|
currency: TPaymentCurrency,
|
|
260
260
|
trial: number
|
|
261
|
-
): { primary: string; secondary?: string } {
|
|
261
|
+
): { primary: string; secondary?: string; quantity: string } {
|
|
262
262
|
const price = item.upsell_price || item.price;
|
|
263
|
-
|
|
263
|
+
|
|
264
|
+
let quantity = `Qty ${item.quantity}`;
|
|
265
|
+
if (price.recurring?.usage_type === 'metered' || +item.quantity === 1) {
|
|
266
|
+
quantity = '';
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const total = `${fromUnitToToken(
|
|
264
270
|
new BN(getPriceUintAmountByCurrency(price, currency)).mul(new BN(item.quantity)),
|
|
265
271
|
currency.decimal
|
|
266
|
-
).
|
|
272
|
+
)} ${currency.symbol}`;
|
|
273
|
+
const unit = `${fromUnitToToken(getPriceUintAmountByCurrency(price, currency))} ${currency.symbol}`;
|
|
274
|
+
|
|
275
|
+
const appendUnit = (v: string, alt: string) => {
|
|
276
|
+
if (price.product.unit_label) {
|
|
277
|
+
return `${v} / ${price.product.unit_label}`;
|
|
278
|
+
}
|
|
279
|
+
if (price.recurring?.usage_type === 'metered' || item.quantity === 1) {
|
|
280
|
+
return alt;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return quantity ? `${unit} each` : '';
|
|
284
|
+
};
|
|
267
285
|
|
|
268
286
|
if (price.type === 'recurring' && price.recurring) {
|
|
269
287
|
if (trial > 0) {
|
|
270
|
-
const secondary = price.product.unit_label
|
|
271
|
-
? `${amount} ${currency.symbol} / ${price.product.unit_label}`
|
|
272
|
-
: `${amount} ${currency.symbol}`;
|
|
273
288
|
return {
|
|
274
289
|
primary: `Free for ${trial} days`,
|
|
275
|
-
secondary: `${
|
|
290
|
+
secondary: `${appendUnit(total, total)} ${formatRecurring(price.recurring, false, '/')}`,
|
|
291
|
+
quantity,
|
|
276
292
|
};
|
|
277
293
|
}
|
|
278
294
|
|
|
279
295
|
return {
|
|
280
|
-
primary:
|
|
281
|
-
secondary:
|
|
296
|
+
primary: total,
|
|
297
|
+
secondary: appendUnit(total, ''),
|
|
298
|
+
quantity,
|
|
282
299
|
};
|
|
283
300
|
}
|
|
284
301
|
|
|
285
302
|
return {
|
|
286
|
-
primary:
|
|
287
|
-
secondary:
|
|
303
|
+
primary: total,
|
|
304
|
+
secondary: appendUnit(total, ''),
|
|
305
|
+
quantity,
|
|
288
306
|
};
|
|
289
307
|
}
|
|
290
308
|
|