@odynn/awayz-flights 0.10.15 → 0.10.16
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.
|
@@ -129,6 +129,8 @@ export interface IFlightPaymentOption {
|
|
|
129
129
|
};
|
|
130
130
|
cabinClass?: string;
|
|
131
131
|
slices?: ISlice[];
|
|
132
|
+
isCached?: boolean;
|
|
133
|
+
lastCachedTime?: string;
|
|
132
134
|
}
|
|
133
135
|
export interface IFlightResult {
|
|
134
136
|
id: string;
|
|
@@ -158,6 +160,8 @@ export interface IFlightResult {
|
|
|
158
160
|
cabinClass: string;
|
|
159
161
|
expiresAt: string;
|
|
160
162
|
transferPartners: string[];
|
|
163
|
+
isCached: boolean;
|
|
164
|
+
lastCachedTime: string;
|
|
161
165
|
}
|
|
162
166
|
export interface IAirportLocation {
|
|
163
167
|
city: string;
|
|
@@ -203,6 +207,8 @@ export interface IFlightOffer {
|
|
|
203
207
|
};
|
|
204
208
|
googleUrl: string;
|
|
205
209
|
partners: string[];
|
|
210
|
+
isCached: boolean;
|
|
211
|
+
lastCachedTime: string;
|
|
206
212
|
}
|
|
207
213
|
export interface IPaymentRequirements {
|
|
208
214
|
requiresInstantPayment: boolean;
|
|
@@ -3,30 +3,30 @@ 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 C } 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
9
|
import { WalletService as J } from "../services/wallet/WalletService.js";
|
|
10
10
|
import { ERewardProgramCategories as X } from "../services/wallet/WalletService.types.js";
|
|
11
|
-
const f = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/",
|
|
12
|
-
var
|
|
13
|
-
const
|
|
11
|
+
const f = "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, i, u, d, r, o, p, m, g, y, b, F, A, L, w, T, 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: ((
|
|
21
|
-
airportCode: ((
|
|
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) || ((u = (i = e.slices[0].segments[0].origin) == null ? void 0 : i.city) == null ? void 0 : u.iataCountryCode) || "",
|
|
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: ((
|
|
24
|
-
longitude: ((
|
|
23
|
+
latitude: ((m = (p = e.slices[0].segments[0].origin) == null ? void 0 : p.city) == null ? void 0 : m.latitude) || 0,
|
|
24
|
+
longitude: ((y = (g = e.slices[0].segments[0].origin) == null ? void 0 : g.city) == null ? void 0 : y.longitude) || 0
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
destination: {
|
|
28
|
-
city: ((
|
|
29
|
-
country: ((
|
|
28
|
+
city: ((F = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : F.cityName) || ((w = (L = (A = e.slices[0].segments.getLast()) == null ? void 0 : A.destination) == null ? void 0 : L.city) == null ? void 0 : w.name) || "",
|
|
29
|
+
country: ((D = (T = e.slices[0].segments.getLast()) == null ? void 0 : T.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
32
|
latitude: (($ = (N = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : N.city) == null ? void 0 : $.latitude) || 0,
|
|
@@ -34,15 +34,15 @@ const f = "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:
|
|
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]),
|
|
43
43
|
awayzGroupId: e.slices[0].comparisonKey || e.awayzRouteId || e.awayzGroupId || e.id,
|
|
44
|
-
departureTime:
|
|
45
|
-
arrivalTime:
|
|
44
|
+
departureTime: C(e.slices[0].segments[0].departingAt).toDate(),
|
|
45
|
+
arrivalTime: C(
|
|
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: C(e.slices[0].segments[0].departingAt),
|
|
55
|
+
arrivalTime: C((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
|
|
@@ -60,135 +60,139 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
60
60
|
cashFee: e.cashFee,
|
|
61
61
|
cabinClass: e.slices[0].segments[0].passengers[0].cabinClass || e.slices[0].segments[0].passengers[0].cabin.name || e.slices[0].segments[0].passengers[0].cabinClassMarketingName || e.slices[0].segments[0].passengers[0].cabin.marketingName,
|
|
62
62
|
expiresAt: e.expiresAt,
|
|
63
|
-
transferPartners: e.partners
|
|
63
|
+
transferPartners: e.partners,
|
|
64
|
+
isCached: e.isCached,
|
|
65
|
+
lastCachedTime: e.lastCachedTime
|
|
64
66
|
};
|
|
65
67
|
}), ee = (s) => {
|
|
66
|
-
const e = s.marketingCarrier ?? s.operatingCarrier,
|
|
67
|
-
return e.iataCode + " " + H(
|
|
68
|
+
const e = s.marketingCarrier ?? s.operatingCarrier, t = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
|
|
69
|
+
return e.iataCode + " " + H(t);
|
|
68
70
|
}, se = (s) => {
|
|
69
|
-
var
|
|
70
|
-
const e = (
|
|
71
|
+
var t;
|
|
72
|
+
const e = (t = s == null ? void 0 : s.segments) == null ? void 0 : t[0];
|
|
71
73
|
return (e == null ? void 0 : e.marketingCarrier) ?? (e == null ? void 0 : e.operatingCarrier);
|
|
72
|
-
},
|
|
74
|
+
}, ae = (s) => {
|
|
73
75
|
var e;
|
|
74
76
|
return se((e = s == null ? void 0 : s.slices) == null ? void 0 : e[0]);
|
|
75
|
-
},
|
|
77
|
+
}, he = (s) => !s.operatingCarrier || !s.marketingCarrier ? "" : s.operatingCarrier.iataCode !== s.marketingCarrier.iataCode ? s.operatingCarrier.name : "", be = ({
|
|
76
78
|
originCode: s,
|
|
77
79
|
destinationCode: e,
|
|
78
|
-
dates:
|
|
79
|
-
cabinClass:
|
|
80
|
-
passengerCount:
|
|
80
|
+
dates: t,
|
|
81
|
+
cabinClass: l,
|
|
82
|
+
passengerCount: n,
|
|
81
83
|
paymentType: c
|
|
82
84
|
}) => {
|
|
83
|
-
let
|
|
84
|
-
return
|
|
85
|
-
},
|
|
86
|
-
const e = s.operatingCarrier ?? s.marketingCarrier,
|
|
87
|
-
return e.iataCode + " " + H(
|
|
88
|
-
},
|
|
85
|
+
let a = `${V.CASH_POINTS_FLIGHT_SEARCH}?`;
|
|
86
|
+
return a += `origin=${s}`, a += `&destination=${e}`, a += `&departure_dates=[${t.map((i) => `"${i}"`).join(",")}]`, a += `&cabin_class=${l}`, a += `&adults=${n}`, a += `&cash_or_points=[${c}]`, a;
|
|
87
|
+
}, te = (s) => s.flightDetails.slices[0].segments.map((t) => ie(t)).join("_") + "_" + C(s.departureTime).format("YYYYMMDD"), ie = (s) => {
|
|
88
|
+
const e = s.operatingCarrier ?? s.marketingCarrier, t = s.operatingCarrierFlightNumber ?? s.marketingCarrierFlightNumber;
|
|
89
|
+
return e.iataCode + " " + H(t);
|
|
90
|
+
}, Fe = (s) => s ? s.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Ae = (s) => {
|
|
89
91
|
const e = {};
|
|
90
|
-
s.forEach((
|
|
91
|
-
var
|
|
92
|
-
const i =
|
|
92
|
+
s.forEach((a) => {
|
|
93
|
+
var u, d;
|
|
94
|
+
const i = te(a);
|
|
93
95
|
if (e[i]) {
|
|
94
|
-
const
|
|
95
|
-
e[i].flight.paymentOptions.push(
|
|
96
|
-
const { lowestCash:
|
|
97
|
-
e[i].flight.points =
|
|
96
|
+
const r = K(a);
|
|
97
|
+
e[i].flight.paymentOptions.push(r);
|
|
98
|
+
const { lowestCash: o, currency: p, lowestPoints: m, cashFee: g, cacheData: y } = j(e[i].flight.paymentOptions);
|
|
99
|
+
e[i].flight.points = m, e[i].flight.cashFee = g, e[i].flight.cash = o, p && (e[i].flight.currency = p), e[i].flight.isCached = y.isCached, e[i].flight.lastCachedTime = y.lastCachedTime;
|
|
98
100
|
} else {
|
|
99
|
-
const { origin:
|
|
101
|
+
const { origin: r, destination: o } = a, p = [K(a)], m = j(p);
|
|
100
102
|
e[i] = {
|
|
101
103
|
programs: [],
|
|
102
104
|
flight: {
|
|
103
|
-
id:
|
|
104
|
-
partial:
|
|
105
|
+
id: a.awayzGroupId,
|
|
106
|
+
partial: a.partial,
|
|
105
107
|
origin: {
|
|
106
|
-
city: n.city,
|
|
107
|
-
country: n.country,
|
|
108
|
-
airportCode: n.airportCode,
|
|
109
|
-
coordinates: n.coordinates
|
|
110
|
-
},
|
|
111
|
-
destination: {
|
|
112
108
|
city: r.city,
|
|
113
109
|
country: r.country,
|
|
114
110
|
airportCode: r.airportCode,
|
|
115
111
|
coordinates: r.coordinates
|
|
116
112
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
destination: {
|
|
114
|
+
city: o.city,
|
|
115
|
+
country: o.country,
|
|
116
|
+
airportCode: o.airportCode,
|
|
117
|
+
coordinates: o.coordinates
|
|
118
|
+
},
|
|
119
|
+
airline: a.airline,
|
|
120
|
+
airlineLogo: a.airlineLogo,
|
|
121
|
+
displayAirlineIataCode: a.displayAirlineIataCode,
|
|
122
|
+
flightNumber: a.flightNumber,
|
|
123
|
+
paymentOptions: p,
|
|
124
|
+
numberOfStops: a.numberOfStops,
|
|
125
|
+
departureTime: a.departureTime,
|
|
126
|
+
arrivalTime: a.arrivalTime,
|
|
125
127
|
awayzGroupId: i,
|
|
126
|
-
duration:
|
|
127
|
-
airlineProgram:
|
|
128
|
+
duration: a.duration,
|
|
129
|
+
airlineProgram: a.airlineProgram,
|
|
128
130
|
durationMinutes: q({
|
|
129
|
-
departureTime:
|
|
130
|
-
|
|
131
|
+
departureTime: C(
|
|
132
|
+
a.flightDetails.slices[0].segments[0].departingAt
|
|
131
133
|
),
|
|
132
|
-
arrivalTime:
|
|
133
|
-
(
|
|
134
|
+
arrivalTime: C(
|
|
135
|
+
(u = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : u.arrivingAt
|
|
134
136
|
),
|
|
135
|
-
originTimeZone:
|
|
136
|
-
destinationTimeZone: (
|
|
137
|
-
duration:
|
|
137
|
+
originTimeZone: a.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
138
|
+
destinationTimeZone: (d = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : d.destination.timeZone,
|
|
139
|
+
duration: a.flightDetails.slices[0].duration
|
|
138
140
|
}),
|
|
139
|
-
cash:
|
|
140
|
-
points:
|
|
141
|
-
flightDetails:
|
|
142
|
-
currency:
|
|
143
|
-
cashFee:
|
|
144
|
-
cabinClass:
|
|
145
|
-
expiresAt:
|
|
146
|
-
transferPartners:
|
|
141
|
+
cash: m.lowestCash,
|
|
142
|
+
points: m.lowestPoints,
|
|
143
|
+
flightDetails: a.flightDetails,
|
|
144
|
+
currency: a.flightDetails.baseCurrency,
|
|
145
|
+
cashFee: a.cashFee,
|
|
146
|
+
cabinClass: a.flightDetails.slices[0].segments[0].passengers[0].cabinClass || a.flightDetails.slices[0].segments[0].passengers[0].cabin.name || a.flightDetails.slices[0].segments[0].passengers[0].cabinClassMarketingName || a.flightDetails.slices[0].segments[0].passengers[0].cabin.marketingName,
|
|
147
|
+
expiresAt: a.expiresAt,
|
|
148
|
+
transferPartners: a.transferPartners || [],
|
|
149
|
+
isCached: a.isCached,
|
|
150
|
+
lastCachedTime: a.lastCachedTime
|
|
147
151
|
}
|
|
148
152
|
};
|
|
149
153
|
}
|
|
150
|
-
|
|
154
|
+
a.airlineProgram && !e[i].programs.includes(a.airlineProgram) && e[i].programs.push(a.airlineProgram);
|
|
151
155
|
});
|
|
152
|
-
const
|
|
153
|
-
Object.values(e).forEach((
|
|
154
|
-
const i =
|
|
155
|
-
(
|
|
156
|
+
const t = [];
|
|
157
|
+
Object.values(e).forEach((a) => {
|
|
158
|
+
const i = a.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
|
|
159
|
+
(r, o) => o.cash < r.cash ? o : r,
|
|
156
160
|
{ cash: 1 / 0, carrier: { name: "", iataCode: "" } }
|
|
157
|
-
),
|
|
158
|
-
iataCode:
|
|
159
|
-
name:
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
(
|
|
164
|
-
),
|
|
165
|
-
|
|
166
|
-
...
|
|
167
|
-
airline:
|
|
168
|
-
airlineLogo:
|
|
169
|
-
displayAirlineIataCode:
|
|
170
|
-
airlineProgram:
|
|
161
|
+
), u = {
|
|
162
|
+
iataCode: a.flight.displayAirlineIataCode,
|
|
163
|
+
name: a.flight.airline
|
|
164
|
+
}, d = i.cash !== 1 / 0 ? i.carrier : u;
|
|
165
|
+
a.programs.length > 0 ? a.programs.forEach((r) => {
|
|
166
|
+
const o = a.flight.paymentOptions.filter(
|
|
167
|
+
(m) => m.program === r && m.points > 0
|
|
168
|
+
), p = o.length > 0 ? Math.min(...o.map((m) => m.points)) : -1;
|
|
169
|
+
t.push({
|
|
170
|
+
...a.flight,
|
|
171
|
+
airline: d.name,
|
|
172
|
+
airlineLogo: h(d.iataCode),
|
|
173
|
+
displayAirlineIataCode: d.iataCode,
|
|
174
|
+
airlineProgram: r,
|
|
171
175
|
cash: i.cash !== 1 / 0 ? i.cash : -1,
|
|
172
|
-
points:
|
|
176
|
+
points: p
|
|
173
177
|
});
|
|
174
|
-
}) :
|
|
175
|
-
...
|
|
176
|
-
airline:
|
|
177
|
-
airlineLogo:
|
|
178
|
-
displayAirlineIataCode:
|
|
178
|
+
}) : t.push({
|
|
179
|
+
...a.flight,
|
|
180
|
+
airline: d.name,
|
|
181
|
+
airlineLogo: h(d.iataCode),
|
|
182
|
+
displayAirlineIataCode: d.iataCode,
|
|
179
183
|
cash: i.cash !== 1 / 0 ? i.cash : -1
|
|
180
184
|
});
|
|
181
185
|
});
|
|
182
|
-
const { cashlessResults:
|
|
183
|
-
(
|
|
186
|
+
const { cashlessResults: l, otherResults: n } = t.reduce(
|
|
187
|
+
(a, i) => (i.cash <= 0 && i.points > 0 ? a.cashlessResults.push(i) : i.cash > 0 && a.otherResults.push(i), a),
|
|
184
188
|
{ cashlessResults: [], otherResults: [] }
|
|
185
|
-
), c = [...
|
|
186
|
-
return
|
|
189
|
+
), c = [...n];
|
|
190
|
+
return l.forEach((a) => {
|
|
187
191
|
(!c.find(
|
|
188
|
-
(
|
|
189
|
-
) ||
|
|
192
|
+
(u) => u.awayzGroupId === a.awayzGroupId
|
|
193
|
+
) || n.length === 0) && c.push(a);
|
|
190
194
|
}), c;
|
|
191
|
-
}, H = (s) => s ? s.replace(/^0+/, "") : "",
|
|
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) => `${f}${s}.svg`, B = Y.logoFallbackImageUrl, x = {
|
|
192
196
|
categoryLogo: B,
|
|
193
197
|
programLogo: B,
|
|
194
198
|
awayzActive: [],
|
|
@@ -200,28 +204,28 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
200
204
|
colour: "#fff",
|
|
201
205
|
// Using App Foreground Colour
|
|
202
206
|
url: "https://www.odynn.com"
|
|
203
|
-
},
|
|
207
|
+
}, we = async (s) => {
|
|
204
208
|
const { airlines: e } = await Q.ensureQueryData({
|
|
205
209
|
queryKey: ["walletAwards"],
|
|
206
210
|
queryFn: J.getAwards,
|
|
207
211
|
staleTime: 864e5
|
|
208
212
|
// 24 hours
|
|
209
213
|
});
|
|
210
|
-
let
|
|
211
|
-
(
|
|
212
|
-
var
|
|
213
|
-
return ((c = (
|
|
214
|
+
let t = e.find(
|
|
215
|
+
(l) => {
|
|
216
|
+
var n, c, a, i;
|
|
217
|
+
return ((c = (n = l.mainProgram) == null ? void 0 : n.toLowerCase()) == null ? void 0 : c.includes(s == null ? void 0 : s.toLowerCase())) || ((i = (a = l.displayProgram) == null ? void 0 : a.toLowerCase()) == null ? void 0 : i.includes(s == null ? void 0 : s.toLowerCase()));
|
|
214
218
|
}
|
|
215
219
|
) ?? x;
|
|
216
|
-
return
|
|
220
|
+
return t || (t = {
|
|
217
221
|
...x,
|
|
218
222
|
mainProgram: s,
|
|
219
223
|
displayProgram: s,
|
|
220
224
|
id: s
|
|
221
|
-
}),
|
|
225
|
+
}), t;
|
|
222
226
|
}, K = (s) => {
|
|
223
|
-
var
|
|
224
|
-
const e = ((
|
|
227
|
+
var n, c, a, i, u, d, r, o, p, m;
|
|
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) ?? [], t = ((d = (u = (i = s.flightDetails.slices.getFirst()) == null ? void 0 : i.segments.getFirst()) == null ? void 0 : u.passengers.getFirst()) == null ? void 0 : d.cabinClassMarketingName) ?? ((p = (o = (r = s.flightDetails.slices.getFirst()) == null ? void 0 : r.segments.getFirst()) == null ? void 0 : o.passengers.getFirst()) == null ? void 0 : p.cabinClass), l = e.map(
|
|
225
229
|
(g) => ({
|
|
226
230
|
type: W(g.type),
|
|
227
231
|
quantity: g.quantity
|
|
@@ -233,39 +237,45 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
233
237
|
points: s.points,
|
|
234
238
|
program: s.airlineProgram,
|
|
235
239
|
baseCurrency: s.flightDetails.baseCurrency,
|
|
236
|
-
fareBrandName: ((
|
|
237
|
-
cabinClass:
|
|
240
|
+
fareBrandName: ((m = s.flightDetails.slices.getFirst()) == null ? void 0 : m.fareBrandName) ?? "",
|
|
241
|
+
cabinClass: t,
|
|
238
242
|
cashFee: s.cashFee,
|
|
239
243
|
conditions: s.flightDetails.conditions,
|
|
240
|
-
baggages:
|
|
244
|
+
baggages: l,
|
|
241
245
|
// `carrier` is an existing unqualified field; semantics are marketing carrier.
|
|
242
246
|
carrier: {
|
|
243
247
|
iataCode: s.displayAirlineIataCode,
|
|
244
248
|
name: s.airline
|
|
245
|
-
}
|
|
249
|
+
},
|
|
250
|
+
isCached: s.isCached,
|
|
251
|
+
lastCachedTime: s.lastCachedTime
|
|
246
252
|
};
|
|
247
253
|
}, j = (s) => {
|
|
248
|
-
const e = s.filter((
|
|
249
|
-
let
|
|
250
|
-
for (const
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
(
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
254
|
+
const e = s.filter((a) => a.cash > 0);
|
|
255
|
+
let t = { cash: 1 / 0, baseCurrency: "" };
|
|
256
|
+
for (const a of e)
|
|
257
|
+
a.cash < t.cash && (t = a);
|
|
258
|
+
const l = [...s].filter(
|
|
259
|
+
(a) => a.points > 0
|
|
260
|
+
);
|
|
261
|
+
let n = {
|
|
262
|
+
points: 1 / 0,
|
|
263
|
+
cashFee: { amount: 0, currency: "" },
|
|
264
|
+
isCached: !1,
|
|
265
|
+
lastCachedTime: ""
|
|
266
|
+
};
|
|
267
|
+
for (const a of l)
|
|
268
|
+
a.points < n.points && (n = a);
|
|
269
|
+
const c = t.cash;
|
|
264
270
|
return {
|
|
265
271
|
lowestCash: c === 1 / 0 ? -1 : c,
|
|
266
|
-
lowestPoints:
|
|
267
|
-
cashFee:
|
|
268
|
-
currency:
|
|
272
|
+
lowestPoints: n.points === 1 / 0 ? -1 : n.points,
|
|
273
|
+
cashFee: n.cashFee,
|
|
274
|
+
currency: t.baseCurrency === "" ? null : t.baseCurrency,
|
|
275
|
+
cacheData: {
|
|
276
|
+
isCached: n.isCached ?? !1,
|
|
277
|
+
lastCachedTime: n.lastCachedTime ?? ""
|
|
278
|
+
}
|
|
269
279
|
};
|
|
270
280
|
}, ne = (s) => [
|
|
271
281
|
...Array.from({ length: s.adults }, () => ({
|
|
@@ -276,30 +286,30 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
276
286
|
type: "child"
|
|
277
287
|
/* CHILD */
|
|
278
288
|
}))
|
|
279
|
-
],
|
|
280
|
-
const
|
|
289
|
+
], Te = (s) => {
|
|
290
|
+
const t = {
|
|
281
291
|
adults: (s == null ? void 0 : s.adults) ?? 1,
|
|
282
292
|
children: (s == null ? void 0 : s.children) ?? 0
|
|
283
|
-
},
|
|
293
|
+
}, l = ne(t);
|
|
284
294
|
return {
|
|
285
|
-
passengerCount:
|
|
286
|
-
passengerList:
|
|
295
|
+
passengerCount: t.adults + t.children,
|
|
296
|
+
passengerList: l
|
|
287
297
|
};
|
|
288
298
|
};
|
|
289
299
|
export {
|
|
290
300
|
x as DEFAULT_AIRLINE_PROGRAM,
|
|
291
|
-
|
|
301
|
+
be as buildFlightSearchQuery,
|
|
292
302
|
ne as buildPassengerArray,
|
|
293
|
-
|
|
294
|
-
|
|
303
|
+
Fe as formatCabinClass,
|
|
304
|
+
we as getAirlineProgram,
|
|
295
305
|
ee as getFlightNumber,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
h as getFullLogoPath,
|
|
307
|
+
Le as getLogoPath,
|
|
308
|
+
he as getOperatedBy,
|
|
309
|
+
ae as getPrimaryDisplayCarrierForFlightOffer,
|
|
300
310
|
se as getPrimaryDisplayCarrierForSlice,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
Ae as groupFlightResults,
|
|
312
|
+
ye as mapDataToFlightDetails,
|
|
313
|
+
Te as passengerValues,
|
|
304
314
|
H as removeLeadingZeros
|
|
305
315
|
};
|