@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.
@@ -40,6 +40,7 @@ export interface ISearchFlightArgs {
40
40
  passengers?: {
41
41
  adults: number;
42
42
  children: number;
43
+ infants: number;
43
44
  };
44
45
  /**
45
46
  * Optional Payment Type
@@ -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 Y, awayzClient as Q } from "@odynn/awayz-core";
1
+ import { defaultAwayzConfig as H, awayzClient as Y } from "@odynn/awayz-core";
2
2
  import "react/jsx-runtime";
3
- import { d as q } from "../dateUtils-Cb9VQiIL.js";
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 V } from "../constants/endpoints.js";
8
- import { mapBaggageType as W } from "../hooks/useFlightSearch/useFlightSearch.types.js";
9
- import { WalletService as f } from "../services/wallet/WalletService.js";
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 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);
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: ((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) || ((p = (t = e.slices[0].segments[0].origin) == null ? void 0 : t.city) == null ? void 0 : p.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) || "",
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: ((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
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: (i == null ? void 0 : i.name) ?? "",
38
- airlineLogo: h((i == null ? void 0 : i.iataCode) ?? ""),
39
- displayAirlineIataCode: (i == null ? void 0 : i.iataCode) ?? "",
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: q({
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, i = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
69
- return e.iataCode + " " + H(i);
68
+ const e = s.marketingCarrier ?? s.operatingCarrier, t = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
69
+ return e.iataCode + " " + q(t);
70
70
  }, se = (s) => {
71
- var i;
72
- const e = (i = s == null ? void 0 : s.segments) == null ? void 0 : i[0];
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: i,
81
- cabinClass: l,
82
- adults: n,
83
- children: c,
84
- paymentType: a
80
+ dates: t,
81
+ cabinClass: m,
82
+ adults: r,
83
+ children: l,
84
+ infants: a,
85
+ paymentType: i
85
86
  }) => {
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);
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 p, d;
95
- const t = te(a);
96
- if (e[t]) {
97
- const r = K(a);
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
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: r, destination: o } = a, u = [K(a)], m = j(u);
107
- e[t] = {
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: u,
129
+ paymentOptions: p,
129
130
  numberOfStops: a.numberOfStops,
130
131
  departureTime: a.departureTime,
131
132
  arrivalTime: a.arrivalTime,
132
- awayzGroupId: t,
133
+ awayzGroupId: i,
133
134
  duration: a.duration,
134
135
  airlineProgram: a.airlineProgram,
135
- durationMinutes: q({
136
+ durationMinutes: j({
136
137
  departureTime: y(
137
138
  a.flightDetails.slices[0].segments[0].departingAt
138
139
  ),
139
140
  arrivalTime: y(
140
- (p = a.flightDetails.slices[0].segments.getLast()) == null ? void 0 : p.arrivingAt
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: m.lowestCash,
147
- points: m.lowestPoints,
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[t].programs.includes(a.airlineProgram) && e[t].programs.push(a.airlineProgram);
160
+ a.airlineProgram && !e[i].programs.includes(a.airlineProgram) && e[i].programs.push(a.airlineProgram);
160
161
  });
161
- const i = [];
162
+ const t = [];
162
163
  Object.values(e).forEach((a) => {
163
- const t = a.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
164
- (r, o) => o.cash < r.cash ? o : r,
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
- ), p = {
167
+ ), n = {
167
168
  iataCode: a.flight.displayAirlineIataCode,
168
169
  name: a.flight.airline
169
- }, d = t.cash !== 1 / 0 ? t.carrier : p;
170
- a.programs.length > 0 ? a.programs.forEach((r) => {
171
- const o = a.flight.paymentOptions.filter(
172
- (m) => m.program === r && m.points > 0
173
- ), u = o.length > 0 ? Math.min(...o.map((m) => m.points)) : -1;
174
- i.push({
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: r,
180
- cash: t.cash !== 1 / 0 ? t.cash : -1,
181
- points: u
180
+ airlineProgram: o,
181
+ cash: i.cash !== 1 / 0 ? i.cash : -1,
182
+ points: p
182
183
  });
183
- }) : i.push({
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: t.cash !== 1 / 0 ? t.cash : -1
189
+ cash: i.cash !== 1 / 0 ? i.cash : -1
189
190
  });
190
191
  });
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),
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
- ), c = [...n];
195
- return l.forEach((a) => {
196
- (!c.find(
197
- (p) => p.awayzGroupId === a.awayzGroupId
198
- ) || n.length === 0) && c.push(a);
199
- }), c;
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 = {
201
- categoryLogo: B,
202
- programLogo: B,
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 Q.ensureQueryData({
214
+ const { airlines: e } = await Y.ensureQueryData({
214
215
  queryKey: ["walletAwards"],
215
- queryFn: f.getAwards,
216
+ queryFn: W.getAwards,
216
217
  staleTime: 864e5
217
218
  // 24 hours
218
219
  });
219
- let i = e.find(
220
- (l) => {
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()));
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
- ) ?? x;
225
- return i || (i = {
226
- ...x,
225
+ ) ?? B;
226
+ return t || (t = {
227
+ ...B,
227
228
  mainProgram: s,
228
229
  displayProgram: s,
229
230
  id: s
230
- }), i;
231
- }, K = (s) => {
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
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: ((m = s.flightDetails.slices.getFirst()) == null ? void 0 : m.fareBrandName) ?? "",
246
- cabinClass: i,
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: l,
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
- }, j = (s) => {
259
+ }, K = (s) => {
259
260
  const e = s.filter((a) => a.cash > 0);
260
- let i = { cash: 1 / 0, baseCurrency: "" };
261
+ let t = { cash: 1 / 0, baseCurrency: "" };
261
262
  for (const a of e)
262
- a.cash < i.cash && (i = a);
263
- const l = [...s].filter(
263
+ a.cash < t.cash && (t = a);
264
+ const m = [...s].filter(
264
265
  (a) => a.points > 0
265
266
  );
266
- let n = {
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 l)
273
- a.points < n.points && (n = a);
274
- const c = i.cash;
273
+ for (const a of m)
274
+ a.points < r.points && (r = a);
275
+ const l = t.cash;
275
276
  return {
276
- lowestCash: c === 1 / 0 ? -1 : c,
277
- lowestPoints: n.points === 1 / 0 ? -1 : n.points,
278
- cashFee: n.cashFee,
279
- currency: i.baseCurrency === "" ? null : i.baseCurrency,
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: n.isCached ?? !1,
282
- lastCachedTime: n.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 i = {
300
+ const t = {
296
301
  adults: (s == null ? void 0 : s.adults) ?? 1,
297
- children: (s == null ? void 0 : s.children) ?? 0
298
- }, l = ne(i);
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: i.adults + i.children,
301
- passengerList: l
306
+ passengerCount: t.adults + t.children + t.infants,
307
+ passengerList: m
302
308
  };
303
309
  };
304
310
  export {
305
- x as DEFAULT_AIRLINE_PROGRAM,
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
- H as removeLeadingZeros
325
+ q as removeLeadingZeros
320
326
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.10.19",
3
+ "version": "0.10.21",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"