@qite/tide-booking-component 1.2.5 → 1.3.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/.vs/ProjectSettings.json +3 -3
- package/.vs/VSWorkspaceState.json +5 -5
- package/README.md +8 -8
- package/build/build-cjs/booking-wizard/components/print-offer-button.d.ts +17 -0
- package/build/build-cjs/booking-wizard/types.d.ts +7 -0
- package/build/build-cjs/booking-wizard/use-offer-printer.d.ts +13 -0
- package/build/build-cjs/index.js +223 -72
- package/build/build-cjs/shared/utils/localization-util.d.ts +5 -0
- package/build/build-cjs/shared/utils/tide-api-utils.d.ts +1 -0
- package/build/build-esm/booking-wizard/components/print-offer-button.d.ts +17 -0
- package/build/build-esm/booking-wizard/types.d.ts +7 -0
- package/build/build-esm/booking-wizard/use-offer-printer.d.ts +13 -0
- package/build/build-esm/index.js +224 -73
- package/build/build-esm/shared/utils/localization-util.d.ts +5 -0
- package/build/build-esm/shared/utils/tide-api-utils.d.ts +1 -0
- package/package.json +75 -75
- package/rollup.config.js +23 -23
- package/src/booking-product/components/age-select.tsx +35 -35
- package/src/booking-product/components/amount-input.tsx +78 -78
- package/src/booking-product/components/date-range-picker/calendar-day.tsx +58 -58
- package/src/booking-product/components/date-range-picker/calendar.tsx +178 -178
- package/src/booking-product/components/date-range-picker/index.tsx +196 -196
- package/src/booking-product/components/dates.tsx +136 -136
- package/src/booking-product/components/footer.tsx +69 -69
- package/src/booking-product/components/header.tsx +79 -79
- package/src/booking-product/components/icon.tsx +251 -251
- package/src/booking-product/components/product.tsx +314 -314
- package/src/booking-product/components/rating.tsx +21 -21
- package/src/booking-product/components/rooms.tsx +195 -195
- package/src/booking-product/index.tsx +30 -30
- package/src/booking-product/settings-context.ts +14 -14
- package/src/booking-product/types.ts +28 -28
- package/src/booking-product/utils/api.ts +25 -25
- package/src/booking-product/utils/price.ts +29 -29
- package/src/booking-wizard/api-settings-slice.ts +24 -24
- package/src/booking-wizard/components/icon.tsx +508 -508
- 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/message.tsx +34 -34
- package/src/booking-wizard/components/multi-range-filter.tsx +113 -113
- package/src/booking-wizard/components/print-offer-button.tsx +66 -0
- package/src/booking-wizard/components/product-card.tsx +37 -37
- package/src/booking-wizard/components/step-indicator.tsx +51 -51
- package/src/booking-wizard/components/step-route.tsx +27 -27
- package/src/booking-wizard/declarations.d.ts +4 -4
- package/src/booking-wizard/features/booking/api.ts +49 -49
- package/src/booking-wizard/features/booking/booking-self-contained.tsx +384 -384
- package/src/booking-wizard/features/booking/booking-slice.ts +662 -662
- package/src/booking-wizard/features/booking/booking.tsx +356 -356
- package/src/booking-wizard/features/booking/constants.ts +16 -16
- package/src/booking-wizard/features/booking/selectors.ts +441 -441
- package/src/booking-wizard/features/confirmation/confirmation.tsx +97 -97
- package/src/booking-wizard/features/error/error.tsx +78 -78
- package/src/booking-wizard/features/flight-options/flight-filter.tsx +432 -432
- package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +385 -385
- package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +229 -229
- package/src/booking-wizard/features/flight-options/flight-option.tsx +81 -81
- package/src/booking-wizard/features/flight-options/flight-utils.ts +516 -516
- package/src/booking-wizard/features/flight-options/index.tsx +196 -196
- package/src/booking-wizard/features/price-details/price-details-api.ts +24 -24
- package/src/booking-wizard/features/price-details/price-details-slice.ts +178 -178
- package/src/booking-wizard/features/price-details/util.ts +155 -155
- package/src/booking-wizard/features/product-options/no-options.tsx +21 -21
- package/src/booking-wizard/features/product-options/none-option.tsx +120 -120
- package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +64 -64
- package/src/booking-wizard/features/product-options/option-booking-group.tsx +216 -216
- package/src/booking-wizard/features/product-options/option-item.tsx +317 -317
- package/src/booking-wizard/features/product-options/option-pax-card.tsx +201 -201
- package/src/booking-wizard/features/product-options/option-pax-group.tsx +175 -175
- package/src/booking-wizard/features/product-options/option-room.tsx +321 -321
- package/src/booking-wizard/features/product-options/option-unit-group.tsx +198 -198
- package/src/booking-wizard/features/product-options/option-units-card.tsx +185 -185
- package/src/booking-wizard/features/product-options/options-form.tsx +563 -459
- package/src/booking-wizard/features/room-options/index.tsx +187 -187
- package/src/booking-wizard/features/room-options/room-utils.ts +190 -190
- package/src/booking-wizard/features/room-options/room.tsx +160 -160
- package/src/booking-wizard/features/room-options/traveler-rooms.tsx +75 -75
- package/src/booking-wizard/features/sidebar/index.tsx +76 -76
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +68 -68
- package/src/booking-wizard/features/sidebar/sidebar-util.ts +177 -177
- package/src/booking-wizard/features/sidebar/sidebar.tsx +364 -364
- package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +25 -25
- package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +25 -25
- package/src/booking-wizard/features/summary/summary-flight.tsx +39 -39
- package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +69 -69
- package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +63 -63
- package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +66 -66
- package/src/booking-wizard/features/summary/summary-slice.ts +28 -28
- package/src/booking-wizard/features/summary/summary.tsx +674 -674
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +164 -164
- package/src/booking-wizard/features/travelers-form/travelers-form.tsx +754 -754
- package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +101 -101
- package/src/booking-wizard/features/travelers-form/validate-form.ts +245 -245
- package/src/booking-wizard/index.tsx +36 -36
- package/src/booking-wizard/settings-context.ts +67 -60
- package/src/booking-wizard/store.ts +31 -31
- package/src/booking-wizard/types.ts +283 -276
- package/src/booking-wizard/use-offer-printer.ts +136 -0
- package/src/index.ts +4 -4
- package/src/shared/components/loader.tsx +16 -16
- package/src/shared/translations/en-GB.json +237 -232
- package/src/shared/translations/fr-BE.json +238 -233
- package/src/shared/translations/nl-BE.json +237 -232
- package/src/shared/types.ts +4 -4
- package/src/shared/utils/class-util.ts +9 -9
- package/src/shared/utils/localization-util.ts +62 -62
- package/src/shared/utils/query-string-util.ts +119 -119
- package/src/shared/utils/tide-api-utils.ts +36 -36
- package/styles/booking-product-variables.scss +394 -394
- package/styles/booking-product.scss +446 -446
- package/styles/booking-wizard-variables.scss +873 -871
- package/styles/booking-wizard.scss +59 -59
- package/styles/components/_animations.scss +39 -39
- package/styles/components/_base.scss +107 -107
- package/styles/components/_booking.scss +879 -879
- package/styles/components/_button.scss +238 -238
- package/styles/components/_checkbox.scss +219 -219
- package/styles/components/_cta.scss +208 -208
- package/styles/components/_date-list.scss +41 -41
- package/styles/components/_date-range-picker.scss +225 -225
- package/styles/components/_decrement-increment.scss +35 -35
- package/styles/components/_dropdown.scss +72 -72
- package/styles/components/_flight-option.scss +1429 -1429
- package/styles/components/_form.scss +1583 -1583
- package/styles/components/_info-message.scss +71 -71
- package/styles/components/_input.scss +25 -25
- package/styles/components/_list.scss +187 -187
- package/styles/components/_loader.scss +72 -72
- package/styles/components/_mixins.scss +550 -550
- package/styles/components/_placeholders.scss +166 -166
- package/styles/components/_pricing-summary.scss +155 -155
- package/styles/components/_qsm.scss +17 -17
- package/styles/components/_radiobutton.scss +170 -170
- package/styles/components/_select-wrapper.scss +80 -80
- package/styles/components/_spinner.scss +29 -29
- package/styles/components/_step-indicators.scss +168 -168
- package/styles/components/_table.scss +81 -81
- package/styles/components/_tree.scss +530 -530
- package/styles/components/_typeahead.scss +281 -281
- package/styles/components/_variables.scss +89 -89
- package/tsconfig.json +24 -24
|
@@ -1,459 +1,563 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AirlineBookingPackageOption,
|
|
5
|
-
AirportBookingPackageOption,
|
|
6
|
-
BookingAirlineGroup,
|
|
7
|
-
BookingAirportGroup,
|
|
8
|
-
BookingOptionGroup,
|
|
9
|
-
BookingOptionPax,
|
|
10
|
-
BookingOptionUnit,
|
|
11
|
-
BookingPackageFlight,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
import {
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
import
|
|
58
|
-
import
|
|
59
|
-
import
|
|
60
|
-
import
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
dispatch(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
1
|
+
import React, { useContext, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AirlineBookingPackageOption,
|
|
5
|
+
AirportBookingPackageOption,
|
|
6
|
+
BookingAirlineGroup,
|
|
7
|
+
BookingAirportGroup,
|
|
8
|
+
BookingOptionGroup,
|
|
9
|
+
BookingOptionPax,
|
|
10
|
+
BookingOptionUnit,
|
|
11
|
+
BookingPackageFlight,
|
|
12
|
+
Pax,
|
|
13
|
+
PerBookingPackageOption,
|
|
14
|
+
} from "@qite/tide-client/build/types";
|
|
15
|
+
import { Link, navigate } from "@reach/router";
|
|
16
|
+
import { isEmpty } from "lodash";
|
|
17
|
+
import { useSelector } from "react-redux";
|
|
18
|
+
import { buildClassName } from "../../../shared/utils/class-util";
|
|
19
|
+
import SettingsContext from "../../settings-context";
|
|
20
|
+
import { useAppDispatch } from "../../store";
|
|
21
|
+
import {
|
|
22
|
+
setCurrentStep,
|
|
23
|
+
setPackage,
|
|
24
|
+
setPackageAirlineGroups,
|
|
25
|
+
setPackageAirportGroups,
|
|
26
|
+
setPackageGroups,
|
|
27
|
+
setPackageOptionPax,
|
|
28
|
+
setPackageOptionUnits,
|
|
29
|
+
setPackageRooms,
|
|
30
|
+
setTagIds,
|
|
31
|
+
} from "../booking/booking-slice";
|
|
32
|
+
import {
|
|
33
|
+
FLIGHT_OPTIONS_FORM_STEP,
|
|
34
|
+
ROOM_OPTIONS_FORM_STEP,
|
|
35
|
+
TRAVELERS_FORM_STEP,
|
|
36
|
+
} from "../booking/constants";
|
|
37
|
+
import {
|
|
38
|
+
selectAvailabilities,
|
|
39
|
+
selectBookingPackagePax,
|
|
40
|
+
selectBookingQueryString,
|
|
41
|
+
selectIsFetchingProductOptions,
|
|
42
|
+
selectPackageAirlineGroups,
|
|
43
|
+
selectPackageAirportGroups,
|
|
44
|
+
selectPackageDetails,
|
|
45
|
+
selectPackageGroups,
|
|
46
|
+
selectPackageOptionPax,
|
|
47
|
+
selectPackageOptionUnits,
|
|
48
|
+
selectPackageRooms,
|
|
49
|
+
selectPackageTags,
|
|
50
|
+
selectRequestRooms,
|
|
51
|
+
selectTagIds,
|
|
52
|
+
selectTranslations,
|
|
53
|
+
} from "../booking/selectors";
|
|
54
|
+
import { fetchPriceDetails } from "../price-details/price-details-slice";
|
|
55
|
+
import { updatePackageRooms } from "../room-options/room-utils";
|
|
56
|
+
import NoOptions from "./no-options";
|
|
57
|
+
import OptionBookingAirlineGroup from "./option-booking-airline-group";
|
|
58
|
+
import OptionBookingGroup from "./option-booking-group";
|
|
59
|
+
import OptionPaxCard from "./option-pax-card";
|
|
60
|
+
import OptionRoom from "./option-room";
|
|
61
|
+
import OptionUnitsCard from "./option-units-card";
|
|
62
|
+
import PrintOfferButton from "../../components/print-offer-button";
|
|
63
|
+
|
|
64
|
+
interface OptionsFormProps {}
|
|
65
|
+
|
|
66
|
+
const OptionsForm: React.FC<OptionsFormProps> = () => {
|
|
67
|
+
const settings = useContext(SettingsContext);
|
|
68
|
+
const { token } = settings;
|
|
69
|
+
const translations = useSelector(selectTranslations);
|
|
70
|
+
const dispatch = useAppDispatch();
|
|
71
|
+
const packageDetails = useSelector(selectPackageDetails);
|
|
72
|
+
const requestRooms = useSelector(selectRequestRooms);
|
|
73
|
+
const requestRoomsPax = requestRooms?.flatMap(
|
|
74
|
+
(x) => x.pax
|
|
75
|
+
);
|
|
76
|
+
const bookingQueryString = useSelector(
|
|
77
|
+
selectBookingQueryString
|
|
78
|
+
);
|
|
79
|
+
const isLoading = useSelector(
|
|
80
|
+
selectIsFetchingProductOptions
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const groups = useSelector(selectPackageGroups);
|
|
84
|
+
const airlineGroups = useSelector(
|
|
85
|
+
selectPackageAirlineGroups
|
|
86
|
+
);
|
|
87
|
+
const airportGroups = useSelector(
|
|
88
|
+
selectPackageAirportGroups
|
|
89
|
+
);
|
|
90
|
+
const optionUnits = useSelector(selectPackageOptionUnits);
|
|
91
|
+
const optionPax = useSelector(selectPackageOptionPax);
|
|
92
|
+
const availabilities = useSelector(selectAvailabilities);
|
|
93
|
+
|
|
94
|
+
// ROOMS
|
|
95
|
+
const showRoomOptions = settings.roomOptions.isHidden;
|
|
96
|
+
const packageRooms = useSelector(selectPackageRooms);
|
|
97
|
+
const pax = useSelector(selectBookingPackagePax);
|
|
98
|
+
|
|
99
|
+
const getRoomPax = (index: number) => {
|
|
100
|
+
var room = requestRooms?.find((x) => x.index == index);
|
|
101
|
+
var bookingPackagePax = pax.filter((x) =>
|
|
102
|
+
room?.pax.some((y) => y.id == x.id)
|
|
103
|
+
);
|
|
104
|
+
return bookingPackagePax.length > 0
|
|
105
|
+
? bookingPackagePax
|
|
106
|
+
: room?.pax ?? [];
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const handleOnRoomChange = (
|
|
110
|
+
index: number,
|
|
111
|
+
accommodationCode: string,
|
|
112
|
+
regimeCode: string | null
|
|
113
|
+
) => {
|
|
114
|
+
if (!packageRooms) return;
|
|
115
|
+
|
|
116
|
+
const updatedPackageRooms = updatePackageRooms(
|
|
117
|
+
packageRooms,
|
|
118
|
+
index,
|
|
119
|
+
accommodationCode,
|
|
120
|
+
regimeCode,
|
|
121
|
+
availabilities!
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
dispatch(setPackageRooms(updatedPackageRooms));
|
|
125
|
+
dispatch(fetchPriceDetails());
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const getPax = () => {
|
|
129
|
+
if (!packageDetails) return undefined;
|
|
130
|
+
const selectedOption =
|
|
131
|
+
packageDetails.options.find((o) => o.isSelected) ??
|
|
132
|
+
packageDetails.options[0];
|
|
133
|
+
return selectedOption?.requestRooms.flatMap(
|
|
134
|
+
(r) => r.pax
|
|
135
|
+
) as Pax[];
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// TAGS
|
|
139
|
+
const packageTags = settings.hideTags
|
|
140
|
+
? []
|
|
141
|
+
: useSelector(selectPackageTags);
|
|
142
|
+
let tagIds = useSelector(selectTagIds) ?? [];
|
|
143
|
+
|
|
144
|
+
const handleSubmit: React.FormEventHandler<
|
|
145
|
+
HTMLFormElement
|
|
146
|
+
> = (e) => {
|
|
147
|
+
if (settings.skipRouter) {
|
|
148
|
+
dispatch(setCurrentStep(TRAVELERS_FORM_STEP));
|
|
149
|
+
} else {
|
|
150
|
+
navigate(
|
|
151
|
+
`${settings.basePath}${settings.travellers.pathSuffix}?${bookingQueryString}`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const handleOnPaxChange = (pax: BookingOptionPax[]) => {
|
|
159
|
+
dispatch(setPackageOptionPax(pax));
|
|
160
|
+
dispatch(fetchPriceDetails());
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const handleOnUnitsChange = (
|
|
164
|
+
units: BookingOptionUnit[]
|
|
165
|
+
) => {
|
|
166
|
+
dispatch(setPackageOptionUnits(units));
|
|
167
|
+
dispatch(fetchPriceDetails());
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const handleOnGroupChange = (
|
|
171
|
+
group: BookingOptionGroup<PerBookingPackageOption>
|
|
172
|
+
) => {
|
|
173
|
+
if (groups) {
|
|
174
|
+
const updatedGroups = groups?.map((g) =>
|
|
175
|
+
g.name === group.name ? group : g
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
dispatch(setPackageGroups(updatedGroups));
|
|
179
|
+
dispatch(fetchPriceDetails());
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const handleOnAirlineGroupChange = (
|
|
184
|
+
group: BookingAirlineGroup<AirlineBookingPackageOption>
|
|
185
|
+
) => {
|
|
186
|
+
if (airlineGroups) {
|
|
187
|
+
const updatedGroups = airlineGroups.map((g) =>
|
|
188
|
+
g.label === group.label ? group : g
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
dispatch(setPackageAirlineGroups(updatedGroups));
|
|
192
|
+
dispatch(fetchPriceDetails());
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const handleOnAirportGroupChange = (
|
|
197
|
+
group: BookingAirportGroup<AirportBookingPackageOption>
|
|
198
|
+
) => {
|
|
199
|
+
if (airportGroups) {
|
|
200
|
+
const updatedGroups = airportGroups.map((g) =>
|
|
201
|
+
g.label === group.label ? group : g
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
dispatch(setPackageAirportGroups(updatedGroups));
|
|
205
|
+
dispatch(fetchPriceDetails());
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const handleOnTagChange = (
|
|
210
|
+
id: number,
|
|
211
|
+
checked: boolean
|
|
212
|
+
) => {
|
|
213
|
+
let updatedTags = [...tagIds];
|
|
214
|
+
if (checked) {
|
|
215
|
+
if (!updatedTags?.includes(id)) {
|
|
216
|
+
updatedTags?.push(id);
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
updatedTags = updatedTags?.filter((x) => x != id);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
dispatch(setTagIds(updatedTags));
|
|
223
|
+
dispatch(fetchPriceDetails());
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (
|
|
228
|
+
packageDetails &&
|
|
229
|
+
settings.roomOptions.isHidden &&
|
|
230
|
+
settings.flightOptions.isHidden
|
|
231
|
+
) {
|
|
232
|
+
const params = new URLSearchParams(location.search);
|
|
233
|
+
|
|
234
|
+
const outwardFlight =
|
|
235
|
+
params.get("outwardflight") ?? undefined;
|
|
236
|
+
const returnFlight =
|
|
237
|
+
params.get("returnflight") ?? undefined;
|
|
238
|
+
if (outwardFlight && returnFlight) {
|
|
239
|
+
const desiredOutwardFlight =
|
|
240
|
+
packageDetails.outwardFlights.find(
|
|
241
|
+
(x) => x.entryLineGuid == outwardFlight
|
|
242
|
+
);
|
|
243
|
+
const desiredReturnFlight =
|
|
244
|
+
packageDetails.returnFlights.find(
|
|
245
|
+
(x) => x.entryLineGuid == returnFlight
|
|
246
|
+
);
|
|
247
|
+
if (desiredOutwardFlight && desiredReturnFlight) {
|
|
248
|
+
dispatch(
|
|
249
|
+
setPackage({
|
|
250
|
+
...packageDetails,
|
|
251
|
+
outwardFlights:
|
|
252
|
+
packageDetails.outwardFlights.map(
|
|
253
|
+
(flight) => {
|
|
254
|
+
return {
|
|
255
|
+
...flight,
|
|
256
|
+
isSelected:
|
|
257
|
+
flight.entryLineGuid ==
|
|
258
|
+
desiredOutwardFlight.entryLineGuid
|
|
259
|
+
? true
|
|
260
|
+
: false,
|
|
261
|
+
} as BookingPackageFlight;
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
returnFlights:
|
|
265
|
+
packageDetails.returnFlights.map(
|
|
266
|
+
(flight) => {
|
|
267
|
+
return {
|
|
268
|
+
...flight,
|
|
269
|
+
isSelected:
|
|
270
|
+
flight.entryLineGuid ==
|
|
271
|
+
desiredReturnFlight.entryLineGuid
|
|
272
|
+
? true
|
|
273
|
+
: false,
|
|
274
|
+
} as BookingPackageFlight;
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
dispatch(fetchPriceDetails());
|
|
283
|
+
}, []);
|
|
284
|
+
|
|
285
|
+
const goPrevious = () => {
|
|
286
|
+
if (settings.roomOptions.isHidden) {
|
|
287
|
+
dispatch(setCurrentStep(FLIGHT_OPTIONS_FORM_STEP));
|
|
288
|
+
} else {
|
|
289
|
+
dispatch(setCurrentStep(ROOM_OPTIONS_FORM_STEP));
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const previousUrl = settings.roomOptions.isHidden
|
|
294
|
+
? `${settings.basePath}${settings.flightOptions.pathSuffix}?${bookingQueryString}`
|
|
295
|
+
: `${settings.basePath}${settings.roomOptions.pathSuffix}?${bookingQueryString}`;
|
|
296
|
+
const hasPrevious =
|
|
297
|
+
!settings.roomOptions.isHidden ||
|
|
298
|
+
!settings.flightOptions.isHidden;
|
|
299
|
+
const showPackageTagsOrRoomoptions =
|
|
300
|
+
showRoomOptions ||
|
|
301
|
+
(packageTags && !isEmpty(packageTags));
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<>
|
|
305
|
+
<form
|
|
306
|
+
className='form'
|
|
307
|
+
name='booking--options'
|
|
308
|
+
id='booking--options'
|
|
309
|
+
noValidate
|
|
310
|
+
onSubmit={handleSubmit}
|
|
311
|
+
>
|
|
312
|
+
{isLoading && settings.loaderComponent}
|
|
313
|
+
{!isLoading && (
|
|
314
|
+
<div className='form__region'>
|
|
315
|
+
{showPackageTagsOrRoomoptions && (
|
|
316
|
+
<div className='form__group'>
|
|
317
|
+
<div className='booking-card'>
|
|
318
|
+
<div className='booking-card__body'>
|
|
319
|
+
<div
|
|
320
|
+
className={buildClassName([
|
|
321
|
+
"booking-card__group",
|
|
322
|
+
"booking-card__group--package",
|
|
323
|
+
])}
|
|
324
|
+
>
|
|
325
|
+
{showRoomOptions && (
|
|
326
|
+
<span className='booking-card__tag'>
|
|
327
|
+
{
|
|
328
|
+
translations.OPTIONS_FORM
|
|
329
|
+
.PACKAGE
|
|
330
|
+
}
|
|
331
|
+
</span>
|
|
332
|
+
)}
|
|
333
|
+
<div className='booking-card__group-body'>
|
|
334
|
+
{showRoomOptions && (
|
|
335
|
+
<table className='table table--striped'>
|
|
336
|
+
<tbody>
|
|
337
|
+
{packageRooms &&
|
|
338
|
+
packageRooms.map((room) => (
|
|
339
|
+
<OptionRoom
|
|
340
|
+
key={room.index}
|
|
341
|
+
packageRoom={room}
|
|
342
|
+
pax={getRoomPax(
|
|
343
|
+
room.index
|
|
344
|
+
)}
|
|
345
|
+
optionPax={optionPax}
|
|
346
|
+
onRoomChange={
|
|
347
|
+
handleOnRoomChange
|
|
348
|
+
}
|
|
349
|
+
/>
|
|
350
|
+
))}
|
|
351
|
+
</tbody>
|
|
352
|
+
</table>
|
|
353
|
+
)}
|
|
354
|
+
{packageTags &&
|
|
355
|
+
!isEmpty(packageTags) && (
|
|
356
|
+
<div className='booking-card__tag-translations'>
|
|
357
|
+
{packageTags.map(
|
|
358
|
+
(tag, index) => (
|
|
359
|
+
<label
|
|
360
|
+
key={index}
|
|
361
|
+
htmlFor={`tag-translation-${index}-${tag.title}`}
|
|
362
|
+
className='checkbox__label tag-translation'
|
|
363
|
+
>
|
|
364
|
+
<div className='tag-translation-input__container'>
|
|
365
|
+
<input
|
|
366
|
+
type='checkbox'
|
|
367
|
+
id={`tag-translation-${index}-${tag.title}`}
|
|
368
|
+
name={`tag-translation-${index}-${tag.title}`}
|
|
369
|
+
className='checkbox__input'
|
|
370
|
+
checked={tagIds?.includes(
|
|
371
|
+
tag.id
|
|
372
|
+
)}
|
|
373
|
+
onChange={(e) =>
|
|
374
|
+
handleOnTagChange(
|
|
375
|
+
tag.id,
|
|
376
|
+
e.target.checked
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
/>
|
|
380
|
+
</div>
|
|
381
|
+
<span className='tag-translation__title'>
|
|
382
|
+
{tag.title}
|
|
383
|
+
</span>
|
|
384
|
+
|
|
385
|
+
<span className='tag-translation__description'>
|
|
386
|
+
{tag.description}
|
|
387
|
+
</span>
|
|
388
|
+
</label>
|
|
389
|
+
)
|
|
390
|
+
)}
|
|
391
|
+
</div>
|
|
392
|
+
)}
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
)}
|
|
399
|
+
{optionUnits && !isEmpty(optionUnits) && (
|
|
400
|
+
<div className='form__group'>
|
|
401
|
+
<div className='booking-card'>
|
|
402
|
+
<div className='booking-card__header'>
|
|
403
|
+
<h2 className='booking-card__header-heading'>
|
|
404
|
+
{
|
|
405
|
+
translations.OPTIONS_FORM
|
|
406
|
+
.PER_UNIT_TITLE
|
|
407
|
+
}
|
|
408
|
+
</h2>
|
|
409
|
+
</div>
|
|
410
|
+
<div className='booking-card__body'>
|
|
411
|
+
<OptionUnitsCard
|
|
412
|
+
units={optionUnits}
|
|
413
|
+
onUnitsChange={handleOnUnitsChange}
|
|
414
|
+
/>
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
</div>
|
|
418
|
+
)}
|
|
419
|
+
|
|
420
|
+
{optionPax && !isEmpty(optionPax) && (
|
|
421
|
+
<div className='form__group'>
|
|
422
|
+
<div className='booking-card'>
|
|
423
|
+
<div className='booking-card__header'>
|
|
424
|
+
<h2 className='booking-card__header-heading'>
|
|
425
|
+
{
|
|
426
|
+
translations.OPTIONS_FORM
|
|
427
|
+
.PER_PAX_TITLE
|
|
428
|
+
}
|
|
429
|
+
</h2>
|
|
430
|
+
</div>
|
|
431
|
+
<div className='booking-card__body'>
|
|
432
|
+
<OptionPaxCard
|
|
433
|
+
pax={optionPax}
|
|
434
|
+
onPaxChange={handleOnPaxChange}
|
|
435
|
+
requestRoomsPax={requestRoomsPax}
|
|
436
|
+
/>
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
)}
|
|
441
|
+
|
|
442
|
+
{groups && !isEmpty(groups) && (
|
|
443
|
+
<div className='form__group'>
|
|
444
|
+
<div className='booking-card'>
|
|
445
|
+
<div className='booking-card__header'>
|
|
446
|
+
<h2 className='booking-card__header-heading'>
|
|
447
|
+
{
|
|
448
|
+
translations.OPTIONS_FORM
|
|
449
|
+
.PER_BOOKING_TITLE
|
|
450
|
+
}
|
|
451
|
+
</h2>
|
|
452
|
+
</div>
|
|
453
|
+
<div className='booking-card__body'>
|
|
454
|
+
<div className='booking-card__group booking-card__group--active'>
|
|
455
|
+
{groups.map((group, i) => (
|
|
456
|
+
<OptionBookingGroup
|
|
457
|
+
key={`${group.name}_${i}`}
|
|
458
|
+
group={group}
|
|
459
|
+
firstClassName={
|
|
460
|
+
"booking-card__group-body"
|
|
461
|
+
}
|
|
462
|
+
secondClassName={
|
|
463
|
+
"booking-card__group-heading"
|
|
464
|
+
}
|
|
465
|
+
parentId={`booking_${group.name}`}
|
|
466
|
+
onGroupChange={
|
|
467
|
+
handleOnGroupChange
|
|
468
|
+
}
|
|
469
|
+
/>
|
|
470
|
+
))}
|
|
471
|
+
{airlineGroups?.map((group, i) => (
|
|
472
|
+
<OptionBookingAirlineGroup
|
|
473
|
+
key={`${group.label}_${i}`}
|
|
474
|
+
airGroup={group}
|
|
475
|
+
onGroupChange={
|
|
476
|
+
handleOnAirlineGroupChange
|
|
477
|
+
}
|
|
478
|
+
/>
|
|
479
|
+
))}
|
|
480
|
+
{airportGroups?.map((group, i) => (
|
|
481
|
+
<OptionBookingAirlineGroup
|
|
482
|
+
key={`${group.label}_${i}`}
|
|
483
|
+
airGroup={group}
|
|
484
|
+
onGroupChange={
|
|
485
|
+
handleOnAirportGroupChange
|
|
486
|
+
}
|
|
487
|
+
/>
|
|
488
|
+
))}
|
|
489
|
+
</div>
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
</div>
|
|
493
|
+
)}
|
|
494
|
+
|
|
495
|
+
{isEmpty(groups) &&
|
|
496
|
+
isEmpty(optionUnits) &&
|
|
497
|
+
isEmpty(optionPax) && <NoOptions />}
|
|
498
|
+
</div>
|
|
499
|
+
)}
|
|
500
|
+
<div className='booking__navigator'>
|
|
501
|
+
{hasPrevious && (
|
|
502
|
+
<>
|
|
503
|
+
{settings.skipRouter ? (
|
|
504
|
+
<button
|
|
505
|
+
type='button'
|
|
506
|
+
title={translations.STEPS.PREVIOUS}
|
|
507
|
+
onClick={() => goPrevious()}
|
|
508
|
+
className='cta cta--secondary'
|
|
509
|
+
>
|
|
510
|
+
{translations.STEPS.PREVIOUS}
|
|
511
|
+
</button>
|
|
512
|
+
) : (
|
|
513
|
+
<Link
|
|
514
|
+
to={previousUrl}
|
|
515
|
+
title={translations.STEPS.PREVIOUS}
|
|
516
|
+
className='cta cta--secondary'
|
|
517
|
+
>
|
|
518
|
+
{translations.STEPS.PREVIOUS}
|
|
519
|
+
</Link>
|
|
520
|
+
)}
|
|
521
|
+
</>
|
|
522
|
+
)}
|
|
523
|
+
{token &&
|
|
524
|
+
settings.options.reportPrintActionId && (
|
|
525
|
+
<PrintOfferButton
|
|
526
|
+
bookingPackage={packageDetails}
|
|
527
|
+
getPax={getPax}
|
|
528
|
+
tagIds={tagIds}
|
|
529
|
+
printActionId={
|
|
530
|
+
settings.options.reportPrintActionId
|
|
531
|
+
}
|
|
532
|
+
labelIdle={
|
|
533
|
+
translations.PRINT_OFFER_BUTTON.LABEL_IDLE
|
|
534
|
+
}
|
|
535
|
+
labelCreating={
|
|
536
|
+
translations.PRINT_OFFER_BUTTON
|
|
537
|
+
.LABEL_CREATING
|
|
538
|
+
}
|
|
539
|
+
labelPrinting={
|
|
540
|
+
translations.PRINT_OFFER_BUTTON
|
|
541
|
+
.LABEL_PRINTING
|
|
542
|
+
}
|
|
543
|
+
className='cta spinner-button'
|
|
544
|
+
/>
|
|
545
|
+
)}
|
|
546
|
+
<button
|
|
547
|
+
type='submit'
|
|
548
|
+
title={translations.STEPS.NEXT}
|
|
549
|
+
disabled={isLoading}
|
|
550
|
+
className={buildClassName([
|
|
551
|
+
"cta",
|
|
552
|
+
isLoading && "cta--disabled",
|
|
553
|
+
])}
|
|
554
|
+
>
|
|
555
|
+
{translations.STEPS.NEXT}
|
|
556
|
+
</button>
|
|
557
|
+
</div>
|
|
558
|
+
</form>
|
|
559
|
+
</>
|
|
560
|
+
);
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export default OptionsForm;
|