@odynn/awayz-flights 0.10.1 → 0.10.3

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.
@@ -8,10 +8,10 @@ import '../../assets/MiniFlightItinerary.css';const I = ({
8
8
  flightDetails: A
9
9
  }) => {
10
10
  const a = A.flightDetails.slices[0].segments, T = y(() => {
11
- var t, l, n, s, p, h, g, u;
11
+ var t, l, d, n, m, h, g, u;
12
12
  const i = [];
13
- for (let m = 0; m < a.length; m++) {
14
- const r = a[m], d = a[m + 1], L = v({
13
+ for (let c = 0; c < a.length; c++) {
14
+ const r = a[c], s = a[c + 1], L = v({
15
15
  departureAt: r.departingAt,
16
16
  departureTimeZone: r.origin.timeZone,
17
17
  arrivalAt: r.arrivingAt,
@@ -23,45 +23,45 @@ import '../../assets/MiniFlightItinerary.css';const I = ({
23
23
  airport: (l = r.origin) == null ? void 0 : l.name
24
24
  },
25
25
  arrival: {
26
- code: (n = r.destination) == null ? void 0 : n.iataCode,
27
- airport: (s = r.destination) == null ? void 0 : s.name
26
+ code: (d = r.destination) == null ? void 0 : d.iataCode,
27
+ airport: (n = r.destination) == null ? void 0 : n.name
28
28
  },
29
29
  time: L
30
- }), !d)
30
+ }), !s)
31
31
  break;
32
32
  const Z = v({
33
33
  departureAt: r.arrivingAt,
34
34
  departureTimeZone: r.destination.timeZone,
35
- arrivalAt: d.departingAt,
36
- arrivalTimeZone: d.origin.timeZone
35
+ arrivalAt: s.departingAt,
36
+ arrivalTimeZone: s.origin.timeZone
37
37
  });
38
38
  i.push({
39
39
  departure: {
40
- code: (p = r.destination) == null ? void 0 : p.iataCode,
40
+ code: (m = r.destination) == null ? void 0 : m.iataCode,
41
41
  airport: (h = r.destination) == null ? void 0 : h.name
42
42
  },
43
43
  arrival: {
44
- code: (g = d.origin) == null ? void 0 : g.iataCode,
45
- airport: (u = d.origin) == null ? void 0 : u.name
44
+ code: (g = s.origin) == null ? void 0 : g.iataCode,
45
+ airport: (u = s.origin) == null ? void 0 : u.name
46
46
  },
47
47
  time: Z,
48
48
  isLayover: !0
49
49
  });
50
50
  }
51
51
  return i;
52
- }, [a]), c = y(() => {
53
- var t, l;
52
+ }, [a]), p = y(() => {
53
+ var t, l, d;
54
54
  const i = [];
55
55
  for (let n = 0; n < a.length; n++) {
56
- const s = a[n];
57
- i.push(((t = s.origin) == null ? void 0 : t.iataCode) ?? "");
56
+ const m = a[n];
57
+ i.push(((t = m.origin) == null ? void 0 : t.iataCode) ?? "");
58
58
  }
59
- return i.push(((l = a.getLast().destination) == null ? void 0 : l.iataCode) ?? ""), i;
59
+ return i.push(((d = (l = a.getLast()) == null ? void 0 : l.destination) == null ? void 0 : d.iataCode) ?? ""), i;
60
60
  }, [a]);
61
61
  return /* @__PURE__ */ o(b, { children: [
62
- /* @__PURE__ */ e("div", { className: "mobile-mini-flight-itinerary", children: c.map((i, t) => /* @__PURE__ */ o("div", { children: [
62
+ /* @__PURE__ */ e("div", { className: "mobile-mini-flight-itinerary", children: p.map((i, t) => /* @__PURE__ */ o("div", { children: [
63
63
  /* @__PURE__ */ e("p", { children: i }),
64
- t < c.length - 1 && /* @__PURE__ */ e(D, {})
64
+ t < p.length - 1 && /* @__PURE__ */ e(D, {})
65
65
  ] }, t)) }),
66
66
  /* @__PURE__ */ e("div", { className: "mini-flight-itinerary", children: T.map(
67
67
  (i, t) => i.isLayover ? /* @__PURE__ */ o("div", { className: "layover tip", children: [
@@ -1,35 +1,35 @@
1
- import { defaultAwayzConfig as H, awayzClient as K } from "@odynn/awayz-core";
2
- import { d as j } from "../dateUtils-Cb9VQiIL.js";
1
+ import { defaultAwayzConfig as Y, awayzClient as Q } from "@odynn/awayz-core";
2
+ import { d as H } from "../dateUtils-Cb9VQiIL.js";
3
3
  import "../arrayExtensions-Ce8YopTP.js";
4
4
  import "react";
5
- import { h as g } from "../moment-BGjjqtLQ.js";
6
- import { EFlightEndpoint as Y } from "../constants/endpoints.js";
7
- import { mapBaggageType as Q } from "../hooks/useFlightSearch/useFlightSearch.types.js";
8
- import { WalletService as W } from "../services/wallet/WalletService.js";
9
- import { ERewardProgramCategories as J } from "../services/wallet/WalletService.types.js";
10
- const V = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", me = (t) => t == null ? void 0 : t.map((e) => {
11
- var m, o, c, s, a, l, n, r, p, u, d, y, b, F, A, w, L, D, I, P, T, h, k, O, R, _, v, E, M, $, z, G, Z, S;
12
- const i = f(e);
5
+ import { h as y } from "../moment-BGjjqtLQ.js";
6
+ import { EFlightEndpoint as W } from "../constants/endpoints.js";
7
+ import { mapBaggageType as J } from "../hooks/useFlightSearch/useFlightSearch.types.js";
8
+ import { WalletService as V } from "../services/wallet/WalletService.js";
9
+ import { ERewardProgramCategories as X } from "../services/wallet/WalletService.types.js";
10
+ const f = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", ue = (t) => t == null ? void 0 : t.map((e) => {
11
+ 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;
12
+ const i = se(e);
13
13
  return {
14
14
  id: e.id,
15
15
  points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
16
16
  partial: e == null ? void 0 : e.partial,
17
17
  origin: {
18
- 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),
19
- country: ((s = e.slices[0].segments[0].origin) == null ? void 0 : s.iataCountryCode) || ((l = (a = e.slices[0].segments[0].origin) == null ? void 0 : a.city) == null ? void 0 : l.iataCountryCode),
20
- airportCode: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.iataCode) || ((p = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : p.iataCode),
18
+ 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) || "",
19
+ 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) || "",
20
+ 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) || "",
21
21
  coordinates: {
22
- latitude: (d = (u = e.slices[0].segments[0].origin) == null ? void 0 : u.city) == null ? void 0 : d.latitude,
23
- longitude: (b = (y = e.slices[0].segments[0].origin) == null ? void 0 : y.city) == null ? void 0 : b.longitude
22
+ latitude: ((p = (m = e.slices[0].segments[0].origin) == null ? void 0 : m.city) == null ? void 0 : p.latitude) || 0,
23
+ longitude: ((b = (g = e.slices[0].segments[0].origin) == null ? void 0 : g.city) == null ? void 0 : b.longitude) || 0
24
24
  }
25
25
  },
26
26
  destination: {
27
- 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),
28
- 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),
29
- 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),
27
+ 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) || "",
28
+ 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) || "",
29
+ 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) || "",
30
30
  coordinates: {
31
- latitude: (z = ($ = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : $.city) == null ? void 0 : z.latitude,
32
- longitude: (S = (Z = (G = e.slices[0].segments.getLast()) == null ? void 0 : G.destination) == null ? void 0 : Z.city) == null ? void 0 : S.longitude
31
+ latitude: ((z = ($ = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : $.city) == null ? void 0 : z.latitude) || 0,
32
+ longitude: ((S = (Z = (G = e.slices[0].segments.getLast()) == null ? void 0 : G.destination) == null ? void 0 : Z.city) == null ? void 0 : S.longitude) || 0
33
33
  }
34
34
  },
35
35
  // `airline` is an existing unqualified field; semantics are display-primary carrier.
@@ -38,10 +38,10 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
38
38
  displayAirlineIataCode: (i == null ? void 0 : i.iataCode) ?? "",
39
39
  cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
40
40
  currency: e.baseCurrency,
41
- flightNumber: q(e.slices[0].segments[0]),
41
+ flightNumber: K(e.slices[0].segments[0]),
42
42
  awayzGroupId: e.slices[0].comparisonKey || e.awayzRouteId || e.awayzGroupId || e.id,
43
- departureTime: g(e.slices[0].segments[0].departingAt).toDate(),
44
- arrivalTime: g(
43
+ departureTime: y(e.slices[0].segments[0].departingAt).toDate(),
44
+ arrivalTime: y(
45
45
  e.slices[0].segments[e.slices[0].segments.length - 1].arrivingAt
46
46
  ).toDate(),
47
47
  numberOfStops: e.slices[0].segments.length - 1,
@@ -49,11 +49,11 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
49
49
  duration: e.slices[0].duration,
50
50
  airlineProgram: e.airlineProgram,
51
51
  paymentOptions: [],
52
- durationMinutes: j({
53
- departureTime: g(e.slices[0].segments[0].departingAt),
54
- arrivalTime: g(e.slices[0].segments.getLast().arrivingAt),
52
+ durationMinutes: H({
53
+ departureTime: y(e.slices[0].segments[0].departingAt),
54
+ arrivalTime: y((U = e.slices[0].segments.getLast()) == null ? void 0 : U.arrivingAt),
55
55
  originTimeZone: e.slices[0].segments[0].origin.timeZone,
56
- destinationTimeZone: e.slices[0].segments.getLast().destination.timeZone,
56
+ destinationTimeZone: (N = e.slices[0].segments.getLast()) == null ? void 0 : N.destination.timeZone,
57
57
  duration: e.slices[0].duration
58
58
  }),
59
59
  cashFee: e.cashFee,
@@ -61,74 +61,75 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
61
61
  expiresAt: e.expiresAt,
62
62
  transferPartners: e.partners
63
63
  };
64
- }), q = (t) => {
64
+ }), K = (t) => {
65
65
  const e = t.marketingCarrier ?? t.operatingCarrier, i = t.marketingCarrierFlightNumber ?? t.operatingCarrierFlightNumber;
66
- return e.iataCode + " " + se(i);
67
- }, X = (t) => {
66
+ return e.iataCode + " " + ae(i);
67
+ }, ee = (t) => {
68
68
  var i;
69
69
  const e = (i = t == null ? void 0 : t.segments) == null ? void 0 : i[0];
70
70
  return (e == null ? void 0 : e.marketingCarrier) ?? (e == null ? void 0 : e.operatingCarrier);
71
- }, f = (t) => {
71
+ }, se = (t) => {
72
72
  var e;
73
- return X((e = t == null ? void 0 : t.slices) == null ? void 0 : e[0]);
74
- }, de = (t) => !t.operatingCarrier || !t.marketingCarrier ? "" : t.operatingCarrier.iataCode !== t.marketingCarrier.iataCode ? t.operatingCarrier.name : "", ue = ({
73
+ return ee((e = t == null ? void 0 : t.slices) == null ? void 0 : e[0]);
74
+ }, ge = (t) => !t.operatingCarrier || !t.marketingCarrier ? "" : t.operatingCarrier.iataCode !== t.marketingCarrier.iataCode ? t.operatingCarrier.name : "", ye = ({
75
75
  originCode: t,
76
76
  destinationCode: e,
77
77
  dates: i,
78
- cabinClass: m,
78
+ cabinClass: d,
79
79
  passengerCount: o,
80
80
  paymentType: c
81
81
  }) => {
82
- let s = `${Y.CASH_POINTS_FLIGHT_SEARCH}?`;
83
- return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, s += `&cabin_class=${m}`, s += `&adults=${o}`, s += `&cash_or_points=[${c}]`, s;
84
- }, ee = (t) => t.flightDetails.slices[0].segments.map((i) => q(i)).join("_") + "_" + g(t.departureTime).format("YYYYMMDD"), ge = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", ye = (t) => {
82
+ let s = `${W.CASH_POINTS_FLIGHT_SEARCH}?`;
83
+ 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;
84
+ }, te = (t) => t.flightDetails.slices[0].segments.map((i) => K(i)).join("_") + "_" + y(t.departureTime).format("YYYYMMDD"), Ce = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", be = (t) => {
85
85
  const e = {};
86
86
  t.forEach((s) => {
87
- const a = ee(s);
87
+ var u, l;
88
+ const a = te(s);
88
89
  if (e[a]) {
89
- const l = B(s);
90
- e[a].flight.paymentOptions.push(l);
91
- const { lowestCash: n, currency: r, lowestPoints: p, cashFee: u } = x(e[a].flight.paymentOptions);
92
- e[a].flight.points = p, e[a].flight.cashFee = u, e[a].flight.cash = n, r && (e[a].flight.currency = r);
90
+ const n = j(s);
91
+ e[a].flight.paymentOptions.push(n);
92
+ const { lowestCash: r, currency: m, lowestPoints: p, cashFee: g } = q(e[a].flight.paymentOptions);
93
+ e[a].flight.points = p, e[a].flight.cashFee = g, e[a].flight.cash = r, m && (e[a].flight.currency = m);
93
94
  } else {
94
- const { origin: l, destination: n } = s, r = [B(s)], p = x(r);
95
+ const { origin: n, destination: r } = s, m = [j(s)], p = q(m);
95
96
  e[a] = {
96
97
  programs: [],
97
98
  flight: {
98
99
  id: s.awayzGroupId,
99
100
  partial: s.partial,
100
101
  origin: {
101
- city: l.city,
102
- country: l.country,
103
- airportCode: l.airportCode,
104
- coordinates: l.coordinates
105
- },
106
- destination: {
107
102
  city: n.city,
108
103
  country: n.country,
109
104
  airportCode: n.airportCode,
110
105
  coordinates: n.coordinates
111
106
  },
107
+ destination: {
108
+ city: r.city,
109
+ country: r.country,
110
+ airportCode: r.airportCode,
111
+ coordinates: r.coordinates
112
+ },
112
113
  airline: s.airline,
113
114
  airlineLogo: s.airlineLogo,
114
115
  displayAirlineIataCode: s.displayAirlineIataCode,
115
116
  flightNumber: s.flightNumber,
116
- paymentOptions: r,
117
+ paymentOptions: m,
117
118
  numberOfStops: s.numberOfStops,
118
119
  departureTime: s.departureTime,
119
120
  arrivalTime: s.arrivalTime,
120
121
  awayzGroupId: a,
121
122
  duration: s.duration,
122
123
  airlineProgram: s.airlineProgram,
123
- durationMinutes: j({
124
- departureTime: g(
124
+ durationMinutes: H({
125
+ departureTime: y(
125
126
  s.flightDetails.slices[0].segments[0].departingAt
126
127
  ),
127
- arrivalTime: g(
128
- s.flightDetails.slices[0].segments.getLast().arrivingAt
128
+ arrivalTime: y(
129
+ (u = s.flightDetails.slices[0].segments.getLast()) == null ? void 0 : u.arrivingAt
129
130
  ),
130
131
  originTimeZone: s.flightDetails.slices[0].segments[0].origin.timeZone,
131
- destinationTimeZone: s.flightDetails.slices[0].segments.getLast().destination.timeZone,
132
+ destinationTimeZone: (l = s.flightDetails.slices[0].segments.getLast()) == null ? void 0 : l.destination.timeZone,
132
133
  duration: s.flightDetails.slices[0].duration
133
134
  }),
134
135
  cash: p.lowestCash,
@@ -146,80 +147,80 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
146
147
  });
147
148
  const i = [];
148
149
  Object.values(e).forEach((s) => {
149
- const a = s.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
150
- (r, p) => p.cash < r.cash ? p : r,
150
+ const a = s.flight.paymentOptions.filter((n) => n.cash > 0).reduce(
151
+ (n, r) => r.cash < n.cash ? r : n,
151
152
  { cash: 1 / 0, carrier: { name: "", iataCode: "" } }
152
- ), l = {
153
+ ), u = {
153
154
  iataCode: s.flight.displayAirlineIataCode,
154
155
  name: s.flight.airline
155
- }, n = a.cash !== 1 / 0 ? a.carrier : l;
156
- s.programs.length > 0 ? s.programs.forEach((r) => {
157
- const p = s.flight.paymentOptions.filter(
158
- (d) => d.program === r && d.points > 0
159
- ), u = p.length > 0 ? Math.min(...p.map((d) => d.points)) : -1;
156
+ }, l = a.cash !== 1 / 0 ? a.carrier : u;
157
+ s.programs.length > 0 ? s.programs.forEach((n) => {
158
+ const r = s.flight.paymentOptions.filter(
159
+ (p) => p.program === n && p.points > 0
160
+ ), m = r.length > 0 ? Math.min(...r.map((p) => p.points)) : -1;
160
161
  i.push({
161
162
  ...s.flight,
162
- airline: n.name,
163
- airlineLogo: C(n.iataCode),
164
- displayAirlineIataCode: n.iataCode,
165
- airlineProgram: r,
163
+ airline: l.name,
164
+ airlineLogo: C(l.iataCode),
165
+ displayAirlineIataCode: l.iataCode,
166
+ airlineProgram: n,
166
167
  cash: a.cash !== 1 / 0 ? a.cash : -1,
167
- points: u
168
+ points: m
168
169
  });
169
170
  }) : i.push({
170
171
  ...s.flight,
171
- airline: n.name,
172
- airlineLogo: C(n.iataCode),
173
- displayAirlineIataCode: n.iataCode,
172
+ airline: l.name,
173
+ airlineLogo: C(l.iataCode),
174
+ displayAirlineIataCode: l.iataCode,
174
175
  cash: a.cash !== 1 / 0 ? a.cash : -1
175
176
  });
176
177
  });
177
- const { cashlessResults: m, otherResults: o } = i.reduce(
178
+ const { cashlessResults: d, otherResults: o } = i.reduce(
178
179
  (s, a) => (a.cash <= 0 && a.points > 0 ? s.cashlessResults.push(a) : a.cash > 0 && s.otherResults.push(a), s),
179
180
  { cashlessResults: [], otherResults: [] }
180
181
  ), c = [...o];
181
- return m.forEach((s) => {
182
+ return d.forEach((s) => {
182
183
  (!c.find(
183
- (l) => l.awayzGroupId === s.awayzGroupId
184
+ (u) => u.awayzGroupId === s.awayzGroupId
184
185
  ) || o.length === 0) && c.push(s);
185
186
  }), c;
186
- }, se = (t) => t ? t.replace(/^0+/, "") : "", Ce = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${V}${t}.svg`, U = H.logoFallbackImageUrl, N = {
187
- categoryLogo: U,
188
- programLogo: U,
187
+ }, ae = (t) => t ? t.replace(/^0+/, "") : "", Fe = (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
+ categoryLogo: B,
189
+ programLogo: B,
189
190
  awayzActive: [],
190
191
  mainProgram: "Unknown",
191
192
  displayProgram: "Unknown",
192
193
  id: "Unknown",
193
194
  totalAccumulatedPoints: 0,
194
- category: J.Airline,
195
+ category: X.Airline,
195
196
  colour: "#fff",
196
197
  // Using App Foreground Colour
197
198
  url: "https://www.odynn.com"
198
- }, be = async (t) => {
199
- const { airlines: e } = await K.ensureQueryData({
199
+ }, Ae = async (t) => {
200
+ const { airlines: e } = await Q.ensureQueryData({
200
201
  queryKey: ["walletAwards"],
201
- queryFn: W.getAwards,
202
+ queryFn: V.getAwards,
202
203
  staleTime: 864e5
203
204
  // 24 hours
204
205
  });
205
206
  let i = e.find(
206
- (m) => {
207
+ (d) => {
207
208
  var o, c, s, a;
208
- return ((c = (o = m.mainProgram) == null ? void 0 : o.toLowerCase()) == null ? void 0 : c.includes(t == null ? void 0 : t.toLowerCase())) || ((a = (s = m.displayProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : a.includes(t == null ? void 0 : t.toLowerCase()));
209
+ 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()));
209
210
  }
210
- ) ?? N;
211
+ ) ?? x;
211
212
  return i || (i = {
212
- ...N,
213
+ ...x,
213
214
  mainProgram: t,
214
215
  displayProgram: t,
215
216
  id: t
216
217
  }), i;
217
- }, B = (t) => {
218
- var o, c, s, a, l, n, r, p, u, d;
219
- 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 = ((n = (l = (a = t.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : l.passengers.getFirst()) == null ? void 0 : n.cabinClassMarketingName) ?? ((u = (p = (r = t.flightDetails.slices.getFirst()) == null ? void 0 : r.segments.getFirst()) == null ? void 0 : p.passengers.getFirst()) == null ? void 0 : u.cabinClass), m = e.map(
220
- (y) => ({
221
- type: Q(y.type),
222
- quantity: y.quantity
218
+ }, j = (t) => {
219
+ var o, c, s, a, u, l, n, r, m, p;
220
+ 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(
221
+ (g) => ({
222
+ type: J(g.type),
223
+ quantity: g.quantity
223
224
  })
224
225
  );
225
226
  return {
@@ -228,18 +229,18 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
228
229
  points: t.points,
229
230
  program: t.airlineProgram,
230
231
  baseCurrency: t.flightDetails.baseCurrency,
231
- fareBrandName: (d = t.flightDetails.slices.getFirst()) == null ? void 0 : d.fareBrandName,
232
+ fareBrandName: ((p = t.flightDetails.slices.getFirst()) == null ? void 0 : p.fareBrandName) ?? "",
232
233
  cabinClass: i,
233
234
  cashFee: t.cashFee,
234
235
  conditions: t.flightDetails.conditions,
235
- baggages: m,
236
+ baggages: d,
236
237
  // `carrier` is an existing unqualified field; semantics are marketing carrier.
237
238
  carrier: {
238
239
  iataCode: t.displayAirlineIataCode,
239
240
  name: t.airline
240
241
  }
241
242
  };
242
- }, x = (t) => {
243
+ }, q = (t) => {
243
244
  const e = t.filter((s) => s.cash > 0);
244
245
  let i = { cash: 1 / 0, baseCurrency: "" };
245
246
  for (const s of e)
@@ -264,17 +265,17 @@ const V = "https://assets.duffel.com/img/airlines/for-light-background/full-colo
264
265
  };
265
266
  };
266
267
  export {
267
- N as DEFAULT_AIRLINE_PROGRAM,
268
- ue as buildFlightSearchQuery,
269
- ge as formatCabinClass,
270
- be as getAirlineProgram,
271
- q as getFlightNumber,
268
+ x as DEFAULT_AIRLINE_PROGRAM,
269
+ ye as buildFlightSearchQuery,
270
+ Ce as formatCabinClass,
271
+ Ae as getAirlineProgram,
272
+ K as getFlightNumber,
272
273
  C as getFullLogoPath,
273
- Ce as getLogoPath,
274
- de as getOperatedBy,
275
- f as getPrimaryDisplayCarrierForFlightOffer,
276
- X as getPrimaryDisplayCarrierForSlice,
277
- ye as groupFlightResults,
278
- me as mapDataToFlightDetails,
279
- se as removeLeadingZeros
274
+ Fe as getLogoPath,
275
+ ge as getOperatedBy,
276
+ se as getPrimaryDisplayCarrierForFlightOffer,
277
+ ee as getPrimaryDisplayCarrierForSlice,
278
+ be as groupFlightResults,
279
+ ue as mapDataToFlightDetails,
280
+ ae as removeLeadingZeros
280
281
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"