@odynn/awayz-flights 0.10.17 → 0.10.20
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 +1377 -1843
- package/dist/keys-C7jV6nZg.js +5 -0
- package/dist/lib/hooks/useFlightSearch/useFlightSearch.types.d.ts +1 -0
- package/dist/lib/utils/flightUtils.d.ts +8 -3
- package/dist/main.js +1 -1
- package/dist/utils/flightUtils.js +126 -119
- 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
|
+
};
|
|
@@ -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,12 +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,
|
|
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;
|
|
45
|
+
children: number;
|
|
46
|
+
infants: number;
|
|
44
47
|
paymentType: string[];
|
|
45
48
|
}) => string;
|
|
46
49
|
/**
|
|
@@ -95,12 +98,14 @@ export declare const getAirlineProgram: (airlineProgramName: string) => Promise<
|
|
|
95
98
|
export declare const buildPassengerArray: (config: {
|
|
96
99
|
adults: number;
|
|
97
100
|
children: number;
|
|
101
|
+
infants: number;
|
|
98
102
|
}) => {
|
|
99
103
|
type: EPassengerType;
|
|
100
104
|
}[];
|
|
101
105
|
interface IPassengers {
|
|
102
106
|
adults: number;
|
|
103
107
|
children: number;
|
|
108
|
+
infants: number;
|
|
104
109
|
}
|
|
105
110
|
export declare const passengerValues: (passengers?: IPassengers) => {
|
|
106
111
|
passengerCount: number;
|
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";
|
|
@@ -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: {
|
|
@@ -29,14 +29,14 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
29
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: (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,49 +77,51 @@ 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
|
-
|
|
83
|
-
|
|
80
|
+
dates: t,
|
|
81
|
+
cabinClass: m,
|
|
82
|
+
adults: r,
|
|
83
|
+
children: l,
|
|
84
|
+
infants: a,
|
|
85
|
+
paymentType: i
|
|
84
86
|
}) => {
|
|
85
|
-
let
|
|
86
|
-
return
|
|
87
|
-
}, te = (s) => s.flightDetails.slices[0].segments.map((
|
|
88
|
-
const e = s.operatingCarrier ?? s.marketingCarrier,
|
|
89
|
-
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);
|
|
90
92
|
}, Fe = (s) => s ? s.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Ae = (s) => {
|
|
91
93
|
const e = {};
|
|
92
94
|
s.forEach((a) => {
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
if (e[
|
|
96
|
-
const
|
|
97
|
-
e[
|
|
98
|
-
const { lowestCash:
|
|
99
|
-
e[
|
|
100
|
-
...e[
|
|
101
|
-
isCached:
|
|
102
|
-
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
|
|
103
105
|
});
|
|
104
106
|
} else {
|
|
105
|
-
const { origin:
|
|
106
|
-
e[
|
|
107
|
+
const { origin: o, destination: c } = a, p = [x(a)], u = K(p);
|
|
108
|
+
e[i] = {
|
|
107
109
|
programs: [],
|
|
108
110
|
flight: {
|
|
109
111
|
id: a.awayzGroupId,
|
|
110
112
|
partial: a.partial,
|
|
111
113
|
origin: {
|
|
112
|
-
city: r.city,
|
|
113
|
-
country: r.country,
|
|
114
|
-
airportCode: r.airportCode,
|
|
115
|
-
coordinates: r.coordinates
|
|
116
|
-
},
|
|
117
|
-
destination: {
|
|
118
114
|
city: o.city,
|
|
119
115
|
country: o.country,
|
|
120
116
|
airportCode: o.airportCode,
|
|
121
117
|
coordinates: o.coordinates
|
|
122
118
|
},
|
|
119
|
+
destination: {
|
|
120
|
+
city: c.city,
|
|
121
|
+
country: c.country,
|
|
122
|
+
airportCode: c.airportCode,
|
|
123
|
+
coordinates: c.coordinates
|
|
124
|
+
},
|
|
123
125
|
airline: a.airline,
|
|
124
126
|
airlineLogo: a.airlineLogo,
|
|
125
127
|
displayAirlineIataCode: a.displayAirlineIataCode,
|
|
@@ -128,22 +130,22 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
128
130
|
numberOfStops: a.numberOfStops,
|
|
129
131
|
departureTime: a.departureTime,
|
|
130
132
|
arrivalTime: a.arrivalTime,
|
|
131
|
-
awayzGroupId:
|
|
133
|
+
awayzGroupId: i,
|
|
132
134
|
duration: a.duration,
|
|
133
135
|
airlineProgram: a.airlineProgram,
|
|
134
|
-
durationMinutes:
|
|
136
|
+
durationMinutes: j({
|
|
135
137
|
departureTime: y(
|
|
136
138
|
a.flightDetails.slices[0].segments[0].departingAt
|
|
137
139
|
),
|
|
138
140
|
arrivalTime: y(
|
|
139
|
-
(
|
|
141
|
+
(n = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : n.arrivingAt
|
|
140
142
|
),
|
|
141
143
|
originTimeZone: a.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
142
144
|
destinationTimeZone: (d = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : d.destination.timeZone,
|
|
143
145
|
duration: a.flightDetails.slices[0].duration
|
|
144
146
|
}),
|
|
145
|
-
cash:
|
|
146
|
-
points:
|
|
147
|
+
cash: u.lowestCash,
|
|
148
|
+
points: u.lowestPoints,
|
|
147
149
|
flightDetails: a.flightDetails,
|
|
148
150
|
currency: a.flightDetails.baseCurrency,
|
|
149
151
|
cashFee: a.cashFee,
|
|
@@ -155,50 +157,50 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
155
157
|
}
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
|
-
a.airlineProgram && !e[
|
|
160
|
+
a.airlineProgram && !e[i].programs.includes(a.airlineProgram) && e[i].programs.push(a.airlineProgram);
|
|
159
161
|
});
|
|
160
|
-
const
|
|
162
|
+
const t = [];
|
|
161
163
|
Object.values(e).forEach((a) => {
|
|
162
|
-
const
|
|
163
|
-
(
|
|
164
|
+
const i = a.flight.paymentOptions.filter((o) => o.cash > 0).reduce(
|
|
165
|
+
(o, c) => c.cash < o.cash ? c : o,
|
|
164
166
|
{ cash: 1 / 0, carrier: { name: "", iataCode: "" } }
|
|
165
|
-
),
|
|
167
|
+
), n = {
|
|
166
168
|
iataCode: a.flight.displayAirlineIataCode,
|
|
167
169
|
name: a.flight.airline
|
|
168
|
-
}, d =
|
|
169
|
-
a.programs.length > 0 ? a.programs.forEach((
|
|
170
|
-
const
|
|
171
|
-
(
|
|
172
|
-
), p =
|
|
173
|
-
|
|
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({
|
|
174
176
|
...a.flight,
|
|
175
177
|
airline: d.name,
|
|
176
178
|
airlineLogo: h(d.iataCode),
|
|
177
179
|
displayAirlineIataCode: d.iataCode,
|
|
178
|
-
airlineProgram:
|
|
179
|
-
cash:
|
|
180
|
+
airlineProgram: o,
|
|
181
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1,
|
|
180
182
|
points: p
|
|
181
183
|
});
|
|
182
|
-
}) :
|
|
184
|
+
}) : t.push({
|
|
183
185
|
...a.flight,
|
|
184
186
|
airline: d.name,
|
|
185
187
|
airlineLogo: h(d.iataCode),
|
|
186
188
|
displayAirlineIataCode: d.iataCode,
|
|
187
|
-
cash:
|
|
189
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1
|
|
188
190
|
});
|
|
189
191
|
});
|
|
190
|
-
const { cashlessResults:
|
|
191
|
-
(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),
|
|
192
194
|
{ cashlessResults: [], otherResults: [] }
|
|
193
|
-
),
|
|
194
|
-
return
|
|
195
|
-
(!
|
|
196
|
-
(
|
|
197
|
-
) ||
|
|
198
|
-
}),
|
|
199
|
-
},
|
|
200
|
-
categoryLogo:
|
|
201
|
-
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,
|
|
202
204
|
awayzActive: [],
|
|
203
205
|
mainProgram: "Unknown",
|
|
204
206
|
displayProgram: "Unknown",
|
|
@@ -209,30 +211,30 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
209
211
|
// Using App Foreground Colour
|
|
210
212
|
url: "https://www.odynn.com"
|
|
211
213
|
}, Te = async (s) => {
|
|
212
|
-
const { airlines: e } = await
|
|
214
|
+
const { airlines: e } = await Y.ensureQueryData({
|
|
213
215
|
queryKey: ["walletAwards"],
|
|
214
|
-
queryFn:
|
|
216
|
+
queryFn: W.getAwards,
|
|
215
217
|
staleTime: 864e5
|
|
216
218
|
// 24 hours
|
|
217
219
|
});
|
|
218
|
-
let
|
|
219
|
-
(
|
|
220
|
-
var
|
|
221
|
-
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()));
|
|
222
224
|
}
|
|
223
|
-
) ??
|
|
224
|
-
return
|
|
225
|
-
...
|
|
225
|
+
) ?? B;
|
|
226
|
+
return t || (t = {
|
|
227
|
+
...B,
|
|
226
228
|
mainProgram: s,
|
|
227
229
|
displayProgram: s,
|
|
228
230
|
id: s
|
|
229
|
-
}),
|
|
230
|
-
},
|
|
231
|
-
var
|
|
232
|
-
const e = ((a = (
|
|
233
|
-
(
|
|
234
|
-
type:
|
|
235
|
-
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
|
|
236
238
|
})
|
|
237
239
|
);
|
|
238
240
|
return {
|
|
@@ -241,11 +243,11 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
241
243
|
points: s.points,
|
|
242
244
|
program: s.airlineProgram,
|
|
243
245
|
baseCurrency: s.flightDetails.baseCurrency,
|
|
244
|
-
fareBrandName: ((
|
|
245
|
-
cabinClass:
|
|
246
|
+
fareBrandName: ((u = s.flightDetails.slices.getFirst()) == null ? void 0 : u.fareBrandName) ?? "",
|
|
247
|
+
cabinClass: t,
|
|
246
248
|
cashFee: s.cashFee,
|
|
247
249
|
conditions: s.flightDetails.conditions,
|
|
248
|
-
baggages:
|
|
250
|
+
baggages: m,
|
|
249
251
|
// `carrier` is an existing unqualified field; semantics are marketing carrier.
|
|
250
252
|
carrier: {
|
|
251
253
|
iataCode: s.displayAirlineIataCode,
|
|
@@ -254,31 +256,31 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
254
256
|
isCached: s.isCached,
|
|
255
257
|
lastCachedTime: s.lastCachedTime
|
|
256
258
|
};
|
|
257
|
-
},
|
|
259
|
+
}, K = (s) => {
|
|
258
260
|
const e = s.filter((a) => a.cash > 0);
|
|
259
|
-
let
|
|
261
|
+
let t = { cash: 1 / 0, baseCurrency: "" };
|
|
260
262
|
for (const a of e)
|
|
261
|
-
a.cash <
|
|
262
|
-
const
|
|
263
|
+
a.cash < t.cash && (t = a);
|
|
264
|
+
const m = [...s].filter(
|
|
263
265
|
(a) => a.points > 0
|
|
264
266
|
);
|
|
265
|
-
let
|
|
267
|
+
let r = {
|
|
266
268
|
points: 1 / 0,
|
|
267
269
|
cashFee: { amount: 0, currency: "" },
|
|
268
270
|
isCached: !1,
|
|
269
271
|
lastCachedTime: ""
|
|
270
272
|
};
|
|
271
|
-
for (const a of
|
|
272
|
-
a.points <
|
|
273
|
-
const
|
|
273
|
+
for (const a of m)
|
|
274
|
+
a.points < r.points && (r = a);
|
|
275
|
+
const l = t.cash;
|
|
274
276
|
return {
|
|
275
|
-
lowestCash:
|
|
276
|
-
lowestPoints:
|
|
277
|
-
cashFee:
|
|
278
|
-
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,
|
|
279
281
|
cacheData: {
|
|
280
|
-
isCached:
|
|
281
|
-
lastCachedTime:
|
|
282
|
+
isCached: r.isCached ?? !1,
|
|
283
|
+
lastCachedTime: r.lastCachedTime ?? ""
|
|
282
284
|
}
|
|
283
285
|
};
|
|
284
286
|
}, ne = (s) => [
|
|
@@ -289,19 +291,24 @@ const X = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
|
|
|
289
291
|
...Array.from({ length: s.children }, () => ({
|
|
290
292
|
type: "child"
|
|
291
293
|
/* CHILD */
|
|
294
|
+
})),
|
|
295
|
+
...Array.from({ length: s.infants }, () => ({
|
|
296
|
+
type: "infant"
|
|
297
|
+
/* INFANT */
|
|
292
298
|
}))
|
|
293
299
|
], we = (s) => {
|
|
294
|
-
const
|
|
300
|
+
const t = {
|
|
295
301
|
adults: (s == null ? void 0 : s.adults) ?? 1,
|
|
296
|
-
children: (s == null ? void 0 : s.children) ?? 0
|
|
297
|
-
|
|
302
|
+
children: (s == null ? void 0 : s.children) ?? 0,
|
|
303
|
+
infants: (s == null ? void 0 : s.infants) ?? 0
|
|
304
|
+
}, m = ne(t);
|
|
298
305
|
return {
|
|
299
|
-
passengerCount:
|
|
300
|
-
passengerList:
|
|
306
|
+
passengerCount: t.adults + t.children + t.infants,
|
|
307
|
+
passengerList: m
|
|
301
308
|
};
|
|
302
309
|
};
|
|
303
310
|
export {
|
|
304
|
-
|
|
311
|
+
B as DEFAULT_AIRLINE_PROGRAM,
|
|
305
312
|
be as buildFlightSearchQuery,
|
|
306
313
|
ne as buildPassengerArray,
|
|
307
314
|
Fe as formatCabinClass,
|
|
@@ -315,5 +322,5 @@ export {
|
|
|
315
322
|
Ae as groupFlightResults,
|
|
316
323
|
ye as mapDataToFlightDetails,
|
|
317
324
|
we as passengerValues,
|
|
318
|
-
|
|
325
|
+
q as removeLeadingZeros
|
|
319
326
|
};
|
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
|
-
};
|