@qite/tide-booking-component 1.3.1 → 1.3.3
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-product/components/age-select.d.ts +8 -8
- package/build/build-cjs/booking-product/components/amount-input.d.ts +10 -10
- package/build/build-cjs/booking-product/components/date-range-picker/calendar-day.d.ts +12 -12
- package/build/build-cjs/booking-product/components/date-range-picker/calendar.d.ts +19 -19
- package/build/build-cjs/booking-product/components/date-range-picker/index.d.ts +20 -23
- package/build/build-cjs/booking-product/components/dates.d.ts +9 -9
- package/build/build-cjs/booking-product/components/footer.d.ts +10 -10
- package/build/build-cjs/booking-product/components/header.d.ts +11 -11
- package/build/build-cjs/booking-product/components/icon.d.ts +10 -10
- package/build/build-cjs/booking-product/components/product.d.ts +9 -9
- package/build/build-cjs/booking-product/components/rating.d.ts +6 -6
- package/build/build-cjs/booking-product/components/rooms.d.ts +10 -10
- package/build/build-cjs/booking-product/index.d.ts +10 -10
- package/build/build-cjs/booking-product/settings-context.d.ts +5 -6
- package/build/build-cjs/booking-product/types.d.ts +25 -25
- package/build/build-cjs/booking-product/utils/api.d.ts +16 -6
- package/build/build-cjs/booking-product/utils/price.d.ts +9 -1
- package/build/build-cjs/booking-wizard/api-settings-slice.d.ts +14 -4
- package/build/build-cjs/booking-wizard/components/icon.d.ts +10 -10
- package/build/build-cjs/booking-wizard/components/labeled-input.d.ts +18 -18
- package/build/build-cjs/booking-wizard/components/labeled-select.d.ts +21 -21
- package/build/build-cjs/booking-wizard/components/message.d.ts +9 -9
- package/build/build-cjs/booking-wizard/components/multi-range-filter.d.ts +11 -11
- package/build/build-cjs/booking-wizard/components/print-offer-button.d.ts +17 -17
- package/build/build-cjs/booking-wizard/components/product-card.d.ts +8 -8
- package/build/build-cjs/booking-wizard/components/step-indicator.d.ts +6 -6
- package/build/build-cjs/booking-wizard/components/step-route.d.ts +9 -9
- package/build/build-cjs/booking-wizard/features/booking/api.d.ts +29 -10
- package/build/build-cjs/booking-wizard/features/booking/booking-self-contained.d.ts +8 -8
- package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +177 -46
- package/build/build-cjs/booking-wizard/features/booking/booking.d.ts +8 -8
- package/build/build-cjs/booking-wizard/features/booking/constants.d.ts +15 -8
- package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +308 -136
- package/build/build-cjs/booking-wizard/features/confirmation/confirmation.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/error/error.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +9 -9
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -8
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -3
- package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +10 -10
- package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +16 -6
- package/build/build-cjs/booking-wizard/features/flight-options/index.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/price-details/price-details-api.d.ts +15 -6
- package/build/build-cjs/booking-wizard/features/price-details/price-details-slice.d.ts +121 -80
- package/build/build-cjs/booking-wizard/features/price-details/util.d.ts +5 -2
- package/build/build-cjs/booking-wizard/features/product-options/no-options.d.ts +3 -3
- package/build/build-cjs/booking-wizard/features/product-options/none-option.d.ts +17 -9
- package/build/build-cjs/booking-wizard/features/product-options/option-booking-airline-group.d.ts +17 -8
- package/build/build-cjs/booking-wizard/features/product-options/option-booking-group.d.ts +18 -12
- package/build/build-cjs/booking-wizard/features/product-options/option-item.d.ts +11 -11
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-card.d.ts +13 -10
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-group.d.ts +20 -13
- package/build/build-cjs/booking-wizard/features/product-options/option-room.d.ts +18 -10
- package/build/build-cjs/booking-wizard/features/product-options/option-unit-group.d.ts +20 -13
- package/build/build-cjs/booking-wizard/features/product-options/option-units-card.d.ts +9 -9
- package/build/build-cjs/booking-wizard/features/product-options/options-form.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/room-options/index.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +29 -9
- package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +15 -12
- package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +13 -9
- package/build/build-cjs/booking-wizard/features/sidebar/index.d.ts +7 -7
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -8
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-util.d.ts +31 -12
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar.d.ts +29 -25
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-flight.d.ts +8 -8
- package/build/build-cjs/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -7
- package/build/build-cjs/booking-wizard/features/summary/summary-slice.d.ts +14 -8
- package/build/build-cjs/booking-wizard/features/summary/summary.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +75 -49
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form.d.ts +4 -5
- package/build/build-cjs/booking-wizard/features/travelers-form/type-ahead-input.d.ts +16 -16
- package/build/build-cjs/booking-wizard/features/travelers-form/validate-form.d.ts +9 -4
- package/build/build-cjs/booking-wizard/index.d.ts +12 -12
- package/build/build-cjs/booking-wizard/settings-context.d.ts +5 -6
- package/build/build-cjs/booking-wizard/store.d.ts +44 -24
- package/build/build-cjs/booking-wizard/types.d.ts +253 -257
- package/build/build-cjs/booking-wizard/use-offer-printer.d.ts +19 -13
- package/build/build-cjs/index.d.ts +3 -3
- package/build/build-cjs/index.js +16348 -7394
- package/build/build-cjs/shared/components/loader.d.ts +6 -6
- package/build/build-cjs/shared/types.d.ts +4 -4
- package/build/build-cjs/shared/utils/class-util.d.ts +1 -1
- package/build/build-cjs/shared/utils/localization-util.d.ts +248 -248
- package/build/build-cjs/shared/utils/query-string-util.d.ts +29 -8
- package/build/build-cjs/shared/utils/tide-api-utils.d.ts +6 -4
- package/build/build-esm/booking-product/components/age-select.d.ts +8 -8
- package/build/build-esm/booking-product/components/amount-input.d.ts +10 -10
- package/build/build-esm/booking-product/components/date-range-picker/calendar-day.d.ts +12 -12
- package/build/build-esm/booking-product/components/date-range-picker/calendar.d.ts +19 -19
- package/build/build-esm/booking-product/components/date-range-picker/index.d.ts +20 -23
- package/build/build-esm/booking-product/components/dates.d.ts +9 -9
- package/build/build-esm/booking-product/components/footer.d.ts +10 -10
- package/build/build-esm/booking-product/components/header.d.ts +11 -11
- package/build/build-esm/booking-product/components/icon.d.ts +10 -10
- package/build/build-esm/booking-product/components/product.d.ts +9 -9
- package/build/build-esm/booking-product/components/rating.d.ts +6 -6
- package/build/build-esm/booking-product/components/rooms.d.ts +10 -10
- package/build/build-esm/booking-product/index.d.ts +10 -10
- package/build/build-esm/booking-product/settings-context.d.ts +5 -6
- package/build/build-esm/booking-product/types.d.ts +25 -25
- package/build/build-esm/booking-product/utils/api.d.ts +16 -6
- package/build/build-esm/booking-product/utils/price.d.ts +9 -1
- package/build/build-esm/booking-wizard/api-settings-slice.d.ts +14 -4
- package/build/build-esm/booking-wizard/components/icon.d.ts +10 -10
- package/build/build-esm/booking-wizard/components/labeled-input.d.ts +18 -18
- package/build/build-esm/booking-wizard/components/labeled-select.d.ts +21 -21
- package/build/build-esm/booking-wizard/components/message.d.ts +9 -9
- package/build/build-esm/booking-wizard/components/multi-range-filter.d.ts +11 -11
- package/build/build-esm/booking-wizard/components/print-offer-button.d.ts +17 -17
- package/build/build-esm/booking-wizard/components/product-card.d.ts +8 -8
- package/build/build-esm/booking-wizard/components/step-indicator.d.ts +6 -6
- package/build/build-esm/booking-wizard/components/step-route.d.ts +9 -9
- package/build/build-esm/booking-wizard/features/booking/api.d.ts +29 -10
- package/build/build-esm/booking-wizard/features/booking/booking-self-contained.d.ts +8 -8
- package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +177 -46
- package/build/build-esm/booking-wizard/features/booking/booking.d.ts +8 -8
- package/build/build-esm/booking-wizard/features/booking/constants.d.ts +15 -8
- package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +308 -136
- package/build/build-esm/booking-wizard/features/confirmation/confirmation.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/error/error.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +9 -9
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -8
- package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -3
- package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +10 -10
- package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +16 -6
- package/build/build-esm/booking-wizard/features/flight-options/index.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/price-details/price-details-api.d.ts +15 -6
- package/build/build-esm/booking-wizard/features/price-details/price-details-slice.d.ts +121 -80
- package/build/build-esm/booking-wizard/features/price-details/util.d.ts +5 -2
- package/build/build-esm/booking-wizard/features/product-options/no-options.d.ts +3 -3
- package/build/build-esm/booking-wizard/features/product-options/none-option.d.ts +17 -9
- package/build/build-esm/booking-wizard/features/product-options/option-booking-airline-group.d.ts +17 -8
- package/build/build-esm/booking-wizard/features/product-options/option-booking-group.d.ts +18 -12
- package/build/build-esm/booking-wizard/features/product-options/option-item.d.ts +11 -11
- package/build/build-esm/booking-wizard/features/product-options/option-pax-card.d.ts +13 -10
- package/build/build-esm/booking-wizard/features/product-options/option-pax-group.d.ts +20 -13
- package/build/build-esm/booking-wizard/features/product-options/option-room.d.ts +18 -10
- package/build/build-esm/booking-wizard/features/product-options/option-unit-group.d.ts +20 -13
- package/build/build-esm/booking-wizard/features/product-options/option-units-card.d.ts +9 -9
- package/build/build-esm/booking-wizard/features/product-options/options-form.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/room-options/index.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +29 -9
- package/build/build-esm/booking-wizard/features/room-options/room.d.ts +15 -12
- package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +13 -9
- package/build/build-esm/booking-wizard/features/sidebar/index.d.ts +7 -7
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -8
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-util.d.ts +31 -12
- package/build/build-esm/booking-wizard/features/sidebar/sidebar.d.ts +29 -25
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -7
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -7
- package/build/build-esm/booking-wizard/features/summary/summary-flight.d.ts +8 -8
- package/build/build-esm/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -7
- package/build/build-esm/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -7
- package/build/build-esm/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -7
- package/build/build-esm/booking-wizard/features/summary/summary-slice.d.ts +14 -8
- package/build/build-esm/booking-wizard/features/summary/summary.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +75 -49
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form.d.ts +4 -5
- package/build/build-esm/booking-wizard/features/travelers-form/type-ahead-input.d.ts +16 -16
- package/build/build-esm/booking-wizard/features/travelers-form/validate-form.d.ts +9 -4
- package/build/build-esm/booking-wizard/index.d.ts +12 -12
- package/build/build-esm/booking-wizard/settings-context.d.ts +5 -6
- package/build/build-esm/booking-wizard/store.d.ts +44 -24
- package/build/build-esm/booking-wizard/types.d.ts +253 -257
- package/build/build-esm/booking-wizard/use-offer-printer.d.ts +19 -13
- package/build/build-esm/index.d.ts +3 -3
- package/build/build-esm/index.js +15949 -7383
- package/build/build-esm/shared/components/loader.d.ts +6 -6
- package/build/build-esm/shared/types.d.ts +4 -4
- package/build/build-esm/shared/utils/class-util.d.ts +1 -1
- package/build/build-esm/shared/utils/localization-util.d.ts +248 -248
- package/build/build-esm/shared/utils/query-string-util.d.ts +29 -8
- package/build/build-esm/shared/utils/tide-api-utils.d.ts +6 -4
- 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 +63 -66
- 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 +389 -384
- package/src/booking-wizard/features/booking/booking-slice.ts +665 -662
- package/src/booking-wizard/features/booking/booking.tsx +361 -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 +481 -563
- 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 +62 -62
- package/src/booking-wizard/store.ts +31 -31
- package/src/booking-wizard/types.ts +279 -278
- package/src/booking-wizard/use-offer-printer.ts +117 -136
- package/src/index.ts +4 -4
- package/src/shared/components/loader.tsx +16 -16
- package/src/shared/translations/en-GB.json +237 -237
- package/src/shared/translations/fr-BE.json +238 -238
- package/src/shared/translations/nl-BE.json +237 -237
- 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 -873
- 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,441 +1,441 @@
|
|
|
1
|
-
import JsonURL from "@jsonurl/jsonurl";
|
|
2
|
-
import { Gender } from "@qite/tide-client";
|
|
3
|
-
import {
|
|
4
|
-
BookingPackageAddress,
|
|
5
|
-
BookingPackageBookRequest,
|
|
6
|
-
BookingPackagePax,
|
|
7
|
-
BookingPackageRequest,
|
|
8
|
-
} from "@qite/tide-client/build/types";
|
|
9
|
-
import { createSelector } from "@reduxjs/toolkit";
|
|
10
|
-
import { format, parseISO } from "date-fns";
|
|
11
|
-
import { omit } from "lodash";
|
|
12
|
-
import { getTranslations } from "../../../shared/utils/localization-util";
|
|
13
|
-
import { RootState } from "../../store";
|
|
14
|
-
import { FlightInfo, Room, Traveler } from "../../types";
|
|
15
|
-
import { selectNotifications } from "../price-details/price-details-slice";
|
|
16
|
-
import {
|
|
17
|
-
selectAgentId,
|
|
18
|
-
selectTravelersFormValues,
|
|
19
|
-
} from "../travelers-form/travelers-form-slice";
|
|
20
|
-
|
|
21
|
-
export const selectCurrentStep = (state: RootState) =>
|
|
22
|
-
state.booking.currentStep;
|
|
23
|
-
|
|
24
|
-
export const selectGeneratePaymentUrl = (state: RootState) =>
|
|
25
|
-
state.booking.generatePaymentUrl;
|
|
26
|
-
|
|
27
|
-
export const selectSkipPaymentWithAgent = (state: RootState) =>
|
|
28
|
-
state.booking.skipPaymentWithAgent;
|
|
29
|
-
|
|
30
|
-
export const selectIsFetchingProductOptions = (state: RootState) =>
|
|
31
|
-
state.booking.isBusy;
|
|
32
|
-
|
|
33
|
-
export const selectDepartureFlight = (state: RootState) =>
|
|
34
|
-
state.booking.package?.outwardFlights?.find((x) => x.isSelected);
|
|
35
|
-
|
|
36
|
-
export const selectReturnFlight = (state: RootState) =>
|
|
37
|
-
state.booking.package?.returnFlights?.find((x) => x.isSelected);
|
|
38
|
-
|
|
39
|
-
export const selectPackageRooms = (state: RootState) =>
|
|
40
|
-
state.booking.package?.options.find((x) => x.isSelected)?.rooms;
|
|
41
|
-
|
|
42
|
-
export const selectAvailabilities = (state: RootState) =>
|
|
43
|
-
state.booking.package?.options.find((x) => x.isSelected)?.availabilities;
|
|
44
|
-
|
|
45
|
-
export const selectPackageTags = (state: RootState) =>
|
|
46
|
-
state.booking.package?.tags;
|
|
47
|
-
|
|
48
|
-
export const selectIsOnRequest = (state: RootState) =>
|
|
49
|
-
state.booking.package?.options.find((x) => x.isSelected)?.isOnRequest;
|
|
50
|
-
|
|
51
|
-
export const selectPackageOptionUnits = (state: RootState) =>
|
|
52
|
-
state.booking.package?.options.find((x) => x.isSelected)?.optionUnits;
|
|
53
|
-
|
|
54
|
-
export const selectPackageOptionPax = (state: RootState) =>
|
|
55
|
-
state.booking.package?.options.find((x) => x.isSelected)?.optionPax;
|
|
56
|
-
|
|
57
|
-
export const selectPackageGroups = (state: RootState) =>
|
|
58
|
-
state.booking.package?.options.find((x) => x.isSelected)?.groups;
|
|
59
|
-
|
|
60
|
-
export const selectPackageDetails = (state: RootState) => state.booking.package;
|
|
61
|
-
|
|
62
|
-
export const selectPackageFlights = (state: RootState) => ({
|
|
63
|
-
outward: state.booking.package?.outwardFlights,
|
|
64
|
-
return: state.booking.package?.returnFlights,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export const selectActiveOption = (state: RootState) =>
|
|
68
|
-
state.booking.package?.options.find((x) => x.isSelected);
|
|
69
|
-
|
|
70
|
-
export const selectPackageAirlineGroups = createSelector(
|
|
71
|
-
selectActiveOption,
|
|
72
|
-
selectDepartureFlight,
|
|
73
|
-
selectReturnFlight,
|
|
74
|
-
(option, departureFlight, returnFlight) =>
|
|
75
|
-
option?.airlineGroups.filter(
|
|
76
|
-
(x) =>
|
|
77
|
-
x.flightIds.includes(departureFlight?.entryLineGuid ?? "") ||
|
|
78
|
-
x.flightIds.includes(returnFlight?.entryLineGuid ?? "")
|
|
79
|
-
)
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
export const selectPackageAirportGroups = createSelector(
|
|
83
|
-
selectActiveOption,
|
|
84
|
-
selectDepartureFlight,
|
|
85
|
-
selectReturnFlight,
|
|
86
|
-
(option, departureFlight, returnFlight) =>
|
|
87
|
-
option?.airportGroups.filter(
|
|
88
|
-
(x) =>
|
|
89
|
-
x.flightIds.includes(departureFlight?.entryLineGuid ?? "") ||
|
|
90
|
-
x.flightIds.includes(returnFlight?.entryLineGuid ?? "")
|
|
91
|
-
)
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
export const selectApiSettings = (state: RootState) => state.apiSettings;
|
|
95
|
-
|
|
96
|
-
export const selectIsUnavailable = (state: RootState) =>
|
|
97
|
-
state.booking.isUnavailable;
|
|
98
|
-
|
|
99
|
-
export const selectRequestRooms = (state: RootState) =>
|
|
100
|
-
state.booking.package?.options.find((x) => x.isSelected)?.requestRooms;
|
|
101
|
-
|
|
102
|
-
export const selectOfficeId = (state: RootState) => state.booking.officeId;
|
|
103
|
-
|
|
104
|
-
export const selectLanguageCode = (state: RootState) =>
|
|
105
|
-
state.booking.languageCode;
|
|
106
|
-
|
|
107
|
-
export const selectTranslations = (state: RootState) => {
|
|
108
|
-
const defaultStaticTranslations = getTranslations(
|
|
109
|
-
state.booking.languageCode
|
|
110
|
-
) as Record<string, any>;
|
|
111
|
-
const dynamicTranslations =
|
|
112
|
-
(state.booking.translations &&
|
|
113
|
-
state.booking.translations.find(
|
|
114
|
-
(x) => x.language == state.booking.languageCode
|
|
115
|
-
)?.value) ??
|
|
116
|
-
{};
|
|
117
|
-
const merged = {} as Record<string, any>;
|
|
118
|
-
|
|
119
|
-
for (const key of Array.from(
|
|
120
|
-
new Set([
|
|
121
|
-
...Object.keys(defaultStaticTranslations),
|
|
122
|
-
...Object.keys(dynamicTranslations),
|
|
123
|
-
])
|
|
124
|
-
)) {
|
|
125
|
-
merged[key] = {
|
|
126
|
-
...(defaultStaticTranslations[key] || {}),
|
|
127
|
-
...(dynamicTranslations[key] || {}),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return merged;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export const selectBookingOptions = (state: RootState) =>
|
|
135
|
-
state.booking.bookingOptions;
|
|
136
|
-
|
|
137
|
-
export const selectBookingType = (state: RootState) =>
|
|
138
|
-
state.booking.bookingType;
|
|
139
|
-
|
|
140
|
-
export const selectTagIds = (state: RootState) => state.booking.tagIds;
|
|
141
|
-
|
|
142
|
-
export const selectAgentAdressId = (state: RootState) =>
|
|
143
|
-
state.booking.agentAdressId;
|
|
144
|
-
|
|
145
|
-
export const selectProductAttributes = (state: RootState) =>
|
|
146
|
-
state.booking.productAttributes;
|
|
147
|
-
|
|
148
|
-
export const selectBookingAttributes = (state: RootState) =>
|
|
149
|
-
state.booking.bookingAttributes;
|
|
150
|
-
|
|
151
|
-
export const selectBookingNumber = (state: RootState) =>
|
|
152
|
-
state.booking.bookingNumber;
|
|
153
|
-
|
|
154
|
-
export const selectBookingRooms = (state: RootState) =>
|
|
155
|
-
state.booking.bookingAttributes?.rooms;
|
|
156
|
-
|
|
157
|
-
export const selectBookingRemarks = (state: RootState) => state.booking.remarks;
|
|
158
|
-
|
|
159
|
-
export const selectVoucherCodes = (state: RootState) =>
|
|
160
|
-
state.booking.voucherCodes;
|
|
161
|
-
|
|
162
|
-
export const selectCalculateDeposit = (state: RootState) =>
|
|
163
|
-
state.booking.calculateDeposit;
|
|
164
|
-
|
|
165
|
-
export const selectIsRetry = (state: RootState) => state.booking.isRetry;
|
|
166
|
-
|
|
167
|
-
export const selectStartDate = (state: RootState) =>
|
|
168
|
-
state.booking.package?.options.find((x) => x.isSelected)?.fromDate;
|
|
169
|
-
|
|
170
|
-
export const selectAgents = (state: RootState) => state.booking.agents;
|
|
171
|
-
|
|
172
|
-
export const selectProductCode = (state: RootState) =>
|
|
173
|
-
state.booking.productAttributes?.productCode;
|
|
174
|
-
|
|
175
|
-
export const selectAccommodationCodes = (state: RootState) => {
|
|
176
|
-
const accommodationCodes: string[] = [];
|
|
177
|
-
state.booking.package?.options.forEach((o) => {
|
|
178
|
-
o.rooms.forEach((r) =>
|
|
179
|
-
r.options.forEach((ro) => {
|
|
180
|
-
if (!accommodationCodes.some((y) => y === ro.accommodationCode)) {
|
|
181
|
-
accommodationCodes.push(ro.accommodationCode);
|
|
182
|
-
}
|
|
183
|
-
})
|
|
184
|
-
);
|
|
185
|
-
});
|
|
186
|
-
return accommodationCodes;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export const selectAccommodationViews = (state: RootState) =>
|
|
190
|
-
state.booking.accommodationViews;
|
|
191
|
-
|
|
192
|
-
export const selectBookingQuery = (state: RootState) => {
|
|
193
|
-
const bookingAttributes = state.booking.bookingAttributes;
|
|
194
|
-
|
|
195
|
-
if (!bookingAttributes) {
|
|
196
|
-
return undefined;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const params: Record<string, string> = {};
|
|
200
|
-
Object.entries(bookingAttributes).forEach(([key, value]) => {
|
|
201
|
-
if (key === "startDate" || key === "endDate") {
|
|
202
|
-
value = format(parseISO(value), "yyyy-MM-dd");
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (key === "rooms") {
|
|
206
|
-
value = JsonURL.stringify(
|
|
207
|
-
(value as Room[]).map((room) => omit(room, ["children"])),
|
|
208
|
-
{
|
|
209
|
-
AQF: true,
|
|
210
|
-
}
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (key === "allotmentIds" && !value.length) {
|
|
215
|
-
value = undefined;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (key === "flight" && value) {
|
|
219
|
-
var flightInfo = value as FlightInfo;
|
|
220
|
-
value = JsonURL.stringify(flightInfo, { AQF: true });
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (value) {
|
|
224
|
-
params[key] = value;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
return params;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export const selectBookingQueryString = createSelector(
|
|
232
|
-
selectBookingQuery,
|
|
233
|
-
(params) => {
|
|
234
|
-
if (!params) {
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
return Object.keys(params)
|
|
239
|
-
.filter((key) => typeof params[key] !== "undefined")
|
|
240
|
-
.map((key) => `${key}=${params[key]}`)
|
|
241
|
-
.join("&");
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
|
|
245
|
-
export const selectMainBookerId = createSelector(
|
|
246
|
-
selectTravelersFormValues,
|
|
247
|
-
(formValues) => formValues?.mainBookerId
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
export const selectBookingPackagePax = createSelector(
|
|
251
|
-
selectTravelersFormValues,
|
|
252
|
-
(formValues) => {
|
|
253
|
-
var pax: BookingPackagePax[] = [];
|
|
254
|
-
|
|
255
|
-
formValues?.rooms.forEach((r) =>
|
|
256
|
-
r.adults.forEach((x) => {
|
|
257
|
-
const adultPax = buildPax(x, formValues?.mainBookerId);
|
|
258
|
-
|
|
259
|
-
if (adultPax.isMainBooker) {
|
|
260
|
-
adultPax.mobilePhone = formValues?.phone;
|
|
261
|
-
adultPax.email = formValues?.email;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
pax.push(adultPax);
|
|
265
|
-
})
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
formValues?.rooms.forEach((r) =>
|
|
269
|
-
r.children.forEach((x) => {
|
|
270
|
-
pax.push(buildPax(x));
|
|
271
|
-
})
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
return pax;
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
export const selectBookingAddress = createSelector(
|
|
279
|
-
selectTravelersFormValues,
|
|
280
|
-
selectBookingPackagePax,
|
|
281
|
-
selectBookingType,
|
|
282
|
-
(formValues, pax, bookingType) => {
|
|
283
|
-
const mainBooker = pax.find((x) => x.isMainBooker);
|
|
284
|
-
if (!mainBooker || bookingType == "b2b") return undefined;
|
|
285
|
-
|
|
286
|
-
return {
|
|
287
|
-
name: `${mainBooker.firstName} ${mainBooker.lastName}`,
|
|
288
|
-
street: formValues?.street,
|
|
289
|
-
number: formValues?.houseNumber,
|
|
290
|
-
box: formValues?.box,
|
|
291
|
-
postalCode: formValues?.zipCode,
|
|
292
|
-
location: formValues?.place,
|
|
293
|
-
country: formValues?.country,
|
|
294
|
-
mobilePhone: formValues?.phone,
|
|
295
|
-
email: formValues?.email,
|
|
296
|
-
} as BookingPackageAddress;
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
export const selectBookingPackageRequest = createSelector(
|
|
301
|
-
selectOfficeId,
|
|
302
|
-
selectAgentId,
|
|
303
|
-
selectAgentAdressId,
|
|
304
|
-
(officeId, agentId, agentAdressId) => {
|
|
305
|
-
const agencyId =
|
|
306
|
-
(agentId ?? agentAdressId ?? 0) > 0 ? agentId ?? agentAdressId : null;
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
officeId: officeId,
|
|
310
|
-
agentId: agencyId,
|
|
311
|
-
payload: null,
|
|
312
|
-
} as BookingPackageRequest<any>;
|
|
313
|
-
}
|
|
314
|
-
);
|
|
315
|
-
|
|
316
|
-
export const selectBookingPackageBookRequest = createSelector(
|
|
317
|
-
selectBookingPackageRequest,
|
|
318
|
-
selectBookingOptions,
|
|
319
|
-
selectBookingType,
|
|
320
|
-
selectBookingPackagePax,
|
|
321
|
-
selectBookingAddress,
|
|
322
|
-
selectPackageDetails,
|
|
323
|
-
selectCalculateDeposit,
|
|
324
|
-
selectAgentId,
|
|
325
|
-
selectGeneratePaymentUrl,
|
|
326
|
-
selectSkipPaymentWithAgent,
|
|
327
|
-
selectNotifications,
|
|
328
|
-
selectTagIds,
|
|
329
|
-
selectBookingRemarks,
|
|
330
|
-
selectVoucherCodes,
|
|
331
|
-
(
|
|
332
|
-
bookingPackageRequest: BookingPackageRequest<BookingPackageBookRequest>,
|
|
333
|
-
bookingOptions,
|
|
334
|
-
bookingType,
|
|
335
|
-
pax,
|
|
336
|
-
address,
|
|
337
|
-
packageDetails,
|
|
338
|
-
calculateDeposit,
|
|
339
|
-
agentId,
|
|
340
|
-
generatePaymentUrl,
|
|
341
|
-
skipPaymentWithAgent,
|
|
342
|
-
notifications,
|
|
343
|
-
tagIds,
|
|
344
|
-
remarks,
|
|
345
|
-
voucherCodes
|
|
346
|
-
) => {
|
|
347
|
-
if (!packageDetails) return null;
|
|
348
|
-
|
|
349
|
-
let returnPaymentUrl = false;
|
|
350
|
-
|
|
351
|
-
if (generatePaymentUrl && (!skipPaymentWithAgent || (agentId ?? 0) == 0)) {
|
|
352
|
-
returnPaymentUrl = true;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
var entryStatus = 0;
|
|
356
|
-
var customEntryStatusId = undefined;
|
|
357
|
-
|
|
358
|
-
switch (bookingType) {
|
|
359
|
-
case "b2b":
|
|
360
|
-
if (bookingOptions.b2b.tagIds && bookingOptions.b2b.tagIds.length > 0) {
|
|
361
|
-
tagIds = tagIds?.concat(bookingOptions.b2b.tagIds);
|
|
362
|
-
}
|
|
363
|
-
if (bookingOptions.b2b.entryStatus) {
|
|
364
|
-
entryStatus = bookingOptions.b2b.entryStatus;
|
|
365
|
-
}
|
|
366
|
-
if (bookingOptions.b2b.customEntryStatusId) {
|
|
367
|
-
customEntryStatusId = bookingOptions.b2b.customEntryStatusId;
|
|
368
|
-
}
|
|
369
|
-
break;
|
|
370
|
-
case "b2b2c":
|
|
371
|
-
if (
|
|
372
|
-
bookingOptions.b2b2c.tagIds &&
|
|
373
|
-
bookingOptions.b2b2c.tagIds.length > 0
|
|
374
|
-
) {
|
|
375
|
-
tagIds = tagIds?.concat(bookingOptions.b2b2c.tagIds);
|
|
376
|
-
}
|
|
377
|
-
if (bookingOptions.b2b2c.entryStatus) {
|
|
378
|
-
entryStatus = bookingOptions.b2b2c.entryStatus;
|
|
379
|
-
}
|
|
380
|
-
if (bookingOptions.b2b2c.customEntryStatusId) {
|
|
381
|
-
customEntryStatusId = bookingOptions.b2b2c.customEntryStatusId;
|
|
382
|
-
}
|
|
383
|
-
break;
|
|
384
|
-
default:
|
|
385
|
-
if (bookingOptions.b2c.tagIds && bookingOptions.b2c.tagIds.length > 0) {
|
|
386
|
-
tagIds = tagIds?.concat(bookingOptions.b2c.tagIds);
|
|
387
|
-
}
|
|
388
|
-
if (bookingOptions.b2c.entryStatus) {
|
|
389
|
-
entryStatus = bookingOptions.b2c.entryStatus;
|
|
390
|
-
}
|
|
391
|
-
if (bookingOptions.b2c.customEntryStatusId) {
|
|
392
|
-
customEntryStatusId = bookingOptions.b2c.customEntryStatusId;
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
bookingPackageRequest.payload = {
|
|
398
|
-
package: packageDetails,
|
|
399
|
-
status: entryStatus,
|
|
400
|
-
customStatusId: customEntryStatusId,
|
|
401
|
-
address: address,
|
|
402
|
-
pax:
|
|
403
|
-
pax?.length != 0
|
|
404
|
-
? pax
|
|
405
|
-
: packageDetails.options[0].requestRooms.flatMap((x) => x.pax),
|
|
406
|
-
nonTravelPax: [],
|
|
407
|
-
calculateDeposit: calculateDeposit,
|
|
408
|
-
returnPaymentUrl: returnPaymentUrl,
|
|
409
|
-
notifications: notifications,
|
|
410
|
-
tagIds: tagIds,
|
|
411
|
-
remarks: remarks,
|
|
412
|
-
voucherCodes: voucherCodes,
|
|
413
|
-
customerRequests: [],
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
return bookingPackageRequest;
|
|
417
|
-
}
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
const buildPax = (traveler: Traveler, mainBookerId?: number) => {
|
|
421
|
-
return {
|
|
422
|
-
id: traveler.id,
|
|
423
|
-
gender: parseGender(traveler.gender),
|
|
424
|
-
firstName: traveler.firstName,
|
|
425
|
-
lastName: traveler.lastName,
|
|
426
|
-
dateOfBirth: traveler.birthDate,
|
|
427
|
-
isMainBooker: traveler.id == mainBookerId,
|
|
428
|
-
} as BookingPackagePax;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
const parseGender = (gender: string): number => {
|
|
432
|
-
switch (gender) {
|
|
433
|
-
case "m":
|
|
434
|
-
return Gender.male;
|
|
435
|
-
case "f":
|
|
436
|
-
return Gender.female;
|
|
437
|
-
case "x":
|
|
438
|
-
default:
|
|
439
|
-
return Gender.other;
|
|
440
|
-
}
|
|
441
|
-
};
|
|
1
|
+
import JsonURL from "@jsonurl/jsonurl";
|
|
2
|
+
import { Gender } from "@qite/tide-client";
|
|
3
|
+
import {
|
|
4
|
+
BookingPackageAddress,
|
|
5
|
+
BookingPackageBookRequest,
|
|
6
|
+
BookingPackagePax,
|
|
7
|
+
BookingPackageRequest,
|
|
8
|
+
} from "@qite/tide-client/build/types";
|
|
9
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
10
|
+
import { format, parseISO } from "date-fns";
|
|
11
|
+
import { omit } from "lodash";
|
|
12
|
+
import { getTranslations } from "../../../shared/utils/localization-util";
|
|
13
|
+
import { RootState } from "../../store";
|
|
14
|
+
import { FlightInfo, Room, Traveler } from "../../types";
|
|
15
|
+
import { selectNotifications } from "../price-details/price-details-slice";
|
|
16
|
+
import {
|
|
17
|
+
selectAgentId,
|
|
18
|
+
selectTravelersFormValues,
|
|
19
|
+
} from "../travelers-form/travelers-form-slice";
|
|
20
|
+
|
|
21
|
+
export const selectCurrentStep = (state: RootState) =>
|
|
22
|
+
state.booking.currentStep;
|
|
23
|
+
|
|
24
|
+
export const selectGeneratePaymentUrl = (state: RootState) =>
|
|
25
|
+
state.booking.generatePaymentUrl;
|
|
26
|
+
|
|
27
|
+
export const selectSkipPaymentWithAgent = (state: RootState) =>
|
|
28
|
+
state.booking.skipPaymentWithAgent;
|
|
29
|
+
|
|
30
|
+
export const selectIsFetchingProductOptions = (state: RootState) =>
|
|
31
|
+
state.booking.isBusy;
|
|
32
|
+
|
|
33
|
+
export const selectDepartureFlight = (state: RootState) =>
|
|
34
|
+
state.booking.package?.outwardFlights?.find((x) => x.isSelected);
|
|
35
|
+
|
|
36
|
+
export const selectReturnFlight = (state: RootState) =>
|
|
37
|
+
state.booking.package?.returnFlights?.find((x) => x.isSelected);
|
|
38
|
+
|
|
39
|
+
export const selectPackageRooms = (state: RootState) =>
|
|
40
|
+
state.booking.package?.options.find((x) => x.isSelected)?.rooms;
|
|
41
|
+
|
|
42
|
+
export const selectAvailabilities = (state: RootState) =>
|
|
43
|
+
state.booking.package?.options.find((x) => x.isSelected)?.availabilities;
|
|
44
|
+
|
|
45
|
+
export const selectPackageTags = (state: RootState) =>
|
|
46
|
+
state.booking.package?.tags;
|
|
47
|
+
|
|
48
|
+
export const selectIsOnRequest = (state: RootState) =>
|
|
49
|
+
state.booking.package?.options.find((x) => x.isSelected)?.isOnRequest;
|
|
50
|
+
|
|
51
|
+
export const selectPackageOptionUnits = (state: RootState) =>
|
|
52
|
+
state.booking.package?.options.find((x) => x.isSelected)?.optionUnits;
|
|
53
|
+
|
|
54
|
+
export const selectPackageOptionPax = (state: RootState) =>
|
|
55
|
+
state.booking.package?.options.find((x) => x.isSelected)?.optionPax;
|
|
56
|
+
|
|
57
|
+
export const selectPackageGroups = (state: RootState) =>
|
|
58
|
+
state.booking.package?.options.find((x) => x.isSelected)?.groups;
|
|
59
|
+
|
|
60
|
+
export const selectPackageDetails = (state: RootState) => state.booking.package;
|
|
61
|
+
|
|
62
|
+
export const selectPackageFlights = (state: RootState) => ({
|
|
63
|
+
outward: state.booking.package?.outwardFlights,
|
|
64
|
+
return: state.booking.package?.returnFlights,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const selectActiveOption = (state: RootState) =>
|
|
68
|
+
state.booking.package?.options.find((x) => x.isSelected);
|
|
69
|
+
|
|
70
|
+
export const selectPackageAirlineGroups = createSelector(
|
|
71
|
+
selectActiveOption,
|
|
72
|
+
selectDepartureFlight,
|
|
73
|
+
selectReturnFlight,
|
|
74
|
+
(option, departureFlight, returnFlight) =>
|
|
75
|
+
option?.airlineGroups.filter(
|
|
76
|
+
(x) =>
|
|
77
|
+
x.flightIds.includes(departureFlight?.entryLineGuid ?? "") ||
|
|
78
|
+
x.flightIds.includes(returnFlight?.entryLineGuid ?? "")
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
export const selectPackageAirportGroups = createSelector(
|
|
83
|
+
selectActiveOption,
|
|
84
|
+
selectDepartureFlight,
|
|
85
|
+
selectReturnFlight,
|
|
86
|
+
(option, departureFlight, returnFlight) =>
|
|
87
|
+
option?.airportGroups.filter(
|
|
88
|
+
(x) =>
|
|
89
|
+
x.flightIds.includes(departureFlight?.entryLineGuid ?? "") ||
|
|
90
|
+
x.flightIds.includes(returnFlight?.entryLineGuid ?? "")
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export const selectApiSettings = (state: RootState) => state.apiSettings;
|
|
95
|
+
|
|
96
|
+
export const selectIsUnavailable = (state: RootState) =>
|
|
97
|
+
state.booking.isUnavailable;
|
|
98
|
+
|
|
99
|
+
export const selectRequestRooms = (state: RootState) =>
|
|
100
|
+
state.booking.package?.options.find((x) => x.isSelected)?.requestRooms;
|
|
101
|
+
|
|
102
|
+
export const selectOfficeId = (state: RootState) => state.booking.officeId;
|
|
103
|
+
|
|
104
|
+
export const selectLanguageCode = (state: RootState) =>
|
|
105
|
+
state.booking.languageCode;
|
|
106
|
+
|
|
107
|
+
export const selectTranslations = (state: RootState) => {
|
|
108
|
+
const defaultStaticTranslations = getTranslations(
|
|
109
|
+
state.booking.languageCode
|
|
110
|
+
) as Record<string, any>;
|
|
111
|
+
const dynamicTranslations =
|
|
112
|
+
(state.booking.translations &&
|
|
113
|
+
state.booking.translations.find(
|
|
114
|
+
(x) => x.language == state.booking.languageCode
|
|
115
|
+
)?.value) ??
|
|
116
|
+
{};
|
|
117
|
+
const merged = {} as Record<string, any>;
|
|
118
|
+
|
|
119
|
+
for (const key of Array.from(
|
|
120
|
+
new Set([
|
|
121
|
+
...Object.keys(defaultStaticTranslations),
|
|
122
|
+
...Object.keys(dynamicTranslations),
|
|
123
|
+
])
|
|
124
|
+
)) {
|
|
125
|
+
merged[key] = {
|
|
126
|
+
...(defaultStaticTranslations[key] || {}),
|
|
127
|
+
...(dynamicTranslations[key] || {}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return merged;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const selectBookingOptions = (state: RootState) =>
|
|
135
|
+
state.booking.bookingOptions;
|
|
136
|
+
|
|
137
|
+
export const selectBookingType = (state: RootState) =>
|
|
138
|
+
state.booking.bookingType;
|
|
139
|
+
|
|
140
|
+
export const selectTagIds = (state: RootState) => state.booking.tagIds;
|
|
141
|
+
|
|
142
|
+
export const selectAgentAdressId = (state: RootState) =>
|
|
143
|
+
state.booking.agentAdressId;
|
|
144
|
+
|
|
145
|
+
export const selectProductAttributes = (state: RootState) =>
|
|
146
|
+
state.booking.productAttributes;
|
|
147
|
+
|
|
148
|
+
export const selectBookingAttributes = (state: RootState) =>
|
|
149
|
+
state.booking.bookingAttributes;
|
|
150
|
+
|
|
151
|
+
export const selectBookingNumber = (state: RootState) =>
|
|
152
|
+
state.booking.bookingNumber;
|
|
153
|
+
|
|
154
|
+
export const selectBookingRooms = (state: RootState) =>
|
|
155
|
+
state.booking.bookingAttributes?.rooms;
|
|
156
|
+
|
|
157
|
+
export const selectBookingRemarks = (state: RootState) => state.booking.remarks;
|
|
158
|
+
|
|
159
|
+
export const selectVoucherCodes = (state: RootState) =>
|
|
160
|
+
state.booking.voucherCodes;
|
|
161
|
+
|
|
162
|
+
export const selectCalculateDeposit = (state: RootState) =>
|
|
163
|
+
state.booking.calculateDeposit;
|
|
164
|
+
|
|
165
|
+
export const selectIsRetry = (state: RootState) => state.booking.isRetry;
|
|
166
|
+
|
|
167
|
+
export const selectStartDate = (state: RootState) =>
|
|
168
|
+
state.booking.package?.options.find((x) => x.isSelected)?.fromDate;
|
|
169
|
+
|
|
170
|
+
export const selectAgents = (state: RootState) => state.booking.agents;
|
|
171
|
+
|
|
172
|
+
export const selectProductCode = (state: RootState) =>
|
|
173
|
+
state.booking.productAttributes?.productCode;
|
|
174
|
+
|
|
175
|
+
export const selectAccommodationCodes = (state: RootState) => {
|
|
176
|
+
const accommodationCodes: string[] = [];
|
|
177
|
+
state.booking.package?.options.forEach((o) => {
|
|
178
|
+
o.rooms.forEach((r) =>
|
|
179
|
+
r.options.forEach((ro) => {
|
|
180
|
+
if (!accommodationCodes.some((y) => y === ro.accommodationCode)) {
|
|
181
|
+
accommodationCodes.push(ro.accommodationCode);
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
return accommodationCodes;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const selectAccommodationViews = (state: RootState) =>
|
|
190
|
+
state.booking.accommodationViews;
|
|
191
|
+
|
|
192
|
+
export const selectBookingQuery = (state: RootState) => {
|
|
193
|
+
const bookingAttributes = state.booking.bookingAttributes;
|
|
194
|
+
|
|
195
|
+
if (!bookingAttributes) {
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const params: Record<string, string> = {};
|
|
200
|
+
Object.entries(bookingAttributes).forEach(([key, value]) => {
|
|
201
|
+
if (key === "startDate" || key === "endDate") {
|
|
202
|
+
value = format(parseISO(value), "yyyy-MM-dd");
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (key === "rooms") {
|
|
206
|
+
value = JsonURL.stringify(
|
|
207
|
+
(value as Room[]).map((room) => omit(room, ["children"])),
|
|
208
|
+
{
|
|
209
|
+
AQF: true,
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (key === "allotmentIds" && !value.length) {
|
|
215
|
+
value = undefined;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (key === "flight" && value) {
|
|
219
|
+
var flightInfo = value as FlightInfo;
|
|
220
|
+
value = JsonURL.stringify(flightInfo, { AQF: true });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (value) {
|
|
224
|
+
params[key] = value;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
return params;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const selectBookingQueryString = createSelector(
|
|
232
|
+
selectBookingQuery,
|
|
233
|
+
(params) => {
|
|
234
|
+
if (!params) {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return Object.keys(params)
|
|
239
|
+
.filter((key) => typeof params[key] !== "undefined")
|
|
240
|
+
.map((key) => `${key}=${params[key]}`)
|
|
241
|
+
.join("&");
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
export const selectMainBookerId = createSelector(
|
|
246
|
+
selectTravelersFormValues,
|
|
247
|
+
(formValues) => formValues?.mainBookerId
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
export const selectBookingPackagePax = createSelector(
|
|
251
|
+
selectTravelersFormValues,
|
|
252
|
+
(formValues) => {
|
|
253
|
+
var pax: BookingPackagePax[] = [];
|
|
254
|
+
|
|
255
|
+
formValues?.rooms.forEach((r) =>
|
|
256
|
+
r.adults.forEach((x) => {
|
|
257
|
+
const adultPax = buildPax(x, formValues?.mainBookerId);
|
|
258
|
+
|
|
259
|
+
if (adultPax.isMainBooker) {
|
|
260
|
+
adultPax.mobilePhone = formValues?.phone;
|
|
261
|
+
adultPax.email = formValues?.email;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
pax.push(adultPax);
|
|
265
|
+
})
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
formValues?.rooms.forEach((r) =>
|
|
269
|
+
r.children.forEach((x) => {
|
|
270
|
+
pax.push(buildPax(x));
|
|
271
|
+
})
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
return pax;
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
export const selectBookingAddress = createSelector(
|
|
279
|
+
selectTravelersFormValues,
|
|
280
|
+
selectBookingPackagePax,
|
|
281
|
+
selectBookingType,
|
|
282
|
+
(formValues, pax, bookingType) => {
|
|
283
|
+
const mainBooker = pax.find((x) => x.isMainBooker);
|
|
284
|
+
if (!mainBooker || bookingType == "b2b") return undefined;
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
name: `${mainBooker.firstName} ${mainBooker.lastName}`,
|
|
288
|
+
street: formValues?.street,
|
|
289
|
+
number: formValues?.houseNumber,
|
|
290
|
+
box: formValues?.box,
|
|
291
|
+
postalCode: formValues?.zipCode,
|
|
292
|
+
location: formValues?.place,
|
|
293
|
+
country: formValues?.country,
|
|
294
|
+
mobilePhone: formValues?.phone,
|
|
295
|
+
email: formValues?.email,
|
|
296
|
+
} as BookingPackageAddress;
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
export const selectBookingPackageRequest = createSelector(
|
|
301
|
+
selectOfficeId,
|
|
302
|
+
selectAgentId,
|
|
303
|
+
selectAgentAdressId,
|
|
304
|
+
(officeId, agentId, agentAdressId) => {
|
|
305
|
+
const agencyId =
|
|
306
|
+
(agentId ?? agentAdressId ?? 0) > 0 ? agentId ?? agentAdressId : null;
|
|
307
|
+
|
|
308
|
+
return {
|
|
309
|
+
officeId: officeId,
|
|
310
|
+
agentId: agencyId,
|
|
311
|
+
payload: null,
|
|
312
|
+
} as BookingPackageRequest<any>;
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
export const selectBookingPackageBookRequest = createSelector(
|
|
317
|
+
selectBookingPackageRequest,
|
|
318
|
+
selectBookingOptions,
|
|
319
|
+
selectBookingType,
|
|
320
|
+
selectBookingPackagePax,
|
|
321
|
+
selectBookingAddress,
|
|
322
|
+
selectPackageDetails,
|
|
323
|
+
selectCalculateDeposit,
|
|
324
|
+
selectAgentId,
|
|
325
|
+
selectGeneratePaymentUrl,
|
|
326
|
+
selectSkipPaymentWithAgent,
|
|
327
|
+
selectNotifications,
|
|
328
|
+
selectTagIds,
|
|
329
|
+
selectBookingRemarks,
|
|
330
|
+
selectVoucherCodes,
|
|
331
|
+
(
|
|
332
|
+
bookingPackageRequest: BookingPackageRequest<BookingPackageBookRequest>,
|
|
333
|
+
bookingOptions,
|
|
334
|
+
bookingType,
|
|
335
|
+
pax,
|
|
336
|
+
address,
|
|
337
|
+
packageDetails,
|
|
338
|
+
calculateDeposit,
|
|
339
|
+
agentId,
|
|
340
|
+
generatePaymentUrl,
|
|
341
|
+
skipPaymentWithAgent,
|
|
342
|
+
notifications,
|
|
343
|
+
tagIds,
|
|
344
|
+
remarks,
|
|
345
|
+
voucherCodes
|
|
346
|
+
) => {
|
|
347
|
+
if (!packageDetails) return null;
|
|
348
|
+
|
|
349
|
+
let returnPaymentUrl = false;
|
|
350
|
+
|
|
351
|
+
if (generatePaymentUrl && (!skipPaymentWithAgent || (agentId ?? 0) == 0)) {
|
|
352
|
+
returnPaymentUrl = true;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
var entryStatus = 0;
|
|
356
|
+
var customEntryStatusId = undefined;
|
|
357
|
+
|
|
358
|
+
switch (bookingType) {
|
|
359
|
+
case "b2b":
|
|
360
|
+
if (bookingOptions.b2b.tagIds && bookingOptions.b2b.tagIds.length > 0) {
|
|
361
|
+
tagIds = tagIds?.concat(bookingOptions.b2b.tagIds);
|
|
362
|
+
}
|
|
363
|
+
if (bookingOptions.b2b.entryStatus) {
|
|
364
|
+
entryStatus = bookingOptions.b2b.entryStatus;
|
|
365
|
+
}
|
|
366
|
+
if (bookingOptions.b2b.customEntryStatusId) {
|
|
367
|
+
customEntryStatusId = bookingOptions.b2b.customEntryStatusId;
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
case "b2b2c":
|
|
371
|
+
if (
|
|
372
|
+
bookingOptions.b2b2c.tagIds &&
|
|
373
|
+
bookingOptions.b2b2c.tagIds.length > 0
|
|
374
|
+
) {
|
|
375
|
+
tagIds = tagIds?.concat(bookingOptions.b2b2c.tagIds);
|
|
376
|
+
}
|
|
377
|
+
if (bookingOptions.b2b2c.entryStatus) {
|
|
378
|
+
entryStatus = bookingOptions.b2b2c.entryStatus;
|
|
379
|
+
}
|
|
380
|
+
if (bookingOptions.b2b2c.customEntryStatusId) {
|
|
381
|
+
customEntryStatusId = bookingOptions.b2b2c.customEntryStatusId;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
default:
|
|
385
|
+
if (bookingOptions.b2c.tagIds && bookingOptions.b2c.tagIds.length > 0) {
|
|
386
|
+
tagIds = tagIds?.concat(bookingOptions.b2c.tagIds);
|
|
387
|
+
}
|
|
388
|
+
if (bookingOptions.b2c.entryStatus) {
|
|
389
|
+
entryStatus = bookingOptions.b2c.entryStatus;
|
|
390
|
+
}
|
|
391
|
+
if (bookingOptions.b2c.customEntryStatusId) {
|
|
392
|
+
customEntryStatusId = bookingOptions.b2c.customEntryStatusId;
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
bookingPackageRequest.payload = {
|
|
398
|
+
package: packageDetails,
|
|
399
|
+
status: entryStatus,
|
|
400
|
+
customStatusId: customEntryStatusId,
|
|
401
|
+
address: address,
|
|
402
|
+
pax:
|
|
403
|
+
pax?.length != 0
|
|
404
|
+
? pax
|
|
405
|
+
: packageDetails.options[0].requestRooms.flatMap((x) => x.pax),
|
|
406
|
+
nonTravelPax: [],
|
|
407
|
+
calculateDeposit: calculateDeposit,
|
|
408
|
+
returnPaymentUrl: returnPaymentUrl,
|
|
409
|
+
notifications: notifications,
|
|
410
|
+
tagIds: tagIds,
|
|
411
|
+
remarks: remarks,
|
|
412
|
+
voucherCodes: voucherCodes,
|
|
413
|
+
customerRequests: [],
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
return bookingPackageRequest;
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
const buildPax = (traveler: Traveler, mainBookerId?: number) => {
|
|
421
|
+
return {
|
|
422
|
+
id: traveler.id,
|
|
423
|
+
gender: parseGender(traveler.gender),
|
|
424
|
+
firstName: traveler.firstName,
|
|
425
|
+
lastName: traveler.lastName,
|
|
426
|
+
dateOfBirth: traveler.birthDate,
|
|
427
|
+
isMainBooker: traveler.id == mainBookerId,
|
|
428
|
+
} as BookingPackagePax;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const parseGender = (gender: string): number => {
|
|
432
|
+
switch (gender) {
|
|
433
|
+
case "m":
|
|
434
|
+
return Gender.male;
|
|
435
|
+
case "f":
|
|
436
|
+
return Gender.female;
|
|
437
|
+
case "x":
|
|
438
|
+
default:
|
|
439
|
+
return Gender.other;
|
|
440
|
+
}
|
|
441
|
+
};
|