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