@blocklet/payment-react 1.14.19 → 1.14.20
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 +4 -1
- package/es/payment/index.js +1 -1
- package/lib/libs/util.js +4 -1
- package/lib/payment/index.js +1 -1
- package/package.json +3 -3
- package/src/libs/util.ts +4 -1
- package/src/payment/index.tsx +1 -1
package/es/libs/util.js
CHANGED
|
@@ -691,7 +691,10 @@ export function formatQuantityInventory(price, quantity, locale = "en") {
|
|
|
691
691
|
return "";
|
|
692
692
|
}
|
|
693
693
|
export function formatAmountPrecisionLimit(amount, locale = "en", precision = 6) {
|
|
694
|
-
|
|
694
|
+
if (!amount) {
|
|
695
|
+
return "";
|
|
696
|
+
}
|
|
697
|
+
const [, decimal] = String(amount).split(".");
|
|
695
698
|
if (decimal && decimal.length > precision) {
|
|
696
699
|
return t("common.amountPrecisionLimit", locale, { precision });
|
|
697
700
|
}
|
package/es/payment/index.js
CHANGED
|
@@ -213,7 +213,7 @@ export function PaymentInner({
|
|
|
213
213
|
if (Number(amount) < min || Number(amount) > max) {
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
if (formatAmountPrecisionLimit(amount, locale)) {
|
|
216
|
+
if (amount && formatAmountPrecisionLimit(String(amount), locale)) {
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
try {
|
package/lib/libs/util.js
CHANGED
|
@@ -827,7 +827,10 @@ function formatQuantityInventory(price, quantity, locale = "en") {
|
|
|
827
827
|
return "";
|
|
828
828
|
}
|
|
829
829
|
function formatAmountPrecisionLimit(amount, locale = "en", precision = 6) {
|
|
830
|
-
|
|
830
|
+
if (!amount) {
|
|
831
|
+
return "";
|
|
832
|
+
}
|
|
833
|
+
const [, decimal] = String(amount).split(".");
|
|
831
834
|
if (decimal && decimal.length > precision) {
|
|
832
835
|
return (0, _locales.t)("common.amountPrecisionLimit", locale, {
|
|
833
836
|
precision
|
package/lib/payment/index.js
CHANGED
|
@@ -265,7 +265,7 @@ function PaymentInner({
|
|
|
265
265
|
if (Number(amount) < min || Number(amount) > max) {
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if ((0, _util2.formatAmountPrecisionLimit)(amount, locale)) {
|
|
268
|
+
if (amount && (0, _util2.formatAmountPrecisionLimit)(String(amount), locale)) {
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.20",
|
|
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.25.2",
|
|
92
92
|
"@babel/preset-env": "^7.25.2",
|
|
93
93
|
"@babel/preset-react": "^7.24.7",
|
|
94
|
-
"@blocklet/payment-types": "1.14.
|
|
94
|
+
"@blocklet/payment-types": "1.14.20",
|
|
95
95
|
"@storybook/addon-essentials": "^7.6.20",
|
|
96
96
|
"@storybook/addon-interactions": "^7.6.20",
|
|
97
97
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -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": "c226ecda79fb537b2067c636410e4c7ab0f2723d"
|
|
124
124
|
}
|
package/src/libs/util.ts
CHANGED
|
@@ -894,7 +894,10 @@ export function formatQuantityInventory(price: TPrice, quantity: string | number
|
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
export function formatAmountPrecisionLimit(amount: string, locale = 'en', precision: number = 6) {
|
|
897
|
-
|
|
897
|
+
if (!amount) {
|
|
898
|
+
return '';
|
|
899
|
+
}
|
|
900
|
+
const [, decimal] = String(amount).split('.');
|
|
898
901
|
if (decimal && decimal.length > precision) {
|
|
899
902
|
return t('common.amountPrecisionLimit', locale, { precision });
|
|
900
903
|
}
|