ctt-puro 0.46.0 → 0.46.2
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/fesm2022/ctt-puro.mjs
CHANGED
|
@@ -4008,17 +4008,18 @@ class MapperService {
|
|
|
4008
4008
|
}
|
|
4009
4009
|
mapGallery(props) {
|
|
4010
4010
|
const { texts, buttons, filters = [] } = props;
|
|
4011
|
-
// 1️⃣
|
|
4012
|
-
const roomsParent = filters.find((f) => f.rooms === true);
|
|
4013
|
-
// 2️⃣ Filtrar SOLO los que tengan multimedia si son habitaciones concretas
|
|
4011
|
+
// 1️⃣ Filtrar filtros válidos
|
|
4014
4012
|
const validFilters = filters.filter((f) => {
|
|
4015
4013
|
if (f.rooms)
|
|
4016
|
-
return true; //
|
|
4014
|
+
return true; // Habitaciones siempre
|
|
4017
4015
|
if (f.room)
|
|
4018
|
-
return Array.isArray(f.multimedia) && f.multimedia.length > 0;
|
|
4019
|
-
return Array.isArray(f.multimedia) && f.multimedia.length > 0;
|
|
4016
|
+
return Array.isArray(f.multimedia) && f.multimedia.length > 0;
|
|
4017
|
+
return Array.isArray(f.multimedia) && f.multimedia.length > 0;
|
|
4020
4018
|
});
|
|
4021
|
-
//
|
|
4019
|
+
// 2️⃣ Crear el índice visible
|
|
4020
|
+
const indexMap = new Map();
|
|
4021
|
+
validFilters.forEach((f, i) => indexMap.set(f, i));
|
|
4022
|
+
// 3️⃣ Mapear filtros visibles
|
|
4022
4023
|
const mappedFilters = validFilters.map((item, index) => ({
|
|
4023
4024
|
id: index,
|
|
4024
4025
|
all: item.all,
|
|
@@ -4026,14 +4027,16 @@ class MapperService {
|
|
|
4026
4027
|
rooms: item.rooms,
|
|
4027
4028
|
text: item.name,
|
|
4028
4029
|
}));
|
|
4029
|
-
// 4️⃣ Items →
|
|
4030
|
-
const items =
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4030
|
+
// 4️⃣ Items → controlando multimedia undefined
|
|
4031
|
+
const items = validFilters.flatMap((filter) => {
|
|
4032
|
+
if (!Array.isArray(filter.multimedia))
|
|
4033
|
+
return [];
|
|
4034
|
+
return filter.multimedia.map((img) => ({
|
|
4035
|
+
img: this.getImageResponsive(img),
|
|
4036
|
+
title: img?.title,
|
|
4037
|
+
filter: indexMap.get(filter), // index correcto
|
|
4038
|
+
}));
|
|
4039
|
+
});
|
|
4037
4040
|
return {
|
|
4038
4041
|
filters: mappedFilters,
|
|
4039
4042
|
pretitle: typeof texts?.pretitle === 'string'
|
|
@@ -4051,7 +4054,7 @@ class MapperService {
|
|
|
4051
4054
|
title: texts?.title?.color?.trim(),
|
|
4052
4055
|
},
|
|
4053
4056
|
filterTitle: texts?.roomsFilter,
|
|
4054
|
-
button: Utils.mapButtons(this.siteId(), buttons)[0],
|
|
4057
|
+
button: Utils.mapButtons(this.siteId(), buttons)?.[0],
|
|
4055
4058
|
items,
|
|
4056
4059
|
};
|
|
4057
4060
|
}
|
|
@@ -4629,7 +4632,7 @@ class MapperService {
|
|
|
4629
4632
|
mapFooterBeachs(props) {
|
|
4630
4633
|
return {
|
|
4631
4634
|
items: props?.hotels?.map((hotel) => ({
|
|
4632
|
-
link: Utils.mapButtons(
|
|
4635
|
+
link: Utils.mapButtons(this.siteId(), hotel.links)[0],
|
|
4633
4636
|
title: hotel?.texts?.name ?? hotel.name,
|
|
4634
4637
|
subtitle: hotel?.texts?.locationDescription ?? null,
|
|
4635
4638
|
})),
|