@odynn/awayz-flights 0.2.5 → 0.2.6

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.
@@ -86,10 +86,7 @@ export interface IFlightPaymentOption {
86
86
  type: EBaggage | null;
87
87
  quantity: number;
88
88
  }[];
89
- conditions: {
90
- refundBeforeDeparture?: boolean;
91
- changeBeforeDeparture?: boolean;
92
- };
89
+ conditions: IOfferConditions;
93
90
  carrier: {
94
91
  iataCode: string;
95
92
  name: string;
@@ -4,8 +4,8 @@ import "react";
4
4
  import { awayzClient as q } from "@odynn/awayz-core";
5
5
  import { WalletService as Q } from "../services/wallet/WalletService.js";
6
6
  import { ERewardProgramCategories as V } from "../services/wallet/WalletService.types.js";
7
- const G = (s) => s == null ? void 0 : s.map((e) => {
8
- var r, t, a, n, i, o, m, w, g, M, P, N, A, L, h, d, p, c, y, C, b, l, u, D, k, O, f, z, v, _, $, Z, B, E;
7
+ const R = (s) => s == null ? void 0 : s.map((e) => {
8
+ var r, t, a, n, i, o, m, w, g, M, P, N, A, L, h, d, p, c, y, C, b, l, u, D, k, O, z, v, _, $, Z, f, E, G;
9
9
  return {
10
10
  id: e.id,
11
11
  points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
@@ -22,10 +22,10 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
22
22
  destination: {
23
23
  city: ((h = (L = e.slices[0].segments.getLast()) == null ? void 0 : L.destination) == null ? void 0 : h.cityName) || ((c = (p = (d = e.slices[0].segments.getLast()) == null ? void 0 : d.destination) == null ? void 0 : p.city) == null ? void 0 : c.name),
24
24
  country: ((C = (y = e.slices[0].segments.getLast()) == null ? void 0 : y.destination) == null ? void 0 : C.iataCountryCode) || ((u = (l = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : l.city) == null ? void 0 : u.iataCountryCode),
25
- airportCode: ((k = (D = e.slices[0].segments.getLast()) == null ? void 0 : D.destination) == null ? void 0 : k.iataCityCode) || ((z = (f = (O = e.slices[0].segments.getLast()) == null ? void 0 : O.destination) == null ? void 0 : f.city) == null ? void 0 : z.iataCode),
25
+ airportCode: ((k = (D = e.slices[0].segments.getLast()) == null ? void 0 : D.destination) == null ? void 0 : k.iataCityCode) || ((v = (z = (O = e.slices[0].segments.getLast()) == null ? void 0 : O.destination) == null ? void 0 : z.city) == null ? void 0 : v.iataCode),
26
26
  coordinates: {
27
- latitude: ($ = (_ = (v = e.slices[0].segments.getLast()) == null ? void 0 : v.destination) == null ? void 0 : _.city) == null ? void 0 : $.latitude,
28
- longitude: (E = (B = (Z = e.slices[0].segments.getLast()) == null ? void 0 : Z.destination) == null ? void 0 : B.city) == null ? void 0 : E.longitude
27
+ latitude: (Z = ($ = (_ = e.slices[0].segments.getLast()) == null ? void 0 : _.destination) == null ? void 0 : $.city) == null ? void 0 : Z.latitude,
28
+ longitude: (G = (E = (f = e.slices[0].segments.getLast()) == null ? void 0 : f.destination) == null ? void 0 : E.city) == null ? void 0 : G.longitude
29
29
  }
30
30
  },
31
31
  airline: e.owner.name,
@@ -53,7 +53,7 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
53
53
  };
54
54
  }), ee = (s, e) => {
55
55
  if (!(e != null && e.length))
56
- return G(s);
56
+ return R(s);
57
57
  const r = [...e], t = [], a = {};
58
58
  for (const i of s) {
59
59
  const o = i.slices[0].segments, m = o[0], w = {
@@ -105,7 +105,7 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
105
105
  }
106
106
  return [
107
107
  ...r,
108
- ...G(t) ?? []
108
+ ...R(t) ?? []
109
109
  ];
110
110
  }, j = (s) => {
111
111
  const e = s.operatingCarrierFlightNumber ? s.operatingCarrier : s.marketingCarrier, r = s.operatingCarrierFlightNumber ?? s.marketingCarrierFlightNumber;
@@ -196,9 +196,9 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
196
196
  });
197
197
  }) : r.push(t.flight);
198
198
  }), r;
199
- }, T = (s) => s ? s.replace(/^0+/, "") : "", ie = (s) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${s}.svg`, R = "/img/logo/odynn-eye.svg", S = {
200
- categoryLogo: R,
201
- programLogo: R,
199
+ }, T = (s) => s ? s.replace(/^0+/, "") : "", ie = (s) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${s}.svg`, S = "/img/logo/odynn-eye.svg", B = {
200
+ categoryLogo: S,
201
+ programLogo: S,
202
202
  awayzActive: [],
203
203
  mainProgram: "Unknown",
204
204
  displayProgram: "Unknown",
@@ -220,33 +220,27 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
220
220
  var a, n, i, o;
221
221
  return ((n = (a = t.mainProgram) == null ? void 0 : a.toLowerCase()) == null ? void 0 : n.includes(s == null ? void 0 : s.toLowerCase())) || ((o = (i = t.displayProgram) == null ? void 0 : i.toLowerCase()) == null ? void 0 : o.includes(s == null ? void 0 : s.toLowerCase()));
222
222
  }
223
- ) ?? S;
223
+ ) ?? B;
224
224
  return r || (r = {
225
- ...S,
225
+ ...B,
226
226
  mainProgram: s,
227
227
  displayProgram: s,
228
228
  id: s
229
229
  }), r;
230
- }, U = (s) => {
231
- var e, r, t, a;
232
- return {
233
- id: s.id,
234
- cash: s.cash,
235
- points: s.points,
236
- program: s.airlineProgram,
237
- baseCurrency: s.flightDetails.baseCurrency,
238
- fareBrandName: s.flightDetails.slices[0].fareBrandName,
239
- cashFee: s.cashFee,
240
- conditions: {
241
- refundBeforeDeparture: (r = (e = s.flightDetails.conditions) == null ? void 0 : e.refundBeforeDeparture) == null ? void 0 : r.allowed,
242
- changeBeforeDeparture: (a = (t = s.flightDetails.conditions) == null ? void 0 : t.changeBeforeDeparture) == null ? void 0 : a.allowed
243
- },
244
- carrier: {
245
- iataCode: s.flightDetails.slices[0].segments[0].marketingCarrier.iataCode,
246
- name: s.flightDetails.slices[0].segments[0].marketingCarrier.name
247
- }
248
- };
249
- }, I = (s) => {
230
+ }, U = (s) => ({
231
+ id: s.id,
232
+ cash: s.cash,
233
+ points: s.points,
234
+ program: s.airlineProgram,
235
+ baseCurrency: s.flightDetails.baseCurrency,
236
+ fareBrandName: s.flightDetails.slices[0].fareBrandName,
237
+ cashFee: s.cashFee,
238
+ conditions: s.flightDetails.conditions,
239
+ carrier: {
240
+ iataCode: s.flightDetails.slices[0].segments[0].marketingCarrier.iataCode,
241
+ name: s.flightDetails.slices[0].segments[0].marketingCarrier.name
242
+ }
243
+ }), I = (s) => {
250
244
  const e = Math.min(
251
245
  ...s.filter((t) => t.cash > 0).map((t) => t.cash)
252
246
  ), r = Math.min(
@@ -258,13 +252,13 @@ const G = (s) => s == null ? void 0 : s.map((e) => {
258
252
  };
259
253
  };
260
254
  export {
261
- S as DEFAULT_AIRLINE_PROGRAM,
255
+ B as DEFAULT_AIRLINE_PROGRAM,
262
256
  te as buildFlightSearchQuery,
263
257
  ae as getAirlineProgram,
264
258
  j as getFlightNumber,
265
259
  ie as getLogoPath,
266
260
  se as groupFlightResults,
267
- G as mapFlightDetailsToResults,
261
+ R as mapFlightDetailsToResults,
268
262
  ee as parseFlightDetails,
269
263
  T as removeLeadingZeros
270
264
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-flights",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"