@duffel/components 3.1.1 → 3.1.2--prototype.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 (137) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  2. package/.storybook/__snapshots__/Storyshots.test.js.snap +14636 -1384
  3. package/.tool-versions +1 -1
  4. package/package.json +1 -1
  5. package/react-dist/index.js +21 -21
  6. package/src/components/DuffelAncillaries/DuffelAncillaries.tsx +2 -1
  7. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.tsx +2 -2
  8. package/src/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.tsx +3 -2
  9. package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.tsx +1 -1
  10. package/src/components/DuffelAncillaries/seats/SeatSelectionModalHeader.tsx +3 -2
  11. package/src/components/DuffelPayments/DuffelPayments.tsx +1 -0
  12. package/src/components/ShowData/ShowData.tsx +38 -0
  13. package/src/components/ShowData/ShowDataCustomElement.tsx +85 -0
  14. package/src/custom-elements.ts +4 -0
  15. package/src/fixtures/offers/off_1.json +1 -10
  16. package/src/index.ts +1 -0
  17. package/src/stories/Button.stories.tsx +1 -0
  18. package/src/stories/DuffelAncillaries.stories.tsx +19 -1
  19. package/src/stories/ShowData.stories.tsx +16 -0
  20. package/src/styles/components/Card.css +3 -3
  21. package/src/styles/components/CfarSelectionModal.css +1 -1
  22. package/src/styles/components/Legend.css +10 -6
  23. package/src/styles/components/LoadingState.css +8 -2
  24. package/src/styles/components/PassengerSelect.css +8 -2
  25. package/src/styles/components/Seat.css +9 -7
  26. package/src/styles/components/Tabs.css +5 -2
  27. package/react-dist/components/DuffelAncillaries/Card.d.ts +0 -14
  28. package/react-dist/components/DuffelAncillaries/Counter.d.ts +0 -10
  29. package/react-dist/components/DuffelAncillaries/DuffelAncillaries.d.ts +0 -3
  30. package/react-dist/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +0 -13
  31. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +0 -11
  32. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +0 -13
  33. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +0 -11
  34. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +0 -11
  35. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +0 -13
  36. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +0 -14
  37. package/react-dist/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +0 -9
  38. package/react-dist/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +0 -7
  39. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +0 -10
  40. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +0 -11
  41. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +0 -7
  42. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +0 -4
  43. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +0 -11
  44. package/react-dist/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +0 -2
  45. package/react-dist/components/DuffelAncillaries/seats/Amenity.d.ts +0 -6
  46. package/react-dist/components/DuffelAncillaries/seats/DeckSelect.d.ts +0 -15
  47. package/react-dist/components/DuffelAncillaries/seats/Element.d.ts +0 -15
  48. package/react-dist/components/DuffelAncillaries/seats/EmptyElement.d.ts +0 -2
  49. package/react-dist/components/DuffelAncillaries/seats/ExitElement.d.ts +0 -6
  50. package/react-dist/components/DuffelAncillaries/seats/Legend.d.ts +0 -12
  51. package/react-dist/components/DuffelAncillaries/seats/Row.d.ts +0 -13
  52. package/react-dist/components/DuffelAncillaries/seats/RowSection.d.ts +0 -17
  53. package/react-dist/components/DuffelAncillaries/seats/SeatElement.d.ts +0 -13
  54. package/react-dist/components/DuffelAncillaries/seats/SeatInfo.d.ts +0 -7
  55. package/react-dist/components/DuffelAncillaries/seats/SeatMap.d.ts +0 -12
  56. package/react-dist/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +0 -2
  57. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +0 -13
  58. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +0 -13
  59. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +0 -4
  60. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +0 -16
  61. package/react-dist/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +0 -10
  62. package/react-dist/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +0 -5
  63. package/react-dist/components/DuffelPayments/DuffelPayments.d.ts +0 -11
  64. package/react-dist/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +0 -14
  65. package/react-dist/components/PlacesLookup/PlacesLookup.d.ts +0 -20
  66. package/react-dist/components/shared/AnimatedLoaderEllipsis.d.ts +0 -2
  67. package/react-dist/components/shared/Button.d.ts +0 -23
  68. package/react-dist/components/shared/ErrorBoundary.d.ts +0 -13
  69. package/react-dist/components/shared/FetchOfferErrorState.d.ts +0 -5
  70. package/react-dist/components/shared/Icon.d.ts +0 -46
  71. package/react-dist/components/shared/IconButton.d.ts +0 -16
  72. package/react-dist/components/shared/Modal.d.ts +0 -11
  73. package/react-dist/components/shared/NonIdealState.d.ts +0 -4
  74. package/react-dist/components/shared/Stamp.d.ts +0 -7
  75. package/react-dist/components/shared/Tabs.d.ts +0 -16
  76. package/react-dist/custom-elements.d.ts +0 -6
  77. package/react-dist/custom-elements.js +0 -37
  78. package/react-dist/custom-elements.js.map +0 -7
  79. package/react-dist/index.d.ts +0 -8
  80. package/react-dist/index.js.map +0 -7
  81. package/react-dist/lib/captureErrorInSentry.d.ts +0 -1
  82. package/react-dist/lib/compileCreateOrderPayload.d.ts +0 -14
  83. package/react-dist/lib/createPriceFormatters.d.ts +0 -12
  84. package/react-dist/lib/fetchFromDuffelAPI.d.ts +0 -8
  85. package/react-dist/lib/fetchFromFixtures.d.ts +0 -4
  86. package/react-dist/lib/formatAvailableServices.d.ts +0 -12
  87. package/react-dist/lib/formatDate.d.ts +0 -2
  88. package/react-dist/lib/formatSeatMaps.d.ts +0 -4
  89. package/react-dist/lib/getBaggageServiceDescription.d.ts +0 -2
  90. package/react-dist/lib/getCabinsForSegmentAndDeck.d.ts +0 -2
  91. package/react-dist/lib/getCurrencyForSeatMaps.d.ts +0 -10
  92. package/react-dist/lib/getCurrencyForServices.d.ts +0 -11
  93. package/react-dist/lib/getFirstSeatElementMatchingCriteria.d.ts +0 -3
  94. package/react-dist/lib/getPassengerBySegmentList.d.ts +0 -6
  95. package/react-dist/lib/getPassengerInitials.d.ts +0 -1
  96. package/react-dist/lib/getPassengerMapById.d.ts +0 -3
  97. package/react-dist/lib/getPassengerName.d.ts +0 -3
  98. package/react-dist/lib/getRowNumber.d.ts +0 -2
  99. package/react-dist/lib/getSegmentList.d.ts +0 -2
  100. package/react-dist/lib/getServicePriceMapById.d.ts +0 -3
  101. package/react-dist/lib/getSymbols.d.ts +0 -2
  102. package/react-dist/lib/getTotalAmountForServices.d.ts +0 -6
  103. package/react-dist/lib/getTotalQuantity.d.ts +0 -2
  104. package/react-dist/lib/hasHighLuminance.d.ts +0 -1
  105. package/react-dist/lib/hasService.d.ts +0 -2
  106. package/react-dist/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +0 -3
  107. package/react-dist/lib/hasWings.d.ts +0 -2
  108. package/react-dist/lib/isBaggageService.d.ts +0 -2
  109. package/react-dist/lib/isCancelForAnyReasonService.d.ts +0 -2
  110. package/react-dist/lib/isFixtureOfferId.d.ts +0 -2
  111. package/react-dist/lib/isPayloadComplete.d.ts +0 -2
  112. package/react-dist/lib/isSeatElement.d.ts +0 -2
  113. package/react-dist/lib/logging.d.ts +0 -46
  114. package/react-dist/lib/moneyStringFormatter.d.ts +0 -8
  115. package/react-dist/lib/offerIsExpired.d.ts +0 -2
  116. package/react-dist/lib/retrieveOffer.d.ts +0 -2
  117. package/react-dist/lib/retrieveOfferFromDuffelAPI.d.ts +0 -1
  118. package/react-dist/lib/retrieveSeatMaps.d.ts +0 -2
  119. package/react-dist/lib/retrieveSeatMapsFromDuffelAPI.d.ts +0 -1
  120. package/react-dist/lib/setBodyScrollability.d.ts +0 -1
  121. package/react-dist/lib/validateProps.d.ts +0 -7
  122. package/react-dist/lib/withPlural.d.ts +0 -1
  123. package/react-dist/types/Aircraft.d.ts +0 -14
  124. package/react-dist/types/Airline.d.ts +0 -14
  125. package/react-dist/types/Airport.d.ts +0 -44
  126. package/react-dist/types/City.d.ts +0 -18
  127. package/react-dist/types/CreateOrderPayload.d.ts +0 -72
  128. package/react-dist/types/CurrencyConversion.d.ts +0 -10
  129. package/react-dist/types/DuffelAncillariesProps.d.ts +0 -70
  130. package/react-dist/types/Offer.d.ts +0 -711
  131. package/react-dist/types/Order.d.ts +0 -8
  132. package/react-dist/types/Place.d.ts +0 -8
  133. package/react-dist/types/SeatMap.d.ts +0 -190
  134. package/react-dist/types/index.d.ts +0 -11
  135. package/src/examples/just-typescript/yarn.lock +0 -154
  136. package/src/examples/payments-just-typescript/yarn.lock +0 -154
  137. package/src/examples/react-app/yarn.lock +0 -219
@@ -1 +0,0 @@
1
- export declare const captureErrorInSentry: (error: Error) => string;
@@ -1,14 +0,0 @@
1
- import { CreateOrderPayload, CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- import { DuffelAncillariesProps } from "../types/DuffelAncillariesProps";
3
- import { Offer } from "../types/Offer";
4
- import { SeatMap } from "../types/SeatMap";
5
- interface CompileCreateOrderPayloadInput {
6
- offer: Offer;
7
- passengers: DuffelAncillariesProps["passengers"];
8
- baggageSelectedServices: CreateOrderPayloadServices;
9
- seatSelectedServices: CreateOrderPayloadServices;
10
- cfarSelectedServices: CreateOrderPayloadServices;
11
- seatMaps?: SeatMap[];
12
- }
13
- export declare const compileCreateOrderPayload: ({ baggageSelectedServices, seatSelectedServices, cfarSelectedServices, offer, seatMaps, passengers, }: CompileCreateOrderPayloadInput) => Partial<CreateOrderPayload>;
14
- export {};
@@ -1,12 +0,0 @@
1
- import { DuffelAncillariesMarkup, DuffelAncillariesPriceFormatters } from "src/types/DuffelAncillariesProps";
2
- /**
3
- * Creates price formatters from the markup and priceFormatters passed in.
4
- * Throws an error if both are supplied.
5
- * If neither are supplied, the priceFormatters will be undefined.
6
- *
7
- * @param markup The markup to be applied to the prices of the available services of an offer.
8
- * @param priceFormatters Price formatters to apply to the prices of the available services of an offer.
9
- * @returns
10
- */
11
- declare const createPriceFormatters: (markup?: DuffelAncillariesMarkup, priceFormatters?: DuffelAncillariesPriceFormatters) => DuffelAncillariesPriceFormatters;
12
- export { createPriceFormatters };
@@ -1,8 +0,0 @@
1
- export interface ErrorResponse extends Response {
2
- data: {
3
- meta: any;
4
- errors: any[];
5
- };
6
- }
7
- export declare const isErrorResponse: (response: any) => response is ErrorResponse;
8
- export declare function fetchFromDuffelAPI(withClientKey: string, path: string, method?: string, body?: string): Promise<any>;
@@ -1,4 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- import { SeatMap } from "../types/SeatMap";
3
- export declare const importFromOfferFixtures: (offerId: string) => Promise<Offer>;
4
- export declare const importFromSeatMapsFixtures: (offerId: string) => Promise<SeatMap[]>;
@@ -1,12 +0,0 @@
1
- import { DuffelAncillariesPriceFormatters } from "../types/DuffelAncillariesProps";
2
- import { Offer } from "../types/Offer";
3
- /**
4
- * Formats the prices of the available services of an offer according to the
5
- * priceFormatters passed in.
6
- *
7
- * @param offer An offer from the Duffel API
8
- * @param priceFormatters Optional price formatting functions. If not passed in, the offer will be returned unchanged.
9
- * @returns An offer with the prices of its available services formatted according to the priceFormatters passed in.
10
- */
11
- declare const formatAvailableServices: (offer: Offer, priceFormatters?: DuffelAncillariesPriceFormatters) => Offer;
12
- export { formatAvailableServices };
@@ -1,2 +0,0 @@
1
- export declare const formatDateString: (dateString: string) => string | undefined;
2
- export declare const formatDate: (date: Date) => string;
@@ -1,4 +0,0 @@
1
- import { DuffelAncillariesPriceFormatterForSeats } from "../types/DuffelAncillariesProps";
2
- import { SeatMap } from "../types/SeatMap";
3
- declare const formatSeatMaps: (seatMaps: SeatMap[], priceFormatter?: DuffelAncillariesPriceFormatterForSeats) => SeatMap[];
4
- export { formatSeatMaps };
@@ -1,2 +0,0 @@
1
- import { OfferAvailableServiceBaggageMetadata } from "../types/Offer";
2
- export declare const getBaggageServiceDescription: (metadata: OfferAvailableServiceBaggageMetadata) => string | null;
@@ -1,2 +0,0 @@
1
- import { SeatMap } from "../types/SeatMap";
2
- export declare const getCabinsForSegmentAndDeck: (forDeck: number, seatMap: SeatMap) => import("../types/SeatMap").SeatMapCabin[];
@@ -1,10 +0,0 @@
1
- import { SeatMap } from "../types/SeatMap";
2
- /**
3
- *
4
- * Returns the currency of the first service of the given seat maps.
5
- *
6
- * @param seatMaps[] Array of seat maps
7
- * @returns A string representing the currency of the seat maps in the offer.
8
- */
9
- declare const getCurrencyForSeatMaps: (seatMaps: SeatMap[]) => string | undefined;
10
- export { getCurrencyForSeatMaps };
@@ -1,11 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- /**
3
- *
4
- * Returns the currency of the first service of the given type in the offer.
5
- *
6
- * @param offer An offer
7
- * @returns A string representing the currency of the services in the offer.
8
- * @throws If there are no services, or none of the services are of the given type.
9
- */
10
- declare const getCurrencyForServices: (offer: Offer, serviceType: string) => string;
11
- export { getCurrencyForServices };
@@ -1,3 +0,0 @@
1
- import { SeatMap, SeatMapCabinRowSectionElement } from "../types/SeatMap";
2
- declare const getFirstSeatElementMatchingCriteria: (seatMaps: SeatMap[], matcher: (element: SeatMapCabinRowSectionElement) => boolean) => SeatMapCabinRowSectionElement | undefined;
3
- export { getFirstSeatElementMatchingCriteria };
@@ -1,6 +0,0 @@
1
- import { OfferSliceSegment } from "../types/Offer";
2
- export declare const getPassengerBySegmentList: (segments: OfferSliceSegment[]) => {
3
- passenger: import("../types/Offer").OfferSliceSegmentPassenger;
4
- passengerIndex: number;
5
- segment: OfferSliceSegment;
6
- }[];
@@ -1 +0,0 @@
1
- export declare const getPassengerInitials: (passengerName?: string) => string;
@@ -1,3 +0,0 @@
1
- import { CreateOrderPayloadPassenger, CreateOrderPayloadPassengers } from "../types/CreateOrderPayload";
2
- export type PassengerMapById = Record<CreateOrderPayloadPassenger["id"], CreateOrderPayloadPassenger>;
3
- export declare const getPassengerMapById: (passengers: CreateOrderPayloadPassengers) => PassengerMapById;
@@ -1,3 +0,0 @@
1
- import { CreateOrderPayloadPassenger } from "../types/CreateOrderPayload";
2
- import { OfferPassenger } from "../types/Offer";
3
- export declare const getPassengerName: (createOrderPayloadPassenger: CreateOrderPayloadPassenger, offerPassenger: OfferPassenger | undefined, fallbackIndex: number) => string;
@@ -1,2 +0,0 @@
1
- import { SeatMapCabinRow } from "../types/SeatMap";
2
- export declare const getRowNumber: (row: SeatMapCabinRow) => string | null;
@@ -1,2 +0,0 @@
1
- import { Offer, OfferSliceSegment } from "../types/Offer";
2
- export declare const getSegmentList: (offer: Offer) => OfferSliceSegment[];
@@ -1,3 +0,0 @@
1
- import { OfferAvailableService } from "../types/Offer";
2
- export type ServicePriceMapById = Record<OfferAvailableService["id"], Pick<OfferAvailableService, "total_amount" | "total_currency">>;
3
- export declare const getServicePriceMapById: (availableServices: OfferAvailableService[]) => ServicePriceMapById;
@@ -1,2 +0,0 @@
1
- import { SeatMapCabin, SeatMapCabinRowSectionElementAmenity } from "../types/SeatMap";
2
- export declare const getSymbols: (cabins: SeatMapCabin[]) => Set<SeatMapCabinRowSectionElementAmenity>;
@@ -1,6 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- import { Offer } from "../types/Offer";
3
- import { SeatMap } from "../types/SeatMap";
4
- import { ServicePriceMapById } from "./getServicePriceMapById";
5
- export declare const getTotalAmountForServices: (offer: Offer, selectedServices: CreateOrderPayloadServices, seatMaps?: SeatMap[]) => number;
6
- export declare const getTotalAmountForServicesWithPriceMap: (servicePriceMap: ServicePriceMapById, selectedServices: CreateOrderPayloadServices, seatMaps?: SeatMap[]) => number;
@@ -1,2 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- export declare const getTotalQuantity: (fromSelectedServices: CreateOrderPayloadServices) => number;
@@ -1 +0,0 @@
1
- export declare const hasHighLuminance: (accentColor: string) => boolean;
@@ -1,2 +0,0 @@
1
- import { Offer, OfferAvailableServiceType } from "../types/Offer";
2
- export declare const hasService: (offer: Offer | undefined, type: OfferAvailableServiceType) => boolean | undefined;
@@ -1,3 +0,0 @@
1
- import { CreateOrderPayloadServices } from "../types/CreateOrderPayload";
2
- import { OfferAvailableServiceBaggage } from "../types/Offer";
3
- export declare const hasServiceOfSameMetadataTypeAlreadyBeenSelected: (selectedServices: CreateOrderPayloadServices, segmentId: string, passengerId: string, availableService: OfferAvailableServiceBaggage) => boolean;
@@ -1,2 +0,0 @@
1
- import { SeatMapCabin } from "../types/SeatMap";
2
- export declare const hasWings: (cabin: SeatMapCabin, rowIndex: number) => boolean;
@@ -1,2 +0,0 @@
1
- import { OfferAvailableBaggageService, OfferAvailableService } from "../types/Offer";
2
- export declare const isBaggageService: (service: OfferAvailableService) => service is OfferAvailableBaggageService;
@@ -1,2 +0,0 @@
1
- import { OfferAvailableService, OfferAvailableServiceCancelForAnyReason } from "../types/Offer";
2
- export declare const isCancelForAnyReasonService: (service: OfferAvailableService) => service is OfferAvailableServiceCancelForAnyReason;
@@ -1,2 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- export declare const isFixtureOfferId: (offerId: Offer["id"]) => boolean;
@@ -1,2 +0,0 @@
1
- import { CreateOrderPayload } from "../types/CreateOrderPayload";
2
- export declare const isPayloadComplete: (payload: Partial<CreateOrderPayload>) => payload is CreateOrderPayload;
@@ -1,2 +0,0 @@
1
- import { SeatMapCabinRowSectionElement, SeatMapCabinRowSectionElementSeat } from "../types/SeatMap";
2
- export declare function isSeatElement(element: SeatMapCabinRowSectionElement): element is SeatMapCabinRowSectionElementSeat;
@@ -1,46 +0,0 @@
1
- /**
2
- * The functions in this file are used to enable logging.
3
- *
4
- * Usage:
5
- *
6
- * In your app's outermost container, import the LogContext and wrap your app in it:
7
- *
8
- * ```jsx
9
- * import { LogContext, initializeLogger } from '@lib/logging'
10
- *
11
- * const logger = initializeLogger(props.debugMode || false)
12
- *
13
- * <LogContext.Provider value={logger}>
14
- * ...
15
- * </LogContext.Provider>
16
- * ```
17
- *
18
- * Then in your components nested within the above container, import the useLog hook and use it:
19
- *
20
- * import { useLog } from '@lib/logging'
21
- *
22
- * const { log, logGroup } = useLog()
23
- * log('This is a log message')
24
- * logGroup('These messages will be grouped together', ['This is a log message', 'This is another log message'])
25
- */
26
- declare const initializeLogger: (debugMode: boolean) => void;
27
- /**
28
- * Log a message to the console. Messages will be prefixed with "[Duffel Ancillaries]".
29
- * @param message The message to print to the console.
30
- */
31
- declare const log: (message: any) => void;
32
- /**
33
- * Log a series of messages to the console inside a collapsible group.
34
- * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
35
- * @param messages An array of messages to print to the console, inside the group.
36
- */
37
- declare function logGroup(groupName: string, messages: any[]): void;
38
- /**
39
- * Log a series of messages to the console inside a collapsible group.
40
- * @param groupName The name of the group of messages. This will be prefixed with "[Duffel Ancillaries]".
41
- * @param object An object to print to the console, inside the group.
42
- */
43
- declare function logGroup(groupName: string, object: {
44
- [key: string]: any;
45
- }): void;
46
- export { initializeLogger, logGroup, log };
@@ -1,8 +0,0 @@
1
- /**
2
- * Return a function to format a number into a money amount for a given currency
3
- *
4
- * @param currency The ISO-4217 currency code to be used by the formatter
5
- */
6
- export declare const moneyStringFormatter: (currency: string, locale?: string, options?: {
7
- [option: string]: string;
8
- }) => (value: number) => string;
@@ -1,2 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- export declare const offerIsExpired: (offer: Offer) => boolean | "";
@@ -1,2 +0,0 @@
1
- import { Offer } from "../types/Offer";
2
- export declare function retrieveOffer(offer_id: string, client_key: string | null, onError: (error: string) => void, setIsLoading: (isLoading: boolean) => void, onOfferReady: (offer: Offer) => void): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function retrieveOfferFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
@@ -1,2 +0,0 @@
1
- import { SeatMap } from "../types/SeatMap";
2
- export declare function retrieveSeatMaps(offer_id: string, client_key: string | null, onError: () => void, setIsLoading: (isLoading: boolean) => void, onSeatMapReady: (seatMaps: SeatMap[]) => void): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function retrieveSeatMapsFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
@@ -1 +0,0 @@
1
- export declare const setBodyScrollability: (shouldScroll: boolean) => void;
@@ -1,7 +0,0 @@
1
- import { DuffelAncillariesProps, DuffelAncillariesPropsWithClientKeyAndOfferId, DuffelAncillariesPropsWithOfferIdForFixture, DuffelAncillariesPropsWithOffersAndSeatMaps, DuffelAncillariesPropWithOfferAndClientKey } from "../types/DuffelAncillariesProps";
2
- export declare const areDuffelAncillariesPropsValid: (props: DuffelAncillariesProps) => boolean;
3
- export declare const hasCommonRequiredProps: (props: DuffelAncillariesProps) => boolean;
4
- export declare const isDuffelAncillariesPropsWithOfferIdForFixture: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithOfferIdForFixture;
5
- export declare const isDuffelAncillariesPropsWithClientKeyAndOfferId: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithClientKeyAndOfferId;
6
- export declare const isDuffelAncillariesPropsWithOfferAndSeatMaps: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropsWithOffersAndSeatMaps;
7
- export declare const isDuffelAncillariesPropsWithOfferAndClientKey: (props: DuffelAncillariesProps) => props is DuffelAncillariesPropWithOfferAndClientKey;
@@ -1 +0,0 @@
1
- export declare const withPlural: (totalQuantity: number, singular: string, plural: string) => string;
@@ -1,14 +0,0 @@
1
- export interface Aircraft {
2
- /**
3
- * The three-character IATA code for the aircraft
4
- */
5
- iata_code: string;
6
- /**
7
- * Duffel's unique identifier for the aircraft
8
- */
9
- id: string;
10
- /**
11
- * The name of the aircraft
12
- */
13
- name: string;
14
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,44 +0,0 @@
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
- }
@@ -1,18 +0,0 @@
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
- }
@@ -1,72 +0,0 @@
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 {};
@@ -1,10 +0,0 @@
1
- export interface CurrencyConversion {
2
- /**
3
- * currency The ISO-4217 currency code to be used
4
- */
5
- currency: string;
6
- /**
7
- * Conversion multiple to be applied to all prices
8
- */
9
- rate: number;
10
- }
@@ -1,70 +0,0 @@
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";