@duffel/components 2.7.20 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/.circleci/config.yml +67 -0
  2. package/.eslintrc.js +47 -0
  3. package/.github/renovate.json +16 -0
  4. package/.github/workflows/autoapprove.yml +18 -0
  5. package/.github/workflows/release.yml +89 -0
  6. package/.husky/post-commit +4 -0
  7. package/.husky/pre-commit +4 -0
  8. package/.nvmrc +1 -0
  9. package/.prettierignore +2 -0
  10. package/.storybook/Storyshots.test.js +3 -0
  11. package/.storybook/__snapshots__/Storyshots.test.js.snap +48318 -0
  12. package/.storybook/main.ts +33 -0
  13. package/.storybook/preview.tsx +28 -0
  14. package/.tool-versions +1 -0
  15. package/CONTRIBUTING.md +83 -0
  16. package/README.md +53 -15
  17. package/__mocks__/styleMock.js +6 -0
  18. package/babel.config.js +20 -0
  19. package/commitlint.config.js +4 -0
  20. package/config/esbuild.base.config.js +18 -0
  21. package/config/esbuild.cdn.config.js +51 -0
  22. package/config/esbuild.dev.config.js +46 -0
  23. package/config/esbuild.react.config.js +42 -0
  24. package/jest.config.ts +14 -0
  25. package/package.json +135 -193
  26. package/react-dist/components/DuffelAncillaries/Card.d.ts +14 -0
  27. package/react-dist/components/DuffelAncillaries/Counter.d.ts +10 -0
  28. package/react-dist/components/DuffelAncillaries/DuffelAncillaries.d.ts +3 -0
  29. package/react-dist/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +13 -0
  30. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +11 -0
  31. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +13 -0
  32. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +11 -0
  33. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +11 -0
  34. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +13 -0
  35. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +14 -0
  36. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +9 -0
  37. package/react-dist/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +7 -0
  38. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +10 -0
  39. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +11 -0
  40. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +7 -0
  41. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
  42. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +11 -0
  43. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
  44. package/react-dist/components/DuffelAncillaries/seats/Amenity.d.ts +6 -0
  45. package/react-dist/components/DuffelAncillaries/seats/DeckSelect.d.ts +15 -0
  46. package/react-dist/components/DuffelAncillaries/seats/Element.d.ts +15 -0
  47. package/react-dist/components/DuffelAncillaries/seats/EmptyElement.d.ts +2 -0
  48. package/react-dist/components/DuffelAncillaries/seats/ExitElement.d.ts +6 -0
  49. package/react-dist/components/DuffelAncillaries/seats/Legend.d.ts +12 -0
  50. package/react-dist/components/DuffelAncillaries/seats/Row.d.ts +13 -0
  51. package/react-dist/components/DuffelAncillaries/seats/RowSection.d.ts +17 -0
  52. package/react-dist/components/DuffelAncillaries/seats/SeatElement.d.ts +13 -0
  53. package/react-dist/components/DuffelAncillaries/seats/SeatInfo.d.ts +7 -0
  54. package/react-dist/components/DuffelAncillaries/seats/SeatMap.d.ts +12 -0
  55. package/react-dist/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +2 -0
  56. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +13 -0
  57. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +13 -0
  58. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +4 -0
  59. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +16 -0
  60. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +10 -0
  61. package/react-dist/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +5 -0
  62. package/react-dist/components/DuffelPayments/DuffelPayments.d.ts +11 -0
  63. package/react-dist/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +14 -0
  64. package/react-dist/components/shared/AnimatedLoaderEllipsis.d.ts +2 -0
  65. package/react-dist/components/shared/Button.d.ts +23 -0
  66. package/react-dist/components/shared/ErrorBoundary.d.ts +13 -0
  67. package/react-dist/components/shared/FetchOfferErrorState.d.ts +5 -0
  68. package/react-dist/components/shared/Icon.d.ts +44 -0
  69. package/react-dist/components/shared/IconButton.d.ts +16 -0
  70. package/react-dist/components/shared/Modal.d.ts +11 -0
  71. package/react-dist/components/shared/NonIdealState.d.ts +4 -0
  72. package/react-dist/components/shared/Stamp.d.ts +7 -0
  73. package/react-dist/components/shared/Tabs.d.ts +16 -0
  74. package/react-dist/custom-elements.d.ts +6 -0
  75. package/react-dist/custom-elements.js +37 -0
  76. package/react-dist/custom-elements.js.map +7 -0
  77. package/react-dist/index.d.ts +7 -0
  78. package/react-dist/index.js +37 -0
  79. package/react-dist/index.js.map +7 -0
  80. package/react-dist/lib/captureErrorInSentry.d.ts +1 -0
  81. package/react-dist/lib/compileCreateOrderPayload.d.ts +14 -0
  82. package/react-dist/lib/createPriceFormatters.d.ts +12 -0
  83. package/react-dist/lib/fetchFromDuffelAPI.d.ts +8 -0
  84. package/react-dist/lib/fetchFromFixtures.d.ts +4 -0
  85. package/react-dist/lib/formatAvailableServices.d.ts +12 -0
  86. package/react-dist/lib/formatDate.d.ts +2 -0
  87. package/react-dist/lib/formatSeatMaps.d.ts +4 -0
  88. package/react-dist/lib/getBaggageServiceDescription.d.ts +2 -0
  89. package/react-dist/lib/getCabinsForSegmentAndDeck.d.ts +2 -0
  90. package/react-dist/lib/getCurrencyForSeatMaps.d.ts +10 -0
  91. package/react-dist/lib/getCurrencyForServices.d.ts +11 -0
  92. package/react-dist/lib/getFirstSeatElementMatchingCriteria.d.ts +3 -0
  93. package/react-dist/lib/getPassengerBySegmentList.d.ts +6 -0
  94. package/react-dist/lib/getPassengerInitials.d.ts +1 -0
  95. package/react-dist/lib/getPassengerMapById.d.ts +3 -0
  96. package/react-dist/lib/getPassengerName.d.ts +3 -0
  97. package/react-dist/lib/getRowNumber.d.ts +2 -0
  98. package/react-dist/lib/getSegmentList.d.ts +2 -0
  99. package/react-dist/lib/getServicePriceMapById.d.ts +3 -0
  100. package/react-dist/lib/getSymbols.d.ts +2 -0
  101. package/react-dist/lib/getTotalAmountForServices.d.ts +6 -0
  102. package/react-dist/lib/getTotalQuantity.d.ts +2 -0
  103. package/react-dist/lib/hasService.d.ts +2 -0
  104. package/react-dist/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +3 -0
  105. package/react-dist/lib/hasWings.d.ts +2 -0
  106. package/react-dist/lib/isBaggageService.d.ts +2 -0
  107. package/react-dist/lib/isCancelForAnyReasonService.d.ts +2 -0
  108. package/react-dist/lib/isFixtureOfferId.d.ts +2 -0
  109. package/react-dist/lib/isPayloadComplete.d.ts +2 -0
  110. package/react-dist/lib/isSeatElement.d.ts +2 -0
  111. package/react-dist/lib/logging.d.ts +46 -0
  112. package/react-dist/lib/moneyStringFormatter.d.ts +8 -0
  113. package/react-dist/lib/offerIsExpired.d.ts +2 -0
  114. package/react-dist/lib/retrieveOffer.d.ts +2 -0
  115. package/react-dist/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
  116. package/react-dist/lib/retrieveSeatMaps.d.ts +2 -0
  117. package/react-dist/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
  118. package/react-dist/lib/setBodyScrollability.d.ts +1 -0
  119. package/react-dist/lib/validateProps.d.ts +7 -0
  120. package/react-dist/lib/withPlural.d.ts +1 -0
  121. package/react-dist/types/Aircraft.d.ts +14 -0
  122. package/react-dist/types/Airline.d.ts +14 -0
  123. package/react-dist/types/Airport.d.ts +44 -0
  124. package/react-dist/types/City.d.ts +18 -0
  125. package/react-dist/types/CreateOrderPayload.d.ts +72 -0
  126. package/react-dist/types/CurrencyConversion.d.ts +10 -0
  127. package/react-dist/types/DuffelAncillariesProps.d.ts +70 -0
  128. package/react-dist/types/Offer.d.ts +711 -0
  129. package/react-dist/types/Order.d.ts +8 -0
  130. package/react-dist/types/Place.d.ts +8 -0
  131. package/react-dist/types/SeatMap.d.ts +190 -0
  132. package/react-dist/types/index.d.ts +11 -0
  133. package/scripts/generate-fixture.ts +200 -0
  134. package/scripts/upload-to-cdn.sh +34 -0
  135. package/scripts.tsconfig.json +11 -0
  136. package/src/components/DuffelAncillaries/Card.tsx +126 -0
  137. package/src/components/DuffelAncillaries/Counter.tsx +40 -0
  138. package/src/components/DuffelAncillaries/DuffelAncillaries.tsx +344 -0
  139. package/src/components/DuffelAncillaries/DuffelAncillariesCustomElement.tsx +124 -0
  140. package/src/components/DuffelAncillaries/bags/BaggageSelectionCard.tsx +96 -0
  141. package/src/components/DuffelAncillaries/bags/BaggageSelectionController.tsx +88 -0
  142. package/src/components/DuffelAncillaries/bags/BaggageSelectionModal.tsx +81 -0
  143. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBody.tsx +60 -0
  144. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.tsx +122 -0
  145. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.tsx +81 -0
  146. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.tsx +76 -0
  147. package/src/components/DuffelAncillaries/bags/IncludedBaggageBanner.tsx +51 -0
  148. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.tsx +90 -0
  149. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.tsx +63 -0
  150. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.tsx +56 -0
  151. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +11 -0
  152. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.tsx +74 -0
  153. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.tsx +9 -0
  154. package/src/components/DuffelAncillaries/seats/Amenity.tsx +21 -0
  155. package/src/components/DuffelAncillaries/seats/DeckSelect.tsx +27 -0
  156. package/src/components/DuffelAncillaries/seats/Element.tsx +52 -0
  157. package/src/components/DuffelAncillaries/seats/EmptyElement.tsx +5 -0
  158. package/src/components/DuffelAncillaries/seats/ExitElement.tsx +17 -0
  159. package/src/components/DuffelAncillaries/seats/Legend.tsx +60 -0
  160. package/src/components/DuffelAncillaries/seats/Row.tsx +47 -0
  161. package/src/components/DuffelAncillaries/seats/RowSection.tsx +78 -0
  162. package/src/components/DuffelAncillaries/seats/SeatElement.tsx +120 -0
  163. package/src/components/DuffelAncillaries/seats/SeatInfo.tsx +32 -0
  164. package/src/components/DuffelAncillaries/seats/SeatMap.tsx +81 -0
  165. package/src/components/DuffelAncillaries/seats/SeatMapUnavailable.tsx +21 -0
  166. package/src/components/DuffelAncillaries/seats/SeatSelectionCard.tsx +103 -0
  167. package/src/components/DuffelAncillaries/seats/SeatSelectionModal.tsx +142 -0
  168. package/src/components/DuffelAncillaries/seats/SeatSelectionModalBody.tsx +13 -0
  169. package/src/components/DuffelAncillaries/seats/SeatSelectionModalFooter.tsx +82 -0
  170. package/src/components/DuffelAncillaries/seats/SeatSelectionModalHeader.tsx +87 -0
  171. package/src/components/DuffelAncillaries/seats/SeatUnavailable.tsx +14 -0
  172. package/src/components/DuffelPayments/DuffelPayments.tsx +218 -0
  173. package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +130 -0
  174. package/src/components/shared/AnimatedLoaderEllipsis.tsx +5 -0
  175. package/src/components/shared/Button.tsx +63 -0
  176. package/src/components/shared/ErrorBoundary.tsx +54 -0
  177. package/src/components/shared/FetchOfferErrorState.tsx +35 -0
  178. package/src/components/shared/Icon.tsx +152 -0
  179. package/src/components/shared/IconButton.tsx +42 -0
  180. package/src/components/shared/Modal.tsx +40 -0
  181. package/src/components/shared/NonIdealState.tsx +28 -0
  182. package/src/components/shared/Stamp.tsx +29 -0
  183. package/src/components/shared/Tabs.tsx +36 -0
  184. package/src/custom-elements.ts +13 -0
  185. package/src/examples/client-side/README.md +30 -0
  186. package/src/examples/client-side/index.html +57 -0
  187. package/src/examples/full-stack/README.md +34 -0
  188. package/src/examples/full-stack/index.html +48 -0
  189. package/src/examples/full-stack/server.mjs +158 -0
  190. package/src/examples/just-typescript/README.md +37 -0
  191. package/src/examples/just-typescript/package.json +16 -0
  192. package/src/examples/just-typescript/src/index.html +23 -0
  193. package/src/examples/just-typescript/src/index.ts +36 -0
  194. package/src/examples/just-typescript/yarn.lock +154 -0
  195. package/src/examples/payments-custom-element/README.md +17 -0
  196. package/src/examples/payments-custom-element/index.html +43 -0
  197. package/src/examples/payments-just-typescript/README.md +37 -0
  198. package/src/examples/payments-just-typescript/package.json +16 -0
  199. package/src/examples/payments-just-typescript/src/index.html +23 -0
  200. package/src/examples/payments-just-typescript/src/index.ts +18 -0
  201. package/src/examples/payments-just-typescript/yarn.lock +154 -0
  202. package/src/examples/react-app/README.md +37 -0
  203. package/src/examples/react-app/package.json +20 -0
  204. package/src/examples/react-app/src/index.html +19 -0
  205. package/src/examples/react-app/src/index.tsx +48 -0
  206. package/src/examples/react-app/yarn.lock +219 -0
  207. package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +497 -0
  208. package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +307 -0
  209. package/src/fixtures/offers/off_1.json +497 -0
  210. package/src/fixtures/passengers/mock_passengers.ts +26 -0
  211. package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +6852 -0
  212. package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +1 -0
  213. package/src/fixtures/seat-maps/off_1.json +6852 -0
  214. package/src/index.ts +7 -0
  215. package/src/lib/captureErrorInSentry.ts +42 -0
  216. package/src/lib/compileCreateOrderPayload.ts +63 -0
  217. package/src/lib/createPriceFormatters.ts +73 -0
  218. package/src/lib/fetchFromDuffelAPI.ts +54 -0
  219. package/src/lib/fetchFromFixtures.ts +18 -0
  220. package/src/lib/formatAvailableServices.ts +91 -0
  221. package/src/lib/formatDate.ts +20 -0
  222. package/src/lib/formatSeatMaps.ts +81 -0
  223. package/src/lib/getBaggageServiceDescription.ts +42 -0
  224. package/src/lib/getCabinsForSegmentAndDeck.ts +4 -0
  225. package/src/lib/getCurrencyForSeatMaps.ts +22 -0
  226. package/src/lib/getCurrencyForServices.ts +24 -0
  227. package/src/lib/getFirstSeatElementMatchingCriteria.ts +22 -0
  228. package/src/lib/getPassengerBySegmentList.ts +10 -0
  229. package/src/lib/getPassengerInitials.ts +6 -0
  230. package/src/lib/getPassengerMapById.ts +17 -0
  231. package/src/lib/getPassengerName.ts +37 -0
  232. package/src/lib/getRowNumber.ts +16 -0
  233. package/src/lib/getSegmentList.ts +7 -0
  234. package/src/lib/getServicePriceMapById.ts +20 -0
  235. package/src/lib/getSymbols.ts +22 -0
  236. package/src/lib/getTotalAmountForServices.ts +72 -0
  237. package/src/lib/getTotalQuantity.ts +5 -0
  238. package/src/lib/hasService.ts +24 -0
  239. package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +35 -0
  240. package/src/lib/hasWings.ts +8 -0
  241. package/src/lib/isBaggageService.ts +8 -0
  242. package/src/lib/isCancelForAnyReasonService.ts +9 -0
  243. package/src/lib/isFixtureOfferId.ts +4 -0
  244. package/src/lib/isPayloadComplete.ts +11 -0
  245. package/src/lib/isSeatElement.ts +10 -0
  246. package/src/lib/logging.ts +120 -0
  247. package/src/lib/moneyStringFormatter.ts +34 -0
  248. package/src/lib/offerIsExpired.ts +5 -0
  249. package/src/lib/retrieveOffer.ts +54 -0
  250. package/src/lib/retrieveOfferFromDuffelAPI.ts +13 -0
  251. package/src/lib/retrieveSeatMaps.ts +55 -0
  252. package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +13 -0
  253. package/src/lib/setBodyScrollability.ts +7 -0
  254. package/src/lib/validateProps.ts +37 -0
  255. package/src/lib/withPlural.ts +8 -0
  256. package/src/stories/BaggageSelectionModalHeader.stories.tsx +21 -0
  257. package/src/stories/Button.stories.tsx +69 -0
  258. package/src/stories/DuffelAncillaries.stories.tsx +126 -0
  259. package/src/stories/DuffelPayments.stories.tsx +34 -0
  260. package/src/stories/Icon.stories.tsx +35 -0
  261. package/src/stories/IconButton.stories.tsx +25 -0
  262. package/src/styles/colors.css +22 -0
  263. package/src/styles/components/Amenity.css +23 -0
  264. package/src/styles/components/BaggageDisplay.css +25 -0
  265. package/src/styles/components/Button.css +161 -0
  266. package/src/styles/components/Card.css +52 -0
  267. package/src/styles/components/CfarSelectionModal.css +34 -0
  268. package/src/styles/components/Counter.css +18 -0
  269. package/src/styles/components/DuffelPayments.css +42 -0
  270. package/src/styles/components/IconButton.css +63 -0
  271. package/src/styles/components/Legend.css +58 -0
  272. package/src/styles/components/Loader.css +37 -0
  273. package/src/styles/components/LoadingState.css +81 -0
  274. package/src/styles/components/Modal.css +84 -0
  275. package/src/styles/components/PassengerSelect.css +93 -0
  276. package/src/styles/components/PassengersLayout.css +90 -0
  277. package/src/styles/components/Row.css +70 -0
  278. package/src/styles/components/Seat.css +57 -0
  279. package/src/styles/components/SeatInfo.css +61 -0
  280. package/src/styles/components/SeatMap.css +24 -0
  281. package/src/styles/components/SeatSelect.css +92 -0
  282. package/src/styles/components/Segment.css +17 -0
  283. package/src/styles/components/SelectionSegment.css +10 -0
  284. package/src/styles/components/Summary.css +70 -0
  285. package/src/styles/components/Tabs.css +49 -0
  286. package/src/styles/flex.css +5 -0
  287. package/src/styles/font-families.css +47 -0
  288. package/src/styles/global.css +51 -0
  289. package/src/styles/margin.css +3 -0
  290. package/src/styles/spacing.css +18 -0
  291. package/src/styles/transitions.css +3 -0
  292. package/src/styles/typography.css +13 -0
  293. package/src/tests/components/DuffelAncillaries.test.tsx +342 -0
  294. package/src/tests/lib/createPriceFormatters.test.tsx +152 -0
  295. package/src/tests/lib/formatAvailableServices.test.tsx +79 -0
  296. package/src/tests/lib/formatSeatMaps.test.tsx +49 -0
  297. package/src/tests/lib/getCurrencyForServices.test.tsx +44 -0
  298. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +86 -0
  299. package/src/tests/lib/logging.test.tsx +32 -0
  300. package/src/tests/lib/moneyStringFormatter.test.tsx +12 -0
  301. package/src/tests/lib/validateProps.test.tsx +57 -0
  302. package/src/types/Aircraft.ts +16 -0
  303. package/src/types/Airline.ts +16 -0
  304. package/src/types/Airport.ts +54 -0
  305. package/src/types/City.ts +21 -0
  306. package/src/types/CreateOrderPayload.ts +99 -0
  307. package/src/types/CurrencyConversion.ts +10 -0
  308. package/src/types/DuffelAncillariesProps.ts +108 -0
  309. package/src/types/Offer.ts +851 -0
  310. package/src/types/Order.ts +6 -0
  311. package/src/types/Place.ts +6 -0
  312. package/src/types/SeatMap.ts +231 -0
  313. package/src/types/index.ts +11 -0
  314. package/tsconfig.json +52 -0
  315. package/LICENSE +0 -21
  316. package/dist/AdditionalBaggage.esm.js +0 -1
  317. package/dist/AdditionalBaggage.js +0 -1
  318. package/dist/AdditionalBaggage.min.css +0 -408
  319. package/dist/AdditionalBaggage.umd.min.js +0 -2
  320. package/dist/AdditionalBaggage.umd.min.js.LICENSE.txt +0 -60
  321. package/dist/AdditionalBaggageSelection.esm.js +0 -1
  322. package/dist/AdditionalBaggageSelection.js +0 -1
  323. package/dist/AdditionalBaggageSelection.min.css +0 -744
  324. package/dist/AdditionalBaggageSelection.umd.min.js +0 -2
  325. package/dist/AdditionalBaggageSelection.umd.min.js.LICENSE.txt +0 -93
  326. package/dist/CardPayment.esm.js +0 -2
  327. package/dist/CardPayment.esm.js.LICENSE.txt +0 -6
  328. package/dist/CardPayment.js +0 -2
  329. package/dist/CardPayment.js.LICENSE.txt +0 -6
  330. package/dist/CardPayment.min.css +0 -233
  331. package/dist/CardPayment.umd.min.js +0 -2
  332. package/dist/CardPayment.umd.min.js.LICENSE.txt +0 -61
  333. package/dist/SeatSelection.esm.js +0 -1
  334. package/dist/SeatSelection.js +0 -1
  335. package/dist/SeatSelection.min.css +0 -1127
  336. package/dist/SeatSelection.umd.min.js +0 -2
  337. package/dist/SeatSelection.umd.min.js.LICENSE.txt +0 -60
  338. package/dist/duffel-components.d.ts +0 -1614
  339. package/dist/duffel-components.esm.js +0 -2
  340. package/dist/duffel-components.esm.js.LICENSE.txt +0 -6
  341. package/dist/duffel-components.js +0 -2
  342. package/dist/duffel-components.js.LICENSE.txt +0 -6
  343. package/dist/duffel-components.min.css +0 -1280
  344. package/dist/duffel-components.umd.min.js +0 -2
  345. package/dist/duffel-components.umd.min.js.LICENSE.txt +0 -102
@@ -0,0 +1,130 @@
1
+ import { StripeError } from "@stripe/stripe-js";
2
+ import { createRoot, Root } from "react-dom/client";
3
+ import { DuffelPayments, DuffelPaymentsProps } from "./DuffelPayments";
4
+
5
+ declare global {
6
+ // eslint-disable-next-line @typescript-eslint/no-namespace
7
+ namespace JSX {
8
+ interface IntrinsicElements {
9
+ "duffel-payments": React.DetailedHTMLProps<
10
+ React.HTMLAttributes<HTMLElement>,
11
+ HTMLElement
12
+ >;
13
+ }
14
+ }
15
+ }
16
+
17
+ const CUSTOM_ELEMENT_TAG = "duffel-payments";
18
+
19
+ type DuffelPaymentsCustomElementRenderArguments = Pick<
20
+ DuffelPaymentsProps,
21
+ "paymentIntentClientToken" | "styles"
22
+ >;
23
+
24
+ class DuffelPaymentsCustomElement extends HTMLElement {
25
+ /**
26
+ * The React root for displaying content inside a browser DOM element.
27
+ */
28
+ private root!: Root;
29
+
30
+ /**
31
+ * `connectedCallback` is called to initialise the custom element
32
+ */
33
+ connectedCallback() {
34
+ const container = document.createElement("div");
35
+ this.appendChild(container);
36
+
37
+ this.root = createRoot(container);
38
+ }
39
+
40
+ /**
41
+ * When this function is called, it will render/re-render
42
+ * the `DuffelPayments` component with the given props.
43
+ */
44
+ public render(withProps: DuffelPaymentsCustomElementRenderArguments) {
45
+ if (!this.root) {
46
+ throw "It was not possible to render `duffel-payments` because `this.root` is missing.";
47
+ }
48
+
49
+ this.root.render(
50
+ <DuffelPayments
51
+ {...withProps}
52
+ onSuccessfulPayment={() => {
53
+ this.dispatchEvent(
54
+ new CustomEvent("onSuccessfulPayment", {
55
+ composed: true,
56
+ })
57
+ );
58
+ }}
59
+ onFailedPayment={(error: StripeError) => {
60
+ this.dispatchEvent(
61
+ new CustomEvent("onFailedPayment", {
62
+ detail: { error },
63
+ composed: true,
64
+ })
65
+ );
66
+ }}
67
+ />
68
+ );
69
+ }
70
+ }
71
+
72
+ window.customElements.get(CUSTOM_ELEMENT_TAG) ||
73
+ window.customElements.define(CUSTOM_ELEMENT_TAG, DuffelPaymentsCustomElement);
74
+
75
+ function tryToGetDuffelPaymentsCustomElement(
76
+ caller: string
77
+ ): DuffelPaymentsCustomElement {
78
+ const element =
79
+ document.querySelector<DuffelPaymentsCustomElement>(CUSTOM_ELEMENT_TAG);
80
+ if (!element) {
81
+ throw new Error(
82
+ `Could not find duffel-payments element in the DOM. Maybe you need to call ${caller} after 'window.onload'?`
83
+ );
84
+ }
85
+ return element;
86
+ }
87
+
88
+ export function renderDuffelPaymentsCustomElement(
89
+ props: DuffelPaymentsCustomElementRenderArguments
90
+ ) {
91
+ const element = tryToGetDuffelPaymentsCustomElement(
92
+ "renderDuffelPaymentsCustomElement"
93
+ );
94
+ element.render(props);
95
+ }
96
+
97
+ export function onDuffelPaymentsSuccessfulPayment(
98
+ onSuccessfulPayment: DuffelPaymentsProps["onSuccessfulPayment"]
99
+ ) {
100
+ const element = tryToGetDuffelPaymentsCustomElement(
101
+ "onDuffelPaymentsPayloadReady"
102
+ );
103
+
104
+ // using `as EventListener` here because typescript doesn't know the event type for `onPayloadReady`
105
+ // There's a few different suggestions to resolve this seemed good enough
106
+ // You can learn more here: https://github.com/microsoft/TypeScript/issues/28357
107
+ element.addEventListener(
108
+ "onPayloadReady",
109
+ onSuccessfulPayment as EventListener
110
+ );
111
+ }
112
+
113
+ type OnFailedPaymentCustomEvent = CustomEvent<{
114
+ error: StripeError;
115
+ }>;
116
+ export function onDuffelPaymentsFailedPayment(
117
+ onFailedPayment: DuffelPaymentsProps["onFailedPayment"]
118
+ ) {
119
+ const element = tryToGetDuffelPaymentsCustomElement(
120
+ "onDuffelPaymentsPayloadReady"
121
+ );
122
+ const eventListener = (event: OnFailedPaymentCustomEvent) => {
123
+ onFailedPayment(event.detail.error);
124
+ };
125
+
126
+ // using `as EventListener` here because typescript doesn't know the event type for `onPayloadReady`
127
+ // There's a few different suggestions to resolve this seemed good enough
128
+ // You can learn more here: https://github.com/microsoft/TypeScript/issues/28357
129
+ element.addEventListener("onPayloadReady", eventListener as EventListener);
130
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+
3
+ export const AnimatedLoaderEllipsis: React.FC = () => (
4
+ <span className="textual-loading-indicator" aria-hidden="true" />
5
+ );
@@ -0,0 +1,63 @@
1
+ import { Icon, IconName } from "@components/shared/Icon";
2
+ import classNames from "classnames";
3
+ import * as React from "react";
4
+
5
+ const BUTTON_VARIANTS = {
6
+ primary: "button--primary",
7
+ outlined: "button--outlined",
8
+ destructive: "button--destructive",
9
+ };
10
+ type ButtonVariants = keyof typeof BUTTON_VARIANTS;
11
+
12
+ const BUTTON_SIZES = {
13
+ 32: "button--32",
14
+ 40: "button--40",
15
+ 48: "button--48",
16
+ };
17
+
18
+ type ButtonSizes = keyof typeof BUTTON_SIZES;
19
+
20
+ type NativeButtonProps = React.DetailedHTMLProps<
21
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
22
+ HTMLButtonElement
23
+ >;
24
+
25
+ export interface ButtonProps
26
+ extends Pick<
27
+ NativeButtonProps,
28
+ "id" | "onClick" | "disabled" | "children" | "className" | "type"
29
+ > {
30
+ "data-testid"?: string;
31
+ iconBefore?: IconName;
32
+ variant?: ButtonVariants;
33
+ size?: ButtonSizes;
34
+ }
35
+
36
+ export const Button: React.FC<ButtonProps> = ({
37
+ iconBefore,
38
+ variant = "primary",
39
+ size = 40,
40
+ children,
41
+ className,
42
+ type = "button",
43
+ ...nativeButtonProps
44
+ }) => (
45
+ <button
46
+ type={type}
47
+ className={classNames(
48
+ "button",
49
+ BUTTON_VARIANTS[variant],
50
+ BUTTON_SIZES[size],
51
+ className
52
+ )}
53
+ {...nativeButtonProps}
54
+ >
55
+ {iconBefore && (
56
+ <Icon
57
+ className="duffel-button__icon duffel-button__icon--before"
58
+ name={iconBefore}
59
+ />
60
+ )}
61
+ {children}
62
+ </button>
63
+ );
@@ -0,0 +1,54 @@
1
+ import { captureErrorInSentry } from "@lib/captureErrorInSentry";
2
+ import React from "react";
3
+ import { Button } from "./Button";
4
+ import { NonIdealState } from "./NonIdealState";
5
+
6
+ export class ErrorBoundary extends React.Component<{
7
+ children: React.ReactNode | React.ReactNode[];
8
+ }> {
9
+ state = { hasError: false };
10
+
11
+ static getDerivedStateFromError() {
12
+ // Update state so the next render will show the fallback UI.
13
+ return { hasError: true };
14
+ }
15
+
16
+ componentDidCatch(error: Error) {
17
+ // You can also log the error to an error reporting service
18
+ captureErrorInSentry(error);
19
+ }
20
+
21
+ render() {
22
+ if (this.state.hasError) {
23
+ return (
24
+ <NonIdealState>
25
+ <p style={{ marginBlock: "0" }} className="p1--semibold">
26
+ We ran into an error
27
+ </p>
28
+ <p
29
+ className="p1--regular"
30
+ style={{
31
+ color: "var(--GREY-600)",
32
+ marginBlock: "12px",
33
+ textAlign: "center",
34
+ }}
35
+ >
36
+ Please try reloading. If the problem persists reach out to our
37
+ support team.
38
+ </p>
39
+ <div>
40
+ <Button
41
+ variant="outlined"
42
+ iconBefore="autorenew"
43
+ onClick={() => location.reload()}
44
+ >
45
+ Try again
46
+ </Button>
47
+ </div>
48
+ </NonIdealState>
49
+ );
50
+ }
51
+
52
+ return this.props.children;
53
+ }
54
+ }
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Button } from "./Button";
3
+ import { NonIdealState } from "./NonIdealState";
4
+
5
+ export const FetchOfferErrorState: React.FC<{
6
+ height: string;
7
+ message: string;
8
+ }> = ({ height, message }) => (
9
+ <NonIdealState style={{ minHeight: height }}>
10
+ <p style={{ marginBlock: "0" }} className="p1--semibold">
11
+ Failed to load extras
12
+ </p>
13
+ <p
14
+ className="p2--regular"
15
+ style={{
16
+ color: "var(--GREY-600)",
17
+ marginBlock: "12px",
18
+ textAlign: "center",
19
+ }}
20
+ >
21
+ {message
22
+ ? message
23
+ : "Please try reloading. If the problem persists reach out to our support team."}
24
+ </p>
25
+ <div>
26
+ <Button
27
+ variant="outlined"
28
+ onClick={() => location.reload()}
29
+ iconBefore="autorenew"
30
+ >
31
+ Try again
32
+ </Button>
33
+ </div>
34
+ </NonIdealState>
35
+ );
@@ -0,0 +1,152 @@
1
+ import { log } from "@lib/logging";
2
+ import * as React from "react";
3
+
4
+ /* eslint-disable react/no-unknown-property */
5
+ /* eslint sort-keys: "error" */
6
+ export const ICON_MAP = {
7
+ add: (
8
+ <path d="M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z" />
9
+ ),
10
+ arrow_forward: (
11
+ <path d="M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42.39.39 1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1z" />
12
+ ),
13
+ arrow_left: (
14
+ <path d="M9 19L2 12L9 5L10.425 6.4L5.825 11H22V13H5.825L10.4 17.6L9 19Z" />
15
+ ),
16
+ arrow_right: (
17
+ <path d="M15 19L13.6 17.6L18.2 13H2V11H18.2L13.6 6.4L15 5L22 12L15 19Z" />
18
+ ),
19
+ autorenew: (
20
+ <path d="M5.69728 14.4104C5.49326 13.9833 5.32604 13.5257 5.19562 13.0374C5.06521 12.5492 5 12.0367 5 11.5C5 9.56481 5.69083 7.91679 7.07249 6.55591C8.45416 5.19504 10.147 4.53946 12.1511 4.58918H12.7613L11.0742 2.92359L12.0097 2L15.2869 5.23549L12.0097 8.47099L11.0742 7.54739L12.7613 5.88181H12.1511C10.5021 5.84866 9.11624 6.38632 7.99347 7.49479C6.87069 8.60326 6.30931 9.93833 6.30931 11.5C6.30931 11.8455 6.33804 12.1824 6.3955 12.5106C6.45296 12.8389 6.53915 13.1573 6.65407 13.4658L5.69728 14.4104ZM11.9903 21L8.71309 17.7645L11.9903 14.529L12.9258 15.4526L11.2387 17.1182H11.8489C13.4979 17.1513 14.8838 16.6137 16.0065 15.5052C17.1293 14.3967 17.6907 13.0617 17.6907 11.5C17.6907 11.1545 17.662 10.8176 17.6045 10.4894C17.547 10.1611 17.4609 9.84273 17.3459 9.53421L18.3027 8.58959C18.5067 9.01665 18.674 9.47431 18.8044 9.96256C18.9348 10.4508 19 10.9633 19 11.5C19 13.4186 18.3092 15.0625 16.9275 16.4317C15.5458 17.8008 13.853 18.4605 11.8489 18.4108H11.2387L12.9258 20.0764L11.9903 21Z" />
21
+ ),
22
+ bassinet: (
23
+ <>
24
+ <path d="M19 12C19 14.1217 18.1571 16.1566 16.6569 17.6569C15.1566 19.1571 13.1217 20 11 20C8.87827 20 6.84344 19.1571 5.34315 17.6569C3.84286 16.1566 3 14.1217 3 12L11 12H19Z" />
25
+ <path d="M16.1347 5.86529L11 11V4C12.0506 4 13.0909 4.20693 14.0615 4.60896C14.8136 4.92052 15.5125 5.34451 16.1347 5.86529ZM16.8602 6.55405L12.4142 11H18.9373C18.8482 10.293 18.6649 9.59962 18.391 8.93853C18.0264 8.05823 17.5077 7.25087 16.8602 6.55405Z" />
26
+ </>
27
+ ),
28
+ cabin_bag: (
29
+ <path d="M7.3077 20.5C6.81058 20.5 6.38502 20.323 6.03102 19.969C5.67701 19.615 5.5 19.1894 5.5 18.6923V8.25007C5.5 7.76417 5.67019 7.35103 6.01057 7.01065C6.35096 6.67027 6.7641 6.50007 7.25 6.50007H9.25V3.6924C9.25 3.43631 9.33622 3.22166 9.50865 3.04842C9.68108 2.87519 9.89773 2.78857 10.1586 2.78857H13.8414C14.1022 2.78857 14.3189 2.87519 14.4913 3.04842C14.6637 3.22166 14.75 3.43631 14.75 3.6924V6.50007H16.6922C17.1894 6.50007 17.6149 6.67708 17.9689 7.0311C18.3229 7.3851 18.5 7.81066 18.5 8.30777V18.6923C18.5 19.1894 18.3229 19.615 17.9689 19.969C17.6149 20.323 17.1894 20.5 16.6922 20.5C16.6922 20.7507 16.6074 20.9608 16.4377 21.1303C16.2681 21.2999 16.0578 21.3846 15.807 21.3846C15.5561 21.3846 15.3461 21.2999 15.1769 21.1303C15.0077 20.9608 14.923 20.7507 14.923 20.5H9.0769C9.0769 20.7513 8.99206 20.9615 8.82237 21.1308C8.65271 21.3 8.44246 21.3846 8.19162 21.3846C7.94079 21.3846 7.73076 21.2999 7.56153 21.1303C7.39231 20.9608 7.3077 20.7507 7.3077 20.5ZM10.4423 6.50007H13.5577V3.98085H10.4423V6.50007ZM7.3077 19H16.6922C16.782 19 16.8557 18.9712 16.9134 18.9135C16.9711 18.8558 17 18.7821 17 18.6923V8.30777C17 8.21802 16.9711 8.1443 16.9134 8.0866C16.8557 8.0289 16.782 8.00005 16.6922 8.00005H7.3077C7.21795 8.00005 7.14423 8.0289 7.08652 8.0866C7.02882 8.1443 6.99997 8.21802 6.99997 8.30777V18.6923C6.99997 18.7821 7.02882 18.8558 7.08652 18.9135C7.14423 18.9712 7.21795 19 7.3077 19ZM8.15382 17.1539C8.15382 17.3261 8.21009 17.4685 8.32262 17.5811C8.43514 17.6937 8.57744 17.75 8.74952 17.75C8.92161 17.75 9.06407 17.6937 9.1769 17.5811C9.28972 17.4685 9.34613 17.3261 9.34613 17.1539V9.8462C9.34613 9.67398 9.28986 9.53157 9.17732 9.41897C9.06481 9.30637 8.92251 9.25007 8.75043 9.25007C8.57834 9.25007 8.43588 9.30637 8.32305 9.41897C8.21023 9.53157 8.15382 9.67398 8.15382 9.8462V17.1539ZM11.4038 17.1539C11.4038 17.3261 11.4601 17.4685 11.5726 17.5811C11.6851 17.6937 11.8274 17.75 11.9995 17.75C12.1716 17.75 12.3141 17.6937 12.4269 17.5811C12.5397 17.4685 12.5961 17.3261 12.5961 17.1539V9.8462C12.5961 9.67398 12.5399 9.53157 12.4273 9.41897C12.3148 9.30637 12.1725 9.25007 12.0004 9.25007C11.8283 9.25007 11.6859 9.30637 11.5731 9.41897C11.4602 9.53157 11.4038 9.67398 11.4038 9.8462V17.1539ZM14.6538 17.1539C14.6538 17.3261 14.7101 17.4685 14.8226 17.5811C14.9351 17.6937 15.0774 17.75 15.2495 17.75C15.4216 17.75 15.5641 17.6937 15.6769 17.5811C15.7897 17.4685 15.8461 17.3261 15.8461 17.1539V9.8462C15.8461 9.67398 15.7899 9.53157 15.6773 9.41897C15.5648 9.30637 15.4225 9.25007 15.2504 9.25007C15.0783 9.25007 14.9359 9.30637 14.823 9.41897C14.7102 9.53157 14.6538 9.67398 14.6538 9.8462V17.1539Z" />
30
+ ),
31
+ check: (
32
+ <path d="M10.3333 15.8646L7 12.5313L8.0625 11.4688L10.3333 13.7396L15.9375 8.13544L17 9.19794L10.3333 15.8646Z" />
33
+ ),
34
+ checked_bag: (
35
+ <path d="M22 19H2V21H22V19M4 15C4 15.5 4.2 16 4.6 16.4C5 16.8 5.5 17 6 17V6C5.5 6 5 6.2 4.6 6.6C4.2 7 4 7.5 4 8V15M13.5 6H10.5C10.5 5.6 10.6 5.2 10.9 4.9C11.2 4.6 11.5 4.5 12 4.5C12.4 4.5 12.8 4.6 13.1 4.9C13.3 5.2 13.5 5.6 13.5 6M7 6V17H17V6H15C15 5.2 14.7 4.5 14.1 3.9S12.8 3 12 3C11.2 3 10.5 3.3 9.9 3.9C9.3 4.5 9 5.2 9 6H7M18 17C18.5 17 19 16.8 19.4 16.4C19.8 16 20 15.5 20 15V8C20 7.5 19.8 7 19.4 6.6C19 6.2 18.5 6 18 6V17Z" />
36
+ ),
37
+ chevron: (
38
+ <path d="M5 13H16.17L11.29 17.88C10.9 18.27 10.9 18.91 11.29 19.3C11.68 19.69 12.31 19.69 12.7 19.3L19.29 12.71C19.68 12.32 19.68 11.69 19.29 11.3L12.71 4.7C12.32 4.31 11.69 4.31 11.3 4.7C10.91 5.09 10.91 5.72 11.3 6.11L16.17 11H5C4.45 11 4 11.45 4 12C4 12.55 4.45 13 5 13Z" />
39
+ ),
40
+ close: (
41
+ <path d="M18.3 5.71c-.39-.39-1.02-.39-1.41 0L12 10.59 7.11 5.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4z" />
42
+ ),
43
+ closet: (
44
+ <path d="M12 4C11.0717 4 10.1815 4.36875 9.52513 5.02513C8.86875 5.6815 8.5 6.57174 8.5 7.5H10.5C10.5 7.10218 10.658 6.72064 10.9393 6.43934C11.2206 6.15804 11.6022 6 12 6C12.3978 6 12.7794 6.15804 13.0607 6.43934C13.342 6.72064 13.5 7.10218 13.5 7.5C13.5 7.89782 13.342 8.27936 13.0607 8.56066C12.7794 8.84196 12.3978 9 12 9C11.45 9 11 9.45 11 10V11.75L2.4 18.2C2.23209 18.3259 2.10807 18.5015 2.04549 18.7018C1.98291 18.9022 1.98495 19.1171 2.05132 19.3162C2.11769 19.5153 2.24502 19.6885 2.41529 19.8112C2.58556 19.934 2.79012 20 3 20H21C21.2099 20 21.4144 19.934 21.5847 19.8112C21.755 19.6885 21.8823 19.5153 21.9487 19.3162C22.0151 19.1171 22.0171 18.9022 21.9545 18.7018C21.8919 18.5015 21.7679 18.3259 21.6 18.2L13 11.75V10.85C13.7216 10.6349 14.3546 10.1927 14.805 9.58919C15.2554 8.98569 15.4991 8.25303 15.5 7.5C15.5 6.57174 15.1313 5.6815 14.4749 5.02513C13.8185 4.36875 12.9283 4 12 4ZM12 13.5L18 18H6L12 13.5Z" />
45
+ ),
46
+ exit_row: (
47
+ <path d="M20 11H6.83001L9.71001 8.12001C10.1 7.73001 10.1 7.10001 9.71001 6.71001C9.32001 6.32001 8.69001 6.32001 8.30001 6.71001L3.71001 11.3C3.32001 11.69 3.32001 12.32 3.71001 12.71L8.30001 17.3C8.69001 17.69 9.32001 17.69 9.71001 17.3C10.1 16.91 10.1 16.28 9.71001 15.89L6.83001 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11Z" />
48
+ ),
49
+ exit_row_right: (
50
+ <path d="M4 11H17.17L14.29 8.12001C13.9 7.73001 13.9 7.10001 14.29 6.71001C14.68 6.32001 15.31 6.32001 15.7 6.71001L20.29 11.3C20.68 11.69 20.68 12.32 20.29 12.71L15.7 17.3C15.31 17.69 14.68 17.69 14.29 17.3C13.9 16.91 13.9 16.28 14.29 15.89L17.17 13H4C3.45 13 3 12.55 3 12C3 11.45 3.45 11 4 11Z" />
51
+ ),
52
+ expand_content: <path d="M5 19V13H7V17H11V19H5ZM17 11V7H13V5H19V11H17Z" />,
53
+ flight_class: (
54
+ <path d="M14.2596 12.5C13.7737 12.5 13.3606 12.3298 13.0202 11.9894C12.6798 11.649 12.5096 11.2359 12.5096 10.75V6.25C12.5096 5.7641 12.6798 5.35096 13.0202 5.01058C13.3606 4.67019 13.7737 4.5 14.2596 4.5H15.75C16.2359 4.5 16.649 4.67019 16.9894 5.01058C17.3298 5.35096 17.5 5.7641 17.5 6.25V10.75C17.5 11.2359 17.3298 11.649 16.9894 11.9894C16.649 12.3298 16.2359 12.5 15.75 12.5H14.2596ZM14.2596 11H15.75C15.8205 11 15.8798 10.9759 15.9278 10.9279C15.9759 10.8798 16 10.8205 16 10.75V6.25C16 6.17948 15.9759 6.12018 15.9278 6.0721C15.8798 6.02402 15.8205 5.99998 15.75 5.99998H14.2596C14.1891 5.99998 14.1298 6.02402 14.0817 6.0721C14.0336 6.12018 14.0096 6.17948 14.0096 6.25V10.75C14.0096 10.8205 14.0336 10.8798 14.0817 10.9279C14.1298 10.9759 14.1891 11 14.2596 11ZM9.5673 17.5C9.21345 17.5 8.89678 17.398 8.6173 17.1942C8.33782 16.9903 8.14423 16.7198 8.03655 16.3827L5.5 8.02883V4.5H6.99997V7.99998L9.49997 16H17.7596V17.5H9.5673ZM8.25 20.5V19H17.75V20.5H8.25ZM14.2596 5.99998H16H14.0096H14.2596Z" />
55
+ ),
56
+ galley: (
57
+ <path d="M20 3H4v10c0 2.21 1.79 4 4 4h6c2.21 0 4-1.79 4-4v-3h2c1.11 0 2-.9 2-2V5c0-1.11-.89-2-2-2zm0 5h-2V5h2v3zM4 19h16v2H4z" />
58
+ ),
59
+ lavatory: (
60
+ <path d="M5.5 22v-7.5H4V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v5.5H9.5V22h-4zM18 22v-6h3l-2.54-7.63C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37L12 16h3v6h3zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z" />
61
+ ),
62
+ lie_flat_seat: (
63
+ <path d="M6.16667 12.8333C6.81667 12.8333 7.45834 12.5833 7.95001 12.0833C8.91667 11.0916 8.90001 9.51659 7.91667 8.54992C7.42501 8.07492 6.79167 7.83325 6.16667 7.83325C5.51667 7.83325 4.87501 8.08325 4.38334 8.58325C3.41667 9.57492 3.43334 11.1499 4.41667 12.1166C4.90834 12.5916 5.54167 12.8333 6.16667 12.8333ZM5.57501 9.74992C5.73334 9.59159 5.94167 9.49992 6.16667 9.49992C6.38334 9.49992 6.59167 9.58325 6.75001 9.73325C7.08334 10.0583 7.08334 10.5749 6.76667 10.9083C6.60001 11.0749 6.39167 11.1666 6.16667 11.1666C5.95001 11.1666 5.74167 11.0833 5.58334 10.9333C5.25001 10.5999 5.25001 10.0833 5.57501 9.74992ZM17 7.83325H9.50001V12.8333H20.3333V11.1666C20.3333 9.32492 18.8417 7.83325 17 7.83325ZM11.1667 11.1666V9.49992H17C17.9167 9.49992 18.6667 10.2499 18.6667 11.1666H11.1667ZM3.66667 15.3333H8.66667V16.9999H15.3333V15.3333H20.3333V13.6666H3.66667V15.3333Z" />
64
+ ),
65
+ minus: (
66
+ <path d="M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1z" />
67
+ ),
68
+ no_airplane: (
69
+ <path d="M14.6674 10.0001V2.66675C14.6674 1.56008 13.7741 0.666748 12.6674 0.666748C11.5607 0.666748 10.6674 1.56008 10.6674 2.66675V7.57341L21.1074 18.0134L25.3341 19.3334V16.6667L14.6674 10.0001ZM1.33407 5.02675L7.9874 11.6801L0.000732422 16.6667V19.3334L10.6674 16.0001V23.3334L8.00073 25.3334V27.3334L12.6674 26.0001L17.3341 27.3334V25.3334L14.6674 23.3334V18.3601L22.3074 26.0001L24.0007 24.3067L3.0274 3.33341L1.33407 5.02675Z" />
70
+ ),
71
+ no_bag: (
72
+ <path
73
+ fill-rule="evenodd"
74
+ clip-rule="evenodd"
75
+ d="M16.8992 6.12037H14.9392V3.18101C14.9385 2.92148 14.8351 2.67278 14.6516 2.48926C14.4681 2.30574 14.2194 2.20234 13.9599 2.20166H10.0399C9.78034 2.20234 9.53163 2.30574 9.34811 2.48926C9.16459 2.67278 9.06119 2.92148 9.06051 3.18101V6.12037H8.20711L8.34715 6.25804L14.3973 12.0871V9.06102H15.9676V13.6L17.3022 14.8859L18.8592 16.4748V8.08037C18.8579 7.56096 18.6509 7.06322 18.2836 6.69594C17.9164 6.32867 17.4186 6.12173 16.8992 6.12037ZM5.14051 8.09559L3.77173 6.71825L5.00821 5.48945L7.16586 7.6606L13.9581 14.4953L15.8932 16.4426L19.7441 20.3175L20.2279 20.8043L18.9914 22.0331L17.635 20.6683C17.4035 20.7625 17.154 20.8126 16.8992 20.8133C16.904 20.945 16.8822 21.0763 16.8351 21.1993C16.788 21.3224 16.7166 21.4347 16.6251 21.5296C16.5336 21.6244 16.424 21.6999 16.3027 21.7514C16.1814 21.8029 16.051 21.8295 15.9192 21.8295C15.7874 21.8295 15.657 21.8029 15.5357 21.7514C15.4145 21.6999 15.3048 21.6244 15.2133 21.5296C15.1219 21.4347 15.0504 21.3224 15.0034 21.1993C14.9563 21.0763 14.9344 20.945 14.9392 20.8133H9.06051C9.06529 20.945 9.04348 21.0763 8.99638 21.1993C8.94929 21.3224 8.87787 21.4347 8.7864 21.5296C8.69492 21.6244 8.58527 21.6999 8.46399 21.7514C8.34271 21.8029 8.21229 21.8295 8.08051 21.8295C7.94874 21.8295 7.81832 21.8029 7.69703 21.7514C7.57575 21.6999 7.4661 21.6244 7.37463 21.5296C7.28316 21.4347 7.21174 21.3224 7.16464 21.1993C7.11754 21.0763 7.09573 20.945 7.10051 20.8133C6.58222 20.8119 6.08545 20.6059 5.71835 20.24C5.35126 19.8741 5.14357 19.378 5.14051 18.8597V8.09559ZM14.8632 17.8791L14.3973 17.4103V17.8791H14.8632ZM9.596 12.579V17.8791H8.03083V11.004L9.596 12.579ZM10.5302 3.67134H13.4695V6.12295H10.5302V3.67134Z"
76
+ />
77
+ ),
78
+ no_seat: (
79
+ <>
80
+ <path d="M25.1667 21.9733L23.4733 23.6667L2.5 2.69333L4.19333 1L7.16667 3.97333L16.5267 13.3333L19.1933 16L24.5 21.3067L25.1667 21.9733Z" />
81
+ <path
82
+ fillRule="evenodd"
83
+ clipRule="evenodd"
84
+ d="M7.16667 24H3.16667V16H19.1933L24.5 21.3067V24H20.5V20H7.16667V24ZM27.1667 9.33333H23.1667V13.3333H27.1667V9.33333ZM4.5 9.33333H0.5V13.3333H4.5V9.33333ZM20.3333 13.3333H20.5V2.66667C20.5 1.2 19.3 0 17.8333 0H9.83333C9.05784 0 8.3569 0.335483 7.86848 0.868484L20.3333 13.3333ZM16.5267 13.3333L7.16667 3.97333V13.3333H16.5267Z"
85
+ />
86
+ </>
87
+ ),
88
+ north_east: (
89
+ <path d="M4.69999 19.3C4.51665 19.1167 4.42499 18.8833 4.42499 18.6C4.42499 18.3167 4.51665 18.0833 4.69999 17.9L15.6 7H9.99999C9.71665 7 9.47915 6.90417 9.28749 6.7125C9.09582 6.52083 8.99999 6.28333 8.99999 6C8.99999 5.71667 9.09582 5.47917 9.28749 5.2875C9.47915 5.09583 9.71665 5 9.99999 5H18C18.2833 5 18.5208 5.09583 18.7125 5.2875C18.9042 5.47917 19 5.71667 19 6V14C19 14.2833 18.9042 14.5208 18.7125 14.7125C18.5208 14.9042 18.2833 15 18 15C17.7167 15 17.4792 14.9042 17.2875 14.7125C17.0958 14.5208 17 14.2833 17 14V8.4L6.09999 19.3C5.91665 19.4833 5.68332 19.575 5.39999 19.575C5.11665 19.575 4.88332 19.4833 4.69999 19.3Z" />
90
+ ),
91
+ seat: (
92
+ <path d="M7.59 5.41012C6.81 4.63012 6.81 3.36012 7.59 2.58012C8.37 1.80012 9.64 1.80012 10.42 2.58012C11.2 3.36012 11.2 4.63012 10.42 5.41012C9.63 6.20012 8.37 6.20012 7.59 5.41012ZM6 16.0001V8.00012C6 7.45012 5.55 7.00012 5 7.00012C4.45 7.00012 4 7.45012 4 8.00012V16.0001C4 18.7601 6.24 21.0001 9 21.0001H14C14.55 21.0001 15 20.5501 15 20.0001C15 19.4501 14.55 19.0001 14 19.0001H9C7.34 19.0001 6 17.6601 6 16.0001ZM19.28 19.3501L15.51 15.5801C15.14 15.2101 14.63 15.0001 14.1 15.0001H11.5V11.3201C12.59 12.2101 14.16 13.0201 15.7 13.3401C16.37 13.4801 17 12.9801 17 12.3001C17 11.7701 16.61 11.3401 16.08 11.2501C14.66 11.0101 13.2 10.2401 12.33 9.28012L10.93 7.73012C10.74 7.52012 10.5 7.35012 10.24 7.23012C9.95 7.09012 9.62 7.00012 9.28 7.00012H9.25C8.01 7.00012 7 8.01012 7 9.25012V15.0001C7 16.6601 8.34 18.0001 10 18.0001H15.07L17.85 20.7801C18.24 21.1701 18.89 21.1701 19.28 20.7801C19.68 20.3901 19.68 19.7501 19.28 19.3501Z" />
93
+ ),
94
+ seat_paid_indicator: (
95
+ <path d="M11.7686 0.731368C12.7766 -0.276576 14.5 0.437294 14.5 1.86274V10.8C14.5 12.5673 13.0673 14 11.3 14H2.36274C0.937294 14 0.223427 12.2766 1.23137 11.2686L11.7686 0.731368Z" />
96
+ ),
97
+ shield_with_moon: (
98
+ <path d="M12.525 15.75C13.0814 15.75 13.6269 15.6408 14.1615 15.4222C14.6961 15.2036 15.166 14.8757 15.5711 14.4385C15.6749 14.3244 15.7032 14.2033 15.6557 14.0751C15.6083 13.9469 15.5077 13.8629 15.3538 13.8232C14.7269 13.6783 14.1477 13.4183 13.6163 13.0433C13.0849 12.6683 12.6474 12.1789 12.3038 11.5751C11.9769 11.0046 11.7682 10.393 11.6778 9.74048C11.5874 9.08791 11.6589 8.45458 11.8923 7.84048C11.9525 7.68663 11.9301 7.55586 11.8249 7.44817C11.7198 7.34049 11.5916 7.30332 11.4403 7.33665C10.4442 7.59177 9.65927 8.1142 9.08555 8.90395C8.51185 9.69368 8.225 10.5591 8.225 11.5001C8.225 12.6796 8.64519 13.6828 9.48558 14.5097C10.3259 15.3366 11.3391 15.75 12.525 15.75ZM12 21.4808C9.83716 20.8911 8.04646 19.618 6.62787 17.6616C5.20929 15.7052 4.5 13.518 4.5 11.1001V5.34625L12 2.53857L19.5 5.34625V11.1001C19.5 13.518 18.7907 15.7052 17.3721 17.6616C15.9535 19.618 14.1628 20.8911 12 21.4808ZM12 19.9001C13.7333 19.3501 15.1666 18.2501 16.3 16.6001C17.4333 14.9501 18 13.1167 18 11.1001V6.37507L12 4.1347L5.99997 6.37507V11.1001C5.99997 13.1167 6.56664 14.9501 7.69997 16.6001C8.83331 18.2501 10.2666 19.3501 12 19.9001Z" />
99
+ ),
100
+ stairs: (
101
+ <path d="M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M18,8h-2.42v3.33H13v3.33h-2.58 V18H6v-2h2.42v-3.33H11V9.33h2.58V6H18V8z" />
102
+ ),
103
+ wifi: (
104
+ <path d="M2.83333 9.50005L4.49999 11.1667C8.64166 7.02505 15.3583 7.02505 19.5 11.1667L21.1667 9.50005C16.1083 4.44172 7.89999 4.44172 2.83333 9.50005ZM9.49999 16.1667L12 18.6667L14.5 16.1667C13.125 14.7834 10.8833 14.7834 9.49999 16.1667ZM6.16666 12.8334L7.83333 14.5C10.1333 12.2 13.8667 12.2 16.1667 14.5L17.8333 12.8334C14.6167 9.61672 9.39166 9.61672 6.16666 12.8334Z" />
105
+ ),
106
+ };
107
+ /* eslint-enable */
108
+
109
+ export type IconName = keyof typeof ICON_MAP;
110
+
111
+ const getIconPath = (name: IconName) => {
112
+ if (!(name in ICON_MAP)) {
113
+ log(`The icon "${name}" is missing from ICON_MAP`);
114
+ return null;
115
+ }
116
+ return ICON_MAP[name];
117
+ };
118
+
119
+ interface IconProps {
120
+ name: IconName;
121
+ className?: string;
122
+ size?: number;
123
+ onClick?: (event: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
124
+
125
+ ml?: string;
126
+ viewBox?: string;
127
+ style?: React.CSSProperties;
128
+ }
129
+
130
+ export const Icon: React.FunctionComponent<IconProps> = ({
131
+ name,
132
+ size,
133
+ className,
134
+ viewBox,
135
+ style,
136
+ }) => (
137
+ <svg
138
+ className={className}
139
+ width={size || 24}
140
+ height={size || 24}
141
+ viewBox={viewBox || "0 0 24 24"}
142
+ aria-label={name}
143
+ data-testid={name}
144
+ style={{
145
+ display: "block",
146
+ fill: "currentColor",
147
+ ...style,
148
+ }}
149
+ >
150
+ {getIconPath(name)}
151
+ </svg>
152
+ );
@@ -0,0 +1,42 @@
1
+ import classNames from "classnames";
2
+ import * as React from "react";
3
+ import { Icon, IconName } from "./Icon";
4
+
5
+ const ICON_BUTTON_VARIANTS = {
6
+ primary: "icon-button--primary",
7
+ outlined: "icon-button--outlined",
8
+ };
9
+
10
+ type IconButtonVariants = keyof typeof ICON_BUTTON_VARIANTS;
11
+
12
+ type NativeButtonProps = React.DetailedHTMLProps<
13
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
14
+ HTMLButtonElement
15
+ >;
16
+
17
+ export interface IconButtonProps
18
+ extends Pick<NativeButtonProps, "id" | "onClick" | "disabled" | "className"> {
19
+ "data-testid"?: string;
20
+ icon: IconName;
21
+ title: string;
22
+ variant?: IconButtonVariants;
23
+ }
24
+
25
+ export const IconButton: React.FC<IconButtonProps> = ({
26
+ icon,
27
+ variant = "primary",
28
+ className,
29
+ ...nativeButtonProps
30
+ }) => (
31
+ <button
32
+ type="button"
33
+ className={classNames(
34
+ "icon-button",
35
+ ICON_BUTTON_VARIANTS[variant],
36
+ className
37
+ )}
38
+ {...nativeButtonProps}
39
+ >
40
+ <Icon name={icon} />
41
+ </button>
42
+ );
@@ -0,0 +1,40 @@
1
+ import { setBodyScrollability } from "@lib/setBodyScrollability";
2
+ import classNames from "classnames";
3
+ import * as React from "react";
4
+ import { IconButton } from "./IconButton";
5
+
6
+ interface ModalProps {
7
+ onClose: () => void;
8
+ isOpen: boolean;
9
+ children: React.ReactNode;
10
+ }
11
+
12
+ export const Modal: React.FC<ModalProps> = ({ children, onClose, isOpen }) => {
13
+ React.useEffect(() => {
14
+ setBodyScrollability(!isOpen);
15
+ return () => setBodyScrollability(true);
16
+ }, [isOpen]);
17
+
18
+ return (
19
+ <div
20
+ className={classNames("modal", isOpen && "modal--open")}
21
+ // setting inline style to avoid modal content to flash unstyled before stylesheet is loaded
22
+ style={{ opacity: 0 }}
23
+ >
24
+ <div role="presentation" className={"modal--content"}>
25
+ {children}
26
+
27
+ <IconButton
28
+ icon="close"
29
+ onClick={onClose}
30
+ title="Close modal"
31
+ className="modal--close-button"
32
+ />
33
+ </div>
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export const ModalBody: React.FC<{ children: React.ReactNode }> = ({
39
+ children,
40
+ }) => <div className={"modal-body"}>{children}</div>;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+
3
+ export const NonIdealState: React.FC<
4
+ React.PropsWithChildren<{ style?: React.CSSProperties }>
5
+ > = ({ style, children }) => (
6
+ <div
7
+ style={{
8
+ display: "flex",
9
+ alignItems: "center",
10
+ justifyContent: "center",
11
+ border: "dashed 1px var(--GREY-300)",
12
+ borderRadius: "4px",
13
+ paddingBlock: "32px",
14
+ ...style,
15
+ }}
16
+ >
17
+ <div
18
+ style={{
19
+ display: "flex",
20
+ flexDirection: "column",
21
+ alignItems: "center",
22
+ maxWidth: "470px",
23
+ }}
24
+ >
25
+ {children}
26
+ </div>
27
+ </div>
28
+ );
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+
3
+ export interface StampProps {
4
+ backgroundColor: React.CSSProperties["backgroundColor"];
5
+ color: React.CSSProperties["color"];
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ export const Stamp: React.FC<StampProps> = ({
10
+ backgroundColor,
11
+ color,
12
+ children,
13
+ }) => (
14
+ <div
15
+ style={{
16
+ backgroundColor,
17
+ color,
18
+ padding: "2px 8px",
19
+ whiteSpace: "nowrap",
20
+ borderRadius: "4px",
21
+ fontWeight: "600",
22
+ fontSize: "14px",
23
+ lineHeight: "20px",
24
+ textAlign: "center",
25
+ }}
26
+ >
27
+ {children}
28
+ </div>
29
+ );
@@ -0,0 +1,36 @@
1
+ import classNames from "classnames";
2
+ import React from "react";
3
+
4
+ export interface TabsProps {
5
+ /**
6
+ * The currently selected tab option
7
+ */
8
+ value: string;
9
+
10
+ /**
11
+ * Callback for when a new tab option is selected
12
+ */
13
+ onChange: (value: string) => void;
14
+
15
+ /**
16
+ * The options you want to render on the tabs
17
+ */
18
+ options: string[];
19
+ }
20
+
21
+ export const Tabs: React.FC<TabsProps> = ({ value, onChange, options }) => (
22
+ <div className="seat-map__tab-select">
23
+ {options.map((option) => (
24
+ <button
25
+ key={option}
26
+ type="button"
27
+ className={classNames("seat-map__tab-select-option", {
28
+ "seat-map__tab-select-option--selected": option === value,
29
+ })}
30
+ onClick={() => value !== option && onChange(option)}
31
+ >
32
+ {option}
33
+ </button>
34
+ ))}
35
+ </div>
36
+ );
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is one of the entry points for the library -- `@duffel/components/custom-elements`.
3
+ * If you'd like to expose other custom element functions, please add them here.
4
+ */
5
+ export {
6
+ onDuffelAncillariesPayloadReady,
7
+ renderDuffelAncillariesCustomElement,
8
+ } from "./components/DuffelAncillaries/DuffelAncillariesCustomElement";
9
+ export {
10
+ onDuffelPaymentsFailedPayment,
11
+ onDuffelPaymentsSuccessfulPayment,
12
+ renderDuffelPaymentsCustomElement,
13
+ } from "./components/DuffelPayments/DuffelPaymentsCustomElement";