@qite/tide-booking-component 1.1.3 → 1.2.0
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/booking-product/components/multi-range-filter.d.ts +12 -0
- package/build/build-cjs/booking-wizard/features/booking/api.d.ts +4 -1
- package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +7 -3
- package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +23 -17
- package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +9 -0
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -0
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -0
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +4 -9
- package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +6 -0
- package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +9 -0
- package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +12 -0
- package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +9 -0
- package/build/build-cjs/booking-wizard/types.d.ts +101 -0
- package/build/build-cjs/index.js +1563 -606
- package/build/build-cjs/shared/utils/localization-util.d.ts +30 -2
- package/build/build-esm/booking-product/components/multi-range-filter.d.ts +12 -0
- package/build/build-esm/booking-wizard/features/booking/api.d.ts +4 -1
- package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +7 -3
- package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +23 -17
- package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +9 -0
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -0
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -0
- package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +4 -9
- package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +6 -0
- package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +9 -0
- package/build/build-esm/booking-wizard/features/room-options/room.d.ts +12 -0
- package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +9 -0
- package/build/build-esm/booking-wizard/types.d.ts +101 -0
- package/build/build-esm/index.js +1564 -607
- package/build/build-esm/shared/utils/localization-util.d.ts +30 -2
- package/package.json +3 -3
- package/rollup.config.js +23 -23
- package/src/booking-product/components/multi-range-filter.css +115 -0
- package/src/booking-product/components/multi-range-filter.tsx +114 -0
- package/src/booking-wizard/components/labeled-input.tsx +64 -64
- package/src/booking-wizard/components/labeled-select.tsx +69 -69
- package/src/booking-wizard/components/step-indicator.tsx +3 -3
- package/src/booking-wizard/features/booking/api.ts +12 -1
- package/src/booking-wizard/features/booking/booking-self-contained.tsx +50 -20
- package/src/booking-wizard/features/booking/booking-slice.ts +45 -9
- package/src/booking-wizard/features/booking/booking.tsx +67 -56
- package/src/booking-wizard/features/booking/selectors.ts +38 -11
- package/src/booking-wizard/features/flight-options/flight-filter.tsx +343 -0
- package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +350 -0
- package/src/booking-wizard/features/flight-options/flight-option.tsx +30 -759
- package/src/booking-wizard/features/flight-options/flight-utils.ts +401 -0
- package/src/booking-wizard/features/flight-options/index.tsx +55 -368
- package/src/booking-wizard/features/price-details/util.ts +6 -6
- package/src/booking-wizard/features/product-options/option-room.tsx +3 -5
- package/src/booking-wizard/features/product-options/options-form.tsx +46 -54
- package/src/booking-wizard/features/room-options/index.tsx +48 -144
- package/src/booking-wizard/features/room-options/room-utils.ts +143 -0
- package/src/booking-wizard/features/room-options/room.tsx +124 -0
- package/src/booking-wizard/features/room-options/traveler-rooms.tsx +63 -0
- package/src/booking-wizard/features/sidebar/sidebar-util.ts +2 -2
- package/src/booking-wizard/features/summary/summary.tsx +2 -2
- package/src/booking-wizard/features/travelers-form/travelers-form.tsx +1 -1
- package/src/booking-wizard/types.ts +116 -0
- package/src/shared/components/rating.tsx +21 -21
- package/src/shared/translations/fr-BE.json +222 -192
- package/src/shared/translations/nl-BE.json +222 -192
- package/src/shared/utils/class-util.ts +9 -9
- package/tsconfig.json +24 -24
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { useSelector } from "react-redux";
|
|
3
|
+
import { buildClassName } from "../../../shared/utils/class-util";
|
|
4
|
+
import { FlightFilterOptions } from "../../types";
|
|
5
|
+
import { selectTranslations } from "../booking/selectors";
|
|
6
|
+
import MultiRangeFilter from "../../../booking-product/components/multi-range-filter";
|
|
7
|
+
import { formatMinutes } from "./flight-utils";
|
|
8
|
+
|
|
9
|
+
interface FlightFilterProps {
|
|
10
|
+
filterOptions: FlightFilterOptions;
|
|
11
|
+
resultCount: number;
|
|
12
|
+
|
|
13
|
+
applyFilter: (options: FlightFilterOptions) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FlightFilter: React.FC<FlightFilterProps> = ({
|
|
17
|
+
filterOptions,
|
|
18
|
+
resultCount,
|
|
19
|
+
applyFilter
|
|
20
|
+
}) => {
|
|
21
|
+
const translations = useSelector(selectTranslations);
|
|
22
|
+
|
|
23
|
+
const [filtersVisible, setFiltersVisible] = useState<boolean>(false);
|
|
24
|
+
|
|
25
|
+
const updateAirportFilter = (code: string) => {
|
|
26
|
+
const updatedFilterOptions = {
|
|
27
|
+
...filterOptions,
|
|
28
|
+
airports: filterOptions.airports.map(x => {
|
|
29
|
+
if (x.value !== code) return x;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
...x,
|
|
33
|
+
isSelected: !x.isSelected
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
applyFilter(updatedFilterOptions);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const updateAirlineFilter = (code: string) => {
|
|
42
|
+
const updatedFilterOptions = {
|
|
43
|
+
...filterOptions,
|
|
44
|
+
airlines: filterOptions.airlines.map(x => {
|
|
45
|
+
if (x.value !== code) return x;
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
...x,
|
|
49
|
+
isSelected: !x.isSelected
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
applyFilter(updatedFilterOptions);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const updateStopsFilter = (count: string) => {
|
|
58
|
+
const updatedFilterOptions = {
|
|
59
|
+
...filterOptions,
|
|
60
|
+
numberOfStops: filterOptions.airlines.map(x => {
|
|
61
|
+
if (x.value !== count) return x;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
...x,
|
|
65
|
+
isSelected: !x.isSelected
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
applyFilter(updatedFilterOptions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const updateOutwardDeparture = (period: string) => {
|
|
74
|
+
const updatedFilterOptions = {
|
|
75
|
+
...filterOptions,
|
|
76
|
+
outward: {
|
|
77
|
+
...filterOptions.outward,
|
|
78
|
+
departurePeriod: filterOptions.outward.departurePeriod.map(x => {
|
|
79
|
+
if (x.value !== period) return x;
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
...x,
|
|
83
|
+
isSelected: !x.isSelected
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
applyFilter(updatedFilterOptions);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const updateOutwardTravelDuration = (min: number, max: number) => {
|
|
93
|
+
const updatedFilterOptions = {
|
|
94
|
+
...filterOptions,
|
|
95
|
+
outward: {
|
|
96
|
+
...filterOptions.outward,
|
|
97
|
+
travelDuration: {
|
|
98
|
+
...filterOptions.outward.travelDuration,
|
|
99
|
+
selectedMin: min,
|
|
100
|
+
selectedMax: max
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
applyFilter(updatedFilterOptions);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const updateOutwardChangeDuration = (min: number, max: number) => {
|
|
109
|
+
const updatedFilterOptions = {
|
|
110
|
+
...filterOptions,
|
|
111
|
+
outward: {
|
|
112
|
+
...filterOptions.outward,
|
|
113
|
+
changeDuration: {
|
|
114
|
+
...filterOptions.outward.changeDuration,
|
|
115
|
+
selectedMin: min,
|
|
116
|
+
selectedMax: max
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
applyFilter(updatedFilterOptions);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const updateReturnDeparture = (period: string) => {
|
|
125
|
+
const updatedFilterOptions = {
|
|
126
|
+
...filterOptions,
|
|
127
|
+
return: {
|
|
128
|
+
...filterOptions.return,
|
|
129
|
+
departurePeriod: filterOptions.return.departurePeriod.map(x => {
|
|
130
|
+
if (x.value !== period) return x;
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
...x,
|
|
134
|
+
isSelected: !x.isSelected
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
applyFilter(updatedFilterOptions);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const updateReturnTravelDuration = (min: number, max: number) => {
|
|
144
|
+
const updatedFilterOptions = {
|
|
145
|
+
...filterOptions,
|
|
146
|
+
return: {
|
|
147
|
+
...filterOptions.return,
|
|
148
|
+
travelDuration: {
|
|
149
|
+
...filterOptions.return.travelDuration,
|
|
150
|
+
selectedMin: min,
|
|
151
|
+
selectedMax: max
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
applyFilter(updatedFilterOptions);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const updateReturnChangeDuration = (min: number, max: number) => {
|
|
160
|
+
const updatedFilterOptions = {
|
|
161
|
+
...filterOptions,
|
|
162
|
+
return: {
|
|
163
|
+
...filterOptions.return,
|
|
164
|
+
changeDuration: {
|
|
165
|
+
...filterOptions.return.changeDuration,
|
|
166
|
+
selectedMin: min,
|
|
167
|
+
selectedMax: max
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
applyFilter(updatedFilterOptions);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
<button type="button" className="cta cta--filter" onClick={() => setFiltersVisible(!filtersVisible)}>
|
|
178
|
+
<svg width={11} height={10}><use href="/icons/svg-sprite.svg#filter"></use></svg>
|
|
179
|
+
<span>{translations.FLIGHTS_FORM.FILTER_OPTIONS}</span>
|
|
180
|
+
{filtersVisible}
|
|
181
|
+
</button>
|
|
182
|
+
|
|
183
|
+
<div className={buildClassName(["flight__filter", filtersVisible && "flight__filter--active"])}>
|
|
184
|
+
<div className="flight__filter__header">
|
|
185
|
+
<div className="flight__filter__header__title">
|
|
186
|
+
<h3>{translations.FLIGHTS_FORM.FILTER_OPTIONS}</h3>
|
|
187
|
+
<p>er zijn <strong>{resultCount} vluchten</strong> gevonden</p>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div className="flight__filter__body">
|
|
191
|
+
<div className="flight__filter__group">
|
|
192
|
+
<div className="flight__filter__group__title">
|
|
193
|
+
{translations.FLIGHTS_FORM.AIRLINES}
|
|
194
|
+
</div>
|
|
195
|
+
<div className="flight__filter__group__wrapper">
|
|
196
|
+
{filterOptions.airlines.map((option, k) => (
|
|
197
|
+
<div className="tree" key={k}>
|
|
198
|
+
<div className="checkbox flight__filter__checkbox">
|
|
199
|
+
<label htmlFor={'airline_' + option.value} className="checkbox__label">
|
|
200
|
+
<input type="checkbox" id={'airline_' + option.value} className="checkbox__input checkbox__input--parent"
|
|
201
|
+
onClick={() => updateAirlineFilter(option.value)} />
|
|
202
|
+
<span className="radiobutton__label-text">
|
|
203
|
+
{option.label} {option.count > 0 && (<span className="amount">({option.count})</span>)}
|
|
204
|
+
</span>
|
|
205
|
+
</label>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
))}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div className="flight__filter__group">
|
|
212
|
+
<div className="flight__filter__group__title">
|
|
213
|
+
{translations.FLIGHTS_FORM.AIRPORTS}
|
|
214
|
+
</div>
|
|
215
|
+
<div className="flight__filter__group__wrapper">
|
|
216
|
+
{filterOptions.airports.map((option, k) => (
|
|
217
|
+
<div className="tree" key={k}>
|
|
218
|
+
<div className="checkbox flight__filter__checkbox">
|
|
219
|
+
<label htmlFor={'airport_' + option.value} className="checkbox__label">
|
|
220
|
+
<input type="checkbox" id={'airport_' + option.value} className="checkbox__input checkbox__input--parent"
|
|
221
|
+
onClick={() => updateAirportFilter(option.value)} />
|
|
222
|
+
<span className="radiobutton__label-text">
|
|
223
|
+
{option.label} {option.count > 0 && (<span className="amount">({option.count})</span>)}
|
|
224
|
+
</span>
|
|
225
|
+
</label>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
))}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
<div className="flight__filter__group">
|
|
232
|
+
<div className="flight__filter__group__title">
|
|
233
|
+
{translations.FLIGHTS_FORM.NUMBER_OF_STOPS}
|
|
234
|
+
</div>
|
|
235
|
+
<div className="flight__filter__group__wrapper">
|
|
236
|
+
{filterOptions.numberOfStops.map((option, k) => (
|
|
237
|
+
<div className="tree" key={k}>
|
|
238
|
+
<div className="checkbox flight__filter__checkbox">
|
|
239
|
+
<label htmlFor={'stops_' + option.value} className="checkbox__label">
|
|
240
|
+
<input type="checkbox" id={'stops_' + option.value} className="checkbox__input checkbox__input--parent"
|
|
241
|
+
onClick={() => updateStopsFilter(option.value)} />
|
|
242
|
+
<span className="radiobutton__label-text">
|
|
243
|
+
{option.label} {option.count > 0 && (<span className="amount">({option.count})</span>)}
|
|
244
|
+
</span>
|
|
245
|
+
</label>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
))}
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
<div className="flight__filter__group">
|
|
252
|
+
<div className="flight__filter__group__title">
|
|
253
|
+
{translations.FLIGHTS_FORM.FLIGHT_OUTWARD}
|
|
254
|
+
</div>
|
|
255
|
+
<div className="flight__filter__group__wrapper">
|
|
256
|
+
<p>{translations.FLIGHTS_FORM.DEPARTURE_TIME}</p>
|
|
257
|
+
{filterOptions.outward.departurePeriod.map((option, k) => (
|
|
258
|
+
<div className="tree" key={k}>
|
|
259
|
+
<div className="checkbox flight__filter__checkbox">
|
|
260
|
+
<label htmlFor={'outward_time_' + option.value} className="checkbox__label">
|
|
261
|
+
<input type="checkbox" id={'outward_time_' + option.value} className="checkbox__input checkbox__input--parent"
|
|
262
|
+
onClick={() => updateOutwardDeparture(option.value)} />
|
|
263
|
+
<span className="radiobutton__label-text">
|
|
264
|
+
{option.label} {option.count > 0 && (<span className="amount">({option.count})</span>)}
|
|
265
|
+
</span>
|
|
266
|
+
</label>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
))}
|
|
270
|
+
</div>
|
|
271
|
+
<div className="flight__filter__group__wrapper">
|
|
272
|
+
<p>{translations.FLIGHTS_FORM.TRAVEL_DURATION}</p>
|
|
273
|
+
<MultiRangeFilter
|
|
274
|
+
min={filterOptions.outward.travelDuration.min}
|
|
275
|
+
max={filterOptions.outward.travelDuration.max}
|
|
276
|
+
selectedMin={filterOptions.outward.travelDuration.selectedMin}
|
|
277
|
+
selectedMax={filterOptions.outward.travelDuration.selectedMax}
|
|
278
|
+
valueFormatter={formatMinutes}
|
|
279
|
+
onChange={updateOutwardTravelDuration}
|
|
280
|
+
/>
|
|
281
|
+
</div>
|
|
282
|
+
<div className="flight__filter__group__wrapper">
|
|
283
|
+
<p>{translations.FLIGHTS_FORM.CHANGE_TIME}</p>
|
|
284
|
+
<MultiRangeFilter
|
|
285
|
+
min={filterOptions.outward.changeDuration.min}
|
|
286
|
+
max={filterOptions.outward.changeDuration.max}
|
|
287
|
+
selectedMin={filterOptions.outward.changeDuration.selectedMin}
|
|
288
|
+
selectedMax={filterOptions.outward.changeDuration.selectedMax}
|
|
289
|
+
valueFormatter={formatMinutes}
|
|
290
|
+
onChange={updateOutwardChangeDuration}
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
<div className="flight__filter__group">
|
|
295
|
+
<div className="flight__filter__group__title">
|
|
296
|
+
{translations.FLIGHTS_FORM.FLIGHT_RETURN}
|
|
297
|
+
</div>
|
|
298
|
+
<div className="flight__filter__group__wrapper">
|
|
299
|
+
<p>{translations.FLIGHTS_FORM.DEPARTURE_TIME}</p>
|
|
300
|
+
{filterOptions.return.departurePeriod.map((option, k) => (
|
|
301
|
+
<div className="tree" key={k}>
|
|
302
|
+
<div className="checkbox flight__filter__checkbox">
|
|
303
|
+
<label htmlFor={'return_time_' + option.value} className="checkbox__label">
|
|
304
|
+
<input type="checkbox" id={'return_time_' + option.value} className="checkbox__input checkbox__input--parent"
|
|
305
|
+
onClick={() => updateReturnDeparture(option.value)} />
|
|
306
|
+
<span className="radiobutton__label-text">
|
|
307
|
+
{option.label} {option.count > 0 && (<span className="amount">({option.count})</span>)}
|
|
308
|
+
</span>
|
|
309
|
+
</label>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
))}
|
|
313
|
+
</div>
|
|
314
|
+
<div className="flight__filter__group__wrapper">
|
|
315
|
+
<p>{translations.FLIGHTS_FORM.TRAVEL_DURATION}</p>
|
|
316
|
+
<MultiRangeFilter
|
|
317
|
+
min={filterOptions.return.travelDuration.min}
|
|
318
|
+
max={filterOptions.return.travelDuration.max}
|
|
319
|
+
selectedMin={filterOptions.return.travelDuration.selectedMin}
|
|
320
|
+
selectedMax={filterOptions.return.travelDuration.selectedMax}
|
|
321
|
+
valueFormatter={formatMinutes}
|
|
322
|
+
onChange={updateReturnTravelDuration}
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
<div className="flight__filter__group__wrapper">
|
|
326
|
+
<p>{translations.FLIGHTS_FORM.CHANGE_TIME}</p>
|
|
327
|
+
<MultiRangeFilter
|
|
328
|
+
min={filterOptions.return.changeDuration.min}
|
|
329
|
+
max={filterOptions.return.changeDuration.max}
|
|
330
|
+
selectedMin={filterOptions.return.changeDuration.selectedMin}
|
|
331
|
+
selectedMax={filterOptions.return.changeDuration.selectedMax}
|
|
332
|
+
valueFormatter={formatMinutes}
|
|
333
|
+
onChange={updateReturnChangeDuration}
|
|
334
|
+
/>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</>
|
|
340
|
+
)
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export default FlightFilter;
|