@blocklet/payment-react 1.13.283 → 1.13.284
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/es/libs/util.js +3 -5
- package/lib/libs/util.js +3 -2
- package/package.json +3 -3
- package/src/libs/util.ts +5 -5
package/es/libs/util.js
CHANGED
|
@@ -205,11 +205,9 @@ export function formatLineItemPricing(item, currency, trial, locale = "en") {
|
|
|
205
205
|
if (price.recurring?.usage_type === "metered" || +item.quantity === 1) {
|
|
206
206
|
quantity = "";
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
)} ${currency.symbol}`;
|
|
212
|
-
const unit = `${fromUnitToToken(getPriceUintAmountByCurrency(price, currency))} ${currency.symbol}`;
|
|
208
|
+
const unitValue = new BN(getPriceUintAmountByCurrency(price, currency));
|
|
209
|
+
const total = `${fromUnitToToken(unitValue.mul(new BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
210
|
+
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
213
211
|
const appendUnit = (v, alt) => {
|
|
214
212
|
if (price.product.unit_label) {
|
|
215
213
|
return `${v}/${price.product.unit_label}`;
|
package/lib/libs/util.js
CHANGED
|
@@ -264,8 +264,9 @@ function formatLineItemPricing(item, currency, trial, locale = "en") {
|
|
|
264
264
|
if (price.recurring?.usage_type === "metered" || +item.quantity === 1) {
|
|
265
265
|
quantity = "";
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
const
|
|
267
|
+
const unitValue = new _util.BN(getPriceUintAmountByCurrency(price, currency));
|
|
268
|
+
const total = `${(0, _util.fromUnitToToken)(unitValue.mul(new _util.BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
269
|
+
const unit = `${(0, _util.fromUnitToToken)(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
269
270
|
const appendUnit = (v, alt) => {
|
|
270
271
|
if (price.product.unit_label) {
|
|
271
272
|
return `${v}/${price.product.unit_label}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.284",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@babel/core": "^7.24.7",
|
|
92
92
|
"@babel/preset-env": "^7.24.7",
|
|
93
93
|
"@babel/preset-react": "^7.24.7",
|
|
94
|
-
"@blocklet/payment-types": "1.13.
|
|
94
|
+
"@blocklet/payment-types": "1.13.284",
|
|
95
95
|
"@storybook/addon-essentials": "^7.6.19",
|
|
96
96
|
"@storybook/addon-interactions": "^7.6.19",
|
|
97
97
|
"@storybook/addon-links": "^7.6.19",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"vite-plugin-babel": "^1.2.0",
|
|
121
121
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "c844c5590104d35d4bffedddec6f909684bacc4b"
|
|
124
124
|
}
|
package/src/libs/util.ts
CHANGED
|
@@ -298,11 +298,11 @@ export function formatLineItemPricing(
|
|
|
298
298
|
quantity = '';
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const unit = `${fromUnitToToken(
|
|
301
|
+
const unitValue = new BN(getPriceUintAmountByCurrency(price, currency));
|
|
302
|
+
|
|
303
|
+
const total = `${fromUnitToToken(unitValue.mul(new BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
304
|
+
|
|
305
|
+
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
306
306
|
|
|
307
307
|
const appendUnit = (v: string, alt: string) => {
|
|
308
308
|
if (price.product.unit_label) {
|