@duffel/components 3.1.3--prototype.8 → 3.1.3--prototype.11

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 (116) hide show
  1. package/README.md +68 -0
  2. package/package.json +7 -7
  3. package/{custom-elements.js → react-dist/custom-elements.js} +2 -2
  4. package/{custom-elements.js.map → react-dist/custom-elements.js.map} +1 -1
  5. package/react-dist/index.d.ts +2156 -0
  6. package/{index.js → react-dist/index.js} +2 -2
  7. package/{index.js.map → react-dist/index.js.map} +1 -1
  8. package/react-dist/index.tsbuildinfo +1 -0
  9. package/components/DuffelAncillaries/Card.d.ts +0 -14
  10. package/components/DuffelAncillaries/Counter.d.ts +0 -10
  11. package/components/DuffelAncillaries/DuffelAncillaries.d.ts +0 -3
  12. package/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +0 -12
  13. package/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +0 -11
  14. package/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +0 -13
  15. package/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +0 -11
  16. package/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +0 -11
  17. package/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +0 -13
  18. package/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +0 -14
  19. package/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +0 -9
  20. package/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +0 -7
  21. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +0 -10
  22. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +0 -11
  23. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +0 -7
  24. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +0 -4
  25. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +0 -11
  26. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +0 -2
  27. package/components/DuffelAncillaries/seats/Amenity.d.ts +0 -6
  28. package/components/DuffelAncillaries/seats/DeckSelect.d.ts +0 -15
  29. package/components/DuffelAncillaries/seats/Element.d.ts +0 -15
  30. package/components/DuffelAncillaries/seats/EmptyElement.d.ts +0 -2
  31. package/components/DuffelAncillaries/seats/ExitElement.d.ts +0 -6
  32. package/components/DuffelAncillaries/seats/Legend.d.ts +0 -12
  33. package/components/DuffelAncillaries/seats/Row.d.ts +0 -13
  34. package/components/DuffelAncillaries/seats/RowSection.d.ts +0 -17
  35. package/components/DuffelAncillaries/seats/SeatElement.d.ts +0 -13
  36. package/components/DuffelAncillaries/seats/SeatInfo.d.ts +0 -7
  37. package/components/DuffelAncillaries/seats/SeatMap.d.ts +0 -12
  38. package/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +0 -2
  39. package/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +0 -13
  40. package/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +0 -13
  41. package/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +0 -4
  42. package/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +0 -16
  43. package/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +0 -10
  44. package/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +0 -5
  45. package/components/DuffelPayments/DuffelPayments.d.ts +0 -11
  46. package/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +0 -13
  47. package/components/PlacesLookup/PlacesLookup.d.ts +0 -20
  48. package/components/shared/AnimatedLoaderEllipsis.d.ts +0 -2
  49. package/components/shared/Button.d.ts +0 -23
  50. package/components/shared/ErrorBoundary.d.ts +0 -13
  51. package/components/shared/FetchOfferErrorState.d.ts +0 -5
  52. package/components/shared/Icon.d.ts +0 -46
  53. package/components/shared/IconButton.d.ts +0 -16
  54. package/components/shared/Modal.d.ts +0 -11
  55. package/components/shared/NonIdealState.d.ts +0 -4
  56. package/components/shared/Stamp.d.ts +0 -7
  57. package/components/shared/Tabs.d.ts +0 -16
  58. package/custom-elements.d.ts +0 -6
  59. package/index.d.ts +0 -7
  60. package/lib/captureErrorInSentry.d.ts +0 -1
  61. package/lib/compileCreateOrderPayload.d.ts +0 -14
  62. package/lib/createPriceFormatters.d.ts +0 -12
  63. package/lib/fetchFromDuffelAPI.d.ts +0 -8
  64. package/lib/fetchFromFixtures.d.ts +0 -4
  65. package/lib/formatAvailableServices.d.ts +0 -12
  66. package/lib/formatDate.d.ts +0 -2
  67. package/lib/formatSeatMaps.d.ts +0 -4
  68. package/lib/getBaggageServiceDescription.d.ts +0 -2
  69. package/lib/getCabinsForSegmentAndDeck.d.ts +0 -2
  70. package/lib/getCurrencyForSeatMaps.d.ts +0 -10
  71. package/lib/getCurrencyForServices.d.ts +0 -11
  72. package/lib/getFirstSeatElementMatchingCriteria.d.ts +0 -3
  73. package/lib/getPassengerBySegmentList.d.ts +0 -6
  74. package/lib/getPassengerInitials.d.ts +0 -1
  75. package/lib/getPassengerMapById.d.ts +0 -3
  76. package/lib/getPassengerName.d.ts +0 -3
  77. package/lib/getRowNumber.d.ts +0 -2
  78. package/lib/getSegmentList.d.ts +0 -2
  79. package/lib/getServicePriceMapById.d.ts +0 -3
  80. package/lib/getSymbols.d.ts +0 -2
  81. package/lib/getTotalAmountForServices.d.ts +0 -6
  82. package/lib/getTotalQuantity.d.ts +0 -2
  83. package/lib/hasHighLuminance.d.ts +0 -1
  84. package/lib/hasService.d.ts +0 -2
  85. package/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +0 -3
  86. package/lib/hasWings.d.ts +0 -2
  87. package/lib/isBaggageService.d.ts +0 -2
  88. package/lib/isCancelForAnyReasonService.d.ts +0 -2
  89. package/lib/isFixtureOfferId.d.ts +0 -2
  90. package/lib/isPayloadComplete.d.ts +0 -2
  91. package/lib/isSeatElement.d.ts +0 -2
  92. package/lib/logging.d.ts +0 -46
  93. package/lib/moneyStringFormatter.d.ts +0 -8
  94. package/lib/offerIsExpired.d.ts +0 -2
  95. package/lib/retrieveOffer.d.ts +0 -2
  96. package/lib/retrieveOfferFromDuffelAPI.d.ts +0 -1
  97. package/lib/retrieveSeatMaps.d.ts +0 -2
  98. package/lib/retrieveSeatMapsFromDuffelAPI.d.ts +0 -1
  99. package/lib/setBodyScrollability.d.ts +0 -1
  100. package/lib/validateProps.d.ts +0 -7
  101. package/lib/withPlural.d.ts +0 -1
  102. package/scripts/generate-fixture.d.ts +0 -3
  103. package/scripts/setup-suggestion-data.d.ts +0 -28
  104. package/tsconfig.tsbuildinfo +0 -1
  105. package/types/Aircraft.d.ts +0 -14
  106. package/types/Airline.d.ts +0 -14
  107. package/types/Airport.d.ts +0 -44
  108. package/types/City.d.ts +0 -18
  109. package/types/CreateOrderPayload.d.ts +0 -72
  110. package/types/CurrencyConversion.d.ts +0 -10
  111. package/types/DuffelAncillariesProps.d.ts +0 -70
  112. package/types/Offer.d.ts +0 -711
  113. package/types/Order.d.ts +0 -8
  114. package/types/Place.d.ts +0 -8
  115. package/types/SeatMap.d.ts +0 -190
  116. package/types/index.d.ts +0 -11
@@ -1,13 +0,0 @@
1
- import * as React from "react";
2
- import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
3
- import { SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
4
- interface SeatElementProps {
5
- element: SeatMapCabinRowSectionElementSeat;
6
- currentSegmentId: string;
7
- currentPassengerId: string;
8
- currentPassengerName: string;
9
- onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
10
- selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
11
- }
12
- export declare const SeatElement: React.FC<SeatElementProps>;
13
- export {};
@@ -1,7 +0,0 @@
1
- import * as React from "react";
2
- import { SeatMapCabinRowSectionAvailableService, SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
3
- export interface SeatInfoProps {
4
- seat: SeatMapCabinRowSectionElementSeat | null;
5
- service: SeatMapCabinRowSectionAvailableService | undefined;
6
- }
7
- export declare const SeatInfo: React.FC<SeatInfoProps>;
@@ -1,12 +0,0 @@
1
- import * as React from "react";
2
- import { CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
3
- import { SeatMap as SeatMapType } from "../../../types/SeatMap";
4
- export interface SeatMapProps {
5
- seatMap: SeatMapType;
6
- selectedServicesMap: Record<string, CreateOrderPayloadSeatService>;
7
- onSeatToggled: (seatService: CreateOrderPayloadSeatService) => void;
8
- currentPassengerId: string;
9
- currentPassengerName: string;
10
- currentSegmentId: string;
11
- }
12
- export declare const SeatMap: React.FC<SeatMapProps>;
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- export declare const SeatMapUnavailable: React.FC;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { CreateOrderPayload, CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
3
- import { Offer } from "../../../types/Offer";
4
- import { SeatMap } from "../../../types/SeatMap";
5
- export interface SeatSelectionCardProps {
6
- isLoading: boolean;
7
- offer?: Offer;
8
- seatMaps?: SeatMap[];
9
- passengers: CreateOrderPayload["passengers"];
10
- selectedServices: CreateOrderPayloadServices;
11
- setSelectedServices: (selectedServices: CreateOrderPayloadServices) => void;
12
- }
13
- export declare const SeatSelectionCard: React.FC<SeatSelectionCardProps>;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { CreateOrderPayload, CreateOrderPayloadSeatService } from "../../../types/CreateOrderPayload";
3
- import { Offer } from "../../../types/Offer";
4
- import { SeatMap } from "../../../types/SeatMap";
5
- export interface SeatSelectionModalProps {
6
- isOpen: boolean;
7
- offer?: Offer;
8
- seatMaps?: SeatMap[];
9
- selectedServices: CreateOrderPayloadSeatService[];
10
- passengers: CreateOrderPayload["passengers"];
11
- onClose: (selectedServices: CreateOrderPayloadSeatService[]) => void;
12
- }
13
- export declare const SeatSelectionModal: React.FC<SeatSelectionModalProps>;
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { SeatMapProps } from "./SeatMap";
3
- export type SeatSelectionModalBodyProps = SeatMapProps;
4
- export declare const SeatSelectionModalBody: React.FC<SeatSelectionModalBodyProps>;
@@ -1,16 +0,0 @@
1
- import { ServicePriceMapById } from "@lib/getServicePriceMapById";
2
- import React from "react";
3
- import { CreateOrderPayloadServices } from "../../../types/CreateOrderPayload";
4
- import { SeatMap } from "../../../types/SeatMap";
5
- export interface SeatSelectionModalFooterProps {
6
- currency: string;
7
- selectedServices: CreateOrderPayloadServices;
8
- servicePrices: ServicePriceMapById;
9
- isFirstSegment: boolean;
10
- isLastSegment: boolean;
11
- onNextSegmentButtonClicked: () => void;
12
- onPreviousSegmentButtonClicked: () => void;
13
- onClose: () => void;
14
- seatMaps: SeatMap[];
15
- }
16
- export declare const SeatSelectionModalFooter: React.FC<SeatSelectionModalFooterProps>;
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { OfferSliceSegment } from "../../../types/Offer";
3
- export interface SeatSelectionModalHeaderProps {
4
- segmentAndPassengerPermutationsCount: number;
5
- currentSegment: OfferSliceSegment;
6
- currentPassengerName: string;
7
- currentSegmentAndPassengerPermutationsIndex: number;
8
- setCurrentSegmentAndPassengerPermutationsIndex: (index: number) => void;
9
- }
10
- export declare const SeatSelectionModalHeader: React.FC<SeatSelectionModalHeaderProps>;
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- import { SeatMapCabinRowSectionElementSeat } from "../../../types/SeatMap";
3
- export declare const SeatUnavailable: React.FC<{
4
- seat: SeatMapCabinRowSectionElementSeat;
5
- }>;
@@ -1,11 +0,0 @@
1
- import { StripeError } from "@stripe/stripe-js";
2
- import * as React from "react";
3
- import { CustomStyles } from "../../types";
4
- export interface DuffelPaymentsProps {
5
- paymentIntentClientToken: string;
6
- onSuccessfulPayment: () => void;
7
- onFailedPayment: (error: StripeError) => void;
8
- styles?: CustomStyles;
9
- debug?: boolean;
10
- }
11
- export declare const DuffelPayments: React.FC<DuffelPaymentsProps>;
@@ -1,13 +0,0 @@
1
- import { DuffelPaymentsProps } from "./DuffelPayments";
2
- declare global {
3
- namespace JSX {
4
- interface IntrinsicElements {
5
- "duffel-payments": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
6
- }
7
- }
8
- }
9
- type DuffelPaymentsCustomElementRenderArguments = Pick<DuffelPaymentsProps, "paymentIntentClientToken" | "styles">;
10
- export declare function renderDuffelPaymentsCustomElement(props: DuffelPaymentsCustomElementRenderArguments): void;
11
- export declare function onDuffelPaymentsSuccessfulPayment(onSuccessfulPayment: DuffelPaymentsProps["onSuccessfulPayment"]): void;
12
- export declare function onDuffelPaymentsFailedPayment(onFailedPayment: DuffelPaymentsProps["onFailedPayment"]): void;
13
- export {};
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- interface City {
3
- type: "city";
4
- name: string;
5
- iata_code: string;
6
- }
7
- interface Airport {
8
- type: "airport";
9
- name: string;
10
- iata_code: string;
11
- latitude: string;
12
- longitude: string;
13
- }
14
- type Place = City | Airport;
15
- export interface PlacesLookupProps {
16
- onPlaceSelected: (selection: Place) => void;
17
- placeholder?: string;
18
- }
19
- export declare const PlacesLookup: React.FC<PlacesLookupProps>;
20
- export {};
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- export declare const AnimatedLoaderEllipsis: React.FC;
@@ -1,23 +0,0 @@
1
- import { IconName } from "@components/shared/Icon";
2
- import * as React from "react";
3
- declare const BUTTON_VARIANTS: {
4
- primary: string;
5
- outlined: string;
6
- destructive: string;
7
- };
8
- type ButtonVariants = keyof typeof BUTTON_VARIANTS;
9
- declare const BUTTON_SIZES: {
10
- 32: string;
11
- 40: string;
12
- 48: string;
13
- };
14
- type ButtonSizes = keyof typeof BUTTON_SIZES;
15
- type NativeButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
16
- export interface ButtonProps extends Pick<NativeButtonProps, "id" | "onClick" | "disabled" | "children" | "className" | "type"> {
17
- "data-testid"?: string;
18
- iconBefore?: IconName;
19
- variant?: ButtonVariants;
20
- size?: ButtonSizes;
21
- }
22
- export declare const Button: React.FC<ButtonProps>;
23
- export {};
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- export declare class ErrorBoundary extends React.Component<{
3
- children: React.ReactNode | React.ReactNode[];
4
- }> {
5
- state: {
6
- hasError: boolean;
7
- };
8
- static getDerivedStateFromError(): {
9
- hasError: boolean;
10
- };
11
- componentDidCatch(error: Error): void;
12
- render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
13
- }
@@ -1,5 +0,0 @@
1
- import * as React from "react";
2
- export declare const FetchOfferErrorState: React.FC<{
3
- height: string;
4
- message: string;
5
- }>;
@@ -1,46 +0,0 @@
1
- import * as React from "react";
2
- export declare const ICON_MAP: {
3
- add: import("react/jsx-runtime").JSX.Element;
4
- apartment: import("react/jsx-runtime").JSX.Element;
5
- arrow_forward: import("react/jsx-runtime").JSX.Element;
6
- arrow_left: import("react/jsx-runtime").JSX.Element;
7
- arrow_right: import("react/jsx-runtime").JSX.Element;
8
- autorenew: import("react/jsx-runtime").JSX.Element;
9
- bassinet: import("react/jsx-runtime").JSX.Element;
10
- cabin_bag: import("react/jsx-runtime").JSX.Element;
11
- check: import("react/jsx-runtime").JSX.Element;
12
- checked_bag: import("react/jsx-runtime").JSX.Element;
13
- chevron: import("react/jsx-runtime").JSX.Element;
14
- close: import("react/jsx-runtime").JSX.Element;
15
- closet: import("react/jsx-runtime").JSX.Element;
16
- exit_row: import("react/jsx-runtime").JSX.Element;
17
- exit_row_right: import("react/jsx-runtime").JSX.Element;
18
- expand_content: import("react/jsx-runtime").JSX.Element;
19
- flight_class: import("react/jsx-runtime").JSX.Element;
20
- flight_takeoff: import("react/jsx-runtime").JSX.Element;
21
- galley: import("react/jsx-runtime").JSX.Element;
22
- lavatory: import("react/jsx-runtime").JSX.Element;
23
- lie_flat_seat: import("react/jsx-runtime").JSX.Element;
24
- minus: import("react/jsx-runtime").JSX.Element;
25
- no_airplane: import("react/jsx-runtime").JSX.Element;
26
- no_bag: import("react/jsx-runtime").JSX.Element;
27
- no_seat: import("react/jsx-runtime").JSX.Element;
28
- north_east: import("react/jsx-runtime").JSX.Element;
29
- seat: import("react/jsx-runtime").JSX.Element;
30
- seat_paid_indicator: import("react/jsx-runtime").JSX.Element;
31
- shield_with_moon: import("react/jsx-runtime").JSX.Element;
32
- stairs: import("react/jsx-runtime").JSX.Element;
33
- wifi: import("react/jsx-runtime").JSX.Element;
34
- };
35
- export type IconName = keyof typeof ICON_MAP;
36
- interface IconProps {
37
- name: IconName;
38
- className?: string;
39
- size?: number;
40
- onClick?: (event: React.MouseEvent<SVGSVGElement, MouseEvent>) => void;
41
- ml?: string;
42
- viewBox?: string;
43
- style?: React.CSSProperties;
44
- }
45
- export declare const Icon: React.FunctionComponent<IconProps>;
46
- export {};
@@ -1,16 +0,0 @@
1
- import * as React from "react";
2
- import { IconName } from "./Icon";
3
- declare const ICON_BUTTON_VARIANTS: {
4
- primary: string;
5
- outlined: string;
6
- };
7
- type IconButtonVariants = keyof typeof ICON_BUTTON_VARIANTS;
8
- type NativeButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
9
- export interface IconButtonProps extends Pick<NativeButtonProps, "id" | "onClick" | "disabled" | "className"> {
10
- "data-testid"?: string;
11
- icon: IconName;
12
- title: string;
13
- variant?: IconButtonVariants;
14
- }
15
- export declare const IconButton: React.FC<IconButtonProps>;
16
- export {};
@@ -1,11 +0,0 @@
1
- import * as React from "react";
2
- interface ModalProps {
3
- onClose: () => void;
4
- isOpen: boolean;
5
- children: React.ReactNode;
6
- }
7
- export declare const Modal: React.FC<ModalProps>;
8
- export declare const ModalBody: React.FC<{
9
- children: React.ReactNode;
10
- }>;
11
- export {};
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- export declare const NonIdealState: React.FC<React.PropsWithChildren<{
3
- style?: React.CSSProperties;
4
- }>>;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- export interface StampProps {
3
- backgroundColor: React.CSSProperties["backgroundColor"];
4
- color: React.CSSProperties["color"];
5
- children: React.ReactNode;
6
- }
7
- export declare const Stamp: React.FC<StampProps>;
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- export interface TabsProps {
3
- /**
4
- * The currently selected tab option
5
- */
6
- value: string;
7
- /**
8
- * Callback for when a new tab option is selected
9
- */
10
- onChange: (value: string) => void;
11
- /**
12
- * The options you want to render on the tabs
13
- */
14
- options: string[];
15
- }
16
- export declare const Tabs: React.FC<TabsProps>;
@@ -1,6 +0,0 @@
1
- /**
2
- * This file is one of the entry points for the library -- `@duffel/components/custom-elements`.
3
- * If you'd like to expose other custom element functions, please add them here.
4
- */
5
- export { onDuffelAncillariesPayloadReady, renderDuffelAncillariesCustomElement, } from "./components/DuffelAncillaries/DuffelAncillariesCustomElement";
6
- export { onDuffelPaymentsFailedPayment, onDuffelPaymentsSuccessfulPayment, renderDuffelPaymentsCustomElement, } from "./components/DuffelPayments/DuffelPaymentsCustomElement";
package/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * This file is the main entry point for the library -- `@duffel/components`.
3
- * If you'd like to expose other react components, please add them here.
4
- */
5
- export * from "./components/DuffelAncillaries/DuffelAncillaries";
6
- export * from "./components/DuffelPayments/DuffelPayments";
7
- export * from "./types";
@@ -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;
package/lib/hasWings.d.ts DELETED
@@ -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;
package/lib/logging.d.ts DELETED
@@ -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, log, logGroup };
@@ -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>;