@qite/tide-booking-component 1.4.120 → 1.4.122
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/build/build-cjs/index.js +72 -1
- package/build/build-esm/index.js +69 -1
- package/package.json +2 -2
- package/src/search-results/components/filters/filters.tsx +36 -36
- package/src/search-results/components/hotel/hotel-card.tsx +1 -1
- package/src/search-results/utils/search-results-utils.ts +35 -0
- package/styles/components/_search.scss +23 -0
package/build/build-cjs/index.js
CHANGED
|
@@ -41274,7 +41274,10 @@ var HotelCard = function (_a) {
|
|
|
41274
41274
|
return (e.currentTarget.style.transform = 'scale(1)');
|
|
41275
41275
|
}
|
|
41276
41276
|
},
|
|
41277
|
-
React__default['default'].createElement('div', {
|
|
41277
|
+
React__default['default'].createElement('div', {
|
|
41278
|
+
className: 'search__result-card__top',
|
|
41279
|
+
dangerouslySetInnerHTML: { __html: he.decode(result.contents) }
|
|
41280
|
+
}),
|
|
41278
41281
|
React__default['default'].createElement(
|
|
41279
41282
|
'div',
|
|
41280
41283
|
{ className: 'search__result-card__footer' },
|
|
@@ -42184,6 +42187,13 @@ var Filters = function (_a) {
|
|
|
42184
42187
|
});
|
|
42185
42188
|
setFilters(updated);
|
|
42186
42189
|
};
|
|
42190
|
+
var handleStarRatingFilter = function (filter, rating) {
|
|
42191
|
+
var updated = filters.map(function (f) {
|
|
42192
|
+
if (f.property !== filter.property) return f;
|
|
42193
|
+
return __assign(__assign({}, f), { selectedRating: f.selectedRating === rating ? 0 : rating });
|
|
42194
|
+
});
|
|
42195
|
+
setFilters(updated);
|
|
42196
|
+
};
|
|
42187
42197
|
var handleSliderChange = function (filter, newMin, newMax) {
|
|
42188
42198
|
var updated = filters.map(function (f) {
|
|
42189
42199
|
if (f.property !== filter.property) return f;
|
|
@@ -42360,6 +42370,35 @@ var Filters = function (_a) {
|
|
|
42360
42370
|
handleSliderChange(filter, newMin, newMax);
|
|
42361
42371
|
}
|
|
42362
42372
|
});
|
|
42373
|
+
})(),
|
|
42374
|
+
isVisible &&
|
|
42375
|
+
filter.property === 'rating' &&
|
|
42376
|
+
filter.type === 'star-rating' &&
|
|
42377
|
+
(function () {
|
|
42378
|
+
var _a;
|
|
42379
|
+
var selectedRating = (_a = filter.selectedRating) !== null && _a !== void 0 ? _a : 0;
|
|
42380
|
+
return React__default['default'].createElement(
|
|
42381
|
+
'div',
|
|
42382
|
+
{ className: 'search__filter-row star-rating-filter' },
|
|
42383
|
+
[5, 4, 3, 2, 1].map(function (star) {
|
|
42384
|
+
return React__default['default'].createElement(
|
|
42385
|
+
'span',
|
|
42386
|
+
{
|
|
42387
|
+
key: star,
|
|
42388
|
+
className: 'star '.concat(star <= selectedRating ? 'filled' : ''),
|
|
42389
|
+
onClick: function () {
|
|
42390
|
+
return handleStarRatingFilter(filter, star);
|
|
42391
|
+
},
|
|
42392
|
+
role: 'button',
|
|
42393
|
+
tabIndex: 0,
|
|
42394
|
+
onKeyDown: function (e) {
|
|
42395
|
+
if (e.key === 'Enter' || e.key === ' ') handleStarRatingFilter(filter, star);
|
|
42396
|
+
}
|
|
42397
|
+
},
|
|
42398
|
+
'\u2605'
|
|
42399
|
+
);
|
|
42400
|
+
})
|
|
42401
|
+
);
|
|
42363
42402
|
})()
|
|
42364
42403
|
);
|
|
42365
42404
|
})
|
|
@@ -45808,6 +45847,32 @@ var enrichFiltersWithPackageAccoResults = function (results, tags) {
|
|
|
45808
45847
|
priceFilter.min = Math.floor(Math.min.apply(Math, prices));
|
|
45809
45848
|
priceFilter.max = Math.ceil(Math.max.apply(Math, prices));
|
|
45810
45849
|
filters.push(priceFilter);
|
|
45850
|
+
var starsFilter = {
|
|
45851
|
+
property: 'rating',
|
|
45852
|
+
label: 'Stars',
|
|
45853
|
+
type: 'star-rating',
|
|
45854
|
+
options: [],
|
|
45855
|
+
isFrontendFilter: true
|
|
45856
|
+
};
|
|
45857
|
+
var ratingMap = new Map();
|
|
45858
|
+
results.forEach(function (r) {
|
|
45859
|
+
var stars = r.stars;
|
|
45860
|
+
if (stars) {
|
|
45861
|
+
ratingMap.set(stars.toString(), {
|
|
45862
|
+
name: stars.toString(),
|
|
45863
|
+
value: stars
|
|
45864
|
+
});
|
|
45865
|
+
}
|
|
45866
|
+
});
|
|
45867
|
+
starsFilter.options = Array.from(ratingMap.values()).map(function (rating) {
|
|
45868
|
+
var _a;
|
|
45869
|
+
return {
|
|
45870
|
+
label: (_a = rating.name) !== null && _a !== void 0 ? _a : rating.value.toString(),
|
|
45871
|
+
value: rating.value,
|
|
45872
|
+
isChecked: false
|
|
45873
|
+
};
|
|
45874
|
+
});
|
|
45875
|
+
filters.push(starsFilter);
|
|
45811
45876
|
return filters;
|
|
45812
45877
|
};
|
|
45813
45878
|
var enrichFiltersWithPackageFlightResults = function (results, tags, translations) {
|
|
@@ -46120,6 +46185,12 @@ var applyFiltersToPackageAccoResults = function (results, filters, sortBy) {
|
|
|
46120
46185
|
if (filter.selectedMax != null && r.price > filter.selectedMax) return false;
|
|
46121
46186
|
return true;
|
|
46122
46187
|
}
|
|
46188
|
+
// RATING
|
|
46189
|
+
if (filter.property === 'rating') {
|
|
46190
|
+
if (r.stars == null) return false;
|
|
46191
|
+
if (filter.selectedRating != null && r.stars < filter.selectedRating) return false;
|
|
46192
|
+
return true;
|
|
46193
|
+
}
|
|
46123
46194
|
return true;
|
|
46124
46195
|
});
|
|
46125
46196
|
});
|
package/build/build-esm/index.js
CHANGED
|
@@ -41135,7 +41135,7 @@ var HotelCard = function (_a) {
|
|
|
41135
41135
|
return (e.currentTarget.style.transform = 'scale(1)');
|
|
41136
41136
|
}
|
|
41137
41137
|
},
|
|
41138
|
-
React__default.createElement('div', { dangerouslySetInnerHTML: { __html: he.decode(result.contents) } }),
|
|
41138
|
+
React__default.createElement('div', { className: 'search__result-card__top', dangerouslySetInnerHTML: { __html: he.decode(result.contents) } }),
|
|
41139
41139
|
React__default.createElement(
|
|
41140
41140
|
'div',
|
|
41141
41141
|
{ className: 'search__result-card__footer' },
|
|
@@ -42017,6 +42017,13 @@ var Filters = function (_a) {
|
|
|
42017
42017
|
});
|
|
42018
42018
|
setFilters(updated);
|
|
42019
42019
|
};
|
|
42020
|
+
var handleStarRatingFilter = function (filter, rating) {
|
|
42021
|
+
var updated = filters.map(function (f) {
|
|
42022
|
+
if (f.property !== filter.property) return f;
|
|
42023
|
+
return __assign(__assign({}, f), { selectedRating: f.selectedRating === rating ? 0 : rating });
|
|
42024
|
+
});
|
|
42025
|
+
setFilters(updated);
|
|
42026
|
+
};
|
|
42020
42027
|
var handleSliderChange = function (filter, newMin, newMax) {
|
|
42021
42028
|
var updated = filters.map(function (f) {
|
|
42022
42029
|
if (f.property !== filter.property) return f;
|
|
@@ -42193,6 +42200,35 @@ var Filters = function (_a) {
|
|
|
42193
42200
|
handleSliderChange(filter, newMin, newMax);
|
|
42194
42201
|
}
|
|
42195
42202
|
});
|
|
42203
|
+
})(),
|
|
42204
|
+
isVisible &&
|
|
42205
|
+
filter.property === 'rating' &&
|
|
42206
|
+
filter.type === 'star-rating' &&
|
|
42207
|
+
(function () {
|
|
42208
|
+
var _a;
|
|
42209
|
+
var selectedRating = (_a = filter.selectedRating) !== null && _a !== void 0 ? _a : 0;
|
|
42210
|
+
return React__default.createElement(
|
|
42211
|
+
'div',
|
|
42212
|
+
{ className: 'search__filter-row star-rating-filter' },
|
|
42213
|
+
[5, 4, 3, 2, 1].map(function (star) {
|
|
42214
|
+
return React__default.createElement(
|
|
42215
|
+
'span',
|
|
42216
|
+
{
|
|
42217
|
+
key: star,
|
|
42218
|
+
className: 'star '.concat(star <= selectedRating ? 'filled' : ''),
|
|
42219
|
+
onClick: function () {
|
|
42220
|
+
return handleStarRatingFilter(filter, star);
|
|
42221
|
+
},
|
|
42222
|
+
role: 'button',
|
|
42223
|
+
tabIndex: 0,
|
|
42224
|
+
onKeyDown: function (e) {
|
|
42225
|
+
if (e.key === 'Enter' || e.key === ' ') handleStarRatingFilter(filter, star);
|
|
42226
|
+
}
|
|
42227
|
+
},
|
|
42228
|
+
'\u2605'
|
|
42229
|
+
);
|
|
42230
|
+
})
|
|
42231
|
+
);
|
|
42196
42232
|
})()
|
|
42197
42233
|
);
|
|
42198
42234
|
})
|
|
@@ -45588,6 +45624,32 @@ var enrichFiltersWithPackageAccoResults = function (results, tags) {
|
|
|
45588
45624
|
priceFilter.min = Math.floor(Math.min.apply(Math, prices));
|
|
45589
45625
|
priceFilter.max = Math.ceil(Math.max.apply(Math, prices));
|
|
45590
45626
|
filters.push(priceFilter);
|
|
45627
|
+
var starsFilter = {
|
|
45628
|
+
property: 'rating',
|
|
45629
|
+
label: 'Stars',
|
|
45630
|
+
type: 'star-rating',
|
|
45631
|
+
options: [],
|
|
45632
|
+
isFrontendFilter: true
|
|
45633
|
+
};
|
|
45634
|
+
var ratingMap = new Map();
|
|
45635
|
+
results.forEach(function (r) {
|
|
45636
|
+
var stars = r.stars;
|
|
45637
|
+
if (stars) {
|
|
45638
|
+
ratingMap.set(stars.toString(), {
|
|
45639
|
+
name: stars.toString(),
|
|
45640
|
+
value: stars
|
|
45641
|
+
});
|
|
45642
|
+
}
|
|
45643
|
+
});
|
|
45644
|
+
starsFilter.options = Array.from(ratingMap.values()).map(function (rating) {
|
|
45645
|
+
var _a;
|
|
45646
|
+
return {
|
|
45647
|
+
label: (_a = rating.name) !== null && _a !== void 0 ? _a : rating.value.toString(),
|
|
45648
|
+
value: rating.value,
|
|
45649
|
+
isChecked: false
|
|
45650
|
+
};
|
|
45651
|
+
});
|
|
45652
|
+
filters.push(starsFilter);
|
|
45591
45653
|
return filters;
|
|
45592
45654
|
};
|
|
45593
45655
|
var enrichFiltersWithPackageFlightResults = function (results, tags, translations) {
|
|
@@ -45900,6 +45962,12 @@ var applyFiltersToPackageAccoResults = function (results, filters, sortBy) {
|
|
|
45900
45962
|
if (filter.selectedMax != null && r.price > filter.selectedMax) return false;
|
|
45901
45963
|
return true;
|
|
45902
45964
|
}
|
|
45965
|
+
// RATING
|
|
45966
|
+
if (filter.property === 'rating') {
|
|
45967
|
+
if (r.stars == null) return false;
|
|
45968
|
+
if (filter.selectedRating != null && r.stars < filter.selectedRating) return false;
|
|
45969
|
+
return true;
|
|
45970
|
+
}
|
|
45903
45971
|
return true;
|
|
45904
45972
|
});
|
|
45905
45973
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qite/tide-booking-component",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.122",
|
|
4
4
|
"description": "React Booking wizard & Booking product component for Tide",
|
|
5
5
|
"main": "build/build-cjs/index.js",
|
|
6
6
|
"types": "build/build-cjs/src/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@jsonurl/jsonurl": "^1.1.4",
|
|
31
31
|
"@popperjs/core": "^2.10.2",
|
|
32
|
-
"@qite/tide-client": "^1.1.
|
|
32
|
+
"@qite/tide-client": "^1.1.178",
|
|
33
33
|
"@reduxjs/toolkit": "^2.8.2",
|
|
34
34
|
"@rollup/plugin-commonjs": "^19.0.1",
|
|
35
35
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -46,6 +46,19 @@ const Filters: React.FC<FiltersProps> = ({ initialFilters, filters, isOpen, hand
|
|
|
46
46
|
setFilters(updated);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
const handleStarRatingFilter = (filter: Filter, rating: number) => {
|
|
50
|
+
const updated = filters.map((f) => {
|
|
51
|
+
if (f.property !== filter.property) return f;
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
...f,
|
|
55
|
+
selectedRating: f.selectedRating === rating ? 0 : rating
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
setFilters(updated);
|
|
60
|
+
};
|
|
61
|
+
|
|
49
62
|
const handleSliderChange = (filter: Filter, newMin: number, newMax: number) => {
|
|
50
63
|
const updated = filters.map((f) => {
|
|
51
64
|
if (f.property !== filter.property) return f;
|
|
@@ -179,42 +192,29 @@ const Filters: React.FC<FiltersProps> = ({ initialFilters, filters, isOpen, hand
|
|
|
179
192
|
);
|
|
180
193
|
})()}
|
|
181
194
|
|
|
182
|
-
{
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
className={`star ${star <= selectedRating ? 'filled' : ''}`}
|
|
206
|
-
onClick={() => handleRatingChange(star)}
|
|
207
|
-
role="button"
|
|
208
|
-
tabIndex={0}
|
|
209
|
-
onKeyDown={(e) => {
|
|
210
|
-
if (e.key === 'Enter' || e.key === ' ') handleRatingChange(star);
|
|
211
|
-
}}>
|
|
212
|
-
★
|
|
213
|
-
</span>
|
|
214
|
-
))}
|
|
215
|
-
</div>
|
|
216
|
-
);
|
|
217
|
-
})()} */}
|
|
195
|
+
{isVisible &&
|
|
196
|
+
filter.property === 'rating' &&
|
|
197
|
+
filter.type === 'star-rating' &&
|
|
198
|
+
(() => {
|
|
199
|
+
const selectedRating = filter.selectedRating ?? 0;
|
|
200
|
+
return (
|
|
201
|
+
<div className="search__filter-row star-rating-filter">
|
|
202
|
+
{[5, 4, 3, 2, 1].map((star) => (
|
|
203
|
+
<span
|
|
204
|
+
key={star}
|
|
205
|
+
className={`star ${star <= selectedRating ? 'filled' : ''}`}
|
|
206
|
+
onClick={() => handleStarRatingFilter(filter, star)}
|
|
207
|
+
role="button"
|
|
208
|
+
tabIndex={0}
|
|
209
|
+
onKeyDown={(e) => {
|
|
210
|
+
if (e.key === 'Enter' || e.key === ' ') handleStarRatingFilter(filter, star);
|
|
211
|
+
}}>
|
|
212
|
+
★
|
|
213
|
+
</span>
|
|
214
|
+
))}
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
})()}
|
|
218
218
|
</div>
|
|
219
219
|
);
|
|
220
220
|
})}
|
|
@@ -26,7 +26,7 @@ const HotelCard: React.FC<HotelCardProps> = ({ result, translations }) => {
|
|
|
26
26
|
className="search__result-card__wrapper search__result-card__wrapper--custom"
|
|
27
27
|
onMouseEnter={(e) => (e.currentTarget.style.transform = 'scale(1.02)')}
|
|
28
28
|
onMouseLeave={(e) => (e.currentTarget.style.transform = 'scale(1)')}>
|
|
29
|
-
<div dangerouslySetInnerHTML={{ __html: he.decode(result.contents) }}></div>
|
|
29
|
+
<div className="search__result-card__top" dangerouslySetInnerHTML={{ __html: he.decode(result.contents) }}></div>
|
|
30
30
|
<div className="search__result-card__footer">
|
|
31
31
|
<button
|
|
32
32
|
type="button"
|
|
@@ -132,6 +132,33 @@ export const enrichFiltersWithPackageAccoResults = (results: PackagingAccommodat
|
|
|
132
132
|
|
|
133
133
|
filters.push(priceFilter);
|
|
134
134
|
|
|
135
|
+
const starsFilter: Filter = {
|
|
136
|
+
property: 'rating',
|
|
137
|
+
label: 'Stars',
|
|
138
|
+
type: 'star-rating',
|
|
139
|
+
options: [],
|
|
140
|
+
isFrontendFilter: true
|
|
141
|
+
};
|
|
142
|
+
const ratingMap = new Map<string, { name?: string; value: number }>();
|
|
143
|
+
|
|
144
|
+
results.forEach((r) => {
|
|
145
|
+
const stars = r.stars;
|
|
146
|
+
if (stars) {
|
|
147
|
+
ratingMap.set(stars.toString(), {
|
|
148
|
+
name: stars.toString(),
|
|
149
|
+
value: stars
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
starsFilter.options = Array.from(ratingMap.values()).map((rating) => ({
|
|
155
|
+
label: rating.name ?? rating.value.toString(),
|
|
156
|
+
value: rating.value,
|
|
157
|
+
isChecked: false
|
|
158
|
+
}));
|
|
159
|
+
|
|
160
|
+
filters.push(starsFilter);
|
|
161
|
+
|
|
135
162
|
return filters;
|
|
136
163
|
};
|
|
137
164
|
|
|
@@ -396,6 +423,14 @@ export const applyFiltersToPackageAccoResults = (results: PackagingAccommodation
|
|
|
396
423
|
return true;
|
|
397
424
|
}
|
|
398
425
|
|
|
426
|
+
// RATING
|
|
427
|
+
if (filter.property === 'rating') {
|
|
428
|
+
if (r.stars == null) return false;
|
|
429
|
+
if (filter.selectedRating != null && r.stars < filter.selectedRating) return false;
|
|
430
|
+
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
|
|
399
434
|
return true;
|
|
400
435
|
});
|
|
401
436
|
});
|
|
@@ -1053,6 +1053,14 @@
|
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
+
&__top {
|
|
1057
|
+
display: flex;
|
|
1058
|
+
flex-direction: column;
|
|
1059
|
+
justify-content: flex-start;
|
|
1060
|
+
align-items: flex-start;
|
|
1061
|
+
width: 100%;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1056
1064
|
&__img-wrapper {
|
|
1057
1065
|
position: relative;
|
|
1058
1066
|
width: 100%;
|
|
@@ -1638,6 +1646,12 @@
|
|
|
1638
1646
|
}
|
|
1639
1647
|
}
|
|
1640
1648
|
|
|
1649
|
+
&__top {
|
|
1650
|
+
@include mixins.media-sm {
|
|
1651
|
+
flex-direction: row;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1641
1655
|
&__img-wrapper {
|
|
1642
1656
|
@include mixins.media-sm {
|
|
1643
1657
|
width: 40%;
|
|
@@ -1708,9 +1722,11 @@
|
|
|
1708
1722
|
&__footer {
|
|
1709
1723
|
@include mixins.media-sm {
|
|
1710
1724
|
justify-content: flex-end;
|
|
1725
|
+
align-items: flex-end;
|
|
1711
1726
|
|
|
1712
1727
|
.cta {
|
|
1713
1728
|
width: auto;
|
|
1729
|
+
min-width: 150px;
|
|
1714
1730
|
}
|
|
1715
1731
|
}
|
|
1716
1732
|
}
|
|
@@ -1825,6 +1841,12 @@
|
|
|
1825
1841
|
}
|
|
1826
1842
|
}
|
|
1827
1843
|
|
|
1844
|
+
&__top {
|
|
1845
|
+
@include mixins.media-sm {
|
|
1846
|
+
flex-direction: row;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1828
1850
|
&__img-wrapper {
|
|
1829
1851
|
@include mixins.media-sm {
|
|
1830
1852
|
min-width: 175px;
|
|
@@ -1902,6 +1924,7 @@
|
|
|
1902
1924
|
|
|
1903
1925
|
.cta {
|
|
1904
1926
|
width: auto;
|
|
1927
|
+
min-width: 150px;
|
|
1905
1928
|
}
|
|
1906
1929
|
}
|
|
1907
1930
|
}
|