@duffel/components 3.0.7-canary → 3.1.2--prototype

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 (232) hide show
  1. package/.eslintrc.js +8 -0
  2. package/.github/CODEOWNERS +4 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  4. package/.github/renovate.json +1 -5
  5. package/.github/workflows/release.yml +3 -0
  6. package/.storybook/__snapshots__/Storyshots.test.js.snap +20384 -533
  7. package/.tool-versions +1 -1
  8. package/README.md +16 -2
  9. package/config/esbuild.base.config.js +6 -2
  10. package/config/esbuild.cdn.config.js +2 -1
  11. package/config/esbuild.dev.config.js +2 -1
  12. package/config/esbuild.react.config.js +1 -1
  13. package/data/airports.csv +9084 -0
  14. package/data/cities.csv +256 -0
  15. package/package.json +11 -1
  16. package/react-dist/index.js +51 -21
  17. package/scripts/generate-fixture.ts +13 -8
  18. package/scripts/setup-suggestion-data.ts +100 -0
  19. package/scripts/upload-to-cdn.sh +1 -1
  20. package/src/components/{Card.tsx → DuffelAncillaries/Card.tsx} +1 -1
  21. package/src/components/{Counter.tsx → DuffelAncillaries/Counter.tsx} +1 -1
  22. package/src/components/{DuffelAncillaries.tsx → DuffelAncillaries/DuffelAncillaries.tsx} +68 -64
  23. package/src/components/{DuffelAncillariesCustomElement.tsx → DuffelAncillaries/DuffelAncillariesCustomElement.tsx} +2 -2
  24. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionCard.tsx +10 -5
  25. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionController.tsx +2 -2
  26. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModal.tsx +4 -4
  27. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBody.tsx +3 -3
  28. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBodyPassenger.tsx +4 -4
  29. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalFooter.tsx +23 -16
  30. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalHeader.tsx +24 -18
  31. package/src/components/{bags → DuffelAncillaries/bags}/IncludedBaggageBanner.tsx +1 -1
  32. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionCard.tsx +4 -4
  33. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModal.tsx +3 -3
  34. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBody.tsx +3 -3
  35. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBodyListItem.tsx +1 -1
  36. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalFooter.tsx +5 -5
  37. package/src/components/{seats → DuffelAncillaries/seats}/Amenity.tsx +2 -2
  38. package/src/components/{seats → DuffelAncillaries/seats}/DeckSelect.tsx +1 -1
  39. package/src/components/{seats → DuffelAncillaries/seats}/Element.tsx +2 -2
  40. package/src/components/{seats → DuffelAncillaries/seats}/ExitElement.tsx +1 -1
  41. package/src/components/{seats → DuffelAncillaries/seats}/Legend.tsx +2 -2
  42. package/src/components/{seats → DuffelAncillaries/seats}/Row.tsx +2 -2
  43. package/src/components/{seats → DuffelAncillaries/seats}/RowSection.tsx +5 -2
  44. package/src/components/{seats → DuffelAncillaries/seats}/SeatElement.tsx +3 -3
  45. package/src/components/{seats → DuffelAncillaries/seats}/SeatInfo.tsx +1 -1
  46. package/src/components/{seats → DuffelAncillaries/seats}/SeatMap.tsx +6 -2
  47. package/src/components/{seats → DuffelAncillaries/seats}/SeatMapUnavailable.tsx +1 -1
  48. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionCard.tsx +5 -5
  49. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModal.tsx +5 -5
  50. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalBody.tsx +1 -1
  51. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalFooter.tsx +24 -17
  52. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalHeader.tsx +30 -20
  53. package/src/components/{seats → DuffelAncillaries/seats}/SeatUnavailable.tsx +2 -2
  54. package/src/components/DuffelPayments/DuffelPayments.tsx +224 -0
  55. package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +130 -0
  56. package/src/components/PlacesLookup/PlacesLookup.tsx +123 -0
  57. package/src/components/ShowData/ShowData.tsx +38 -0
  58. package/src/components/ShowData/ShowDataCustomElement.tsx +85 -0
  59. package/src/components/{Button.tsx → shared/Button.tsx} +4 -3
  60. package/src/components/{ErrorBoundary.tsx → shared/ErrorBoundary.tsx} +2 -2
  61. package/src/components/{Icon.tsx → shared/Icon.tsx} +11 -11
  62. package/src/components/{IconButton.tsx → shared/IconButton.tsx} +1 -1
  63. package/src/components/{Modal.tsx → shared/Modal.tsx} +5 -1
  64. package/src/components/{NonIdealState.tsx → shared/NonIdealState.tsx} +1 -1
  65. package/src/custom-elements.ts +6 -1
  66. package/src/examples/client-side/index.html +1 -1
  67. package/src/examples/full-stack/index.html +1 -1
  68. package/src/examples/full-stack/server.mjs +1 -0
  69. package/src/examples/just-typescript/src/index.html +2 -2
  70. package/src/examples/just-typescript/src/index.ts +2 -1
  71. package/src/examples/payments-custom-element/README.md +17 -0
  72. package/src/examples/payments-custom-element/index.html +43 -0
  73. package/src/examples/payments-just-typescript/README.md +37 -0
  74. package/src/examples/payments-just-typescript/package.json +16 -0
  75. package/src/examples/payments-just-typescript/src/index.html +23 -0
  76. package/src/examples/payments-just-typescript/src/index.ts +18 -0
  77. package/src/examples/react-app/src/index.tsx +11 -6
  78. package/src/fixtures/offers/off_1.json +1 -10
  79. package/src/index.ts +3 -1
  80. package/src/lib/captureErrorInSentry.ts +2 -20
  81. package/src/lib/fetchFromDuffelAPI.ts +36 -6
  82. package/src/lib/formatDate.ts +3 -4
  83. package/src/lib/getBaggageServiceDescription.ts +1 -6
  84. package/src/lib/getPassengerName.ts +4 -0
  85. package/src/lib/getTotalAmountForServices.ts +1 -1
  86. package/src/lib/hasHighLuminance.ts +9 -0
  87. package/src/lib/logging.ts +52 -32
  88. package/src/lib/retrieveOffer.ts +13 -6
  89. package/src/lib/retrieveSeatMaps.ts +13 -8
  90. package/src/stories/BaggageSelectionModalHeader.stories.tsx +1 -1
  91. package/src/stories/Button.stories.tsx +33 -2
  92. package/src/stories/DuffelAncillaries.stories.tsx +42 -2
  93. package/src/stories/DuffelPayments.stories.tsx +34 -0
  94. package/src/stories/Icon.stories.tsx +3 -2
  95. package/src/stories/IconButton.stories.tsx +1 -1
  96. package/src/stories/PlacesLookup.stories.tsx +22 -0
  97. package/src/stories/ShowData.stories.tsx +16 -0
  98. package/src/styles/components/Button.css +11 -3
  99. package/src/styles/components/Card.css +3 -3
  100. package/src/styles/components/CfarSelectionModal.css +1 -1
  101. package/src/styles/components/DuffelPayments.css +42 -0
  102. package/src/styles/components/Legend.css +10 -6
  103. package/src/styles/components/LoadingState.css +8 -2
  104. package/src/styles/components/Modal.css +2 -1
  105. package/src/styles/components/PassengerSelect.css +8 -2
  106. package/src/styles/components/PlacesLookup.css +36 -0
  107. package/src/styles/components/Seat.css +9 -7
  108. package/src/styles/components/SeatInfo.css +1 -1
  109. package/src/styles/components/Tabs.css +5 -2
  110. package/src/styles/global.css +2 -0
  111. package/src/tests/components/DuffelAncillaries.test.tsx +1 -1
  112. package/src/tests/lib/createPriceFormatters.test.tsx +1 -1
  113. package/src/tests/lib/formatAvailableServices.test.tsx +1 -1
  114. package/src/tests/lib/formatSeatMaps.test.tsx +2 -2
  115. package/src/tests/lib/getCurrencyForServices.test.tsx +1 -1
  116. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +1 -1
  117. package/src/tests/lib/logging.test.tsx +14 -14
  118. package/src/tests/lib/moneyStringFormatter.test.tsx +1 -1
  119. package/src/tests/lib/validateProps.test.tsx +1 -1
  120. package/src/types/DuffelAncillariesProps.ts +1 -1
  121. package/react-dist/components/AnimatedLoaderEllipsis.d.ts +0 -2
  122. package/react-dist/components/Button.d.ts +0 -23
  123. package/react-dist/components/Card.d.ts +0 -14
  124. package/react-dist/components/Counter.d.ts +0 -10
  125. package/react-dist/components/DuffelAncillaries.d.ts +0 -3
  126. package/react-dist/components/DuffelAncillariesCustomElement.d.ts +0 -13
  127. package/react-dist/components/ErrorBoundary.d.ts +0 -13
  128. package/react-dist/components/FetchOfferErrorState.d.ts +0 -5
  129. package/react-dist/components/Icon.d.ts +0 -44
  130. package/react-dist/components/IconButton.d.ts +0 -16
  131. package/react-dist/components/Modal.d.ts +0 -11
  132. package/react-dist/components/NonIdealState.d.ts +0 -4
  133. package/react-dist/components/Stamp.d.ts +0 -7
  134. package/react-dist/components/Tabs.d.ts +0 -16
  135. package/react-dist/components/bags/BaggageSelectionCard.d.ts +0 -11
  136. package/react-dist/components/bags/BaggageSelectionController.d.ts +0 -13
  137. package/react-dist/components/bags/BaggageSelectionModal.d.ts +0 -11
  138. package/react-dist/components/bags/BaggageSelectionModalBody.d.ts +0 -11
  139. package/react-dist/components/bags/BaggageSelectionModalBodyPassenger.d.ts +0 -13
  140. package/react-dist/components/bags/BaggageSelectionModalFooter.d.ts +0 -14
  141. package/react-dist/components/bags/BaggageSelectionModalHeader.d.ts +0 -9
  142. package/react-dist/components/bags/IncludedBaggageBanner.d.ts +0 -7
  143. package/react-dist/components/cancel_for_any_reason/CfarSelectionCard.d.ts +0 -10
  144. package/react-dist/components/cancel_for_any_reason/CfarSelectionModal.d.ts +0 -11
  145. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBody.d.ts +0 -7
  146. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +0 -4
  147. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +0 -11
  148. package/react-dist/components/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +0 -2
  149. package/react-dist/components/seats/Amenity.d.ts +0 -6
  150. package/react-dist/components/seats/DeckSelect.d.ts +0 -15
  151. package/react-dist/components/seats/Element.d.ts +0 -15
  152. package/react-dist/components/seats/EmptyElement.d.ts +0 -2
  153. package/react-dist/components/seats/ExitElement.d.ts +0 -6
  154. package/react-dist/components/seats/Legend.d.ts +0 -12
  155. package/react-dist/components/seats/Row.d.ts +0 -13
  156. package/react-dist/components/seats/RowSection.d.ts +0 -17
  157. package/react-dist/components/seats/SeatElement.d.ts +0 -13
  158. package/react-dist/components/seats/SeatInfo.d.ts +0 -7
  159. package/react-dist/components/seats/SeatMap.d.ts +0 -12
  160. package/react-dist/components/seats/SeatMapUnavailable.d.ts +0 -2
  161. package/react-dist/components/seats/SeatSelectionCard.d.ts +0 -13
  162. package/react-dist/components/seats/SeatSelectionModal.d.ts +0 -13
  163. package/react-dist/components/seats/SeatSelectionModalBody.d.ts +0 -4
  164. package/react-dist/components/seats/SeatSelectionModalFooter.d.ts +0 -16
  165. package/react-dist/components/seats/SeatSelectionModalHeader.d.ts +0 -10
  166. package/react-dist/components/seats/SeatUnavailable.d.ts +0 -5
  167. package/react-dist/custom-elements.d.ts +0 -5
  168. package/react-dist/custom-elements.js +0 -36
  169. package/react-dist/custom-elements.js.map +0 -7
  170. package/react-dist/index.d.ts +0 -6
  171. package/react-dist/index.js.map +0 -7
  172. package/react-dist/lib/captureErrorInSentry.d.ts +0 -1
  173. package/react-dist/lib/compileCreateOrderPayload.d.ts +0 -14
  174. package/react-dist/lib/createPriceFormatters.d.ts +0 -12
  175. package/react-dist/lib/fetchFromDuffelAPI.d.ts +0 -1
  176. package/react-dist/lib/fetchFromFixtures.d.ts +0 -4
  177. package/react-dist/lib/formatAvailableServices.d.ts +0 -12
  178. package/react-dist/lib/formatDate.d.ts +0 -2
  179. package/react-dist/lib/formatSeatMaps.d.ts +0 -4
  180. package/react-dist/lib/getBaggageServiceDescription.d.ts +0 -2
  181. package/react-dist/lib/getCabinsForSegmentAndDeck.d.ts +0 -2
  182. package/react-dist/lib/getCurrencyForSeatMaps.d.ts +0 -10
  183. package/react-dist/lib/getCurrencyForServices.d.ts +0 -11
  184. package/react-dist/lib/getFirstSeatElementMatchingCriteria.d.ts +0 -3
  185. package/react-dist/lib/getPassengerBySegmentList.d.ts +0 -6
  186. package/react-dist/lib/getPassengerInitials.d.ts +0 -1
  187. package/react-dist/lib/getPassengerMapById.d.ts +0 -3
  188. package/react-dist/lib/getPassengerName.d.ts +0 -3
  189. package/react-dist/lib/getRowNumber.d.ts +0 -2
  190. package/react-dist/lib/getSegmentList.d.ts +0 -2
  191. package/react-dist/lib/getServicePriceMapById.d.ts +0 -3
  192. package/react-dist/lib/getSymbols.d.ts +0 -2
  193. package/react-dist/lib/getTotalAmountForServices.d.ts +0 -6
  194. package/react-dist/lib/getTotalQuantity.d.ts +0 -2
  195. package/react-dist/lib/hasService.d.ts +0 -2
  196. package/react-dist/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +0 -3
  197. package/react-dist/lib/hasWings.d.ts +0 -2
  198. package/react-dist/lib/isBaggageService.d.ts +0 -2
  199. package/react-dist/lib/isCancelForAnyReasonService.d.ts +0 -2
  200. package/react-dist/lib/isFixtureOfferId.d.ts +0 -2
  201. package/react-dist/lib/isPayloadComplete.d.ts +0 -2
  202. package/react-dist/lib/isSeatElement.d.ts +0 -2
  203. package/react-dist/lib/logging.d.ts +0 -53
  204. package/react-dist/lib/moneyStringFormatter.d.ts +0 -8
  205. package/react-dist/lib/offerIsExpired.d.ts +0 -2
  206. package/react-dist/lib/retrieveOffer.d.ts +0 -2
  207. package/react-dist/lib/retrieveOfferFromDuffelAPI.d.ts +0 -1
  208. package/react-dist/lib/retrieveSeatMaps.d.ts +0 -2
  209. package/react-dist/lib/retrieveSeatMapsFromDuffelAPI.d.ts +0 -1
  210. package/react-dist/lib/setBodyScrollability.d.ts +0 -1
  211. package/react-dist/lib/validateProps.d.ts +0 -7
  212. package/react-dist/lib/withPlural.d.ts +0 -1
  213. package/react-dist/types/Aircraft.d.ts +0 -14
  214. package/react-dist/types/Airline.d.ts +0 -14
  215. package/react-dist/types/Airport.d.ts +0 -44
  216. package/react-dist/types/City.d.ts +0 -18
  217. package/react-dist/types/CreateOrderPayload.d.ts +0 -72
  218. package/react-dist/types/CurrencyConversion.d.ts +0 -10
  219. package/react-dist/types/DuffelAncillariesProps.d.ts +0 -70
  220. package/react-dist/types/Offer.d.ts +0 -711
  221. package/react-dist/types/Order.d.ts +0 -8
  222. package/react-dist/types/Place.d.ts +0 -8
  223. package/react-dist/types/SeatMap.d.ts +0 -190
  224. package/react-dist/types/index.d.ts +0 -11
  225. package/src/examples/just-typescript/yarn.lock +0 -154
  226. package/src/examples/react-app/yarn.lock +0 -219
  227. /package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalHeader.tsx +0 -0
  228. /package/src/components/{seats → DuffelAncillaries/seats}/EmptyElement.tsx +0 -0
  229. /package/src/components/{AnimatedLoaderEllipsis.tsx → shared/AnimatedLoaderEllipsis.tsx} +0 -0
  230. /package/src/components/{FetchOfferErrorState.tsx → shared/FetchOfferErrorState.tsx} +0 -0
  231. /package/src/components/{Stamp.tsx → shared/Stamp.tsx} +0 -0
  232. /package/src/components/{Tabs.tsx → shared/Tabs.tsx} +0 -0
package/.eslintrc.js CHANGED
@@ -35,5 +35,13 @@ module.exports = {
35
35
  "react/react-in-jsx-scope": 0,
36
36
  "react/prop-types": 0,
37
37
  "react-hooks/exhaustive-deps": 0,
38
+ "no-restricted-syntax": [
39
+ "error",
40
+ {
41
+ selector: "CallExpression[callee.object.name='console']",
42
+ message:
43
+ "Prefer 'log' or 'logGroup' from 'src/lib/logging.ts' instead of 'console'.",
44
+ },
45
+ ],
38
46
  },
39
47
  };
@@ -0,0 +1,4 @@
1
+ # See https://help.github.com/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
2
+ # for more information about the format and syntax of this file
3
+
4
+ * @duffelhq/ux-products
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ""
5
+ labels: ""
6
+ assignees: ""
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **Version of duffel-components**
13
+ Please add:
14
+
15
+ 1. the version of the library you are using
16
+ 2. how you are installing it (npm or script tag)
17
+ 3. Your framework (React, vanilla JS, etc..)
18
+
19
+ **Code sample to reproduce**
20
+ Please re-create your issue in a code sandbox, if possible. Otherwise share as much as you can of your setup to help us narrow down what the issue is. Information such as request IDs can be helpful as well.
21
+
22
+ **Expected behavior**
23
+ A clear and concise description of what you expected to happen.
24
+
25
+ **Screenshots**
26
+ If applicable, please add screenshots to help explain your problem.
27
+
28
+ **Additional context**
29
+ Add any other context about the problem here.
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base",
5
- "schedule:earlyMondays",
6
- ":combinePatchMinorReleases"
7
- ],
3
+ "extends": ["config:base", "schedule:monthly", ":combinePatchMinorReleases"],
8
4
  "labels": ["dependencies"],
9
5
  "enabledManagers": ["github-actions", "npm"],
10
6
  "packageRules": [
@@ -45,6 +45,9 @@ jobs:
45
45
  GIT_AUTHOR_EMAIL: duffel-bot-read-write@duffel.com
46
46
  GIT_COMMITTER_NAME: duffel-bot
47
47
  GIT_COMMITTER_EMAIL: duffel-bot-read-write@duffel.com
48
+ DUFFEL_API_URL: https://api.duffel.com
49
+ COMPONENT_CDN: https://assets.duffel.com/components
50
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
48
51
  run: yarn release
49
52
 
50
53
  - name: Get version from package.json after release step