@duffel/components 3.1.3--prototype.12 → 3.1.3--prototype.14

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 (114) hide show
  1. package/components/DuffelAncillaries/Card.d.ts +14 -0
  2. package/components/DuffelAncillaries/Counter.d.ts +10 -0
  3. package/components/DuffelAncillaries/DuffelAncillaries.d.ts +3 -0
  4. package/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +12 -0
  5. package/components/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +11 -0
  6. package/components/DuffelAncillaries/bags/BaggageSelectionController.d.ts +13 -0
  7. package/components/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +11 -0
  8. package/components/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +11 -0
  9. package/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +13 -0
  10. package/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +14 -0
  11. package/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +9 -0
  12. package/components/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +7 -0
  13. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +10 -0
  14. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +11 -0
  15. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +7 -0
  16. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +4 -0
  17. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +11 -0
  18. package/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +2 -0
  19. package/components/DuffelAncillaries/seats/Amenity.d.ts +6 -0
  20. package/components/DuffelAncillaries/seats/DeckSelect.d.ts +15 -0
  21. package/components/DuffelAncillaries/seats/Element.d.ts +15 -0
  22. package/components/DuffelAncillaries/seats/EmptyElement.d.ts +2 -0
  23. package/components/DuffelAncillaries/seats/ExitElement.d.ts +6 -0
  24. package/components/DuffelAncillaries/seats/Legend.d.ts +12 -0
  25. package/components/DuffelAncillaries/seats/Row.d.ts +13 -0
  26. package/components/DuffelAncillaries/seats/RowSection.d.ts +17 -0
  27. package/components/DuffelAncillaries/seats/SeatElement.d.ts +13 -0
  28. package/components/DuffelAncillaries/seats/SeatInfo.d.ts +7 -0
  29. package/components/DuffelAncillaries/seats/SeatMap.d.ts +12 -0
  30. package/components/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +2 -0
  31. package/components/DuffelAncillaries/seats/SeatSelectionCard.d.ts +13 -0
  32. package/components/DuffelAncillaries/seats/SeatSelectionModal.d.ts +13 -0
  33. package/components/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +4 -0
  34. package/components/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +16 -0
  35. package/components/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +10 -0
  36. package/components/DuffelAncillaries/seats/SeatUnavailable.d.ts +5 -0
  37. package/components/DuffelPayments/DuffelPayments.d.ts +11 -0
  38. package/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +13 -0
  39. package/components/PlacesLookup/PlacesLookup.d.ts +20 -0
  40. package/components/shared/AnimatedLoaderEllipsis.d.ts +2 -0
  41. package/components/shared/Button.d.ts +23 -0
  42. package/components/shared/ErrorBoundary.d.ts +13 -0
  43. package/components/shared/FetchOfferErrorState.d.ts +5 -0
  44. package/components/shared/Icon.d.ts +46 -0
  45. package/components/shared/IconButton.d.ts +16 -0
  46. package/components/shared/Modal.d.ts +11 -0
  47. package/components/shared/NonIdealState.d.ts +4 -0
  48. package/components/shared/Stamp.d.ts +7 -0
  49. package/components/shared/Tabs.d.ts +16 -0
  50. package/custom-elements.d.ts +6 -0
  51. package/index.d.ts +7 -0
  52. package/lib/captureErrorInSentry.d.ts +1 -0
  53. package/lib/compileCreateOrderPayload.d.ts +14 -0
  54. package/lib/createPriceFormatters.d.ts +12 -0
  55. package/lib/fetchFromDuffelAPI.d.ts +8 -0
  56. package/lib/fetchFromFixtures.d.ts +4 -0
  57. package/lib/formatAvailableServices.d.ts +12 -0
  58. package/lib/formatDate.d.ts +2 -0
  59. package/lib/formatSeatMaps.d.ts +4 -0
  60. package/lib/getBaggageServiceDescription.d.ts +2 -0
  61. package/lib/getCabinsForSegmentAndDeck.d.ts +2 -0
  62. package/lib/getCurrencyForSeatMaps.d.ts +10 -0
  63. package/lib/getCurrencyForServices.d.ts +11 -0
  64. package/lib/getFirstSeatElementMatchingCriteria.d.ts +3 -0
  65. package/lib/getPassengerBySegmentList.d.ts +6 -0
  66. package/lib/getPassengerInitials.d.ts +1 -0
  67. package/lib/getPassengerMapById.d.ts +3 -0
  68. package/lib/getPassengerName.d.ts +3 -0
  69. package/lib/getRowNumber.d.ts +2 -0
  70. package/lib/getSegmentList.d.ts +2 -0
  71. package/lib/getServicePriceMapById.d.ts +3 -0
  72. package/lib/getSymbols.d.ts +2 -0
  73. package/lib/getTotalAmountForServices.d.ts +6 -0
  74. package/lib/getTotalQuantity.d.ts +2 -0
  75. package/lib/hasHighLuminance.d.ts +1 -0
  76. package/lib/hasService.d.ts +2 -0
  77. package/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +3 -0
  78. package/lib/hasWings.d.ts +2 -0
  79. package/lib/isBaggageService.d.ts +2 -0
  80. package/lib/isCancelForAnyReasonService.d.ts +2 -0
  81. package/lib/isFixtureOfferId.d.ts +2 -0
  82. package/lib/isPayloadComplete.d.ts +2 -0
  83. package/lib/isSeatElement.d.ts +2 -0
  84. package/lib/logging.d.ts +46 -0
  85. package/lib/moneyStringFormatter.d.ts +8 -0
  86. package/lib/offerIsExpired.d.ts +2 -0
  87. package/lib/retrieveOffer.d.ts +2 -0
  88. package/lib/retrieveOfferFromDuffelAPI.d.ts +1 -0
  89. package/lib/retrieveSeatMaps.d.ts +2 -0
  90. package/lib/retrieveSeatMapsFromDuffelAPI.d.ts +1 -0
  91. package/lib/setBodyScrollability.d.ts +1 -0
  92. package/lib/validateProps.d.ts +7 -0
  93. package/lib/withPlural.d.ts +1 -0
  94. package/package.json +4 -4
  95. package/tsconfig.tsbuildinfo +1 -0
  96. package/types/Aircraft.d.ts +14 -0
  97. package/types/Airline.d.ts +14 -0
  98. package/types/Airport.d.ts +44 -0
  99. package/types/City.d.ts +18 -0
  100. package/types/CreateOrderPayload.d.ts +72 -0
  101. package/types/CurrencyConversion.d.ts +10 -0
  102. package/types/DuffelAncillariesProps.d.ts +70 -0
  103. package/types/Offer.d.ts +711 -0
  104. package/types/Order.d.ts +8 -0
  105. package/types/Place.d.ts +8 -0
  106. package/types/SeatMap.d.ts +190 -0
  107. package/types/index.d.ts +11 -0
  108. package/README.md +0 -68
  109. package/react-dist/index.d.ts +0 -2121
  110. /package/{react-dist/custom-elements.js → custom-elements.js} +0 -0
  111. /package/{react-dist/custom-elements.js.map → custom-elements.js.map} +0 -0
  112. /package/{react-dist/index.js → index.js} +0 -0
  113. /package/{react-dist/index.js.map → index.js.map} +0 -0
  114. /package/{react-dist/index.tsbuildinfo → index.tsbuildinfo} +0 -0
@@ -0,0 +1,8 @@
1
+ export type Order = {
2
+ id: string;
3
+ [any: string]: any;
4
+ slices: {
5
+ segments: any[];
6
+ }[];
7
+ };
8
+ export type OrderAvailableService = any;
@@ -0,0 +1,8 @@
1
+ import { Airport } from "./Airport";
2
+ import { City } from "./City";
3
+ export type Place = (Airport & {
4
+ type?: "airport";
5
+ airports?: Airport[] | null;
6
+ }) | (City & {
7
+ type?: "city";
8
+ });
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Seat maps are used to build a rich experience for your customers so they can select a seat as part of an order.
3
+ * A seat map includes the data for rendering seats in the relevant cabins, along with their total cost and other information such as disclosures.
4
+ * @link https://duffel.com/docs/api/seat-maps/schema
5
+ */
6
+ export interface SeatMap {
7
+ /**
8
+ * Duffel's unique identifier for the seat map
9
+ */
10
+ id: string;
11
+ /**
12
+ * Duffel's unique identifier for the slice. It identifies the slice of an offer (i.e. the same slice across offers will have different ids.)
13
+ */
14
+ slice_id: string;
15
+ /**
16
+ * Duffel's unique identifier for the segment. It identifies the segment of an offer (i.e. the same segment across offers will have different ids).
17
+ */
18
+ segment_id: string;
19
+ /**
20
+ * The list of cabins in this seat map.
21
+ * Cabins are ordered by deck from lowest to highest, and then within each deck from the front to back of the aircraft.
22
+ */
23
+ cabins: SeatMapCabin[];
24
+ }
25
+ export interface SeatMapCabin {
26
+ /**
27
+ * Level 0 is the main deck and level 1 is the upper deck above that, which is found on some large aircraft.
28
+ */
29
+ deck: number;
30
+ /**
31
+ * The cabin class that the passenger will travel in on this segment
32
+ */
33
+ cabin_class: string;
34
+ /**
35
+ * Where the wings of the aircraft are in relation to rows in the cabin.
36
+ * The numbers correspond to the indices of the first and the last row which are overwing. You can use this to draw a visual representation of the wings to help users get a better idea of what they will see outside their window.
37
+ * The indices are 0 th-based and are for all rows, not just those that have seats.
38
+ * This is null when no rows of the cabin are overwing.
39
+ */
40
+ wings: {
41
+ /**
42
+ * The index of the first row which is overwing, starting from the front of the aircraft.
43
+ */
44
+ first_row_index: number;
45
+ /**
46
+ * The index of the last row which is overwing, starting from the front of the aircraft.
47
+ */
48
+ last_row_index: number;
49
+ } | null;
50
+ /**
51
+ * The number of aisles in this cabin.
52
+ * If this is set to 1, each row of the cabin is split into two sections. If this is set to 2, each row of the cabin is split into three section.
53
+ */
54
+ aisles: number;
55
+ /**
56
+ * A list of rows in this cabin.
57
+ * Row sections are broken up by aisles. Rows are ordered from front to back of the aircraft.
58
+ */
59
+ rows: SeatMapCabinRow[];
60
+ }
61
+ export interface SeatMapCabinRow {
62
+ /**
63
+ * A list of sections.
64
+ * Each row is divided into sections by one or more aisles.
65
+ */
66
+ sections: SeatMapCabinRowSection[];
67
+ }
68
+ export interface SeatMapCabinRowSection {
69
+ /**
70
+ * The elements that make up this section.
71
+ */
72
+ elements: SeatMapCabinRowSectionElement[];
73
+ }
74
+ /**
75
+ * A seat for a passenger. If the available_services list is empty (which will be represented as an empty list : []), the seat is unavailable.
76
+ * For display, all seats should be displayed with the same static width.
77
+ */
78
+ export interface SeatMapCabinRowSectionElementSeat {
79
+ /**
80
+ * The type of this element.
81
+ */
82
+ type: "seat";
83
+ /**
84
+ * The designator used to uniquely identify the seat, usually made up of a row number and a column letter
85
+ */
86
+ designator: string;
87
+ /**
88
+ * A name which describes the type of seat, which you can display in your user interface to help customers to understand its features
89
+ */
90
+ name?: string;
91
+ /**
92
+ * Each disclosure is text, in English, provided by the airline that describes the terms and conditions of this seat. We recommend showing this in your user interface to make sure that customers understand any restrictions and limitations.
93
+ */
94
+ disclosures: string[];
95
+ /**
96
+ * Seats are considered a special kind of service. There will be at most one service per seat per passenger. A seat can only be booked for one passenger. If a seat has no available services (which will be represented as an empty list : []) then it's unavailable.
97
+ */
98
+ available_services: SeatMapCabinRowSectionAvailableService[];
99
+ }
100
+ export interface SeatMapCabinRowSectionAvailableService {
101
+ /**
102
+ * Duffel's unique identifier for the service
103
+ */
104
+ id: string;
105
+ /**
106
+ * The passenger that this seat is for
107
+ */
108
+ passenger_id: string;
109
+ /**
110
+ * The total price of the seat, including taxes
111
+ */
112
+ total_amount: string;
113
+ /**
114
+ * The currency of the total_amount, as an ISO 4217 currency code
115
+ */
116
+ total_currency: string;
117
+ }
118
+ /**
119
+ * A bassinet is a child's cradle. This element will be aligned with the corresponding seat in the following row.
120
+ * For display, this element should have the same width as a seat for proper alignment.
121
+ */
122
+ export interface SeatMapCabinRowSectionElementBassinet {
123
+ /**
124
+ * The type of this element.
125
+ */
126
+ type: "bassinet";
127
+ }
128
+ /**
129
+ * An empty space used for padding in some non-standard seat arrangements.
130
+ * For display, this element should have the same dimensions as a seat for proper alignment.
131
+ */
132
+ export interface SeatMapCabinRowSectionElementEmpty {
133
+ /**
134
+ * The type of this element.
135
+ */
136
+ type: "empty";
137
+ }
138
+ /**
139
+ * An exit row represents the extra wide legroom used to reach aircraft exits. There is one exit_row element per row section.
140
+ * Exit row elements only occur in their own row, so they can be displayed as one element across the whole row. Displaying an exit row element filling all available space in its section or using the same width as the seat is also reasonable.
141
+ */
142
+ export interface SeatMapCabinRowSectionElementExitRow {
143
+ /**
144
+ * The type of this element.
145
+ */
146
+ type: "exit_row";
147
+ }
148
+ /**
149
+ * A lavatory for use by passengers.
150
+ * For display, this element should ideally fill or shrink to available space in a row section. Displaying it with the same width as seat is also reasonable.
151
+ */
152
+ export interface SeatMapCabinRowSectionElementLavatory {
153
+ /**
154
+ * The type of this element.
155
+ */
156
+ type: "lavatory";
157
+ }
158
+ /**
159
+ * A galley is the compartment where food is cooked or prepared. These are conventionally marked with a teacup symbol.
160
+ * For display, this element should ideally fill or shrink to available space in a row section. Displaying it with the same width as seat is also reasonable.
161
+ */
162
+ export interface SeatMapCabinRowSectionElementGalley {
163
+ /**
164
+ * The type of this element.
165
+ */
166
+ type: "galley";
167
+ }
168
+ /**
169
+ * A closet used for storage. These are conventionally marked with a clothes hanger symbol.
170
+ * For display, this element should ideally fill or shrink to available space in a row section. Displaying it with the same width as seat is also reasonable.
171
+ */
172
+ export interface SeatMapCabinRowSectionElementCloset {
173
+ /**
174
+ * The type of this element.
175
+ */
176
+ type: "closet";
177
+ }
178
+ /**
179
+ * A set of stairs to another deck.
180
+ * For display, this element should ideally fill or shrink to available space in a row section. Displaying it with the same width as seat is also reasonable.
181
+ */
182
+ export interface SeatMapCabinRowSectionElementStairs {
183
+ /**
184
+ * The type of this element.
185
+ */
186
+ type: "stairs";
187
+ }
188
+ export type SeatMapCabinRowSectionElement = SeatMapCabinRowSectionElementSeat | SeatMapCabinRowSectionElementBassinet | SeatMapCabinRowSectionElementEmpty | SeatMapCabinRowSectionElementExitRow | SeatMapCabinRowSectionElementLavatory | SeatMapCabinRowSectionElementGalley | SeatMapCabinRowSectionElementCloset | SeatMapCabinRowSectionElementStairs;
189
+ export type SeatMapCabinRowSectionElementType = SeatMapCabinRowSectionElement["type"];
190
+ export type SeatMapCabinRowSectionElementAmenity = Exclude<SeatMapCabinRowSectionElementType, "empty" | "seat">;
@@ -0,0 +1,11 @@
1
+ export * from "./Aircraft";
2
+ export * from "./Airline";
3
+ export * from "./Airport";
4
+ export * from "./City";
5
+ export * from "./CreateOrderPayload";
6
+ export * from "./CurrencyConversion";
7
+ export * from "./DuffelAncillariesProps";
8
+ export * from "./Offer";
9
+ export * from "./Order";
10
+ export * from "./Place";
11
+ export * from "./SeatMap";
package/README.md DELETED
@@ -1,68 +0,0 @@
1
- # @duffel/components
2
-
3
- This package is a component library to help you build your travel product using the [Duffel API](https://duffel.com/docs).
4
-
5
- ## Get started
6
-
7
- ### Installing
8
-
9
- ```sh
10
- yarn add @duffel/components
11
- # -- or --
12
- npm i @duffel/components
13
- ```
14
-
15
- ### (alternative) Load from CDN:
16
-
17
- ```html
18
- <script src="https://assets.duffel.com/components/VERSION/duffel-ancillaries.js"></script>
19
- <script src="https://assets.duffel.com/components/VERSION/duffel-payments.js"></script>
20
- ```
21
-
22
- ## How do I integrate this into my website?
23
-
24
- 1. Please start by reading our integration guide on https://duffel.com/docs/guides/ancillaries-component
25
-
26
- ## Integration examples
27
-
28
- 1. **client-side** | This example loads a local version of the components using a `script` tag. It uses a fixture for the offer and seat maps.
29
-
30
- - [Find it on src/examples/client-side](src/examples/client-side)
31
-
32
- 2. **full-stack** | This example loads a local version of the components using a `script` tag. It will search and retrieve an offer from the Duffel API and render the ancillaries component custom element with its `offer_id` and `client_key`. As soon as a service modal is closed it will create a test order with the given payload.
33
-
34
- - [Find it on src/examples/full-stack](src/examples/full-stack)
35
-
36
- 3. **just-typescript** | This example imports a local version of `@duffel/components` and renders the custom element with an offer fixture once the page loads.
37
-
38
- - [Find it on src/examples/just-typescript](src/examples/just-typescript)
39
-
40
- 4. **react-app** | This example imports a local version of `@duffel/components` and renders the a react element with an offer fixture.
41
-
42
- - [Find it on src/examples/react-app](src/examples/react-app)
43
-
44
- 5. **payments-custom-element** | This example demonstrates the use of the payments component loaded through a script tag
45
-
46
- - [Find it on src/examples/payments-custom-element](src/examples/payments-custom-element)
47
-
48
- 6. **payments-just-typescript** | This example imports a local version of `@duffel/components` and renders the payments custom element with a fixture of the payment intent.
49
-
50
- - [Find it on src/examples/payments-just-typescript](src/examples/payments-just-typescript)
51
-
52
- 7. **next** | This example imports and renders `@duffel/components` into a `next.js` project.
53
-
54
- - [Find it on src/examples/payments-just-typescript](src/examples/next)
55
-
56
- ## What components are available?
57
-
58
- ### Ancillaries component
59
-
60
- The ancillaries component allows your customers to add ancillaries to their order. It's simple to add to your website and can be customised to fit your brand. This component is avaiable through npm and our cdn.
61
-
62
- - [Find live demo on codesandbox.io&nbsp;&nbsp;↗](https://codesandbox.io/s/duffel-ancillaries-example-1nxuu7)
63
-
64
- ### Payments component
65
-
66
- The payments component provides a [PCI-compliant](https://help.duffel.com/hc/en-gb/articles/4409049543058) way for you to collect card payments for online bookings from your customers. To learn more about how to work with Duffel payments please visit the [Collecting customer card payments guide](https://duffel.com/docs/guides/collecting-customer-card-payments).
67
-
68
- #### more coming soon...