@odynn/awayz-flights 0.10.11 → 0.10.13

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.
@@ -37,7 +37,10 @@ export interface ISearchFlightArgs {
37
37
  * @default 1
38
38
  * @type number
39
39
  */
40
- passengers?: number;
40
+ passengers?: {
41
+ adults: number;
42
+ children: number;
43
+ };
41
44
  /**
42
45
  * Optional Payment Type
43
46
  * @default EFlightPaymentType.CASH_AND_MILES
@@ -2,6 +2,10 @@ import { ISegment } from '@type-op/shared';
2
2
  import { IFlightOffer, IFlightResult } from '../hooks/useFlightSearch/useFlightSearch.types';
3
3
  import { IAirlineProgram } from '../services/wallet/WalletService.types';
4
4
  import { ECabinClass } from '../types/ECabinClass';
5
+ declare enum EPassengerType {
6
+ ADULT = "adult",
7
+ CHILD = "child"
8
+ }
5
9
  /**
6
10
  * @description - maps flight details into the flight result format, which is the expected format for Flight Components throughout the Awayz Application
7
11
  * @param {IFlightOffer[]} data incoming flight details from Flight Stream or Cash Only Search
@@ -88,3 +92,20 @@ export declare const DEFAULT_AIRLINE_PROGRAM: IAirlineProgram;
88
92
  * @returns airline reward program details matching name (from reward programs in statestore)
89
93
  */
90
94
  export declare const getAirlineProgram: (airlineProgramName: string) => Promise<IAirlineProgram>;
95
+ export declare const buildPassengerArray: (config: {
96
+ adults: number;
97
+ children: number;
98
+ }) => {
99
+ type: EPassengerType;
100
+ }[];
101
+ interface IPassengers {
102
+ adults: number;
103
+ children: number;
104
+ }
105
+ export declare const passengerValues: (passengers?: IPassengers) => {
106
+ passengerCount: number;
107
+ passengerList: {
108
+ type: EPassengerType;
109
+ }[];
110
+ };
111
+ export {};
@@ -4,29 +4,29 @@ import { d as H } 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 W } from "../constants/endpoints.js";
8
- import { mapBaggageType as J } from "../hooks/useFlightSearch/useFlightSearch.types.js";
9
- import { WalletService as V } from "../services/wallet/WalletService.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 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/", ge = (t) => t == null ? void 0 : t.map((e) => {
12
- var d, o, c, s, a, u, l, n, r, m, p, g, b, F, A, w, L, D, I, P, T, h, k, O, R, _, v, E, M, $, z, G, Z, S, U, N;
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 m, o, c, t, a, u, l, n, r, p, d, g, b, A, F, L, w, D, P, h, I, T, k, O, R, _, v, E, M, $, z, G, Z, S, U, N;
13
13
  const i = se(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: ((d = e.slices[0].segments[0].origin) == null ? void 0 : d.cityName) || ((c = (o = e.slices[0].segments[0].origin) == null ? void 0 : o.city) == null ? void 0 : c.name) || "",
20
- country: ((s = e.slices[0].segments[0].origin) == null ? void 0 : s.iataCountryCode) || ((u = (a = e.slices[0].segments[0].origin) == null ? void 0 : a.city) == null ? void 0 : u.iataCountryCode) || "",
19
+ city: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.cityName) || ((c = (o = e.slices[0].segments[0].origin) == null ? void 0 : o.city) == null ? void 0 : c.name) || "",
20
+ country: ((t = e.slices[0].segments[0].origin) == null ? void 0 : t.iataCountryCode) || ((u = (a = e.slices[0].segments[0].origin) == null ? void 0 : a.city) == null ? void 0 : u.iataCountryCode) || "",
21
21
  airportCode: ((l = e.slices[0].segments[0].origin) == null ? void 0 : l.iataCode) || ((r = (n = e.slices[0].segments[0].origin) == null ? void 0 : n.city) == null ? void 0 : r.iataCode) || "",
22
22
  coordinates: {
23
- latitude: ((p = (m = e.slices[0].segments[0].origin) == null ? void 0 : m.city) == null ? void 0 : p.latitude) || 0,
23
+ latitude: ((d = (p = e.slices[0].segments[0].origin) == null ? void 0 : p.city) == null ? void 0 : d.latitude) || 0,
24
24
  longitude: ((b = (g = e.slices[0].segments[0].origin) == null ? void 0 : g.city) == null ? void 0 : b.longitude) || 0
25
25
  }
26
26
  },
27
27
  destination: {
28
- city: ((A = (F = e.slices[0].segments.getLast()) == null ? void 0 : F.destination) == null ? void 0 : A.cityName) || ((D = (L = (w = e.slices[0].segments.getLast()) == null ? void 0 : w.destination) == null ? void 0 : L.city) == null ? void 0 : D.name) || "",
29
- country: ((P = (I = e.slices[0].segments.getLast()) == null ? void 0 : I.destination) == null ? void 0 : P.iataCountryCode) || ((k = (h = (T = e.slices[0].segments.getLast()) == null ? void 0 : T.destination) == null ? void 0 : h.city) == null ? void 0 : k.iataCountryCode) || "",
28
+ city: ((F = (A = e.slices[0].segments.getLast()) == null ? void 0 : A.destination) == null ? void 0 : F.cityName) || ((D = (w = (L = e.slices[0].segments.getLast()) == null ? void 0 : L.destination) == null ? void 0 : w.city) == null ? void 0 : D.name) || "",
29
+ country: ((h = (P = e.slices[0].segments.getLast()) == null ? void 0 : P.destination) == null ? void 0 : h.iataCountryCode) || ((k = (T = (I = e.slices[0].segments.getLast()) == null ? void 0 : I.destination) == null ? void 0 : T.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: ((z = ($ = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : $.city) == null ? void 0 : z.latitude) || 0,
@@ -62,43 +62,43 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
62
62
  expiresAt: e.expiresAt,
63
63
  transferPartners: e.partners
64
64
  };
65
- }), K = (t) => {
66
- const e = t.marketingCarrier ?? t.operatingCarrier, i = t.marketingCarrierFlightNumber ?? t.operatingCarrierFlightNumber;
65
+ }), K = (s) => {
66
+ const e = s.marketingCarrier ?? s.operatingCarrier, i = s.marketingCarrierFlightNumber ?? s.operatingCarrierFlightNumber;
67
67
  return e.iataCode + " " + ae(i);
68
- }, ee = (t) => {
68
+ }, ee = (s) => {
69
69
  var i;
70
- const e = (i = t == null ? void 0 : t.segments) == null ? void 0 : i[0];
70
+ const e = (i = s == null ? void 0 : s.segments) == null ? void 0 : i[0];
71
71
  return (e == null ? void 0 : e.marketingCarrier) ?? (e == null ? void 0 : e.operatingCarrier);
72
- }, se = (t) => {
72
+ }, se = (s) => {
73
73
  var e;
74
- return ee((e = t == null ? void 0 : t.slices) == null ? void 0 : e[0]);
75
- }, ye = (t) => !t.operatingCarrier || !t.marketingCarrier ? "" : t.operatingCarrier.iataCode !== t.marketingCarrier.iataCode ? t.operatingCarrier.name : "", Ce = ({
76
- originCode: t,
74
+ return ee((e = s == null ? void 0 : s.slices) == null ? void 0 : e[0]);
75
+ }, Ce = (s) => !s.operatingCarrier || !s.marketingCarrier ? "" : s.operatingCarrier.iataCode !== s.marketingCarrier.iataCode ? s.operatingCarrier.name : "", be = ({
76
+ originCode: s,
77
77
  destinationCode: e,
78
78
  dates: i,
79
- cabinClass: d,
79
+ cabinClass: m,
80
80
  passengerCount: o,
81
81
  paymentType: c
82
82
  }) => {
83
- let s = `${W.CASH_POINTS_FLIGHT_SEARCH}?`;
84
- return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, s += `&cabin_class=${d}`, s += `&adults=${o}`, s += `&cash_or_points=[${c}]`, s;
85
- }, te = (t) => t.flightDetails.slices[0].segments.map((i) => K(i)).join("_") + "_" + y(t.departureTime).format("YYYYMMDD"), be = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Fe = (t) => {
83
+ let t = `${V.CASH_POINTS_FLIGHT_SEARCH}?`;
84
+ return t += `origin=${s}`, t += `&destination=${e}`, t += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, t += `&cabin_class=${m}`, t += `&adults=${o}`, t += `&cash_or_points=[${c}]`, t;
85
+ }, te = (s) => s.flightDetails.slices[0].segments.map((i) => K(i)).join("_") + "_" + y(s.departureTime).format("YYYYMMDD"), Ae = (s) => s ? s.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", Fe = (s) => {
86
86
  const e = {};
87
- t.forEach((s) => {
87
+ s.forEach((t) => {
88
88
  var u, l;
89
- const a = te(s);
89
+ const a = te(t);
90
90
  if (e[a]) {
91
- const n = j(s);
91
+ const n = j(t);
92
92
  e[a].flight.paymentOptions.push(n);
93
- const { lowestCash: r, currency: m, lowestPoints: p, cashFee: g } = q(e[a].flight.paymentOptions);
94
- e[a].flight.points = p, e[a].flight.cashFee = g, e[a].flight.cash = r, m && (e[a].flight.currency = m);
93
+ const { lowestCash: r, currency: p, lowestPoints: d, cashFee: g } = q(e[a].flight.paymentOptions);
94
+ e[a].flight.points = d, e[a].flight.cashFee = g, e[a].flight.cash = r, p && (e[a].flight.currency = p);
95
95
  } else {
96
- const { origin: n, destination: r } = s, m = [j(s)], p = q(m);
96
+ const { origin: n, destination: r } = t, p = [j(t)], d = q(p);
97
97
  e[a] = {
98
98
  programs: [],
99
99
  flight: {
100
- id: s.awayzGroupId,
101
- partial: s.partial,
100
+ id: t.awayzGroupId,
101
+ partial: t.partial,
102
102
  origin: {
103
103
  city: n.city,
104
104
  country: n.country,
@@ -111,81 +111,81 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
111
111
  airportCode: r.airportCode,
112
112
  coordinates: r.coordinates
113
113
  },
114
- airline: s.airline,
115
- airlineLogo: s.airlineLogo,
116
- displayAirlineIataCode: s.displayAirlineIataCode,
117
- flightNumber: s.flightNumber,
118
- paymentOptions: m,
119
- numberOfStops: s.numberOfStops,
120
- departureTime: s.departureTime,
121
- arrivalTime: s.arrivalTime,
114
+ airline: t.airline,
115
+ airlineLogo: t.airlineLogo,
116
+ displayAirlineIataCode: t.displayAirlineIataCode,
117
+ flightNumber: t.flightNumber,
118
+ paymentOptions: p,
119
+ numberOfStops: t.numberOfStops,
120
+ departureTime: t.departureTime,
121
+ arrivalTime: t.arrivalTime,
122
122
  awayzGroupId: a,
123
- duration: s.duration,
124
- airlineProgram: s.airlineProgram,
123
+ duration: t.duration,
124
+ airlineProgram: t.airlineProgram,
125
125
  durationMinutes: H({
126
126
  departureTime: y(
127
- s.flightDetails.slices[0].segments[0].departingAt
127
+ t.flightDetails.slices[0].segments[0].departingAt
128
128
  ),
129
129
  arrivalTime: y(
130
- (u = s.flightDetails.slices[0].segments.getLast()) == null ? void 0 : u.arrivingAt
130
+ (u = t.flightDetails.slices[0].segments.getLast()) == null ? void 0 : u.arrivingAt
131
131
  ),
132
- originTimeZone: s.flightDetails.slices[0].segments[0].origin.timeZone,
133
- destinationTimeZone: (l = s.flightDetails.slices[0].segments.getLast()) == null ? void 0 : l.destination.timeZone,
134
- duration: s.flightDetails.slices[0].duration
132
+ originTimeZone: t.flightDetails.slices[0].segments[0].origin.timeZone,
133
+ destinationTimeZone: (l = t.flightDetails.slices[0].segments.getLast()) == null ? void 0 : l.destination.timeZone,
134
+ duration: t.flightDetails.slices[0].duration
135
135
  }),
136
- cash: p.lowestCash,
137
- points: p.lowestPoints,
138
- flightDetails: s.flightDetails,
139
- currency: s.flightDetails.baseCurrency,
140
- cashFee: s.cashFee,
141
- cabinClass: s.flightDetails.slices[0].segments[0].passengers[0].cabinClass || s.flightDetails.slices[0].segments[0].passengers[0].cabin.name || s.flightDetails.slices[0].segments[0].passengers[0].cabinClassMarketingName || s.flightDetails.slices[0].segments[0].passengers[0].cabin.marketingName,
142
- expiresAt: s.expiresAt,
143
- transferPartners: s.transferPartners || []
136
+ cash: d.lowestCash,
137
+ points: d.lowestPoints,
138
+ flightDetails: t.flightDetails,
139
+ currency: t.flightDetails.baseCurrency,
140
+ cashFee: t.cashFee,
141
+ cabinClass: t.flightDetails.slices[0].segments[0].passengers[0].cabinClass || t.flightDetails.slices[0].segments[0].passengers[0].cabin.name || t.flightDetails.slices[0].segments[0].passengers[0].cabinClassMarketingName || t.flightDetails.slices[0].segments[0].passengers[0].cabin.marketingName,
142
+ expiresAt: t.expiresAt,
143
+ transferPartners: t.transferPartners || []
144
144
  }
145
145
  };
146
146
  }
147
- s.airlineProgram && !e[a].programs.includes(s.airlineProgram) && e[a].programs.push(s.airlineProgram);
147
+ t.airlineProgram && !e[a].programs.includes(t.airlineProgram) && e[a].programs.push(t.airlineProgram);
148
148
  });
149
149
  const i = [];
150
- Object.values(e).forEach((s) => {
151
- const a = s.flight.paymentOptions.filter((n) => n.cash > 0).reduce(
150
+ Object.values(e).forEach((t) => {
151
+ const a = t.flight.paymentOptions.filter((n) => n.cash > 0).reduce(
152
152
  (n, r) => r.cash < n.cash ? r : n,
153
153
  { cash: 1 / 0, carrier: { name: "", iataCode: "" } }
154
154
  ), u = {
155
- iataCode: s.flight.displayAirlineIataCode,
156
- name: s.flight.airline
155
+ iataCode: t.flight.displayAirlineIataCode,
156
+ name: t.flight.airline
157
157
  }, l = a.cash !== 1 / 0 ? a.carrier : u;
158
- s.programs.length > 0 ? s.programs.forEach((n) => {
159
- const r = s.flight.paymentOptions.filter(
160
- (p) => p.program === n && p.points > 0
161
- ), m = r.length > 0 ? Math.min(...r.map((p) => p.points)) : -1;
158
+ t.programs.length > 0 ? t.programs.forEach((n) => {
159
+ const r = t.flight.paymentOptions.filter(
160
+ (d) => d.program === n && d.points > 0
161
+ ), p = r.length > 0 ? Math.min(...r.map((d) => d.points)) : -1;
162
162
  i.push({
163
- ...s.flight,
163
+ ...t.flight,
164
164
  airline: l.name,
165
165
  airlineLogo: C(l.iataCode),
166
166
  displayAirlineIataCode: l.iataCode,
167
167
  airlineProgram: n,
168
168
  cash: a.cash !== 1 / 0 ? a.cash : -1,
169
- points: m
169
+ points: p
170
170
  });
171
171
  }) : i.push({
172
- ...s.flight,
172
+ ...t.flight,
173
173
  airline: l.name,
174
174
  airlineLogo: C(l.iataCode),
175
175
  displayAirlineIataCode: l.iataCode,
176
176
  cash: a.cash !== 1 / 0 ? a.cash : -1
177
177
  });
178
178
  });
179
- const { cashlessResults: d, otherResults: o } = i.reduce(
180
- (s, a) => (a.cash <= 0 && a.points > 0 ? s.cashlessResults.push(a) : a.cash > 0 && s.otherResults.push(a), s),
179
+ const { cashlessResults: m, otherResults: o } = i.reduce(
180
+ (t, a) => (a.cash <= 0 && a.points > 0 ? t.cashlessResults.push(a) : a.cash > 0 && t.otherResults.push(a), t),
181
181
  { cashlessResults: [], otherResults: [] }
182
182
  ), c = [...o];
183
- return d.forEach((s) => {
183
+ return m.forEach((t) => {
184
184
  (!c.find(
185
- (u) => u.awayzGroupId === s.awayzGroupId
186
- ) || o.length === 0) && c.push(s);
185
+ (u) => u.awayzGroupId === t.awayzGroupId
186
+ ) || o.length === 0) && c.push(t);
187
187
  }), c;
188
- }, ae = (t) => t ? t.replace(/^0+/, "") : "", Ae = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${f}${t}.svg`, B = Y.logoFallbackImageUrl, x = {
188
+ }, ae = (s) => s ? s.replace(/^0+/, "") : "", Le = (s) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${s}.svg`, C = (s) => `${f}${s}.svg`, B = Y.logoFallbackImageUrl, x = {
189
189
  categoryLogo: B,
190
190
  programLogo: B,
191
191
  awayzActive: [],
@@ -197,59 +197,59 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
197
197
  colour: "#fff",
198
198
  // Using App Foreground Colour
199
199
  url: "https://www.odynn.com"
200
- }, we = async (t) => {
200
+ }, we = async (s) => {
201
201
  const { airlines: e } = await Q.ensureQueryData({
202
202
  queryKey: ["walletAwards"],
203
- queryFn: V.getAwards,
203
+ queryFn: J.getAwards,
204
204
  staleTime: 864e5
205
205
  // 24 hours
206
206
  });
207
207
  let i = e.find(
208
- (d) => {
209
- var o, c, s, a;
210
- return ((c = (o = d.mainProgram) == null ? void 0 : o.toLowerCase()) == null ? void 0 : c.includes(t == null ? void 0 : t.toLowerCase())) || ((a = (s = d.displayProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : a.includes(t == null ? void 0 : t.toLowerCase()));
208
+ (m) => {
209
+ var o, c, t, a;
210
+ return ((c = (o = m.mainProgram) == null ? void 0 : o.toLowerCase()) == null ? void 0 : c.includes(s == null ? void 0 : s.toLowerCase())) || ((a = (t = m.displayProgram) == null ? void 0 : t.toLowerCase()) == null ? void 0 : a.includes(s == null ? void 0 : s.toLowerCase()));
211
211
  }
212
212
  ) ?? x;
213
213
  return i || (i = {
214
214
  ...x,
215
- mainProgram: t,
216
- displayProgram: t,
217
- id: t
215
+ mainProgram: s,
216
+ displayProgram: s,
217
+ id: s
218
218
  }), i;
219
- }, j = (t) => {
220
- var o, c, s, a, u, l, n, r, m, p;
221
- const e = ((s = (c = (o = t.flightDetails.slices.getFirst()) == null ? void 0 : o.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : s.baggages) ?? [], i = ((l = (u = (a = t.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : u.passengers.getFirst()) == null ? void 0 : l.cabinClassMarketingName) ?? ((m = (r = (n = t.flightDetails.slices.getFirst()) == null ? void 0 : n.segments.getFirst()) == null ? void 0 : r.passengers.getFirst()) == null ? void 0 : m.cabinClass), d = e.map(
219
+ }, j = (s) => {
220
+ var o, c, t, a, u, l, n, r, p, d;
221
+ const e = ((t = (c = (o = s.flightDetails.slices.getFirst()) == null ? void 0 : o.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : t.baggages) ?? [], i = ((l = (u = (a = s.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : u.passengers.getFirst()) == null ? void 0 : l.cabinClassMarketingName) ?? ((p = (r = (n = s.flightDetails.slices.getFirst()) == null ? void 0 : n.segments.getFirst()) == null ? void 0 : r.passengers.getFirst()) == null ? void 0 : p.cabinClass), m = e.map(
222
222
  (g) => ({
223
- type: J(g.type),
223
+ type: W(g.type),
224
224
  quantity: g.quantity
225
225
  })
226
226
  );
227
227
  return {
228
- id: t.id,
229
- cash: t.cash,
230
- points: t.points,
231
- program: t.airlineProgram,
232
- baseCurrency: t.flightDetails.baseCurrency,
233
- fareBrandName: ((p = t.flightDetails.slices.getFirst()) == null ? void 0 : p.fareBrandName) ?? "",
228
+ id: s.id,
229
+ cash: s.cash,
230
+ points: s.points,
231
+ program: s.airlineProgram,
232
+ baseCurrency: s.flightDetails.baseCurrency,
233
+ fareBrandName: ((d = s.flightDetails.slices.getFirst()) == null ? void 0 : d.fareBrandName) ?? "",
234
234
  cabinClass: i,
235
- cashFee: t.cashFee,
236
- conditions: t.flightDetails.conditions,
237
- baggages: d,
235
+ cashFee: s.cashFee,
236
+ conditions: s.flightDetails.conditions,
237
+ baggages: m,
238
238
  // `carrier` is an existing unqualified field; semantics are marketing carrier.
239
239
  carrier: {
240
- iataCode: t.displayAirlineIataCode,
241
- name: t.airline
240
+ iataCode: s.displayAirlineIataCode,
241
+ name: s.airline
242
242
  }
243
243
  };
244
- }, q = (t) => {
245
- const e = t.filter((s) => s.cash > 0);
244
+ }, q = (s) => {
245
+ const e = s.filter((t) => t.cash > 0);
246
246
  let i = { cash: 1 / 0, baseCurrency: "" };
247
- for (const s of e)
248
- s.cash < i.cash && (i = s);
249
- const o = [...t].filter(
250
- (s) => s.points > 0
247
+ for (const t of e)
248
+ t.cash < i.cash && (i = t);
249
+ const o = [...s].filter(
250
+ (t) => t.points > 0
251
251
  ).reduce(
252
- (s, a) => a.points < s.points ? a : s,
252
+ (t, a) => a.points < t.points ? a : t,
253
253
  {
254
254
  points: 1 / 0,
255
255
  cashFee: {
@@ -264,19 +264,39 @@ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
264
264
  cashFee: o.cashFee,
265
265
  currency: i.baseCurrency === "" ? null : i.baseCurrency
266
266
  };
267
+ }, ie = (s) => [
268
+ ...Array.from({ length: s.adults }, () => ({
269
+ type: "adult"
270
+ /* ADULT */
271
+ })),
272
+ ...Array.from({ length: s.children }, () => ({
273
+ type: "child"
274
+ /* CHILD */
275
+ }))
276
+ ], De = (s) => {
277
+ const i = {
278
+ adults: (s == null ? void 0 : s.adults) ?? 1,
279
+ children: (s == null ? void 0 : s.children) ?? 0
280
+ }, m = ie(i);
281
+ return {
282
+ passengerCount: i.adults + i.children,
283
+ passengerList: m
284
+ };
267
285
  };
268
286
  export {
269
287
  x as DEFAULT_AIRLINE_PROGRAM,
270
- Ce as buildFlightSearchQuery,
271
- be as formatCabinClass,
288
+ be as buildFlightSearchQuery,
289
+ ie as buildPassengerArray,
290
+ Ae as formatCabinClass,
272
291
  we as getAirlineProgram,
273
292
  K as getFlightNumber,
274
293
  C as getFullLogoPath,
275
- Ae as getLogoPath,
276
- ye as getOperatedBy,
294
+ Le as getLogoPath,
295
+ Ce as getOperatedBy,
277
296
  se as getPrimaryDisplayCarrierForFlightOffer,
278
297
  ee as getPrimaryDisplayCarrierForSlice,
279
298
  Fe as groupFlightResults,
280
- ge as mapDataToFlightDetails,
299
+ ye as mapDataToFlightDetails,
300
+ De as passengerValues,
281
301
  ae as removeLeadingZeros
282
302
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.10.11",
3
+ "version": "0.10.13",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"