@duffel/components 3.1.3--prototype.4 → 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 -3
  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,20 +0,0 @@
1
- import { OfferAvailableService } from "../types/Offer";
2
-
3
- export type ServicePriceMapById = Record<
4
- OfferAvailableService["id"],
5
- Pick<OfferAvailableService, "total_amount" | "total_currency">
6
- >;
7
-
8
- export const getServicePriceMapById = (
9
- availableServices: OfferAvailableService[]
10
- ): ServicePriceMapById =>
11
- availableServices.reduce(
12
- (all, { id, total_amount, total_currency }) => ({
13
- [id]: {
14
- total_amount,
15
- total_currency,
16
- },
17
- ...all,
18
- }),
19
- {} as ServicePriceMapById
20
- );
@@ -1,22 +0,0 @@
1
- import {
2
- SeatMapCabin,
3
- SeatMapCabinRowSectionElementAmenity,
4
- } from "../types/SeatMap";
5
-
6
- export const getSymbols = (
7
- cabins: SeatMapCabin[]
8
- ): Set<SeatMapCabinRowSectionElementAmenity> => {
9
- const results: Set<SeatMapCabinRowSectionElementAmenity> = new Set();
10
- for (const cabin of cabins) {
11
- for (const row of cabin.rows) {
12
- for (const section of row.sections) {
13
- for (const element of section.elements) {
14
- if (element.type !== "seat" && element.type !== "empty") {
15
- results.add(element.type);
16
- }
17
- }
18
- }
19
- }
20
- }
21
- return results;
22
- };
@@ -1,72 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- import { Offer } from "../types/Offer";
3
- import { SeatMap } from "../types/SeatMap";
4
- import { captureErrorInSentry } from "./captureErrorInSentry";
5
- import {
6
- ServicePriceMapById,
7
- getServicePriceMapById,
8
- } from "./getServicePriceMapById";
9
-
10
- export const getTotalAmountForServices = (
11
- offer: Offer,
12
- selectedServices: CreateOrderPayloadServices,
13
- seatMaps?: SeatMap[]
14
- ): number => {
15
- if (!offer || selectedServices.length === 0) return 0;
16
- const servicePriceMap = getServicePriceMapById(offer.available_services);
17
- return getTotalAmountForServicesWithPriceMap(
18
- servicePriceMap,
19
- selectedServices,
20
- seatMaps
21
- );
22
- };
23
-
24
- export const getTotalAmountForServicesWithPriceMap = (
25
- servicePriceMap: ServicePriceMapById,
26
- selectedServices: CreateOrderPayloadServices,
27
- seatMaps?: SeatMap[]
28
- ) =>
29
- selectedServices.reduce(
30
- (total, { quantity, id }) => {
31
- let newTotal = total;
32
-
33
- if (id in servicePriceMap) {
34
- newTotal += quantity * +servicePriceMap[id].total_amount;
35
- } else if (seatMaps) {
36
- newTotal += quantity * getTotalAmountFromSeatMaps(id, seatMaps);
37
- } else {
38
- captureErrorInSentry(
39
- new Error(
40
- `The service id (${id}) provided could not be found in neither the offer nor the seat maps.`
41
- )
42
- );
43
- }
44
-
45
- return newTotal;
46
- },
47
-
48
- 0
49
- );
50
-
51
- const getTotalAmountFromSeatMaps = (serviceId: string, seatMaps: SeatMap[]) => {
52
- for (const seatMap of seatMaps) {
53
- for (const cabin of seatMap.cabins) {
54
- for (const row of cabin.rows) {
55
- for (const section of row.sections) {
56
- for (const element of section.elements) {
57
- if (
58
- element.type === "seat" &&
59
- Array.isArray(element.available_services)
60
- ) {
61
- const serviceMatch = element.available_services.find(
62
- (service) => service.id === serviceId
63
- );
64
- if (serviceMatch) return +serviceMatch.total_amount;
65
- }
66
- }
67
- }
68
- }
69
- }
70
- }
71
- return 0;
72
- };
@@ -1,5 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
-
3
- export const getTotalQuantity = (
4
- fromSelectedServices: CreateOrderPayloadServices
5
- ) => fromSelectedServices.reduce((total, { quantity }) => total + quantity, 0);
@@ -1,9 +0,0 @@
1
- /*
2
- * Use relative-luminance to determine whether the color is dark enough or not.
3
- * See also: https://www.w3.org/WAI/GL/wiki/Relative_luminance
4
- */
5
- export const hasHighLuminance = (accentColor: string) => {
6
- const rgb = accentColor.split(", ").map((x) => parseInt(x));
7
- const luminance = (0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]) / 255;
8
- return luminance > 0.5;
9
- };
@@ -1,24 +0,0 @@
1
- import { Offer, OfferAvailableServiceType } from "../types/Offer";
2
- import { isBaggageService } from "./isBaggageService";
3
- import { isCancelForAnyReasonService } from "./isCancelForAnyReasonService";
4
-
5
- const checkFunctionsMap = {
6
- baggage: isBaggageService,
7
- cancel_for_any_reason: isCancelForAnyReasonService,
8
- };
9
-
10
- export const hasService = (
11
- offer: Offer | undefined,
12
- type: OfferAvailableServiceType
13
- ) => {
14
- const checkFunction = checkFunctionsMap[type];
15
- if (!checkFunction) throw new Error(`Unknown service type: ${type}`);
16
-
17
- return (
18
- offer &&
19
- Array.isArray(offer.available_services) &&
20
- offer.available_services.some(
21
- (service) => checkFunction(service) && service.maximum_quantity > 0
22
- )
23
- );
24
- };
@@ -1,35 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- import { OfferAvailableServiceBaggage } from "../types/Offer";
3
-
4
- export const hasServiceOfSameMetadataTypeAlreadyBeenSelected = (
5
- selectedServices: CreateOrderPayloadServices,
6
- segmentId: string,
7
- passengerId: string,
8
- availableService: OfferAvailableServiceBaggage
9
- ) =>
10
- selectedServices.some((selectedService) => {
11
- if (selectedService.id === availableService.id) {
12
- // if the selected service is the one on the counter, don't disable it
13
- // the max quantity will be availableService.maximum_quantity
14
- return false;
15
- } else if (
16
- selectedService.serviceInformation?.type !== "carry_on" &&
17
- selectedService.serviceInformation?.type !== "checked"
18
- ) {
19
- return false;
20
- } else if (selectedService.serviceInformation?.segmentId !== segmentId) {
21
- // if the selected service doesn't belong to the same segment, don't disable it
22
- return false;
23
- } else if (
24
- // if the selected service doesn't belong to the same passenger, don't disable it
25
- selectedService.serviceInformation?.passengerId !== passengerId
26
- ) {
27
- return false;
28
- } else {
29
- // if this service selection controller is for the same passenger and segment, disable it
30
- return (
31
- selectedService.serviceInformation?.type ===
32
- availableService.metadata.type
33
- );
34
- }
35
- });
@@ -1,8 +0,0 @@
1
- import { SeatMapCabin } from "../types/SeatMap";
2
-
3
- export const hasWings = (cabin: SeatMapCabin, rowIndex: number) =>
4
- Boolean(
5
- cabin.wings &&
6
- cabin.wings.first_row_index <= rowIndex &&
7
- cabin.wings.last_row_index >= rowIndex
8
- );
@@ -1,8 +0,0 @@
1
- import {
2
- OfferAvailableBaggageService,
3
- OfferAvailableService,
4
- } from "../types/Offer";
5
-
6
- export const isBaggageService = (
7
- service: OfferAvailableService
8
- ): service is OfferAvailableBaggageService => service.type === "baggage";
@@ -1,9 +0,0 @@
1
- import {
2
- OfferAvailableService,
3
- OfferAvailableServiceCancelForAnyReason,
4
- } from "../types/Offer";
5
-
6
- export const isCancelForAnyReasonService = (
7
- service: OfferAvailableService
8
- ): service is OfferAvailableServiceCancelForAnyReason =>
9
- service.type === "cancel_for_any_reason";
@@ -1,4 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
-
3
- export const isFixtureOfferId = (offerId: Offer["id"]): boolean =>
4
- offerId.startsWith("fixture_off_");
@@ -1,11 +0,0 @@
1
- import { CreateOrderPayload } from "../types/CreateOrderPayload";
2
-
3
- export const isPayloadComplete = (
4
- payload: Partial<CreateOrderPayload>
5
- ): payload is CreateOrderPayload =>
6
- "selected_offers" in payload &&
7
- "passengers" in payload &&
8
- "services" in payload &&
9
- "payments" in payload &&
10
- "type" in payload &&
11
- "metadata" in payload;
@@ -1,10 +0,0 @@
1
- import {
2
- SeatMapCabinRowSectionElement,
3
- SeatMapCabinRowSectionElementSeat,
4
- } from "../types/SeatMap";
5
-
6
- export function isSeatElement(
7
- element: SeatMapCabinRowSectionElement
8
- ): element is SeatMapCabinRowSectionElementSeat {
9
- return element.type === "seat";
10
- }
@@ -1,120 +0,0 @@
1
- import * as Sentry from "@sentry/browser";
2
-
3
- const MESSAGE_PREFIX = "[Duffel Ancillaries] ";
4
- const LOCAL_STORAGE_KEY = "duffel-ancillaries-logger-state";
5
- let LOG_INITIALISED = false;
6
-
7
- const storeLoggerState = (shouldLog: boolean) => {
8
- localStorage.setItem(LOCAL_STORAGE_KEY, shouldLog.toString());
9
- };
10
-
11
- const shouldLog = () => localStorage.getItem(LOCAL_STORAGE_KEY) === "true";
12
-
13
- /**
14
- * The functions in this file are used to enable logging.
15
- *
16
- * Usage:
17
- *
18
- * In your app's outermost container, import the LogContext and wrap your app in it:
19
- *
20
- * ```jsx
21
- * import { LogContext, initializeLogger } from '@lib/logging'
22
- *
23
- * const logger = initializeLogger(props.debugMode || false)
24
- *
25
- * <LogContext.Provider value={logger}>
26
- * ...
27
- * </LogContext.Provider>
28
- * ```
29
- *
30
- * Then in your components nested within the above container, import the useLog hook and use it:
31
- *
32
- * import { useLog } from '@lib/logging'
33
- *
34
- * const { log, logGroup } = useLog()
35
- * log('This is a log message')
36
- * logGroup('These messages will be grouped together', ['This is a log message', 'This is another log message'])
37
- */
38
- const initializeLogger = (debugMode: boolean): void => {
39
- storeLoggerState(debugMode);
40
- if (debugMode && !LOG_INITIALISED) {
41
- // eslint-disable-next-line
42
- console.info(
43
- MESSAGE_PREFIX,
44
- `\n\nDebug mode is enabled. Information about your setup will be printed to the console.
45
-
46
- If you do not want to enable debug mode (for example in a production environment), pass "debug: false" when initializing this component.
47
-
48
- Learn more about the Ancillaries component:
49
- http://duffel.com/docs/guides/ancillaries-component`
50
- );
51
- }
52
- LOG_INITIALISED = true;
53
- };
54
-
55
- /**
56
- * Log a message to the console. Messages will be prefixed with "[Duffel Ancillaries]".
57
- * @param message The message to print to the console.
58
- */
59
- const log = (message: any) => {
60
- if (shouldLog()) {
61
- // eslint-disable-next-line
62
- console.info(MESSAGE_PREFIX, message);
63
- } else {
64
- Sentry.addBreadcrumb({
65
- category: "log",
66
- message,
67
- });
68
- }
69
- };
70
-
71
- /**
72
- * Log a series of messages to the console inside a collapsible group.
73
- * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
74
- * @param messages An array of messages to print to the console, inside the group.
75
- */
76
- function logGroup(groupName: string, messages: any[]): void;
77
-
78
- /**
79
- * Log a series of messages to the console inside a collapsible group.
80
- * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
81
- * @param object An object to print to the console, inside the group.
82
- */
83
- function logGroup(groupName: string, object: { [key: string]: any }): void;
84
-
85
- // Overloaded function implementation.
86
- // https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads
87
- function logGroup(
88
- groupName: string,
89
- messagesOrObject: any[] | { [key: string]: any }
90
- ): void {
91
- let transformedMessagesOrObject = [];
92
- if (Array.isArray(messagesOrObject)) {
93
- transformedMessagesOrObject = messagesOrObject;
94
- } else {
95
- transformedMessagesOrObject = Object.entries(messagesOrObject).map(
96
- ([key, value]) => ({ property: key, value })
97
- );
98
- }
99
-
100
- if (shouldLog()) {
101
- // eslint-disable-next-line
102
- console.groupCollapsed(MESSAGE_PREFIX, groupName);
103
-
104
- transformedMessagesOrObject.forEach((message) => {
105
- // eslint-disable-next-line
106
- console.info(message);
107
- });
108
-
109
- // eslint-disable-next-line
110
- console.groupEnd();
111
- } else {
112
- Sentry.addBreadcrumb({
113
- category: "log.group",
114
- message: groupName,
115
- data: messagesOrObject,
116
- });
117
- }
118
- }
119
-
120
- export { initializeLogger, log, logGroup };
@@ -1,34 +0,0 @@
1
- /**
2
- * Return a function to format a number into a money amount for a given currency
3
- *
4
- * @param currency The ISO-4217 currency code to be used by the formatter
5
- */
6
- export const moneyStringFormatter = (
7
- currency: string,
8
- locale = "en-GB",
9
- options: { [option: string]: string } = {}
10
- ) => {
11
- return (value: number) => {
12
- try {
13
- const formatter = new Intl.NumberFormat(locale, {
14
- style: "currency",
15
- currency,
16
- ...options,
17
- });
18
- const numberFormatted = formatter.format(value);
19
- const signFormatted =
20
- options &&
21
- options["signDisplay"] &&
22
- (options["signDisplay"] === "always" ||
23
- (options["signDisplay"] === "exceptZero" && value !== 0))
24
- ? numberFormatted.replace(/^([+-])/, "$1 ")
25
- : numberFormatted;
26
-
27
- return signFormatted;
28
- } catch (error) {
29
- // If the currency is not supported by the browser, we return the value with the currency code.
30
- // This allows us to support made-up currencies, like "1000 Duffel Points"
31
- return `${value} ${currency}`;
32
- }
33
- };
34
- };
@@ -1,5 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
-
3
- export const offerIsExpired = (offer: Offer) => {
4
- return offer.expires_at && new Date(offer.expires_at) < new Date();
5
- };
@@ -1,56 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- import { captureErrorInSentry } from "./captureErrorInSentry";
3
- import { isErrorResponse } from "./fetchFromDuffelAPI";
4
- import { importFromOfferFixtures } from "./fetchFromFixtures";
5
- import { isFixtureOfferId } from "./isFixtureOfferId";
6
- import { retrieveOfferFromDuffelAPI } from "./retrieveOfferFromDuffelAPI";
7
-
8
- export async function retrieveOffer(
9
- offer_id: string,
10
- client_key: string | null,
11
- onError: (error: string) => void,
12
- setIsLoading: (isLoading: boolean) => void,
13
- onOfferReady: (offer: Offer) => void
14
- ) {
15
- setIsLoading(true);
16
- const useFixture = isFixtureOfferId(offer_id);
17
- offer_id = useFixture ? offer_id.replace("fixture_", "") : offer_id;
18
-
19
- if (useFixture) {
20
- return importFromOfferFixtures(offer_id).then((offer) => {
21
- setIsLoading(false);
22
- onOfferReady(offer);
23
- });
24
- }
25
-
26
- if (!client_key) {
27
- throw new Error(
28
- "Attempted to retrieve seat maps but the client key is missing."
29
- );
30
- }
31
-
32
- try {
33
- const data = await retrieveOfferFromDuffelAPI(offer_id, client_key);
34
- onOfferReady(data);
35
- } catch (error) {
36
- let message = "An unknown error occurred while retrieving the offer.";
37
- if (error instanceof Error) {
38
- message = error.message;
39
- if (error.message.includes("Load failed")) {
40
- message = "The Duffel API is not available. Please try again later.";
41
- }
42
- } else if (isErrorResponse(error)) {
43
- if (error.status === 404) {
44
- message =
45
- "The offer you are looking for does not exist or has expired.";
46
- }
47
- }
48
-
49
- if (isErrorResponse(error) && error.status >= 500 && error.status < 600) {
50
- captureErrorInSentry(new Error(message));
51
- }
52
- onError(message);
53
- } finally {
54
- setIsLoading(false);
55
- }
56
- }
@@ -1,13 +0,0 @@
1
- import { fetchFromDuffelAPI } from "./fetchFromDuffelAPI";
2
-
3
- export async function retrieveOfferFromDuffelAPI(
4
- offer_id: string,
5
- client_key: string
6
- ) {
7
- const getOfferResponse = await fetchFromDuffelAPI(
8
- client_key,
9
- `offers/${offer_id}?return_available_services=true`
10
- );
11
-
12
- return getOfferResponse.data;
13
- }
@@ -1,55 +0,0 @@
1
- import { SeatMap } from "../types/SeatMap";
2
- import { captureErrorInSentry } from "./captureErrorInSentry";
3
- import { isErrorResponse } from "./fetchFromDuffelAPI";
4
- import { importFromSeatMapsFixtures } from "./fetchFromFixtures";
5
- import { isFixtureOfferId } from "./isFixtureOfferId";
6
- import { retrieveSeatMapsFromDuffelAPI } from "./retrieveSeatMapsFromDuffelAPI";
7
-
8
- export async function retrieveSeatMaps(
9
- offer_id: string,
10
- client_key: string | null,
11
- onError: () => void,
12
- setIsLoading: (isLoading: boolean) => void,
13
- onSeatMapReady: (seatMaps: SeatMap[]) => void
14
- ) {
15
- setIsLoading(true);
16
-
17
- const useFixture = isFixtureOfferId(offer_id);
18
- offer_id = useFixture ? offer_id.replace("fixture_", "") : offer_id;
19
-
20
- if (useFixture) {
21
- return importFromSeatMapsFixtures(offer_id).then((seatMaps) => {
22
- setIsLoading(false);
23
- onSeatMapReady(seatMaps);
24
- });
25
- }
26
-
27
- if (!client_key) {
28
- throw new Error(
29
- "Attemptted to retrieve seat maps but the client key is missing."
30
- );
31
- }
32
-
33
- try {
34
- const data = await retrieveSeatMapsFromDuffelAPI(offer_id, client_key);
35
- onSeatMapReady(data);
36
- } catch (error) {
37
- let message = "An unknown error occurred while retrieving the seat maps.";
38
-
39
- if (error instanceof Error) {
40
- message = error.message;
41
- if (error.message.includes("Load failed")) {
42
- message = "The Duffel API is not available. Please try again later.";
43
- }
44
- } else if (isErrorResponse(error)) {
45
- message =
46
- error.data.errors[0]?.message ||
47
- "Received an unknown error from the Duffel API.";
48
- }
49
-
50
- captureErrorInSentry(new Error(message));
51
- onError();
52
- } finally {
53
- setIsLoading(false);
54
- }
55
- }
@@ -1,13 +0,0 @@
1
- import { fetchFromDuffelAPI } from "./fetchFromDuffelAPI";
2
-
3
- export async function retrieveSeatMapsFromDuffelAPI(
4
- offer_id: string,
5
- client_key: string
6
- ) {
7
- const getSeatMapResponse = await fetchFromDuffelAPI(
8
- client_key,
9
- `offers/${offer_id}/seat_maps`
10
- );
11
-
12
- return getSeatMapResponse.data;
13
- }
@@ -1,7 +0,0 @@
1
- export const setBodyScrollability = (shouldScroll: boolean) => {
2
- if (shouldScroll) {
3
- document.body.style.overflow = "";
4
- } else {
5
- document.body.style.overflow = "hidden";
6
- }
7
- };
@@ -1,37 +0,0 @@
1
- import {
2
- DuffelAncillariesProps,
3
- DuffelAncillariesPropsWithClientKeyAndOfferId,
4
- DuffelAncillariesPropsWithOfferIdForFixture,
5
- DuffelAncillariesPropsWithOffersAndSeatMaps,
6
- DuffelAncillariesPropWithOfferAndClientKey,
7
- } from "../types/DuffelAncillariesProps";
8
-
9
- export const areDuffelAncillariesPropsValid = (props: DuffelAncillariesProps) =>
10
- hasCommonRequiredProps(props) &&
11
- (isDuffelAncillariesPropsWithOfferIdForFixture(props) ||
12
- isDuffelAncillariesPropsWithClientKeyAndOfferId(props) ||
13
- isDuffelAncillariesPropsWithOfferAndSeatMaps(props) ||
14
- isDuffelAncillariesPropsWithOfferAndClientKey(props));
15
-
16
- export const hasCommonRequiredProps = (props: DuffelAncillariesProps) =>
17
- "onPayloadReady" in props && "passengers" in props && "services" in props;
18
-
19
- export const isDuffelAncillariesPropsWithOfferIdForFixture = (
20
- props: DuffelAncillariesProps
21
- ): props is DuffelAncillariesPropsWithOfferIdForFixture =>
22
- "offer_id" in props && props.offer_id.startsWith("fixture_");
23
-
24
- export const isDuffelAncillariesPropsWithClientKeyAndOfferId = (
25
- props: DuffelAncillariesProps
26
- ): props is DuffelAncillariesPropsWithClientKeyAndOfferId =>
27
- "offer_id" in props && "client_key" in props;
28
-
29
- export const isDuffelAncillariesPropsWithOfferAndSeatMaps = (
30
- props: DuffelAncillariesProps
31
- ): props is DuffelAncillariesPropsWithOffersAndSeatMaps =>
32
- "offer" in props && "seat_maps" in props;
33
-
34
- export const isDuffelAncillariesPropsWithOfferAndClientKey = (
35
- props: DuffelAncillariesProps
36
- ): props is DuffelAncillariesPropWithOfferAndClientKey =>
37
- "offer" in props && "client_key" in props;
@@ -1,8 +0,0 @@
1
- export const withPlural = (
2
- totalQuantity: number,
3
- singular: string,
4
- plural: string
5
- ) => {
6
- if (totalQuantity == 1) return `${totalQuantity} ${singular}`;
7
- else return `${totalQuantity} ${plural}`;
8
- };
@@ -1,21 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { BaggageSelectionModalHeader } from "../components/DuffelAncillaries/bags/BaggageSelectionModalHeader";
3
- import { OfferSliceSegment } from "../types/Offer";
4
- // eslint-disable-next-line @typescript-eslint/no-var-requires
5
- const offer = require("../fixtures/offers/off_0000AUde3KwTztSRK1cznH.json");
6
-
7
- export default {
8
- title: "BaggageSelectionModalHeader",
9
- component: BaggageSelectionModalHeader,
10
- } as Meta;
11
-
12
- type Story = StoryObj<typeof BaggageSelectionModalHeader>;
13
-
14
- export const FirstStory: Story = {
15
- args: {
16
- segmentCount: 2,
17
- currentSegmentIndex: 0,
18
- currentSegment: offer.slices[0].segments[0] as OfferSliceSegment,
19
- setCurrentSegmentIndex: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function
20
- },
21
- };