@odynn/awayz-flights 0.10.16 → 0.10.19
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/dist/{FlightItinerary-BMRY5V0b.js → FlightItinerary-BAARVZkD.js} +1 -1
- package/dist/components/FlightItinerary/FlightItinerary.js +2 -2
- package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/hooks/useFlightSearch/useFlightSearch.js +412 -411
- package/dist/keys-C7jV6nZg.js +5 -0
- package/dist/lib/utils/flightUtils.d.ts +3 -2
- package/dist/main.js +1 -1
- package/dist/utils/flightUtils.js +88 -83
- package/package.json +1 -1
- package/dist/keys-BcBfU51M.js +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var T = /* @__PURE__ */ ((_) => (_.TOKEN = "token", _.REFRESH_TOKEN = "refreshToken", _.CLIENT_ID = "clientId", _.AUTH_FLOW = "authFlow", _.OVERRIDE_TOKEN_EXCHANGE_ENDPOINT = "overrideExchangeTokenEndpoint", _.OVERRIDE_PAC_ENDPOINT = "overridePACEndpoint", _))(T || {}), d = /* @__PURE__ */ ((_) => (_.ISO = "dates:iso", _.DISPLAY_SHORT = "dates:displayShort", _.DISPLAY_MEDIUM = "dates:displayMedium", _.DISPLAY_LONG = "dates:displayLong", _.DISPLAY_FULL = "dates:displayFull", _.DISPLAY_SHORT_WITH_YEAR = "dates:displayShortWithYear", _.DISPLAY_MEDIUM_WITH_YEAR = "dates:displayMediumWithYear", _.DISPLAY_LONG_WITH_YEAR = "dates:displayLongWithYear", _.DISPLAY_FULL_WITH_YEAR = "dates:displayFullWithYear", _.DATE_TIME_SHORT = "dates:dateTimeShort", _.DATE_TIME_MEDIUM = "dates:dateTimeMedium", _.DATE_TIME_LONG = "dates:dateTimeLong", _.DATE_TIME_FULL = "dates:dateTimeFull", _.DATE_TIME_SHORT_WITH_YEAR = "dates:dateTimeShortWithYear", _.DATE_TIME_MEDIUM_WITH_YEAR = "dates:dateTimeMediumWithYear", _.DATE_TIME_LONG_WITH_YEAR = "dates:dateTimeLongWithYear", _.DATE_TIME_FULL_WITH_YEAR = "dates:dateTimeFullWithYear", _.TIME_ONLY = "dates:timeOnly", _.TIME_WITH_SECONDS = "dates:timeWithSeconds", _))(d || {});
|
|
2
|
+
export {
|
|
3
|
+
d as E,
|
|
4
|
+
T as a
|
|
5
|
+
};
|
|
@@ -35,12 +35,13 @@ export declare const getOperatedBy: (segment: ISegment) => string;
|
|
|
35
35
|
* @param {EFlightPaymentType} params.paymentType - The type of payment (e.g., cash, points).
|
|
36
36
|
* @returns {string} The constructed flight search query URL.
|
|
37
37
|
*/
|
|
38
|
-
export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dates, cabinClass,
|
|
38
|
+
export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dates, cabinClass, adults, children, paymentType }: {
|
|
39
39
|
originCode: string;
|
|
40
40
|
destinationCode: string;
|
|
41
41
|
dates: string[];
|
|
42
42
|
cabinClass: ECabinClass;
|
|
43
|
-
|
|
43
|
+
adults: number;
|
|
44
|
+
children: number;
|
|
44
45
|
paymentType: string[];
|
|
45
46
|
}) => string;
|
|
46
47
|
/**
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFlightSearch as Y } from "./hooks/useFlightSearch/useFlightSearch.js";
|
|
2
2
|
import { useAirportSearch as p } from "./hooks/useAirportSearch/useAirportSearch.js";
|
|
3
3
|
import { EBaggage as l } from "./hooks/useFlightSearch/useFlightSearch.types.js";
|
|
4
|
-
import { F as h, g as f } from "./FlightItinerary-
|
|
4
|
+
import { F as h, g as f } from "./FlightItinerary-BAARVZkD.js";
|
|
5
5
|
import { FlightItineraryDropdown as S } from "./components/FlightItineraryDropdown/FlightItineraryDropdown.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "react";
|
|
@@ -3,46 +3,46 @@ import "react/jsx-runtime";
|
|
|
3
3
|
import { d as q } from "../dateUtils-Cb9VQiIL.js";
|
|
4
4
|
import "../arrayExtensions-Ce8YopTP.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { h as
|
|
6
|
+
import { h as y } from "../moment-BGjjqtLQ.js";
|
|
7
7
|
import { EFlightEndpoint as V } from "../constants/endpoints.js";
|
|
8
8
|
import { mapBaggageType as W } from "../hooks/useFlightSearch/useFlightSearch.types.js";
|
|
9
|
-
import { WalletService as
|
|
10
|
-
import { ERewardProgramCategories as
|
|
11
|
-
const
|
|
12
|
-
var l, n, c, a,
|
|
13
|
-
const
|
|
9
|
+
import { WalletService as f } from "../services/wallet/WalletService.js";
|
|
10
|
+
import { ERewardProgramCategories as J } from "../services/wallet/WalletService.types.js";
|
|
11
|
+
const X = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", ye = (s) => s == null ? void 0 : s.map((e) => {
|
|
12
|
+
var l, n, c, a, t, p, d, r, o, u, m, C, g, b, F, A, L, T, w, D, P, I, k, O, R, _, v, E, $, M, N, z, G, Z, S, U;
|
|
13
|
+
const i = ae(e);
|
|
14
14
|
return {
|
|
15
15
|
id: e.id,
|
|
16
16
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
17
17
|
partial: e == null ? void 0 : e.partial,
|
|
18
18
|
origin: {
|
|
19
19
|
city: ((l = e.slices[0].segments[0].origin) == null ? void 0 : l.cityName) || ((c = (n = e.slices[0].segments[0].origin) == null ? void 0 : n.city) == null ? void 0 : c.name) || "",
|
|
20
|
-
country: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.iataCountryCode) || ((
|
|
20
|
+
country: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.iataCountryCode) || ((p = (t = e.slices[0].segments[0].origin) == null ? void 0 : t.city) == null ? void 0 : p.iataCountryCode) || "",
|
|
21
21
|
airportCode: ((d = e.slices[0].segments[0].origin) == null ? void 0 : d.iataCode) || ((o = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : o.iataCode) || "",
|
|
22
22
|
coordinates: {
|
|
23
|
-
latitude: ((m = (
|
|
24
|
-
longitude: ((
|
|
23
|
+
latitude: ((m = (u = e.slices[0].segments[0].origin) == null ? void 0 : u.city) == null ? void 0 : m.latitude) || 0,
|
|
24
|
+
longitude: ((g = (C = e.slices[0].segments[0].origin) == null ? void 0 : C.city) == null ? void 0 : g.longitude) || 0
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
destination: {
|
|
28
|
-
city: ((F = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : F.cityName) || ((
|
|
29
|
-
country: ((D = (
|
|
28
|
+
city: ((F = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : F.cityName) || ((T = (L = (A = e.slices[0].segments.getLast()) == null ? void 0 : A.destination) == null ? void 0 : L.city) == null ? void 0 : T.name) || "",
|
|
29
|
+
country: ((D = (w = e.slices[0].segments.getLast()) == null ? void 0 : w.destination) == null ? void 0 : D.iataCountryCode) || ((k = (I = (P = e.slices[0].segments.getLast()) == null ? void 0 : P.destination) == null ? void 0 : I.city) == null ? void 0 : k.iataCountryCode) || "",
|
|
30
30
|
airportCode: ((R = (O = e.slices[0].segments.getLast()) == null ? void 0 : O.destination) == null ? void 0 : R.iataCode) || ((E = (v = (_ = e.slices[0].segments.getLast()) == null ? void 0 : _.destination) == null ? void 0 : v.city) == null ? void 0 : E.iataCode) || "",
|
|
31
31
|
coordinates: {
|
|
32
|
-
latitude: ((
|
|
32
|
+
latitude: ((N = (M = ($ = e.slices[0].segments.getLast()) == null ? void 0 : $.destination) == null ? void 0 : M.city) == null ? void 0 : N.latitude) || 0,
|
|
33
33
|
longitude: ((Z = (G = (z = e.slices[0].segments.getLast()) == null ? void 0 : z.destination) == null ? void 0 : G.city) == null ? void 0 : Z.longitude) || 0
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
// `airline` is an existing unqualified field; semantics are display-primary carrier.
|
|
37
|
-
airline: (
|
|
38
|
-
airlineLogo: h((
|
|
39
|
-
displayAirlineIataCode: (
|
|
37
|
+
airline: (i == null ? void 0 : i.name) ?? "",
|
|
38
|
+
airlineLogo: h((i == null ? void 0 : i.iataCode) ?? ""),
|
|
39
|
+
displayAirlineIataCode: (i == null ? void 0 : i.iataCode) ?? "",
|
|
40
40
|
cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
|
|
41
41
|
currency: e.baseCurrency,
|
|
42
42
|
flightNumber: ee(e.slices[0].segments[0]),
|
|
43
43
|
awayzGroupId: e.slices[0].comparisonKey || e.awayzRouteId || e.awayzGroupId || e.id,
|
|
44
|
-
departureTime:
|
|
45
|
-
arrivalTime:
|
|
44
|
+
departureTime: y(e.slices[0].segments[0].departingAt).toDate(),
|
|
45
|
+
arrivalTime: y(
|
|
46
46
|
e.slices[0].segments[e.slices[0].segments.length - 1].arrivingAt
|
|
47
47
|
).toDate(),
|
|
48
48
|
numberOfStops: e.slices[0].segments.length - 1,
|
|
@@ -51,8 +51,8 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
51
51
|
airlineProgram: e.airlineProgram,
|
|
52
52
|
paymentOptions: [],
|
|
53
53
|
durationMinutes: q({
|
|
54
|
-
departureTime:
|
|
55
|
-
arrivalTime:
|
|
54
|
+
departureTime: y(e.slices[0].segments[0].departingAt),
|
|
55
|
+
arrivalTime: y((S = e.slices[0].segments.getLast()) == null ? void 0 : S.arrivingAt),
|
|
56
56
|
originTimeZone: e.slices[0].segments[0].origin.timeZone,
|
|
57
57
|
destinationTimeZone: (U = e.slices[0].segments.getLast()) == null ? void 0 : U.destination.timeZone,
|
|
58
58
|
duration: e.slices[0].duration
|
|
@@ -65,11 +65,11 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
65
65
|
lastCachedTime: e.lastCachedTime
|
|
66
66
|
};
|
|
67
67
|
}), ee = (s) => {
|
|
68
|
-
const e = s.marketingCarrier ?? s.operatingCarrier,
|
|
69
|
-
return e.iataCode + " " + H(
|
|
68
|
+
const e = s.marketingCarrier ?? s.operatingCarrier, i = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
|
|
69
|
+
return e.iataCode + " " + H(i);
|
|
70
70
|
}, se = (s) => {
|
|
71
|
-
var
|
|
72
|
-
const e = (
|
|
71
|
+
var i;
|
|
72
|
+
const e = (i = s == null ? void 0 : s.segments) == null ? void 0 : i[0];
|
|
73
73
|
return (e == null ? void 0 : e.marketingCarrier) ?? (e == null ? void 0 : e.operatingCarrier);
|
|
74
74
|
}, ae = (s) => {
|
|
75
75
|
var e;
|
|
@@ -77,29 +77,34 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
77
77
|
}, he = (s) => !s.operatingCarrier || !s.marketingCarrier ? "" : s.operatingCarrier.iataCode !== s.marketingCarrier.iataCode ? s.operatingCarrier.name : "", be = ({
|
|
78
78
|
originCode: s,
|
|
79
79
|
destinationCode: e,
|
|
80
|
-
dates:
|
|
80
|
+
dates: i,
|
|
81
81
|
cabinClass: l,
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
adults: n,
|
|
83
|
+
children: c,
|
|
84
|
+
paymentType: a
|
|
84
85
|
}) => {
|
|
85
|
-
let
|
|
86
|
-
return
|
|
87
|
-
}, te = (s) => s.flightDetails.slices[0].segments.map((
|
|
88
|
-
const e = s.operatingCarrier ?? s.marketingCarrier,
|
|
89
|
-
return e.iataCode + " " + H(
|
|
86
|
+
let t = `${V.CASH_POINTS_FLIGHT_SEARCH}?`;
|
|
87
|
+
return t += `origin=${s}`, t += `&destination=${e}`, t += `&departure_dates=[${i.map((p) => `"${p}"`).join(",")}]`, t += `&cabin_class=${l}`, t += `&adults=${n}`, t += `&children=${c}`, t += `&cash_or_points=[${a}]`, t;
|
|
88
|
+
}, te = (s) => s.flightDetails.slices[0].segments.map((i) => ie(i)).join("_") + "_" + y(s.departureTime).format("YYYYMMDD"), ie = (s) => {
|
|
89
|
+
const e = s.operatingCarrier ?? s.marketingCarrier, i = s.operatingCarrierFlightNumber ?? s.marketingCarrierFlightNumber;
|
|
90
|
+
return e.iataCode + " " + H(i);
|
|
90
91
|
}, Fe = (s) => s ? s.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Ae = (s) => {
|
|
91
92
|
const e = {};
|
|
92
93
|
s.forEach((a) => {
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
if (e[
|
|
94
|
+
var p, d;
|
|
95
|
+
const t = te(a);
|
|
96
|
+
if (e[t]) {
|
|
96
97
|
const r = K(a);
|
|
97
|
-
e[
|
|
98
|
-
const { lowestCash: o, currency:
|
|
99
|
-
e[
|
|
98
|
+
e[t].flight.paymentOptions.push(r);
|
|
99
|
+
const { lowestCash: o, currency: u, lowestPoints: m, cashFee: C, cacheData: g } = j(e[t].flight.paymentOptions);
|
|
100
|
+
e[t].flight.points = m, e[t].flight.cashFee = C, e[t].flight.cash = o, u && (e[t].flight.currency = u), e[t].flight.isCached = g.isCached, e[t].flight.lastCachedTime = g.lastCachedTime, g.isCached && !e[t].flight.flightDetails.isCached && (e[t].flight.flightDetails = {
|
|
101
|
+
...e[t].flight.flightDetails,
|
|
102
|
+
isCached: g.isCached,
|
|
103
|
+
lastCachedTime: g.lastCachedTime
|
|
104
|
+
});
|
|
100
105
|
} else {
|
|
101
|
-
const { origin: r, destination: o } = a,
|
|
102
|
-
e[
|
|
106
|
+
const { origin: r, destination: o } = a, u = [K(a)], m = j(u);
|
|
107
|
+
e[t] = {
|
|
103
108
|
programs: [],
|
|
104
109
|
flight: {
|
|
105
110
|
id: a.awayzGroupId,
|
|
@@ -120,19 +125,19 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
120
125
|
airlineLogo: a.airlineLogo,
|
|
121
126
|
displayAirlineIataCode: a.displayAirlineIataCode,
|
|
122
127
|
flightNumber: a.flightNumber,
|
|
123
|
-
paymentOptions:
|
|
128
|
+
paymentOptions: u,
|
|
124
129
|
numberOfStops: a.numberOfStops,
|
|
125
130
|
departureTime: a.departureTime,
|
|
126
131
|
arrivalTime: a.arrivalTime,
|
|
127
|
-
awayzGroupId:
|
|
132
|
+
awayzGroupId: t,
|
|
128
133
|
duration: a.duration,
|
|
129
134
|
airlineProgram: a.airlineProgram,
|
|
130
135
|
durationMinutes: q({
|
|
131
|
-
departureTime:
|
|
136
|
+
departureTime: y(
|
|
132
137
|
a.flightDetails.slices[0].segments[0].departingAt
|
|
133
138
|
),
|
|
134
|
-
arrivalTime:
|
|
135
|
-
(
|
|
139
|
+
arrivalTime: y(
|
|
140
|
+
(p = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : p.arrivingAt
|
|
136
141
|
),
|
|
137
142
|
originTimeZone: a.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
138
143
|
destinationTimeZone: (d = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : d.destination.timeZone,
|
|
@@ -151,48 +156,48 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
151
156
|
}
|
|
152
157
|
};
|
|
153
158
|
}
|
|
154
|
-
a.airlineProgram && !e[
|
|
159
|
+
a.airlineProgram && !e[t].programs.includes(a.airlineProgram) && e[t].programs.push(a.airlineProgram);
|
|
155
160
|
});
|
|
156
|
-
const
|
|
161
|
+
const i = [];
|
|
157
162
|
Object.values(e).forEach((a) => {
|
|
158
|
-
const
|
|
163
|
+
const t = a.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
|
|
159
164
|
(r, o) => o.cash < r.cash ? o : r,
|
|
160
165
|
{ cash: 1 / 0, carrier: { name: "", iataCode: "" } }
|
|
161
|
-
),
|
|
166
|
+
), p = {
|
|
162
167
|
iataCode: a.flight.displayAirlineIataCode,
|
|
163
168
|
name: a.flight.airline
|
|
164
|
-
}, d =
|
|
169
|
+
}, d = t.cash !== 1 / 0 ? t.carrier : p;
|
|
165
170
|
a.programs.length > 0 ? a.programs.forEach((r) => {
|
|
166
171
|
const o = a.flight.paymentOptions.filter(
|
|
167
172
|
(m) => m.program === r && m.points > 0
|
|
168
|
-
),
|
|
169
|
-
|
|
173
|
+
), u = o.length > 0 ? Math.min(...o.map((m) => m.points)) : -1;
|
|
174
|
+
i.push({
|
|
170
175
|
...a.flight,
|
|
171
176
|
airline: d.name,
|
|
172
177
|
airlineLogo: h(d.iataCode),
|
|
173
178
|
displayAirlineIataCode: d.iataCode,
|
|
174
179
|
airlineProgram: r,
|
|
175
|
-
cash:
|
|
176
|
-
points:
|
|
180
|
+
cash: t.cash !== 1 / 0 ? t.cash : -1,
|
|
181
|
+
points: u
|
|
177
182
|
});
|
|
178
|
-
}) :
|
|
183
|
+
}) : i.push({
|
|
179
184
|
...a.flight,
|
|
180
185
|
airline: d.name,
|
|
181
186
|
airlineLogo: h(d.iataCode),
|
|
182
187
|
displayAirlineIataCode: d.iataCode,
|
|
183
|
-
cash:
|
|
188
|
+
cash: t.cash !== 1 / 0 ? t.cash : -1
|
|
184
189
|
});
|
|
185
190
|
});
|
|
186
|
-
const { cashlessResults: l, otherResults: n } =
|
|
187
|
-
(a,
|
|
191
|
+
const { cashlessResults: l, otherResults: n } = i.reduce(
|
|
192
|
+
(a, t) => (t.cash <= 0 && t.points > 0 ? a.cashlessResults.push(t) : t.cash > 0 && a.otherResults.push(t), a),
|
|
188
193
|
{ cashlessResults: [], otherResults: [] }
|
|
189
194
|
), c = [...n];
|
|
190
195
|
return l.forEach((a) => {
|
|
191
196
|
(!c.find(
|
|
192
|
-
(
|
|
197
|
+
(p) => p.awayzGroupId === a.awayzGroupId
|
|
193
198
|
) || n.length === 0) && c.push(a);
|
|
194
199
|
}), c;
|
|
195
|
-
}, H = (s) => s ? s.replace(/^0+/, "") : "", Le = (s) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${s}.svg`, h = (s) => `${
|
|
200
|
+
}, H = (s) => s ? s.replace(/^0+/, "") : "", Le = (s) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${s}.svg`, h = (s) => `${X}${s}.svg`, B = Y.logoFallbackImageUrl, x = {
|
|
196
201
|
categoryLogo: B,
|
|
197
202
|
programLogo: B,
|
|
198
203
|
awayzActive: [],
|
|
@@ -200,35 +205,35 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
200
205
|
displayProgram: "Unknown",
|
|
201
206
|
id: "Unknown",
|
|
202
207
|
totalAccumulatedPoints: 0,
|
|
203
|
-
category:
|
|
208
|
+
category: J.Airline,
|
|
204
209
|
colour: "#fff",
|
|
205
210
|
// Using App Foreground Colour
|
|
206
211
|
url: "https://www.odynn.com"
|
|
207
|
-
},
|
|
212
|
+
}, Te = async (s) => {
|
|
208
213
|
const { airlines: e } = await Q.ensureQueryData({
|
|
209
214
|
queryKey: ["walletAwards"],
|
|
210
|
-
queryFn:
|
|
215
|
+
queryFn: f.getAwards,
|
|
211
216
|
staleTime: 864e5
|
|
212
217
|
// 24 hours
|
|
213
218
|
});
|
|
214
|
-
let
|
|
219
|
+
let i = e.find(
|
|
215
220
|
(l) => {
|
|
216
|
-
var n, c, a,
|
|
217
|
-
return ((c = (n = l.mainProgram) == null ? void 0 : n.toLowerCase()) == null ? void 0 : c.includes(s == null ? void 0 : s.toLowerCase())) || ((
|
|
221
|
+
var n, c, a, t;
|
|
222
|
+
return ((c = (n = l.mainProgram) == null ? void 0 : n.toLowerCase()) == null ? void 0 : c.includes(s == null ? void 0 : s.toLowerCase())) || ((t = (a = l.displayProgram) == null ? void 0 : a.toLowerCase()) == null ? void 0 : t.includes(s == null ? void 0 : s.toLowerCase()));
|
|
218
223
|
}
|
|
219
224
|
) ?? x;
|
|
220
|
-
return
|
|
225
|
+
return i || (i = {
|
|
221
226
|
...x,
|
|
222
227
|
mainProgram: s,
|
|
223
228
|
displayProgram: s,
|
|
224
229
|
id: s
|
|
225
|
-
}),
|
|
230
|
+
}), i;
|
|
226
231
|
}, K = (s) => {
|
|
227
|
-
var n, c, a,
|
|
228
|
-
const e = ((a = (c = (n = s.flightDetails.slices.getFirst()) == null ? void 0 : n.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : a.baggages) ?? [],
|
|
229
|
-
(
|
|
230
|
-
type: W(
|
|
231
|
-
quantity:
|
|
232
|
+
var n, c, a, t, p, d, r, o, u, m;
|
|
233
|
+
const e = ((a = (c = (n = s.flightDetails.slices.getFirst()) == null ? void 0 : n.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : a.baggages) ?? [], i = ((d = (p = (t = s.flightDetails.slices.getFirst()) == null ? void 0 : t.segments.getFirst()) == null ? void 0 : p.passengers.getFirst()) == null ? void 0 : d.cabinClassMarketingName) ?? ((u = (o = (r = s.flightDetails.slices.getFirst()) == null ? void 0 : r.segments.getFirst()) == null ? void 0 : o.passengers.getFirst()) == null ? void 0 : u.cabinClass), l = e.map(
|
|
234
|
+
(C) => ({
|
|
235
|
+
type: W(C.type),
|
|
236
|
+
quantity: C.quantity
|
|
232
237
|
})
|
|
233
238
|
);
|
|
234
239
|
return {
|
|
@@ -238,7 +243,7 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
238
243
|
program: s.airlineProgram,
|
|
239
244
|
baseCurrency: s.flightDetails.baseCurrency,
|
|
240
245
|
fareBrandName: ((m = s.flightDetails.slices.getFirst()) == null ? void 0 : m.fareBrandName) ?? "",
|
|
241
|
-
cabinClass:
|
|
246
|
+
cabinClass: i,
|
|
242
247
|
cashFee: s.cashFee,
|
|
243
248
|
conditions: s.flightDetails.conditions,
|
|
244
249
|
baggages: l,
|
|
@@ -252,9 +257,9 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
252
257
|
};
|
|
253
258
|
}, j = (s) => {
|
|
254
259
|
const e = s.filter((a) => a.cash > 0);
|
|
255
|
-
let
|
|
260
|
+
let i = { cash: 1 / 0, baseCurrency: "" };
|
|
256
261
|
for (const a of e)
|
|
257
|
-
a.cash <
|
|
262
|
+
a.cash < i.cash && (i = a);
|
|
258
263
|
const l = [...s].filter(
|
|
259
264
|
(a) => a.points > 0
|
|
260
265
|
);
|
|
@@ -266,12 +271,12 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
266
271
|
};
|
|
267
272
|
for (const a of l)
|
|
268
273
|
a.points < n.points && (n = a);
|
|
269
|
-
const c =
|
|
274
|
+
const c = i.cash;
|
|
270
275
|
return {
|
|
271
276
|
lowestCash: c === 1 / 0 ? -1 : c,
|
|
272
277
|
lowestPoints: n.points === 1 / 0 ? -1 : n.points,
|
|
273
278
|
cashFee: n.cashFee,
|
|
274
|
-
currency:
|
|
279
|
+
currency: i.baseCurrency === "" ? null : i.baseCurrency,
|
|
275
280
|
cacheData: {
|
|
276
281
|
isCached: n.isCached ?? !1,
|
|
277
282
|
lastCachedTime: n.lastCachedTime ?? ""
|
|
@@ -286,13 +291,13 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
286
291
|
type: "child"
|
|
287
292
|
/* CHILD */
|
|
288
293
|
}))
|
|
289
|
-
],
|
|
290
|
-
const
|
|
294
|
+
], we = (s) => {
|
|
295
|
+
const i = {
|
|
291
296
|
adults: (s == null ? void 0 : s.adults) ?? 1,
|
|
292
297
|
children: (s == null ? void 0 : s.children) ?? 0
|
|
293
|
-
}, l = ne(
|
|
298
|
+
}, l = ne(i);
|
|
294
299
|
return {
|
|
295
|
-
passengerCount:
|
|
300
|
+
passengerCount: i.adults + i.children,
|
|
296
301
|
passengerList: l
|
|
297
302
|
};
|
|
298
303
|
};
|
|
@@ -301,7 +306,7 @@ export {
|
|
|
301
306
|
be as buildFlightSearchQuery,
|
|
302
307
|
ne as buildPassengerArray,
|
|
303
308
|
Fe as formatCabinClass,
|
|
304
|
-
|
|
309
|
+
Te as getAirlineProgram,
|
|
305
310
|
ee as getFlightNumber,
|
|
306
311
|
h as getFullLogoPath,
|
|
307
312
|
Le as getLogoPath,
|
|
@@ -310,6 +315,6 @@ export {
|
|
|
310
315
|
se as getPrimaryDisplayCarrierForSlice,
|
|
311
316
|
Ae as groupFlightResults,
|
|
312
317
|
ye as mapDataToFlightDetails,
|
|
313
|
-
|
|
318
|
+
we as passengerValues,
|
|
314
319
|
H as removeLeadingZeros
|
|
315
320
|
};
|
package/package.json
CHANGED
package/dist/keys-BcBfU51M.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var T = /* @__PURE__ */ ((_) => (_.TOKEN = "token", _.REFRESH_TOKEN = "refreshToken", _.CLIENT_ID = "clientId", _.AUTH_FLOW = "authFlow", _.OVERRIDE_TOKEN_EXCHANGE_ENDPOINT = "overrideExchangeTokenEndpoint", _))(T || {}), d = /* @__PURE__ */ ((_) => (_.ISO = "dates:iso", _.DISPLAY_SHORT = "dates:displayShort", _.DISPLAY_MEDIUM = "dates:displayMedium", _.DISPLAY_LONG = "dates:displayLong", _.DISPLAY_FULL = "dates:displayFull", _.DISPLAY_SHORT_WITH_YEAR = "dates:displayShortWithYear", _.DISPLAY_MEDIUM_WITH_YEAR = "dates:displayMediumWithYear", _.DISPLAY_LONG_WITH_YEAR = "dates:displayLongWithYear", _.DISPLAY_FULL_WITH_YEAR = "dates:displayFullWithYear", _.DATE_TIME_SHORT = "dates:dateTimeShort", _.DATE_TIME_MEDIUM = "dates:dateTimeMedium", _.DATE_TIME_LONG = "dates:dateTimeLong", _.DATE_TIME_FULL = "dates:dateTimeFull", _.DATE_TIME_SHORT_WITH_YEAR = "dates:dateTimeShortWithYear", _.DATE_TIME_MEDIUM_WITH_YEAR = "dates:dateTimeMediumWithYear", _.DATE_TIME_LONG_WITH_YEAR = "dates:dateTimeLongWithYear", _.DATE_TIME_FULL_WITH_YEAR = "dates:dateTimeFullWithYear", _.TIME_ONLY = "dates:timeOnly", _.TIME_WITH_SECONDS = "dates:timeWithSeconds", _))(d || {});
|
|
2
|
-
export {
|
|
3
|
-
d as E,
|
|
4
|
-
T as a
|
|
5
|
-
};
|