@duffel/components 3.0.7-canary → 3.1.2

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 (182) hide show
  1. package/.eslintrc.js +8 -0
  2. package/.github/CODEOWNERS +4 -0
  3. package/.github/renovate.json +1 -5
  4. package/.github/workflows/release.yml +3 -0
  5. package/.storybook/__snapshots__/Storyshots.test.js.snap +20384 -533
  6. package/README.md +16 -2
  7. package/config/esbuild.base.config.js +6 -2
  8. package/config/esbuild.cdn.config.js +2 -1
  9. package/config/esbuild.dev.config.js +2 -1
  10. package/config/esbuild.react.config.js +1 -1
  11. package/data/airports.csv +9084 -0
  12. package/data/cities.csv +256 -0
  13. package/package.json +11 -1
  14. package/react-dist/components/{Card.d.ts → DuffelAncillaries/Card.d.ts} +1 -1
  15. package/react-dist/components/{DuffelAncillaries.d.ts → DuffelAncillaries/DuffelAncillaries.d.ts} +1 -1
  16. package/react-dist/components/{DuffelAncillariesCustomElement.d.ts → DuffelAncillaries/DuffelAncillariesCustomElement.d.ts} +1 -1
  17. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionCard.d.ts +2 -2
  18. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionController.d.ts +2 -2
  19. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModal.d.ts +2 -2
  20. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBody.d.ts +2 -2
  21. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBodyPassenger.d.ts +2 -2
  22. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalFooter.d.ts +1 -1
  23. package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalHeader.d.ts +1 -1
  24. package/react-dist/components/{bags → DuffelAncillaries/bags}/IncludedBaggageBanner.d.ts +1 -1
  25. package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionCard.d.ts +2 -2
  26. package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModal.d.ts +2 -2
  27. package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBody.d.ts +1 -1
  28. package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalFooter.d.ts +2 -2
  29. package/react-dist/components/{seats → DuffelAncillaries/seats}/Amenity.d.ts +1 -1
  30. package/react-dist/components/{seats → DuffelAncillaries/seats}/Element.d.ts +2 -2
  31. package/react-dist/components/{seats → DuffelAncillaries/seats}/Legend.d.ts +1 -1
  32. package/react-dist/components/{seats → DuffelAncillaries/seats}/Row.d.ts +2 -2
  33. package/react-dist/components/{seats → DuffelAncillaries/seats}/RowSection.d.ts +2 -2
  34. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatElement.d.ts +2 -2
  35. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatInfo.d.ts +1 -1
  36. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatMap.d.ts +2 -2
  37. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionCard.d.ts +3 -3
  38. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModal.d.ts +3 -3
  39. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalFooter.d.ts +2 -2
  40. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalHeader.d.ts +1 -1
  41. package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatUnavailable.d.ts +1 -1
  42. package/react-dist/components/DuffelPayments/DuffelPayments.d.ts +11 -0
  43. package/react-dist/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +14 -0
  44. package/react-dist/components/PlacesLookup/PlacesLookup.d.ts +20 -0
  45. package/react-dist/components/{Button.d.ts → shared/Button.d.ts} +2 -2
  46. package/react-dist/components/{ErrorBoundary.d.ts → shared/ErrorBoundary.d.ts} +1 -1
  47. package/react-dist/components/{Icon.d.ts → shared/Icon.d.ts} +2 -0
  48. package/react-dist/components/{IconButton.d.ts → shared/IconButton.d.ts} +1 -1
  49. package/react-dist/components/{NonIdealState.d.ts → shared/NonIdealState.d.ts} +1 -1
  50. package/react-dist/custom-elements.d.ts +2 -1
  51. package/react-dist/custom-elements.js +21 -20
  52. package/react-dist/custom-elements.js.map +4 -4
  53. package/react-dist/index.d.ts +3 -1
  54. package/react-dist/index.js +51 -21
  55. package/react-dist/index.js.map +4 -4
  56. package/react-dist/lib/captureErrorInSentry.d.ts +1 -1
  57. package/react-dist/lib/fetchFromDuffelAPI.d.ts +7 -0
  58. package/react-dist/lib/hasHighLuminance.d.ts +1 -0
  59. package/react-dist/lib/logging.d.ts +7 -14
  60. package/react-dist/lib/retrieveSeatMaps.d.ts +1 -1
  61. package/react-dist/types/DuffelAncillariesProps.d.ts +1 -1
  62. package/scripts/generate-fixture.ts +13 -8
  63. package/scripts/setup-suggestion-data.ts +100 -0
  64. package/scripts/upload-to-cdn.sh +1 -1
  65. package/src/components/{Card.tsx → DuffelAncillaries/Card.tsx} +1 -1
  66. package/src/components/{Counter.tsx → DuffelAncillaries/Counter.tsx} +1 -1
  67. package/src/components/{DuffelAncillaries.tsx → DuffelAncillaries/DuffelAncillaries.tsx} +68 -64
  68. package/src/components/{DuffelAncillariesCustomElement.tsx → DuffelAncillaries/DuffelAncillariesCustomElement.tsx} +2 -2
  69. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionCard.tsx +10 -5
  70. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionController.tsx +2 -2
  71. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModal.tsx +4 -4
  72. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBody.tsx +3 -3
  73. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBodyPassenger.tsx +4 -4
  74. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalFooter.tsx +23 -16
  75. package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalHeader.tsx +24 -18
  76. package/src/components/{bags → DuffelAncillaries/bags}/IncludedBaggageBanner.tsx +1 -1
  77. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionCard.tsx +4 -4
  78. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModal.tsx +3 -3
  79. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBody.tsx +3 -3
  80. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBodyListItem.tsx +1 -1
  81. package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalFooter.tsx +5 -5
  82. package/src/components/{seats → DuffelAncillaries/seats}/Amenity.tsx +2 -2
  83. package/src/components/{seats → DuffelAncillaries/seats}/DeckSelect.tsx +1 -1
  84. package/src/components/{seats → DuffelAncillaries/seats}/Element.tsx +2 -2
  85. package/src/components/{seats → DuffelAncillaries/seats}/ExitElement.tsx +1 -1
  86. package/src/components/{seats → DuffelAncillaries/seats}/Legend.tsx +2 -2
  87. package/src/components/{seats → DuffelAncillaries/seats}/Row.tsx +2 -2
  88. package/src/components/{seats → DuffelAncillaries/seats}/RowSection.tsx +5 -2
  89. package/src/components/{seats → DuffelAncillaries/seats}/SeatElement.tsx +3 -3
  90. package/src/components/{seats → DuffelAncillaries/seats}/SeatInfo.tsx +1 -1
  91. package/src/components/{seats → DuffelAncillaries/seats}/SeatMap.tsx +6 -2
  92. package/src/components/{seats → DuffelAncillaries/seats}/SeatMapUnavailable.tsx +1 -1
  93. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionCard.tsx +5 -5
  94. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModal.tsx +5 -5
  95. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalBody.tsx +1 -1
  96. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalFooter.tsx +24 -17
  97. package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalHeader.tsx +30 -20
  98. package/src/components/{seats → DuffelAncillaries/seats}/SeatUnavailable.tsx +2 -2
  99. package/src/components/DuffelPayments/DuffelPayments.tsx +224 -0
  100. package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +130 -0
  101. package/src/components/PlacesLookup/PlacesLookup.tsx +123 -0
  102. package/src/components/{Button.tsx → shared/Button.tsx} +4 -3
  103. package/src/components/{ErrorBoundary.tsx → shared/ErrorBoundary.tsx} +2 -2
  104. package/src/components/{Icon.tsx → shared/Icon.tsx} +11 -11
  105. package/src/components/{IconButton.tsx → shared/IconButton.tsx} +1 -1
  106. package/src/components/{Modal.tsx → shared/Modal.tsx} +5 -1
  107. package/src/components/{NonIdealState.tsx → shared/NonIdealState.tsx} +1 -1
  108. package/src/custom-elements.ts +6 -1
  109. package/src/examples/client-side/index.html +1 -1
  110. package/src/examples/full-stack/index.html +1 -1
  111. package/src/examples/full-stack/server.mjs +1 -0
  112. package/src/examples/just-typescript/src/index.html +2 -2
  113. package/src/examples/just-typescript/src/index.ts +2 -1
  114. package/src/examples/payments-custom-element/README.md +17 -0
  115. package/src/examples/payments-custom-element/index.html +43 -0
  116. package/src/examples/payments-just-typescript/README.md +37 -0
  117. package/src/examples/payments-just-typescript/package.json +16 -0
  118. package/src/examples/payments-just-typescript/src/index.html +23 -0
  119. package/src/examples/payments-just-typescript/src/index.ts +18 -0
  120. package/src/examples/payments-just-typescript/yarn.lock +154 -0
  121. package/src/examples/react-app/src/index.tsx +11 -6
  122. package/src/fixtures/offers/off_1.json +1 -10
  123. package/src/index.ts +3 -1
  124. package/src/lib/captureErrorInSentry.ts +2 -20
  125. package/src/lib/fetchFromDuffelAPI.ts +36 -6
  126. package/src/lib/formatDate.ts +3 -4
  127. package/src/lib/getBaggageServiceDescription.ts +1 -6
  128. package/src/lib/getPassengerName.ts +4 -0
  129. package/src/lib/getTotalAmountForServices.ts +1 -1
  130. package/src/lib/hasHighLuminance.ts +9 -0
  131. package/src/lib/logging.ts +52 -32
  132. package/src/lib/retrieveOffer.ts +13 -6
  133. package/src/lib/retrieveSeatMaps.ts +13 -8
  134. package/src/stories/BaggageSelectionModalHeader.stories.tsx +1 -1
  135. package/src/stories/Button.stories.tsx +33 -2
  136. package/src/stories/DuffelAncillaries.stories.tsx +42 -2
  137. package/src/stories/DuffelPayments.stories.tsx +34 -0
  138. package/src/stories/Icon.stories.tsx +3 -2
  139. package/src/stories/IconButton.stories.tsx +1 -1
  140. package/src/stories/PlacesLookup.stories.tsx +22 -0
  141. package/src/styles/components/Button.css +11 -3
  142. package/src/styles/components/Card.css +3 -3
  143. package/src/styles/components/CfarSelectionModal.css +1 -1
  144. package/src/styles/components/DuffelPayments.css +42 -0
  145. package/src/styles/components/Legend.css +10 -6
  146. package/src/styles/components/LoadingState.css +8 -2
  147. package/src/styles/components/Modal.css +2 -1
  148. package/src/styles/components/PassengerSelect.css +8 -2
  149. package/src/styles/components/PlacesLookup.css +36 -0
  150. package/src/styles/components/Seat.css +9 -7
  151. package/src/styles/components/SeatInfo.css +1 -1
  152. package/src/styles/components/Tabs.css +5 -2
  153. package/src/styles/global.css +2 -0
  154. package/src/tests/components/DuffelAncillaries.test.tsx +1 -1
  155. package/src/tests/lib/createPriceFormatters.test.tsx +1 -1
  156. package/src/tests/lib/formatAvailableServices.test.tsx +1 -1
  157. package/src/tests/lib/formatSeatMaps.test.tsx +2 -2
  158. package/src/tests/lib/getCurrencyForServices.test.tsx +1 -1
  159. package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +1 -1
  160. package/src/tests/lib/logging.test.tsx +14 -14
  161. package/src/tests/lib/moneyStringFormatter.test.tsx +1 -1
  162. package/src/tests/lib/validateProps.test.tsx +1 -1
  163. package/src/types/DuffelAncillariesProps.ts +1 -1
  164. /package/react-dist/components/{Counter.d.ts → DuffelAncillaries/Counter.d.ts} +0 -0
  165. /package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBodyListItem.d.ts +0 -0
  166. /package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalHeader.d.ts +0 -0
  167. /package/react-dist/components/{seats → DuffelAncillaries/seats}/DeckSelect.d.ts +0 -0
  168. /package/react-dist/components/{seats → DuffelAncillaries/seats}/EmptyElement.d.ts +0 -0
  169. /package/react-dist/components/{seats → DuffelAncillaries/seats}/ExitElement.d.ts +0 -0
  170. /package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatMapUnavailable.d.ts +0 -0
  171. /package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalBody.d.ts +0 -0
  172. /package/react-dist/components/{AnimatedLoaderEllipsis.d.ts → shared/AnimatedLoaderEllipsis.d.ts} +0 -0
  173. /package/react-dist/components/{FetchOfferErrorState.d.ts → shared/FetchOfferErrorState.d.ts} +0 -0
  174. /package/react-dist/components/{Modal.d.ts → shared/Modal.d.ts} +0 -0
  175. /package/react-dist/components/{Stamp.d.ts → shared/Stamp.d.ts} +0 -0
  176. /package/react-dist/components/{Tabs.d.ts → shared/Tabs.d.ts} +0 -0
  177. /package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalHeader.tsx +0 -0
  178. /package/src/components/{seats → DuffelAncillaries/seats}/EmptyElement.tsx +0 -0
  179. /package/src/components/{AnimatedLoaderEllipsis.tsx → shared/AnimatedLoaderEllipsis.tsx} +0 -0
  180. /package/src/components/{FetchOfferErrorState.tsx → shared/FetchOfferErrorState.tsx} +0 -0
  181. /package/src/components/{Stamp.tsx → shared/Stamp.tsx} +0 -0
  182. /package/src/components/{Tabs.tsx → shared/Tabs.tsx} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { formatDateString } from "@lib/formatDate";
2
2
  import React from "react";
3
- import { OfferSliceSegment } from "../../types/Offer";
3
+ import { OfferSliceSegment } from "../../../types/Offer";
4
4
 
5
5
  export interface BaggageSelectionModalHeaderProps {
6
6
  segmentCount: number;
@@ -18,21 +18,26 @@ export const BaggageSelectionModalHeader: React.FC<
18
18
  setCurrentSegmentIndex,
19
19
  }) => (
20
20
  <div style={{ padding: "24px 24px 16px" }}>
21
- <div style={{ display: "flex", columnGap: "4px" }}>
22
- {Array(segmentCount)
23
- .fill(0)
24
- .map((_, index) =>
25
- index === currentSegmentIndex ? (
26
- <ActiveSegment key={`segment_${index}`} />
27
- ) : (
28
- <InactiveSegment
29
- key={`segment_${index}`}
30
- onClick={() => setCurrentSegmentIndex(index)}
31
- />
32
- )
33
- )}
34
- </div>
35
- <h2 className="h3--semibold" style={{ marginTop: "12px" }}>
21
+ {segmentCount > 1 && (
22
+ <div style={{ display: "flex", columnGap: "4px" }}>
23
+ {Array(segmentCount)
24
+ .fill(0)
25
+ .map((_, index) =>
26
+ index === currentSegmentIndex ? (
27
+ <ActiveSegment key={`segment_${index}`} />
28
+ ) : (
29
+ <InactiveSegment
30
+ key={`segment_${index}`}
31
+ onClick={() => setCurrentSegmentIndex(index)}
32
+ />
33
+ )
34
+ )}
35
+ </div>
36
+ )}
37
+ <h2
38
+ className="h3--semibold"
39
+ style={segmentCount > 1 ? { marginTop: "12px" } : {}}
40
+ >
36
41
  Flight to {currentSegment.destination.iata_code}
37
42
  <span
38
43
  className="p2--regular"
@@ -59,7 +64,8 @@ const InactiveSegment: React.FC<{
59
64
  height: "4px",
60
65
  padding: "0",
61
66
  borderRadius: "4px",
62
- backgroundColor: "rgba(var(--ACCENT), var(--ACCENT-LIGHT-200))",
67
+ backgroundColor:
68
+ "var(--TERTIARY, rgba(var(--ACCENT), var(--ACCENT-LIGHT-200)))",
63
69
  transition: "background-color 0.3s var(--TRANSITION-CUBIC-BEZIER)",
64
70
  ...style,
65
71
  }}
@@ -70,7 +76,7 @@ const ActiveSegment = () => (
70
76
  <InactiveSegment
71
77
  onClick={undefined}
72
78
  style={{
73
- backgroundColor: "rgb(var(--ACCENT))",
79
+ backgroundColor: "var(--SECONDARY, rgb(var(--ACCENT)))",
74
80
  }}
75
81
  />
76
82
  );
@@ -1,6 +1,6 @@
1
1
  import { withPlural } from "@lib/withPlural";
2
2
  import React from "react";
3
- import { OfferSliceSegmentPassengerBaggage } from "../../types/Offer";
3
+ import { OfferSliceSegmentPassengerBaggage } from "../../../types/Offer";
4
4
 
5
5
  interface IncludedBaggageBannerProps {
6
6
  includedBaggage: OfferSliceSegmentPassengerBaggage[];
@@ -1,5 +1,5 @@
1
- import { AnimatedLoaderEllipsis } from "@components/AnimatedLoaderEllipsis";
2
- import { Stamp } from "@components/Stamp";
1
+ import { AnimatedLoaderEllipsis } from "@components/shared/AnimatedLoaderEllipsis";
2
+ import { Stamp } from "@components/shared/Stamp";
3
3
  import { getCurrencyForServices } from "@lib/getCurrencyForServices";
4
4
  import { getTotalAmountForServices } from "@lib/getTotalAmountForServices";
5
5
  import { getTotalQuantity } from "@lib/getTotalQuantity";
@@ -7,8 +7,8 @@ import { hasService } from "@lib/hasService";
7
7
  import { isCancelForAnyReasonService } from "@lib/isCancelForAnyReasonService";
8
8
  import { moneyStringFormatter } from "@lib/moneyStringFormatter";
9
9
  import React from "react";
10
- import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
11
- import { Offer } from "../../types/Offer";
10
+ import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
11
+ import { Offer } from "../../../types/Offer";
12
12
  import { Card } from "../Card";
13
13
  import { CfarSelectionModal } from "./CfarSelectionModal";
14
14
 
@@ -1,13 +1,13 @@
1
+ import { Modal } from "@components/shared/Modal";
1
2
  import React from "react";
2
3
  import {
3
4
  CreateOrderPayloadServiceInformationForCancelForAnyReason,
4
5
  CreateOrderPayloadServices,
5
- } from "../../types/CreateOrderPayload";
6
+ } from "../../../types/CreateOrderPayload";
6
7
  import {
7
8
  Offer,
8
9
  OfferAvailableServiceCancelForAnyReason,
9
- } from "../../types/Offer";
10
- import { Modal } from "../Modal";
10
+ } from "../../../types/Offer";
11
11
  import { CfarSelectionModalBody } from "./CfarSelectionModalBody";
12
12
  import { CfarSelectionModalFooter } from "./CfarSelectionModalFooter";
13
13
  import { CfarSelectionModalHeader } from "./CfarSelectionModalHeader";
@@ -1,11 +1,11 @@
1
- import { Icon } from "@components/Icon";
2
- import { ModalBody } from "@components/Modal";
1
+ import { Icon } from "@components/shared//Icon";
2
+ import { ModalBody } from "@components/shared/Modal";
3
3
  import { moneyStringFormatter } from "@lib/moneyStringFormatter";
4
4
  import React from "react";
5
5
  import {
6
6
  Offer,
7
7
  OfferAvailableServiceCancelForAnyReason,
8
- } from "../../types/Offer";
8
+ } from "../../../types/Offer";
9
9
  import { CfarSelectionModalBodyListItem } from "./CfarSelectionModalBodyListItem";
10
10
 
11
11
  export interface CfarSelectionModalBodyProps {
@@ -1,4 +1,4 @@
1
- import { Icon } from "@components/Icon";
1
+ import { Icon } from "@components/shared/Icon";
2
2
  import React, { ReactNode } from "react";
3
3
 
4
4
  export const CfarSelectionModalBodyListItem: React.FC<{
@@ -1,9 +1,9 @@
1
- import { Icon } from "@components/Icon";
1
+ import { Button } from "@components/shared/Button";
2
+ import { Icon } from "@components/shared/Icon";
2
3
  import { moneyStringFormatter } from "@lib/moneyStringFormatter";
3
4
  import React from "react";
4
- import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
5
- import { OfferAvailableServiceCancelForAnyReason } from "../../types/Offer";
6
- import { Button } from "../Button";
5
+ import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
6
+ import { OfferAvailableServiceCancelForAnyReason } from "../../../types/Offer";
7
7
 
8
8
  export interface CfarSelectionModalFooterProps {
9
9
  service: OfferAvailableServiceCancelForAnyReason;
@@ -67,7 +67,7 @@ const ProtectedTripBanner: React.FC = () => (
67
67
  <Icon
68
68
  size={20}
69
69
  name="shield_with_moon"
70
- style={{ fill: "rgb(var(--ACCENT))" }}
70
+ style={{ fill: "var(--SECONDARY, rgb(var(--ACCENT)))" }}
71
71
  />
72
72
  Your trip is protected
73
73
  </div>
@@ -1,7 +1,7 @@
1
+ import { Icon, IconName } from "@components/shared/Icon";
1
2
  import classNames from "classnames";
2
3
  import * as React from "react";
3
- import { SeatMapCabinRowSectionElementAmenity } from "../../types/SeatMap";
4
- import { Icon, IconName } from "../Icon";
4
+ import { SeatMapCabinRowSectionElementAmenity } from "../../../types/SeatMap";
5
5
 
6
6
  const amenitiesWithoutWrapper = ["bassinet", "exit_row"];
7
7
 
@@ -1,4 +1,4 @@
1
- import { Tabs } from "@components/Tabs";
1
+ import { Tabs } from "@components/shared/Tabs";
2
2
  import * as React from "react";
3
3
 
4
4
  export interface DeckSelectProps {
@@ -1,7 +1,7 @@
1
1
  import { isSeatElement } from "@lib/isSeatElement";
2
2
  import * as React from "react";
3
- import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
4
- import { SeatMapCabinRowSectionElement } from "../../types/SeatMap";
3
+ import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
4
+ import { SeatMapCabinRowSectionElement } from "../../../types/SeatMap";
5
5
  import { Amenity } from "./Amenity";
6
6
  import { EmptyElement } from "./EmptyElement";
7
7
  import { ExitElement } from "./ExitElement";
@@ -1,6 +1,6 @@
1
+ import { Icon } from "@components/shared/Icon";
1
2
  import classNames from "classnames";
2
3
  import * as React from "react";
3
- import { Icon } from "../Icon";
4
4
 
5
5
  interface ExitElementProps {
6
6
  isRight: boolean;
@@ -1,6 +1,6 @@
1
- import { Icon, IconName } from "@components/Icon";
1
+ import { Icon, IconName } from "@components/shared/Icon";
2
2
  import * as React from "react";
3
- import { SeatMapCabinRowSectionElementAmenity } from "../../types/SeatMap";
3
+ import { SeatMapCabinRowSectionElementAmenity } from "../../../types/SeatMap";
4
4
 
5
5
  export interface LegendProps {
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { getRowNumber } from "@lib/getRowNumber";
2
2
  import * as React from "react";
3
- import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
4
- import { SeatMapCabinRow } from "../../types/SeatMap";
3
+ import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
4
+ import { SeatMapCabinRow } from "../../../types/SeatMap";
5
5
  import { RowSection } from "./RowSection";
6
6
 
7
7
  export interface RowProps {
@@ -1,7 +1,10 @@
1
1
  import classNames from "classnames";
2
2
  import * as React from "react";
3
- import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
4
- import { SeatMapCabinRow, SeatMapCabinRowSection } from "../../types/SeatMap";
3
+ import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
4
+ import {
5
+ SeatMapCabinRow,
6
+ SeatMapCabinRowSection,
7
+ } from "../../../types/SeatMap";
5
8
  import { Element } from "./Element";
6
9
  import { EmptyElement } from "./EmptyElement";
7
10
 
@@ -1,10 +1,10 @@
1
+ import { Icon } from "@components/shared/Icon";
1
2
  import { getPassengerInitials } from "@lib/getPassengerInitials";
2
3
  import { moneyStringFormatter } from "@lib/moneyStringFormatter";
3
4
  import classNames from "classnames";
4
5
  import * as React from "react";
5
- import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
6
- import { SeatMapCabinRowSectionElementSeat } from "../../types/SeatMap";
7
- import { Icon } from "../Icon";
6
+ import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
7
+ import { SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
8
8
  import { SeatInfo } from "./SeatInfo";
9
9
  import { SeatUnavailable } from "./SeatUnavailable";
10
10
 
@@ -3,7 +3,7 @@ import * as React from "react";
3
3
  import {
4
4
  SeatMapCabinRowSectionAvailableService,
5
5
  SeatMapCabinRowSectionElementSeat,
6
- } from "../../types/SeatMap";
6
+ } from "../../../types/SeatMap";
7
7
 
8
8
  export interface SeatInfoProps {
9
9
  seat: SeatMapCabinRowSectionElementSeat | null;
@@ -3,8 +3,8 @@ import { getSymbols } from "@lib/getSymbols";
3
3
  import { hasWings } from "@lib/hasWings";
4
4
  import classNames from "classnames";
5
5
  import * as React from "react";
6
- import { CreateOrderPayloadSeatService } from "../../types/CreateOrderPayload";
7
- import { SeatMap as SeatMapType } from "../../types/SeatMap";
6
+ import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
7
+ import { SeatMap as SeatMapType } from "../../../types/SeatMap";
8
8
  import { DeckSelect } from "./DeckSelect";
9
9
  import { Legend } from "./Legend";
10
10
  import { Row } from "./Row";
@@ -29,6 +29,10 @@ export const SeatMap: React.FC<SeatMapProps> = ({
29
29
  }) => {
30
30
  const [selectedDeck, setSelectedDeck] = React.useState(0);
31
31
 
32
+ if (!seatMap || !seatMap.cabins || !seatMap.cabins.length) {
33
+ return <SeatMapUnavailable />;
34
+ }
35
+
32
36
  const cabins = getCabinsForSegmentAndDeck(selectedDeck, seatMap);
33
37
  const hasMultipleDecks = cabins.length !== seatMap.cabins.length;
34
38
  const anyHasWings = seatMap.cabins.some((cabin) => cabin.wings);
@@ -1,4 +1,4 @@
1
- import { NonIdealState } from "@components/NonIdealState";
1
+ import { NonIdealState } from "@components/shared/NonIdealState";
2
2
  import * as React from "react";
3
3
 
4
4
  export const SeatMapUnavailable: React.FC = () => (
@@ -1,3 +1,5 @@
1
+ import { AnimatedLoaderEllipsis } from "@components/shared/AnimatedLoaderEllipsis";
2
+ import { Stamp } from "@components/shared/Stamp";
1
3
  import { getCurrencyForSeatMaps } from "@lib/getCurrencyForSeatMaps";
2
4
  import { getTotalAmountForServices } from "@lib/getTotalAmountForServices";
3
5
  import { getTotalQuantity } from "@lib/getTotalQuantity";
@@ -8,12 +10,10 @@ import {
8
10
  CreateOrderPayload,
9
11
  CreateOrderPayloadSeatService,
10
12
  CreateOrderPayloadServices,
11
- } from "../../types/CreateOrderPayload";
12
- import { Offer } from "../../types/Offer";
13
- import { SeatMap } from "../../types/SeatMap";
14
- import { AnimatedLoaderEllipsis } from "../AnimatedLoaderEllipsis";
13
+ } from "../../../types/CreateOrderPayload";
14
+ import { Offer } from "../../../types/Offer";
15
+ import { SeatMap } from "../../../types/SeatMap";
15
16
  import { Card } from "../Card";
16
- import { Stamp } from "../Stamp";
17
17
  import { SeatSelectionModal } from "./SeatSelectionModal";
18
18
 
19
19
  export interface SeatSelectionCardProps {
@@ -1,3 +1,4 @@
1
+ import { Modal } from "@components/shared/Modal";
1
2
  import { getCurrencyForSeatMaps } from "@lib/getCurrencyForSeatMaps";
2
3
  import { getPassengerBySegmentList } from "@lib/getPassengerBySegmentList";
3
4
  import { getPassengerMapById } from "@lib/getPassengerMapById";
@@ -8,10 +9,9 @@ import React from "react";
8
9
  import {
9
10
  CreateOrderPayload,
10
11
  CreateOrderPayloadSeatService,
11
- } from "../../types/CreateOrderPayload";
12
- import { Offer } from "../../types/Offer";
13
- import { SeatMap } from "../../types/SeatMap";
14
- import { Modal } from "../Modal";
12
+ } from "../../../types/CreateOrderPayload";
13
+ import { Offer } from "../../../types/Offer";
14
+ import { SeatMap } from "../../../types/SeatMap";
15
15
  import { SeatSelectionModalBody } from "./SeatSelectionModalBody";
16
16
  import { SeatSelectionModalFooter } from "./SeatSelectionModalFooter";
17
17
  import { SeatSelectionModalHeader } from "./SeatSelectionModalHeader";
@@ -100,7 +100,7 @@ export const SeatSelectionModal: React.FC<SeatSelectionModalProps> = ({
100
100
  getCurrencyForSeatMaps(seatMaps) ?? offer.total_currency;
101
101
 
102
102
  return (
103
- <Modal isOpen={isOpen} onClose={() => onClose(selectedServicesState)}>
103
+ <Modal isOpen={isOpen} onClose={() => onClose(selectedServices)}>
104
104
  <SeatSelectionModalHeader
105
105
  segmentAndPassengerPermutationsCount={
106
106
  segmentAndPassengerPermutations.length
@@ -1,4 +1,4 @@
1
- import { ModalBody } from "@components/Modal";
1
+ import { ModalBody } from "@components/shared/Modal";
2
2
  import React from "react";
3
3
  import { SeatMap, SeatMapProps } from "./SeatMap";
4
4
 
@@ -1,12 +1,12 @@
1
+ import { Button } from "@components/shared/Button";
1
2
  import { ServicePriceMapById } from "@lib/getServicePriceMapById";
2
3
  import { getTotalAmountForServicesWithPriceMap } from "@lib/getTotalAmountForServices";
3
4
  import { getTotalQuantity } from "@lib/getTotalQuantity";
4
5
  import { moneyStringFormatter } from "@lib/moneyStringFormatter";
5
6
  import { withPlural } from "@lib/withPlural";
6
7
  import React from "react";
7
- import { CreateOrderPayloadServices } from "../../types/CreateOrderPayload";
8
- import { SeatMap } from "../../types/SeatMap";
9
- import { Button } from "../Button";
8
+ import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
9
+ import { SeatMap } from "../../../types/SeatMap";
10
10
 
11
11
  export interface SeatSelectionModalFooterProps {
12
12
  currency: string;
@@ -42,6 +42,7 @@ export const SeatSelectionModalFooter: React.FC<
42
42
  seatMaps
43
43
  );
44
44
  const totalAmountLabel = moneyStringFormatter(currency)(totalAmount);
45
+ const isOneWay = isFirstSegment && isLastSegment;
45
46
 
46
47
  return (
47
48
  <div style={{ padding: "16px 24px 24px" }}>
@@ -51,21 +52,27 @@ export const SeatSelectionModalFooter: React.FC<
51
52
  </div>
52
53
 
53
54
  <div
54
- style={{
55
- marginTop: "16px",
56
- display: "grid",
57
- columnGap: "12px",
58
- gridTemplateColumns: "repeat(2, 1fr)",
59
- }}
55
+ style={
56
+ isOneWay
57
+ ? { marginTop: "16px", display: "grid" }
58
+ : {
59
+ marginTop: "16px",
60
+ display: "grid",
61
+ columnGap: "12px",
62
+ gridTemplateColumns: "repeat(2, 1fr)",
63
+ }
64
+ }
60
65
  >
61
- <Button
62
- size={48}
63
- disabled={isFirstSegment}
64
- variant="outlined"
65
- onClick={() => onPreviousSegmentButtonClicked()}
66
- >
67
- Back
68
- </Button>
66
+ {!isOneWay && (
67
+ <Button
68
+ size={48}
69
+ disabled={isFirstSegment}
70
+ variant="outlined"
71
+ onClick={() => onPreviousSegmentButtonClicked()}
72
+ >
73
+ Back
74
+ </Button>
75
+ )}
69
76
 
70
77
  <Button
71
78
  size={48}
@@ -1,6 +1,6 @@
1
1
  import { formatDateString } from "@lib/formatDate";
2
2
  import React from "react";
3
- import { OfferSliceSegment } from "../../types/Offer";
3
+ import { OfferSliceSegment } from "../../../types/Offer";
4
4
 
5
5
  export interface SeatSelectionModalHeaderProps {
6
6
  segmentAndPassengerPermutationsCount: number;
@@ -21,23 +21,32 @@ export const SeatSelectionModalHeader: React.FC<
21
21
  setCurrentSegmentAndPassengerPermutationsIndex,
22
22
  }) => (
23
23
  <div style={{ padding: "24px 24px 16px" }}>
24
- <div style={{ display: "flex", columnGap: "4px" }}>
25
- {Array(segmentAndPassengerPermutationsCount)
26
- .fill(0)
27
- .map((_, index) =>
28
- index === currentSegmentAndPassengerPermutationsIndex ? (
29
- <ActiveSegment key={`segment_${index}`} />
30
- ) : (
31
- <InactiveSegment
32
- key={`segment_${index}`}
33
- onClick={() =>
34
- setCurrentSegmentAndPassengerPermutationsIndex(index)
35
- }
36
- />
37
- )
38
- )}
39
- </div>
40
- <h2 className="h3--semibold" style={{ marginBlock: "12px 0px" }}>
24
+ {segmentAndPassengerPermutationsCount > 1 && (
25
+ <div style={{ display: "flex", columnGap: "4px" }}>
26
+ {Array(segmentAndPassengerPermutationsCount)
27
+ .fill(0)
28
+ .map((_, index) =>
29
+ index === currentSegmentAndPassengerPermutationsIndex ? (
30
+ <ActiveSegment key={`segment_${index}`} />
31
+ ) : (
32
+ <InactiveSegment
33
+ key={`segment_${index}`}
34
+ onClick={() =>
35
+ setCurrentSegmentAndPassengerPermutationsIndex(index)
36
+ }
37
+ />
38
+ )
39
+ )}
40
+ </div>
41
+ )}
42
+ <h2
43
+ className="h3--semibold"
44
+ style={
45
+ segmentAndPassengerPermutationsCount > 1
46
+ ? { marginBlock: "12px 0px" }
47
+ : {}
48
+ }
49
+ >
41
50
  Flight to {currentSegment.destination.iata_code}
42
51
  <span
43
52
  className="p2--regular"
@@ -70,7 +79,8 @@ const InactiveSegment: React.FC<{
70
79
  height: "4px",
71
80
  padding: "0",
72
81
  borderRadius: "4px",
73
- backgroundColor: "rgba(var(--ACCENT), var(--ACCENT-LIGHT-200))",
82
+ backgroundColor:
83
+ "var(--TERTIARY, rgba(var(--ACCENT), var(--ACCENT-LIGHT-200)))",
74
84
  transition: "background-color 0.3s var(--TRANSITION-CUBIC-BEZIER)",
75
85
  ...style,
76
86
  }}
@@ -81,7 +91,7 @@ const ActiveSegment = () => (
81
91
  <InactiveSegment
82
92
  onClick={undefined}
83
93
  style={{
84
- backgroundColor: "rgb(var(--ACCENT))",
94
+ backgroundColor: "var(--SECONDARY, rgb(var(--ACCENT)))",
85
95
  }}
86
96
  />
87
97
  );
@@ -1,6 +1,6 @@
1
+ import { Icon } from "@components/shared/Icon";
1
2
  import * as React from "react";
2
- import { SeatMapCabinRowSectionElementSeat } from "../../types/SeatMap";
3
- import { Icon } from "../Icon";
3
+ import { SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
4
4
 
5
5
  export const SeatUnavailable: React.FC<{
6
6
  seat: SeatMapCabinRowSectionElementSeat;