@qite/tide-booking-component 1.4.121 → 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
CHANGED
|
@@ -42187,6 +42187,13 @@ var Filters = function (_a) {
|
|
|
42187
42187
|
});
|
|
42188
42188
|
setFilters(updated);
|
|
42189
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
|
+
};
|
|
42190
42197
|
var handleSliderChange = function (filter, newMin, newMax) {
|
|
42191
42198
|
var updated = filters.map(function (f) {
|
|
42192
42199
|
if (f.property !== filter.property) return f;
|
|
@@ -42363,6 +42370,35 @@ var Filters = function (_a) {
|
|
|
42363
42370
|
handleSliderChange(filter, newMin, newMax);
|
|
42364
42371
|
}
|
|
42365
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
|
+
);
|
|
42366
42402
|
})()
|
|
42367
42403
|
);
|
|
42368
42404
|
})
|
|
@@ -45811,6 +45847,32 @@ var enrichFiltersWithPackageAccoResults = function (results, tags) {
|
|
|
45811
45847
|
priceFilter.min = Math.floor(Math.min.apply(Math, prices));
|
|
45812
45848
|
priceFilter.max = Math.ceil(Math.max.apply(Math, prices));
|
|
45813
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);
|
|
45814
45876
|
return filters;
|
|
45815
45877
|
};
|
|
45816
45878
|
var enrichFiltersWithPackageFlightResults = function (results, tags, translations) {
|
|
@@ -46123,6 +46185,12 @@ var applyFiltersToPackageAccoResults = function (results, filters, sortBy) {
|
|
|
46123
46185
|
if (filter.selectedMax != null && r.price > filter.selectedMax) return false;
|
|
46124
46186
|
return true;
|
|
46125
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
|
+
}
|
|
46126
46194
|
return true;
|
|
46127
46195
|
});
|
|
46128
46196
|
});
|
package/build/build-esm/index.js
CHANGED
|
@@ -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
|
})}
|
|
@@ -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
|
});
|