@odynn/awayz-flights 0.10.19 → 0.10.21
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.
|
@@ -4,7 +4,8 @@ import { IAirlineProgram } from '../services/wallet/WalletService.types';
|
|
|
4
4
|
import { ECabinClass } from '../types/ECabinClass';
|
|
5
5
|
declare enum EPassengerType {
|
|
6
6
|
ADULT = "adult",
|
|
7
|
-
CHILD = "child"
|
|
7
|
+
CHILD = "child",
|
|
8
|
+
INFANT = "infant"
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* @description - maps flight details into the flight result format, which is the expected format for Flight Components throughout the Awayz Application
|
|
@@ -35,13 +36,14 @@ export declare const getOperatedBy: (segment: ISegment) => string;
|
|
|
35
36
|
* @param {EFlightPaymentType} params.paymentType - The type of payment (e.g., cash, points).
|
|
36
37
|
* @returns {string} The constructed flight search query URL.
|
|
37
38
|
*/
|
|
38
|
-
export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dates, cabinClass, adults, children, paymentType }: {
|
|
39
|
+
export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dates, cabinClass, adults, children, infants, paymentType }: {
|
|
39
40
|
originCode: string;
|
|
40
41
|
destinationCode: string;
|
|
41
42
|
dates: string[];
|
|
42
43
|
cabinClass: ECabinClass;
|
|
43
44
|
adults: number;
|
|
44
45
|
children: number;
|
|
46
|
+
infants: number;
|
|
45
47
|
paymentType: string[];
|
|
46
48
|
}) => string;
|
|
47
49
|
/**
|
|
@@ -96,12 +98,14 @@ export declare const getAirlineProgram: (airlineProgramName: string) => Promise<
|
|
|
96
98
|
export declare const buildPassengerArray: (config: {
|
|
97
99
|
adults: number;
|
|
98
100
|
children: number;
|
|
101
|
+
infants: number;
|
|
99
102
|
}) => {
|
|
100
103
|
type: EPassengerType;
|
|
101
104
|
}[];
|
|
102
105
|
interface IPassengers {
|
|
103
106
|
adults: number;
|
|
104
107
|
children: number;
|
|
108
|
+
infants: number;
|
|
105
109
|
}
|
|
106
110
|
export declare const passengerValues: (passengers?: IPassengers) => {
|
|
107
111
|
passengerCount: number;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defaultAwayzConfig as
|
|
1
|
+
import { defaultAwayzConfig as H, awayzClient as Y } from "@odynn/awayz-core";
|
|
2
2
|
import "react/jsx-runtime";
|
|
3
|
-
import { d as
|
|
3
|
+
import { d as j } from "../dateUtils-Cb9VQiIL.js";
|
|
4
4
|
import "../arrayExtensions-Ce8YopTP.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { h as y } from "../moment-BGjjqtLQ.js";
|
|
7
|
-
import { EFlightEndpoint as
|
|
8
|
-
import { mapBaggageType as
|
|
9
|
-
import { WalletService as
|
|
7
|
+
import { EFlightEndpoint as Q } from "../constants/endpoints.js";
|
|
8
|
+
import { mapBaggageType as V } from "../hooks/useFlightSearch/useFlightSearch.types.js";
|
|
9
|
+
import { WalletService as W } from "../services/wallet/WalletService.js";
|
|
10
10
|
import { ERewardProgramCategories as J } from "../services/wallet/WalletService.types.js";
|
|
11
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
|
|
13
|
-
const
|
|
12
|
+
var m, r, l, a, i, n, d, o, c, p, u, g, C, b, F, A, L, T, w, D, P, I, k, O, R, _, v, E, $, M, N, z, G, Z, S, U;
|
|
13
|
+
const t = 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
|
-
city: ((
|
|
20
|
-
country: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.iataCountryCode) || ((
|
|
21
|
-
airportCode: ((d = e.slices[0].segments[0].origin) == null ? void 0 : d.iataCode) || ((
|
|
19
|
+
city: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.cityName) || ((l = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : l.name) || "",
|
|
20
|
+
country: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.iataCountryCode) || ((n = (i = e.slices[0].segments[0].origin) == null ? void 0 : i.city) == null ? void 0 : n.iataCountryCode) || "",
|
|
21
|
+
airportCode: ((d = e.slices[0].segments[0].origin) == null ? void 0 : d.iataCode) || ((c = (o = e.slices[0].segments[0].origin) == null ? void 0 : o.city) == null ? void 0 : c.iataCode) || "",
|
|
22
22
|
coordinates: {
|
|
23
|
-
latitude: ((
|
|
24
|
-
longitude: ((
|
|
23
|
+
latitude: ((u = (p = e.slices[0].segments[0].origin) == null ? void 0 : p.city) == null ? void 0 : u.latitude) || 0,
|
|
24
|
+
longitude: ((C = (g = e.slices[0].segments[0].origin) == null ? void 0 : g.city) == null ? void 0 : C.longitude) || 0
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
destination: {
|
|
@@ -34,9 +34,9 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
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: (t == null ? void 0 : t.name) ?? "",
|
|
38
|
+
airlineLogo: h((t == null ? void 0 : t.iataCode) ?? ""),
|
|
39
|
+
displayAirlineIataCode: (t == null ? void 0 : t.iataCode) ?? "",
|
|
40
40
|
cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
|
|
41
41
|
currency: e.baseCurrency,
|
|
42
42
|
flightNumber: ee(e.slices[0].segments[0]),
|
|
@@ -50,7 +50,7 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
50
50
|
duration: e.slices[0].duration,
|
|
51
51
|
airlineProgram: e.airlineProgram,
|
|
52
52
|
paymentOptions: [],
|
|
53
|
-
durationMinutes:
|
|
53
|
+
durationMinutes: j({
|
|
54
54
|
departureTime: y(e.slices[0].segments[0].departingAt),
|
|
55
55
|
arrivalTime: y((S = e.slices[0].segments.getLast()) == null ? void 0 : S.arrivingAt),
|
|
56
56
|
originTimeZone: e.slices[0].segments[0].origin.timeZone,
|
|
@@ -65,11 +65,11 @@ const X = "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 + " " +
|
|
68
|
+
const e = s.marketingCarrier ?? s.operatingCarrier, t = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
|
|
69
|
+
return e.iataCode + " " + q(t);
|
|
70
70
|
}, se = (s) => {
|
|
71
|
-
var
|
|
72
|
-
const e = (
|
|
71
|
+
var t;
|
|
72
|
+
const e = (t = s == null ? void 0 : s.segments) == null ? void 0 : t[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,74 +77,75 @@ const X = "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:
|
|
81
|
-
cabinClass:
|
|
82
|
-
adults:
|
|
83
|
-
children:
|
|
84
|
-
|
|
80
|
+
dates: t,
|
|
81
|
+
cabinClass: m,
|
|
82
|
+
adults: r,
|
|
83
|
+
children: l,
|
|
84
|
+
infants: a,
|
|
85
|
+
paymentType: i
|
|
85
86
|
}) => {
|
|
86
|
-
let
|
|
87
|
-
return
|
|
88
|
-
}, te = (s) => s.flightDetails.slices[0].segments.map((
|
|
89
|
-
const e = s.operatingCarrier ?? s.marketingCarrier,
|
|
90
|
-
return e.iataCode + " " +
|
|
87
|
+
let n = `${Q.CASH_POINTS_FLIGHT_SEARCH}?`;
|
|
88
|
+
return n += `origin=${s}`, n += `&destination=${e}`, n += `&departure_dates=[${t.map((d) => `"${d}"`).join(",")}]`, n += `&cabin_class=${m}`, n += `&adults=${r}`, n += `&children=${l}`, n += `&infants=${a}`, n += `&cash_or_points=[${i}]`, n;
|
|
89
|
+
}, te = (s) => s.flightDetails.slices[0].segments.map((t) => ie(t)).join("_") + "_" + y(s.departureTime).format("YYYYMMDD"), ie = (s) => {
|
|
90
|
+
const e = s.operatingCarrier ?? s.marketingCarrier, t = s.operatingCarrierFlightNumber ?? s.marketingCarrierFlightNumber;
|
|
91
|
+
return e.iataCode + " " + q(t);
|
|
91
92
|
}, Fe = (s) => s ? s.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Ae = (s) => {
|
|
92
93
|
const e = {};
|
|
93
94
|
s.forEach((a) => {
|
|
94
|
-
var
|
|
95
|
-
const
|
|
96
|
-
if (e[
|
|
97
|
-
const
|
|
98
|
-
e[
|
|
99
|
-
const { lowestCash:
|
|
100
|
-
e[
|
|
101
|
-
...e[
|
|
102
|
-
isCached:
|
|
103
|
-
lastCachedTime:
|
|
95
|
+
var n, d;
|
|
96
|
+
const i = te(a);
|
|
97
|
+
if (e[i]) {
|
|
98
|
+
const o = x(a);
|
|
99
|
+
e[i].flight.paymentOptions.push(o);
|
|
100
|
+
const { lowestCash: c, currency: p, lowestPoints: u, cashFee: g, cacheData: C } = K(e[i].flight.paymentOptions);
|
|
101
|
+
e[i].flight.points = u, e[i].flight.cashFee = g, e[i].flight.cash = c, p && (e[i].flight.currency = p), e[i].flight.isCached = C.isCached, e[i].flight.lastCachedTime = C.lastCachedTime, C.isCached && !e[i].flight.flightDetails.isCached && (e[i].flight.flightDetails = {
|
|
102
|
+
...e[i].flight.flightDetails,
|
|
103
|
+
isCached: C.isCached,
|
|
104
|
+
lastCachedTime: C.lastCachedTime
|
|
104
105
|
});
|
|
105
106
|
} else {
|
|
106
|
-
const { origin:
|
|
107
|
-
e[
|
|
107
|
+
const { origin: o, destination: c } = a, p = [x(a)], u = K(p);
|
|
108
|
+
e[i] = {
|
|
108
109
|
programs: [],
|
|
109
110
|
flight: {
|
|
110
111
|
id: a.awayzGroupId,
|
|
111
112
|
partial: a.partial,
|
|
112
113
|
origin: {
|
|
113
|
-
city: r.city,
|
|
114
|
-
country: r.country,
|
|
115
|
-
airportCode: r.airportCode,
|
|
116
|
-
coordinates: r.coordinates
|
|
117
|
-
},
|
|
118
|
-
destination: {
|
|
119
114
|
city: o.city,
|
|
120
115
|
country: o.country,
|
|
121
116
|
airportCode: o.airportCode,
|
|
122
117
|
coordinates: o.coordinates
|
|
123
118
|
},
|
|
119
|
+
destination: {
|
|
120
|
+
city: c.city,
|
|
121
|
+
country: c.country,
|
|
122
|
+
airportCode: c.airportCode,
|
|
123
|
+
coordinates: c.coordinates
|
|
124
|
+
},
|
|
124
125
|
airline: a.airline,
|
|
125
126
|
airlineLogo: a.airlineLogo,
|
|
126
127
|
displayAirlineIataCode: a.displayAirlineIataCode,
|
|
127
128
|
flightNumber: a.flightNumber,
|
|
128
|
-
paymentOptions:
|
|
129
|
+
paymentOptions: p,
|
|
129
130
|
numberOfStops: a.numberOfStops,
|
|
130
131
|
departureTime: a.departureTime,
|
|
131
132
|
arrivalTime: a.arrivalTime,
|
|
132
|
-
awayzGroupId:
|
|
133
|
+
awayzGroupId: i,
|
|
133
134
|
duration: a.duration,
|
|
134
135
|
airlineProgram: a.airlineProgram,
|
|
135
|
-
durationMinutes:
|
|
136
|
+
durationMinutes: j({
|
|
136
137
|
departureTime: y(
|
|
137
138
|
a.flightDetails.slices[0].segments[0].departingAt
|
|
138
139
|
),
|
|
139
140
|
arrivalTime: y(
|
|
140
|
-
(
|
|
141
|
+
(n = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : n.arrivingAt
|
|
141
142
|
),
|
|
142
143
|
originTimeZone: a.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
143
144
|
destinationTimeZone: (d = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : d.destination.timeZone,
|
|
144
145
|
duration: a.flightDetails.slices[0].duration
|
|
145
146
|
}),
|
|
146
|
-
cash:
|
|
147
|
-
points:
|
|
147
|
+
cash: u.lowestCash,
|
|
148
|
+
points: u.lowestPoints,
|
|
148
149
|
flightDetails: a.flightDetails,
|
|
149
150
|
currency: a.flightDetails.baseCurrency,
|
|
150
151
|
cashFee: a.cashFee,
|
|
@@ -156,50 +157,50 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
156
157
|
}
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
a.airlineProgram && !e[
|
|
160
|
+
a.airlineProgram && !e[i].programs.includes(a.airlineProgram) && e[i].programs.push(a.airlineProgram);
|
|
160
161
|
});
|
|
161
|
-
const
|
|
162
|
+
const t = [];
|
|
162
163
|
Object.values(e).forEach((a) => {
|
|
163
|
-
const
|
|
164
|
-
(
|
|
164
|
+
const i = a.flight.paymentOptions.filter((o) => o.cash > 0).reduce(
|
|
165
|
+
(o, c) => c.cash < o.cash ? c : o,
|
|
165
166
|
{ cash: 1 / 0, carrier: { name: "", iataCode: "" } }
|
|
166
|
-
),
|
|
167
|
+
), n = {
|
|
167
168
|
iataCode: a.flight.displayAirlineIataCode,
|
|
168
169
|
name: a.flight.airline
|
|
169
|
-
}, d =
|
|
170
|
-
a.programs.length > 0 ? a.programs.forEach((
|
|
171
|
-
const
|
|
172
|
-
(
|
|
173
|
-
),
|
|
174
|
-
|
|
170
|
+
}, d = i.cash !== 1 / 0 ? i.carrier : n;
|
|
171
|
+
a.programs.length > 0 ? a.programs.forEach((o) => {
|
|
172
|
+
const c = a.flight.paymentOptions.filter(
|
|
173
|
+
(u) => u.program === o && u.points > 0
|
|
174
|
+
), p = c.length > 0 ? Math.min(...c.map((u) => u.points)) : -1;
|
|
175
|
+
t.push({
|
|
175
176
|
...a.flight,
|
|
176
177
|
airline: d.name,
|
|
177
178
|
airlineLogo: h(d.iataCode),
|
|
178
179
|
displayAirlineIataCode: d.iataCode,
|
|
179
|
-
airlineProgram:
|
|
180
|
-
cash:
|
|
181
|
-
points:
|
|
180
|
+
airlineProgram: o,
|
|
181
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1,
|
|
182
|
+
points: p
|
|
182
183
|
});
|
|
183
|
-
}) :
|
|
184
|
+
}) : t.push({
|
|
184
185
|
...a.flight,
|
|
185
186
|
airline: d.name,
|
|
186
187
|
airlineLogo: h(d.iataCode),
|
|
187
188
|
displayAirlineIataCode: d.iataCode,
|
|
188
|
-
cash:
|
|
189
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1
|
|
189
190
|
});
|
|
190
191
|
});
|
|
191
|
-
const { cashlessResults:
|
|
192
|
-
(a,
|
|
192
|
+
const { cashlessResults: m, otherResults: r } = t.reduce(
|
|
193
|
+
(a, i) => (i.cash <= 0 && i.points > 0 ? a.cashlessResults.push(i) : i.cash > 0 && a.otherResults.push(i), a),
|
|
193
194
|
{ cashlessResults: [], otherResults: [] }
|
|
194
|
-
),
|
|
195
|
-
return
|
|
196
|
-
(!
|
|
197
|
-
(
|
|
198
|
-
) ||
|
|
199
|
-
}),
|
|
200
|
-
},
|
|
201
|
-
categoryLogo:
|
|
202
|
-
programLogo:
|
|
195
|
+
), l = [...r];
|
|
196
|
+
return m.forEach((a) => {
|
|
197
|
+
(!l.find(
|
|
198
|
+
(n) => n.awayzGroupId === a.awayzGroupId
|
|
199
|
+
) || r.length === 0) && l.push(a);
|
|
200
|
+
}), l;
|
|
201
|
+
}, q = (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`, f = H.logoFallbackImageUrl, B = {
|
|
202
|
+
categoryLogo: f,
|
|
203
|
+
programLogo: f,
|
|
203
204
|
awayzActive: [],
|
|
204
205
|
mainProgram: "Unknown",
|
|
205
206
|
displayProgram: "Unknown",
|
|
@@ -210,30 +211,30 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
210
211
|
// Using App Foreground Colour
|
|
211
212
|
url: "https://www.odynn.com"
|
|
212
213
|
}, Te = async (s) => {
|
|
213
|
-
const { airlines: e } = await
|
|
214
|
+
const { airlines: e } = await Y.ensureQueryData({
|
|
214
215
|
queryKey: ["walletAwards"],
|
|
215
|
-
queryFn:
|
|
216
|
+
queryFn: W.getAwards,
|
|
216
217
|
staleTime: 864e5
|
|
217
218
|
// 24 hours
|
|
218
219
|
});
|
|
219
|
-
let
|
|
220
|
-
(
|
|
221
|
-
var
|
|
222
|
-
return ((
|
|
220
|
+
let t = e.find(
|
|
221
|
+
(m) => {
|
|
222
|
+
var r, l, a, i;
|
|
223
|
+
return ((l = (r = m.mainProgram) == null ? void 0 : r.toLowerCase()) == null ? void 0 : l.includes(s == null ? void 0 : s.toLowerCase())) || ((i = (a = m.displayProgram) == null ? void 0 : a.toLowerCase()) == null ? void 0 : i.includes(s == null ? void 0 : s.toLowerCase()));
|
|
223
224
|
}
|
|
224
|
-
) ??
|
|
225
|
-
return
|
|
226
|
-
...
|
|
225
|
+
) ?? B;
|
|
226
|
+
return t || (t = {
|
|
227
|
+
...B,
|
|
227
228
|
mainProgram: s,
|
|
228
229
|
displayProgram: s,
|
|
229
230
|
id: s
|
|
230
|
-
}),
|
|
231
|
-
},
|
|
232
|
-
var
|
|
233
|
-
const e = ((a = (
|
|
234
|
-
(
|
|
235
|
-
type:
|
|
236
|
-
quantity:
|
|
231
|
+
}), t;
|
|
232
|
+
}, x = (s) => {
|
|
233
|
+
var r, l, a, i, n, d, o, c, p, u;
|
|
234
|
+
const e = ((a = (l = (r = s.flightDetails.slices.getFirst()) == null ? void 0 : r.segments.getFirst()) == null ? void 0 : l.passengers.getFirst()) == null ? void 0 : a.baggages) ?? [], t = ((d = (n = (i = s.flightDetails.slices.getFirst()) == null ? void 0 : i.segments.getFirst()) == null ? void 0 : n.passengers.getFirst()) == null ? void 0 : d.cabinClassMarketingName) ?? ((p = (c = (o = s.flightDetails.slices.getFirst()) == null ? void 0 : o.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : p.cabinClass), m = e.map(
|
|
235
|
+
(g) => ({
|
|
236
|
+
type: V(g.type),
|
|
237
|
+
quantity: g.quantity
|
|
237
238
|
})
|
|
238
239
|
);
|
|
239
240
|
return {
|
|
@@ -242,11 +243,11 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
242
243
|
points: s.points,
|
|
243
244
|
program: s.airlineProgram,
|
|
244
245
|
baseCurrency: s.flightDetails.baseCurrency,
|
|
245
|
-
fareBrandName: ((
|
|
246
|
-
cabinClass:
|
|
246
|
+
fareBrandName: ((u = s.flightDetails.slices.getFirst()) == null ? void 0 : u.fareBrandName) ?? "",
|
|
247
|
+
cabinClass: t,
|
|
247
248
|
cashFee: s.cashFee,
|
|
248
249
|
conditions: s.flightDetails.conditions,
|
|
249
|
-
baggages:
|
|
250
|
+
baggages: m,
|
|
250
251
|
// `carrier` is an existing unqualified field; semantics are marketing carrier.
|
|
251
252
|
carrier: {
|
|
252
253
|
iataCode: s.displayAirlineIataCode,
|
|
@@ -255,31 +256,31 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
255
256
|
isCached: s.isCached,
|
|
256
257
|
lastCachedTime: s.lastCachedTime
|
|
257
258
|
};
|
|
258
|
-
},
|
|
259
|
+
}, K = (s) => {
|
|
259
260
|
const e = s.filter((a) => a.cash > 0);
|
|
260
|
-
let
|
|
261
|
+
let t = { cash: 1 / 0, baseCurrency: "" };
|
|
261
262
|
for (const a of e)
|
|
262
|
-
a.cash <
|
|
263
|
-
const
|
|
263
|
+
a.cash < t.cash && (t = a);
|
|
264
|
+
const m = [...s].filter(
|
|
264
265
|
(a) => a.points > 0
|
|
265
266
|
);
|
|
266
|
-
let
|
|
267
|
+
let r = {
|
|
267
268
|
points: 1 / 0,
|
|
268
269
|
cashFee: { amount: 0, currency: "" },
|
|
269
270
|
isCached: !1,
|
|
270
271
|
lastCachedTime: ""
|
|
271
272
|
};
|
|
272
|
-
for (const a of
|
|
273
|
-
a.points <
|
|
274
|
-
const
|
|
273
|
+
for (const a of m)
|
|
274
|
+
a.points < r.points && (r = a);
|
|
275
|
+
const l = t.cash;
|
|
275
276
|
return {
|
|
276
|
-
lowestCash:
|
|
277
|
-
lowestPoints:
|
|
278
|
-
cashFee:
|
|
279
|
-
currency:
|
|
277
|
+
lowestCash: l === 1 / 0 ? -1 : l,
|
|
278
|
+
lowestPoints: r.points === 1 / 0 ? -1 : r.points,
|
|
279
|
+
cashFee: r.cashFee,
|
|
280
|
+
currency: t.baseCurrency === "" ? null : t.baseCurrency,
|
|
280
281
|
cacheData: {
|
|
281
|
-
isCached:
|
|
282
|
-
lastCachedTime:
|
|
282
|
+
isCached: r.isCached ?? !1,
|
|
283
|
+
lastCachedTime: r.lastCachedTime ?? ""
|
|
283
284
|
}
|
|
284
285
|
};
|
|
285
286
|
}, ne = (s) => [
|
|
@@ -290,19 +291,24 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
290
291
|
...Array.from({ length: s.children }, () => ({
|
|
291
292
|
type: "child"
|
|
292
293
|
/* CHILD */
|
|
294
|
+
})),
|
|
295
|
+
...Array.from({ length: s.infants }, () => ({
|
|
296
|
+
type: "infant"
|
|
297
|
+
/* INFANT */
|
|
293
298
|
}))
|
|
294
299
|
], we = (s) => {
|
|
295
|
-
const
|
|
300
|
+
const t = {
|
|
296
301
|
adults: (s == null ? void 0 : s.adults) ?? 1,
|
|
297
|
-
children: (s == null ? void 0 : s.children) ?? 0
|
|
298
|
-
|
|
302
|
+
children: (s == null ? void 0 : s.children) ?? 0,
|
|
303
|
+
infants: (s == null ? void 0 : s.infants) ?? 0
|
|
304
|
+
}, m = ne(t);
|
|
299
305
|
return {
|
|
300
|
-
passengerCount:
|
|
301
|
-
passengerList:
|
|
306
|
+
passengerCount: t.adults + t.children + t.infants,
|
|
307
|
+
passengerList: m
|
|
302
308
|
};
|
|
303
309
|
};
|
|
304
310
|
export {
|
|
305
|
-
|
|
311
|
+
B as DEFAULT_AIRLINE_PROGRAM,
|
|
306
312
|
be as buildFlightSearchQuery,
|
|
307
313
|
ne as buildPassengerArray,
|
|
308
314
|
Fe as formatCabinClass,
|
|
@@ -316,5 +322,5 @@ export {
|
|
|
316
322
|
Ae as groupFlightResults,
|
|
317
323
|
ye as mapDataToFlightDetails,
|
|
318
324
|
we as passengerValues,
|
|
319
|
-
|
|
325
|
+
q as removeLeadingZeros
|
|
320
326
|
};
|