@duffel/components 3.1.3--prototype.3 → 3.1.3--prototype.6

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 (352) hide show
  1. package/{react-dist/custom-elements.js → custom-elements.js} +2 -2
  2. package/{react-dist/custom-elements.js.map → custom-elements.js.map} +1 -1
  3. package/{react-dist/index.js → index.js} +2 -2
  4. package/{react-dist/index.js.map → index.js.map} +1 -1
  5. package/package.json +3 -7
  6. package/scripts/generate-fixture.d.ts +3 -0
  7. package/scripts/setup-suggestion-data.d.ts +28 -0
  8. package/tsconfig.tsbuildinfo +1 -0
  9. package/.circleci/config.yml +0 -67
  10. package/.eslintrc.js +0 -47
  11. package/.github/CODEOWNERS +0 -4
  12. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
  13. package/.github/renovate.json +0 -12
  14. package/.nvmrc +0 -1
  15. package/.prettierignore +0 -6
  16. package/.storybook/main.ts +0 -33
  17. package/.storybook/preview.tsx +0 -28
  18. package/.tool-versions +0 -1
  19. package/.vscode/extensions.json +0 -7
  20. package/.vscode/settings.json +0 -10
  21. package/.yarn/releases/yarn-4.0.1.cjs +0 -893
  22. package/.yarn/sdks/eslint/bin/eslint.js +0 -20
  23. package/.yarn/sdks/eslint/lib/api.js +0 -20
  24. package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -20
  25. package/.yarn/sdks/eslint/package.json +0 -14
  26. package/.yarn/sdks/integrations.yml +0 -5
  27. package/.yarn/sdks/prettier/bin-prettier.js +0 -20
  28. package/.yarn/sdks/prettier/index.js +0 -20
  29. package/.yarn/sdks/prettier/package.json +0 -7
  30. package/.yarn/sdks/typescript/bin/tsc +0 -20
  31. package/.yarn/sdks/typescript/bin/tsserver +0 -20
  32. package/.yarn/sdks/typescript/lib/tsc.js +0 -20
  33. package/.yarn/sdks/typescript/lib/tsserver.js +0 -225
  34. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -225
  35. package/.yarn/sdks/typescript/lib/typescript.js +0 -20
  36. package/.yarn/sdks/typescript/package.json +0 -10
  37. package/.yarnrc.yml +0 -3
  38. package/CONTRIBUTING.md +0 -83
  39. package/README.md +0 -68
  40. package/__mocks__/styleMock.js +0 -6
  41. package/babel.config.js +0 -20
  42. package/commitlint.config.js +0 -4
  43. package/config/esbuild.base.config.js +0 -18
  44. package/config/esbuild.cdn.config.js +0 -51
  45. package/config/esbuild.dev.config.js +0 -46
  46. package/config/esbuild.react.config.js +0 -42
  47. package/data/airports.csv +0 -9084
  48. package/data/cities.csv +0 -256
  49. package/jest.config.ts +0 -14
  50. package/scripts/build-and-publish.sh +0 -42
  51. package/scripts/generate-fixture.ts +0 -200
  52. package/scripts/setup-suggestion-data.ts +0 -100
  53. package/scripts/upload-to-cdn.sh +0 -34
  54. package/scripts.tsconfig.json +0 -11
  55. package/src/components/DuffelAncillaries/Card.tsx +0 -126
  56. package/src/components/DuffelAncillaries/Counter.tsx +0 -40
  57. package/src/components/DuffelAncillaries/DuffelAncillaries.tsx +0 -350
  58. package/src/components/DuffelAncillaries/DuffelAncillariesCustomElement.tsx +0 -124
  59. package/src/components/DuffelAncillaries/bags/BaggageSelectionCard.tsx +0 -101
  60. package/src/components/DuffelAncillaries/bags/BaggageSelectionController.tsx +0 -88
  61. package/src/components/DuffelAncillaries/bags/BaggageSelectionModal.tsx +0 -81
  62. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBody.tsx +0 -60
  63. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.tsx +0 -122
  64. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.tsx +0 -88
  65. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.tsx +0 -82
  66. package/src/components/DuffelAncillaries/bags/IncludedBaggageBanner.tsx +0 -51
  67. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.tsx +0 -90
  68. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.tsx +0 -63
  69. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.tsx +0 -56
  70. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +0 -11
  71. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.tsx +0 -74
  72. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.tsx +0 -9
  73. package/src/components/DuffelAncillaries/seats/Amenity.tsx +0 -21
  74. package/src/components/DuffelAncillaries/seats/DeckSelect.tsx +0 -27
  75. package/src/components/DuffelAncillaries/seats/Element.tsx +0 -52
  76. package/src/components/DuffelAncillaries/seats/EmptyElement.tsx +0 -5
  77. package/src/components/DuffelAncillaries/seats/ExitElement.tsx +0 -17
  78. package/src/components/DuffelAncillaries/seats/Legend.tsx +0 -60
  79. package/src/components/DuffelAncillaries/seats/Row.tsx +0 -47
  80. package/src/components/DuffelAncillaries/seats/RowSection.tsx +0 -78
  81. package/src/components/DuffelAncillaries/seats/SeatElement.tsx +0 -120
  82. package/src/components/DuffelAncillaries/seats/SeatInfo.tsx +0 -32
  83. package/src/components/DuffelAncillaries/seats/SeatMap.tsx +0 -85
  84. package/src/components/DuffelAncillaries/seats/SeatMapUnavailable.tsx +0 -21
  85. package/src/components/DuffelAncillaries/seats/SeatSelectionCard.tsx +0 -103
  86. package/src/components/DuffelAncillaries/seats/SeatSelectionModal.tsx +0 -142
  87. package/src/components/DuffelAncillaries/seats/SeatSelectionModalBody.tsx +0 -13
  88. package/src/components/DuffelAncillaries/seats/SeatSelectionModalFooter.tsx +0 -89
  89. package/src/components/DuffelAncillaries/seats/SeatSelectionModalHeader.tsx +0 -97
  90. package/src/components/DuffelAncillaries/seats/SeatUnavailable.tsx +0 -14
  91. package/src/components/DuffelPayments/DuffelPayments.tsx +0 -224
  92. package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +0 -130
  93. package/src/components/PlacesLookup/PlacesLookup.tsx +0 -122
  94. package/src/components/shared/AnimatedLoaderEllipsis.tsx +0 -5
  95. package/src/components/shared/Button.tsx +0 -63
  96. package/src/components/shared/ErrorBoundary.tsx +0 -54
  97. package/src/components/shared/FetchOfferErrorState.tsx +0 -35
  98. package/src/components/shared/Icon.tsx +0 -151
  99. package/src/components/shared/IconButton.tsx +0 -42
  100. package/src/components/shared/Modal.tsx +0 -40
  101. package/src/components/shared/NonIdealState.tsx +0 -28
  102. package/src/components/shared/Stamp.tsx +0 -29
  103. package/src/components/shared/Tabs.tsx +0 -36
  104. package/src/custom-elements.ts +0 -13
  105. package/src/examples/client-side/README.md +0 -30
  106. package/src/examples/client-side/index.html +0 -57
  107. package/src/examples/full-stack/README.md +0 -34
  108. package/src/examples/full-stack/index.html +0 -48
  109. package/src/examples/full-stack/server.mjs +0 -158
  110. package/src/examples/just-typescript/.yarn/install-state.gz +0 -0
  111. package/src/examples/just-typescript/README.md +0 -37
  112. package/src/examples/just-typescript/package.json +0 -16
  113. package/src/examples/just-typescript/src/index.html +0 -23
  114. package/src/examples/just-typescript/src/index.ts +0 -36
  115. package/src/examples/just-typescript/yarn.lock +0 -467
  116. package/src/examples/next/README.md +0 -28
  117. package/src/examples/next/next-env.d.ts +0 -5
  118. package/src/examples/next/next.config.js +0 -4
  119. package/src/examples/next/package.json +0 -24
  120. package/src/examples/next/src/app/DuffelComponents.tsx +0 -40
  121. package/src/examples/next/src/app/layout.tsx +0 -18
  122. package/src/examples/next/src/app/page.tsx +0 -9
  123. package/src/examples/next/tsconfig.json +0 -27
  124. package/src/examples/next/yarn.lock +0 -257
  125. package/src/examples/payments-custom-element/README.md +0 -17
  126. package/src/examples/payments-custom-element/index.html +0 -43
  127. package/src/examples/payments-just-typescript/README.md +0 -37
  128. package/src/examples/payments-just-typescript/package.json +0 -16
  129. package/src/examples/payments-just-typescript/src/index.html +0 -23
  130. package/src/examples/payments-just-typescript/src/index.ts +0 -18
  131. package/src/examples/payments-just-typescript/yarn.lock +0 -154
  132. package/src/examples/react-app/README.md +0 -37
  133. package/src/examples/react-app/package.json +0 -20
  134. package/src/examples/react-app/src/index.html +0 -19
  135. package/src/examples/react-app/src/index.tsx +0 -48
  136. package/src/examples/react-app/yarn.lock +0 -219
  137. package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +0 -497
  138. package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -307
  139. package/src/fixtures/offers/off_1.json +0 -488
  140. package/src/fixtures/passengers/mock_passengers.ts +0 -26
  141. package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +0 -6852
  142. package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -1
  143. package/src/fixtures/seat-maps/off_1.json +0 -6852
  144. package/src/index.ts +0 -7
  145. package/src/lib/captureErrorInSentry.ts +0 -42
  146. package/src/lib/compileCreateOrderPayload.ts +0 -63
  147. package/src/lib/createPriceFormatters.ts +0 -73
  148. package/src/lib/fetchFromDuffelAPI.ts +0 -54
  149. package/src/lib/fetchFromFixtures.ts +0 -18
  150. package/src/lib/formatAvailableServices.ts +0 -91
  151. package/src/lib/formatDate.ts +0 -20
  152. package/src/lib/formatSeatMaps.ts +0 -81
  153. package/src/lib/getBaggageServiceDescription.ts +0 -39
  154. package/src/lib/getCabinsForSegmentAndDeck.ts +0 -4
  155. package/src/lib/getCurrencyForSeatMaps.ts +0 -22
  156. package/src/lib/getCurrencyForServices.ts +0 -24
  157. package/src/lib/getFirstSeatElementMatchingCriteria.ts +0 -22
  158. package/src/lib/getPassengerBySegmentList.ts +0 -10
  159. package/src/lib/getPassengerInitials.ts +0 -6
  160. package/src/lib/getPassengerMapById.ts +0 -17
  161. package/src/lib/getPassengerName.ts +0 -41
  162. package/src/lib/getRowNumber.ts +0 -16
  163. package/src/lib/getSegmentList.ts +0 -7
  164. package/src/lib/getServicePriceMapById.ts +0 -20
  165. package/src/lib/getSymbols.ts +0 -22
  166. package/src/lib/getTotalAmountForServices.ts +0 -72
  167. package/src/lib/getTotalQuantity.ts +0 -5
  168. package/src/lib/hasHighLuminance.ts +0 -9
  169. package/src/lib/hasService.ts +0 -24
  170. package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +0 -35
  171. package/src/lib/hasWings.ts +0 -8
  172. package/src/lib/isBaggageService.ts +0 -8
  173. package/src/lib/isCancelForAnyReasonService.ts +0 -9
  174. package/src/lib/isFixtureOfferId.ts +0 -4
  175. package/src/lib/isPayloadComplete.ts +0 -11
  176. package/src/lib/isSeatElement.ts +0 -10
  177. package/src/lib/logging.ts +0 -120
  178. package/src/lib/moneyStringFormatter.ts +0 -34
  179. package/src/lib/offerIsExpired.ts +0 -5
  180. package/src/lib/retrieveOffer.ts +0 -56
  181. package/src/lib/retrieveOfferFromDuffelAPI.ts +0 -13
  182. package/src/lib/retrieveSeatMaps.ts +0 -55
  183. package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +0 -13
  184. package/src/lib/setBodyScrollability.ts +0 -7
  185. package/src/lib/validateProps.ts +0 -37
  186. package/src/lib/withPlural.ts +0 -8
  187. package/src/stories/BaggageSelectionModalHeader.stories.tsx +0 -21
  188. package/src/stories/Button.stories.tsx +0 -91
  189. package/src/stories/DuffelAncillaries.stories.tsx +0 -166
  190. package/src/stories/DuffelPayments.stories.tsx +0 -34
  191. package/src/stories/Icon.stories.tsx +0 -35
  192. package/src/stories/IconButton.stories.tsx +0 -25
  193. package/src/stories/PlacesLookup.stories.tsx +0 -22
  194. package/src/styles/colors.css +0 -22
  195. package/src/styles/components/Amenity.css +0 -23
  196. package/src/styles/components/BaggageDisplay.css +0 -25
  197. package/src/styles/components/Button.css +0 -169
  198. package/src/styles/components/Card.css +0 -52
  199. package/src/styles/components/CfarSelectionModal.css +0 -34
  200. package/src/styles/components/Counter.css +0 -18
  201. package/src/styles/components/DuffelPayments.css +0 -42
  202. package/src/styles/components/IconButton.css +0 -63
  203. package/src/styles/components/Legend.css +0 -62
  204. package/src/styles/components/Loader.css +0 -37
  205. package/src/styles/components/LoadingState.css +0 -87
  206. package/src/styles/components/Modal.css +0 -84
  207. package/src/styles/components/PassengerSelect.css +0 -99
  208. package/src/styles/components/PassengersLayout.css +0 -90
  209. package/src/styles/components/PlacesLookup.css +0 -36
  210. package/src/styles/components/Row.css +0 -70
  211. package/src/styles/components/Seat.css +0 -59
  212. package/src/styles/components/SeatInfo.css +0 -61
  213. package/src/styles/components/SeatMap.css +0 -24
  214. package/src/styles/components/SeatSelect.css +0 -92
  215. package/src/styles/components/Segment.css +0 -17
  216. package/src/styles/components/SelectionSegment.css +0 -10
  217. package/src/styles/components/Summary.css +0 -70
  218. package/src/styles/components/Tabs.css +0 -52
  219. package/src/styles/flex.css +0 -5
  220. package/src/styles/font-families.css +0 -47
  221. package/src/styles/global.css +0 -52
  222. package/src/styles/margin.css +0 -3
  223. package/src/styles/spacing.css +0 -18
  224. package/src/styles/transitions.css +0 -3
  225. package/src/styles/typography.css +0 -13
  226. package/src/tests/components/DuffelAncillaries.test.tsx +0 -342
  227. package/src/tests/lib/createPriceFormatters.test.tsx +0 -152
  228. package/src/tests/lib/formatAvailableServices.test.tsx +0 -79
  229. package/src/tests/lib/formatSeatMaps.test.tsx +0 -49
  230. package/src/tests/lib/getCurrencyForServices.test.tsx +0 -44
  231. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +0 -86
  232. package/src/tests/lib/logging.test.tsx +0 -32
  233. package/src/tests/lib/moneyStringFormatter.test.tsx +0 -12
  234. package/src/tests/lib/validateProps.test.tsx +0 -57
  235. package/src/types/Aircraft.ts +0 -16
  236. package/src/types/Airline.ts +0 -16
  237. package/src/types/Airport.ts +0 -54
  238. package/src/types/City.ts +0 -21
  239. package/src/types/CreateOrderPayload.ts +0 -99
  240. package/src/types/CurrencyConversion.ts +0 -10
  241. package/src/types/DuffelAncillariesProps.ts +0 -108
  242. package/src/types/Offer.ts +0 -851
  243. package/src/types/Order.ts +0 -6
  244. package/src/types/Place.ts +0 -6
  245. package/src/types/SeatMap.ts +0 -231
  246. package/src/types/index.ts +0 -11
  247. package/tsconfig.json +0 -58
  248. /package/{react-dist/components → components}/DuffelAncillaries/Card.d.ts +0 -0
  249. /package/{react-dist/components → components}/DuffelAncillaries/Counter.d.ts +0 -0
  250. /package/{react-dist/components → components}/DuffelAncillaries/DuffelAncillaries.d.ts +0 -0
  251. /package/{react-dist/components → components}/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +0 -0
  252. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +0 -0
  253. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionController.d.ts +0 -0
  254. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +0 -0
  255. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +0 -0
  256. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +0 -0
  257. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +0 -0
  258. /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +0 -0
  259. /package/{react-dist/components → components}/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +0 -0
  260. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +0 -0
  261. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +0 -0
  262. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +0 -0
  263. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +0 -0
  264. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +0 -0
  265. /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +0 -0
  266. /package/{react-dist/components → components}/DuffelAncillaries/seats/Amenity.d.ts +0 -0
  267. /package/{react-dist/components → components}/DuffelAncillaries/seats/DeckSelect.d.ts +0 -0
  268. /package/{react-dist/components → components}/DuffelAncillaries/seats/Element.d.ts +0 -0
  269. /package/{react-dist/components → components}/DuffelAncillaries/seats/EmptyElement.d.ts +0 -0
  270. /package/{react-dist/components → components}/DuffelAncillaries/seats/ExitElement.d.ts +0 -0
  271. /package/{react-dist/components → components}/DuffelAncillaries/seats/Legend.d.ts +0 -0
  272. /package/{react-dist/components → components}/DuffelAncillaries/seats/Row.d.ts +0 -0
  273. /package/{react-dist/components → components}/DuffelAncillaries/seats/RowSection.d.ts +0 -0
  274. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatElement.d.ts +0 -0
  275. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatInfo.d.ts +0 -0
  276. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatMap.d.ts +0 -0
  277. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +0 -0
  278. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionCard.d.ts +0 -0
  279. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModal.d.ts +0 -0
  280. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +0 -0
  281. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +0 -0
  282. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +0 -0
  283. /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatUnavailable.d.ts +0 -0
  284. /package/{react-dist/components → components}/DuffelPayments/DuffelPayments.d.ts +0 -0
  285. /package/{react-dist/components → components}/DuffelPayments/DuffelPaymentsCustomElement.d.ts +0 -0
  286. /package/{react-dist/components → components}/PlacesLookup/PlacesLookup.d.ts +0 -0
  287. /package/{react-dist/components → components}/shared/AnimatedLoaderEllipsis.d.ts +0 -0
  288. /package/{react-dist/components → components}/shared/Button.d.ts +0 -0
  289. /package/{react-dist/components → components}/shared/ErrorBoundary.d.ts +0 -0
  290. /package/{react-dist/components → components}/shared/FetchOfferErrorState.d.ts +0 -0
  291. /package/{react-dist/components → components}/shared/Icon.d.ts +0 -0
  292. /package/{react-dist/components → components}/shared/IconButton.d.ts +0 -0
  293. /package/{react-dist/components → components}/shared/Modal.d.ts +0 -0
  294. /package/{react-dist/components → components}/shared/NonIdealState.d.ts +0 -0
  295. /package/{react-dist/components → components}/shared/Stamp.d.ts +0 -0
  296. /package/{react-dist/components → components}/shared/Tabs.d.ts +0 -0
  297. /package/{react-dist/custom-elements.d.ts → custom-elements.d.ts} +0 -0
  298. /package/{react-dist/index.d.ts → index.d.ts} +0 -0
  299. /package/{react-dist/lib → lib}/captureErrorInSentry.d.ts +0 -0
  300. /package/{react-dist/lib → lib}/compileCreateOrderPayload.d.ts +0 -0
  301. /package/{react-dist/lib → lib}/createPriceFormatters.d.ts +0 -0
  302. /package/{react-dist/lib → lib}/fetchFromDuffelAPI.d.ts +0 -0
  303. /package/{react-dist/lib → lib}/fetchFromFixtures.d.ts +0 -0
  304. /package/{react-dist/lib → lib}/formatAvailableServices.d.ts +0 -0
  305. /package/{react-dist/lib → lib}/formatDate.d.ts +0 -0
  306. /package/{react-dist/lib → lib}/formatSeatMaps.d.ts +0 -0
  307. /package/{react-dist/lib → lib}/getBaggageServiceDescription.d.ts +0 -0
  308. /package/{react-dist/lib → lib}/getCabinsForSegmentAndDeck.d.ts +0 -0
  309. /package/{react-dist/lib → lib}/getCurrencyForSeatMaps.d.ts +0 -0
  310. /package/{react-dist/lib → lib}/getCurrencyForServices.d.ts +0 -0
  311. /package/{react-dist/lib → lib}/getFirstSeatElementMatchingCriteria.d.ts +0 -0
  312. /package/{react-dist/lib → lib}/getPassengerBySegmentList.d.ts +0 -0
  313. /package/{react-dist/lib → lib}/getPassengerInitials.d.ts +0 -0
  314. /package/{react-dist/lib → lib}/getPassengerMapById.d.ts +0 -0
  315. /package/{react-dist/lib → lib}/getPassengerName.d.ts +0 -0
  316. /package/{react-dist/lib → lib}/getRowNumber.d.ts +0 -0
  317. /package/{react-dist/lib → lib}/getSegmentList.d.ts +0 -0
  318. /package/{react-dist/lib → lib}/getServicePriceMapById.d.ts +0 -0
  319. /package/{react-dist/lib → lib}/getSymbols.d.ts +0 -0
  320. /package/{react-dist/lib → lib}/getTotalAmountForServices.d.ts +0 -0
  321. /package/{react-dist/lib → lib}/getTotalQuantity.d.ts +0 -0
  322. /package/{react-dist/lib → lib}/hasHighLuminance.d.ts +0 -0
  323. /package/{react-dist/lib → lib}/hasService.d.ts +0 -0
  324. /package/{react-dist/lib → lib}/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +0 -0
  325. /package/{react-dist/lib → lib}/hasWings.d.ts +0 -0
  326. /package/{react-dist/lib → lib}/isBaggageService.d.ts +0 -0
  327. /package/{react-dist/lib → lib}/isCancelForAnyReasonService.d.ts +0 -0
  328. /package/{react-dist/lib → lib}/isFixtureOfferId.d.ts +0 -0
  329. /package/{react-dist/lib → lib}/isPayloadComplete.d.ts +0 -0
  330. /package/{react-dist/lib → lib}/isSeatElement.d.ts +0 -0
  331. /package/{react-dist/lib → lib}/logging.d.ts +0 -0
  332. /package/{react-dist/lib → lib}/moneyStringFormatter.d.ts +0 -0
  333. /package/{react-dist/lib → lib}/offerIsExpired.d.ts +0 -0
  334. /package/{react-dist/lib → lib}/retrieveOffer.d.ts +0 -0
  335. /package/{react-dist/lib → lib}/retrieveOfferFromDuffelAPI.d.ts +0 -0
  336. /package/{react-dist/lib → lib}/retrieveSeatMaps.d.ts +0 -0
  337. /package/{react-dist/lib → lib}/retrieveSeatMapsFromDuffelAPI.d.ts +0 -0
  338. /package/{react-dist/lib → lib}/setBodyScrollability.d.ts +0 -0
  339. /package/{react-dist/lib → lib}/validateProps.d.ts +0 -0
  340. /package/{react-dist/lib → lib}/withPlural.d.ts +0 -0
  341. /package/{react-dist/types → types}/Aircraft.d.ts +0 -0
  342. /package/{react-dist/types → types}/Airline.d.ts +0 -0
  343. /package/{react-dist/types → types}/Airport.d.ts +0 -0
  344. /package/{react-dist/types → types}/City.d.ts +0 -0
  345. /package/{react-dist/types → types}/CreateOrderPayload.d.ts +0 -0
  346. /package/{react-dist/types → types}/CurrencyConversion.d.ts +0 -0
  347. /package/{react-dist/types → types}/DuffelAncillariesProps.d.ts +0 -0
  348. /package/{react-dist/types → types}/Offer.d.ts +0 -0
  349. /package/{react-dist/types → types}/Order.d.ts +0 -0
  350. /package/{react-dist/types → types}/Place.d.ts +0 -0
  351. /package/{react-dist/types → types}/SeatMap.d.ts +0 -0
  352. /package/{react-dist/types → types}/index.d.ts +0 -0
@@ -1,101 +0,0 @@
1
- import { AnimatedLoaderEllipsis } from "@components/shared/AnimatedLoaderEllipsis";
2
- import { Stamp } from "@components/shared/Stamp";
3
- import { getCurrencyForServices } from "@lib/getCurrencyForServices";
4
- import { getTotalAmountForServices } from "@lib/getTotalAmountForServices";
5
- import { getTotalQuantity } from "@lib/getTotalQuantity";
6
- import { hasService } from "@lib/hasService";
7
- import { moneyStringFormatter } from "@lib/moneyStringFormatter";
8
- import { withPlural } from "@lib/withPlural";
9
- import React from "react";
10
- import {
11
- CreateOrderPayload,
12
- CreateOrderPayloadServices,
13
- } from "../../../types/CreateOrderPayload";
14
- import { Offer } from "../../../types/Offer";
15
- import { Card } from "../Card";
16
- import { BaggageSelectionModal } from "./BaggageSelectionModal";
17
-
18
- export interface BaggageSelectionCardProps {
19
- isLoading: boolean;
20
- offer?: Offer;
21
- passengers: CreateOrderPayload["passengers"];
22
- selectedServices: CreateOrderPayloadServices;
23
- setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
24
- }
25
-
26
- export const BaggageSelectionCard: React.FC<BaggageSelectionCardProps> = ({
27
- isLoading,
28
- offer,
29
- passengers,
30
- selectedServices,
31
- setSelectedServices,
32
- }) => {
33
- const [isOpen, setIsOpen] = React.useState(false);
34
-
35
- const containsBaggageService = hasService(offer, "baggage");
36
- const totalQuantity = getTotalQuantity(selectedServices);
37
- const isBaggageAdded = totalQuantity > 0;
38
-
39
- const totalAmount = getTotalAmountForServices(offer!, selectedServices);
40
-
41
- let currencyToUse = offer?.base_currency || "";
42
- if (containsBaggageService) {
43
- currencyToUse = getCurrencyForServices(offer!, "baggage");
44
- }
45
-
46
- const totalAmountFormatted = offer
47
- ? moneyStringFormatter(currencyToUse)(totalAmount)
48
- : "0";
49
-
50
- const copy =
51
- containsBaggageService && isBaggageAdded
52
- ? `${withPlural(
53
- totalQuantity,
54
- "bag",
55
- "bags"
56
- )} added for ${totalAmountFormatted}`
57
- : "Add any extra baggage you need for your trip";
58
-
59
- return (
60
- <>
61
- <Card
62
- buttonTitle="Select extra baggage"
63
- title="Extra baggage"
64
- copy={copy}
65
- icon="cabin_bag"
66
- onClick={containsBaggageService ? () => setIsOpen(true) : null}
67
- isLoading={isLoading}
68
- disabled={!isLoading && !containsBaggageService}
69
- isSelected={isBaggageAdded}
70
- >
71
- {isLoading && (
72
- <Stamp color="var(--GREY-900)" backgroundColor="var(--GREY-100)">
73
- Loading
74
- <AnimatedLoaderEllipsis />
75
- </Stamp>
76
- )}
77
- {!isLoading && !containsBaggageService && (
78
- <Stamp color="var(--GREY-700)" backgroundColor="var(--GREY-200)">
79
- Not available
80
- </Stamp>
81
- )}
82
- </Card>
83
-
84
- <BaggageSelectionModal
85
- isOpen={Boolean(isOpen && offer)}
86
- offer={offer}
87
- passengers={passengers}
88
- onClose={(newSelectedServices) => {
89
- // We need to do a deep copy here because otherwise the modal changing the quantity
90
- // will affect the selected services regardless of whether it's saved or not
91
- const newSelectedServicesDeepCopy = JSON.parse(
92
- JSON.stringify(newSelectedServices)
93
- );
94
- setSelectedServices(newSelectedServicesDeepCopy);
95
- setIsOpen(false);
96
- }}
97
- selectedServices={selectedServices}
98
- />
99
- </>
100
- );
101
- };
@@ -1,88 +0,0 @@
1
- import { getBaggageServiceDescription } from "@lib/getBaggageServiceDescription";
2
- import { hasServiceOfSameMetadataTypeAlreadyBeenSelected } from "@lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected";
3
- import { moneyStringFormatter } from "@lib/moneyStringFormatter";
4
- import React from "react";
5
- import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
6
- import { OfferAvailableServiceBaggage } from "../../../types/Offer";
7
- import { Counter } from "../Counter";
8
-
9
- interface BaggageSelectionControllerProps {
10
- segmentId: string;
11
- passengerId: string;
12
- availableService: OfferAvailableServiceBaggage;
13
- selectedServices: CreateOrderPayloadServices;
14
- quantity: number;
15
- onQuantityChanged: (quantity: number) => void;
16
- }
17
-
18
- export const BaggageSelectionController: React.FC<
19
- BaggageSelectionControllerProps
20
- > = ({
21
- segmentId,
22
- passengerId,
23
- availableService,
24
- quantity,
25
- onQuantityChanged,
26
- selectedServices,
27
- }) => {
28
- const serviceName =
29
- availableService.metadata.type === "carry_on" ? "Cabin bag" : "Checked bag";
30
-
31
- const servicePrice = moneyStringFormatter(availableService.total_currency)(
32
- +availableService.total_amount
33
- );
34
- const serviceDescription = getBaggageServiceDescription(
35
- availableService.metadata
36
- );
37
-
38
- const shouldDisableController =
39
- hasServiceOfSameMetadataTypeAlreadyBeenSelected(
40
- selectedServices,
41
- segmentId,
42
- passengerId,
43
- availableService
44
- );
45
-
46
- return (
47
- <div
48
- style={{
49
- display: "flex",
50
- justifyContent: "space-between",
51
- alignItems: "center",
52
- }}
53
- >
54
- <div>
55
- <p style={{ margin: 0 }} className="p2--regular">
56
- {serviceName}
57
- <span
58
- style={{
59
- marginInline: "4px",
60
- color: "var(--GREY-400)",
61
- }}
62
- >
63
-
64
- </span>
65
- <span
66
- className="p2--semibold"
67
- data-testid={`price-label--${availableService.id}--${passengerId}`}
68
- >
69
- {servicePrice}
70
- </span>
71
- </p>
72
- <p
73
- style={{ margin: 0, color: "var(--GREY-600)" }}
74
- className="p3--regular"
75
- >
76
- {serviceDescription}
77
- </p>
78
- </div>
79
- <Counter
80
- id={`counter--${availableService.id}--${passengerId}`}
81
- min={0}
82
- value={quantity}
83
- onChange={onQuantityChanged}
84
- max={shouldDisableController ? 0 : availableService.maximum_quantity}
85
- />
86
- </div>
87
- );
88
- };
@@ -1,81 +0,0 @@
1
- import { Modal } from "@components/shared/Modal";
2
- import { getCurrencyForServices } from "@lib/getCurrencyForServices";
3
- import { getPassengerMapById } from "@lib/getPassengerMapById";
4
- import { getSegmentList } from "@lib/getSegmentList";
5
- import { getServicePriceMapById } from "@lib/getServicePriceMapById";
6
- import { hasService } from "@lib/hasService";
7
- import React, { useState } from "react";
8
- import {
9
- CreateOrderPayload,
10
- CreateOrderPayloadServices,
11
- } from "../../../types/CreateOrderPayload";
12
- import { Offer } from "../../../types/Offer";
13
- import { BaggageSelectionModalBody } from "./BaggageSelectionModalBody";
14
- import { BaggageSelectionModalFooter } from "./BaggageSelectionModalFooter";
15
- import { BaggageSelectionModalHeader } from "./BaggageSelectionModalHeader";
16
-
17
- export interface BaggageSelectionModalProps {
18
- isOpen: boolean;
19
- offer?: Offer;
20
- passengers: CreateOrderPayload["passengers"];
21
- selectedServices: CreateOrderPayloadServices;
22
- onClose: (selectedServices: CreateOrderPayloadServices) => void;
23
- }
24
-
25
- export const BaggageSelectionModal: React.FC<BaggageSelectionModalProps> = ({
26
- isOpen,
27
- offer,
28
- passengers,
29
- onClose,
30
- selectedServices,
31
- }) => {
32
- const [currentSegmentIndex, setCurrentSegmentIndex] = useState(0);
33
-
34
- const [selectedServicesState, setSelectedServicesState] =
35
- React.useState(selectedServices);
36
-
37
- if (!offer) return null;
38
-
39
- const segments = getSegmentList(offer);
40
- const currentSegment = segments[currentSegmentIndex];
41
-
42
- const passengerMapById = getPassengerMapById(passengers);
43
- const servicePricesMap = getServicePriceMapById(offer.available_services);
44
-
45
- let currencyToUse = offer.base_currency;
46
- if (hasService(offer, "baggage")) {
47
- currencyToUse = getCurrencyForServices(offer, "baggage");
48
- }
49
-
50
- return (
51
- <Modal isOpen={isOpen} onClose={() => onClose(selectedServices)}>
52
- <BaggageSelectionModalHeader
53
- segmentCount={segments.length}
54
- currentSegment={currentSegment}
55
- currentSegmentIndex={currentSegmentIndex}
56
- setCurrentSegmentIndex={(index) => setCurrentSegmentIndex(index)}
57
- />
58
- <BaggageSelectionModalBody
59
- offer={offer}
60
- selectedServices={selectedServicesState}
61
- passengersById={passengerMapById}
62
- segment={currentSegment}
63
- setSelectedServices={setSelectedServicesState}
64
- />
65
- <BaggageSelectionModalFooter
66
- currency={currencyToUse}
67
- selectedServices={selectedServicesState}
68
- servicePrices={servicePricesMap}
69
- isFirstSegment={currentSegmentIndex === 0}
70
- isLastSegment={currentSegmentIndex + 1 === segments.length}
71
- onNextSegmentButtonClicked={() =>
72
- setCurrentSegmentIndex(currentSegmentIndex + 1)
73
- }
74
- onPreviousSegmentButtonClicked={() =>
75
- setCurrentSegmentIndex(currentSegmentIndex - 1)
76
- }
77
- onClose={() => onClose(selectedServicesState)}
78
- />
79
- </Modal>
80
- );
81
- };
@@ -1,60 +0,0 @@
1
- import { ModalBody } from "@components/shared/Modal";
2
- import { getPassengerName } from "@lib/getPassengerName";
3
- import React from "react";
4
- import {
5
- CreateOrderPayloadPassenger,
6
- CreateOrderPayloadServices,
7
- } from "../../../types/CreateOrderPayload";
8
- import {
9
- Offer,
10
- OfferAvailableServiceBaggage,
11
- OfferSliceSegment,
12
- } from "../../../types/Offer";
13
- import { BaggageSelectionModalBodyPassenger } from "./BaggageSelectionModalBodyPassenger";
14
-
15
- export interface BaggageSelectionModalBodyProps {
16
- offer: Offer;
17
- segment: OfferSliceSegment;
18
- passengersById: Record<
19
- CreateOrderPayloadPassenger["id"],
20
- CreateOrderPayloadPassenger
21
- >;
22
- selectedServices: CreateOrderPayloadServices;
23
- setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
24
- }
25
-
26
- export const BaggageSelectionModalBody: React.FC<
27
- BaggageSelectionModalBodyProps
28
- > = ({
29
- offer,
30
- segment,
31
- passengersById,
32
- selectedServices,
33
- setSelectedServices,
34
- }) => (
35
- <ModalBody>
36
- {segment.passengers.map(({ passenger_id, baggages }, index) => (
37
- <BaggageSelectionModalBodyPassenger
38
- key={passenger_id}
39
- segmentId={segment.id}
40
- passengerId={passenger_id}
41
- passengerName={getPassengerName(
42
- passengersById[passenger_id],
43
- offer.passengers.find(({ id }) => id === passenger_id),
44
- index + 1
45
- )}
46
- includedBaggage={baggages}
47
- passengerServicesForSegment={
48
- offer.available_services.filter(
49
- ({ type, passenger_ids, segment_ids }) =>
50
- type === "baggage" &&
51
- passenger_ids.includes(passenger_id) &&
52
- segment_ids.includes(segment.id)
53
- ) as OfferAvailableServiceBaggage[]
54
- }
55
- selectedServices={selectedServices}
56
- setSelectedServices={setSelectedServices}
57
- />
58
- ))}
59
- </ModalBody>
60
- );
@@ -1,122 +0,0 @@
1
- import React from "react";
2
- import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
3
- import {
4
- OfferAvailableServiceBaggage,
5
- OfferSliceSegmentPassengerBaggage,
6
- } from "../../../types/Offer";
7
- import { BaggageSelectionController } from "./BaggageSelectionController";
8
- import { IncludedBaggageBanner } from "./IncludedBaggageBanner";
9
-
10
- export interface BaggageSelectionModalBodyPassengerProps {
11
- segmentId: string;
12
- passengerId: string;
13
- passengerName: string;
14
- includedBaggage: OfferSliceSegmentPassengerBaggage[];
15
- passengerServicesForSegment: OfferAvailableServiceBaggage[];
16
- selectedServices: CreateOrderPayloadServices;
17
- setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
18
- }
19
-
20
- export const BaggageSelectionModalBodyPassenger: React.FC<
21
- BaggageSelectionModalBodyPassengerProps
22
- > = ({
23
- segmentId,
24
- passengerId,
25
- passengerName,
26
- includedBaggage,
27
- passengerServicesForSegment,
28
- selectedServices,
29
- setSelectedServices,
30
- }) => {
31
- const hasIncludedBaggage = includedBaggage.reduce(
32
- (sum, bag) => sum + bag.quantity,
33
- 0
34
- );
35
-
36
- return (
37
- <div style={{ marginTop: "24px" }}>
38
- <h3 style={{ margin: 0 }} className="p1--semibold">
39
- {passengerName}
40
- </h3>
41
- {hasIncludedBaggage ? (
42
- <IncludedBaggageBanner includedBaggage={includedBaggage} />
43
- ) : null}
44
-
45
- <div style={{ display: "flex", rowGap: "8px", flexDirection: "column" }}>
46
- {passengerServicesForSegment.map((availableService) => (
47
- <BaggageSelectionController
48
- key={availableService.id}
49
- passengerId={passengerId}
50
- segmentId={segmentId}
51
- availableService={availableService}
52
- selectedServices={selectedServices}
53
- quantity={
54
- selectedServices.find(({ id }) => id == availableService.id)
55
- ?.quantity || 0
56
- }
57
- onQuantityChanged={(newQuantity) =>
58
- onBaggageQuantityChanged(
59
- newQuantity,
60
- segmentId,
61
- passengerId,
62
- passengerName,
63
- availableService,
64
- selectedServices,
65
- setSelectedServices
66
- )
67
- }
68
- />
69
- ))}
70
- </div>
71
-
72
- {passengerServicesForSegment.length === 0 && (
73
- <p style={{ color: `var(--GREY-700)`, margin: 0 }}>
74
- Extra baggage is not available for this passenger on this flight
75
- </p>
76
- )}
77
- </div>
78
- );
79
- };
80
-
81
- const onBaggageQuantityChanged = (
82
- newQuantity: number,
83
- segmentId: string,
84
- passengerId: string,
85
- passengerName: string,
86
- availableService: OfferAvailableServiceBaggage,
87
- selectedServices: CreateOrderPayloadServices,
88
- setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void
89
- ) => {
90
- // check if the service which had its quantity changed is already in the list
91
- const changedServiceIndex = selectedServices.findIndex(
92
- ({ id }) => availableService.id === id
93
- );
94
-
95
- // create a copy of the existing list of selected services
96
- const newSelectedServices = Array.from(selectedServices);
97
-
98
- // if the service is not in the list, add it
99
- if (changedServiceIndex < 0) {
100
- newSelectedServices.push({
101
- id: availableService.id,
102
- quantity: newQuantity,
103
- serviceInformation: {
104
- segmentId,
105
- passengerId,
106
- passengerName,
107
- total_amount: availableService.total_amount,
108
- total_currency: availableService.total_currency,
109
- ...availableService.metadata,
110
- },
111
- });
112
- } else {
113
- // if the service is in the list, update its quantity
114
- newSelectedServices[changedServiceIndex].quantity = newQuantity;
115
- }
116
-
117
- // remove any services with a quantity of 0
118
- // and update the list of selected services
119
- setSelectedServices(
120
- newSelectedServices.filter(({ quantity }) => quantity !== 0)
121
- );
122
- };
@@ -1,88 +0,0 @@
1
- import { Button } from "@components/shared/Button";
2
- import { ServicePriceMapById } from "@lib/getServicePriceMapById";
3
- import { getTotalAmountForServicesWithPriceMap } from "@lib/getTotalAmountForServices";
4
- import { getTotalQuantity } from "@lib/getTotalQuantity";
5
- import { moneyStringFormatter } from "@lib/moneyStringFormatter";
6
- import { withPlural } from "@lib/withPlural";
7
- import React from "react";
8
- import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
9
-
10
- export interface BaggageSelectionModalFooterProps {
11
- currency: string;
12
- selectedServices: CreateOrderPayloadServices;
13
- servicePrices: ServicePriceMapById;
14
-
15
- isFirstSegment: boolean;
16
- isLastSegment: boolean;
17
-
18
- onNextSegmentButtonClicked: () => void;
19
- onPreviousSegmentButtonClicked: () => void;
20
- onClose: () => void;
21
- }
22
-
23
- export const BaggageSelectionModalFooter: React.FC<
24
- BaggageSelectionModalFooterProps
25
- > = ({
26
- selectedServices,
27
- servicePrices,
28
- currency,
29
- isFirstSegment,
30
- isLastSegment,
31
- onNextSegmentButtonClicked,
32
- onPreviousSegmentButtonClicked,
33
- onClose,
34
- }) => {
35
- const totalQuantity = getTotalQuantity(selectedServices);
36
- const totalAmount = getTotalAmountForServicesWithPriceMap(
37
- servicePrices,
38
- selectedServices
39
- );
40
- const totalAmountLabel = moneyStringFormatter(currency)(totalAmount);
41
- const isOneWay = isFirstSegment && isFirstSegment;
42
-
43
- return (
44
- <div style={{ padding: "16px 24px 24px" }}>
45
- <div className="flex--space-between">
46
- <div>
47
- Price for {withPlural(totalQuantity, "extra bag", "extra bags")}
48
- </div>
49
- <div className="h3--semibold" data-testid="baggage-total-amount-label">
50
- + {totalAmountLabel}
51
- </div>
52
- </div>
53
-
54
- <div
55
- style={
56
- isOneWay
57
- ? { marginTop: "16px", display: "grid" }
58
- : {
59
- marginTop: "16px",
60
- display: "grid",
61
- columnGap: "12px",
62
- gridTemplateColumns: "repeat(2, 1fr)",
63
- }
64
- }
65
- >
66
- {!isOneWay && (
67
- <Button
68
- size={48}
69
- variant="outlined"
70
- disabled={isFirstSegment}
71
- onClick={() => onPreviousSegmentButtonClicked()}
72
- >
73
- Back
74
- </Button>
75
- )}
76
- <Button
77
- size={48}
78
- data-testid="confirm-selection-for-baggage"
79
- onClick={() =>
80
- isLastSegment ? onClose() : onNextSegmentButtonClicked()
81
- }
82
- >
83
- {isLastSegment ? "Confirm" : "Next"}
84
- </Button>
85
- </div>
86
- </div>
87
- );
88
- };
@@ -1,82 +0,0 @@
1
- import { formatDateString } from "@lib/formatDate";
2
- import React from "react";
3
- import { OfferSliceSegment } from "../../../types/Offer";
4
-
5
- export interface BaggageSelectionModalHeaderProps {
6
- segmentCount: number;
7
- currentSegmentIndex: number;
8
- currentSegment: OfferSliceSegment;
9
- setCurrentSegmentIndex: (index: number) => void;
10
- }
11
-
12
- export const BaggageSelectionModalHeader: React.FC<
13
- BaggageSelectionModalHeaderProps
14
- > = ({
15
- segmentCount,
16
- currentSegmentIndex,
17
- currentSegment,
18
- setCurrentSegmentIndex,
19
- }) => (
20
- <div style={{ padding: "24px 24px 16px" }}>
21
- {segmentCount > 1 && (
22
- <div style={{ display: "flex", columnGap: "4px" }}>
23
- {Array(segmentCount)
24
- .fill(0)
25
- .map((_, index) =>
26
- index === currentSegmentIndex ? (
27
- <ActiveSegment key={`segment_${index}`} />
28
- ) : (
29
- <InactiveSegment
30
- key={`segment_${index}`}
31
- onClick={() => setCurrentSegmentIndex(index)}
32
- />
33
- )
34
- )}
35
- </div>
36
- )}
37
- <h2
38
- className="h3--semibold"
39
- style={segmentCount > 1 ? { marginTop: "12px" } : {}}
40
- >
41
- Flight to {currentSegment.destination.iata_code}
42
- <span
43
- className="p2--regular"
44
- style={{
45
- color: "var(--GREY-600)",
46
- marginLeft: "8px",
47
- }}
48
- >
49
- {formatDateString(currentSegment.departing_at)}
50
- </span>
51
- </h2>
52
- </div>
53
- );
54
-
55
- const InactiveSegment: React.FC<{
56
- style?: React.CSSProperties;
57
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
58
- }> = ({ onClick, style }) => (
59
- <button
60
- onClick={onClick}
61
- style={{
62
- border: "none",
63
- width: "4px",
64
- height: "4px",
65
- padding: "0",
66
- borderRadius: "4px",
67
- backgroundColor:
68
- "var(--TERTIARY, rgba(var(--ACCENT), var(--ACCENT-LIGHT-200)))",
69
- transition: "background-color 0.3s var(--TRANSITION-CUBIC-BEZIER)",
70
- ...style,
71
- }}
72
- />
73
- );
74
-
75
- const ActiveSegment = () => (
76
- <InactiveSegment
77
- onClick={undefined}
78
- style={{
79
- backgroundColor: "var(--SECONDARY, rgb(var(--ACCENT)))",
80
- }}
81
- />
82
- );
@@ -1,51 +0,0 @@
1
- import { withPlural } from "@lib/withPlural";
2
- import React from "react";
3
- import { OfferSliceSegmentPassengerBaggage } from "../../../types/Offer";
4
-
5
- interface IncludedBaggageBannerProps {
6
- includedBaggage: OfferSliceSegmentPassengerBaggage[];
7
- }
8
-
9
- export const IncludedBaggageBanner: React.FC<IncludedBaggageBannerProps> = ({
10
- includedBaggage,
11
- }) => {
12
- const { carryOnBagsQuantity, checkedBagsQuantity } = includedBaggage.reduce(
13
- (sum, { type, quantity }) => ({
14
- carryOnBagsQuantity:
15
- sum.carryOnBagsQuantity + (type === "carry_on" ? quantity : 0),
16
- checkedBagsQuantity:
17
- sum.checkedBagsQuantity + (type === "checked" ? quantity : 0),
18
- }),
19
- {
20
- carryOnBagsQuantity: 0,
21
- checkedBagsQuantity: 0,
22
- }
23
- );
24
-
25
- const baggageLabelStringArray = new Array<string>();
26
- if (carryOnBagsQuantity > 0) {
27
- baggageLabelStringArray.push(
28
- withPlural(carryOnBagsQuantity, "cabin bag", "cabin bags")
29
- );
30
- }
31
- if (checkedBagsQuantity > 0) {
32
- baggageLabelStringArray.push(
33
- withPlural(checkedBagsQuantity, "checked bag", "checked bags")
34
- );
35
- }
36
-
37
- return (
38
- <div
39
- style={{
40
- marginBlock: "8px",
41
- padding: "8px 12px",
42
- color: ` var(--GREEN-300)`,
43
- backgroundColor: ` var(--GREEN-100)`,
44
- borderRadius: "6px",
45
- }}
46
- className="p2--regular"
47
- >
48
- {baggageLabelStringArray.join(" and ")} included with ticket
49
- </div>
50
- );
51
- };