@resira/ui 0.4.13 → 0.4.14
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/index.cjs +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2031,10 +2031,17 @@ function groupProductsByCategory(products, resources) {
|
|
|
2031
2031
|
let groupId;
|
|
2032
2032
|
let label;
|
|
2033
2033
|
let catImage;
|
|
2034
|
+
let catGalleryImages;
|
|
2034
2035
|
if (productCategory) {
|
|
2035
2036
|
groupId = productCategory.toLowerCase();
|
|
2036
2037
|
label = product.categoryName?.trim() ? product.categoryName.trim() : formatCategoryLabel(productCategory);
|
|
2038
|
+
catGalleryImages = Array.isArray(product.categoryGalleryImages) ? product.categoryGalleryImages.filter(
|
|
2039
|
+
(url) => typeof url === "string" && url.trim().length > 0
|
|
2040
|
+
) : void 0;
|
|
2037
2041
|
catImage = product.categoryImage ?? void 0;
|
|
2042
|
+
if (!catImage && catGalleryImages && catGalleryImages.length > 0) {
|
|
2043
|
+
catImage = catGalleryImages[0];
|
|
2044
|
+
}
|
|
2038
2045
|
} else {
|
|
2039
2046
|
let categoryResource;
|
|
2040
2047
|
const categoryType = product.equipmentIds.map((equipmentId) => {
|
|
@@ -2053,6 +2060,7 @@ function groupProductsByCategory(products, resources) {
|
|
|
2053
2060
|
id: groupId,
|
|
2054
2061
|
label,
|
|
2055
2062
|
imageUrl: catImage,
|
|
2063
|
+
galleryImages: catGalleryImages,
|
|
2056
2064
|
products: []
|
|
2057
2065
|
});
|
|
2058
2066
|
}
|
|
@@ -2061,14 +2069,11 @@ function groupProductsByCategory(products, resources) {
|
|
|
2061
2069
|
if (!group.imageUrl) {
|
|
2062
2070
|
if (catImage) {
|
|
2063
2071
|
group.imageUrl = catImage;
|
|
2064
|
-
} else {
|
|
2065
|
-
const coverImage = product.images?.[0];
|
|
2066
|
-
const firstImage = (coverImage?.showInCategoryHeader !== false ? coverImage?.url : void 0) ?? product.imageUrl;
|
|
2067
|
-
if (firstImage) {
|
|
2068
|
-
group.imageUrl = firstImage;
|
|
2069
|
-
}
|
|
2070
2072
|
}
|
|
2071
2073
|
}
|
|
2074
|
+
if ((!group.galleryImages || group.galleryImages.length === 0) && catGalleryImages && catGalleryImages.length > 0) {
|
|
2075
|
+
group.galleryImages = catGalleryImages;
|
|
2076
|
+
}
|
|
2072
2077
|
});
|
|
2073
2078
|
return Array.from(groups.values());
|
|
2074
2079
|
}
|