@duffel/components 3.1.3 → 3.1.4

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 (330) hide show
  1. package/components/DuffelAncillaries/Card.d.ts +14 -0
  2. package/components/DuffelAncillaries/Counter.d.ts +10 -0
  3. package/components/DuffelAncillaries/DuffelAncillaries.d.ts +3 -0
  4. package/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +12 -0
  5. package/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +11 -0
  6. package/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +13 -0
  7. package/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +11 -0
  8. package/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +11 -0
  9. package/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +13 -0
  10. package/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +14 -0
  11. package/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +9 -0
  12. package/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +7 -0
  13. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +10 -0
  14. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +11 -0
  15. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +7 -0
  16. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
  17. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +11 -0
  18. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
  19. package/components/DuffelAncillaries/seats/Amenity.d.ts +6 -0
  20. package/components/DuffelAncillaries/seats/DeckSelect.d.ts +15 -0
  21. package/components/DuffelAncillaries/seats/Element.d.ts +15 -0
  22. package/components/DuffelAncillaries/seats/EmptyElement.d.ts +2 -0
  23. package/components/DuffelAncillaries/seats/ExitElement.d.ts +6 -0
  24. package/components/DuffelAncillaries/seats/Legend.d.ts +12 -0
  25. package/components/DuffelAncillaries/seats/Row.d.ts +13 -0
  26. package/components/DuffelAncillaries/seats/RowSection.d.ts +17 -0
  27. package/components/DuffelAncillaries/seats/SeatElement.d.ts +13 -0
  28. package/components/DuffelAncillaries/seats/SeatInfo.d.ts +7 -0
  29. package/components/DuffelAncillaries/seats/SeatMap.d.ts +12 -0
  30. package/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +2 -0
  31. package/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +13 -0
  32. package/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +13 -0
  33. package/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +4 -0
  34. package/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +16 -0
  35. package/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +10 -0
  36. package/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +5 -0
  37. package/components/DuffelPayments/DuffelPayments.d.ts +11 -0
  38. package/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +13 -0
  39. package/components/PlacesLookup/PlacesLookup.d.ts +20 -0
  40. package/components/shared/AnimatedLoaderEllipsis.d.ts +2 -0
  41. package/components/shared/Button.d.ts +23 -0
  42. package/components/shared/ErrorBoundary.d.ts +13 -0
  43. package/components/shared/FetchOfferErrorState.d.ts +5 -0
  44. package/components/shared/Icon.d.ts +46 -0
  45. package/components/shared/IconButton.d.ts +16 -0
  46. package/components/shared/Modal.d.ts +11 -0
  47. package/components/shared/NonIdealState.d.ts +4 -0
  48. package/components/shared/Stamp.d.ts +7 -0
  49. package/components/shared/Tabs.d.ts +16 -0
  50. package/custom-elements.d.ts +6 -0
  51. package/custom-elements.js +40 -0
  52. package/custom-elements.js.map +7 -0
  53. package/index.js +40 -0
  54. package/index.js.map +7 -0
  55. package/lib/captureErrorInSentry.d.ts +1 -0
  56. package/lib/compileCreateOrderPayload.d.ts +14 -0
  57. package/lib/createPriceFormatters.d.ts +12 -0
  58. package/lib/fetchFromDuffelAPI.d.ts +8 -0
  59. package/lib/fetchFromFixtures.d.ts +4 -0
  60. package/lib/formatAvailableServices.d.ts +12 -0
  61. package/lib/formatDate.d.ts +2 -0
  62. package/lib/formatSeatMaps.d.ts +4 -0
  63. package/lib/getBaggageServiceDescription.d.ts +2 -0
  64. package/lib/getCabinsForSegmentAndDeck.d.ts +2 -0
  65. package/lib/getCurrencyForSeatMaps.d.ts +10 -0
  66. package/lib/getCurrencyForServices.d.ts +11 -0
  67. package/lib/getFirstSeatElementMatchingCriteria.d.ts +3 -0
  68. package/lib/getPassengerBySegmentList.d.ts +6 -0
  69. package/lib/getPassengerInitials.d.ts +1 -0
  70. package/lib/getPassengerMapById.d.ts +3 -0
  71. package/lib/getPassengerName.d.ts +3 -0
  72. package/lib/getRowNumber.d.ts +2 -0
  73. package/lib/getSegmentList.d.ts +2 -0
  74. package/lib/getServicePriceMapById.d.ts +3 -0
  75. package/lib/getSymbols.d.ts +2 -0
  76. package/lib/getTotalAmountForServices.d.ts +6 -0
  77. package/lib/getTotalQuantity.d.ts +2 -0
  78. package/lib/hasHighLuminance.d.ts +1 -0
  79. package/lib/hasService.d.ts +2 -0
  80. package/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +3 -0
  81. package/lib/hasWings.d.ts +2 -0
  82. package/lib/isBaggageService.d.ts +2 -0
  83. package/lib/isCancelForAnyReasonService.d.ts +2 -0
  84. package/lib/isFixtureOfferId.d.ts +2 -0
  85. package/lib/isPayloadComplete.d.ts +2 -0
  86. package/lib/isSeatElement.d.ts +2 -0
  87. package/lib/logging.d.ts +46 -0
  88. package/lib/moneyStringFormatter.d.ts +8 -0
  89. package/lib/offerIsExpired.d.ts +2 -0
  90. package/lib/retrieveOffer.d.ts +2 -0
  91. package/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
  92. package/lib/retrieveSeatMaps.d.ts +2 -0
  93. package/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
  94. package/lib/setBodyScrollability.d.ts +1 -0
  95. package/lib/validateProps.d.ts +7 -0
  96. package/lib/withPlural.d.ts +1 -0
  97. package/package.json +84 -134
  98. package/tsconfig.tsbuildinfo +1 -0
  99. package/types/Aircraft.d.ts +14 -0
  100. package/types/Airline.d.ts +14 -0
  101. package/types/Airport.d.ts +44 -0
  102. package/types/City.d.ts +18 -0
  103. package/types/CreateOrderPayload.d.ts +72 -0
  104. package/types/CurrencyConversion.d.ts +10 -0
  105. package/types/DuffelAncillariesProps.d.ts +70 -0
  106. package/types/Offer.d.ts +711 -0
  107. package/types/Order.d.ts +8 -0
  108. package/types/Place.d.ts +8 -0
  109. package/types/SeatMap.d.ts +190 -0
  110. package/.circleci/config.yml +0 -67
  111. package/.eslintrc.js +0 -47
  112. package/.github/CODEOWNERS +0 -4
  113. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
  114. package/.github/renovate.json +0 -12
  115. package/.github/workflows/autoapprove.yml +0 -18
  116. package/.github/workflows/release.yml +0 -89
  117. package/.husky/post-commit +0 -4
  118. package/.husky/pre-commit +0 -4
  119. package/.nvmrc +0 -1
  120. package/.prettierignore +0 -2
  121. package/.storybook/Storyshots.test.js +0 -3
  122. package/.storybook/__snapshots__/Storyshots.test.js.snap +0 -67984
  123. package/.storybook/main.ts +0 -33
  124. package/.storybook/preview.tsx +0 -28
  125. package/.tool-versions +0 -1
  126. package/CONTRIBUTING.md +0 -83
  127. package/README.md +0 -68
  128. package/__mocks__/styleMock.js +0 -6
  129. package/babel.config.js +0 -20
  130. package/commitlint.config.js +0 -4
  131. package/config/esbuild.base.config.js +0 -18
  132. package/config/esbuild.cdn.config.js +0 -51
  133. package/config/esbuild.dev.config.js +0 -46
  134. package/config/esbuild.react.config.js +0 -42
  135. package/data/airports.csv +0 -9084
  136. package/data/cities.csv +0 -256
  137. package/jest.config.ts +0 -14
  138. package/react-dist/index.js +0 -37
  139. package/scripts/generate-fixture.ts +0 -200
  140. package/scripts/setup-suggestion-data.ts +0 -100
  141. package/scripts/upload-to-cdn.sh +0 -34
  142. package/scripts.tsconfig.json +0 -11
  143. package/src/components/DuffelAncillaries/Card.tsx +0 -126
  144. package/src/components/DuffelAncillaries/Counter.tsx +0 -40
  145. package/src/components/DuffelAncillaries/DuffelAncillaries.tsx +0 -350
  146. package/src/components/DuffelAncillaries/DuffelAncillariesCustomElement.tsx +0 -124
  147. package/src/components/DuffelAncillaries/bags/BaggageSelectionCard.tsx +0 -101
  148. package/src/components/DuffelAncillaries/bags/BaggageSelectionController.tsx +0 -88
  149. package/src/components/DuffelAncillaries/bags/BaggageSelectionModal.tsx +0 -81
  150. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBody.tsx +0 -60
  151. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.tsx +0 -122
  152. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.tsx +0 -88
  153. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.tsx +0 -82
  154. package/src/components/DuffelAncillaries/bags/IncludedBaggageBanner.tsx +0 -51
  155. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.tsx +0 -90
  156. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.tsx +0 -63
  157. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.tsx +0 -56
  158. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +0 -11
  159. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.tsx +0 -74
  160. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.tsx +0 -9
  161. package/src/components/DuffelAncillaries/seats/Amenity.tsx +0 -21
  162. package/src/components/DuffelAncillaries/seats/DeckSelect.tsx +0 -27
  163. package/src/components/DuffelAncillaries/seats/Element.tsx +0 -52
  164. package/src/components/DuffelAncillaries/seats/EmptyElement.tsx +0 -5
  165. package/src/components/DuffelAncillaries/seats/ExitElement.tsx +0 -17
  166. package/src/components/DuffelAncillaries/seats/Legend.tsx +0 -60
  167. package/src/components/DuffelAncillaries/seats/Row.tsx +0 -47
  168. package/src/components/DuffelAncillaries/seats/RowSection.tsx +0 -78
  169. package/src/components/DuffelAncillaries/seats/SeatElement.tsx +0 -120
  170. package/src/components/DuffelAncillaries/seats/SeatInfo.tsx +0 -32
  171. package/src/components/DuffelAncillaries/seats/SeatMap.tsx +0 -85
  172. package/src/components/DuffelAncillaries/seats/SeatMapUnavailable.tsx +0 -21
  173. package/src/components/DuffelAncillaries/seats/SeatSelectionCard.tsx +0 -103
  174. package/src/components/DuffelAncillaries/seats/SeatSelectionModal.tsx +0 -142
  175. package/src/components/DuffelAncillaries/seats/SeatSelectionModalBody.tsx +0 -13
  176. package/src/components/DuffelAncillaries/seats/SeatSelectionModalFooter.tsx +0 -89
  177. package/src/components/DuffelAncillaries/seats/SeatSelectionModalHeader.tsx +0 -97
  178. package/src/components/DuffelAncillaries/seats/SeatUnavailable.tsx +0 -14
  179. package/src/components/DuffelPayments/DuffelPayments.tsx +0 -224
  180. package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +0 -130
  181. package/src/components/PlacesLookup/PlacesLookup.tsx +0 -123
  182. package/src/components/shared/AnimatedLoaderEllipsis.tsx +0 -5
  183. package/src/components/shared/Button.tsx +0 -63
  184. package/src/components/shared/ErrorBoundary.tsx +0 -54
  185. package/src/components/shared/FetchOfferErrorState.tsx +0 -35
  186. package/src/components/shared/Icon.tsx +0 -151
  187. package/src/components/shared/IconButton.tsx +0 -42
  188. package/src/components/shared/Modal.tsx +0 -40
  189. package/src/components/shared/NonIdealState.tsx +0 -28
  190. package/src/components/shared/Stamp.tsx +0 -29
  191. package/src/components/shared/Tabs.tsx +0 -36
  192. package/src/custom-elements.ts +0 -13
  193. package/src/examples/client-side/README.md +0 -30
  194. package/src/examples/client-side/index.html +0 -57
  195. package/src/examples/full-stack/README.md +0 -34
  196. package/src/examples/full-stack/index.html +0 -48
  197. package/src/examples/full-stack/server.mjs +0 -158
  198. package/src/examples/just-typescript/README.md +0 -37
  199. package/src/examples/just-typescript/package.json +0 -16
  200. package/src/examples/just-typescript/src/index.html +0 -23
  201. package/src/examples/just-typescript/src/index.ts +0 -36
  202. package/src/examples/next/README.md +0 -28
  203. package/src/examples/next/next-env.d.ts +0 -5
  204. package/src/examples/next/next.config.js +0 -4
  205. package/src/examples/next/package.json +0 -24
  206. package/src/examples/next/src/app/DuffelComponents.tsx +0 -40
  207. package/src/examples/next/src/app/layout.tsx +0 -18
  208. package/src/examples/next/src/app/page.tsx +0 -9
  209. package/src/examples/next/tsconfig.json +0 -27
  210. package/src/examples/payments-custom-element/README.md +0 -17
  211. package/src/examples/payments-custom-element/index.html +0 -43
  212. package/src/examples/payments-just-typescript/README.md +0 -37
  213. package/src/examples/payments-just-typescript/package.json +0 -16
  214. package/src/examples/payments-just-typescript/src/index.html +0 -23
  215. package/src/examples/payments-just-typescript/src/index.ts +0 -18
  216. package/src/examples/react-app/README.md +0 -37
  217. package/src/examples/react-app/package.json +0 -20
  218. package/src/examples/react-app/src/index.html +0 -19
  219. package/src/examples/react-app/src/index.tsx +0 -48
  220. package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +0 -497
  221. package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -307
  222. package/src/fixtures/offers/off_1.json +0 -488
  223. package/src/fixtures/passengers/mock_passengers.ts +0 -26
  224. package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +0 -6852
  225. package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -1
  226. package/src/fixtures/seat-maps/off_1.json +0 -6852
  227. package/src/lib/captureErrorInSentry.ts +0 -42
  228. package/src/lib/compileCreateOrderPayload.ts +0 -63
  229. package/src/lib/createPriceFormatters.ts +0 -73
  230. package/src/lib/fetchFromDuffelAPI.ts +0 -54
  231. package/src/lib/fetchFromFixtures.ts +0 -18
  232. package/src/lib/formatAvailableServices.ts +0 -91
  233. package/src/lib/formatDate.ts +0 -20
  234. package/src/lib/formatSeatMaps.ts +0 -81
  235. package/src/lib/getBaggageServiceDescription.ts +0 -39
  236. package/src/lib/getCabinsForSegmentAndDeck.ts +0 -4
  237. package/src/lib/getCurrencyForSeatMaps.ts +0 -22
  238. package/src/lib/getCurrencyForServices.ts +0 -24
  239. package/src/lib/getFirstSeatElementMatchingCriteria.ts +0 -22
  240. package/src/lib/getPassengerBySegmentList.ts +0 -10
  241. package/src/lib/getPassengerInitials.ts +0 -6
  242. package/src/lib/getPassengerMapById.ts +0 -17
  243. package/src/lib/getPassengerName.ts +0 -41
  244. package/src/lib/getRowNumber.ts +0 -16
  245. package/src/lib/getSegmentList.ts +0 -7
  246. package/src/lib/getServicePriceMapById.ts +0 -20
  247. package/src/lib/getSymbols.ts +0 -22
  248. package/src/lib/getTotalAmountForServices.ts +0 -72
  249. package/src/lib/getTotalQuantity.ts +0 -5
  250. package/src/lib/hasHighLuminance.ts +0 -9
  251. package/src/lib/hasService.ts +0 -24
  252. package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +0 -35
  253. package/src/lib/hasWings.ts +0 -8
  254. package/src/lib/isBaggageService.ts +0 -8
  255. package/src/lib/isCancelForAnyReasonService.ts +0 -9
  256. package/src/lib/isFixtureOfferId.ts +0 -4
  257. package/src/lib/isPayloadComplete.ts +0 -11
  258. package/src/lib/isSeatElement.ts +0 -10
  259. package/src/lib/logging.ts +0 -120
  260. package/src/lib/moneyStringFormatter.ts +0 -34
  261. package/src/lib/offerIsExpired.ts +0 -5
  262. package/src/lib/retrieveOffer.ts +0 -56
  263. package/src/lib/retrieveOfferFromDuffelAPI.ts +0 -13
  264. package/src/lib/retrieveSeatMaps.ts +0 -55
  265. package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +0 -13
  266. package/src/lib/setBodyScrollability.ts +0 -7
  267. package/src/lib/validateProps.ts +0 -37
  268. package/src/lib/withPlural.ts +0 -8
  269. package/src/stories/BaggageSelectionModalHeader.stories.tsx +0 -21
  270. package/src/stories/Button.stories.tsx +0 -91
  271. package/src/stories/DuffelAncillaries.stories.tsx +0 -166
  272. package/src/stories/DuffelPayments.stories.tsx +0 -34
  273. package/src/stories/Icon.stories.tsx +0 -35
  274. package/src/stories/IconButton.stories.tsx +0 -25
  275. package/src/stories/PlacesLookup.stories.tsx +0 -22
  276. package/src/styles/colors.css +0 -22
  277. package/src/styles/components/Amenity.css +0 -23
  278. package/src/styles/components/BaggageDisplay.css +0 -25
  279. package/src/styles/components/Button.css +0 -169
  280. package/src/styles/components/Card.css +0 -52
  281. package/src/styles/components/CfarSelectionModal.css +0 -34
  282. package/src/styles/components/Counter.css +0 -18
  283. package/src/styles/components/DuffelPayments.css +0 -42
  284. package/src/styles/components/IconButton.css +0 -63
  285. package/src/styles/components/Legend.css +0 -62
  286. package/src/styles/components/Loader.css +0 -37
  287. package/src/styles/components/LoadingState.css +0 -87
  288. package/src/styles/components/Modal.css +0 -84
  289. package/src/styles/components/PassengerSelect.css +0 -99
  290. package/src/styles/components/PassengersLayout.css +0 -90
  291. package/src/styles/components/PlacesLookup.css +0 -36
  292. package/src/styles/components/Row.css +0 -70
  293. package/src/styles/components/Seat.css +0 -59
  294. package/src/styles/components/SeatInfo.css +0 -61
  295. package/src/styles/components/SeatMap.css +0 -24
  296. package/src/styles/components/SeatSelect.css +0 -92
  297. package/src/styles/components/Segment.css +0 -17
  298. package/src/styles/components/SelectionSegment.css +0 -10
  299. package/src/styles/components/Summary.css +0 -70
  300. package/src/styles/components/Tabs.css +0 -52
  301. package/src/styles/flex.css +0 -5
  302. package/src/styles/font-families.css +0 -47
  303. package/src/styles/global.css +0 -52
  304. package/src/styles/margin.css +0 -3
  305. package/src/styles/spacing.css +0 -18
  306. package/src/styles/transitions.css +0 -3
  307. package/src/styles/typography.css +0 -13
  308. package/src/tests/components/DuffelAncillaries.test.tsx +0 -342
  309. package/src/tests/lib/createPriceFormatters.test.tsx +0 -152
  310. package/src/tests/lib/formatAvailableServices.test.tsx +0 -79
  311. package/src/tests/lib/formatSeatMaps.test.tsx +0 -49
  312. package/src/tests/lib/getCurrencyForServices.test.tsx +0 -44
  313. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +0 -86
  314. package/src/tests/lib/logging.test.tsx +0 -32
  315. package/src/tests/lib/moneyStringFormatter.test.tsx +0 -12
  316. package/src/tests/lib/validateProps.test.tsx +0 -57
  317. package/src/types/Aircraft.ts +0 -16
  318. package/src/types/Airline.ts +0 -16
  319. package/src/types/Airport.ts +0 -54
  320. package/src/types/City.ts +0 -21
  321. package/src/types/CreateOrderPayload.ts +0 -99
  322. package/src/types/CurrencyConversion.ts +0 -10
  323. package/src/types/DuffelAncillariesProps.ts +0 -108
  324. package/src/types/Offer.ts +0 -851
  325. package/src/types/Order.ts +0 -6
  326. package/src/types/Place.ts +0 -6
  327. package/src/types/SeatMap.ts +0 -231
  328. package/tsconfig.json +0 -52
  329. /package/{src/index.ts → index.d.ts} +0 -0
  330. /package/{src/types/index.ts → types/index.d.ts} +0 -0
@@ -1,28 +0,0 @@
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
- );
@@ -1,29 +0,0 @@
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
- );
@@ -1,36 +0,0 @@
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
- );
@@ -1,13 +0,0 @@
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";
@@ -1,30 +0,0 @@
1
- # duffel-components client-side example
2
-
3
- ## Setup
4
-
5
- ```sh
6
- # .env.local
7
-
8
- # The Duffel API environment we want to make requests to.
9
- # Remember to update the key below if this value changes.
10
- # DUFFEL_API_URL=https://api.duffel.com # production
11
- DUFFEL_API_URL=https://localhost:4000 # development (for Duffel engineers only)
12
-
13
- # Used to authenticate our
14
- # example server to talk to Duffel
15
- # DUFFEL_API_TOKEN=duffel_test_**** # production
16
- DUFFEL_API_TOKEN=test_duffel_dev_rw # development (for Duffel engineers only)
17
-
18
-
19
- # The url for the component CDN.
20
- # This is used to load both the styles an
21
- # COMPONENT_CDN=https://assets.duffel.com/components/ancillaries/VERSION # production
22
- COMPONENT_CDN=http://localhost:8000 # development
23
- ```
24
-
25
- ## Run the example
26
-
27
- This is a basic example that doesn't rely on the Duffel API, from the root of the repository run `yarn run-example:client-side`. This command will:
28
-
29
- 1. Serve the Duffel component bundle and watch for changes to rebuild on port `8000`. This can also be done with `yarn dev`
30
- 2. Host a basic `index.html` with `http-server`. The example page will be ready on port `6262`. This can be done with `yarn run-client-side-server`
@@ -1,57 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Checkout page example</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link
7
- rel="icon"
8
- type="image/png"
9
- sizes="96x96"
10
- href="https://duffel.com/images/favicon/favicon-96x96.png"
11
- />
12
-
13
- <!-- 1. This script loads duffel-components -->
14
- <script src="http://localhost:8000/duffel-ancillaries.js"></script>
15
- </head>
16
-
17
- <body style="font-family: sans-serif">
18
- <h1>Checkout page</h1>
19
-
20
- <!-- 2. Add the custom element to your markup where you want to render the ancillaries card -->
21
- <duffel-ancillaries></duffel-ancillaries>
22
- </body>
23
- <script>
24
- const duffelAncillariesElement =
25
- document.querySelector("duffel-ancillaries");
26
-
27
- // 3. Render the component with the required data, you can safely call this function as many times as you want. E.g. when your passenger data changes.
28
- duffelAncillariesElement.render({
29
- offer_id: "fixture_off_1",
30
- services: ["bags", "seats", "cancel_for_any_reason"],
31
- passengers: [
32
- {
33
- given_name: "Mae",
34
- family_name: "Jemison",
35
- gender: "F",
36
- title: "dr",
37
- born_on: "1956-10-17",
38
- email: "m.jemison@nasa.gov",
39
- phone_number: "+16177562626",
40
- },
41
- {
42
- given_name: "Dorothy",
43
- family_name: "Green",
44
- gender: "F",
45
- title: "dr",
46
- born_on: "1942-10-17",
47
- },
48
- ],
49
- debug: true,
50
- });
51
-
52
- // 4. Listen to 'onPayloadReady' event on the component. `event.detail.data` contains the payload you need to send to Duffel's API to create an order.
53
- duffelAncillariesElement.addEventListener("onPayloadReady", (event) =>
54
- console.log("onPayloadReady\n", event.detail)
55
- );
56
- </script>
57
- </html>
@@ -1,34 +0,0 @@
1
- # duffel-components full-stack example
2
-
3
- ## Setup
4
-
5
- ```sh
6
- # .env.local
7
-
8
- # The Duffel API environment we want to make requests to.
9
- # Remember to update the key below if this value changes.
10
- # DUFFEL_API_URL=https://api.duffel.com # production
11
- DUFFEL_API_URL=https://localhost:4000 # development (for Duffel engineers only)
12
-
13
- # Used to authenticate our
14
- # example server to talk to Duffel
15
- # DUFFEL_API_TOKEN=duffel_test_**** # production (find it on https://app.duffel.com/YOUR_ORG/test/developers/tokens)
16
- DUFFEL_API_TOKEN=test_duffel_dev_rw # development (for Duffel engineers only)
17
-
18
-
19
- # The url for the component CDN.
20
- # This is used to load both the styles an
21
- # COMPONENT_CDN=https://assets.duffel.com/components/ancillaries/VERSION # production
22
- COMPONENT_CDN=http://localhost:8000 # development
23
- ```
24
-
25
- ## Run the example
26
-
27
- This example has a server that will reach out to the Duffel API to search and retrieve an offer.
28
- To talk to the API we'll define the url to the API environment we want and .
29
- Please add the following to `.env.local`:
30
-
31
- This is a 'real life' example, where it uses a real offer ID and client key retrieved from the Duffel API. To run this, use `yarn run-example:full-stack`. This command will:
32
-
33
- 1. Serve the Duffel component bundle and watch for changes to rebuild on port `8000`. This can also be done with `yarn dev`
34
- 2. Run the full stack server using node. The example page will be ready on port `6262`. This can be done with `yarn run-full-stack-server`
@@ -1,48 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Checkout page example</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link
7
- rel="icon"
8
- type="image/png"
9
- sizes="96x96"
10
- href="https://duffel.com/images/favicon/favicon-96x96.png"
11
- />
12
-
13
- <!-- 1. This script loads duffel-components -->
14
- <script src="http://localhost:8000/duffel-ancillaries.js"></script>
15
- </head>
16
-
17
- <body style="font-family: sans-serif">
18
- <h1>Checkout page</h1>
19
-
20
- <!-- 2. Add the custom element to your markup where you want to render the ancillaries card -->
21
- <duffel-ancillaries></duffel-ancillaries>
22
- </body>
23
- <script>
24
- const duffelAncillariesElement =
25
- document.querySelector("duffel-ancillaries");
26
-
27
- // 3. Render the component with the required data, you can safely call this function as many times as you want. E.g. when your passenger data changes.
28
- duffelAncillariesElement.render({
29
- offer_id: "__OFFER_ID__",
30
- client_key: "__CLIENT_KEY__",
31
- passengers: "__PASSENGERS__",
32
- services: ["seats", "bags", "cancel_for_any_reason"],
33
- debug: true,
34
- });
35
-
36
- // 4. Listen to 'onPayloadReady' event on the component. `event.detail.data` contains the payload you need to send to Duffel's API to create an order.
37
- duffelAncillariesElement.addEventListener("onPayloadReady", (event) => {
38
- console.log("onPayloadReady\n", event.detail);
39
- const body = JSON.stringify({ data: event.detail.data });
40
-
41
- // 5. Send the order creation payload to your server to create an order with the Duffel API.
42
- fetch("/book", { method: "POST", body })
43
- .then((response) => response.json())
44
- .then(({ data }) => console.log("Order created", data))
45
- .catch((error) => console.error("Order creation failed", error));
46
- });
47
- </script>
48
- </html>
@@ -1,158 +0,0 @@
1
- import dotenv from "dotenv";
2
- import { readFileSync } from "fs";
3
- import http from "http";
4
-
5
- /* https://nodejs.org/api/cli.html#node_tls_reject_unauthorizedvalue */
6
- process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
7
-
8
- dotenv.config({ path: ".env.local" });
9
-
10
- if (process.env.DUFFEL_API_URL === undefined) {
11
- throw new Error("process.env.DUFFEL_API_URL is required but missing");
12
- }
13
-
14
- if (process.env.DUFFEL_API_TOKEN === undefined) {
15
- throw new Error("process.env.DUFFEL_API_TOKEN is required but missing");
16
- }
17
-
18
- const makeMockDateInTheFuture = (daysAhead) => {
19
- const now = new Date(Date.now());
20
- now.setDate(now.getDate() + daysAhead);
21
- return now;
22
- };
23
-
24
- const duffelHeaders = {
25
- "Duffel-Version": "v1",
26
- "Accept-Encoding": "gzip",
27
- Accept: "application/json",
28
- "Content-Type": "application/json",
29
- Authorization: `Bearer ${process.env.DUFFEL_API_TOKEN}`,
30
- };
31
-
32
- let searchRoundTripOnDuffelResultCache = null;
33
- const searchRoundTripOnDuffel = async (origin, destination) => {
34
- if (searchRoundTripOnDuffelResultCache !== null) {
35
- return searchRoundTripOnDuffelResultCache;
36
- }
37
-
38
- const payload = {
39
- data: {
40
- slices: [
41
- {
42
- origin,
43
- destination,
44
- departure_date: makeMockDateInTheFuture(7)
45
- .toISOString()
46
- .split("T")[0],
47
- },
48
- {
49
- origin: destination,
50
- destination: origin,
51
- departure_date: makeMockDateInTheFuture(14)
52
- .toISOString()
53
- .split("T")[0],
54
- },
55
- ],
56
- passengers: [{ type: "adult" }],
57
- requested_sources: ["duffel_airways"],
58
- },
59
- };
60
-
61
- const { data: offerRequest } = await (
62
- await fetch(
63
- process.env.DUFFEL_API_URL + "/air/offer_requests?return_offers=true",
64
- {
65
- method: "POST",
66
- body: JSON.stringify(payload),
67
- headers: duffelHeaders,
68
- }
69
- )
70
- ).json();
71
-
72
- searchRoundTripOnDuffelResultCache = offerRequest;
73
- return searchRoundTripOnDuffelResultCache;
74
- };
75
-
76
- const createOrderOnDuffel = async (request, response) => {
77
- const createOrderOnDuffelResponse = await fetch(
78
- process.env.DUFFEL_API_URL + "/air/orders",
79
- {
80
- method: "POST",
81
- headers: duffelHeaders,
82
- body: request,
83
- duplex: "half",
84
- }
85
- );
86
-
87
- response.writeHead(createOrderOnDuffelResponse.status, {
88
- "Content-type": "application/json",
89
- });
90
- response.write(await createOrderOnDuffelResponse.text());
91
- response.end();
92
- };
93
-
94
- const ROUTES = {
95
- "/": async function index(request, response) {
96
- const offerRequest = await searchRoundTripOnDuffel("JFK", "MIA");
97
- const offer = offerRequest.offers[0];
98
-
99
- if (!offer) {
100
- response.writeHead(404);
101
- response.end(http.STATUS_CODES[404]);
102
- return;
103
- }
104
-
105
- const passengers = [
106
- {
107
- id: offer.passengers[0].id,
108
- given_name: "Mae",
109
- family_name: "Jemison",
110
- gender: "F",
111
- title: "dr",
112
- born_on: "1956-10-17",
113
- email: "m.jemison@nasa.gov",
114
- phone_number: "+16177562626",
115
- },
116
- ];
117
-
118
- const template = readFileSync("src/examples/full-stack/index.html", {
119
- encoding: "utf-8",
120
- });
121
-
122
- const withOfferId = template.replace("__OFFER_ID__", offer.id);
123
- const withclientKey = withOfferId.replace(
124
- "__CLIENT_KEY__",
125
- offerRequest.client_key
126
- );
127
- const withPassengers = withclientKey.replace(
128
- `"__PASSENGERS__"`,
129
- `${JSON.stringify(passengers)}`
130
- );
131
-
132
- response.writeHead(200);
133
- response.end(withPassengers);
134
- },
135
- "/book": async function book(request, response) {
136
- if (request.method != "POST") {
137
- response.writeHead(404);
138
- response.end(http.STATUS_CODES[404]);
139
- return;
140
- }
141
-
142
- await createOrderOnDuffel(request, response);
143
- },
144
- };
145
-
146
- http
147
- .createServer(function (request, response) {
148
- if (request.url in ROUTES) {
149
- return ROUTES[request.url](request, response);
150
- }
151
-
152
- response.writeHead(404);
153
- response.end(http.STATUS_CODES[404]);
154
- })
155
- .listen(6262);
156
-
157
- // eslint-disable-next-line
158
- console.log(`\n🐄 Serving example on http://localhost:6262`);
@@ -1,37 +0,0 @@
1
- # duffel-components typescript example
2
-
3
- ## TL;DR
4
-
5
- Start on the root of the `duffel-components` repository:
6
-
7
- ```sh
8
- # build duffel-components for react env:
9
- yarn react-build
10
-
11
- # change directory to example folder
12
- cd src/examples/just-typescript
13
-
14
- # cleanup last install and build
15
- rm -rf node_modules && rm -rf dist
16
-
17
- # install new version
18
- yarn
19
-
20
- # build and watch example
21
- yarn build
22
-
23
- # open example
24
- open src/index.html -a "Safari"
25
- ```
26
-
27
- ## Build duffel-components
28
-
29
- First, navigate to the root folder of the duffel-components repository and run `yarn react-build` to build the package. It should output a react-dist folder on the root. This folder is the one we reference on `src/examples/just-typescript/package.json` dependencies under `duffel-components`
30
-
31
- ## Install dependencies
32
-
33
- Once the package is built, you can cd into this directory and run `yarn` to install all dependencies. If there are changes to `react-dist` since your last install, you'll need to `rm -rf node_modules`, otherwise the updates build will not be installed.
34
-
35
- ## Run example
36
-
37
- Finally, run `yarn dev` to build `src/examples/just-typescript/src/index.tsx`. This will produce `src/examples/just-typescript/dist` folder that is referenced by `src/examples/just-typescript/src/index.html`. You can then open `src/examples/just-typescript/src/index.html` on your browser to see the example up and running.
@@ -1,16 +0,0 @@
1
- {
2
- "name": "just-typescript",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "build": "esbuild src/index.ts --bundle --outfile=dist/index.js"
7
- },
8
- "dependencies": {
9
- "@types/node": "20.2.5",
10
- "typescript": "5.0.4",
11
- "duffel-components": "../../../../duffel-components/react-dist"
12
- },
13
- "devDependencies": {
14
- "esbuild": "^0.17.19"
15
- }
16
- }
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link
7
- rel="icon"
8
- type="image/png"
9
- sizes="96x96"
10
- href="https://duffel.com/images/favicon/favicon-96x96.png"
11
- />
12
-
13
- <script src="../dist/index.js" defer></script>
14
- <title>ancillaries component just typescript example</title>
15
- </head>
16
- <body>
17
- <h1 style="margin-bottom: 2rem">
18
- Duffel ancillaries component just typescript example
19
- </h1>
20
-
21
- <duffel-ancillaries></duffel-ancillaries>
22
- </body>
23
- </html>
@@ -1,36 +0,0 @@
1
- import {
2
- onDuffelAncillariesPayloadReady,
3
- renderDuffelAncillariesCustomElement,
4
- } from "duffel-components/custom-elements";
5
-
6
- window.onload = () => {
7
- renderDuffelAncillariesCustomElement({
8
- offer_id: "fixture_off_1",
9
- services: ["bags", "seats", "cancel_for_any_reason"],
10
- passengers: [
11
- {
12
- id: "pas_0000AUde3KY1SptM6ABSfT",
13
- given_name: "Mae",
14
- family_name: "Jemison",
15
- gender: "F",
16
- title: "dr",
17
- born_on: "1956-10-17",
18
- email: "m.jemison@nasa.gov",
19
- phone_number: "+16177562626",
20
- },
21
- {
22
- id: "pas_0000AUde3KY1SptM6ABSfU",
23
- given_name: "Dorothy",
24
- family_name: "Green",
25
- gender: "F",
26
- title: "dr",
27
- born_on: "1942-10-17",
28
- },
29
- ],
30
- });
31
- onDuffelAncillariesPayloadReady((data, metadata) => {
32
- /* eslint-disable */
33
- console.table(data);
34
- console.table(metadata);
35
- });
36
- };
@@ -1,28 +0,0 @@
1
- This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
-
3
- ## Getting Started
4
-
5
- First, run the development server:
6
-
7
- ```bash
8
- npm run dev
9
- # or
10
- yarn dev
11
- # or
12
- pnpm dev
13
- # or
14
- bun dev
15
- ```
16
-
17
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
-
19
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
-
21
- ## Learn More
22
-
23
- To learn more about Next.js, take a look at the following resources:
24
-
25
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27
-
28
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
@@ -1,5 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
-
4
- // NOTE: This file should not be edited
5
- // see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -1,4 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- const nextConfig = {};
3
-
4
- module.exports = nextConfig;
@@ -1,24 +0,0 @@
1
- {
2
- "name": "my-app",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "start": "next start",
9
- "lint": "next lint"
10
- },
11
- "dependencies": {
12
- "duffel-components": "../../../../duffel-components/react-dist",
13
- "next": "13.5.6",
14
- "react": "^18",
15
- "react-dom": "^18"
16
- },
17
- "devDependencies": {
18
- "@types/node": "~18",
19
- "@types/react": "^18",
20
- "@types/react-dom": "^18",
21
- "next-transpile-modules": "^10.0.1",
22
- "typescript": "^5"
23
- }
24
- }
@@ -1,40 +0,0 @@
1
- "use client";
2
-
3
- import { DuffelAncillaries, DuffelPayments } from "duffel-components";
4
-
5
- export const DuffelComponents = () => (
6
- <>
7
- <DuffelAncillaries
8
- debug={true}
9
- offer_id="fixture_off_1"
10
- services={["bags", "seats"]}
11
- passengers={[
12
- {
13
- id: "pas_0000AUde3KY1SptM6ABSfU",
14
- given_name: "Mae",
15
- family_name: "Jemison",
16
- gender: "F",
17
- title: "dr",
18
- born_on: "1956-10-17",
19
- email: "m.jemison@nasa.gov",
20
- phone_number: "+16177562626",
21
- },
22
- {
23
- id: "pas_0000AUde3KY1SptM6ABSfT",
24
- given_name: "Dorothy",
25
- family_name: "Green",
26
- gender: "F",
27
- title: "dr",
28
- born_on: "1942-10-17",
29
- },
30
- ]}
31
- onPayloadReady={console.log}
32
- />
33
-
34
- <DuffelPayments
35
- paymentIntentClientToken="eyJjbGllbnRfc2VjcmV0IjoicGlfM0psczlVQWcySmhFeTh2WTBSTm1MU0JkX3NlY3JldF9QUW9yZXNuU3laeWJadGRiejZwNzBCbUdPIiwicHVibGlzaGFibGVfa2V5IjoicGtfdGVzdF9EQUJLY0E2Vzh6OTc0cTdPSWY0YmJ2MVQwMEpwRmMyOUpWIn0="
36
- onSuccessfulPayment={console.log}
37
- onFailedPayment={console.log}
38
- />
39
- </>
40
- );