@open-mercato/core 0.4.8-develop-665ca9216b → 0.4.8-develop-f3593949bf
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/dist/modules/catalog/backend/catalog/products/[id]/page.js +10 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/components/products/variantForm.js +2 -3
- package/dist/modules/catalog/components/products/variantForm.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +15 -2
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/lib/priceValidation.js +45 -0
- package/dist/modules/catalog/lib/priceValidation.js.map +7 -0
- package/package.json +3 -3
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +10 -2
- package/src/modules/catalog/components/products/variantForm.ts +2 -3
- package/src/modules/catalog/data/validators.ts +18 -2
- package/src/modules/catalog/lib/priceValidation.ts +57 -0
|
@@ -585,6 +585,12 @@ function EditCatalogProductPage({
|
|
|
585
585
|
);
|
|
586
586
|
const handleSubmit = React.useCallback(
|
|
587
587
|
async (formValues) => {
|
|
588
|
+
const translateValidationMessage = (message) => {
|
|
589
|
+
if (typeof message !== "string") return "";
|
|
590
|
+
const trimmed = message.trim();
|
|
591
|
+
if (!trimmed) return "";
|
|
592
|
+
return t(trimmed, trimmed);
|
|
593
|
+
};
|
|
588
594
|
if (!productId) {
|
|
589
595
|
throw createCrudFormError(
|
|
590
596
|
t(
|
|
@@ -599,9 +605,11 @@ function EditCatalogProductPage({
|
|
|
599
605
|
const fieldErrors = {};
|
|
600
606
|
issues.forEach((issue) => {
|
|
601
607
|
const path = issue.path.join(".") || "form";
|
|
602
|
-
if (!fieldErrors[path])
|
|
608
|
+
if (!fieldErrors[path]) {
|
|
609
|
+
fieldErrors[path] = translateValidationMessage(issue.message);
|
|
610
|
+
}
|
|
603
611
|
});
|
|
604
|
-
const message = issues[0]?.message
|
|
612
|
+
const message = translateValidationMessage(issues[0]?.message) || t(
|
|
605
613
|
"catalog.products.edit.errors.validation",
|
|
606
614
|
"Fix highlighted fields."
|
|
607
615
|
);
|