@duffel/components 3.5.0--canary-5 → 3.5.0--canary-7

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.
@@ -1,3 +1,3 @@
1
1
  import * as React from "react";
2
2
  import { DuffelCardFormProps } from "./lib/types";
3
- export declare const DuffelCardForm: React.FC<DuffelCardFormProps>;
3
+ export declare const DuffelCardForm: React.ForwardRefExoticComponent<DuffelCardFormProps & React.RefAttributes<DuffelCardFormActions>>;
@@ -1,2 +1,2 @@
1
1
  import { DuffelCardFormProps } from "./types";
2
- export declare function getIframeURL(tokenProxyEnvironment: DuffelCardFormProps["tokenProxyEnvironment"], intent: DuffelCardFormProps["intent"], clientKey: DuffelCardFormProps["clientKey"], cardId: DuffelCardFormProps["cardId"]): URL;
2
+ export declare function getIframeURL(tokenProxyEnvironment: DuffelCardFormProps["tokenProxyEnvironment"], intent: DuffelCardFormProps["intent"], clientKey: DuffelCardFormProps["clientKey"], savedCardData: DuffelCardFormProps["savedCardData"]): URL;
@@ -67,23 +67,14 @@ export interface DuffelCardFormProps {
67
67
  * but not create an id for immediate, temporary use. For the use case of saving during checkout or save + use, use the `to-create-card-for-temporary-use` intent.
68
68
  */
69
69
  intent: DuffelCardFormIntent;
70
- /**
71
- * The actions you'd like the component to perform.
72
- *
73
- * This prop is a dependecy of a useEffect hook in the component
74
- * and so when it's changed it will perform the action you specify.
75
- *
76
- * The `create-card-for-temporary-use` and `save-card` actions will only happen once `validate` has been successful.
77
- *
78
- * We recommend using the `useDuffelCardFormActions` hook for a simpler, more readable interface to manage the actions array.
79
- *
80
- */
81
- actions: DuffelCardFormAction[];
82
70
  /**
83
71
  * Once a card is saved, in order to use it, travellers need to enter its cvv.
84
72
  * When using the `use-saved-card` intent, you must provide the card ID.
85
73
  */
86
- cardId?: string;
74
+ savedCardData?: {
75
+ id: string;
76
+ brand: string;
77
+ };
87
78
  /**
88
79
  * This function will be called when the card form validation has been successful.
89
80
  */
@@ -1,23 +1,24 @@
1
- import { DuffelCardFormProps } from "./types";
1
+ import React from "react";
2
+ export interface DuffelCardFormActions {
3
+ saveCard: () => void;
4
+ createCardForTemporaryUse: () => void;
5
+ }
2
6
  export interface UseDuffelCardFormActionsHook {
3
7
  /**
4
- * The actions array that should be passed to the `actions` prop of the `DuffelCardForm` component.
5
- * You do not have have to modify this array directly, instead rely on `triggerSaveCard` and `triggerCreateCardForTemporaryUse` to update the array.
8
+ * The ref you should pass to the DuffelCardForm component.
6
9
  */
7
- actions: DuffelCardFormProps["actions"];
10
+ ref: React.RefObject<DuffelCardFormActions>;
8
11
  /**
9
12
  * Call this function to tell the component to save the card.
10
13
  */
11
- triggerSaveCard: () => void;
14
+ saveCard: () => void;
12
15
  /**
13
16
  * Call this function to tell the component to create a card for temporary use.
14
17
  */
15
- triggerCreateCardForTemporaryUse: () => void;
18
+ createCardForTemporaryUse: () => void;
16
19
  }
17
20
  /**
18
- * This hook gives you convinient helpers to read and reason through the DuffelCardForm integration.
19
- * Add `actions` to the `DuffelCardForm` actions prop and call the functions to trigger the actions you'd like.
20
- *
21
- * In the background, this hook is setting the state on actions prop and the component's useEffect hook will trigger the action.
21
+ * This hook abstracts the ref for convinience and readability.
22
+ * Add `ref` to the `DuffelCardForm` `ref` prop and call the functions to trigger the actions you'd like.
22
23
  */
23
24
  export declare function useDuffelCardFormActions(): UseDuffelCardFormActionsHook;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { OfferWithNGS } from "./lib";
3
+ export interface DuffelNGSViewProps {
4
+ offers: OfferWithNGS[];
5
+ }
6
+ export declare const DuffelNGSView: React.FC<DuffelNGSViewProps>;
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { NGSShelf } from "./lib";
3
+ export interface NGSShelfInfoCardProps {
4
+ ngs_shelf: NGSShelf;
5
+ }
6
+ export declare const NGSShelfInfoCard: React.FC<NGSShelfInfoCardProps>;
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { OfferWithNGS } from "./lib";
3
+ export interface NGSSliceFareCardProps {
4
+ offer: OfferWithNGS;
5
+ sliceIndex: number;
6
+ selected?: boolean;
7
+ onSelect?: () => void;
8
+ compareToAmount?: number;
9
+ }
10
+ export declare const NGSSliceFareCard: React.FC<NGSSliceFareCardProps>;
@@ -0,0 +1,8 @@
1
+ import { OfferAvailableServiceBaggageMetadata, OfferSlice, OfferSliceSegmentPassenger } from "@duffel/api/types";
2
+ /**
3
+ * Returns the passenger baggages object with the largest quantity of baggages
4
+ * of a specified type for a slice. Baggage quantity can (very occasionally)
5
+ * vary across passengers and segments in a slice, so the 'max' baggages can
6
+ * be used as the baseline for a slice.
7
+ */
8
+ export declare const getMaxBaggagesForOfferSlice: (offerSlice: OfferSlice, type: OfferAvailableServiceBaggageMetadata["type"]) => OfferSliceSegmentPassenger["baggages"];
@@ -0,0 +1,56 @@
1
+ /// <reference types="@duffel/api" />
2
+ import { IconName } from "@components/shared/Icon";
3
+ import { Offer, OfferSlice, OfferSliceSegment, OfferSliceSegmentPassenger } from "@duffel/api/types";
4
+ export declare const NGS_SHELVES: readonly ["1", "2", "3", "4", "5", "6"];
5
+ export type NGSShelf = (typeof NGS_SHELVES)[number];
6
+ type SeatWithNGS = {
7
+ type: string;
8
+ flatness: string;
9
+ };
10
+ type CabinWithNGS = {
11
+ amenities: {
12
+ seat: SeatWithNGS;
13
+ power: {
14
+ available: boolean;
15
+ };
16
+ wifi: {
17
+ available: boolean;
18
+ cost: "free" | "paid" | "free or paid" | "n/a";
19
+ };
20
+ };
21
+ layout: {
22
+ type: string;
23
+ };
24
+ };
25
+ type OfferSliceSegmentPassengerWithNGS = OfferSliceSegmentPassenger & {
26
+ cabin: CabinWithNGS;
27
+ ticket_attributes: {
28
+ advanced_selection_available: boolean;
29
+ };
30
+ };
31
+ export type OfferSliceSegmentWithNGS = OfferSliceSegment & {
32
+ passengers: OfferSliceSegmentPassengerWithNGS[];
33
+ };
34
+ type OfferSliceWithNGS = OfferSlice & {
35
+ segments: OfferSliceSegmentWithNGS[];
36
+ ngs_shelf: NGSShelf;
37
+ };
38
+ export type OfferWithNGS = Offer & {
39
+ slices: OfferSliceWithNGS[];
40
+ };
41
+ type SeatType = "Standard seat" | "Extra legroom" | "Larger seat" | "Lie flat bed" | "Lie flat suite";
42
+ type ShelfInfo = {
43
+ short_title: string;
44
+ full_title: string;
45
+ description: string;
46
+ seat: {
47
+ description: SeatType;
48
+ icon: IconName;
49
+ };
50
+ checked_bag: boolean;
51
+ seat_selection: boolean;
52
+ icon: IconName;
53
+ };
54
+ export declare const SEAT_ICONS_MAP: Record<SeatType, IconName>;
55
+ export declare const NGS_SHELF_INFO: Record<NGSShelf, ShelfInfo>;
56
+ export {};
@@ -3,6 +3,12 @@ import * as React from "react";
3
3
  export declare const ICON_MAP: {
4
4
  accessible: import("react/jsx-runtime").JSX.Element;
5
5
  add: import("react/jsx-runtime").JSX.Element;
6
+ airline_seat_flat: import("react/jsx-runtime").JSX.Element;
7
+ airline_seat_individual_suite: import("react/jsx-runtime").JSX.Element;
8
+ airline_seat_legroom_extra: import("react/jsx-runtime").JSX.Element;
9
+ airline_seat_recline_extra: import("react/jsx-runtime").JSX.Element;
10
+ airline_seat_recline_normal: import("react/jsx-runtime").JSX.Element;
11
+ airplane_ticket: import("react/jsx-runtime").JSX.Element;
6
12
  apartment: import("react/jsx-runtime").JSX.Element;
7
13
  arrow_forward: import("react/jsx-runtime").JSX.Element;
8
14
  arrow_left: import("react/jsx-runtime").JSX.Element;
@@ -14,8 +20,10 @@ export declare const ICON_MAP: {
14
20
  bedroom_parent: import("react/jsx-runtime").JSX.Element;
15
21
  brunch_dining: import("react/jsx-runtime").JSX.Element;
16
22
  cabin_bag: import("react/jsx-runtime").JSX.Element;
23
+ carry_on_bag_inactive: import("react/jsx-runtime").JSX.Element;
17
24
  check: import("react/jsx-runtime").JSX.Element;
18
25
  check_circle: import("react/jsx-runtime").JSX.Element;
26
+ check_small: import("react/jsx-runtime").JSX.Element;
19
27
  checked_bag: import("react/jsx-runtime").JSX.Element;
20
28
  chevron: import("react/jsx-runtime").JSX.Element;
21
29
  child_care: import("react/jsx-runtime").JSX.Element;
@@ -23,6 +31,7 @@ export declare const ICON_MAP: {
23
31
  closet: import("react/jsx-runtime").JSX.Element;
24
32
  concierge: import("react/jsx-runtime").JSX.Element;
25
33
  credit_card: import("react/jsx-runtime").JSX.Element;
34
+ currency_exchange: import("react/jsx-runtime").JSX.Element;
26
35
  dinner_dining: import("react/jsx-runtime").JSX.Element;
27
36
  exit_row: import("react/jsx-runtime").JSX.Element;
28
37
  exit_row_right: import("react/jsx-runtime").JSX.Element;
@@ -40,6 +49,7 @@ export declare const ICON_MAP: {
40
49
  local_bar: import("react/jsx-runtime").JSX.Element;
41
50
  local_parking: import("react/jsx-runtime").JSX.Element;
42
51
  loyalty: import("react/jsx-runtime").JSX.Element;
52
+ luggage: import("react/jsx-runtime").JSX.Element;
43
53
  meeting_room: import("react/jsx-runtime").JSX.Element;
44
54
  minus: import("react/jsx-runtime").JSX.Element;
45
55
  no_airplane: import("react/jsx-runtime").JSX.Element;
@@ -55,6 +65,7 @@ export declare const ICON_MAP: {
55
65
  seat: import("react/jsx-runtime").JSX.Element;
56
66
  seat_paid_indicator: import("react/jsx-runtime").JSX.Element;
57
67
  shield_with_moon: import("react/jsx-runtime").JSX.Element;
68
+ shopping_bag: import("react/jsx-runtime").JSX.Element;
58
69
  spa: import("react/jsx-runtime").JSX.Element;
59
70
  stairs: import("react/jsx-runtime").JSX.Element;
60
71
  star: import("react/jsx-runtime").JSX.Element;
@@ -2,5 +2,6 @@ import * as React from "react";
2
2
  export interface RadioButtonProps {
3
3
  value: string;
4
4
  checked?: boolean;
5
+ className?: string;
5
6
  }
6
7
  export declare const RadioButton: React.FC<RadioButtonProps>;