@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.
- package/.eslintrc.js +8 -0
- package/.github/CODEOWNERS +4 -0
- package/.github/renovate.json +1 -5
- package/.github/workflows/release.yml +3 -0
- package/.storybook/__snapshots__/Storyshots.test.js.snap +20384 -533
- package/README.md +16 -2
- package/config/esbuild.base.config.js +6 -2
- package/config/esbuild.cdn.config.js +2 -1
- package/config/esbuild.dev.config.js +2 -1
- package/config/esbuild.react.config.js +1 -1
- package/data/airports.csv +9084 -0
- package/data/cities.csv +256 -0
- package/package.json +11 -1
- package/react-dist/components/{Card.d.ts → DuffelAncillaries/Card.d.ts} +1 -1
- package/react-dist/components/{DuffelAncillaries.d.ts → DuffelAncillaries/DuffelAncillaries.d.ts} +1 -1
- package/react-dist/components/{DuffelAncillariesCustomElement.d.ts → DuffelAncillaries/DuffelAncillariesCustomElement.d.ts} +1 -1
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionCard.d.ts +2 -2
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionController.d.ts +2 -2
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModal.d.ts +2 -2
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBody.d.ts +2 -2
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBodyPassenger.d.ts +2 -2
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalFooter.d.ts +1 -1
- package/react-dist/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalHeader.d.ts +1 -1
- package/react-dist/components/{bags → DuffelAncillaries/bags}/IncludedBaggageBanner.d.ts +1 -1
- package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionCard.d.ts +2 -2
- package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModal.d.ts +2 -2
- package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBody.d.ts +1 -1
- package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalFooter.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/Amenity.d.ts +1 -1
- package/react-dist/components/{seats → DuffelAncillaries/seats}/Element.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/Legend.d.ts +1 -1
- package/react-dist/components/{seats → DuffelAncillaries/seats}/Row.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/RowSection.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatElement.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatInfo.d.ts +1 -1
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatMap.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionCard.d.ts +3 -3
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModal.d.ts +3 -3
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalFooter.d.ts +2 -2
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalHeader.d.ts +1 -1
- package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatUnavailable.d.ts +1 -1
- package/react-dist/components/DuffelPayments/DuffelPayments.d.ts +11 -0
- package/react-dist/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +14 -0
- package/react-dist/components/PlacesLookup/PlacesLookup.d.ts +20 -0
- package/react-dist/components/{Button.d.ts → shared/Button.d.ts} +2 -2
- package/react-dist/components/{ErrorBoundary.d.ts → shared/ErrorBoundary.d.ts} +1 -1
- package/react-dist/components/{Icon.d.ts → shared/Icon.d.ts} +2 -0
- package/react-dist/components/{IconButton.d.ts → shared/IconButton.d.ts} +1 -1
- package/react-dist/components/{NonIdealState.d.ts → shared/NonIdealState.d.ts} +1 -1
- package/react-dist/custom-elements.d.ts +2 -1
- package/react-dist/custom-elements.js +21 -20
- package/react-dist/custom-elements.js.map +4 -4
- package/react-dist/index.d.ts +3 -1
- package/react-dist/index.js +51 -21
- package/react-dist/index.js.map +4 -4
- package/react-dist/lib/captureErrorInSentry.d.ts +1 -1
- package/react-dist/lib/fetchFromDuffelAPI.d.ts +7 -0
- package/react-dist/lib/hasHighLuminance.d.ts +1 -0
- package/react-dist/lib/logging.d.ts +7 -14
- package/react-dist/lib/retrieveSeatMaps.d.ts +1 -1
- package/react-dist/types/DuffelAncillariesProps.d.ts +1 -1
- package/scripts/generate-fixture.ts +13 -8
- package/scripts/setup-suggestion-data.ts +100 -0
- package/scripts/upload-to-cdn.sh +1 -1
- package/src/components/{Card.tsx → DuffelAncillaries/Card.tsx} +1 -1
- package/src/components/{Counter.tsx → DuffelAncillaries/Counter.tsx} +1 -1
- package/src/components/{DuffelAncillaries.tsx → DuffelAncillaries/DuffelAncillaries.tsx} +68 -64
- package/src/components/{DuffelAncillariesCustomElement.tsx → DuffelAncillaries/DuffelAncillariesCustomElement.tsx} +2 -2
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionCard.tsx +10 -5
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionController.tsx +2 -2
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModal.tsx +4 -4
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBody.tsx +3 -3
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalBodyPassenger.tsx +4 -4
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalFooter.tsx +23 -16
- package/src/components/{bags → DuffelAncillaries/bags}/BaggageSelectionModalHeader.tsx +24 -18
- package/src/components/{bags → DuffelAncillaries/bags}/IncludedBaggageBanner.tsx +1 -1
- package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionCard.tsx +4 -4
- package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModal.tsx +3 -3
- package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBody.tsx +3 -3
- package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBodyListItem.tsx +1 -1
- package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalFooter.tsx +5 -5
- package/src/components/{seats → DuffelAncillaries/seats}/Amenity.tsx +2 -2
- package/src/components/{seats → DuffelAncillaries/seats}/DeckSelect.tsx +1 -1
- package/src/components/{seats → DuffelAncillaries/seats}/Element.tsx +2 -2
- package/src/components/{seats → DuffelAncillaries/seats}/ExitElement.tsx +1 -1
- package/src/components/{seats → DuffelAncillaries/seats}/Legend.tsx +2 -2
- package/src/components/{seats → DuffelAncillaries/seats}/Row.tsx +2 -2
- package/src/components/{seats → DuffelAncillaries/seats}/RowSection.tsx +5 -2
- package/src/components/{seats → DuffelAncillaries/seats}/SeatElement.tsx +3 -3
- package/src/components/{seats → DuffelAncillaries/seats}/SeatInfo.tsx +1 -1
- package/src/components/{seats → DuffelAncillaries/seats}/SeatMap.tsx +6 -2
- package/src/components/{seats → DuffelAncillaries/seats}/SeatMapUnavailable.tsx +1 -1
- package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionCard.tsx +5 -5
- package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModal.tsx +5 -5
- package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalBody.tsx +1 -1
- package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalFooter.tsx +24 -17
- package/src/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalHeader.tsx +30 -20
- package/src/components/{seats → DuffelAncillaries/seats}/SeatUnavailable.tsx +2 -2
- package/src/components/DuffelPayments/DuffelPayments.tsx +224 -0
- package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +130 -0
- package/src/components/PlacesLookup/PlacesLookup.tsx +123 -0
- package/src/components/{Button.tsx → shared/Button.tsx} +4 -3
- package/src/components/{ErrorBoundary.tsx → shared/ErrorBoundary.tsx} +2 -2
- package/src/components/{Icon.tsx → shared/Icon.tsx} +11 -11
- package/src/components/{IconButton.tsx → shared/IconButton.tsx} +1 -1
- package/src/components/{Modal.tsx → shared/Modal.tsx} +5 -1
- package/src/components/{NonIdealState.tsx → shared/NonIdealState.tsx} +1 -1
- package/src/custom-elements.ts +6 -1
- package/src/examples/client-side/index.html +1 -1
- package/src/examples/full-stack/index.html +1 -1
- package/src/examples/full-stack/server.mjs +1 -0
- package/src/examples/just-typescript/src/index.html +2 -2
- package/src/examples/just-typescript/src/index.ts +2 -1
- package/src/examples/payments-custom-element/README.md +17 -0
- package/src/examples/payments-custom-element/index.html +43 -0
- package/src/examples/payments-just-typescript/README.md +37 -0
- package/src/examples/payments-just-typescript/package.json +16 -0
- package/src/examples/payments-just-typescript/src/index.html +23 -0
- package/src/examples/payments-just-typescript/src/index.ts +18 -0
- package/src/examples/payments-just-typescript/yarn.lock +154 -0
- package/src/examples/react-app/src/index.tsx +11 -6
- package/src/fixtures/offers/off_1.json +1 -10
- package/src/index.ts +3 -1
- package/src/lib/captureErrorInSentry.ts +2 -20
- package/src/lib/fetchFromDuffelAPI.ts +36 -6
- package/src/lib/formatDate.ts +3 -4
- package/src/lib/getBaggageServiceDescription.ts +1 -6
- package/src/lib/getPassengerName.ts +4 -0
- package/src/lib/getTotalAmountForServices.ts +1 -1
- package/src/lib/hasHighLuminance.ts +9 -0
- package/src/lib/logging.ts +52 -32
- package/src/lib/retrieveOffer.ts +13 -6
- package/src/lib/retrieveSeatMaps.ts +13 -8
- package/src/stories/BaggageSelectionModalHeader.stories.tsx +1 -1
- package/src/stories/Button.stories.tsx +33 -2
- package/src/stories/DuffelAncillaries.stories.tsx +42 -2
- package/src/stories/DuffelPayments.stories.tsx +34 -0
- package/src/stories/Icon.stories.tsx +3 -2
- package/src/stories/IconButton.stories.tsx +1 -1
- package/src/stories/PlacesLookup.stories.tsx +22 -0
- package/src/styles/components/Button.css +11 -3
- package/src/styles/components/Card.css +3 -3
- package/src/styles/components/CfarSelectionModal.css +1 -1
- package/src/styles/components/DuffelPayments.css +42 -0
- package/src/styles/components/Legend.css +10 -6
- package/src/styles/components/LoadingState.css +8 -2
- package/src/styles/components/Modal.css +2 -1
- package/src/styles/components/PassengerSelect.css +8 -2
- package/src/styles/components/PlacesLookup.css +36 -0
- package/src/styles/components/Seat.css +9 -7
- package/src/styles/components/SeatInfo.css +1 -1
- package/src/styles/components/Tabs.css +5 -2
- package/src/styles/global.css +2 -0
- package/src/tests/components/DuffelAncillaries.test.tsx +1 -1
- package/src/tests/lib/createPriceFormatters.test.tsx +1 -1
- package/src/tests/lib/formatAvailableServices.test.tsx +1 -1
- package/src/tests/lib/formatSeatMaps.test.tsx +2 -2
- package/src/tests/lib/getCurrencyForServices.test.tsx +1 -1
- package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +1 -1
- package/src/tests/lib/logging.test.tsx +14 -14
- package/src/tests/lib/moneyStringFormatter.test.tsx +1 -1
- package/src/tests/lib/validateProps.test.tsx +1 -1
- package/src/types/DuffelAncillariesProps.ts +1 -1
- /package/react-dist/components/{Counter.d.ts → DuffelAncillaries/Counter.d.ts} +0 -0
- /package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalBodyListItem.d.ts +0 -0
- /package/react-dist/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalHeader.d.ts +0 -0
- /package/react-dist/components/{seats → DuffelAncillaries/seats}/DeckSelect.d.ts +0 -0
- /package/react-dist/components/{seats → DuffelAncillaries/seats}/EmptyElement.d.ts +0 -0
- /package/react-dist/components/{seats → DuffelAncillaries/seats}/ExitElement.d.ts +0 -0
- /package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatMapUnavailable.d.ts +0 -0
- /package/react-dist/components/{seats → DuffelAncillaries/seats}/SeatSelectionModalBody.d.ts +0 -0
- /package/react-dist/components/{AnimatedLoaderEllipsis.d.ts → shared/AnimatedLoaderEllipsis.d.ts} +0 -0
- /package/react-dist/components/{FetchOfferErrorState.d.ts → shared/FetchOfferErrorState.d.ts} +0 -0
- /package/react-dist/components/{Modal.d.ts → shared/Modal.d.ts} +0 -0
- /package/react-dist/components/{Stamp.d.ts → shared/Stamp.d.ts} +0 -0
- /package/react-dist/components/{Tabs.d.ts → shared/Tabs.d.ts} +0 -0
- /package/src/components/{cancel_for_any_reason → DuffelAncillaries/cancel_for_any_reason}/CfarSelectionModalHeader.tsx +0 -0
- /package/src/components/{seats → DuffelAncillaries/seats}/EmptyElement.tsx +0 -0
- /package/src/components/{AnimatedLoaderEllipsis.tsx → shared/AnimatedLoaderEllipsis.tsx} +0 -0
- /package/src/components/{FetchOfferErrorState.tsx → shared/FetchOfferErrorState.tsx} +0 -0
- /package/src/components/{Stamp.tsx → shared/Stamp.tsx} +0 -0
- /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 "
|
|
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
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
index
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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:
|
|
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 "
|
|
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 "
|
|
11
|
-
import { Offer } from "
|
|
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 "
|
|
6
|
+
} from "../../../types/CreateOrderPayload";
|
|
6
7
|
import {
|
|
7
8
|
Offer,
|
|
8
9
|
OfferAvailableServiceCancelForAnyReason,
|
|
9
|
-
} from "
|
|
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 "
|
|
8
|
+
} from "../../../types/Offer";
|
|
9
9
|
import { CfarSelectionModalBodyListItem } from "./CfarSelectionModalBodyListItem";
|
|
10
10
|
|
|
11
11
|
export interface CfarSelectionModalBodyProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
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 "
|
|
5
|
-
import { OfferAvailableServiceCancelForAnyReason } from "
|
|
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 "
|
|
4
|
-
import { Icon, IconName } from "../Icon";
|
|
4
|
+
import { SeatMapCabinRowSectionElementAmenity } from "../../../types/SeatMap";
|
|
5
5
|
|
|
6
6
|
const amenitiesWithoutWrapper = ["bassinet", "exit_row"];
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isSeatElement } from "@lib/isSeatElement";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { CreateOrderPayloadSeatService } from "
|
|
4
|
-
import { SeatMapCabinRowSectionElement } from "
|
|
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, IconName } from "@components/Icon";
|
|
1
|
+
import { Icon, IconName } from "@components/shared/Icon";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { SeatMapCabinRowSectionElementAmenity } from "
|
|
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 "
|
|
4
|
-
import { SeatMapCabinRow } from "
|
|
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 "
|
|
4
|
-
import {
|
|
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 "
|
|
6
|
-
import { SeatMapCabinRowSectionElementSeat } from "
|
|
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 "
|
|
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 "
|
|
7
|
-
import { SeatMap as SeatMapType } from "
|
|
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,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 "
|
|
12
|
-
import { Offer } from "
|
|
13
|
-
import { SeatMap } from "
|
|
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 "
|
|
12
|
-
import { Offer } from "
|
|
13
|
-
import { SeatMap } from "
|
|
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(
|
|
103
|
+
<Modal isOpen={isOpen} onClose={() => onClose(selectedServices)}>
|
|
104
104
|
<SeatSelectionModalHeader
|
|
105
105
|
segmentAndPassengerPermutationsCount={
|
|
106
106
|
segmentAndPassengerPermutations.length
|
|
@@ -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 "
|
|
8
|
-
import { SeatMap } from "
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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 "
|
|
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
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
index
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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:
|
|
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 "
|
|
3
|
-
import { Icon } from "../Icon";
|
|
3
|
+
import { SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
|
|
4
4
|
|
|
5
5
|
export const SeatUnavailable: React.FC<{
|
|
6
6
|
seat: SeatMapCabinRowSectionElementSeat;
|