@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.
@@ -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, passengerCount, paymentType }: {
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
- passengerCount: number;
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-BMRY5V0b.js";
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 C } from "../moment-BGjjqtLQ.js";
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 J } from "../services/wallet/WalletService.js";
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/", 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);
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) || ((u = (i = e.slices[0].segments[0].origin) == null ? void 0 : i.city) == null ? void 0 : u.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 = (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
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) || ((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) || "",
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: (($ = (N = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : N.city) == null ? void 0 : $.latitude) || 0,
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: (t == null ? void 0 : t.name) ?? "",
38
- airlineLogo: h((t == null ? void 0 : t.iataCode) ?? ""),
39
- displayAirlineIataCode: (t == null ? void 0 : t.iataCode) ?? "",
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: C(e.slices[0].segments[0].departingAt).toDate(),
45
- arrivalTime: C(
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: C(e.slices[0].segments[0].departingAt),
55
- arrivalTime: C((S = e.slices[0].segments.getLast()) == null ? void 0 : S.arrivingAt),
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, t = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
69
- return e.iataCode + " " + H(t);
68
+ const e = s.marketingCarrier ?? s.operatingCarrier, i = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
69
+ return e.iataCode + " " + H(i);
70
70
  }, se = (s) => {
71
- var t;
72
- const e = (t = s == null ? void 0 : s.segments) == null ? void 0 : t[0];
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: t,
80
+ dates: i,
81
81
  cabinClass: l,
82
- passengerCount: n,
83
- paymentType: c
82
+ adults: n,
83
+ children: c,
84
+ paymentType: a
84
85
  }) => {
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);
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 u, d;
94
- const i = te(a);
95
- if (e[i]) {
94
+ var p, d;
95
+ const t = te(a);
96
+ if (e[t]) {
96
97
  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
+ 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, p = [K(a)], m = j(p);
102
- e[i] = {
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: p,
128
+ paymentOptions: u,
124
129
  numberOfStops: a.numberOfStops,
125
130
  departureTime: a.departureTime,
126
131
  arrivalTime: a.arrivalTime,
127
- awayzGroupId: i,
132
+ awayzGroupId: t,
128
133
  duration: a.duration,
129
134
  airlineProgram: a.airlineProgram,
130
135
  durationMinutes: q({
131
- departureTime: C(
136
+ departureTime: y(
132
137
  a.flightDetails.slices[0].segments[0].departingAt
133
138
  ),
134
- arrivalTime: C(
135
- (u = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : u.arrivingAt
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[i].programs.includes(a.airlineProgram) && e[i].programs.push(a.airlineProgram);
159
+ a.airlineProgram && !e[t].programs.includes(a.airlineProgram) && e[t].programs.push(a.airlineProgram);
155
160
  });
156
- const t = [];
161
+ const i = [];
157
162
  Object.values(e).forEach((a) => {
158
- const i = a.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
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
- ), u = {
166
+ ), p = {
162
167
  iataCode: a.flight.displayAirlineIataCode,
163
168
  name: a.flight.airline
164
- }, d = i.cash !== 1 / 0 ? i.carrier : u;
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
- ), p = o.length > 0 ? Math.min(...o.map((m) => m.points)) : -1;
169
- t.push({
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: i.cash !== 1 / 0 ? i.cash : -1,
176
- points: p
180
+ cash: t.cash !== 1 / 0 ? t.cash : -1,
181
+ points: u
177
182
  });
178
- }) : t.push({
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: i.cash !== 1 / 0 ? i.cash : -1
188
+ cash: t.cash !== 1 / 0 ? t.cash : -1
184
189
  });
185
190
  });
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),
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
- (u) => u.awayzGroupId === a.awayzGroupId
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) => `${f}${s}.svg`, B = Y.logoFallbackImageUrl, x = {
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: X.Airline,
208
+ category: J.Airline,
204
209
  colour: "#fff",
205
210
  // Using App Foreground Colour
206
211
  url: "https://www.odynn.com"
207
- }, we = async (s) => {
212
+ }, Te = async (s) => {
208
213
  const { airlines: e } = await Q.ensureQueryData({
209
214
  queryKey: ["walletAwards"],
210
- queryFn: J.getAwards,
215
+ queryFn: f.getAwards,
211
216
  staleTime: 864e5
212
217
  // 24 hours
213
218
  });
214
- let t = e.find(
219
+ let i = e.find(
215
220
  (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()));
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 t || (t = {
225
+ return i || (i = {
221
226
  ...x,
222
227
  mainProgram: s,
223
228
  displayProgram: s,
224
229
  id: s
225
- }), t;
230
+ }), i;
226
231
  }, K = (s) => {
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(
229
- (g) => ({
230
- type: W(g.type),
231
- quantity: g.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: t,
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 t = { cash: 1 / 0, baseCurrency: "" };
260
+ let i = { cash: 1 / 0, baseCurrency: "" };
256
261
  for (const a of e)
257
- a.cash < t.cash && (t = a);
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 = t.cash;
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: t.baseCurrency === "" ? null : t.baseCurrency,
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
- ], Te = (s) => {
290
- const t = {
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(t);
298
+ }, l = ne(i);
294
299
  return {
295
- passengerCount: t.adults + t.children,
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
- we as getAirlineProgram,
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
- Te as passengerValues,
318
+ we as passengerValues,
314
319
  H as removeLeadingZeros
315
320
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.10.16",
3
+ "version": "0.10.19",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -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
- };