@qite/tide-booking-component 1.3.2 → 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.
Files changed (305) hide show
  1. package/.vs/ProjectSettings.json +3 -3
  2. package/.vs/VSWorkspaceState.json +5 -5
  3. package/README.md +8 -8
  4. package/build/build-cjs/booking-product/components/age-select.d.ts +8 -8
  5. package/build/build-cjs/booking-product/components/amount-input.d.ts +10 -10
  6. package/build/build-cjs/booking-product/components/date-range-picker/calendar-day.d.ts +12 -12
  7. package/build/build-cjs/booking-product/components/date-range-picker/calendar.d.ts +19 -19
  8. package/build/build-cjs/booking-product/components/date-range-picker/index.d.ts +20 -23
  9. package/build/build-cjs/booking-product/components/dates.d.ts +9 -9
  10. package/build/build-cjs/booking-product/components/footer.d.ts +10 -10
  11. package/build/build-cjs/booking-product/components/header.d.ts +11 -11
  12. package/build/build-cjs/booking-product/components/icon.d.ts +10 -10
  13. package/build/build-cjs/booking-product/components/product.d.ts +9 -9
  14. package/build/build-cjs/booking-product/components/rating.d.ts +6 -6
  15. package/build/build-cjs/booking-product/components/rooms.d.ts +10 -10
  16. package/build/build-cjs/booking-product/index.d.ts +10 -10
  17. package/build/build-cjs/booking-product/settings-context.d.ts +5 -6
  18. package/build/build-cjs/booking-product/types.d.ts +25 -25
  19. package/build/build-cjs/booking-product/utils/api.d.ts +16 -6
  20. package/build/build-cjs/booking-product/utils/price.d.ts +9 -1
  21. package/build/build-cjs/booking-wizard/api-settings-slice.d.ts +14 -4
  22. package/build/build-cjs/booking-wizard/components/icon.d.ts +10 -10
  23. package/build/build-cjs/booking-wizard/components/labeled-input.d.ts +18 -18
  24. package/build/build-cjs/booking-wizard/components/labeled-select.d.ts +21 -21
  25. package/build/build-cjs/booking-wizard/components/message.d.ts +9 -9
  26. package/build/build-cjs/booking-wizard/components/multi-range-filter.d.ts +11 -11
  27. package/build/build-cjs/booking-wizard/components/print-offer-button.d.ts +17 -17
  28. package/build/build-cjs/booking-wizard/components/product-card.d.ts +8 -8
  29. package/build/build-cjs/booking-wizard/components/step-indicator.d.ts +6 -6
  30. package/build/build-cjs/booking-wizard/components/step-route.d.ts +9 -9
  31. package/build/build-cjs/booking-wizard/features/booking/api.d.ts +29 -10
  32. package/build/build-cjs/booking-wizard/features/booking/booking-self-contained.d.ts +8 -8
  33. package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +177 -46
  34. package/build/build-cjs/booking-wizard/features/booking/booking.d.ts +8 -8
  35. package/build/build-cjs/booking-wizard/features/booking/constants.d.ts +15 -8
  36. package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +308 -136
  37. package/build/build-cjs/booking-wizard/features/confirmation/confirmation.d.ts +4 -5
  38. package/build/build-cjs/booking-wizard/features/error/error.d.ts +4 -5
  39. package/build/build-cjs/booking-wizard/features/flight-options/flight-filter.d.ts +9 -9
  40. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -8
  41. package/build/build-cjs/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -3
  42. package/build/build-cjs/booking-wizard/features/flight-options/flight-option.d.ts +10 -10
  43. package/build/build-cjs/booking-wizard/features/flight-options/flight-utils.d.ts +16 -6
  44. package/build/build-cjs/booking-wizard/features/flight-options/index.d.ts +4 -5
  45. package/build/build-cjs/booking-wizard/features/price-details/price-details-api.d.ts +15 -6
  46. package/build/build-cjs/booking-wizard/features/price-details/price-details-slice.d.ts +121 -80
  47. package/build/build-cjs/booking-wizard/features/price-details/util.d.ts +5 -2
  48. package/build/build-cjs/booking-wizard/features/product-options/no-options.d.ts +3 -3
  49. package/build/build-cjs/booking-wizard/features/product-options/none-option.d.ts +17 -9
  50. package/build/build-cjs/booking-wizard/features/product-options/option-booking-airline-group.d.ts +17 -8
  51. package/build/build-cjs/booking-wizard/features/product-options/option-booking-group.d.ts +18 -12
  52. package/build/build-cjs/booking-wizard/features/product-options/option-item.d.ts +11 -11
  53. package/build/build-cjs/booking-wizard/features/product-options/option-pax-card.d.ts +13 -10
  54. package/build/build-cjs/booking-wizard/features/product-options/option-pax-group.d.ts +20 -13
  55. package/build/build-cjs/booking-wizard/features/product-options/option-room.d.ts +18 -10
  56. package/build/build-cjs/booking-wizard/features/product-options/option-unit-group.d.ts +20 -13
  57. package/build/build-cjs/booking-wizard/features/product-options/option-units-card.d.ts +9 -9
  58. package/build/build-cjs/booking-wizard/features/product-options/options-form.d.ts +4 -5
  59. package/build/build-cjs/booking-wizard/features/room-options/index.d.ts +4 -5
  60. package/build/build-cjs/booking-wizard/features/room-options/room-utils.d.ts +29 -9
  61. package/build/build-cjs/booking-wizard/features/room-options/room.d.ts +15 -12
  62. package/build/build-cjs/booking-wizard/features/room-options/traveler-rooms.d.ts +13 -9
  63. package/build/build-cjs/booking-wizard/features/sidebar/index.d.ts +7 -7
  64. package/build/build-cjs/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -8
  65. package/build/build-cjs/booking-wizard/features/sidebar/sidebar-util.d.ts +31 -12
  66. package/build/build-cjs/booking-wizard/features/sidebar/sidebar.d.ts +29 -25
  67. package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -7
  68. package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -7
  69. package/build/build-cjs/booking-wizard/features/summary/summary-flight.d.ts +8 -8
  70. package/build/build-cjs/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -7
  71. package/build/build-cjs/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -7
  72. package/build/build-cjs/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -7
  73. package/build/build-cjs/booking-wizard/features/summary/summary-slice.d.ts +14 -8
  74. package/build/build-cjs/booking-wizard/features/summary/summary.d.ts +4 -5
  75. package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +75 -49
  76. package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form.d.ts +4 -5
  77. package/build/build-cjs/booking-wizard/features/travelers-form/type-ahead-input.d.ts +16 -16
  78. package/build/build-cjs/booking-wizard/features/travelers-form/validate-form.d.ts +9 -4
  79. package/build/build-cjs/booking-wizard/index.d.ts +12 -12
  80. package/build/build-cjs/booking-wizard/settings-context.d.ts +5 -6
  81. package/build/build-cjs/booking-wizard/store.d.ts +44 -24
  82. package/build/build-cjs/booking-wizard/types.d.ts +253 -257
  83. package/build/build-cjs/booking-wizard/use-offer-printer.d.ts +19 -13
  84. package/build/build-cjs/index.d.ts +3 -3
  85. package/build/build-cjs/index.js +16332 -7414
  86. package/build/build-cjs/shared/components/loader.d.ts +6 -6
  87. package/build/build-cjs/shared/types.d.ts +4 -4
  88. package/build/build-cjs/shared/utils/class-util.d.ts +1 -1
  89. package/build/build-cjs/shared/utils/localization-util.d.ts +248 -248
  90. package/build/build-cjs/shared/utils/query-string-util.d.ts +29 -8
  91. package/build/build-cjs/shared/utils/tide-api-utils.d.ts +6 -4
  92. package/build/build-esm/booking-product/components/age-select.d.ts +8 -8
  93. package/build/build-esm/booking-product/components/amount-input.d.ts +10 -10
  94. package/build/build-esm/booking-product/components/date-range-picker/calendar-day.d.ts +12 -12
  95. package/build/build-esm/booking-product/components/date-range-picker/calendar.d.ts +19 -19
  96. package/build/build-esm/booking-product/components/date-range-picker/index.d.ts +20 -23
  97. package/build/build-esm/booking-product/components/dates.d.ts +9 -9
  98. package/build/build-esm/booking-product/components/footer.d.ts +10 -10
  99. package/build/build-esm/booking-product/components/header.d.ts +11 -11
  100. package/build/build-esm/booking-product/components/icon.d.ts +10 -10
  101. package/build/build-esm/booking-product/components/product.d.ts +9 -9
  102. package/build/build-esm/booking-product/components/rating.d.ts +6 -6
  103. package/build/build-esm/booking-product/components/rooms.d.ts +10 -10
  104. package/build/build-esm/booking-product/index.d.ts +10 -10
  105. package/build/build-esm/booking-product/settings-context.d.ts +5 -6
  106. package/build/build-esm/booking-product/types.d.ts +25 -25
  107. package/build/build-esm/booking-product/utils/api.d.ts +16 -6
  108. package/build/build-esm/booking-product/utils/price.d.ts +9 -1
  109. package/build/build-esm/booking-wizard/api-settings-slice.d.ts +14 -4
  110. package/build/build-esm/booking-wizard/components/icon.d.ts +10 -10
  111. package/build/build-esm/booking-wizard/components/labeled-input.d.ts +18 -18
  112. package/build/build-esm/booking-wizard/components/labeled-select.d.ts +21 -21
  113. package/build/build-esm/booking-wizard/components/message.d.ts +9 -9
  114. package/build/build-esm/booking-wizard/components/multi-range-filter.d.ts +11 -11
  115. package/build/build-esm/booking-wizard/components/print-offer-button.d.ts +17 -17
  116. package/build/build-esm/booking-wizard/components/product-card.d.ts +8 -8
  117. package/build/build-esm/booking-wizard/components/step-indicator.d.ts +6 -6
  118. package/build/build-esm/booking-wizard/components/step-route.d.ts +9 -9
  119. package/build/build-esm/booking-wizard/features/booking/api.d.ts +29 -10
  120. package/build/build-esm/booking-wizard/features/booking/booking-self-contained.d.ts +8 -8
  121. package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +177 -46
  122. package/build/build-esm/booking-wizard/features/booking/booking.d.ts +8 -8
  123. package/build/build-esm/booking-wizard/features/booking/constants.d.ts +15 -8
  124. package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +308 -136
  125. package/build/build-esm/booking-wizard/features/confirmation/confirmation.d.ts +4 -5
  126. package/build/build-esm/booking-wizard/features/error/error.d.ts +4 -5
  127. package/build/build-esm/booking-wizard/features/flight-options/flight-filter.d.ts +9 -9
  128. package/build/build-esm/booking-wizard/features/flight-options/flight-option-flight.d.ts +8 -8
  129. package/build/build-esm/booking-wizard/features/flight-options/flight-option-modal.d.ts +3 -3
  130. package/build/build-esm/booking-wizard/features/flight-options/flight-option.d.ts +10 -10
  131. package/build/build-esm/booking-wizard/features/flight-options/flight-utils.d.ts +16 -6
  132. package/build/build-esm/booking-wizard/features/flight-options/index.d.ts +4 -5
  133. package/build/build-esm/booking-wizard/features/price-details/price-details-api.d.ts +15 -6
  134. package/build/build-esm/booking-wizard/features/price-details/price-details-slice.d.ts +121 -80
  135. package/build/build-esm/booking-wizard/features/price-details/util.d.ts +5 -2
  136. package/build/build-esm/booking-wizard/features/product-options/no-options.d.ts +3 -3
  137. package/build/build-esm/booking-wizard/features/product-options/none-option.d.ts +17 -9
  138. package/build/build-esm/booking-wizard/features/product-options/option-booking-airline-group.d.ts +17 -8
  139. package/build/build-esm/booking-wizard/features/product-options/option-booking-group.d.ts +18 -12
  140. package/build/build-esm/booking-wizard/features/product-options/option-item.d.ts +11 -11
  141. package/build/build-esm/booking-wizard/features/product-options/option-pax-card.d.ts +13 -10
  142. package/build/build-esm/booking-wizard/features/product-options/option-pax-group.d.ts +20 -13
  143. package/build/build-esm/booking-wizard/features/product-options/option-room.d.ts +18 -10
  144. package/build/build-esm/booking-wizard/features/product-options/option-unit-group.d.ts +20 -13
  145. package/build/build-esm/booking-wizard/features/product-options/option-units-card.d.ts +9 -9
  146. package/build/build-esm/booking-wizard/features/product-options/options-form.d.ts +4 -5
  147. package/build/build-esm/booking-wizard/features/room-options/index.d.ts +4 -5
  148. package/build/build-esm/booking-wizard/features/room-options/room-utils.d.ts +29 -9
  149. package/build/build-esm/booking-wizard/features/room-options/room.d.ts +15 -12
  150. package/build/build-esm/booking-wizard/features/room-options/traveler-rooms.d.ts +13 -9
  151. package/build/build-esm/booking-wizard/features/sidebar/index.d.ts +7 -7
  152. package/build/build-esm/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -8
  153. package/build/build-esm/booking-wizard/features/sidebar/sidebar-util.d.ts +31 -12
  154. package/build/build-esm/booking-wizard/features/sidebar/sidebar.d.ts +29 -25
  155. package/build/build-esm/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -7
  156. package/build/build-esm/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -7
  157. package/build/build-esm/booking-wizard/features/summary/summary-flight.d.ts +8 -8
  158. package/build/build-esm/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -7
  159. package/build/build-esm/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -7
  160. package/build/build-esm/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -7
  161. package/build/build-esm/booking-wizard/features/summary/summary-slice.d.ts +14 -8
  162. package/build/build-esm/booking-wizard/features/summary/summary.d.ts +4 -5
  163. package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +75 -49
  164. package/build/build-esm/booking-wizard/features/travelers-form/travelers-form.d.ts +4 -5
  165. package/build/build-esm/booking-wizard/features/travelers-form/type-ahead-input.d.ts +16 -16
  166. package/build/build-esm/booking-wizard/features/travelers-form/validate-form.d.ts +9 -4
  167. package/build/build-esm/booking-wizard/index.d.ts +12 -12
  168. package/build/build-esm/booking-wizard/settings-context.d.ts +5 -6
  169. package/build/build-esm/booking-wizard/store.d.ts +44 -24
  170. package/build/build-esm/booking-wizard/types.d.ts +253 -257
  171. package/build/build-esm/booking-wizard/use-offer-printer.d.ts +19 -13
  172. package/build/build-esm/index.d.ts +3 -3
  173. package/build/build-esm/index.js +15926 -7396
  174. package/build/build-esm/shared/components/loader.d.ts +6 -6
  175. package/build/build-esm/shared/types.d.ts +4 -4
  176. package/build/build-esm/shared/utils/class-util.d.ts +1 -1
  177. package/build/build-esm/shared/utils/localization-util.d.ts +248 -248
  178. package/build/build-esm/shared/utils/query-string-util.d.ts +29 -8
  179. package/build/build-esm/shared/utils/tide-api-utils.d.ts +6 -4
  180. package/package.json +75 -75
  181. package/rollup.config.js +23 -23
  182. package/src/booking-product/components/age-select.tsx +35 -35
  183. package/src/booking-product/components/amount-input.tsx +78 -78
  184. package/src/booking-product/components/date-range-picker/calendar-day.tsx +58 -58
  185. package/src/booking-product/components/date-range-picker/calendar.tsx +178 -178
  186. package/src/booking-product/components/date-range-picker/index.tsx +196 -196
  187. package/src/booking-product/components/dates.tsx +136 -136
  188. package/src/booking-product/components/footer.tsx +69 -69
  189. package/src/booking-product/components/header.tsx +79 -79
  190. package/src/booking-product/components/icon.tsx +251 -251
  191. package/src/booking-product/components/product.tsx +314 -314
  192. package/src/booking-product/components/rating.tsx +21 -21
  193. package/src/booking-product/components/rooms.tsx +195 -195
  194. package/src/booking-product/index.tsx +30 -30
  195. package/src/booking-product/settings-context.ts +14 -14
  196. package/src/booking-product/types.ts +28 -28
  197. package/src/booking-product/utils/api.ts +25 -25
  198. package/src/booking-product/utils/price.ts +29 -29
  199. package/src/booking-wizard/api-settings-slice.ts +24 -24
  200. package/src/booking-wizard/components/icon.tsx +508 -508
  201. package/src/booking-wizard/components/labeled-input.tsx +64 -64
  202. package/src/booking-wizard/components/labeled-select.tsx +69 -69
  203. package/src/booking-wizard/components/message.tsx +34 -34
  204. package/src/booking-wizard/components/multi-range-filter.tsx +113 -113
  205. package/src/booking-wizard/components/print-offer-button.tsx +63 -66
  206. package/src/booking-wizard/components/product-card.tsx +37 -37
  207. package/src/booking-wizard/components/step-indicator.tsx +51 -51
  208. package/src/booking-wizard/components/step-route.tsx +27 -27
  209. package/src/booking-wizard/declarations.d.ts +4 -4
  210. package/src/booking-wizard/features/booking/api.ts +49 -49
  211. package/src/booking-wizard/features/booking/booking-self-contained.tsx +389 -389
  212. package/src/booking-wizard/features/booking/booking-slice.ts +665 -663
  213. package/src/booking-wizard/features/booking/booking.tsx +361 -361
  214. package/src/booking-wizard/features/booking/constants.ts +16 -16
  215. package/src/booking-wizard/features/booking/selectors.ts +441 -441
  216. package/src/booking-wizard/features/confirmation/confirmation.tsx +97 -97
  217. package/src/booking-wizard/features/error/error.tsx +78 -78
  218. package/src/booking-wizard/features/flight-options/flight-filter.tsx +432 -432
  219. package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +385 -385
  220. package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +229 -229
  221. package/src/booking-wizard/features/flight-options/flight-option.tsx +81 -81
  222. package/src/booking-wizard/features/flight-options/flight-utils.ts +516 -516
  223. package/src/booking-wizard/features/flight-options/index.tsx +196 -196
  224. package/src/booking-wizard/features/price-details/price-details-api.ts +24 -24
  225. package/src/booking-wizard/features/price-details/price-details-slice.ts +178 -178
  226. package/src/booking-wizard/features/price-details/util.ts +155 -155
  227. package/src/booking-wizard/features/product-options/no-options.tsx +21 -21
  228. package/src/booking-wizard/features/product-options/none-option.tsx +120 -120
  229. package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +64 -64
  230. package/src/booking-wizard/features/product-options/option-booking-group.tsx +216 -216
  231. package/src/booking-wizard/features/product-options/option-item.tsx +317 -317
  232. package/src/booking-wizard/features/product-options/option-pax-card.tsx +201 -201
  233. package/src/booking-wizard/features/product-options/option-pax-group.tsx +175 -175
  234. package/src/booking-wizard/features/product-options/option-room.tsx +321 -321
  235. package/src/booking-wizard/features/product-options/option-unit-group.tsx +198 -198
  236. package/src/booking-wizard/features/product-options/option-units-card.tsx +185 -185
  237. package/src/booking-wizard/features/product-options/options-form.tsx +481 -563
  238. package/src/booking-wizard/features/room-options/index.tsx +187 -187
  239. package/src/booking-wizard/features/room-options/room-utils.ts +190 -190
  240. package/src/booking-wizard/features/room-options/room.tsx +160 -160
  241. package/src/booking-wizard/features/room-options/traveler-rooms.tsx +75 -75
  242. package/src/booking-wizard/features/sidebar/index.tsx +76 -76
  243. package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +68 -68
  244. package/src/booking-wizard/features/sidebar/sidebar-util.ts +177 -177
  245. package/src/booking-wizard/features/sidebar/sidebar.tsx +364 -364
  246. package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +25 -25
  247. package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +25 -25
  248. package/src/booking-wizard/features/summary/summary-flight.tsx +39 -39
  249. package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +69 -69
  250. package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +63 -63
  251. package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +66 -66
  252. package/src/booking-wizard/features/summary/summary-slice.ts +28 -28
  253. package/src/booking-wizard/features/summary/summary.tsx +674 -674
  254. package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +164 -164
  255. package/src/booking-wizard/features/travelers-form/travelers-form.tsx +754 -754
  256. package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +101 -101
  257. package/src/booking-wizard/features/travelers-form/validate-form.ts +245 -245
  258. package/src/booking-wizard/index.tsx +36 -36
  259. package/src/booking-wizard/settings-context.ts +62 -62
  260. package/src/booking-wizard/store.ts +31 -31
  261. package/src/booking-wizard/types.ts +279 -279
  262. package/src/booking-wizard/use-offer-printer.ts +117 -136
  263. package/src/index.ts +4 -4
  264. package/src/shared/components/loader.tsx +16 -16
  265. package/src/shared/translations/en-GB.json +237 -237
  266. package/src/shared/translations/fr-BE.json +238 -238
  267. package/src/shared/translations/nl-BE.json +237 -237
  268. package/src/shared/types.ts +4 -4
  269. package/src/shared/utils/class-util.ts +9 -9
  270. package/src/shared/utils/localization-util.ts +62 -62
  271. package/src/shared/utils/query-string-util.ts +119 -119
  272. package/src/shared/utils/tide-api-utils.ts +36 -36
  273. package/styles/booking-product-variables.scss +394 -394
  274. package/styles/booking-product.scss +446 -446
  275. package/styles/booking-wizard-variables.scss +873 -873
  276. package/styles/booking-wizard.scss +59 -59
  277. package/styles/components/_animations.scss +39 -39
  278. package/styles/components/_base.scss +107 -107
  279. package/styles/components/_booking.scss +879 -879
  280. package/styles/components/_button.scss +238 -238
  281. package/styles/components/_checkbox.scss +219 -219
  282. package/styles/components/_cta.scss +208 -208
  283. package/styles/components/_date-list.scss +41 -41
  284. package/styles/components/_date-range-picker.scss +225 -225
  285. package/styles/components/_decrement-increment.scss +35 -35
  286. package/styles/components/_dropdown.scss +72 -72
  287. package/styles/components/_flight-option.scss +1429 -1429
  288. package/styles/components/_form.scss +1583 -1583
  289. package/styles/components/_info-message.scss +71 -71
  290. package/styles/components/_input.scss +25 -25
  291. package/styles/components/_list.scss +187 -187
  292. package/styles/components/_loader.scss +72 -72
  293. package/styles/components/_mixins.scss +550 -550
  294. package/styles/components/_placeholders.scss +166 -166
  295. package/styles/components/_pricing-summary.scss +155 -155
  296. package/styles/components/_qsm.scss +17 -17
  297. package/styles/components/_radiobutton.scss +170 -170
  298. package/styles/components/_select-wrapper.scss +80 -80
  299. package/styles/components/_spinner.scss +29 -29
  300. package/styles/components/_step-indicators.scss +168 -168
  301. package/styles/components/_table.scss +81 -81
  302. package/styles/components/_tree.scss +530 -530
  303. package/styles/components/_typeahead.scss +281 -281
  304. package/styles/components/_variables.scss +89 -89
  305. package/tsconfig.json +24 -24
@@ -1,516 +1,516 @@
1
- import {
2
- BookingPackageFlight,
3
- BookingPackageFlightMetaDataLine,
4
- } from "@qite/tide-client/build/types";
5
- import { differenceInMinutes, isEqual, parseISO } from "date-fns";
6
- import {
7
- FlightDirectionFilter,
8
- FlightFilterOption,
9
- FlightFilterOptions,
10
- GroupedFlightDetails,
11
- GroupedFlights,
12
- } from "../../types";
13
-
14
- /*interface FlightGroup {
15
- code: string;
16
- startDate: Date,
17
- endDate: Date;
18
- options: BookingPackageFlight[];
19
- }*/
20
-
21
- export const buildGroupedFlights = (
22
- outwardFlights: BookingPackageFlight[] | undefined,
23
- returnFlights: BookingPackageFlight[] | undefined
24
- ) => {
25
- if (!outwardFlights || !returnFlights) return [] as GroupedFlights[];
26
-
27
- // let outwardGroups = groupFlights(outwardFlights);
28
- // let returnGroups = groupFlights(returnFlights);
29
-
30
- const pairs: {
31
- outward: BookingPackageFlight;
32
- return: BookingPackageFlight;
33
- }[] = [];
34
- outwardFlights.forEach((outwardFlight) => {
35
- if (outwardFlight.externalGuid) {
36
- const returnFlight = returnFlights.find(
37
- (x) => x.externalGuid === outwardFlight.externalGuid
38
- )!;
39
- pairs.push({ outward: outwardFlight, return: returnFlight });
40
- } else {
41
- const outwardCode = outwardFlight.code.substring(0, 7);
42
- const returnCode = outwardCode.split(" ").reduce((a, b) => `${b} ${a}`);
43
-
44
- returnFlights
45
- .filter((x) => x.code.startsWith(returnCode))
46
- .forEach((returnFlight) => {
47
- pairs.push({ outward: outwardFlight, return: returnFlight });
48
- });
49
- }
50
- });
51
-
52
- const results = pairs.map((x) => {
53
- const outwardFlightDetails = getFlightDetails(x.outward);
54
- const returnFlightDetails = getFlightDetails(x.return);
55
-
56
- return {
57
- isSelected: x.outward.isSelected && x.return.isSelected,
58
- price: x.outward.price + x.return.price,
59
- outward: outwardFlightDetails,
60
- return: returnFlightDetails,
61
- selectedOutward: x.outward,
62
- selectedReturn: x.return,
63
- } as GroupedFlights;
64
- });
65
-
66
- return results;
67
- };
68
-
69
- export const buildFilterOptions = (
70
- outwardFlights: BookingPackageFlight[] | undefined,
71
- returnFlights: BookingPackageFlight[] | undefined,
72
- translations: any
73
- ) => {
74
- if (!outwardFlights || !returnFlights) return undefined;
75
-
76
- const airports: FlightFilterOption[] = [];
77
- const airlines: FlightFilterOption[] = [];
78
- const numberOfStops: FlightFilterOption[] = [];
79
- const outwardDeparturePeriods: FlightFilterOption[] = [];
80
- const returnDeparturePeriods: FlightFilterOption[] = [];
81
-
82
- let lowestDepartureTravelDuration = 9999;
83
- let highestDepartureTravelDuration = 0;
84
- let lowestDepartureChangeDuration = 9999;
85
- let highestDepartureChangeDuration = 0;
86
-
87
- outwardFlights.forEach((flight) => {
88
- const airlineCode = flight.code.split("/")[1];
89
-
90
- if (flight.flightMetaData.flightLines?.length) {
91
- const firstLine = flight.flightMetaData.flightLines[0];
92
-
93
- if (!airports.some((x) => x.value === firstLine.departureAirport)) {
94
- airports.push({
95
- value: firstLine?.departureAirport,
96
- label: firstLine.departureAirportDescription,
97
- count: 0,
98
- isSelected: false,
99
- });
100
- }
101
- }
102
-
103
- if (!airlines.some((x) => x.value === airlineCode)) {
104
- airlines.push({
105
- value: airlineCode,
106
- label: flight.airlineDescription,
107
- count: 0,
108
- isSelected: false,
109
- });
110
- }
111
-
112
- const stopCount = flight.flightMetaData.flightLines.length - 1;
113
- if (!numberOfStops.some((x) => x.value === stopCount + "")) {
114
- numberOfStops.push({
115
- value: stopCount + "",
116
- label:
117
- stopCount === 0
118
- ? translations.FLIGHTS_FORM.DIRECT_FLIGHT
119
- : stopCount == 1
120
- ? `${stopCount} ${translations.FLIGHTS_FORM.STOP}`
121
- : `${stopCount} ${translations.FLIGHTS_FORM.STOPS}`,
122
- count: 0,
123
- isSelected: false,
124
- });
125
- }
126
-
127
- const departureTime = flight.flightMetaData.flightLines[0].departureTime;
128
- const timeBracket = determineTimeBracket(departureTime);
129
- if (!outwardDeparturePeriods.some((x) => x.value === timeBracket)) {
130
- outwardDeparturePeriods.push({
131
- value: timeBracket,
132
- label: getBracketTranslation(timeBracket, translations),
133
- count: 0,
134
- isSelected: false,
135
- });
136
- }
137
-
138
- const travelDurationInMinutes = minutesFromTicks(
139
- flight.flightMetaData.durationInTicks
140
- );
141
- if (travelDurationInMinutes > highestDepartureTravelDuration)
142
- highestDepartureTravelDuration = travelDurationInMinutes;
143
- if (travelDurationInMinutes < lowestDepartureTravelDuration)
144
- lowestDepartureTravelDuration = travelDurationInMinutes;
145
-
146
- const changeDurationInMinutes = getTotalChangeDuration(flight);
147
- if (changeDurationInMinutes > highestDepartureChangeDuration)
148
- highestDepartureChangeDuration = changeDurationInMinutes;
149
- if (changeDurationInMinutes < lowestDepartureChangeDuration)
150
- lowestDepartureChangeDuration = changeDurationInMinutes;
151
- });
152
-
153
- let lowestReturnTravelDuration = 9999;
154
- let highestReturnTravelDuration = 0;
155
- let lowestReturnChangeDuration = 9999;
156
- let highestReturnChangeDuration = 0;
157
-
158
- returnFlights.forEach((flight) => {
159
- const durationInMinutes = minutesFromTicks(
160
- flight.flightMetaData.durationInTicks
161
- );
162
- if (durationInMinutes > highestReturnTravelDuration)
163
- highestReturnTravelDuration = durationInMinutes;
164
- if (durationInMinutes < lowestReturnTravelDuration)
165
- lowestReturnTravelDuration = durationInMinutes;
166
-
167
- const changeDurationInMinutes = getTotalChangeDuration(flight);
168
- if (changeDurationInMinutes > highestReturnChangeDuration)
169
- highestReturnChangeDuration = changeDurationInMinutes;
170
- if (changeDurationInMinutes < lowestReturnChangeDuration)
171
- lowestReturnChangeDuration = changeDurationInMinutes;
172
-
173
- const departureTime = flight.flightMetaData.flightLines[0].departureTime;
174
- const timeBracket = determineTimeBracket(departureTime);
175
- if (!returnDeparturePeriods.some((x) => x.value === timeBracket)) {
176
- returnDeparturePeriods.push({
177
- value: timeBracket,
178
- label: getBracketTranslation(timeBracket, translations),
179
- count: 0,
180
- isSelected: false,
181
- });
182
- }
183
- });
184
-
185
- return {
186
- airports: airports,
187
- airlines: airlines,
188
- numberOfStops: numberOfStops,
189
- outward: {
190
- departurePeriod: outwardDeparturePeriods,
191
- travelDuration: {
192
- min: lowestDepartureTravelDuration,
193
- max: highestDepartureTravelDuration,
194
- selectedMin: lowestDepartureTravelDuration,
195
- selectedMax: highestDepartureTravelDuration,
196
- },
197
- changeDuration: {
198
- min: lowestDepartureChangeDuration,
199
- max: highestDepartureChangeDuration,
200
- selectedMin: lowestDepartureChangeDuration,
201
- selectedMax: highestDepartureChangeDuration,
202
- },
203
- },
204
- return: {
205
- departurePeriod: returnDeparturePeriods,
206
- travelDuration: {
207
- min: lowestReturnTravelDuration,
208
- max: highestReturnTravelDuration,
209
- selectedMin: lowestReturnTravelDuration,
210
- selectedMax: highestReturnTravelDuration,
211
- },
212
- changeDuration: {
213
- min: lowestReturnChangeDuration,
214
- max: highestReturnChangeDuration,
215
- selectedMin: lowestReturnChangeDuration,
216
- selectedMax: highestReturnChangeDuration,
217
- },
218
- },
219
- } as FlightFilterOptions;
220
- };
221
-
222
- export const filterGroupedFlights = (
223
- groups: GroupedFlights[],
224
- filterOptions: FlightFilterOptions | undefined
225
- ) => {
226
- if (!groups.length || !filterOptions) return [];
227
-
228
- let filteredGroups = groups;
229
- if (filterOptions.airlines.some((x) => x.isSelected)) {
230
- const selectedAirlineCodes = filterOptions.airlines.filter(
231
- (x) => x.isSelected
232
- );
233
- filteredGroups = filteredGroups.filter((x) =>
234
- selectedAirlineCodes.some((y) => y.value === x.outward.airlineCode)
235
- );
236
- }
237
-
238
- if (filterOptions.airports.some((x) => x.isSelected)) {
239
- const selectedAirlineCodes = filterOptions.airports.filter(
240
- (x) => x.isSelected
241
- );
242
- filteredGroups = filteredGroups.filter((x) =>
243
- selectedAirlineCodes.some(
244
- (y) => y.value === x.outward.departureAirportCode
245
- )
246
- );
247
- }
248
-
249
- if (filterOptions.numberOfStops.some((x) => x.isSelected)) {
250
- const selectedNumberOfStops = filterOptions.numberOfStops.filter(
251
- (x) => x.isSelected
252
- );
253
- filteredGroups = filteredGroups.filter((x) =>
254
- selectedNumberOfStops.some(
255
- (y) => parseInt(y.value) === x.outward.flightLines.length - 1
256
- )
257
- );
258
- }
259
-
260
- filteredGroups = filterGroupedFlightByDirection(
261
- filteredGroups,
262
- true,
263
- filterOptions.outward
264
- );
265
- filteredGroups = filterGroupedFlightByDirection(
266
- filteredGroups,
267
- false,
268
- filterOptions.return
269
- );
270
-
271
- return filteredGroups;
272
- };
273
-
274
- const filterGroupedFlightByDirection = (
275
- groups: GroupedFlights[],
276
- isOutward: boolean,
277
- directionFilter: FlightDirectionFilter
278
- ) => {
279
- let filteredGroups = groups;
280
-
281
- if (directionFilter.departurePeriod.some((x) => x.isSelected)) {
282
- const selectedDeparturePeriods = directionFilter.departurePeriod.filter(
283
- (x) => x.isSelected
284
- );
285
- filteredGroups = filteredGroups.filter((x) =>
286
- selectedDeparturePeriods.some(
287
- (y) =>
288
- y.value ===
289
- determineTimeBracket((isOutward ? x.outward : x.return).departureTime)
290
- )
291
- );
292
- }
293
-
294
- filteredGroups = filteredGroups.filter(
295
- (x) =>
296
- directionFilter.travelDuration.selectedMin <=
297
- (isOutward ? x.outward : x.return).travelDurationMinutes &&
298
- (isOutward ? x.outward : x.return).travelDurationMinutes <=
299
- directionFilter.travelDuration.selectedMax
300
- );
301
- return filteredGroups.filter(
302
- (x) =>
303
- directionFilter.changeDuration.selectedMin <=
304
- (isOutward ? x.outward : x.return).changeDurationMinutes &&
305
- (isOutward ? x.outward : x.return).changeDurationMinutes <=
306
- directionFilter.changeDuration.selectedMax
307
- );
308
- };
309
-
310
- export const formatMinutes = (minutes: number) => {
311
- var hh = Math.floor(minutes / 60);
312
- var mm = Math.floor(minutes % 60);
313
- return pad(hh, 2) + ":" + pad(mm, 2);
314
- };
315
-
316
- const getFlightDetails = (flight: BookingPackageFlight) => {
317
- const firstLine = flight.flightMetaData.flightLines[0];
318
- const lastLine =
319
- flight.flightMetaData.flightLines[
320
- flight.flightMetaData.flightLines.length - 1
321
- ];
322
-
323
- const airlineCode = flight.code.split("/")[1];
324
- const waitDurations = getWaitDurations(flight.flightMetaData.flightLines);
325
-
326
- return {
327
- airline: flight.airlineDescription,
328
- airlineCode: airlineCode,
329
- departureDate: firstLine.departureDate,
330
- departureTime: firstLine.departureTime,
331
- departureAirportCode: firstLine.departureAirport,
332
- departureAirport: firstLine.departureAirportDescription,
333
- arrivalDate: lastLine.arrivalDate,
334
- arrivalTime: lastLine.arrivalTime,
335
- arrivalAirport: lastLine.arrivalAirportDescription,
336
- travelDuration: formatDuration(flight.flightMetaData.durationInTicks),
337
- travelDurationMinutes: minutesFromTicks(
338
- flight.flightMetaData.durationInTicks
339
- ),
340
- changeDurationMinutes: getTotalChangeDuration(flight),
341
- numberOfStops: flight.flightMetaData.flightLines.length - 1,
342
- isNextDay: isNextDay(firstLine.departureDate, lastLine.arrivalDate),
343
- travelClass: firstLine.travelClass,
344
- flightLines: flight.flightMetaData.flightLines.map((x, i) => ({
345
- airline: x.operatingAirlineDescription,
346
- departureDate: x.departureDate,
347
- departureTime: x.departureTime,
348
- departureAirport: x.departureAirportDescription,
349
- arrivalDate: x.arrivalDate,
350
- arrivalTime: x.arrivalTime,
351
- arrivalAirport: x.arrivalAirportDescription,
352
- number: `${x.airlineCode} ${x.number}`,
353
- travelDuration: formatDuration(x.durationInTicks),
354
- waitDuration:
355
- waitDurations.length - 1 <= i ? waitDurations[i] : undefined,
356
- })),
357
- } as GroupedFlightDetails;
358
- };
359
-
360
- const isNextDay = (startDateString: string, endDateString: string) => {
361
- const startDate = parseISO(startDateString);
362
- const endDate = parseISO(endDateString);
363
-
364
- return !isEqual(startDate, endDate);
365
- };
366
-
367
- const getWaitDurations = (lines: BookingPackageFlightMetaDataLine[]) => {
368
- if (lines.length <= 1) return [];
369
- let arrivalDate = lines[0].arrivalDate;
370
- let arrivalTime = lines[0].arrivalTime;
371
-
372
- const waitDurations: string[] = [];
373
- for (var i = 1; i < lines.length; i++) {
374
- const line = lines[i];
375
-
376
- const waitDuration = getWaitDuration(
377
- arrivalDate,
378
- arrivalTime,
379
- line.departureDate,
380
- line.departureTime
381
- );
382
- waitDurations.push(waitDuration);
383
-
384
- arrivalDate = line.arrivalDate;
385
- arrivalTime = line.arrivalTime;
386
- }
387
-
388
- return waitDurations;
389
- };
390
-
391
- const getWaitDuration = (
392
- arrivalDateString: string,
393
- arrivalTime: string,
394
- departureDateString: string,
395
- departureTime: string
396
- ) => {
397
- const minutes = getWaitDurationInMinutes(
398
- arrivalDateString,
399
- arrivalTime,
400
- departureDateString,
401
- departureTime
402
- );
403
-
404
- var hh = Math.floor(minutes / 60);
405
- var mm = Math.floor(minutes % 60);
406
- return pad(hh, 2) + ":" + pad(mm, 2);
407
- };
408
-
409
- const getWaitDurationInMinutes = (
410
- arrivalDateString: string,
411
- arrivalTime: string,
412
- departureDateString: string,
413
- departureTime: string
414
- ) => {
415
- const arrivalDate = parseISO(arrivalDateString);
416
- const arrivalTimeParts = arrivalTime.split(":");
417
-
418
- arrivalDate.setHours(parseInt(arrivalTimeParts[0]));
419
- arrivalDate.setMinutes(parseInt(arrivalTimeParts[1]));
420
-
421
- const departureDate = parseISO(departureDateString);
422
- const departureTimeParts = departureTime.split(":");
423
-
424
- departureDate.setHours(parseInt(departureTimeParts[0]));
425
- departureDate.setMinutes(parseInt(departureTimeParts[1]));
426
-
427
- return differenceInMinutes(departureDate, arrivalDate);
428
- };
429
-
430
- /*const groupFlights = (flights: BookingPackageFlight[]) => {
431
- let flightsPool = [...flights];
432
- let groups = [] as FlightGroup[];
433
- for (var i = 0; i < flightsPool.length; i++) {
434
- const flight = flightsPool[i];
435
-
436
- const relatedFlights = flightsPool.filter(x => x != flight
437
- && x.code === flight.code
438
- && isDateEqual(x.startDateTime, flight.startDateTime)
439
- && isDateEqual(x.endDateTime, flight.endDateTime)
440
- );
441
-
442
- flightsPool = flightsPool.filter(x => x != flight
443
- && relatedFlights.some(y => y != x));
444
-
445
- groups.push({
446
- code: flight.code,
447
- startDate: parseISO(flight.startDateTime),
448
- endDate: parseISO(flight.endDateTime),
449
- options: [flight, ...relatedFlights]
450
- });
451
- }
452
- }
453
-
454
- const isDateEqual = (first: string, second: string) => {
455
- const firstDate = parseISO(first);
456
- const secondDate = parseISO(second);
457
-
458
- return isEqual(firstDate, secondDate);
459
- }*/
460
-
461
- const minutesFromTicks = (ticks: number) => {
462
- const totalSeconds = ticks / 10_000_000;
463
- return Math.floor(totalSeconds / 60);
464
- };
465
-
466
- const formatDuration = (ticks: number) => {
467
- if (!ticks) return "";
468
-
469
- const totalSeconds = ticks / 10_000_000;
470
- var hh = Math.floor(totalSeconds / 3600);
471
- var mm = Math.floor((totalSeconds % 3600) / 60);
472
- return pad(hh, 2) + ":" + pad(mm, 2);
473
- };
474
-
475
- const pad = (input: number, width: number) => {
476
- const n = input + "";
477
- return n.length >= width ? n : new Array(width - n.length + 1).join("0") + n;
478
- };
479
-
480
- const determineTimeBracket = (input: string) => {
481
- const time = parseInt(input.replace(":", ""));
482
- if (time <= 500) return "0000-0500";
483
- if (time > 500 && time <= 1200) return "0500-1200";
484
- if (time > 1200 && time <= 1800) return "1201-1800";
485
- return "1800-2400";
486
- };
487
-
488
- const getBracketTranslation = (input: string, translations: any) => {
489
- if (input === "0000-0500") return translations.FLIGHTS_FORM.NIGHT_DEPARTURE;
490
- if (input === "0500-1200") return translations.FLIGHTS_FORM.MORNING_DEPARTURE;
491
- if (input === "1200-1800")
492
- return translations.FLIGHTS_FORM.AFTERNOON_DEPARTURE;
493
- return translations.FLIGHTS_FORM.EVENING_DEPARTURE;
494
- };
495
-
496
- const getTotalChangeDuration = (flight: BookingPackageFlight) => {
497
- const lines = flight.flightMetaData.flightLines;
498
-
499
- if (lines.length <= 1) return 0;
500
- let arrivalDate = lines[0].arrivalDate;
501
- let arrivalTime = lines[0].arrivalTime;
502
-
503
- let waitDuration = 0;
504
- for (var i = 1; i < lines.length; i++) {
505
- const line = lines[i];
506
-
507
- waitDuration += getWaitDurationInMinutes(
508
- arrivalDate,
509
- arrivalTime,
510
- line.departureDate,
511
- line.departureTime
512
- );
513
- }
514
-
515
- return waitDuration;
516
- };
1
+ import {
2
+ BookingPackageFlight,
3
+ BookingPackageFlightMetaDataLine,
4
+ } from "@qite/tide-client/build/types";
5
+ import { differenceInMinutes, isEqual, parseISO } from "date-fns";
6
+ import {
7
+ FlightDirectionFilter,
8
+ FlightFilterOption,
9
+ FlightFilterOptions,
10
+ GroupedFlightDetails,
11
+ GroupedFlights,
12
+ } from "../../types";
13
+
14
+ /*interface FlightGroup {
15
+ code: string;
16
+ startDate: Date,
17
+ endDate: Date;
18
+ options: BookingPackageFlight[];
19
+ }*/
20
+
21
+ export const buildGroupedFlights = (
22
+ outwardFlights: BookingPackageFlight[] | undefined,
23
+ returnFlights: BookingPackageFlight[] | undefined
24
+ ) => {
25
+ if (!outwardFlights || !returnFlights) return [] as GroupedFlights[];
26
+
27
+ // let outwardGroups = groupFlights(outwardFlights);
28
+ // let returnGroups = groupFlights(returnFlights);
29
+
30
+ const pairs: {
31
+ outward: BookingPackageFlight;
32
+ return: BookingPackageFlight;
33
+ }[] = [];
34
+ outwardFlights.forEach((outwardFlight) => {
35
+ if (outwardFlight.externalGuid) {
36
+ const returnFlight = returnFlights.find(
37
+ (x) => x.externalGuid === outwardFlight.externalGuid
38
+ )!;
39
+ pairs.push({ outward: outwardFlight, return: returnFlight });
40
+ } else {
41
+ const outwardCode = outwardFlight.code.substring(0, 7);
42
+ const returnCode = outwardCode.split(" ").reduce((a, b) => `${b} ${a}`);
43
+
44
+ returnFlights
45
+ .filter((x) => x.code.startsWith(returnCode))
46
+ .forEach((returnFlight) => {
47
+ pairs.push({ outward: outwardFlight, return: returnFlight });
48
+ });
49
+ }
50
+ });
51
+
52
+ const results = pairs.map((x) => {
53
+ const outwardFlightDetails = getFlightDetails(x.outward);
54
+ const returnFlightDetails = getFlightDetails(x.return);
55
+
56
+ return {
57
+ isSelected: x.outward.isSelected && x.return.isSelected,
58
+ price: x.outward.price + x.return.price,
59
+ outward: outwardFlightDetails,
60
+ return: returnFlightDetails,
61
+ selectedOutward: x.outward,
62
+ selectedReturn: x.return,
63
+ } as GroupedFlights;
64
+ });
65
+
66
+ return results;
67
+ };
68
+
69
+ export const buildFilterOptions = (
70
+ outwardFlights: BookingPackageFlight[] | undefined,
71
+ returnFlights: BookingPackageFlight[] | undefined,
72
+ translations: any
73
+ ) => {
74
+ if (!outwardFlights || !returnFlights) return undefined;
75
+
76
+ const airports: FlightFilterOption[] = [];
77
+ const airlines: FlightFilterOption[] = [];
78
+ const numberOfStops: FlightFilterOption[] = [];
79
+ const outwardDeparturePeriods: FlightFilterOption[] = [];
80
+ const returnDeparturePeriods: FlightFilterOption[] = [];
81
+
82
+ let lowestDepartureTravelDuration = 9999;
83
+ let highestDepartureTravelDuration = 0;
84
+ let lowestDepartureChangeDuration = 9999;
85
+ let highestDepartureChangeDuration = 0;
86
+
87
+ outwardFlights.forEach((flight) => {
88
+ const airlineCode = flight.code.split("/")[1];
89
+
90
+ if (flight.flightMetaData.flightLines?.length) {
91
+ const firstLine = flight.flightMetaData.flightLines[0];
92
+
93
+ if (!airports.some((x) => x.value === firstLine.departureAirport)) {
94
+ airports.push({
95
+ value: firstLine?.departureAirport,
96
+ label: firstLine.departureAirportDescription,
97
+ count: 0,
98
+ isSelected: false,
99
+ });
100
+ }
101
+ }
102
+
103
+ if (!airlines.some((x) => x.value === airlineCode)) {
104
+ airlines.push({
105
+ value: airlineCode,
106
+ label: flight.airlineDescription,
107
+ count: 0,
108
+ isSelected: false,
109
+ });
110
+ }
111
+
112
+ const stopCount = flight.flightMetaData.flightLines.length - 1;
113
+ if (!numberOfStops.some((x) => x.value === stopCount + "")) {
114
+ numberOfStops.push({
115
+ value: stopCount + "",
116
+ label:
117
+ stopCount === 0
118
+ ? translations.FLIGHTS_FORM.DIRECT_FLIGHT
119
+ : stopCount == 1
120
+ ? `${stopCount} ${translations.FLIGHTS_FORM.STOP}`
121
+ : `${stopCount} ${translations.FLIGHTS_FORM.STOPS}`,
122
+ count: 0,
123
+ isSelected: false,
124
+ });
125
+ }
126
+
127
+ const departureTime = flight.flightMetaData.flightLines[0].departureTime;
128
+ const timeBracket = determineTimeBracket(departureTime);
129
+ if (!outwardDeparturePeriods.some((x) => x.value === timeBracket)) {
130
+ outwardDeparturePeriods.push({
131
+ value: timeBracket,
132
+ label: getBracketTranslation(timeBracket, translations),
133
+ count: 0,
134
+ isSelected: false,
135
+ });
136
+ }
137
+
138
+ const travelDurationInMinutes = minutesFromTicks(
139
+ flight.flightMetaData.durationInTicks
140
+ );
141
+ if (travelDurationInMinutes > highestDepartureTravelDuration)
142
+ highestDepartureTravelDuration = travelDurationInMinutes;
143
+ if (travelDurationInMinutes < lowestDepartureTravelDuration)
144
+ lowestDepartureTravelDuration = travelDurationInMinutes;
145
+
146
+ const changeDurationInMinutes = getTotalChangeDuration(flight);
147
+ if (changeDurationInMinutes > highestDepartureChangeDuration)
148
+ highestDepartureChangeDuration = changeDurationInMinutes;
149
+ if (changeDurationInMinutes < lowestDepartureChangeDuration)
150
+ lowestDepartureChangeDuration = changeDurationInMinutes;
151
+ });
152
+
153
+ let lowestReturnTravelDuration = 9999;
154
+ let highestReturnTravelDuration = 0;
155
+ let lowestReturnChangeDuration = 9999;
156
+ let highestReturnChangeDuration = 0;
157
+
158
+ returnFlights.forEach((flight) => {
159
+ const durationInMinutes = minutesFromTicks(
160
+ flight.flightMetaData.durationInTicks
161
+ );
162
+ if (durationInMinutes > highestReturnTravelDuration)
163
+ highestReturnTravelDuration = durationInMinutes;
164
+ if (durationInMinutes < lowestReturnTravelDuration)
165
+ lowestReturnTravelDuration = durationInMinutes;
166
+
167
+ const changeDurationInMinutes = getTotalChangeDuration(flight);
168
+ if (changeDurationInMinutes > highestReturnChangeDuration)
169
+ highestReturnChangeDuration = changeDurationInMinutes;
170
+ if (changeDurationInMinutes < lowestReturnChangeDuration)
171
+ lowestReturnChangeDuration = changeDurationInMinutes;
172
+
173
+ const departureTime = flight.flightMetaData.flightLines[0].departureTime;
174
+ const timeBracket = determineTimeBracket(departureTime);
175
+ if (!returnDeparturePeriods.some((x) => x.value === timeBracket)) {
176
+ returnDeparturePeriods.push({
177
+ value: timeBracket,
178
+ label: getBracketTranslation(timeBracket, translations),
179
+ count: 0,
180
+ isSelected: false,
181
+ });
182
+ }
183
+ });
184
+
185
+ return {
186
+ airports: airports,
187
+ airlines: airlines,
188
+ numberOfStops: numberOfStops,
189
+ outward: {
190
+ departurePeriod: outwardDeparturePeriods,
191
+ travelDuration: {
192
+ min: lowestDepartureTravelDuration,
193
+ max: highestDepartureTravelDuration,
194
+ selectedMin: lowestDepartureTravelDuration,
195
+ selectedMax: highestDepartureTravelDuration,
196
+ },
197
+ changeDuration: {
198
+ min: lowestDepartureChangeDuration,
199
+ max: highestDepartureChangeDuration,
200
+ selectedMin: lowestDepartureChangeDuration,
201
+ selectedMax: highestDepartureChangeDuration,
202
+ },
203
+ },
204
+ return: {
205
+ departurePeriod: returnDeparturePeriods,
206
+ travelDuration: {
207
+ min: lowestReturnTravelDuration,
208
+ max: highestReturnTravelDuration,
209
+ selectedMin: lowestReturnTravelDuration,
210
+ selectedMax: highestReturnTravelDuration,
211
+ },
212
+ changeDuration: {
213
+ min: lowestReturnChangeDuration,
214
+ max: highestReturnChangeDuration,
215
+ selectedMin: lowestReturnChangeDuration,
216
+ selectedMax: highestReturnChangeDuration,
217
+ },
218
+ },
219
+ } as FlightFilterOptions;
220
+ };
221
+
222
+ export const filterGroupedFlights = (
223
+ groups: GroupedFlights[],
224
+ filterOptions: FlightFilterOptions | undefined
225
+ ) => {
226
+ if (!groups.length || !filterOptions) return [];
227
+
228
+ let filteredGroups = groups;
229
+ if (filterOptions.airlines.some((x) => x.isSelected)) {
230
+ const selectedAirlineCodes = filterOptions.airlines.filter(
231
+ (x) => x.isSelected
232
+ );
233
+ filteredGroups = filteredGroups.filter((x) =>
234
+ selectedAirlineCodes.some((y) => y.value === x.outward.airlineCode)
235
+ );
236
+ }
237
+
238
+ if (filterOptions.airports.some((x) => x.isSelected)) {
239
+ const selectedAirlineCodes = filterOptions.airports.filter(
240
+ (x) => x.isSelected
241
+ );
242
+ filteredGroups = filteredGroups.filter((x) =>
243
+ selectedAirlineCodes.some(
244
+ (y) => y.value === x.outward.departureAirportCode
245
+ )
246
+ );
247
+ }
248
+
249
+ if (filterOptions.numberOfStops.some((x) => x.isSelected)) {
250
+ const selectedNumberOfStops = filterOptions.numberOfStops.filter(
251
+ (x) => x.isSelected
252
+ );
253
+ filteredGroups = filteredGroups.filter((x) =>
254
+ selectedNumberOfStops.some(
255
+ (y) => parseInt(y.value) === x.outward.flightLines.length - 1
256
+ )
257
+ );
258
+ }
259
+
260
+ filteredGroups = filterGroupedFlightByDirection(
261
+ filteredGroups,
262
+ true,
263
+ filterOptions.outward
264
+ );
265
+ filteredGroups = filterGroupedFlightByDirection(
266
+ filteredGroups,
267
+ false,
268
+ filterOptions.return
269
+ );
270
+
271
+ return filteredGroups;
272
+ };
273
+
274
+ const filterGroupedFlightByDirection = (
275
+ groups: GroupedFlights[],
276
+ isOutward: boolean,
277
+ directionFilter: FlightDirectionFilter
278
+ ) => {
279
+ let filteredGroups = groups;
280
+
281
+ if (directionFilter.departurePeriod.some((x) => x.isSelected)) {
282
+ const selectedDeparturePeriods = directionFilter.departurePeriod.filter(
283
+ (x) => x.isSelected
284
+ );
285
+ filteredGroups = filteredGroups.filter((x) =>
286
+ selectedDeparturePeriods.some(
287
+ (y) =>
288
+ y.value ===
289
+ determineTimeBracket((isOutward ? x.outward : x.return).departureTime)
290
+ )
291
+ );
292
+ }
293
+
294
+ filteredGroups = filteredGroups.filter(
295
+ (x) =>
296
+ directionFilter.travelDuration.selectedMin <=
297
+ (isOutward ? x.outward : x.return).travelDurationMinutes &&
298
+ (isOutward ? x.outward : x.return).travelDurationMinutes <=
299
+ directionFilter.travelDuration.selectedMax
300
+ );
301
+ return filteredGroups.filter(
302
+ (x) =>
303
+ directionFilter.changeDuration.selectedMin <=
304
+ (isOutward ? x.outward : x.return).changeDurationMinutes &&
305
+ (isOutward ? x.outward : x.return).changeDurationMinutes <=
306
+ directionFilter.changeDuration.selectedMax
307
+ );
308
+ };
309
+
310
+ export const formatMinutes = (minutes: number) => {
311
+ var hh = Math.floor(minutes / 60);
312
+ var mm = Math.floor(minutes % 60);
313
+ return pad(hh, 2) + ":" + pad(mm, 2);
314
+ };
315
+
316
+ const getFlightDetails = (flight: BookingPackageFlight) => {
317
+ const firstLine = flight.flightMetaData.flightLines[0];
318
+ const lastLine =
319
+ flight.flightMetaData.flightLines[
320
+ flight.flightMetaData.flightLines.length - 1
321
+ ];
322
+
323
+ const airlineCode = flight.code.split("/")[1];
324
+ const waitDurations = getWaitDurations(flight.flightMetaData.flightLines);
325
+
326
+ return {
327
+ airline: flight.airlineDescription,
328
+ airlineCode: airlineCode,
329
+ departureDate: firstLine.departureDate,
330
+ departureTime: firstLine.departureTime,
331
+ departureAirportCode: firstLine.departureAirport,
332
+ departureAirport: firstLine.departureAirportDescription,
333
+ arrivalDate: lastLine.arrivalDate,
334
+ arrivalTime: lastLine.arrivalTime,
335
+ arrivalAirport: lastLine.arrivalAirportDescription,
336
+ travelDuration: formatDuration(flight.flightMetaData.durationInTicks),
337
+ travelDurationMinutes: minutesFromTicks(
338
+ flight.flightMetaData.durationInTicks
339
+ ),
340
+ changeDurationMinutes: getTotalChangeDuration(flight),
341
+ numberOfStops: flight.flightMetaData.flightLines.length - 1,
342
+ isNextDay: isNextDay(firstLine.departureDate, lastLine.arrivalDate),
343
+ travelClass: firstLine.travelClass,
344
+ flightLines: flight.flightMetaData.flightLines.map((x, i) => ({
345
+ airline: x.operatingAirlineDescription,
346
+ departureDate: x.departureDate,
347
+ departureTime: x.departureTime,
348
+ departureAirport: x.departureAirportDescription,
349
+ arrivalDate: x.arrivalDate,
350
+ arrivalTime: x.arrivalTime,
351
+ arrivalAirport: x.arrivalAirportDescription,
352
+ number: `${x.airlineCode} ${x.number}`,
353
+ travelDuration: formatDuration(x.durationInTicks),
354
+ waitDuration:
355
+ waitDurations.length - 1 <= i ? waitDurations[i] : undefined,
356
+ })),
357
+ } as GroupedFlightDetails;
358
+ };
359
+
360
+ const isNextDay = (startDateString: string, endDateString: string) => {
361
+ const startDate = parseISO(startDateString);
362
+ const endDate = parseISO(endDateString);
363
+
364
+ return !isEqual(startDate, endDate);
365
+ };
366
+
367
+ const getWaitDurations = (lines: BookingPackageFlightMetaDataLine[]) => {
368
+ if (lines.length <= 1) return [];
369
+ let arrivalDate = lines[0].arrivalDate;
370
+ let arrivalTime = lines[0].arrivalTime;
371
+
372
+ const waitDurations: string[] = [];
373
+ for (var i = 1; i < lines.length; i++) {
374
+ const line = lines[i];
375
+
376
+ const waitDuration = getWaitDuration(
377
+ arrivalDate,
378
+ arrivalTime,
379
+ line.departureDate,
380
+ line.departureTime
381
+ );
382
+ waitDurations.push(waitDuration);
383
+
384
+ arrivalDate = line.arrivalDate;
385
+ arrivalTime = line.arrivalTime;
386
+ }
387
+
388
+ return waitDurations;
389
+ };
390
+
391
+ const getWaitDuration = (
392
+ arrivalDateString: string,
393
+ arrivalTime: string,
394
+ departureDateString: string,
395
+ departureTime: string
396
+ ) => {
397
+ const minutes = getWaitDurationInMinutes(
398
+ arrivalDateString,
399
+ arrivalTime,
400
+ departureDateString,
401
+ departureTime
402
+ );
403
+
404
+ var hh = Math.floor(minutes / 60);
405
+ var mm = Math.floor(minutes % 60);
406
+ return pad(hh, 2) + ":" + pad(mm, 2);
407
+ };
408
+
409
+ const getWaitDurationInMinutes = (
410
+ arrivalDateString: string,
411
+ arrivalTime: string,
412
+ departureDateString: string,
413
+ departureTime: string
414
+ ) => {
415
+ const arrivalDate = parseISO(arrivalDateString);
416
+ const arrivalTimeParts = arrivalTime.split(":");
417
+
418
+ arrivalDate.setHours(parseInt(arrivalTimeParts[0]));
419
+ arrivalDate.setMinutes(parseInt(arrivalTimeParts[1]));
420
+
421
+ const departureDate = parseISO(departureDateString);
422
+ const departureTimeParts = departureTime.split(":");
423
+
424
+ departureDate.setHours(parseInt(departureTimeParts[0]));
425
+ departureDate.setMinutes(parseInt(departureTimeParts[1]));
426
+
427
+ return differenceInMinutes(departureDate, arrivalDate);
428
+ };
429
+
430
+ /*const groupFlights = (flights: BookingPackageFlight[]) => {
431
+ let flightsPool = [...flights];
432
+ let groups = [] as FlightGroup[];
433
+ for (var i = 0; i < flightsPool.length; i++) {
434
+ const flight = flightsPool[i];
435
+
436
+ const relatedFlights = flightsPool.filter(x => x != flight
437
+ && x.code === flight.code
438
+ && isDateEqual(x.startDateTime, flight.startDateTime)
439
+ && isDateEqual(x.endDateTime, flight.endDateTime)
440
+ );
441
+
442
+ flightsPool = flightsPool.filter(x => x != flight
443
+ && relatedFlights.some(y => y != x));
444
+
445
+ groups.push({
446
+ code: flight.code,
447
+ startDate: parseISO(flight.startDateTime),
448
+ endDate: parseISO(flight.endDateTime),
449
+ options: [flight, ...relatedFlights]
450
+ });
451
+ }
452
+ }
453
+
454
+ const isDateEqual = (first: string, second: string) => {
455
+ const firstDate = parseISO(first);
456
+ const secondDate = parseISO(second);
457
+
458
+ return isEqual(firstDate, secondDate);
459
+ }*/
460
+
461
+ const minutesFromTicks = (ticks: number) => {
462
+ const totalSeconds = ticks / 10_000_000;
463
+ return Math.floor(totalSeconds / 60);
464
+ };
465
+
466
+ const formatDuration = (ticks: number) => {
467
+ if (!ticks) return "";
468
+
469
+ const totalSeconds = ticks / 10_000_000;
470
+ var hh = Math.floor(totalSeconds / 3600);
471
+ var mm = Math.floor((totalSeconds % 3600) / 60);
472
+ return pad(hh, 2) + ":" + pad(mm, 2);
473
+ };
474
+
475
+ const pad = (input: number, width: number) => {
476
+ const n = input + "";
477
+ return n.length >= width ? n : new Array(width - n.length + 1).join("0") + n;
478
+ };
479
+
480
+ const determineTimeBracket = (input: string) => {
481
+ const time = parseInt(input.replace(":", ""));
482
+ if (time <= 500) return "0000-0500";
483
+ if (time > 500 && time <= 1200) return "0500-1200";
484
+ if (time > 1200 && time <= 1800) return "1201-1800";
485
+ return "1800-2400";
486
+ };
487
+
488
+ const getBracketTranslation = (input: string, translations: any) => {
489
+ if (input === "0000-0500") return translations.FLIGHTS_FORM.NIGHT_DEPARTURE;
490
+ if (input === "0500-1200") return translations.FLIGHTS_FORM.MORNING_DEPARTURE;
491
+ if (input === "1200-1800")
492
+ return translations.FLIGHTS_FORM.AFTERNOON_DEPARTURE;
493
+ return translations.FLIGHTS_FORM.EVENING_DEPARTURE;
494
+ };
495
+
496
+ const getTotalChangeDuration = (flight: BookingPackageFlight) => {
497
+ const lines = flight.flightMetaData.flightLines;
498
+
499
+ if (lines.length <= 1) return 0;
500
+ let arrivalDate = lines[0].arrivalDate;
501
+ let arrivalTime = lines[0].arrivalTime;
502
+
503
+ let waitDuration = 0;
504
+ for (var i = 1; i < lines.length; i++) {
505
+ const line = lines[i];
506
+
507
+ waitDuration += getWaitDurationInMinutes(
508
+ arrivalDate,
509
+ arrivalTime,
510
+ line.departureDate,
511
+ line.departureTime
512
+ );
513
+ }
514
+
515
+ return waitDuration;
516
+ };