@duffel/components 3.12.0 → 3.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/DuffelAncillaries/Counter.d.ts +10 -0
- package/components/DuffelAncillaries/DuffelAncillaries.d.ts +3 -0
- package/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +12 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +12 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +14 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +12 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +12 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +14 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +15 -0
- package/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +10 -0
- package/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +8 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +11 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +12 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +8 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +12 -0
- package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
- package/components/DuffelAncillaries/seats/Amenity.d.ts +7 -0
- package/components/DuffelAncillaries/seats/DeckSelect.d.ts +15 -0
- package/components/DuffelAncillaries/seats/Element.d.ts +16 -0
- package/components/DuffelAncillaries/seats/EmptyElement.d.ts +2 -0
- package/components/DuffelAncillaries/seats/ExitElement.d.ts +6 -0
- package/components/DuffelAncillaries/seats/Legend.d.ts +13 -0
- package/components/DuffelAncillaries/seats/Row.d.ts +14 -0
- package/components/DuffelAncillaries/seats/RowSection.d.ts +18 -0
- package/components/DuffelAncillaries/seats/SeatElement.d.ts +14 -0
- package/components/DuffelAncillaries/seats/SeatInfo.d.ts +8 -0
- package/components/DuffelAncillaries/seats/SeatMap.d.ts +13 -0
- package/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +2 -0
- package/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +13 -0
- package/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +15 -0
- package/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +4 -0
- package/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +16 -0
- package/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +11 -0
- package/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +6 -0
- package/components/DuffelCardForm/DuffelCardForm.d.ts +4 -0
- package/components/DuffelCardForm/DuffelCardFormCustomElement.d.ts +34 -0
- package/components/DuffelCardForm/lib/getIFrameEventListener.d.ts +7 -0
- package/components/DuffelCardForm/lib/getIFrameOriginForEnvironment.d.ts +2 -0
- package/components/DuffelCardForm/lib/getIframeURL.d.ts +2 -0
- package/components/DuffelCardForm/lib/getPathnameForIntent.d.ts +2 -0
- package/components/DuffelCardForm/lib/getTokenFromClientKey.d.ts +1 -0
- package/components/DuffelCardForm/lib/postMessageToCreateCardForTemporaryUse.d.ts +1 -0
- package/components/DuffelCardForm/lib/postMessageToSaveCard.d.ts +1 -0
- package/components/DuffelCardForm/lib/postMessageWithStyles.d.ts +2 -0
- package/components/DuffelCardForm/lib/types.d.ts +154 -0
- package/components/DuffelCardForm/lib/useDuffelCardFormActions.d.ts +24 -0
- package/components/DuffelNGSView/AirlineSelector.d.ts +10 -0
- package/components/DuffelNGSView/DuffelNGSView.d.ts +14 -0
- package/components/DuffelNGSView/FilterControl.d.ts +20 -0
- package/components/DuffelNGSView/FilterControls.d.ts +13 -0
- package/components/DuffelNGSView/NGSShelfInfoCard.d.ts +7 -0
- package/components/DuffelNGSView/NGSSliceFareCard.d.ts +10 -0
- package/components/DuffelNGSView/NGSTable.d.ts +15 -0
- package/components/DuffelNGSView/SliceSummary.d.ts +7 -0
- package/components/DuffelNGSView/SortingControl.d.ts +23 -0
- package/components/DuffelNGSView/StopsSelector.d.ts +8 -0
- package/components/DuffelNGSView/TimeRangeSelector.d.ts +8 -0
- package/components/DuffelNGSView/lib/deduplicate-mapped-offers-by-fare-brand.d.ts +7 -0
- package/components/DuffelNGSView/lib/does-slice-have-mixed-cabins.d.ts +4 -0
- package/components/DuffelNGSView/lib/filter-results.d.ts +14 -0
- package/components/DuffelNGSView/lib/get-initial-filter-values.d.ts +4 -0
- package/components/DuffelNGSView/lib/get-max-baggages-for-offer-slice.d.ts +8 -0
- package/components/DuffelNGSView/lib/getAirlines.d.ts +4 -0
- package/components/DuffelNGSView/lib/group-offers-for-ngs-view.d.ts +6 -0
- package/components/DuffelNGSView/lib/index.d.ts +14 -0
- package/components/DuffelNGSView/lib/sort-ngs-rows-by-duration.d.ts +5 -0
- package/components/DuffelNGSView/lib/sort-ngs-rows-by-recommended.d.ts +2 -0
- package/components/DuffelNGSView/lib/sort-ngs-rows-by-shelf-price.d.ts +6 -0
- package/components/DuffelNGSView/lib/useFilters.d.ts +28 -0
- package/components/DuffelPayments/DuffelPayments.d.ts +11 -0
- package/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +13 -0
- package/components/MapboxPlacesLookup/MapboxPlacesLookup.d.ts +12 -0
- package/components/MapboxPlacesLookup/MapboxPlacesLookupCustomElement.d.ts +13 -0
- package/components/MapboxPlacesLookup/lib/getPlacesFromMapboxClient.d.ts +7 -0
- package/components/OfferSlice/OfferSlice.d.ts +7 -0
- package/components/OfferSlice/OfferSliceConditions.d.ts +7 -0
- package/components/OfferSlice/OfferSliceDetailItem.d.ts +7 -0
- package/components/OfferSlice/OfferSliceDetailLayoverItem.d.ts +8 -0
- package/components/OfferSlice/OfferSliceDetailTravelItem.d.ts +9 -0
- package/components/OfferSlice/lib/getHighlightStyles.d.ts +7 -0
- package/components/OfferSliceModal/OfferSliceModal.d.ts +7 -0
- package/components/PlacesLookup/PlacesLookup.d.ts +20 -0
- package/components/Stays/StaysAmenities.d.ts +9 -0
- package/components/Stays/StaysAmenitiesCustomElement.d.ts +12 -0
- package/components/Stays/StaysCancellationTimeline/Policy.d.ts +8 -0
- package/components/Stays/StaysCancellationTimeline/StaysCancellationTimeline.d.ts +12 -0
- package/components/Stays/StaysCancellationTimeline/StaysCancellationTimelineDeposit.d.ts +12 -0
- package/components/Stays/StaysCancellationTimeline/StaysCancellationTimelineGuarantee.d.ts +12 -0
- package/components/Stays/StaysCancellationTimeline/StaysCancellationTimelinePayNow.d.ts +12 -0
- package/components/Stays/StaysCancellationTimeline/TimelineItem.d.ts +15 -0
- package/components/Stays/StaysCancellationTimeline/lib/isTimezoneDate.d.ts +4 -0
- package/components/Stays/StaysCancellationTimeline/lib/renderTimelineDateTime.d.ts +1 -0
- package/components/Stays/StaysRating.d.ts +6 -0
- package/components/Stays/StaysRatingCustomElement.d.ts +14 -0
- package/components/Stays/StaysRoomRateCard.d.ts +13 -0
- package/components/Stays/StaysRoomRateCardCustomElement.d.ts +14 -0
- package/components/Stays/StaysSummary.d.ts +12 -0
- package/components/Stays/StaysSummaryCustomElement.d.ts +12 -0
- package/components/Stays/lib/getRateLabel.d.ts +2 -0
- package/components/Stays/lib/types.d.ts +14 -0
- package/components/shared/AirlineLogo.d.ts +8 -0
- package/components/shared/AnimatedLoaderEllipsis.d.ts +2 -0
- package/components/shared/Button.d.ts +23 -0
- package/components/shared/Card.d.ts +14 -0
- package/components/shared/ErrorBoundary.d.ts +13 -0
- package/components/shared/FetchOfferErrorState.d.ts +5 -0
- package/components/shared/HSpace.d.ts +28 -0
- package/components/shared/Icon.d.ts +98 -0
- package/components/shared/IconButton.d.ts +16 -0
- package/components/shared/Modal.d.ts +14 -0
- package/components/shared/NonIdealState.d.ts +4 -0
- package/components/shared/RadioButton.d.ts +7 -0
- package/components/shared/SliceCarriersTitle.d.ts +8 -0
- package/components/shared/Stamp.d.ts +7 -0
- package/components/shared/Tabs.d.ts +16 -0
- package/components/shared/VSpace.d.ts +14 -0
- package/components/shared/WithComponentStyles.d.ts +7 -0
- package/custom-elements.d.ts +12 -0
- package/custom-elements.js +70 -0
- package/custom-elements.js.map +7 -0
- package/fixtures/offer-requests/orq_duplicates.d.ts +2 -0
- package/fixtures/passengers/mock_passengers.d.ts +4 -0
- package/functions/createThreeDSecureSession/client.d.ts +43 -0
- package/functions/createThreeDSecureSession/createThreeDSecureSession.d.ts +25 -0
- package/functions/createThreeDSecureSession/initEvervault.d.ts +1 -0
- package/functions/createThreeDSecureSession/loadEvervaultScript.d.ts +1 -0
- package/functions/hasService.d.ts +3 -0
- package/functions.d.ts +10 -0
- package/index.d.ts +19 -0
- package/index.js +55 -0
- package/index.js.map +7 -0
- package/lib/captureErrorInSentry.d.ts +1 -0
- package/lib/colors.d.ts +31 -0
- package/lib/compileCreateOrderPayload.d.ts +13 -0
- package/lib/convertDurationToString.d.ts +1 -0
- package/lib/createPriceFormatters.d.ts +12 -0
- package/lib/fetchFromDuffelAPI.d.ts +8 -0
- package/lib/fetchFromFixtures.d.ts +3 -0
- package/lib/formatAvailableServices.d.ts +12 -0
- package/lib/formatDate.d.ts +2 -0
- package/lib/formatSeatMaps.d.ts +4 -0
- package/lib/getAirlinesText.d.ts +2 -0
- package/lib/getBaggageServiceDescription.d.ts +2 -0
- package/lib/getCabinsForSegmentAndDeck.d.ts +3 -0
- package/lib/getCarriers.d.ts +6 -0
- package/lib/getCurrencyForSeatMaps.d.ts +10 -0
- package/lib/getCurrencyForServices.d.ts +11 -0
- package/lib/getDateObject.d.ts +10 -0
- package/lib/getDateString.d.ts +73 -0
- package/lib/getDayDiff.d.ts +5 -0
- package/lib/getDurationString.d.ts +1 -0
- package/lib/getFareBrandName.d.ts +2 -0
- package/lib/getFirstSeatElementMatchingCriteria.d.ts +4 -0
- package/lib/getLayoverOriginDestinationKey.d.ts +1 -0
- package/lib/getPassengerBySegmentList.d.ts +7 -0
- package/lib/getPassengerInitials.d.ts +1 -0
- package/lib/getPassengerMapById.d.ts +4 -0
- package/lib/getPassengerName.d.ts +2 -0
- package/lib/getRowNumber.d.ts +2 -0
- package/lib/getSegmentDates.d.ts +5 -0
- package/lib/getSegmentFlightNumber.d.ts +2 -0
- package/lib/getSegmentList.d.ts +3 -0
- package/lib/getServicePriceMapById.d.ts +4 -0
- package/lib/getSliceDetails.d.ts +3 -0
- package/lib/getSymbols.d.ts +2 -0
- package/lib/getTimeString.d.ts +1 -0
- package/lib/getTotalAmountForServices.d.ts +4 -0
- package/lib/getTotalQuantity.d.ts +2 -0
- package/lib/getTravelItem.d.ts +3 -0
- package/lib/hasAvailableSeatService.d.ts +3 -0
- package/lib/hasBaggageServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +4 -0
- package/lib/hasHighLuminance.d.ts +1 -0
- package/lib/hasService.d.ts +2 -0
- package/lib/hasWings.d.ts +2 -0
- package/lib/isAmenityElement.d.ts +3 -0
- package/lib/isBaggageService.d.ts +3 -0
- package/lib/isCancelForAnyReasonService.d.ts +3 -0
- package/lib/isFixtureOfferId.d.ts +2 -0
- package/lib/isISO8601Duration.d.ts +2 -0
- package/lib/isPayloadComplete.d.ts +3 -0
- package/lib/isSeatElement.d.ts +3 -0
- package/lib/isValidDateString.d.ts +6 -0
- package/lib/logging.d.ts +46 -0
- package/lib/moneyStringFormatter.d.ts +8 -0
- package/lib/offerIsExpired.d.ts +2 -0
- package/lib/retrieveOffer.d.ts +3 -0
- package/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
- package/lib/retrieveSeatMaps.d.ts +3 -0
- package/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
- package/lib/setBodyScrollability.d.ts +1 -0
- package/lib/toUTCDate.d.ts +1 -0
- package/lib/validateProps.d.ts +7 -0
- package/lib/withPlural.d.ts +1 -0
- package/package.json +2 -2
- package/stories/AirlineLogo.stories.d.ts +3 -0
- package/stories/AirlineSelector.stories.d.ts +3 -0
- package/stories/BaggageSelectionModalHeader.stories.d.ts +6 -0
- package/stories/Button.stories.d.ts +15 -0
- package/stories/DuffelAncillaries.stories.d.ts +24 -0
- package/stories/DuffelCardForm.stories.d.ts +7 -0
- package/stories/DuffelNGSView.stories.d.ts +8 -0
- package/stories/DuffelPayments.stories.d.ts +7 -0
- package/stories/Icon.stories.d.ts +3 -0
- package/stories/IconButton.stories.d.ts +8 -0
- package/stories/MapboxPlacesLookup.stories.d.ts +5 -0
- package/stories/NGSShelfInfoCard.stories.d.ts +3 -0
- package/stories/NGSSliceFareCard.stories.d.ts +3 -0
- package/stories/OfferSlice.stories.d.ts +5 -0
- package/stories/OfferSliceModal.stories.d.ts +6 -0
- package/stories/PlacesLookup.stories.d.ts +3 -0
- package/stories/SeatMap.stories.d.ts +4 -0
- package/stories/SliceCarriersTitle.stories.d.ts +10 -0
- package/stories/SliceSummary.stories.d.ts +5 -0
- package/stories/StaysAmenities.stories.d.ts +10 -0
- package/stories/StaysCancellationTimeline.stories.d.ts +122 -0
- package/stories/StaysRating.stories.d.ts +16 -0
- package/stories/StaysRoomRateCard.stories.d.ts +147 -0
- package/stories/StaysSummary.stories.d.ts +48 -0
- package/tests/components/DuffelAncillaries.test.d.ts +1 -0
- package/tests/functions/createThreeDSecureSession.test.d.ts +1 -0
- package/tests/lib/convertDurationToString.test.d.ts +1 -0
- package/tests/lib/createPriceFormatters.test.d.ts +1 -0
- package/tests/lib/formatAvailableServices.test.d.ts +1 -0
- package/tests/lib/formatSeatMaps.test.d.ts +1 -0
- package/tests/lib/getAirlines.test.d.ts +1 -0
- package/tests/lib/getAirlinesText.test.d.ts +1 -0
- package/tests/lib/getCarriers.test.d.ts +1 -0
- package/tests/lib/getCurrencyForServices.test.d.ts +1 -0
- package/tests/lib/getDateObject.test.d.ts +1 -0
- package/tests/lib/getDateString.spec.d.ts +1 -0
- package/tests/lib/getDayDiff.test.d.ts +1 -0
- package/tests/lib/getDurationString.test.d.ts +1 -0
- package/tests/lib/getFareBrandName.test.d.ts +1 -0
- package/tests/lib/getLayoverOriginDestinationKey.test.d.ts +1 -0
- package/tests/lib/getRateLabel.spec.d.ts +1 -0
- package/tests/lib/getSegmentDates.d.ts +1 -0
- package/tests/lib/getSegmentDates.test.d.ts +1 -0
- package/tests/lib/getSegmentFlightNumber.test.d.ts +1 -0
- package/tests/lib/getSliceDetails.test.d.ts +1 -0
- package/tests/lib/getTimeString.test.d.ts +1 -0
- package/tests/lib/getTravelItem.test.d.ts +1 -0
- package/tests/lib/groupOffersForNGSView.test.d.ts +1 -0
- package/tests/lib/hasAvailableSeatService.test.d.ts +1 -0
- package/tests/lib/hasBaggageServiceOfSameMetadataTypeAlreadyBeenSelected.test.d.ts +1 -0
- package/tests/lib/isValidDateString.test.d.ts +1 -0
- package/tests/lib/logging.test.d.ts +1 -0
- package/tests/lib/moneyStringFormatter.test.d.ts +1 -0
- package/tests/lib/toUTCDate.test.d.ts +1 -0
- package/tests/lib/validateProps.test.d.ts +5 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types/CurrencyConversion.d.ts +10 -0
- package/types/DuffelAncillariesProps.d.ts +127 -0
- package/types/TravelDetails.d.ts +77 -0
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const captureErrorInSentry: (error: Error) => string;
|
package/lib/colors.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
"--GREY-50": string;
|
|
3
|
+
"--GREY-100": string;
|
|
4
|
+
"--GREY-200": string;
|
|
5
|
+
"--GREY-300": string;
|
|
6
|
+
"--GREY-400": string;
|
|
7
|
+
"--GREY-500": string;
|
|
8
|
+
"--GREY-600": string;
|
|
9
|
+
"--GREY-700": string;
|
|
10
|
+
"--GREY-900": string;
|
|
11
|
+
"--RED": string;
|
|
12
|
+
"--BLACK": string;
|
|
13
|
+
"--WHITE": string;
|
|
14
|
+
"--ACCENT": string;
|
|
15
|
+
"--ACCENT-LIGHT-100": string;
|
|
16
|
+
"--ACCENT-LIGHT-200": string;
|
|
17
|
+
"--ACCENT-LIGHT-300": string;
|
|
18
|
+
"--ACCENT-LIGHT-800": string;
|
|
19
|
+
"--ACCENT-LIGHT-1000": string;
|
|
20
|
+
"--GREEN-100": string;
|
|
21
|
+
"--GREEN-200": string;
|
|
22
|
+
"--GREEN-300": string;
|
|
23
|
+
"--GREEN-700": string;
|
|
24
|
+
"--GREEN-800": string;
|
|
25
|
+
"--YELLOW-600": string;
|
|
26
|
+
"--YELLOW-700": string;
|
|
27
|
+
"--BLUE-100": string;
|
|
28
|
+
"--BLUE-300": string;
|
|
29
|
+
"--PINK-700": string;
|
|
30
|
+
};
|
|
31
|
+
export type Color = keyof typeof colors;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { CreateOrder, Offer, SeatMap } from "@duffel/api/types";
|
|
3
|
+
import { DuffelAncillariesProps } from "src/types";
|
|
4
|
+
interface CompileCreateOrderPayloadInput {
|
|
5
|
+
offer: Offer;
|
|
6
|
+
passengers: DuffelAncillariesProps["passengers"];
|
|
7
|
+
baggageSelectedServices: CreateOrder["services"];
|
|
8
|
+
seatSelectedServices: CreateOrder["services"];
|
|
9
|
+
cfarSelectedServices: CreateOrder["services"];
|
|
10
|
+
seatMaps?: SeatMap[];
|
|
11
|
+
}
|
|
12
|
+
export declare const compileCreateOrderPayload: ({ baggageSelectedServices, seatSelectedServices, cfarSelectedServices, offer, seatMaps, passengers, }: CompileCreateOrderPayloadInput) => Partial<CreateOrder>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertDurationToString(duration: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DuffelAncillariesMarkup, DuffelAncillariesPriceFormatters } from "../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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
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>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Offer } from "@duffel/api/types";
|
|
2
|
+
import { DuffelAncillariesPriceFormatters } from "../types/DuffelAncillariesProps";
|
|
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 };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SeatMap } from "@duffel/api/types";
|
|
2
|
+
import { DuffelAncillariesPriceFormatterForSeats } from "../types/DuffelAncillariesProps";
|
|
3
|
+
declare const formatSeatMaps: (seatMaps: SeatMap[], priceFormatter?: DuffelAncillariesPriceFormatterForSeats) => SeatMap[];
|
|
4
|
+
export { formatSeatMaps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { Airline, OfferSliceSegment, OrderSliceSegment } from "@duffel/api/types";
|
|
3
|
+
export declare const getCarriers: (forSegments: OfferSliceSegment[] | OrderSliceSegment[]) => {
|
|
4
|
+
marketingCarrier: Airline | null;
|
|
5
|
+
operatingCarriers: Airline[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SeatMap } from "@duffel/api/types";
|
|
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 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Offer } from "@duffel/api/types";
|
|
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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates JS date object based on an ISO string.
|
|
3
|
+
* It adds a safe times to date only strings so it can be safely used by Intl
|
|
4
|
+
* without breaking based on locale.
|
|
5
|
+
*
|
|
6
|
+
* This function return null if the string cannot be parsed into a Date
|
|
7
|
+
*
|
|
8
|
+
* @param fromISO The ISO-8601 date string to be converted into a JS date object
|
|
9
|
+
*/
|
|
10
|
+
export declare const getDateObject: (fromISO: string) => Date | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
declare const formats: {
|
|
2
|
+
readonly short: {
|
|
3
|
+
readonly year: "numeric";
|
|
4
|
+
readonly month: "numeric";
|
|
5
|
+
readonly day: "numeric";
|
|
6
|
+
};
|
|
7
|
+
readonly shortWithTime: {
|
|
8
|
+
readonly year: "numeric";
|
|
9
|
+
readonly month: "numeric";
|
|
10
|
+
readonly day: "numeric";
|
|
11
|
+
readonly hour: "numeric";
|
|
12
|
+
readonly minute: "numeric";
|
|
13
|
+
};
|
|
14
|
+
readonly medium: {
|
|
15
|
+
readonly year: "numeric";
|
|
16
|
+
readonly month: "short";
|
|
17
|
+
readonly day: "numeric";
|
|
18
|
+
};
|
|
19
|
+
readonly mediumNoYear: {
|
|
20
|
+
readonly month: "short";
|
|
21
|
+
readonly day: "numeric";
|
|
22
|
+
};
|
|
23
|
+
readonly mediumWithTime: {
|
|
24
|
+
readonly year: "numeric";
|
|
25
|
+
readonly month: "short";
|
|
26
|
+
readonly day: "numeric";
|
|
27
|
+
readonly hour: "numeric";
|
|
28
|
+
readonly minute: "numeric";
|
|
29
|
+
};
|
|
30
|
+
readonly mediumWithTimeAndTimezone: {
|
|
31
|
+
readonly year: "numeric";
|
|
32
|
+
readonly month: "short";
|
|
33
|
+
readonly day: "numeric";
|
|
34
|
+
readonly hour: "numeric";
|
|
35
|
+
readonly minute: "numeric";
|
|
36
|
+
readonly timeZoneName: "short";
|
|
37
|
+
readonly hour12: true;
|
|
38
|
+
};
|
|
39
|
+
readonly long: {
|
|
40
|
+
readonly weekday: "short";
|
|
41
|
+
readonly year: "numeric";
|
|
42
|
+
readonly month: "short";
|
|
43
|
+
readonly day: "numeric";
|
|
44
|
+
};
|
|
45
|
+
readonly longNoYear: {
|
|
46
|
+
readonly weekday: "short";
|
|
47
|
+
readonly month: "short";
|
|
48
|
+
readonly day: "numeric";
|
|
49
|
+
};
|
|
50
|
+
readonly longWithTime: {
|
|
51
|
+
readonly weekday: "short";
|
|
52
|
+
readonly year: "numeric";
|
|
53
|
+
readonly month: "short";
|
|
54
|
+
readonly day: "numeric";
|
|
55
|
+
readonly hour: "numeric";
|
|
56
|
+
readonly minute: "numeric";
|
|
57
|
+
readonly hour12: false;
|
|
58
|
+
};
|
|
59
|
+
readonly timeOnlyWithTimezone: {
|
|
60
|
+
readonly hour: "numeric";
|
|
61
|
+
readonly minute: "numeric";
|
|
62
|
+
readonly hour12: true;
|
|
63
|
+
readonly timeZoneName: "short";
|
|
64
|
+
};
|
|
65
|
+
readonly timeOnly: {
|
|
66
|
+
readonly hour: "numeric";
|
|
67
|
+
readonly minute: "numeric";
|
|
68
|
+
readonly hour12: true;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type DateTimeDisplayFormat = keyof typeof formats;
|
|
72
|
+
export declare const getDateString: (original: Date | string | null, format: DateTimeDisplayFormat, locale?: string) => string;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDurationString(start: Date | string, end: Date | string, format?: "long"): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { SeatMap, SeatMapCabinRowSectionElement } from "@duffel/api/types";
|
|
3
|
+
declare const getFirstSeatElementMatchingCriteria: (seatMaps: SeatMap[], matcher: (element: SeatMapCabinRowSectionElement) => boolean) => SeatMapCabinRowSectionElement | undefined;
|
|
4
|
+
export { getFirstSeatElementMatchingCriteria };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLayoverOriginDestinationKey: (from?: string | null, at?: string | null, to?: string | null) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { OfferSliceSegment } from "@duffel/api/types";
|
|
3
|
+
export declare const getPassengerBySegmentList: (segments: OfferSliceSegment[]) => {
|
|
4
|
+
passenger: import("@duffel/api/types").OfferSliceSegmentPassenger;
|
|
5
|
+
passengerIndex: number;
|
|
6
|
+
segment: OfferSliceSegment;
|
|
7
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getPassengerInitials: (passengerName?: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { CreateOrder, CreateOrderPassenger } from "@duffel/api/types";
|
|
3
|
+
export type PassengerMapById = Record<CreateOrderPassenger["id"], CreateOrderPassenger>;
|
|
4
|
+
export declare const getPassengerMapById: (passengers: CreateOrder["passengers"]) => PassengerMapById;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { OfferAvailableService } from "@duffel/api/types";
|
|
3
|
+
export type ServicePriceMapById = Record<OfferAvailableService["id"], Pick<OfferAvailableService, "total_amount" | "total_currency">>;
|
|
4
|
+
export declare const getServicePriceMapById: (availableServices: OfferAvailableService[]) => ServicePriceMapById;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getTimeString: (original: Date | string, locale?: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CreateOrder, Offer, SeatMap } from "@duffel/api/types";
|
|
2
|
+
import { ServicePriceMapById } from "./getServicePriceMapById";
|
|
3
|
+
export declare const getTotalAmountForServices: (offer: Offer, selectedServices: CreateOrder["services"], seatMaps?: SeatMap[]) => number;
|
|
4
|
+
export declare const getTotalAmountForServicesWithPriceMap: (servicePriceMap: ServicePriceMapById, selectedServices: CreateOrder["services"], seatMaps?: SeatMap[]) => number;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { OfferSliceSegment, OrderSliceSegment } from "@duffel/api/types";
|
|
2
|
+
import { TravelDetails } from "src/types/TravelDetails";
|
|
3
|
+
export declare const getTravelItem: (fromSegment: OfferSliceSegment | OrderSliceSegment, fareBrandName: string | null) => TravelDetails<"order" | "offer">;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { CreateOrderService, OfferAvailableServiceBaggage } from "@duffel/api/types";
|
|
3
|
+
import { WithBaggageServiceInformation } from "src/types";
|
|
4
|
+
export declare function hasBaggageServiceOfSameMetadataTypeAlreadyBeenSelected(selectedServices: WithBaggageServiceInformation<CreateOrderService>[], availableService: OfferAvailableServiceBaggage): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hasHighLuminance: (accentColor: string) => boolean;
|
package/lib/logging.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { Offer } from "@duffel/api/types";
|
|
3
|
+
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function retrieveOfferFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { SeatMap } from "@duffel/api/types";
|
|
3
|
+
export declare function retrieveSeatMaps(offer_id: string, client_key: string | null, onError: () => void, setIsLoading: (isLoading: boolean) => void, onSeatMapReady: (seatMaps: SeatMap[]) => void): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function retrieveSeatMapsFromDuffelAPI(offer_id: string, client_key: string): Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setBodyScrollability: (shouldScroll: boolean) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toUTCDate: <T extends Date | null>(date: T) => T;
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const withPlural: (totalQuantity: number, singular: string, plural: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffel/components",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.2",
|
|
4
4
|
"description": "Component library to build your travel product with Duffel.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Duffel",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"semver": "7.5.4"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@duffel/api": "4.
|
|
54
|
+
"@duffel/api": "4.21.0",
|
|
55
55
|
"@sentry/browser": "7.119.2",
|
|
56
56
|
"@stripe/react-stripe-js": "2.1.0",
|
|
57
57
|
"@stripe/stripe-js": "1.54.2",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { BaggageSelectionModalHeader } from "../components/DuffelAncillaries/bags/BaggageSelectionModalHeader";
|
|
3
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof BaggageSelectionModalHeader>;
|
|
6
|
+
export declare const FirstStory: Story;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryFn, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Button, ButtonProps } from "../components/shared/Button";
|
|
3
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type ButtonStory = StoryObj<typeof Button>;
|
|
6
|
+
export declare const Default: ButtonStory;
|
|
7
|
+
export declare const Disabled: ButtonStory;
|
|
8
|
+
export declare const WithIconBefore: ButtonStory;
|
|
9
|
+
export declare const WithOutlinedVariant: ButtonStory;
|
|
10
|
+
export declare const DisabledWithOutlinedVariant: ButtonStory;
|
|
11
|
+
export declare const WithDestructiveVariant: ButtonStory;
|
|
12
|
+
export declare const WithSize32: ButtonStory;
|
|
13
|
+
export declare const WithSize48: ButtonStory;
|
|
14
|
+
export declare const WithAccentColorSet: StoryFn<ButtonProps>;
|
|
15
|
+
export declare const WithWhiteAccentColorSet: StoryFn<ButtonProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryFn, StoryObj } from "@storybook/react";
|
|
2
|
+
import { DuffelAncillaries } from "../components/DuffelAncillaries/DuffelAncillaries";
|
|
3
|
+
import { DuffelAncillariesPropsWithOffersAndSeatMaps } from "../types/DuffelAncillariesProps";
|
|
4
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
5
|
+
export default _default;
|
|
6
|
+
type DuffelAncillariesStory = StoryObj<typeof DuffelAncillaries>;
|
|
7
|
+
export declare const AllServices: DuffelAncillariesStory;
|
|
8
|
+
export declare const JustBags: DuffelAncillariesStory;
|
|
9
|
+
export declare const JustSeats: DuffelAncillariesStory;
|
|
10
|
+
export declare const JustCFAR: DuffelAncillariesStory;
|
|
11
|
+
export declare const ExpiredOffer: DuffelAncillariesStory;
|
|
12
|
+
export declare const OneWayOnePassengerOffer: DuffelAncillariesStory;
|
|
13
|
+
export declare const WithCustomStyles: DuffelAncillariesStory;
|
|
14
|
+
export declare const Markup: DuffelAncillariesStory;
|
|
15
|
+
export declare const MarkupUsingPriceFormatters: DuffelAncillariesStory;
|
|
16
|
+
export declare const MarkupUsingPriceFormattersWithCustomCurrency: DuffelAncillariesStory;
|
|
17
|
+
export declare const WithAccentColorSet: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
18
|
+
export declare const WithWhiteAccentColorSet: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
19
|
+
export declare const NoSeatMaps: DuffelAncillariesStory;
|
|
20
|
+
export declare const BaggageBehaviourSpirit: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
21
|
+
export declare const BaggageBehaviourEasyjet: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
22
|
+
export declare const BaggageBehaviourLufthansa: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
23
|
+
export declare const BaggageBehaviourAustrian: StoryFn<DuffelAncillariesPropsWithOffersAndSeatMaps>;
|
|
24
|
+
export declare const WithPreselectedServices: DuffelAncillariesStory;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DuffelCardForm } from "@components/DuffelCardForm/DuffelCardForm";
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type DuffelCardFormStory = StoryObj<typeof DuffelCardForm>;
|
|
6
|
+
export declare const Default: DuffelCardFormStory;
|
|
7
|
+
export declare const WithLinksStyles: DuffelCardFormStory;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryFn } from "@storybook/react";
|
|
2
|
+
import { DuffelNGSViewProps } from "../components/DuffelNGSView/DuffelNGSView";
|
|
3
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: StoryFn<DuffelNGSViewProps>;
|
|
6
|
+
export declare const Deduplicated: StoryFn<DuffelNGSViewProps>;
|
|
7
|
+
export declare const Large: StoryFn<DuffelNGSViewProps>;
|
|
8
|
+
export declare const Spirit: StoryFn<DuffelNGSViewProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { DuffelPayments } from "../components/DuffelPayments/DuffelPayments";
|
|
3
|
+
declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react/dist/types-a5624094").R, import("@storybook/csf").Args>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type DuffelPaymentsStory = StoryObj<typeof DuffelPayments>;
|
|
6
|
+
export declare const Default: DuffelPaymentsStory;
|
|
7
|
+
export declare const WithCustomStyles: DuffelPaymentsStory;
|