@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.
Files changed (63) hide show
  1. package/build/build-cjs/booking-product/components/multi-range-filter.d.ts +12 -0
  2. package/build/build-cjs/booking-wizard/features/booking/api.d.ts +4 -1
  3. package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +7 -3
  4. package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +23 -17
  5. package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +9 -0
  6. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -0
  7. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -0
  8. package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +4 -9
  9. package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +6 -0
  10. package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +9 -0
  11. package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +12 -0
  12. package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +9 -0
  13. package/build/build-cjs/booking-wizard/types.d.ts +101 -0
  14. package/build/build-cjs/index.js +1563 -606
  15. package/build/build-cjs/shared/utils/localization-util.d.ts +30 -2
  16. package/build/build-esm/booking-product/components/multi-range-filter.d.ts +12 -0
  17. package/build/build-esm/booking-wizard/features/booking/api.d.ts +4 -1
  18. package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +7 -3
  19. package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +23 -17
  20. package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +9 -0
  21. package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -0
  22. package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -0
  23. package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +4 -9
  24. package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +6 -0
  25. package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +9 -0
  26. package/build/build-esm/booking-wizard/features/room-options/room.d.ts +12 -0
  27. package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +9 -0
  28. package/build/build-esm/booking-wizard/types.d.ts +101 -0
  29. package/build/build-esm/index.js +1564 -607
  30. package/build/build-esm/shared/utils/localization-util.d.ts +30 -2
  31. package/package.json +3 -3
  32. package/rollup.config.js +23 -23
  33. package/src/booking-product/components/multi-range-filter.css +115 -0
  34. package/src/booking-product/components/multi-range-filter.tsx +114 -0
  35. package/src/booking-wizard/components/labeled-input.tsx +64 -64
  36. package/src/booking-wizard/components/labeled-select.tsx +69 -69
  37. package/src/booking-wizard/components/step-indicator.tsx +3 -3
  38. package/src/booking-wizard/features/booking/api.ts +12 -1
  39. package/src/booking-wizard/features/booking/booking-self-contained.tsx +50 -20
  40. package/src/booking-wizard/features/booking/booking-slice.ts +45 -9
  41. package/src/booking-wizard/features/booking/booking.tsx +67 -56
  42. package/src/booking-wizard/features/booking/selectors.ts +38 -11
  43. package/src/booking-wizard/features/flight-options/flight-filter.tsx +343 -0
  44. package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +350 -0
  45. package/src/booking-wizard/features/flight-options/flight-option.tsx +30 -759
  46. package/src/booking-wizard/features/flight-options/flight-utils.ts +401 -0
  47. package/src/booking-wizard/features/flight-options/index.tsx +55 -368
  48. package/src/booking-wizard/features/price-details/util.ts +6 -6
  49. package/src/booking-wizard/features/product-options/option-room.tsx +3 -5
  50. package/src/booking-wizard/features/product-options/options-form.tsx +46 -54
  51. package/src/booking-wizard/features/room-options/index.tsx +48 -144
  52. package/src/booking-wizard/features/room-options/room-utils.ts +143 -0
  53. package/src/booking-wizard/features/room-options/room.tsx +124 -0
  54. package/src/booking-wizard/features/room-options/traveler-rooms.tsx +63 -0
  55. package/src/booking-wizard/features/sidebar/sidebar-util.ts +2 -2
  56. package/src/booking-wizard/features/summary/summary.tsx +2 -2
  57. package/src/booking-wizard/features/travelers-form/travelers-form.tsx +1 -1
  58. package/src/booking-wizard/types.ts +116 -0
  59. package/src/shared/components/rating.tsx +21 -21
  60. package/src/shared/translations/fr-BE.json +222 -192
  61. package/src/shared/translations/nl-BE.json +222 -192
  62. package/src/shared/utils/class-util.ts +9 -9
  63. package/tsconfig.json +24 -24
@@ -10,6 +10,7 @@ import {
10
10
  } from "../../../shared/utils/query-string-util";
11
11
  import {
12
12
  fetchPackage,
13
+ setAccommodationViewId,
13
14
  setAgentAdressId,
14
15
  setBookingAttributes,
15
16
  setBookingNumber,
@@ -28,21 +29,25 @@ import {
28
29
 
29
30
  import { isNil } from "lodash";
30
31
  import { useEffect } from "react";
31
- import { setApiKey, setApiUrl } from "../../api-settings-slice";
32
32
  import Loader from "../../../shared/components/loader";
33
+ import { setApiKey, setApiUrl } from "../../api-settings-slice";
33
34
  import StepRoute from "../../components/step-route";
34
35
  import SettingsContext from "../../settings-context";
35
36
  import { useAppDispatch } from "../../store";
36
37
  import Confirmation from "../confirmation/confirmation";
37
38
  import Error from "../error/error";
39
+ import FlightOptionsForm from "../flight-options";
38
40
  import OptionsForm from "../product-options/options-form";
41
+ import RoomOptionsForm from "../room-options";
39
42
  import Sidebar from "../sidebar";
40
43
  import Summary from "../summary/summary";
41
44
  import TravelersForm from "../travelers-form/travelers-form";
42
45
  import {
43
46
  CONFIRMATION_STEP,
44
47
  ERROR_STEP,
48
+ FLIGHT_OPTIONS_FORM_STEP,
45
49
  OPTIONS_FORM_STEP,
50
+ ROOM_OPTIONS_FORM_STEP,
46
51
  SUMMARY_STEP,
47
52
  TRAVELERS_FORM_STEP,
48
53
  } from "./constants";
@@ -52,7 +57,6 @@ import {
52
57
  selectBookingNumber,
53
58
  selectBookingRooms,
54
59
  selectCurrentStep,
55
- selectIsRetry,
56
60
  selectIsUnavailable,
57
61
  selectPackageDetails,
58
62
  selectProductAttributes,
@@ -83,6 +87,9 @@ const BookingSelfContained: React.FC<BookingProps> = ({
83
87
  apiUrl,
84
88
  apiKey,
85
89
  translationFiles,
90
+ roomOptions,
91
+ flightOptions,
92
+ accommodationViewId
86
93
  } = useContext(SettingsContext);
87
94
 
88
95
  const dispatch = useAppDispatch();
@@ -128,6 +135,10 @@ const BookingSelfContained: React.FC<BookingProps> = ({
128
135
  if (!isNil(bookingNumber)) {
129
136
  dispatch(setBookingNumber(bookingNumber));
130
137
  dispatch(setCurrentStep(CONFIRMATION_STEP));
138
+ } else if (!flightOptions.isHidden) {
139
+ dispatch(setCurrentStep(FLIGHT_OPTIONS_FORM_STEP));
140
+ } else if (!roomOptions.isHidden) {
141
+ dispatch(setCurrentStep(ROOM_OPTIONS_FORM_STEP));
131
142
  }
132
143
 
133
144
  if (
@@ -178,7 +189,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
178
189
  }, [productCode, productName, setProductAttributes]);
179
190
 
180
191
  const getTranslations = async () => {
181
- const translations = translationFiles?.map(x => fetch(x.path).then(y => y.json()).then(z => ({language: x.language, value: z})));
192
+ const translations = translationFiles?.map(x => fetch(x.path).then(y => y.json()).then(z => ({ language: x.language, value: z })));
182
193
  return translations && await Promise.all(translations);
183
194
  };
184
195
 
@@ -187,7 +198,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
187
198
  const translations = await getTranslations();
188
199
  dispatch(setTranslations(translations)); // Now dispatch the resolved value
189
200
  };
190
-
201
+
191
202
  loadTranslations();
192
203
 
193
204
  dispatch(setOfficeId(officeId));
@@ -201,6 +212,10 @@ const BookingSelfContained: React.FC<BookingProps> = ({
201
212
  if (agentAdressId && agentAdressId != 0) {
202
213
  dispatch(setBookingType("b2b"));
203
214
  }
215
+ if (accommodationViewId && accommodationViewId != 0) {
216
+ dispatch(setAccommodationViewId(accommodationViewId));
217
+ }
218
+
204
219
  }, [
205
220
  officeId,
206
221
  language,
@@ -211,6 +226,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
211
226
  setCalculateDeposit,
212
227
  tagIds,
213
228
  agentAdressId,
229
+ accommodationViewId,
214
230
  ]);
215
231
 
216
232
  useEffect(() => {
@@ -239,14 +255,28 @@ const BookingSelfContained: React.FC<BookingProps> = ({
239
255
  apiSettings.apiKey,
240
256
  ]);
241
257
 
242
- // const translations = getTranslations(language);
243
-
244
258
  const renderStep = () => {
245
259
  switch (currentStep) {
246
- case OPTIONS_FORM_STEP:
260
+ case FLIGHT_OPTIONS_FORM_STEP:
247
261
  return (
248
262
  <StepRoute
249
263
  number={1}
264
+ title={translations.STEPS.FLIGHT_OPTIONS}
265
+ component={<FlightOptionsForm />}
266
+ />
267
+ );
268
+ case ROOM_OPTIONS_FORM_STEP:
269
+ return (
270
+ <StepRoute
271
+ number={1 + (flightOptions.isHidden ? 0 : 1)}
272
+ title={translations.STEPS.ROOM_OPTIONS}
273
+ component={<RoomOptionsForm />}
274
+ />
275
+ );
276
+ case OPTIONS_FORM_STEP:
277
+ return (
278
+ <StepRoute
279
+ number={1 + (roomOptions.isHidden ? 0 : 1) + (flightOptions.isHidden ? 0 : 1)}
250
280
  title={translations.STEPS.EXTRA_OPTIONS}
251
281
  component={<OptionsForm />}
252
282
  />
@@ -254,7 +284,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
254
284
  case TRAVELERS_FORM_STEP:
255
285
  return (
256
286
  <StepRoute
257
- number={2}
287
+ number={2 + (roomOptions.isHidden ? 0 : 1) + (flightOptions.isHidden ? 0 : 1)}
258
288
  title={translations.STEPS.PERSONAL_DETAILS}
259
289
  component={<TravelersForm />}
260
290
  />
@@ -262,7 +292,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
262
292
  case SUMMARY_STEP:
263
293
  return (
264
294
  <StepRoute
265
- number={3}
295
+ number={3 + (roomOptions.isHidden ? 0 : 1) + (flightOptions.isHidden ? 0 : 1)}
266
296
  title={translations.STEPS.SUMMARY}
267
297
  component={<Summary />}
268
298
  />
@@ -270,7 +300,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
270
300
  case CONFIRMATION_STEP:
271
301
  return (
272
302
  <StepRoute
273
- number={4}
303
+ number={4 + (roomOptions.isHidden ? 0 : 1) + (flightOptions.isHidden ? 0 : 1)}
274
304
  title={translations.STEPS.CONFIRMATION}
275
305
  component={<Confirmation />}
276
306
  />
@@ -278,7 +308,7 @@ const BookingSelfContained: React.FC<BookingProps> = ({
278
308
  case ERROR_STEP:
279
309
  return (
280
310
  <StepRoute
281
- number={4}
311
+ number={5 + (roomOptions.isHidden ? 0 : 1) + (flightOptions.isHidden ? 0 : 1)}
282
312
  title={translations.STEPS.ERROR}
283
313
  component={<Error />}
284
314
  />
@@ -290,16 +320,16 @@ const BookingSelfContained: React.FC<BookingProps> = ({
290
320
  <>
291
321
  {((productAttributes && bookingAttributes && packageDetails) ||
292
322
  bookingNumber) && (
293
- <div className="booking">
294
- <div className="booking__content">
295
- <div className="booking__panel">{renderStep()}</div>
296
- <div className="backdrop" id="backdrop"></div>
297
- {packageDetails && (
298
- <Sidebar productName={productName} thumbnailUrl={thumbnailUrl} />
299
- )}
323
+ <div className="booking">
324
+ <div className="booking__content">
325
+ <div className="booking__panel">{renderStep()}</div>
326
+ <div className="backdrop" id="backdrop"></div>
327
+ {packageDetails && (
328
+ <Sidebar productName={productName} thumbnailUrl={thumbnailUrl} />
329
+ )}
330
+ </div>
300
331
  </div>
301
- </div>
302
- )}
332
+ )}
303
333
  {!packageDetails && !bookingNumber && !isUnvailable && (
304
334
  <div className="booking">
305
335
  <div className="booking__loader">
@@ -2,6 +2,7 @@ import { PayloadAction, createAsyncThunk, createSlice } from "@reduxjs/toolkit";
2
2
  import {
3
3
  BookingAttributes,
4
4
  BookingOptions,
5
+ GroupedFlights,
5
6
  ProductAttributes,
6
7
  } from "../../types";
7
8
 
@@ -21,6 +22,7 @@ import {
21
22
  BookingPackageRequestRoom,
22
23
  BookingPackageRoom,
23
24
  BookingTravelAgent,
25
+ GenerateBookingAccommodationRequest,
24
26
  PerBookingPackageOption,
25
27
  } from "@qite/tide-client/build/types";
26
28
  import { first, isEmpty, isNil, range } from "lodash";
@@ -29,11 +31,13 @@ import { selectAgentId } from "../travelers-form/travelers-form-slice";
29
31
  import packageApi from "./api";
30
32
  import { BookingStep, OPTIONS_FORM_STEP } from "./constants";
31
33
  import {
34
+ selectAccommodationCodes,
32
35
  selectBookingAttributes,
33
36
  selectBookingRooms,
34
37
  selectLanguageCode,
35
38
  selectOfficeId,
36
39
  selectProductAttributes,
40
+ selectProductCode,
37
41
  } from "./selectors";
38
42
 
39
43
  export interface BookingState {
@@ -61,6 +65,8 @@ export interface BookingState {
61
65
  language: string;
62
66
  value: any;
63
67
  }[];
68
+ accommodationViewId?: number;
69
+ accommodationViews?: { [key: string]: string };
64
70
  }
65
71
 
66
72
  const initialState: BookingState = {
@@ -105,6 +111,7 @@ export const fetchPackage = createAsyncThunk(
105
111
  dispatch(setFetchingPackage(true));
106
112
  await dispatch(fetchAgents());
107
113
  await dispatch(fetchPackageDetails());
114
+ await dispatch(fetchAccommodationViews());
108
115
  dispatch(setFetchingPackage(false));
109
116
  }
110
117
  );
@@ -187,6 +194,31 @@ const fetchPackageDetails = createAsyncThunk(
187
194
  }
188
195
  );
189
196
 
197
+ const fetchAccommodationViews = createAsyncThunk(
198
+ "booking/accommodationViews",
199
+ async (_, { dispatch, getState, signal }) => {
200
+ const state = getState() as RootState;
201
+ if (!state.booking.accommodationViewId) return Promise.resolve();
202
+
203
+ const languageCode = selectLanguageCode(state);
204
+ const accommodationCodes = selectAccommodationCodes(state);
205
+ const productCode = selectProductCode(state);
206
+
207
+ if (!productCode) {
208
+ throw Error('No product selected');
209
+ }
210
+
211
+ const request = {
212
+ languageCode: languageCode,
213
+ productCode: productCode,
214
+ accommodationCodes: accommodationCodes,
215
+ contentViewId: state.booking.accommodationViewId
216
+ } as GenerateBookingAccommodationRequest;
217
+
218
+ return await packageApi.fetchAccommodationViews(request, signal, state.apiSettings);
219
+ }
220
+ );
221
+
190
222
  const getActiveOption = (state: BookingState) => {
191
223
  if (state.package) return state.package.options.find((x) => x.isSelected);
192
224
  return null;
@@ -380,17 +412,15 @@ const bookingSlice = createSlice({
380
412
 
381
413
  state.currentStep = action.payload;
382
414
  },
383
- setOutwardFlight(state, action: PayloadAction<BookingPackageFlight>) {
415
+ setFlights(state, action: PayloadAction<GroupedFlights>) {
384
416
  if (!state.package) return;
385
417
 
386
- changeOutwardFlight(state.package, action.payload);
418
+ changeOutwardFlight(state.package, action.payload.selectedOutward);
419
+ changeReturnFlight(state.package, action.payload.selectedReturn);
387
420
  changePackageOption(state.package);
388
421
  },
389
- setReturnFlight(state, action: PayloadAction<BookingPackageFlight>) {
390
- if (!state.package) return;
391
-
392
- changeReturnFlight(state.package, action.payload);
393
- changePackageOption(state.package);
422
+ setAccommodationViewId(state, action: PayloadAction<number>) {
423
+ state.accommodationViewId = action.payload;
394
424
  }
395
425
  },
396
426
  extraReducers: (builder) => {
@@ -531,6 +561,11 @@ const bookingSlice = createSlice({
531
561
  state.agents = action.payload;
532
562
  }
533
563
  });
564
+ builder.addCase(fetchAccommodationViews.fulfilled, (state, action) => {
565
+ if (action.payload) {
566
+ state.accommodationViews = action.payload;
567
+ }
568
+ });
534
569
  },
535
570
  });
536
571
 
@@ -560,8 +595,9 @@ export const {
560
595
  setCurrentStep,
561
596
  setPackageAirlineGroups,
562
597
  setPackageAirportGroups,
563
- setOutwardFlight,
564
- setReturnFlight
598
+ setFlights,
599
+ setAccommodationViewId
565
600
  } = bookingSlice.actions;
566
601
 
567
602
  export default bookingSlice.reducer;
603
+
@@ -11,6 +11,7 @@ import {
11
11
  } from "../../../shared/utils/query-string-util";
12
12
  import {
13
13
  fetchPackage,
14
+ setAccommodationViewId,
14
15
  setAgentAdressId,
15
16
  setBookingAttributes,
16
17
  setBookingNumber,
@@ -82,6 +83,7 @@ const Booking: React.FC<BookingProps> = ({
82
83
  agentAdressId,
83
84
  language,
84
85
  translationFiles,
86
+ accommodationViewId
85
87
  } = useContext(SettingsContext);
86
88
 
87
89
  const dispatch = useAppDispatch();
@@ -94,7 +96,7 @@ const Booking: React.FC<BookingProps> = ({
94
96
  const isRetry = useSelector(selectIsRetry);
95
97
  const packageDetails = useSelector(selectPackageDetails);
96
98
  const isUnvailable = useSelector(selectIsUnavailable);
97
- const translations = useSelector(selectTranslations);
99
+ const translations = useSelector(selectTranslations);
98
100
 
99
101
  useEffect(() => {
100
102
  dispatch(setSkipPayment(skipPaymentWithAgent ?? false));
@@ -192,7 +194,7 @@ const Booking: React.FC<BookingProps> = ({
192
194
  }, [productCode, productName, setProductAttributes]);
193
195
 
194
196
  const getTranslations = async () => {
195
- const translations = translationFiles?.map(x => fetch(x.path).then(y => y.json()).then(z => ({language: x.language, value: z})));
197
+ const translations = translationFiles?.map(x => fetch(x.path).then(y => y.json()).then(z => ({ language: x.language, value: z })));
196
198
  return translations && await Promise.all(translations);
197
199
  };
198
200
 
@@ -201,7 +203,7 @@ const Booking: React.FC<BookingProps> = ({
201
203
  const translations = await getTranslations();
202
204
  dispatch(setTranslations(translations)); // Now dispatch the resolved value
203
205
  };
204
-
206
+
205
207
  loadTranslations();
206
208
 
207
209
  dispatch(setOfficeId(officeId));
@@ -215,6 +217,10 @@ const Booking: React.FC<BookingProps> = ({
215
217
  if (agentAdressId && agentAdressId != 0) {
216
218
  dispatch(setBookingType("b2b"));
217
219
  }
220
+ if (accommodationViewId && accommodationViewId != 0) {
221
+ dispatch(setAccommodationViewId(accommodationViewId));
222
+ }
223
+
218
224
  }, [
219
225
  officeId,
220
226
  language,
@@ -225,6 +231,7 @@ const Booking: React.FC<BookingProps> = ({
225
231
  setCalculateDeposit,
226
232
  tagIds,
227
233
  agentAdressId,
234
+ accommodationViewId
228
235
  ]);
229
236
 
230
237
  useEffect(() => {
@@ -256,61 +263,65 @@ const Booking: React.FC<BookingProps> = ({
256
263
  <>
257
264
  {((productAttributes && bookingAttributes && packageDetails) ||
258
265
  bookingNumber) && (
259
- <div className="booking">
260
- <div className="booking__content">
261
- <div className="booking__panel">
262
- <Router basepath={basePath}>
263
- {!roomOptions.isHidden && roomOptions.pathSuffix && (<StepRoute
264
- path={roomOptions.pathSuffix}
265
- number={numberIndex++}
266
- title={translations.STEPS.ROOM_OPTIONS}
267
- component={<RoomOptionsForm />}
268
- />)}
269
- {!flightOptions.isHidden && flightOptions.pathSuffix && (<StepRoute
270
- path={flightOptions.pathSuffix}
271
- number={numberIndex++}
272
- title={translations.STEPS.FLIGHT_OPTIONS}
273
- component={<FlightOptionsForm />}
274
- />)}
275
- <StepRoute
276
- path={options.pathSuffix}
277
- number={numberIndex++}
278
- title={translations.STEPS.EXTRA_OPTIONS}
279
- component={<OptionsForm />}
280
- />
281
- <StepRoute
282
- path={travellers.pathSuffix}
283
- number={numberIndex++}
284
- title={translations.STEPS.PERSONAL_DETAILS}
285
- component={<TravelersForm />}
286
- />
287
- <StepRoute
288
- path={summary.pathSuffix}
289
- number={numberIndex++}
290
- title={translations.STEPS.SUMMARY}
291
- component={<Summary />}
292
- />
293
- <StepRoute
294
- path={confirmation.pathSuffix}
295
- number={numberIndex++}
296
- title={translations.STEPS.CONFIRMATION}
297
- component={<Confirmation />}
298
- />
299
- <StepRoute
300
- path={error.pathSuffix}
301
- number={numberIndex++}
302
- title={translations.STEPS.ERROR}
303
- component={<Error />}
304
- />
305
- </Router>
266
+ <div className="booking">
267
+ <div className="booking__content">
268
+ <div className="booking__panel">
269
+ <Router basepath={basePath}>
270
+ {!flightOptions.isHidden && flightOptions.pathSuffix && (
271
+ <StepRoute
272
+ path={flightOptions.pathSuffix}
273
+ number={numberIndex++}
274
+ title={translations.STEPS.FLIGHT_OPTIONS}
275
+ component={<FlightOptionsForm />}
276
+ />
277
+ )}
278
+ {!roomOptions.isHidden && roomOptions.pathSuffix && (
279
+ <StepRoute
280
+ path={roomOptions.pathSuffix}
281
+ number={numberIndex++}
282
+ title={translations.STEPS.ROOM_OPTIONS}
283
+ component={<RoomOptionsForm />}
284
+ />
285
+ )}
286
+ <StepRoute
287
+ path={options.pathSuffix}
288
+ number={numberIndex++}
289
+ title={translations.STEPS.EXTRA_OPTIONS}
290
+ component={<OptionsForm />}
291
+ />
292
+ <StepRoute
293
+ path={travellers.pathSuffix}
294
+ number={numberIndex++}
295
+ title={translations.STEPS.PERSONAL_DETAILS}
296
+ component={<TravelersForm />}
297
+ />
298
+ <StepRoute
299
+ path={summary.pathSuffix}
300
+ number={numberIndex++}
301
+ title={translations.STEPS.SUMMARY}
302
+ component={<Summary />}
303
+ />
304
+ <StepRoute
305
+ path={confirmation.pathSuffix}
306
+ number={numberIndex++}
307
+ title={translations.STEPS.CONFIRMATION}
308
+ component={<Confirmation />}
309
+ />
310
+ <StepRoute
311
+ path={error.pathSuffix}
312
+ number={numberIndex++}
313
+ title={translations.STEPS.ERROR}
314
+ component={<Error />}
315
+ />
316
+ </Router>
317
+ </div>
318
+ <div className="backdrop" id="backdrop"></div>
319
+ {packageDetails && (
320
+ <Sidebar productName={productName} thumbnailUrl={thumbnailUrl} />
321
+ )}
306
322
  </div>
307
- <div className="backdrop" id="backdrop"></div>
308
- {packageDetails && (
309
- <Sidebar productName={productName} thumbnailUrl={thumbnailUrl} />
310
- )}
311
323
  </div>
312
- </div>
313
- )}
324
+ )}
314
325
  {!packageDetails && !bookingNumber && !isUnvailable && (
315
326
  <div className="booking">
316
327
  <div className="booking__loader">
@@ -5,10 +5,11 @@ import {
5
5
  BookingPackageBookRequest,
6
6
  BookingPackagePax,
7
7
  BookingPackageRequest,
8
- } from "@qite/tide-client/build/types/offer";
8
+ } from "@qite/tide-client/build/types";
9
9
  import { createSelector } from "@reduxjs/toolkit";
10
10
  import { format, parseISO } from "date-fns";
11
11
  import { omit } from "lodash";
12
+ import { getTranslations } from "../../../shared/utils/localization-util";
12
13
  import { RootState } from "../../store";
13
14
  import { FlightInfo, Room, Traveler } from "../../types";
14
15
  import { selectNotifications } from "../price-details/price-details-slice";
@@ -16,7 +17,6 @@ import {
16
17
  selectAgentId,
17
18
  selectTravelersFormValues,
18
19
  } from "../travelers-form/travelers-form-slice";
19
- import { getTranslations } from "../../../shared/utils/localization-util";
20
20
 
21
21
  export const selectCurrentStep = (state: RootState) =>
22
22
  state.booking.currentStep;
@@ -39,6 +39,9 @@ export const selectReturnFlight = (state: RootState) =>
39
39
  export const selectPackageRooms = (state: RootState) =>
40
40
  state.booking.package?.options.find((x) => x.isSelected)?.rooms;
41
41
 
42
+ export const selectAvailabilities = (state: RootState) =>
43
+ state.booking.package?.options.find((x) => x.isSelected)?.availabilities;
44
+
42
45
  export const selectPackageTags = (state: RootState) =>
43
46
  state.booking.package?.tags;
44
47
 
@@ -56,11 +59,11 @@ export const selectPackageGroups = (state: RootState) =>
56
59
 
57
60
  export const selectPackageDetails = (state: RootState) => state.booking.package;
58
61
 
59
- export const selectPackageFlights = (state: RootState) =>
60
- ({
61
- outward: state.booking.package?.outwardFlights,
62
- return: state.booking.package?.returnFlights
63
- });
62
+ export const selectPackageFlights = (state: RootState) =>
63
+ ({
64
+ outward: state.booking.package?.outwardFlights,
65
+ return: state.booking.package?.returnFlights
66
+ });
64
67
 
65
68
  export const selectActiveOption = (state: RootState) =>
66
69
  state.booking.package?.options.find((x) => x.isSelected);
@@ -69,7 +72,7 @@ export const selectPackageAirlineGroups = createSelector(
69
72
  selectActiveOption,
70
73
  selectDepartureFlight,
71
74
  selectReturnFlight,
72
- (option, departureFlight, returnFlight) =>
75
+ (option, departureFlight, returnFlight) =>
73
76
  option?.airlineGroups
74
77
  .filter(x => x.flightIds.includes(departureFlight?.entryLineGuid ?? "") || x.flightIds.includes(returnFlight?.entryLineGuid ?? "")));
75
78
 
@@ -77,7 +80,7 @@ export const selectPackageAirportGroups = createSelector(
77
80
  selectActiveOption,
78
81
  selectDepartureFlight,
79
82
  selectReturnFlight,
80
- (option, departureFlight, returnFlight) =>
83
+ (option, departureFlight, returnFlight) =>
81
84
  option?.airportGroups
82
85
  .filter(x => x.flightIds.includes(departureFlight?.entryLineGuid ?? "") || x.flightIds.includes(returnFlight?.entryLineGuid ?? "")));
83
86
 
@@ -137,6 +140,22 @@ export const selectStartDate = (state: RootState) =>
137
140
 
138
141
  export const selectAgents = (state: RootState) => state.booking.agents;
139
142
 
143
+ export const selectProductCode = (state: RootState) => state.booking.productAttributes?.productCode;
144
+
145
+ export const selectAccommodationCodes = (state: RootState) => {
146
+ const accommodationCodes: string[] = [];
147
+ state.booking.package?.options.forEach(o => {
148
+ o.rooms.forEach(r => r.options.forEach(ro => {
149
+ if (!accommodationCodes.some(y => y === ro.accommodationCode)) {
150
+ accommodationCodes.push(ro.accommodationCode)
151
+ }
152
+ }))
153
+ });
154
+ return accommodationCodes;
155
+ }
156
+
157
+ export const selectAccommodationViews = (state: RootState) => state.booking.accommodationViews;
158
+
140
159
  export const selectBookingQuery = (state: RootState) => {
141
160
  const bookingAttributes = state.booking.bookingAttributes;
142
161
 
@@ -149,6 +168,7 @@ export const selectBookingQuery = (state: RootState) => {
149
168
  if (key === "startDate" || key === "endDate") {
150
169
  value = format(parseISO(value), "yyyy-MM-dd");
151
170
  }
171
+
152
172
  if (key === "rooms") {
153
173
  value = JsonURL.stringify(
154
174
  (value as Room[]).map((room) => omit(room, ["children"])),
@@ -157,12 +177,19 @@ export const selectBookingQuery = (state: RootState) => {
157
177
  }
158
178
  );
159
179
  }
160
- if (key === "flight") {
180
+
181
+ if (key === "allotmentIds" && !value.length) {
182
+ value = undefined;
183
+ }
184
+
185
+ if (key === "flight" && value) {
161
186
  var flightInfo = value as FlightInfo;
162
187
  value = JsonURL.stringify(flightInfo, { AQF: true });
163
188
  }
164
189
 
165
- params[key] = value;
190
+ if (value) {
191
+ params[key] = value;
192
+ }
166
193
  });
167
194
 
168
195
  return params;