@duffel/components 2.7.20 → 3.0.1-canary
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +67 -0
- package/.eslintrc.js +34 -0
- package/.github/renovate.json +16 -0
- package/.github/workflows/autoapprove.yml +18 -0
- package/.github/workflows/release.yml +86 -0
- package/.husky/post-commit +4 -0
- package/.husky/pre-commit +4 -0
- package/.nvmrc +1 -0
- package/.prettierignore +2 -0
- package/.storybook/Storyshots.test.js +3 -0
- package/.storybook/__snapshots__/Storyshots.test.js.snap +48133 -0
- package/.storybook/main.ts +33 -0
- package/.storybook/preview.tsx +28 -0
- package/.tool-versions +1 -0
- package/CONTRIBUTING.md +131 -0
- package/README.md +4 -21
- package/__mocks__/styleMock.js +6 -0
- package/babel.config.js +20 -0
- package/commitlint.config.js +4 -0
- package/config/esbuild.base.config.js +14 -0
- package/config/esbuild.cdn.config.js +50 -0
- package/config/esbuild.dev.config.js +45 -0
- package/config/esbuild.react.config.js +42 -0
- package/jest.config.ts +14 -0
- package/package.json +123 -192
- package/react-dist/components/AnimatedLoaderEllipsis.d.ts +2 -0
- package/react-dist/components/Button.d.ts +23 -0
- package/react-dist/components/Card.d.ts +14 -0
- package/react-dist/components/Counter.d.ts +10 -0
- package/react-dist/components/DuffelAncillaries.d.ts +3 -0
- package/react-dist/components/DuffelAncillariesCustomElement.d.ts +13 -0
- package/react-dist/components/ErrorBoundary.d.ts +13 -0
- package/react-dist/components/FetchOfferErrorState.d.ts +5 -0
- package/react-dist/components/Icon.d.ts +44 -0
- package/react-dist/components/IconButton.d.ts +16 -0
- package/react-dist/components/Modal.d.ts +11 -0
- package/react-dist/components/NonIdealState.d.ts +4 -0
- package/react-dist/components/Stamp.d.ts +7 -0
- package/react-dist/components/Tabs.d.ts +16 -0
- package/react-dist/components/bags/BaggageSelectionCard.d.ts +11 -0
- package/react-dist/components/bags/BaggageSelectionController.d.ts +13 -0
- package/react-dist/components/bags/BaggageSelectionModal.d.ts +11 -0
- package/react-dist/components/bags/BaggageSelectionModalBody.d.ts +11 -0
- package/react-dist/components/bags/BaggageSelectionModalBodyPassenger.d.ts +13 -0
- package/react-dist/components/bags/BaggageSelectionModalFooter.d.ts +14 -0
- package/react-dist/components/bags/BaggageSelectionModalHeader.d.ts +9 -0
- package/react-dist/components/bags/IncludedBaggageBanner.d.ts +7 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionCard.d.ts +10 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionModal.d.ts +11 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBody.d.ts +7 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +11 -0
- package/react-dist/components/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
- package/react-dist/components/seats/Amenity.d.ts +6 -0
- package/react-dist/components/seats/DeckSelect.d.ts +15 -0
- package/react-dist/components/seats/Element.d.ts +15 -0
- package/react-dist/components/seats/EmptyElement.d.ts +2 -0
- package/react-dist/components/seats/ExitElement.d.ts +6 -0
- package/react-dist/components/seats/Legend.d.ts +12 -0
- package/react-dist/components/seats/Row.d.ts +13 -0
- package/react-dist/components/seats/RowSection.d.ts +17 -0
- package/react-dist/components/seats/SeatElement.d.ts +13 -0
- package/react-dist/components/seats/SeatInfo.d.ts +7 -0
- package/react-dist/components/seats/SeatMap.d.ts +12 -0
- package/react-dist/components/seats/SeatMapUnavailable.d.ts +2 -0
- package/react-dist/components/seats/SeatSelectionCard.d.ts +13 -0
- package/react-dist/components/seats/SeatSelectionModal.d.ts +13 -0
- package/react-dist/components/seats/SeatSelectionModalBody.d.ts +4 -0
- package/react-dist/components/seats/SeatSelectionModalFooter.d.ts +16 -0
- package/react-dist/components/seats/SeatSelectionModalHeader.d.ts +10 -0
- package/react-dist/components/seats/SeatUnavailable.d.ts +5 -0
- package/react-dist/index.d.ts +8 -0
- package/react-dist/index.js +2 -0
- package/react-dist/index.js.map +7 -0
- package/react-dist/lib/captureErrorInSentry.d.ts +1 -0
- package/react-dist/lib/compileCreateOrderPayload.d.ts +14 -0
- package/react-dist/lib/createPriceFormatters.d.ts +12 -0
- package/react-dist/lib/fetchFromDuffelAPI.d.ts +1 -0
- package/react-dist/lib/fetchFromFixtures.d.ts +4 -0
- package/react-dist/lib/formatAvailableServices.d.ts +12 -0
- package/react-dist/lib/formatDate.d.ts +2 -0
- package/react-dist/lib/formatSeatMaps.d.ts +4 -0
- package/react-dist/lib/getBaggageServiceDescription.d.ts +2 -0
- package/react-dist/lib/getCabinsForSegmentAndDeck.d.ts +2 -0
- package/react-dist/lib/getCurrencyForSeatMaps.d.ts +10 -0
- package/react-dist/lib/getCurrencyForServices.d.ts +11 -0
- package/react-dist/lib/getFirstSeatElementMatchingCriteria.d.ts +3 -0
- package/react-dist/lib/getPassengerBySegmentList.d.ts +6 -0
- package/react-dist/lib/getPassengerInitials.d.ts +1 -0
- package/react-dist/lib/getPassengerMapById.d.ts +3 -0
- package/react-dist/lib/getPassengerName.d.ts +3 -0
- package/react-dist/lib/getRowNumber.d.ts +2 -0
- package/react-dist/lib/getSegmentList.d.ts +2 -0
- package/react-dist/lib/getServicePriceMapById.d.ts +3 -0
- package/react-dist/lib/getSymbols.d.ts +2 -0
- package/react-dist/lib/getTotalAmountForServices.d.ts +6 -0
- package/react-dist/lib/getTotalQuantity.d.ts +2 -0
- package/react-dist/lib/hasService.d.ts +2 -0
- package/react-dist/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +3 -0
- package/react-dist/lib/hasWings.d.ts +2 -0
- package/react-dist/lib/isBaggageService.d.ts +2 -0
- package/react-dist/lib/isCancelForAnyReasonService.d.ts +2 -0
- package/react-dist/lib/isFixtureOfferId.d.ts +2 -0
- package/react-dist/lib/isPayloadComplete.d.ts +2 -0
- package/react-dist/lib/isSeatElement.d.ts +2 -0
- package/react-dist/lib/logging.d.ts +53 -0
- package/react-dist/lib/moneyStringFormatter.d.ts +8 -0
- package/react-dist/lib/offerIsExpired.d.ts +2 -0
- package/react-dist/lib/retrieveOffer.d.ts +2 -0
- package/react-dist/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
- package/react-dist/lib/retrieveSeatMaps.d.ts +2 -0
- package/react-dist/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
- package/react-dist/lib/setBodyScrollability.d.ts +1 -0
- package/react-dist/lib/validateProps.d.ts +7 -0
- package/react-dist/lib/withPlural.d.ts +1 -0
- package/react-dist/types/Aircraft.d.ts +14 -0
- package/react-dist/types/Airline.d.ts +14 -0
- package/react-dist/types/Airport.d.ts +44 -0
- package/react-dist/types/City.d.ts +18 -0
- package/react-dist/types/CreateOrderPayload.d.ts +72 -0
- package/react-dist/types/CurrencyConversion.d.ts +10 -0
- package/react-dist/types/DuffelAncillariesProps.d.ts +70 -0
- package/react-dist/types/Offer.d.ts +711 -0
- package/react-dist/types/Order.d.ts +8 -0
- package/react-dist/types/Place.d.ts +8 -0
- package/react-dist/types/SeatMap.d.ts +190 -0
- package/react-dist/types/index.d.ts +11 -0
- package/scripts/generate-fixture.ts +195 -0
- package/scripts/upload-to-cdn.sh +39 -0
- package/scripts.tsconfig.json +11 -0
- package/src/components/AnimatedLoaderEllipsis.tsx +5 -0
- package/src/components/Button.tsx +62 -0
- package/src/components/Card.tsx +126 -0
- package/src/components/Counter.tsx +40 -0
- package/src/components/DuffelAncillaries.tsx +346 -0
- package/src/components/DuffelAncillariesCustomElement.tsx +124 -0
- package/src/components/ErrorBoundary.tsx +54 -0
- package/src/components/FetchOfferErrorState.tsx +35 -0
- package/src/components/Icon.tsx +151 -0
- package/src/components/IconButton.tsx +42 -0
- package/src/components/Modal.tsx +36 -0
- package/src/components/NonIdealState.tsx +28 -0
- package/src/components/Stamp.tsx +29 -0
- package/src/components/Tabs.tsx +36 -0
- package/src/components/bags/BaggageSelectionCard.tsx +96 -0
- package/src/components/bags/BaggageSelectionController.tsx +88 -0
- package/src/components/bags/BaggageSelectionModal.tsx +81 -0
- package/src/components/bags/BaggageSelectionModalBody.tsx +60 -0
- package/src/components/bags/BaggageSelectionModalBodyPassenger.tsx +122 -0
- package/src/components/bags/BaggageSelectionModalFooter.tsx +81 -0
- package/src/components/bags/BaggageSelectionModalHeader.tsx +76 -0
- package/src/components/bags/IncludedBaggageBanner.tsx +51 -0
- package/src/components/cancel_for_any_reason/CfarSelectionCard.tsx +90 -0
- package/src/components/cancel_for_any_reason/CfarSelectionModal.tsx +63 -0
- package/src/components/cancel_for_any_reason/CfarSelectionModalBody.tsx +56 -0
- package/src/components/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +11 -0
- package/src/components/cancel_for_any_reason/CfarSelectionModalFooter.tsx +74 -0
- package/src/components/cancel_for_any_reason/CfarSelectionModalHeader.tsx +9 -0
- package/src/components/seats/Amenity.tsx +21 -0
- package/src/components/seats/DeckSelect.tsx +27 -0
- package/src/components/seats/Element.tsx +52 -0
- package/src/components/seats/EmptyElement.tsx +5 -0
- package/src/components/seats/ExitElement.tsx +17 -0
- package/src/components/seats/Legend.tsx +60 -0
- package/src/components/seats/Row.tsx +47 -0
- package/src/components/seats/RowSection.tsx +75 -0
- package/src/components/seats/SeatElement.tsx +120 -0
- package/src/components/seats/SeatInfo.tsx +32 -0
- package/src/components/seats/SeatMap.tsx +81 -0
- package/src/components/seats/SeatMapUnavailable.tsx +21 -0
- package/src/components/seats/SeatSelectionCard.tsx +103 -0
- package/src/components/seats/SeatSelectionModal.tsx +142 -0
- package/src/components/seats/SeatSelectionModalBody.tsx +13 -0
- package/src/components/seats/SeatSelectionModalFooter.tsx +82 -0
- package/src/components/seats/SeatSelectionModalHeader.tsx +87 -0
- package/src/components/seats/SeatUnavailable.tsx +14 -0
- package/src/examples/client-side/index.html +57 -0
- package/src/examples/full-stack/index.html +48 -0
- package/src/examples/full-stack/server.mjs +157 -0
- package/src/examples/just-typescript/README.md +37 -0
- package/src/examples/just-typescript/package.json +16 -0
- package/src/examples/just-typescript/src/index.html +23 -0
- package/src/examples/just-typescript/src/index.ts +35 -0
- package/src/examples/just-typescript/yarn.lock +154 -0
- package/src/examples/react-app/README.md +37 -0
- package/src/examples/react-app/package.json +20 -0
- package/src/examples/react-app/src/index.html +19 -0
- package/src/examples/react-app/src/index.tsx +43 -0
- package/src/examples/react-app/yarn.lock +219 -0
- package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +497 -0
- package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +307 -0
- package/src/fixtures/offers/off_1.json +497 -0
- package/src/fixtures/passengers/mock_passengers.ts +26 -0
- package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +6852 -0
- package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +1 -0
- package/src/fixtures/seat-maps/off_1.json +6852 -0
- package/src/index.ts +8 -0
- package/src/lib/captureErrorInSentry.ts +60 -0
- package/src/lib/compileCreateOrderPayload.ts +63 -0
- package/src/lib/createPriceFormatters.ts +73 -0
- package/src/lib/fetchFromDuffelAPI.ts +24 -0
- package/src/lib/fetchFromFixtures.ts +18 -0
- package/src/lib/formatAvailableServices.ts +91 -0
- package/src/lib/formatDate.ts +21 -0
- package/src/lib/formatSeatMaps.ts +81 -0
- package/src/lib/getBaggageServiceDescription.ts +44 -0
- package/src/lib/getCabinsForSegmentAndDeck.ts +4 -0
- package/src/lib/getCurrencyForSeatMaps.ts +22 -0
- package/src/lib/getCurrencyForServices.ts +24 -0
- package/src/lib/getFirstSeatElementMatchingCriteria.ts +22 -0
- package/src/lib/getPassengerBySegmentList.ts +10 -0
- package/src/lib/getPassengerInitials.ts +6 -0
- package/src/lib/getPassengerMapById.ts +17 -0
- package/src/lib/getPassengerName.ts +37 -0
- package/src/lib/getRowNumber.ts +16 -0
- package/src/lib/getSegmentList.ts +7 -0
- package/src/lib/getServicePriceMapById.ts +20 -0
- package/src/lib/getSymbols.ts +22 -0
- package/src/lib/getTotalAmountForServices.ts +72 -0
- package/src/lib/getTotalQuantity.ts +5 -0
- package/src/lib/hasService.ts +24 -0
- package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +35 -0
- package/src/lib/hasWings.ts +8 -0
- package/src/lib/isBaggageService.ts +8 -0
- package/src/lib/isCancelForAnyReasonService.ts +9 -0
- package/src/lib/isFixtureOfferId.ts +4 -0
- package/src/lib/isPayloadComplete.ts +11 -0
- package/src/lib/isSeatElement.ts +10 -0
- package/src/lib/logging.ts +100 -0
- package/src/lib/moneyStringFormatter.ts +34 -0
- package/src/lib/offerIsExpired.ts +5 -0
- package/src/lib/retrieveOffer.ts +49 -0
- package/src/lib/retrieveOfferFromDuffelAPI.ts +13 -0
- package/src/lib/retrieveSeatMaps.ts +50 -0
- package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +13 -0
- package/src/lib/setBodyScrollability.ts +7 -0
- package/src/lib/validateProps.ts +37 -0
- package/src/lib/withPlural.ts +8 -0
- package/src/stories/BaggageSelectionModalHeader.stories.tsx +21 -0
- package/src/stories/Button.stories.tsx +60 -0
- package/src/stories/DuffelAncillaries.stories.tsx +126 -0
- package/src/stories/Icon.stories.tsx +34 -0
- package/src/stories/IconButton.stories.tsx +25 -0
- package/src/styles/colors.css +22 -0
- package/src/styles/components/Amenity.css +23 -0
- package/src/styles/components/BaggageDisplay.css +25 -0
- package/src/styles/components/Button.css +161 -0
- package/src/styles/components/Card.css +52 -0
- package/src/styles/components/CfarSelectionModal.css +34 -0
- package/src/styles/components/Counter.css +18 -0
- package/src/styles/components/IconButton.css +63 -0
- package/src/styles/components/Legend.css +58 -0
- package/src/styles/components/Loader.css +37 -0
- package/src/styles/components/LoadingState.css +81 -0
- package/src/styles/components/Modal.css +83 -0
- package/src/styles/components/PassengerSelect.css +93 -0
- package/src/styles/components/PassengersLayout.css +90 -0
- package/src/styles/components/Row.css +70 -0
- package/src/styles/components/Seat.css +57 -0
- package/src/styles/components/SeatInfo.css +61 -0
- package/src/styles/components/SeatMap.css +24 -0
- package/src/styles/components/SeatSelect.css +92 -0
- package/src/styles/components/Segment.css +17 -0
- package/src/styles/components/SelectionSegment.css +10 -0
- package/src/styles/components/Summary.css +70 -0
- package/src/styles/components/Tabs.css +49 -0
- package/src/styles/flex.css +5 -0
- package/src/styles/font-families.css +47 -0
- package/src/styles/global.css +50 -0
- package/src/styles/margin.css +3 -0
- package/src/styles/spacing.css +18 -0
- package/src/styles/transitions.css +3 -0
- package/src/styles/typography.css +13 -0
- package/src/tests/components/DuffelAncillaries.test.tsx +342 -0
- package/src/tests/lib/createPriceFormatters.test.tsx +152 -0
- package/src/tests/lib/formatAvailableServices.test.tsx +79 -0
- package/src/tests/lib/formatSeatMaps.test.tsx +49 -0
- package/src/tests/lib/getCurrencyForServices.test.tsx +44 -0
- package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +86 -0
- package/src/tests/lib/logging.test.tsx +32 -0
- package/src/tests/lib/moneyStringFormatter.test.tsx +12 -0
- package/src/tests/lib/validateProps.test.tsx +57 -0
- package/src/types/Aircraft.ts +16 -0
- package/src/types/Airline.ts +16 -0
- package/src/types/Airport.ts +54 -0
- package/src/types/City.ts +21 -0
- package/src/types/CreateOrderPayload.ts +99 -0
- package/src/types/CurrencyConversion.ts +10 -0
- package/src/types/DuffelAncillariesProps.ts +108 -0
- package/src/types/Offer.ts +851 -0
- package/src/types/Order.ts +6 -0
- package/src/types/Place.ts +6 -0
- package/src/types/SeatMap.ts +231 -0
- package/src/types/index.ts +11 -0
- package/tsconfig.json +52 -0
- package/LICENSE +0 -21
- package/dist/AdditionalBaggage.esm.js +0 -1
- package/dist/AdditionalBaggage.js +0 -1
- package/dist/AdditionalBaggage.min.css +0 -408
- package/dist/AdditionalBaggage.umd.min.js +0 -2
- package/dist/AdditionalBaggage.umd.min.js.LICENSE.txt +0 -60
- package/dist/AdditionalBaggageSelection.esm.js +0 -1
- package/dist/AdditionalBaggageSelection.js +0 -1
- package/dist/AdditionalBaggageSelection.min.css +0 -744
- package/dist/AdditionalBaggageSelection.umd.min.js +0 -2
- package/dist/AdditionalBaggageSelection.umd.min.js.LICENSE.txt +0 -93
- package/dist/CardPayment.esm.js +0 -2
- package/dist/CardPayment.esm.js.LICENSE.txt +0 -6
- package/dist/CardPayment.js +0 -2
- package/dist/CardPayment.js.LICENSE.txt +0 -6
- package/dist/CardPayment.min.css +0 -233
- package/dist/CardPayment.umd.min.js +0 -2
- package/dist/CardPayment.umd.min.js.LICENSE.txt +0 -61
- package/dist/SeatSelection.esm.js +0 -1
- package/dist/SeatSelection.js +0 -1
- package/dist/SeatSelection.min.css +0 -1127
- package/dist/SeatSelection.umd.min.js +0 -2
- package/dist/SeatSelection.umd.min.js.LICENSE.txt +0 -60
- package/dist/duffel-components.d.ts +0 -1614
- package/dist/duffel-components.esm.js +0 -2
- package/dist/duffel-components.esm.js.LICENSE.txt +0 -6
- package/dist/duffel-components.js +0 -2
- package/dist/duffel-components.js.LICENSE.txt +0 -6
- package/dist/duffel-components.min.css +0 -1280
- package/dist/duffel-components.umd.min.js +0 -2
- package/dist/duffel-components.umd.min.js.LICENSE.txt +0 -102
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Airline {
|
|
2
|
+
/**
|
|
3
|
+
* The two-character IATA code for the airline. This may be null for non-IATA carriers.
|
|
4
|
+
*/
|
|
5
|
+
iata_code: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Duffel's unique identifier for the airline
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the airline
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { City } from "./City";
|
|
2
|
+
export interface Airport {
|
|
3
|
+
/**
|
|
4
|
+
* The three-character IATA code for the airport
|
|
5
|
+
*/
|
|
6
|
+
iata_code: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Duffel's unique identifier for the airport
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The name of the airport
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* The ISO 3166-1 alpha-2 code for the country where the airport is located
|
|
17
|
+
*/
|
|
18
|
+
iata_country_code: string;
|
|
19
|
+
/**
|
|
20
|
+
* The latitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
|
|
21
|
+
*/
|
|
22
|
+
latitude: number;
|
|
23
|
+
/**
|
|
24
|
+
* The longitude position of the airport represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
|
|
25
|
+
*/
|
|
26
|
+
longitude: number;
|
|
27
|
+
/**
|
|
28
|
+
* The four-character ICAO code for the airport
|
|
29
|
+
*/
|
|
30
|
+
icao_code: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* The time zone of the airport, specified by name from the [tz database](https://en.wikipedia.org/wiki/Tz_database)
|
|
33
|
+
*/
|
|
34
|
+
time_zone: string;
|
|
35
|
+
/**
|
|
36
|
+
* The name of the city (or cities separated by a `/`) where the airport is located
|
|
37
|
+
*/
|
|
38
|
+
city_name: string;
|
|
39
|
+
/**
|
|
40
|
+
* The metropolitan area where the airport is located.
|
|
41
|
+
* Only present for airports which are registered with IATA as belonging to a metropolitan area.
|
|
42
|
+
*/
|
|
43
|
+
city: City;
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface City {
|
|
2
|
+
/**
|
|
3
|
+
* The three-character IATA code for the city
|
|
4
|
+
*/
|
|
5
|
+
iata_code: string;
|
|
6
|
+
/**
|
|
7
|
+
* Duffel's unique identifier for the city
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The ISO 3166-1 alpha-2 code for the country where the city is located
|
|
12
|
+
*/
|
|
13
|
+
iata_country_code: string;
|
|
14
|
+
/**
|
|
15
|
+
* The name of the city
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Offer, OfferAvailableCancelForAnyReasonServiceMetadata, OfferAvailableServiceBaggageMetadata } from "./Offer";
|
|
2
|
+
export interface CreateOrderPayload {
|
|
3
|
+
selected_offers: Array<Offer["id"]>;
|
|
4
|
+
passengers: CreateOrderPayloadPassengers;
|
|
5
|
+
services: CreateOrderPayloadServices;
|
|
6
|
+
payments: Array<CreateOrderPayloadPayment>;
|
|
7
|
+
type: "instant";
|
|
8
|
+
metadata: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateOrderPayloadPassenger {
|
|
11
|
+
id: string;
|
|
12
|
+
given_name: string;
|
|
13
|
+
family_name: string;
|
|
14
|
+
gender: string;
|
|
15
|
+
title: string;
|
|
16
|
+
born_on: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
phone_number?: string;
|
|
19
|
+
}
|
|
20
|
+
export type CreateOrderPayloadPassengers = Array<CreateOrderPayloadPassenger>;
|
|
21
|
+
export type CreateOrderPayloadPaymentType = "balance";
|
|
22
|
+
export interface CreateOrderPayloadPayment {
|
|
23
|
+
type: CreateOrderPayloadPaymentType;
|
|
24
|
+
amount: string;
|
|
25
|
+
currency: string;
|
|
26
|
+
}
|
|
27
|
+
export type CreateOrderPayloadServices = CreateOrderPayloadService[];
|
|
28
|
+
export interface CreateOrderPayloadService {
|
|
29
|
+
id: string;
|
|
30
|
+
quantity: number;
|
|
31
|
+
/** `serviceInformation` is meant for:
|
|
32
|
+
* 1. internal use within the Duffel Ancillaries component, so it is convenient to augument selected services with data about it.
|
|
33
|
+
* 2. When `onPayloadReady` is ready, we'll return selected bags and seat services along with the `serviceInformation` to allow consumer to enrich their price breakdown.
|
|
34
|
+
*
|
|
35
|
+
* Note: `serviceInformation` is not known by the Duffel API.
|
|
36
|
+
*/
|
|
37
|
+
serviceInformation?: CreateOrderPayloadServiceInformation;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateOrderPayloadSeatService {
|
|
40
|
+
id: string;
|
|
41
|
+
quantity: number;
|
|
42
|
+
/** `serviceInformation` is meant for:
|
|
43
|
+
* 1. internal use within the Duffel Ancillaries component, so it is convenient to augument selected services with data about it.
|
|
44
|
+
* 2. When `onPayloadReady` is ready, we'll return selected bags and seat services along with the `serviceInformation` to allow consumer to enrich their price breakdown.
|
|
45
|
+
*
|
|
46
|
+
* Note: `serviceInformation` is not known by the Duffel API.
|
|
47
|
+
*/
|
|
48
|
+
serviceInformation?: CreateOrderPayloadServiceInformationForSeats;
|
|
49
|
+
}
|
|
50
|
+
type CreateOrderPayloadServiceInformation = CreateOrderPayloadServiceInformationForSeats | CreateOrderPayloadServiceInformationForBags | CreateOrderPayloadServiceInformationForCancelForAnyReason;
|
|
51
|
+
interface CreateOrderPayloadCommonServiceInformation {
|
|
52
|
+
segmentId: string;
|
|
53
|
+
passengerId: string;
|
|
54
|
+
passengerName: string;
|
|
55
|
+
total_amount: string;
|
|
56
|
+
total_currency: string;
|
|
57
|
+
}
|
|
58
|
+
export interface CreateOrderPayloadServiceInformationForSeats extends CreateOrderPayloadCommonServiceInformation {
|
|
59
|
+
type: "seat";
|
|
60
|
+
designator: string;
|
|
61
|
+
disclosures: string[];
|
|
62
|
+
}
|
|
63
|
+
export type CreateOrderPayloadServiceInformationForBags = CreateOrderPayloadCommonServiceInformation & OfferAvailableServiceBaggageMetadata;
|
|
64
|
+
export type CreateOrderPayloadServiceInformationForCancelForAnyReason = {
|
|
65
|
+
type: "cancel_for_any_reason";
|
|
66
|
+
} & Pick<CreateOrderPayloadCommonServiceInformation,
|
|
67
|
+
/**
|
|
68
|
+
* only using `total_amount` and `total_currency` from `CreateOrderPayloadCommonServiceInformation`
|
|
69
|
+
* because the cancel for any reason service applies to the whole order, not a specific segment or passenger
|
|
70
|
+
*/
|
|
71
|
+
"total_amount" | "total_currency"> & OfferAvailableCancelForAnyReasonServiceMetadata;
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CreateOrderPayload, CreateOrderPayloadServices } from "./CreateOrderPayload";
|
|
2
|
+
import { Offer, OfferAvailableServiceBaggage, OfferAvailableServiceCancelForAnyReason } from "./Offer";
|
|
3
|
+
import { SeatMap, SeatMapCabinRowSectionAvailableService } from "./SeatMap";
|
|
4
|
+
export type DuffelAncillariesProps = DuffelAncillariesPropsWithOfferIdForFixture | DuffelAncillariesPropsWithClientKeyAndOfferId | DuffelAncillariesPropWithOfferAndClientKey | DuffelAncillariesPropsWithOffersAndSeatMaps;
|
|
5
|
+
export interface DuffelAncillariesCommonProps {
|
|
6
|
+
styles?: CustomStyles;
|
|
7
|
+
onPayloadReady: OnPayloadReady;
|
|
8
|
+
passengers: CreateOrderPayload["passengers"];
|
|
9
|
+
services: Ancillaries[];
|
|
10
|
+
markup?: DuffelAncillariesMarkup;
|
|
11
|
+
priceFormatters?: DuffelAncillariesPriceFormatters;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface DuffelAncillariesPropsWithOfferIdForFixture extends DuffelAncillariesCommonProps {
|
|
15
|
+
offer_id: `fixture_${string}`;
|
|
16
|
+
}
|
|
17
|
+
export interface DuffelAncillariesPropsWithClientKeyAndOfferId extends DuffelAncillariesCommonProps {
|
|
18
|
+
offer_id: string;
|
|
19
|
+
client_key: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DuffelAncillariesPropWithOfferAndClientKey extends DuffelAncillariesCommonProps {
|
|
22
|
+
offer: Offer;
|
|
23
|
+
client_key: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DuffelAncillariesPropsWithOffersAndSeatMaps extends DuffelAncillariesCommonProps {
|
|
26
|
+
offer: Offer;
|
|
27
|
+
seat_maps: SeatMap[];
|
|
28
|
+
}
|
|
29
|
+
export type DuffelAncillariesMarkupDefinition = {
|
|
30
|
+
rate: number;
|
|
31
|
+
amount: number;
|
|
32
|
+
};
|
|
33
|
+
export interface DuffelAncillariesMarkup {
|
|
34
|
+
bags?: DuffelAncillariesMarkupDefinition;
|
|
35
|
+
seats?: DuffelAncillariesMarkupDefinition;
|
|
36
|
+
cancel_for_any_reason?: DuffelAncillariesMarkupDefinition;
|
|
37
|
+
}
|
|
38
|
+
export type DuffelAncillariesPriceFormatterForBags = (amount: number, currency: string, service: OfferAvailableServiceBaggage) => {
|
|
39
|
+
amount: number;
|
|
40
|
+
currency?: string;
|
|
41
|
+
};
|
|
42
|
+
export type DuffelAncillariesPriceFormatterForSeats = (amount: number, currency: string, service: SeatMapCabinRowSectionAvailableService) => {
|
|
43
|
+
amount: number;
|
|
44
|
+
currency?: string;
|
|
45
|
+
};
|
|
46
|
+
export type DuffelAncillariesPriceFormatterForCancelForAnyReason = (amount: number, currency: string, service: OfferAvailableServiceCancelForAnyReason) => {
|
|
47
|
+
amount: number;
|
|
48
|
+
currency: string;
|
|
49
|
+
};
|
|
50
|
+
export interface DuffelAncillariesPriceFormatters {
|
|
51
|
+
bags?: DuffelAncillariesPriceFormatterForBags;
|
|
52
|
+
seats?: DuffelAncillariesPriceFormatterForSeats;
|
|
53
|
+
cancel_for_any_reason?: DuffelAncillariesPriceFormatterForCancelForAnyReason;
|
|
54
|
+
}
|
|
55
|
+
export interface CustomStyles {
|
|
56
|
+
accentColor?: string;
|
|
57
|
+
buttonCornerRadius?: string;
|
|
58
|
+
fontFamily?: string;
|
|
59
|
+
}
|
|
60
|
+
export type OnPayloadReady = (data: CreateOrderPayload, metadata: OnPayloadReadyMetadata) => void;
|
|
61
|
+
export interface OnPayloadReadyMetadata {
|
|
62
|
+
offer_total_amount: Offer["total_amount"];
|
|
63
|
+
offer_total_currency: Offer["total_currency"];
|
|
64
|
+
offer_tax_amount: Offer["tax_amount"];
|
|
65
|
+
offer_tax_currency: Offer["tax_currency"];
|
|
66
|
+
baggage_services: CreateOrderPayloadServices;
|
|
67
|
+
seat_services: CreateOrderPayloadServices;
|
|
68
|
+
cancel_for_any_reason_services: CreateOrderPayloadServices;
|
|
69
|
+
}
|
|
70
|
+
export type Ancillaries = "bags" | "seats" | "cancel_for_any_reason";
|