@duffel/components 2.7.20 → 3.0.1-canary

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 (326) hide show
  1. package/.circleci/config.yml +67 -0
  2. package/.eslintrc.js +34 -0
  3. package/.github/renovate.json +16 -0
  4. package/.github/workflows/autoapprove.yml +18 -0
  5. package/.github/workflows/release.yml +86 -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 +48133 -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 +131 -0
  16. package/README.md +4 -21
  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 +14 -0
  21. package/config/esbuild.cdn.config.js +50 -0
  22. package/config/esbuild.dev.config.js +45 -0
  23. package/config/esbuild.react.config.js +42 -0
  24. package/jest.config.ts +14 -0
  25. package/package.json +123 -192
  26. package/react-dist/components/AnimatedLoaderEllipsis.d.ts +2 -0
  27. package/react-dist/components/Button.d.ts +23 -0
  28. package/react-dist/components/Card.d.ts +14 -0
  29. package/react-dist/components/Counter.d.ts +10 -0
  30. package/react-dist/components/DuffelAncillaries.d.ts +3 -0
  31. package/react-dist/components/DuffelAncillariesCustomElement.d.ts +13 -0
  32. package/react-dist/components/ErrorBoundary.d.ts +13 -0
  33. package/react-dist/components/FetchOfferErrorState.d.ts +5 -0
  34. package/react-dist/components/Icon.d.ts +44 -0
  35. package/react-dist/components/IconButton.d.ts +16 -0
  36. package/react-dist/components/Modal.d.ts +11 -0
  37. package/react-dist/components/NonIdealState.d.ts +4 -0
  38. package/react-dist/components/Stamp.d.ts +7 -0
  39. package/react-dist/components/Tabs.d.ts +16 -0
  40. package/react-dist/components/bags/BaggageSelectionCard.d.ts +11 -0
  41. package/react-dist/components/bags/BaggageSelectionController.d.ts +13 -0
  42. package/react-dist/components/bags/BaggageSelectionModal.d.ts +11 -0
  43. package/react-dist/components/bags/BaggageSelectionModalBody.d.ts +11 -0
  44. package/react-dist/components/bags/BaggageSelectionModalBodyPassenger.d.ts +13 -0
  45. package/react-dist/components/bags/BaggageSelectionModalFooter.d.ts +14 -0
  46. package/react-dist/components/bags/BaggageSelectionModalHeader.d.ts +9 -0
  47. package/react-dist/components/bags/IncludedBaggageBanner.d.ts +7 -0
  48. package/react-dist/components/cancel_for_any_reason/CfarSelectionCard.d.ts +10 -0
  49. package/react-dist/components/cancel_for_any_reason/CfarSelectionModal.d.ts +11 -0
  50. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBody.d.ts +7 -0
  51. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
  52. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +11 -0
  53. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
  54. package/react-dist/components/seats/Amenity.d.ts +6 -0
  55. package/react-dist/components/seats/DeckSelect.d.ts +15 -0
  56. package/react-dist/components/seats/Element.d.ts +15 -0
  57. package/react-dist/components/seats/EmptyElement.d.ts +2 -0
  58. package/react-dist/components/seats/ExitElement.d.ts +6 -0
  59. package/react-dist/components/seats/Legend.d.ts +12 -0
  60. package/react-dist/components/seats/Row.d.ts +13 -0
  61. package/react-dist/components/seats/RowSection.d.ts +17 -0
  62. package/react-dist/components/seats/SeatElement.d.ts +13 -0
  63. package/react-dist/components/seats/SeatInfo.d.ts +7 -0
  64. package/react-dist/components/seats/SeatMap.d.ts +12 -0
  65. package/react-dist/components/seats/SeatMapUnavailable.d.ts +2 -0
  66. package/react-dist/components/seats/SeatSelectionCard.d.ts +13 -0
  67. package/react-dist/components/seats/SeatSelectionModal.d.ts +13 -0
  68. package/react-dist/components/seats/SeatSelectionModalBody.d.ts +4 -0
  69. package/react-dist/components/seats/SeatSelectionModalFooter.d.ts +16 -0
  70. package/react-dist/components/seats/SeatSelectionModalHeader.d.ts +10 -0
  71. package/react-dist/components/seats/SeatUnavailable.d.ts +5 -0
  72. package/react-dist/index.d.ts +8 -0
  73. package/react-dist/index.js +2 -0
  74. package/react-dist/index.js.map +7 -0
  75. package/react-dist/lib/captureErrorInSentry.d.ts +1 -0
  76. package/react-dist/lib/compileCreateOrderPayload.d.ts +14 -0
  77. package/react-dist/lib/createPriceFormatters.d.ts +12 -0
  78. package/react-dist/lib/fetchFromDuffelAPI.d.ts +1 -0
  79. package/react-dist/lib/fetchFromFixtures.d.ts +4 -0
  80. package/react-dist/lib/formatAvailableServices.d.ts +12 -0
  81. package/react-dist/lib/formatDate.d.ts +2 -0
  82. package/react-dist/lib/formatSeatMaps.d.ts +4 -0
  83. package/react-dist/lib/getBaggageServiceDescription.d.ts +2 -0
  84. package/react-dist/lib/getCabinsForSegmentAndDeck.d.ts +2 -0
  85. package/react-dist/lib/getCurrencyForSeatMaps.d.ts +10 -0
  86. package/react-dist/lib/getCurrencyForServices.d.ts +11 -0
  87. package/react-dist/lib/getFirstSeatElementMatchingCriteria.d.ts +3 -0
  88. package/react-dist/lib/getPassengerBySegmentList.d.ts +6 -0
  89. package/react-dist/lib/getPassengerInitials.d.ts +1 -0
  90. package/react-dist/lib/getPassengerMapById.d.ts +3 -0
  91. package/react-dist/lib/getPassengerName.d.ts +3 -0
  92. package/react-dist/lib/getRowNumber.d.ts +2 -0
  93. package/react-dist/lib/getSegmentList.d.ts +2 -0
  94. package/react-dist/lib/getServicePriceMapById.d.ts +3 -0
  95. package/react-dist/lib/getSymbols.d.ts +2 -0
  96. package/react-dist/lib/getTotalAmountForServices.d.ts +6 -0
  97. package/react-dist/lib/getTotalQuantity.d.ts +2 -0
  98. package/react-dist/lib/hasService.d.ts +2 -0
  99. package/react-dist/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +3 -0
  100. package/react-dist/lib/hasWings.d.ts +2 -0
  101. package/react-dist/lib/isBaggageService.d.ts +2 -0
  102. package/react-dist/lib/isCancelForAnyReasonService.d.ts +2 -0
  103. package/react-dist/lib/isFixtureOfferId.d.ts +2 -0
  104. package/react-dist/lib/isPayloadComplete.d.ts +2 -0
  105. package/react-dist/lib/isSeatElement.d.ts +2 -0
  106. package/react-dist/lib/logging.d.ts +53 -0
  107. package/react-dist/lib/moneyStringFormatter.d.ts +8 -0
  108. package/react-dist/lib/offerIsExpired.d.ts +2 -0
  109. package/react-dist/lib/retrieveOffer.d.ts +2 -0
  110. package/react-dist/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
  111. package/react-dist/lib/retrieveSeatMaps.d.ts +2 -0
  112. package/react-dist/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
  113. package/react-dist/lib/setBodyScrollability.d.ts +1 -0
  114. package/react-dist/lib/validateProps.d.ts +7 -0
  115. package/react-dist/lib/withPlural.d.ts +1 -0
  116. package/react-dist/types/Aircraft.d.ts +14 -0
  117. package/react-dist/types/Airline.d.ts +14 -0
  118. package/react-dist/types/Airport.d.ts +44 -0
  119. package/react-dist/types/City.d.ts +18 -0
  120. package/react-dist/types/CreateOrderPayload.d.ts +72 -0
  121. package/react-dist/types/CurrencyConversion.d.ts +10 -0
  122. package/react-dist/types/DuffelAncillariesProps.d.ts +70 -0
  123. package/react-dist/types/Offer.d.ts +711 -0
  124. package/react-dist/types/Order.d.ts +8 -0
  125. package/react-dist/types/Place.d.ts +8 -0
  126. package/react-dist/types/SeatMap.d.ts +190 -0
  127. package/react-dist/types/index.d.ts +11 -0
  128. package/scripts/generate-fixture.ts +195 -0
  129. package/scripts/upload-to-cdn.sh +39 -0
  130. package/scripts.tsconfig.json +11 -0
  131. package/src/components/AnimatedLoaderEllipsis.tsx +5 -0
  132. package/src/components/Button.tsx +62 -0
  133. package/src/components/Card.tsx +126 -0
  134. package/src/components/Counter.tsx +40 -0
  135. package/src/components/DuffelAncillaries.tsx +346 -0
  136. package/src/components/DuffelAncillariesCustomElement.tsx +124 -0
  137. package/src/components/ErrorBoundary.tsx +54 -0
  138. package/src/components/FetchOfferErrorState.tsx +35 -0
  139. package/src/components/Icon.tsx +151 -0
  140. package/src/components/IconButton.tsx +42 -0
  141. package/src/components/Modal.tsx +36 -0
  142. package/src/components/NonIdealState.tsx +28 -0
  143. package/src/components/Stamp.tsx +29 -0
  144. package/src/components/Tabs.tsx +36 -0
  145. package/src/components/bags/BaggageSelectionCard.tsx +96 -0
  146. package/src/components/bags/BaggageSelectionController.tsx +88 -0
  147. package/src/components/bags/BaggageSelectionModal.tsx +81 -0
  148. package/src/components/bags/BaggageSelectionModalBody.tsx +60 -0
  149. package/src/components/bags/BaggageSelectionModalBodyPassenger.tsx +122 -0
  150. package/src/components/bags/BaggageSelectionModalFooter.tsx +81 -0
  151. package/src/components/bags/BaggageSelectionModalHeader.tsx +76 -0
  152. package/src/components/bags/IncludedBaggageBanner.tsx +51 -0
  153. package/src/components/cancel_for_any_reason/CfarSelectionCard.tsx +90 -0
  154. package/src/components/cancel_for_any_reason/CfarSelectionModal.tsx +63 -0
  155. package/src/components/cancel_for_any_reason/CfarSelectionModalBody.tsx +56 -0
  156. package/src/components/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +11 -0
  157. package/src/components/cancel_for_any_reason/CfarSelectionModalFooter.tsx +74 -0
  158. package/src/components/cancel_for_any_reason/CfarSelectionModalHeader.tsx +9 -0
  159. package/src/components/seats/Amenity.tsx +21 -0
  160. package/src/components/seats/DeckSelect.tsx +27 -0
  161. package/src/components/seats/Element.tsx +52 -0
  162. package/src/components/seats/EmptyElement.tsx +5 -0
  163. package/src/components/seats/ExitElement.tsx +17 -0
  164. package/src/components/seats/Legend.tsx +60 -0
  165. package/src/components/seats/Row.tsx +47 -0
  166. package/src/components/seats/RowSection.tsx +75 -0
  167. package/src/components/seats/SeatElement.tsx +120 -0
  168. package/src/components/seats/SeatInfo.tsx +32 -0
  169. package/src/components/seats/SeatMap.tsx +81 -0
  170. package/src/components/seats/SeatMapUnavailable.tsx +21 -0
  171. package/src/components/seats/SeatSelectionCard.tsx +103 -0
  172. package/src/components/seats/SeatSelectionModal.tsx +142 -0
  173. package/src/components/seats/SeatSelectionModalBody.tsx +13 -0
  174. package/src/components/seats/SeatSelectionModalFooter.tsx +82 -0
  175. package/src/components/seats/SeatSelectionModalHeader.tsx +87 -0
  176. package/src/components/seats/SeatUnavailable.tsx +14 -0
  177. package/src/examples/client-side/index.html +57 -0
  178. package/src/examples/full-stack/index.html +48 -0
  179. package/src/examples/full-stack/server.mjs +157 -0
  180. package/src/examples/just-typescript/README.md +37 -0
  181. package/src/examples/just-typescript/package.json +16 -0
  182. package/src/examples/just-typescript/src/index.html +23 -0
  183. package/src/examples/just-typescript/src/index.ts +35 -0
  184. package/src/examples/just-typescript/yarn.lock +154 -0
  185. package/src/examples/react-app/README.md +37 -0
  186. package/src/examples/react-app/package.json +20 -0
  187. package/src/examples/react-app/src/index.html +19 -0
  188. package/src/examples/react-app/src/index.tsx +43 -0
  189. package/src/examples/react-app/yarn.lock +219 -0
  190. package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +497 -0
  191. package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +307 -0
  192. package/src/fixtures/offers/off_1.json +497 -0
  193. package/src/fixtures/passengers/mock_passengers.ts +26 -0
  194. package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +6852 -0
  195. package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +1 -0
  196. package/src/fixtures/seat-maps/off_1.json +6852 -0
  197. package/src/index.ts +8 -0
  198. package/src/lib/captureErrorInSentry.ts +60 -0
  199. package/src/lib/compileCreateOrderPayload.ts +63 -0
  200. package/src/lib/createPriceFormatters.ts +73 -0
  201. package/src/lib/fetchFromDuffelAPI.ts +24 -0
  202. package/src/lib/fetchFromFixtures.ts +18 -0
  203. package/src/lib/formatAvailableServices.ts +91 -0
  204. package/src/lib/formatDate.ts +21 -0
  205. package/src/lib/formatSeatMaps.ts +81 -0
  206. package/src/lib/getBaggageServiceDescription.ts +44 -0
  207. package/src/lib/getCabinsForSegmentAndDeck.ts +4 -0
  208. package/src/lib/getCurrencyForSeatMaps.ts +22 -0
  209. package/src/lib/getCurrencyForServices.ts +24 -0
  210. package/src/lib/getFirstSeatElementMatchingCriteria.ts +22 -0
  211. package/src/lib/getPassengerBySegmentList.ts +10 -0
  212. package/src/lib/getPassengerInitials.ts +6 -0
  213. package/src/lib/getPassengerMapById.ts +17 -0
  214. package/src/lib/getPassengerName.ts +37 -0
  215. package/src/lib/getRowNumber.ts +16 -0
  216. package/src/lib/getSegmentList.ts +7 -0
  217. package/src/lib/getServicePriceMapById.ts +20 -0
  218. package/src/lib/getSymbols.ts +22 -0
  219. package/src/lib/getTotalAmountForServices.ts +72 -0
  220. package/src/lib/getTotalQuantity.ts +5 -0
  221. package/src/lib/hasService.ts +24 -0
  222. package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +35 -0
  223. package/src/lib/hasWings.ts +8 -0
  224. package/src/lib/isBaggageService.ts +8 -0
  225. package/src/lib/isCancelForAnyReasonService.ts +9 -0
  226. package/src/lib/isFixtureOfferId.ts +4 -0
  227. package/src/lib/isPayloadComplete.ts +11 -0
  228. package/src/lib/isSeatElement.ts +10 -0
  229. package/src/lib/logging.ts +100 -0
  230. package/src/lib/moneyStringFormatter.ts +34 -0
  231. package/src/lib/offerIsExpired.ts +5 -0
  232. package/src/lib/retrieveOffer.ts +49 -0
  233. package/src/lib/retrieveOfferFromDuffelAPI.ts +13 -0
  234. package/src/lib/retrieveSeatMaps.ts +50 -0
  235. package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +13 -0
  236. package/src/lib/setBodyScrollability.ts +7 -0
  237. package/src/lib/validateProps.ts +37 -0
  238. package/src/lib/withPlural.ts +8 -0
  239. package/src/stories/BaggageSelectionModalHeader.stories.tsx +21 -0
  240. package/src/stories/Button.stories.tsx +60 -0
  241. package/src/stories/DuffelAncillaries.stories.tsx +126 -0
  242. package/src/stories/Icon.stories.tsx +34 -0
  243. package/src/stories/IconButton.stories.tsx +25 -0
  244. package/src/styles/colors.css +22 -0
  245. package/src/styles/components/Amenity.css +23 -0
  246. package/src/styles/components/BaggageDisplay.css +25 -0
  247. package/src/styles/components/Button.css +161 -0
  248. package/src/styles/components/Card.css +52 -0
  249. package/src/styles/components/CfarSelectionModal.css +34 -0
  250. package/src/styles/components/Counter.css +18 -0
  251. package/src/styles/components/IconButton.css +63 -0
  252. package/src/styles/components/Legend.css +58 -0
  253. package/src/styles/components/Loader.css +37 -0
  254. package/src/styles/components/LoadingState.css +81 -0
  255. package/src/styles/components/Modal.css +83 -0
  256. package/src/styles/components/PassengerSelect.css +93 -0
  257. package/src/styles/components/PassengersLayout.css +90 -0
  258. package/src/styles/components/Row.css +70 -0
  259. package/src/styles/components/Seat.css +57 -0
  260. package/src/styles/components/SeatInfo.css +61 -0
  261. package/src/styles/components/SeatMap.css +24 -0
  262. package/src/styles/components/SeatSelect.css +92 -0
  263. package/src/styles/components/Segment.css +17 -0
  264. package/src/styles/components/SelectionSegment.css +10 -0
  265. package/src/styles/components/Summary.css +70 -0
  266. package/src/styles/components/Tabs.css +49 -0
  267. package/src/styles/flex.css +5 -0
  268. package/src/styles/font-families.css +47 -0
  269. package/src/styles/global.css +50 -0
  270. package/src/styles/margin.css +3 -0
  271. package/src/styles/spacing.css +18 -0
  272. package/src/styles/transitions.css +3 -0
  273. package/src/styles/typography.css +13 -0
  274. package/src/tests/components/DuffelAncillaries.test.tsx +342 -0
  275. package/src/tests/lib/createPriceFormatters.test.tsx +152 -0
  276. package/src/tests/lib/formatAvailableServices.test.tsx +79 -0
  277. package/src/tests/lib/formatSeatMaps.test.tsx +49 -0
  278. package/src/tests/lib/getCurrencyForServices.test.tsx +44 -0
  279. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +86 -0
  280. package/src/tests/lib/logging.test.tsx +32 -0
  281. package/src/tests/lib/moneyStringFormatter.test.tsx +12 -0
  282. package/src/tests/lib/validateProps.test.tsx +57 -0
  283. package/src/types/Aircraft.ts +16 -0
  284. package/src/types/Airline.ts +16 -0
  285. package/src/types/Airport.ts +54 -0
  286. package/src/types/City.ts +21 -0
  287. package/src/types/CreateOrderPayload.ts +99 -0
  288. package/src/types/CurrencyConversion.ts +10 -0
  289. package/src/types/DuffelAncillariesProps.ts +108 -0
  290. package/src/types/Offer.ts +851 -0
  291. package/src/types/Order.ts +6 -0
  292. package/src/types/Place.ts +6 -0
  293. package/src/types/SeatMap.ts +231 -0
  294. package/src/types/index.ts +11 -0
  295. package/tsconfig.json +52 -0
  296. package/LICENSE +0 -21
  297. package/dist/AdditionalBaggage.esm.js +0 -1
  298. package/dist/AdditionalBaggage.js +0 -1
  299. package/dist/AdditionalBaggage.min.css +0 -408
  300. package/dist/AdditionalBaggage.umd.min.js +0 -2
  301. package/dist/AdditionalBaggage.umd.min.js.LICENSE.txt +0 -60
  302. package/dist/AdditionalBaggageSelection.esm.js +0 -1
  303. package/dist/AdditionalBaggageSelection.js +0 -1
  304. package/dist/AdditionalBaggageSelection.min.css +0 -744
  305. package/dist/AdditionalBaggageSelection.umd.min.js +0 -2
  306. package/dist/AdditionalBaggageSelection.umd.min.js.LICENSE.txt +0 -93
  307. package/dist/CardPayment.esm.js +0 -2
  308. package/dist/CardPayment.esm.js.LICENSE.txt +0 -6
  309. package/dist/CardPayment.js +0 -2
  310. package/dist/CardPayment.js.LICENSE.txt +0 -6
  311. package/dist/CardPayment.min.css +0 -233
  312. package/dist/CardPayment.umd.min.js +0 -2
  313. package/dist/CardPayment.umd.min.js.LICENSE.txt +0 -61
  314. package/dist/SeatSelection.esm.js +0 -1
  315. package/dist/SeatSelection.js +0 -1
  316. package/dist/SeatSelection.min.css +0 -1127
  317. package/dist/SeatSelection.umd.min.js +0 -2
  318. package/dist/SeatSelection.umd.min.js.LICENSE.txt +0 -60
  319. package/dist/duffel-components.d.ts +0 -1614
  320. package/dist/duffel-components.esm.js +0 -2
  321. package/dist/duffel-components.esm.js.LICENSE.txt +0 -6
  322. package/dist/duffel-components.js +0 -2
  323. package/dist/duffel-components.js.LICENSE.txt +0 -6
  324. package/dist/duffel-components.min.css +0 -1280
  325. package/dist/duffel-components.umd.min.js +0 -2
  326. package/dist/duffel-components.umd.min.js.LICENSE.txt +0 -102
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { OfferSliceSegment } from "../../types/Offer";
3
+ export interface BaggageSelectionModalHeaderProps {
4
+ segmentCount: number;
5
+ currentSegmentIndex: number;
6
+ currentSegment: OfferSliceSegment;
7
+ setCurrentSegmentIndex: (index: number) => void;
8
+ }
9
+ export declare const BaggageSelectionModalHeader: React.FC<BaggageSelectionModalHeaderProps>;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { OfferSliceSegmentPassengerBaggage } from "../../types/Offer";
3
+ interface IncludedBaggageBannerProps {
4
+ includedBaggage: OfferSliceSegmentPassengerBaggage[];
5
+ }
6
+ export declare const IncludedBaggageBanner: React.FC<IncludedBaggageBannerProps>;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
3
+ import { Offer } from "../../types/Offer";
4
+ export interface CfarSelectionCardProps {
5
+ isLoading: boolean;
6
+ offer?: Offer;
7
+ selectedServices: CreateOrderPayloadServices;
8
+ setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
9
+ }
10
+ export declare const CfarSelectionCard: React.FC<CfarSelectionCardProps>;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
3
+ import { Offer, OfferAvailableServiceCancelForAnyReason } from "../../types/Offer";
4
+ export interface CfarSelectionModalProps {
5
+ isOpen: boolean;
6
+ offerCurrency?: Offer["base_currency"];
7
+ service?: OfferAvailableServiceCancelForAnyReason;
8
+ selectedServices: CreateOrderPayloadServices;
9
+ onClose: (selectedServices: CreateOrderPayloadServices) => void;
10
+ }
11
+ export declare const CfarSelectionModal: React.FC<CfarSelectionModalProps>;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Offer, OfferAvailableServiceCancelForAnyReason } from "../../types/Offer";
3
+ export interface CfarSelectionModalBodyProps {
4
+ offerCurrency: Offer["base_currency"];
5
+ service: OfferAvailableServiceCancelForAnyReason;
6
+ }
7
+ export declare const CfarSelectionModalBody: React.FC<CfarSelectionModalBodyProps>;
@@ -0,0 +1,4 @@
1
+ import React, { ReactNode } from "react";
2
+ export declare const CfarSelectionModalBodyListItem: React.FC<{
3
+ children: ReactNode;
4
+ }>;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
3
+ import { OfferAvailableServiceCancelForAnyReason } from "../../types/Offer";
4
+ export interface CfarSelectionModalFooterProps {
5
+ service: OfferAvailableServiceCancelForAnyReason;
6
+ selectedServices: CreateOrderPayloadServices;
7
+ onAddCfarService: () => void;
8
+ onRemoveCfarService: () => void;
9
+ onClose: () => void;
10
+ }
11
+ export declare const CfarSelectionModalFooter: React.FC<CfarSelectionModalFooterProps>;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const CfarSelectionModalHeader: React.FC;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { SeatMapCabinRowSectionElementAmenity } from "../../types/SeatMap";
3
+ export interface AmenityProps {
4
+ type: SeatMapCabinRowSectionElementAmenity;
5
+ }
6
+ export declare const Amenity: React.FC<AmenityProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ export interface DeckSelectProps {
3
+ /**
4
+ * The currently selected deck number
5
+ */
6
+ value: number;
7
+ /**
8
+ * What to do when the user selects a deck
9
+ */
10
+ setValue: (value: number) => void;
11
+ }
12
+ /**
13
+ * The deck selection component for the seat map.
14
+ */
15
+ export declare const DeckSelect: React.FC<DeckSelectProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { SeatMapCabinRowSectionElement } from "../../types/SeatMap";
4
+ interface ElementProps {
5
+ sectionIndex: number;
6
+ elementIndex: number;
7
+ element: SeatMapCabinRowSectionElement;
8
+ selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
9
+ onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
10
+ currentPassengerId: string;
11
+ currentSegmentId: string;
12
+ currentPassengerName: string;
13
+ }
14
+ export declare const Element: React.FC<ElementProps>;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ export declare const EmptyElement: React.FC;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ interface ExitElementProps {
3
+ isRight: boolean;
4
+ }
5
+ export declare const ExitElement: React.FC<ExitElementProps>;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { SeatMapCabinRowSectionElementAmenity } from "../../types/SeatMap";
3
+ export interface LegendProps {
4
+ /**
5
+ * The set of additional symbols to display
6
+ */
7
+ symbols: Set<SeatMapCabinRowSectionElementAmenity>;
8
+ }
9
+ /**
10
+ * The legend for the seat map.
11
+ */
12
+ export declare const Legend: React.FC<LegendProps>;
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { SeatMapCabinRow } from "../../types/SeatMap";
4
+ export interface RowProps {
5
+ row: SeatMapCabinRow;
6
+ hasWings: boolean;
7
+ selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
8
+ onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
9
+ currentPassengerId: string;
10
+ currentPassengerName: string;
11
+ currentSegmentId: string;
12
+ }
13
+ export declare const Row: React.FC<RowProps>;
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { SeatMapCabinRow, SeatMapCabinRowSection } from "../../types/SeatMap";
4
+ interface RowSectionProps {
5
+ row: SeatMapCabinRow;
6
+ rowNumber: string | null;
7
+ hasWings: boolean;
8
+ section: SeatMapCabinRowSection;
9
+ sectionIndex: number;
10
+ selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
11
+ onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
12
+ currentPassengerId: string;
13
+ currentPassengerName: string;
14
+ currentSegmentId: string;
15
+ }
16
+ export declare const RowSection: React.FC<RowSectionProps>;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { SeatMapCabinRowSectionElementSeat } from "../../types/SeatMap";
4
+ interface SeatElementProps {
5
+ element: SeatMapCabinRowSectionElementSeat;
6
+ currentSegmentId: string;
7
+ currentPassengerId: string;
8
+ currentPassengerName: string;
9
+ onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
10
+ selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
11
+ }
12
+ export declare const SeatElement: React.FC<SeatElementProps>;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { SeatMapCabinRowSectionAvailableService, SeatMapCabinRowSectionElementSeat } from "../../types/SeatMap";
3
+ export interface SeatInfoProps {
4
+ seat: SeatMapCabinRowSectionElementSeat | null;
5
+ service: SeatMapCabinRowSectionAvailableService | undefined;
6
+ }
7
+ export declare const SeatInfo: React.FC<SeatInfoProps>;
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { SeatMap as SeatMapType } from "../../types/SeatMap";
4
+ export interface SeatMapProps {
5
+ seatMap: SeatMapType;
6
+ selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
7
+ onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
8
+ currentPassengerId: string;
9
+ currentPassengerName: string;
10
+ currentSegmentId: string;
11
+ }
12
+ export declare const SeatMap: React.FC<SeatMapProps>;
@@ -0,0 +1,2 @@
1
+ import * as React from "react";
2
+ export declare const SeatMapUnavailable: React.FC;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { CreateOrderPayload, CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
3
+ import { Offer } from "../../types/Offer";
4
+ import { SeatMap } from "../../types/SeatMap";
5
+ export interface SeatSelectionCardProps {
6
+ isLoading: boolean;
7
+ offer?: Offer;
8
+ seatMaps?: SeatMap[];
9
+ passengers: CreateOrderPayload["passengers"];
10
+ selectedServices: CreateOrderPayloadServices;
11
+ setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
12
+ }
13
+ export declare const SeatSelectionCard: React.FC<SeatSelectionCardProps>;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { CreateOrderPayload, CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
3
+ import { Offer } from "../../types/Offer";
4
+ import { SeatMap } from "../../types/SeatMap";
5
+ export interface SeatSelectionModalProps {
6
+ isOpen: boolean;
7
+ offer?: Offer;
8
+ seatMaps?: SeatMap[];
9
+ selectedServices: CreateOrderPayloadSeatService[];
10
+ passengers: CreateOrderPayload["passengers"];
11
+ onClose: (selectedServices: CreateOrderPayloadSeatService[]) => void;
12
+ }
13
+ export declare const SeatSelectionModal: React.FC<SeatSelectionModalProps>;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { SeatMapProps } from "./SeatMap";
3
+ export type SeatSelectionModalBodyProps = SeatMapProps;
4
+ export declare const SeatSelectionModalBody: React.FC<SeatSelectionModalBodyProps>;
@@ -0,0 +1,16 @@
1
+ import { ServicePriceMapById } from "@lib/getServicePriceMapById";
2
+ import React from "react";
3
+ import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
4
+ import { SeatMap } from "../../types/SeatMap";
5
+ export interface SeatSelectionModalFooterProps {
6
+ currency: string;
7
+ selectedServices: CreateOrderPayloadServices;
8
+ servicePrices: ServicePriceMapById;
9
+ isFirstSegment: boolean;
10
+ isLastSegment: boolean;
11
+ onNextSegmentButtonClicked: () => void;
12
+ onPreviousSegmentButtonClicked: () => void;
13
+ onClose: () => void;
14
+ seatMaps: SeatMap[];
15
+ }
16
+ export declare const SeatSelectionModalFooter: React.FC<SeatSelectionModalFooterProps>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { OfferSliceSegment } from "../../types/Offer";
3
+ export interface SeatSelectionModalHeaderProps {
4
+ segmentAndPassengerPermutationsCount: number;
5
+ currentSegment: OfferSliceSegment;
6
+ currentPassengerName: string;
7
+ currentSegmentAndPassengerPermutationsIndex: number;
8
+ setCurrentSegmentAndPassengerPermutationsIndex: (index: number) => void;
9
+ }
10
+ export declare const SeatSelectionModalHeader: React.FC<SeatSelectionModalHeaderProps>;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import { SeatMapCabinRowSectionElementSeat } from "../../types/SeatMap";
3
+ export declare const SeatUnavailable: React.FC<{
4
+ seat: SeatMapCabinRowSectionElementSeat;
5
+ }>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file is the entry point for the library.
3
+ * If you'd like to expose other components,
4
+ * they must be exported here.
5
+ */
6
+ export * from "./components/DuffelAncillaries";
7
+ export * from "./components/DuffelAncillariesCustomElement";
8
+ export * from "./types";
@@ -0,0 +1,2 @@
1
+ "use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var f=(p,r,e,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of b(r))!c.call(p,t)&&t!==e&&i(p,t,{get:()=>r[t],enumerable:!(x=a(r,t))||x.enumerable});return p},m=(p,r,e)=>(f(p,r,"default"),e&&f(e,r,"default"));var d=p=>f(i({},"__esModule",{value:!0}),p);var o={};module.exports=d(o);m(o,require("./components/DuffelAncillaries"),module.exports);m(o,require("./components/DuffelAncillariesCustomElement"),module.exports);m(o,require("./types"),module.exports);var h=require("/Users/igor/Duffel/duffel-components/node_modules/@sentry/bundler-plugin-core/sentry-release-injection-file.js");
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["/**\n * This file is the entry point for the library.\n * If you'd like to expose other components,\n * they must be exported here.\n */\nexport * from \"./components/DuffelAncillaries\";\nexport * from \"./components/DuffelAncillariesCustomElement\";\nexport * from \"./types\";\n;\nimport \"/Users/igor/Duffel/duffel-components/node_modules/@sentry/bundler-plugin-core/sentry-release-injection-file.js\";"],
5
+ "mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAKAE,EAAAF,EAAc,0CALd,gBAMAE,EAAAF,EAAc,uDANd,gBAOAE,EAAAF,EAAc,mBAPd,gBASA,IAAAG,EAAO",
6
+ "names": ["src_exports", "__toCommonJS", "__reExport", "import_sentry_release_injection_file"]
7
+ }
@@ -0,0 +1 @@
1
+ export declare const captureErrorInSentry: (error: Error, context?: Record<string, any>) => string;
@@ -0,0 +1,14 @@
1
+ import { CreateOrderPayload, CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
+ import { DuffelAncillariesProps } from "../types/DuffelAncillariesProps";
3
+ import { Offer } from "../types/Offer";
4
+ import { SeatMap } from "../types/SeatMap";
5
+ interface CompileCreateOrderPayloadInput {
6
+ offer: Offer;
7
+ passengers: DuffelAncillariesProps["passengers"];
8
+ baggageSelectedServices: CreateOrderPayloadServices;
9
+ seatSelectedServices: CreateOrderPayloadServices;
10
+ cfarSelectedServices: CreateOrderPayloadServices;
11
+ seatMaps?: SeatMap[];
12
+ }
13
+ export declare const compileCreateOrderPayload: ({ baggageSelectedServices, seatSelectedServices, cfarSelectedServices, offer, seatMaps, passengers, }: CompileCreateOrderPayloadInput) => Partial<CreateOrderPayload>;
14
+ export {};
@@ -0,0 +1,12 @@
1
+ import { DuffelAncillariesMarkup, DuffelAncillariesPriceFormatters } from "src/types/DuffelAncillariesProps";
2
+ /**
3
+ * Creates price formatters from the markup and priceFormatters passed in.
4
+ * Throws an error if both are supplied.
5
+ * If neither are supplied, the priceFormatters will be undefined.
6
+ *
7
+ * @param markup The markup to be applied to the prices of the available services of an offer.
8
+ * @param priceFormatters Price formatters to apply to the prices of the available services of an offer.
9
+ * @returns
10
+ */
11
+ declare const createPriceFormatters: (markup?: DuffelAncillariesMarkup, priceFormatters?: DuffelAncillariesPriceFormatters) => DuffelAncillariesPriceFormatters;
12
+ export { createPriceFormatters };
@@ -0,0 +1 @@
1
+ export declare function fetchFromDuffelAPI(withClientKey: string, path: string, method?: string, body?: string): Promise<any>;
@@ -0,0 +1,4 @@
1
+ import { Offer } from "../types/Offer";
2
+ import { SeatMap } from "../types/SeatMap";
3
+ export declare const importFromOfferFixtures: (offerId: string) => Promise<Offer>;
4
+ export declare const importFromSeatMapsFixtures: (offerId: string) => Promise<SeatMap[]>;
@@ -0,0 +1,12 @@
1
+ import { DuffelAncillariesPriceFormatters } from "../types/DuffelAncillariesProps";
2
+ import { Offer } from "../types/Offer";
3
+ /**
4
+ * Formats the prices of the available services of an offer according to the
5
+ * priceFormatters passed in.
6
+ *
7
+ * @param offer An offer from the Duffel API
8
+ * @param priceFormatters Optional price formatting functions. If not passed in, the offer will be returned unchanged.
9
+ * @returns An offer with the prices of its available services formatted according to the priceFormatters passed in.
10
+ */
11
+ declare const formatAvailableServices: (offer: Offer, priceFormatters?: DuffelAncillariesPriceFormatters) => Offer;
12
+ export { formatAvailableServices };
@@ -0,0 +1,2 @@
1
+ export declare const formatDateString: (dateString: string) => string | undefined;
2
+ export declare const formatDate: (date: Date) => string;
@@ -0,0 +1,4 @@
1
+ import { DuffelAncillariesPriceFormatterForSeats } from "../types/DuffelAncillariesProps";
2
+ import { SeatMap } from "../types/SeatMap";
3
+ declare const formatSeatMaps: (seatMaps: SeatMap[], priceFormatter?: DuffelAncillariesPriceFormatterForSeats) => SeatMap[];
4
+ export { formatSeatMaps };
@@ -0,0 +1,2 @@
1
+ import { OfferAvailableServiceBaggageMetadata } from "../types/Offer";
2
+ export declare const getBaggageServiceDescription: (metadata: OfferAvailableServiceBaggageMetadata) => string | null;
@@ -0,0 +1,2 @@
1
+ import { SeatMap } from "../types/SeatMap";
2
+ export declare const getCabinsForSegmentAndDeck: (forDeck: number, seatMap: SeatMap) => import("../types/SeatMap").SeatMapCabin[];
@@ -0,0 +1,10 @@
1
+ import { SeatMap } from "../types/SeatMap";
2
+ /**
3
+ *
4
+ * Returns the currency of the first service of the given seat maps.
5
+ *
6
+ * @param seatMaps[] Array of seat maps
7
+ * @returns A string representing the currency of the seat maps in the offer.
8
+ */
9
+ declare const getCurrencyForSeatMaps: (seatMaps: SeatMap[]) => string | undefined;
10
+ export { getCurrencyForSeatMaps };
@@ -0,0 +1,11 @@
1
+ import { Offer } from "../types/Offer";
2
+ /**
3
+ *
4
+ * Returns the currency of the first service of the given type in the offer.
5
+ *
6
+ * @param offer An offer
7
+ * @returns A string representing the currency of the services in the offer.
8
+ * @throws If there are no services, or none of the services are of the given type.
9
+ */
10
+ declare const getCurrencyForServices: (offer: Offer, serviceType: string) => string;
11
+ export { getCurrencyForServices };
@@ -0,0 +1,3 @@
1
+ import { SeatMap, SeatMapCabinRowSectionElement } from "../types/SeatMap";
2
+ declare const getFirstSeatElementMatchingCriteria: (seatMaps: SeatMap[], matcher: (element: SeatMapCabinRowSectionElement) => boolean) => SeatMapCabinRowSectionElement | undefined;
3
+ export { getFirstSeatElementMatchingCriteria };
@@ -0,0 +1,6 @@
1
+ import { OfferSliceSegment } from "../types/Offer";
2
+ export declare const getPassengerBySegmentList: (segments: OfferSliceSegment[]) => {
3
+ passenger: import("../types/Offer").OfferSliceSegmentPassenger;
4
+ passengerIndex: number;
5
+ segment: OfferSliceSegment;
6
+ }[];
@@ -0,0 +1 @@
1
+ export declare const getPassengerInitials: (passengerName?: string) => string;
@@ -0,0 +1,3 @@
1
+ import { CreateOrderPayloadPassenger, CreateOrderPayloadPassengers } from "../types/CreateOrderPayload";
2
+ export type PassengerMapById = Record<CreateOrderPayloadPassenger["id"], CreateOrderPayloadPassenger>;
3
+ export declare const getPassengerMapById: (passengers: CreateOrderPayloadPassengers) => PassengerMapById;
@@ -0,0 +1,3 @@
1
+ import { CreateOrderPayloadPassenger } from "../types/CreateOrderPayload";
2
+ import { OfferPassenger } from "../types/Offer";
3
+ export declare const getPassengerName: (createOrderPayloadPassenger: CreateOrderPayloadPassenger, offerPassenger: OfferPassenger | undefined, fallbackIndex: number) => string;
@@ -0,0 +1,2 @@
1
+ import { SeatMapCabinRow } from "../types/SeatMap";
2
+ export declare const getRowNumber: (row: SeatMapCabinRow) => string | null;
@@ -0,0 +1,2 @@
1
+ import { Offer, OfferSliceSegment } from "../types/Offer";
2
+ export declare const getSegmentList: (offer: Offer) => OfferSliceSegment[];
@@ -0,0 +1,3 @@
1
+ import { OfferAvailableService } from "../types/Offer";
2
+ export type ServicePriceMapById = Record<OfferAvailableService["id"], Pick<OfferAvailableService, "total_amount" | "total_currency">>;
3
+ export declare const getServicePriceMapById: (availableServices: OfferAvailableService[]) => ServicePriceMapById;
@@ -0,0 +1,2 @@
1
+ import { SeatMapCabin, SeatMapCabinRowSectionElementAmenity } from "../types/SeatMap";
2
+ export declare const getSymbols: (cabins: SeatMapCabin[]) => Set<SeatMapCabinRowSectionElementAmenity>;
@@ -0,0 +1,6 @@
1
+ import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
+ import { Offer } from "../types/Offer";
3
+ import { SeatMap } from "../types/SeatMap";
4
+ import { ServicePriceMapById } from "./getServicePriceMapById";
5
+ export declare const getTotalAmountForServices: (offer: Offer, selectedServices: CreateOrderPayloadServices, seatMaps?: SeatMap[]) => number;
6
+ export declare const getTotalAmountForServicesWithPriceMap: (servicePriceMap: ServicePriceMapById, selectedServices: CreateOrderPayloadServices, seatMaps?: SeatMap[]) => number;
@@ -0,0 +1,2 @@
1
+ import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
+ export declare const getTotalQuantity: (fromSelectedServices: CreateOrderPayloadServices) => number;
@@ -0,0 +1,2 @@
1
+ import { Offer, OfferAvailableServiceType } from "../types/Offer";
2
+ export declare const hasService: (offer: Offer | undefined, type: OfferAvailableServiceType) => boolean | undefined;
@@ -0,0 +1,3 @@
1
+ import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
+ import { OfferAvailableServiceBaggage } from "../types/Offer";
3
+ export declare const hasServiceOfSameMetadataTypeAlreadyBeenSelected: (selectedServices: CreateOrderPayloadServices, segmentId: string, passengerId: string, availableService: OfferAvailableServiceBaggage) => boolean;
@@ -0,0 +1,2 @@
1
+ import { SeatMapCabin } from "../types/SeatMap";
2
+ export declare const hasWings: (cabin: SeatMapCabin, rowIndex: number) => boolean;
@@ -0,0 +1,2 @@
1
+ import { OfferAvailableBaggageService, OfferAvailableService } from "../types/Offer";
2
+ export declare const isBaggageService: (service: OfferAvailableService) => service is OfferAvailableBaggageService;
@@ -0,0 +1,2 @@
1
+ import { OfferAvailableService, OfferAvailableServiceCancelForAnyReason } from "../types/Offer";
2
+ export declare const isCancelForAnyReasonService: (service: OfferAvailableService) => service is OfferAvailableServiceCancelForAnyReason;
@@ -0,0 +1,2 @@
1
+ import { Offer } from "../types/Offer";
2
+ export declare const isFixtureOfferId: (offerId: Offer["id"]) => boolean;
@@ -0,0 +1,2 @@
1
+ import { CreateOrderPayload } from "../types/CreateOrderPayload";
2
+ export declare const isPayloadComplete: (payload: Partial<CreateOrderPayload>) => payload is CreateOrderPayload;
@@ -0,0 +1,2 @@
1
+ import { SeatMapCabinRowSectionElement, SeatMapCabinRowSectionElementSeat } from "../types/SeatMap";
2
+ export declare function isSeatElement(element: SeatMapCabinRowSectionElement): element is SeatMapCabinRowSectionElementSeat;
@@ -0,0 +1,53 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * The functions in this file are used to enable logging.
4
+ *
5
+ * Usage:
6
+ *
7
+ * In your app's outermost container, import the LogContext and wrap your app in it:
8
+ *
9
+ * ```jsx
10
+ * import { LogContext, initializeLogger } from '@lib/logging'
11
+ *
12
+ * const logger = initializeLogger(props.debugMode || false)
13
+ *
14
+ * <LogContext.Provider value={logger}>
15
+ * ...
16
+ * </LogContext.Provider>
17
+ * ```
18
+ *
19
+ * Then in your components nested within the above container, import the useLog hook and use it:
20
+ *
21
+ * import { useLog } from '@lib/logging'
22
+ *
23
+ * const { log, logGroup } = useLog()
24
+ * log('This is a log message')
25
+ * logGroup('These messages will be grouped together', ['This is a log message', 'This is another log message'])
26
+ */
27
+ declare const initializeLogger: (debugMode: boolean) => {
28
+ log: (message: any) => void;
29
+ logGroup: typeof logGroup;
30
+ };
31
+ /**
32
+ * Log a series of messages to the console inside a collapsible group.
33
+ * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
34
+ * @param messages An array of messages to print to the console, inside the group.
35
+ */
36
+ declare function logGroup(groupName: string, messages: any[]): void;
37
+ /**
38
+ * Log a series of messages to the console inside a collapsible group.
39
+ * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
40
+ * @param object An object to print to the console, inside the group.
41
+ */
42
+ declare function logGroup(groupName: string, object: {
43
+ [key: string]: any;
44
+ }): void;
45
+ declare const LogContext: import("react").Context<{
46
+ log: (message: any) => void;
47
+ logGroup: typeof logGroup;
48
+ }>;
49
+ declare const useLog: () => {
50
+ log: (message: any) => void;
51
+ logGroup: typeof logGroup;
52
+ };
53
+ export { LogContext, initializeLogger, useLog };
@@ -0,0 +1,8 @@
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 declare const moneyStringFormatter: (currency: string, locale?: string, options?: {
7
+ [option: string]: string;
8
+ }) => (value: number) => string;
@@ -0,0 +1,2 @@
1
+ import { Offer } from "../types/Offer";
2
+ export declare const offerIsExpired: (offer: Offer) => boolean | "";
@@ -0,0 +1,2 @@
1
+ import { Offer } from "../types/Offer";
2
+ export declare function retrieveOffer(offer_id: string, client_key: string | null, onError: (error: string) => void, setIsLoading: (isLoading: boolean) => void, onOfferReady: (offer: Offer) => void): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function retrieveOfferFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
@@ -0,0 +1,2 @@
1
+ import { SeatMap } from "../types/SeatMap";
2
+ export declare function retrieveSeatMaps(offer_id: string, client_key: string | null, onError: (error: string) => void, setIsLoading: (isLoading: boolean) => void, onSeatMapReady: (seatMaps: SeatMap[]) => void): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function retrieveSeatMapsFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
@@ -0,0 +1 @@
1
+ export declare const setBodyScrollability: (shouldScroll: boolean) => void;
@@ -0,0 +1,7 @@
1
+ import { DuffelAncillariesProps, DuffelAncillariesPropsWithClientKeyAndOfferId, DuffelAncillariesPropsWithOfferIdForFixture, DuffelAncillariesPropsWithOffersAndSeatMaps, DuffelAncillariesPropWithOfferAndClientKey } from "../types/DuffelAncillariesProps";
2
+ export declare const areDuffelAncillariesPropsValid: (props: DuffelAncillariesProps) => boolean;
3
+ export declare const hasCommonRequiredProps: (props: DuffelAncillariesProps) => boolean;
4
+ export declare const isDuffelAncillariesPropsWithOfferIdForFixture: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithOfferIdForFixture;
5
+ export declare const isDuffelAncillariesPropsWithClientKeyAndOfferId: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithClientKeyAndOfferId;
6
+ export declare const isDuffelAncillariesPropsWithOfferAndSeatMaps: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithOffersAndSeatMaps;
7
+ export declare const isDuffelAncillariesPropsWithOfferAndClientKey: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropWithOfferAndClientKey;
@@ -0,0 +1 @@
1
+ export declare const withPlural: (totalQuantity: number, singular: string, plural: string) => string;