@odynn/awayz-flights 0.1.25 → 0.1.27
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.
- package/dist/{FlightItinerary-C-fQZjL3.js → FlightItinerary-DgpK1LYF.js} +15 -15
- package/dist/components/FlightItinerary/FlightItinerary.js +2 -2
- package/dist/components/FlightResult/FlightResult.js +2 -2
- package/dist/{dateUtils-vgrvV5fG.js → dateUtils-DeNLG5hw.js} +2 -2
- package/dist/hooks/useFlightSearch/useFlightSearch.js +19 -18
- package/dist/stores/useFlightStore.js +14 -14
- package/dist/utils/flightUtils.js +85 -87
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsxs as a, jsx as c, Fragment as B } from "react/jsx-runtime";
|
|
|
2
2
|
import g, { useMemo as k } from "react";
|
|
3
3
|
import { l as G, h as A } from "./arrayExtensions-DWKenJCh.js";
|
|
4
4
|
import { ECabinClass as I } from "./types/enums.js";
|
|
5
|
-
import { a as E, b as
|
|
5
|
+
import { a as E, b as V, d as Z } from "./dateUtils-DeNLG5hw.js";
|
|
6
6
|
import { DUFFEL_ASSET_PATH as K } from "./constants/constants.js";
|
|
7
7
|
import './assets/FlightItinerary.css';const w = (e) => {
|
|
8
8
|
var t;
|
|
@@ -82,7 +82,7 @@ function ee(e, t) {
|
|
|
82
82
|
if (typeof e != "object" || !e) return e;
|
|
83
83
|
var r = e[Symbol.toPrimitive];
|
|
84
84
|
if (r !== void 0) {
|
|
85
|
-
var i = r.call(e, t);
|
|
85
|
+
var i = r.call(e, t || "default");
|
|
86
86
|
if (typeof i != "object") return i;
|
|
87
87
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
88
88
|
}
|
|
@@ -122,13 +122,13 @@ function te(e) {
|
|
|
122
122
|
return z !== void 0 ? /* @__PURE__ */ g.createElement(z.Consumer, null, (r) => t(r)) : t(U);
|
|
123
123
|
}
|
|
124
124
|
function $(e) {
|
|
125
|
-
return F({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" }, child: [] }] })(e);
|
|
125
|
+
return F({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" }, child: [] }] })(e);
|
|
126
126
|
}
|
|
127
127
|
function me(e) {
|
|
128
|
-
return F({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, child: [] }] })(e);
|
|
128
|
+
return F({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, child: [] }] })(e);
|
|
129
129
|
}
|
|
130
130
|
function re(e) {
|
|
131
|
-
return F({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z" }, child: [] }] })(e);
|
|
131
|
+
return F({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z" }, child: [] }] })(e);
|
|
132
132
|
}
|
|
133
133
|
const se = ({
|
|
134
134
|
itinerary: e,
|
|
@@ -139,15 +139,15 @@ const se = ({
|
|
|
139
139
|
}) => {
|
|
140
140
|
var d, l, v, D, y, j;
|
|
141
141
|
const m = () => I.ECONOMY, p = k(() => {
|
|
142
|
-
var
|
|
142
|
+
var h, b, C, O, T, M, N;
|
|
143
143
|
const n = [];
|
|
144
|
-
for (let
|
|
145
|
-
const u = e[
|
|
144
|
+
for (let f = 0; f < e.length; f++) {
|
|
145
|
+
const u = e[f], s = e[f + 1];
|
|
146
146
|
if (!s)
|
|
147
147
|
break;
|
|
148
148
|
const x = {
|
|
149
149
|
arrival: {
|
|
150
|
-
airport: (
|
|
150
|
+
airport: (h = u.destination) == null ? void 0 : h.name,
|
|
151
151
|
city: (b = u.destination) == null ? void 0 : b.cityName,
|
|
152
152
|
country: w((C = u.destination) == null ? void 0 : C.iataCountryCode),
|
|
153
153
|
time: u.arrivingAt,
|
|
@@ -196,8 +196,8 @@ const se = ({
|
|
|
196
196
|
isMultiDayFlight: o
|
|
197
197
|
}
|
|
198
198
|
),
|
|
199
|
-
p.map((n,
|
|
200
|
-
var b, C, O, T, M, N,
|
|
199
|
+
p.map((n, h) => {
|
|
200
|
+
var b, C, O, T, M, N, f, u;
|
|
201
201
|
return /* @__PURE__ */ a(g.Fragment, { children: [
|
|
202
202
|
/* @__PURE__ */ c(
|
|
203
203
|
L,
|
|
@@ -222,16 +222,16 @@ const se = ({
|
|
|
222
222
|
country: (O = n.departure) == null ? void 0 : O.country,
|
|
223
223
|
departureAt: n.departure.time,
|
|
224
224
|
departureTimeZone: n.departure.departureTimeZone,
|
|
225
|
-
arrivalAt: e[
|
|
226
|
-
arrivalTimeZone: e[
|
|
225
|
+
arrivalAt: e[h + 1].arrivingAt,
|
|
226
|
+
arrivalTimeZone: e[h + 1].destination.timeZone,
|
|
227
227
|
airline: (T = n.departure) == null ? void 0 : T.airline,
|
|
228
228
|
airlineCode: (M = n.departure) == null ? void 0 : M.airlineCode,
|
|
229
229
|
aircraft: (N = n.departure) == null ? void 0 : N.aircraft,
|
|
230
|
-
flightNumber: (
|
|
230
|
+
flightNumber: (f = n.departure) == null ? void 0 : f.flightNumber,
|
|
231
231
|
cabin: (u = n.departure) == null ? void 0 : u.cabin
|
|
232
232
|
}
|
|
233
233
|
)
|
|
234
|
-
] }, n.departure.flightNumber ||
|
|
234
|
+
] }, n.departure.flightNumber || h);
|
|
235
235
|
}),
|
|
236
236
|
/* @__PURE__ */ c(
|
|
237
237
|
L,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../arrayExtensions-DWKenJCh.js";
|
|
4
|
-
import { a as f } from "../../FlightItinerary-
|
|
4
|
+
import { a as f } from "../../FlightItinerary-DgpK1LYF.js";
|
|
5
5
|
import "../../types/enums.js";
|
|
6
|
-
import "../../dateUtils-
|
|
6
|
+
import "../../dateUtils-DeNLG5hw.js";
|
|
7
7
|
import "../../constants/constants.js";
|
|
8
8
|
export {
|
|
9
9
|
f as default
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
2
2
|
import O, { useState as d, useMemo as E } from "react";
|
|
3
|
-
import { g as f, E as N, F as I, a as M } from "../../FlightItinerary-
|
|
3
|
+
import { g as f, E as N, F as I, a as M } from "../../FlightItinerary-DgpK1LYF.js";
|
|
4
4
|
import { DEFAULT_AIRLINE_PROGRAM as R, getFlightNumber as T, getLogoPath as B, getAirlineProgram as L } from "../../utils/flightUtils.js";
|
|
5
5
|
import { h as u } from "../../arrayExtensions-DWKenJCh.js";
|
|
6
|
-
import { g as $ } from "../../dateUtils-
|
|
6
|
+
import { g as $ } from "../../dateUtils-DeNLG5hw.js";
|
|
7
7
|
import { EPaymentType as v } from "../../enums/EPaymentType.js";
|
|
8
8
|
import '../../assets/FlightResult.css';function b(i) {
|
|
9
9
|
if (!i || isNaN(i) || i < 0) return "N/A";
|
|
@@ -89,7 +89,7 @@ var oe = function(o, t) {
|
|
|
89
89
|
};
|
|
90
90
|
const L = "text/event-stream", se = 1e3, M = "last-event-id";
|
|
91
91
|
function ae(o, t) {
|
|
92
|
-
var { signal: r, headers: n, onopen: s, onmessage:
|
|
92
|
+
var { signal: r, headers: n, onopen: s, onmessage: v, onclose: c, onerror: u, openWhenHidden: a, fetch: d } = t, b = oe(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
93
93
|
return new Promise((g, D) => {
|
|
94
94
|
const p = Object.assign({}, n);
|
|
95
95
|
p.accept || (p.accept = L);
|
|
@@ -115,7 +115,7 @@ function ae(o, t) {
|
|
|
115
115
|
h ? p[M] = h : delete p[M];
|
|
116
116
|
}, (h) => {
|
|
117
117
|
I = h;
|
|
118
|
-
},
|
|
118
|
+
}, v))), c == null || c(), S(), g();
|
|
119
119
|
} catch (w) {
|
|
120
120
|
if (!m.signal.aborted)
|
|
121
121
|
try {
|
|
@@ -134,15 +134,15 @@ function ie(o) {
|
|
|
134
134
|
if (!(t != null && t.startsWith(L)))
|
|
135
135
|
throw new Error(`Expected content-type to be ${L}, Actual: ${t}`);
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const W = 1, U = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o) => {
|
|
138
138
|
if (!o.origin || !o.destination)
|
|
139
139
|
throw new Error("Origin and destination are required.");
|
|
140
140
|
if (!o.departureDate)
|
|
141
141
|
throw new Error("Departure date is required.");
|
|
142
142
|
if (o.flightType === Y.ROUND_TRIP && !o.returnDate)
|
|
143
143
|
throw new Error("Return date is required for round-trip flights.");
|
|
144
|
-
},
|
|
145
|
-
const { token: o, config: t } = X(), [r, n] = N(""), [s,
|
|
144
|
+
}, Oe = () => {
|
|
145
|
+
const { token: o, config: t } = X(), [r, n] = N(""), [s, v] = N([]), [c, u] = N(!1), a = $(null), {
|
|
146
146
|
inboundResults: d,
|
|
147
147
|
outboundResults: b,
|
|
148
148
|
setInboundResults: g,
|
|
@@ -165,12 +165,12 @@ const U = 1, W = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o
|
|
|
165
165
|
B(e);
|
|
166
166
|
const f = {
|
|
167
167
|
passengers: Array.from(
|
|
168
|
-
{ length: e.passengers ??
|
|
168
|
+
{ length: e.passengers ?? W },
|
|
169
169
|
() => ({ type: "adult" })
|
|
170
170
|
),
|
|
171
171
|
origin: e.origin || "",
|
|
172
172
|
destination: e.destination || "",
|
|
173
|
-
cabin_class: e.cabinClass ||
|
|
173
|
+
cabin_class: e.cabinClass || U
|
|
174
174
|
};
|
|
175
175
|
if (e.flightType === Y.ONE_WAY) {
|
|
176
176
|
const i = await A.cashOnlySearch({
|
|
@@ -247,7 +247,7 @@ const U = 1, W = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o
|
|
|
247
247
|
const { success: l, data: f } = e;
|
|
248
248
|
if (!l) return;
|
|
249
249
|
const i = f.offers;
|
|
250
|
-
|
|
250
|
+
v(x(i));
|
|
251
251
|
},
|
|
252
252
|
onError: (e) => {
|
|
253
253
|
console.error("Error in round-trip fare search:", e);
|
|
@@ -258,8 +258,8 @@ const U = 1, W = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o
|
|
|
258
258
|
originCode: e.origin,
|
|
259
259
|
destinationCode: e.destination,
|
|
260
260
|
departureDate: e.departureDate,
|
|
261
|
-
cabinClass: e.cabinClass ||
|
|
262
|
-
passengerCount: e.passengers ||
|
|
261
|
+
cabinClass: e.cabinClass || U,
|
|
262
|
+
passengerCount: e.passengers || W,
|
|
263
263
|
paymentType: l
|
|
264
264
|
});
|
|
265
265
|
let i = [];
|
|
@@ -271,24 +271,25 @@ const U = 1, W = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o
|
|
|
271
271
|
Authorization: o || "",
|
|
272
272
|
"client-id": (t == null ? void 0 : t.clientId) || ""
|
|
273
273
|
},
|
|
274
|
+
openWhenHidden: !0,
|
|
274
275
|
signal: z.signal,
|
|
275
276
|
onmessage(F) {
|
|
276
277
|
try {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
278
|
+
const O = x(JSON.parse(F.data));
|
|
279
|
+
if (O.success === !1) {
|
|
279
280
|
C();
|
|
280
281
|
return;
|
|
281
282
|
}
|
|
282
|
-
if (
|
|
283
|
+
if (O.close === !0) {
|
|
283
284
|
C();
|
|
284
285
|
return;
|
|
285
286
|
}
|
|
286
|
-
|
|
287
|
-
data:
|
|
287
|
+
O.flights && (i = y({
|
|
288
|
+
data: O.flights,
|
|
288
289
|
previousResults: i
|
|
289
290
|
}));
|
|
290
|
-
} catch (
|
|
291
|
-
console.error("Error parsing message:",
|
|
291
|
+
} catch (O) {
|
|
292
|
+
console.error("Error parsing message:", O), C();
|
|
292
293
|
}
|
|
293
294
|
},
|
|
294
295
|
onerror(F) {
|
|
@@ -360,5 +361,5 @@ const U = 1, W = J.ECONOMY, z = new AbortController(), ue = 3 * 60 * 1e3, B = (o
|
|
|
360
361
|
};
|
|
361
362
|
};
|
|
362
363
|
export {
|
|
363
|
-
|
|
364
|
+
Oe as useFlightSearch
|
|
364
365
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import i from "react";
|
|
2
|
+
const d = (e) => {
|
|
3
3
|
let t;
|
|
4
|
-
const s = /* @__PURE__ */ new Set(),
|
|
4
|
+
const s = /* @__PURE__ */ new Set(), c = (n, a) => {
|
|
5
5
|
const o = typeof n == "function" ? n(t) : n;
|
|
6
6
|
if (!Object.is(o, t)) {
|
|
7
|
-
const
|
|
8
|
-
t =
|
|
7
|
+
const S = t;
|
|
8
|
+
t = a ?? (typeof o != "object" || o === null) ? o : Object.assign({}, t, o), s.forEach((b) => b(t, S));
|
|
9
9
|
}
|
|
10
|
-
},
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
const s =
|
|
10
|
+
}, u = () => t, r = { setState: c, getState: u, getInitialState: () => l, subscribe: (n) => (s.add(n), () => s.delete(n)) }, l = t = e(c, u, r);
|
|
11
|
+
return r;
|
|
12
|
+
}, f = (e) => d(e), g = (e) => e;
|
|
13
|
+
function I(e, t = g) {
|
|
14
|
+
const s = i.useSyncExternalStore(
|
|
15
15
|
e.subscribe,
|
|
16
16
|
() => t(e.getState()),
|
|
17
17
|
() => t(e.getInitialState())
|
|
18
18
|
);
|
|
19
|
-
return
|
|
19
|
+
return i.useDebugValue(s), s;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
const t =
|
|
21
|
+
const R = (e) => {
|
|
22
|
+
const t = f(e), s = (c) => I(t, c);
|
|
23
23
|
return Object.assign(s, t), s;
|
|
24
|
-
}, O = (e) =>
|
|
24
|
+
}, O = (e) => R(e), y = O((e) => ({
|
|
25
25
|
outboundResults: [],
|
|
26
26
|
inboundResults: [],
|
|
27
27
|
setOutboundResults: (t) => e({ outboundResults: t }),
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { c as
|
|
1
|
+
import { h as f } from "../arrayExtensions-DWKenJCh.js";
|
|
2
|
+
import { c as R } from "../dateUtils-DeNLG5hw.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { awayzClient as
|
|
5
|
-
import { WalletService as
|
|
6
|
-
import { ERewardProgramCategories as
|
|
7
|
-
const
|
|
8
|
-
var c, a,
|
|
4
|
+
import { awayzClient as K } from "@odynn/awayz-auth";
|
|
5
|
+
import { WalletService as j } from "../services/wallet/WalletService.js";
|
|
6
|
+
import { ERewardProgramCategories as q } from "../services/wallet/WalletService.types.js";
|
|
7
|
+
const B = (i) => i == null ? void 0 : i.map((e) => {
|
|
8
|
+
var c, a, s, n, t, o, g, r, d, A, M, I, F, L, w, u, y, l, C, h, b, m, p, D, T, k, z, v, O, G, _, $, Z, P;
|
|
9
9
|
return {
|
|
10
10
|
id: e.id,
|
|
11
11
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
12
|
-
partial: e.partial,
|
|
12
|
+
partial: e == null ? void 0 : e.partial,
|
|
13
13
|
origin: {
|
|
14
|
-
city: e.slices[0].segments[0].origin.cityName || ((
|
|
15
|
-
country: e.slices[0].segments[0].origin.iataCountryCode || ((
|
|
16
|
-
airportCode: e.slices[0].segments[0].origin.iataCityCode || e.slices[0].segments[0].origin.city.iataCode,
|
|
14
|
+
city: ((c = e.slices[0].segments[0].origin) == null ? void 0 : c.cityName) || ((s = (a = e.slices[0].segments[0].origin) == null ? void 0 : a.city) == null ? void 0 : s.name),
|
|
15
|
+
country: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.iataCountryCode) || ((o = (t = e.slices[0].segments[0].origin) == null ? void 0 : t.city) == null ? void 0 : o.iataCountryCode),
|
|
16
|
+
airportCode: ((g = e.slices[0].segments[0].origin) == null ? void 0 : g.iataCityCode) || ((d = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : d.iataCode),
|
|
17
17
|
coordinates: {
|
|
18
|
-
latitude: e.slices[0].segments[0].origin.city.latitude,
|
|
19
|
-
longitude: e.slices[0].segments[0].origin.city.longitude
|
|
18
|
+
latitude: (M = (A = e.slices[0].segments[0].origin) == null ? void 0 : A.city) == null ? void 0 : M.latitude,
|
|
19
|
+
longitude: (F = (I = e.slices[0].segments[0].origin) == null ? void 0 : I.city) == null ? void 0 : F.longitude
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
destination: {
|
|
23
|
-
city: ((
|
|
24
|
-
country: ((
|
|
25
|
-
airportCode: ((
|
|
23
|
+
city: ((w = (L = e.slices[0].segments.getLast()) == null ? void 0 : L.destination) == null ? void 0 : w.cityName) || ((l = (y = (u = e.slices[0].segments.getLast()) == null ? void 0 : u.destination) == null ? void 0 : y.city) == null ? void 0 : l.name),
|
|
24
|
+
country: ((h = (C = e.slices[0].segments.getLast()) == null ? void 0 : C.destination) == null ? void 0 : h.iataCountryCode) || ((p = (m = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : m.city) == null ? void 0 : p.iataCountryCode),
|
|
25
|
+
airportCode: ((T = (D = e.slices[0].segments.getLast()) == null ? void 0 : D.destination) == null ? void 0 : T.iataCityCode) || ((v = (z = (k = e.slices[0].segments.getLast()) == null ? void 0 : k.destination) == null ? void 0 : z.city) == null ? void 0 : v.iataCode),
|
|
26
26
|
coordinates: {
|
|
27
|
-
latitude: (
|
|
28
|
-
longitude: (
|
|
27
|
+
latitude: (_ = (G = (O = e.slices[0].segments.getLast()) == null ? void 0 : O.destination) == null ? void 0 : G.city) == null ? void 0 : _.latitude,
|
|
28
|
+
longitude: (P = (Z = ($ = e.slices[0].segments.getLast()) == null ? void 0 : $.destination) == null ? void 0 : Z.city) == null ? void 0 : P.longitude
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
airline: e.owner.name,
|
|
32
32
|
cash: parseFloat(e.totalAmount),
|
|
33
|
-
flightNumber:
|
|
33
|
+
flightNumber: U(e.slices[0].segments[0]),
|
|
34
34
|
awayzGroupId: e.slices[0].comparisonKey || e.awayzRouteId || e.awayzGroupId || e.id,
|
|
35
|
-
departureTime:
|
|
36
|
-
arrivalTime:
|
|
35
|
+
departureTime: f(e.slices[0].segments[0].departingAt).toDate(),
|
|
36
|
+
arrivalTime: f(
|
|
37
37
|
e.slices[0].segments[e.slices[0].segments.length - 1].arrivingAt
|
|
38
38
|
).toDate(),
|
|
39
39
|
numberOfStops: e.slices[0].segments.length - 1,
|
|
@@ -41,21 +41,19 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
41
41
|
duration: e.slices[0].duration,
|
|
42
42
|
airlineProgram: e.airlineProgram,
|
|
43
43
|
paymentOptions: [],
|
|
44
|
-
durationMinutes:
|
|
45
|
-
departureTime:
|
|
46
|
-
arrivalTime:
|
|
44
|
+
durationMinutes: R({
|
|
45
|
+
departureTime: f(e.slices[0].segments[0].departingAt),
|
|
46
|
+
arrivalTime: f(e.slices[0].segments.getLast().arrivingAt),
|
|
47
47
|
originTimeZone: e.slices[0].segments[0].origin.timeZone,
|
|
48
48
|
destinationTimeZone: e.slices[0].segments.getLast().destination.timeZone,
|
|
49
49
|
duration: e.slices[0].duration
|
|
50
50
|
})
|
|
51
51
|
};
|
|
52
|
-
}),
|
|
52
|
+
}), J = (i, e) => {
|
|
53
53
|
if (!(e != null && e.length))
|
|
54
|
-
return
|
|
55
|
-
const c = [...e];
|
|
56
|
-
|
|
57
|
-
const i = {};
|
|
58
|
-
for (const t of s) {
|
|
54
|
+
return B(i);
|
|
55
|
+
const c = [...e], a = [], s = {};
|
|
56
|
+
for (const t of i) {
|
|
59
57
|
const o = t.slices[0].segments, g = o[0], r = {
|
|
60
58
|
iataCode: g.operatingCarrier.iataCode,
|
|
61
59
|
flightNumber: N(
|
|
@@ -70,11 +68,11 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
70
68
|
const l = u.flightDetails, C = u.flightDetails.slices[0].segments[0].operatingCarrierFlightNumber, h = l.id && // TODO: Maybe expand on this - Id check ensures it is a duffel flight
|
|
71
69
|
!!C && C !== "";
|
|
72
70
|
if (!(l.slices[0].segments.length === (o == null ? void 0 : o.length) && !l.slices[0].segments.find(
|
|
73
|
-
(p,
|
|
71
|
+
(p, D) => p.departingAt !== o[D].departingAt || p.arrivingAt !== o[D].arrivingAt || p.duration !== o[D].duration
|
|
74
72
|
)))
|
|
75
73
|
return !1;
|
|
76
74
|
let m = !1;
|
|
77
|
-
return (L && F && l.awayzMatchId === A || !h && l.awayzMatchId === M || F && !L && l.awayzMarketerMatchId === I) && (m = !0), m && (
|
|
75
|
+
return (L && F && l.awayzMatchId === A || !h && l.awayzMatchId === M || F && !L && l.awayzMarketerMatchId === I) && (m = !0), m && (s[l.id] = y), m;
|
|
78
76
|
});
|
|
79
77
|
if (w.length) {
|
|
80
78
|
t.slices[0].comparisonKey = w[0].awayzGroupId;
|
|
@@ -86,7 +84,7 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
86
84
|
d.iataCode === "AC" && ((m = C.split(" ")) == null ? void 0 : m[0]) === ((p = l.split(" ")) == null ? void 0 : p[0]);
|
|
87
85
|
});
|
|
88
86
|
if (u) {
|
|
89
|
-
const y =
|
|
87
|
+
const y = s[u.id], l = {
|
|
90
88
|
...t,
|
|
91
89
|
...u,
|
|
92
90
|
points: t.points,
|
|
@@ -105,33 +103,33 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
105
103
|
a.push(t);
|
|
106
104
|
}
|
|
107
105
|
return [
|
|
108
|
-
...c
|
|
109
|
-
...
|
|
106
|
+
...c,
|
|
107
|
+
...B(a) ?? []
|
|
110
108
|
];
|
|
111
|
-
},
|
|
112
|
-
const e =
|
|
109
|
+
}, U = (i) => {
|
|
110
|
+
const e = i.operatingCarrierFlightNumber ? i.operatingCarrier : i.marketingCarrier, c = i.operatingCarrierFlightNumber ?? i.marketingCarrierFlightNumber;
|
|
113
111
|
return e.iataCode + " " + N(c);
|
|
114
|
-
},
|
|
115
|
-
originCode:
|
|
112
|
+
}, X = ({
|
|
113
|
+
originCode: i,
|
|
116
114
|
destinationCode: e,
|
|
117
115
|
departureDate: c,
|
|
118
116
|
cabinClass: a,
|
|
119
|
-
passengerCount:
|
|
117
|
+
passengerCount: s,
|
|
120
118
|
paymentType: n
|
|
121
119
|
}) => {
|
|
122
120
|
let t = "/flights/search/one-way/points-cash?";
|
|
123
|
-
return t += `origin=${
|
|
124
|
-
},
|
|
125
|
-
const e =
|
|
126
|
-
const n =
|
|
127
|
-
return a[n] || (a[n] = []), a[n].push(
|
|
121
|
+
return t += `origin=${i}`, t += `&destination=${e}`, t += `&departure_date=${c}`, t += `&cabin_class=${a}`, t += `&adults=${s}`, t += `&cash_or_points=[${n}]`, t;
|
|
122
|
+
}, ee = (i) => {
|
|
123
|
+
const e = i.reduce((a, s) => {
|
|
124
|
+
const n = s.flightDetails.slices[0].segments.map((t) => N(U(t))).join("_");
|
|
125
|
+
return a[n] || (a[n] = []), a[n].push(s), a;
|
|
128
126
|
}, {});
|
|
129
127
|
return Object.values(e).map(
|
|
130
128
|
(a) => {
|
|
131
|
-
const
|
|
129
|
+
const s = a[0], { origin: n, destination: t } = s, o = a.filter((r) => r.cash > 0).reduce((r, d) => Math.min(r, d.cash), 1 / 0), g = a.filter((r) => r.points > 0).reduce((r, d) => Math.min(r, d.points), 1 / 0);
|
|
132
130
|
return {
|
|
133
|
-
id:
|
|
134
|
-
partial:
|
|
131
|
+
id: s.awayzGroupId,
|
|
132
|
+
partial: s.partial,
|
|
135
133
|
origin: {
|
|
136
134
|
city: n.city,
|
|
137
135
|
country: n.country,
|
|
@@ -144,8 +142,8 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
144
142
|
airportCode: t.airportCode,
|
|
145
143
|
coordinates: t.coordinates
|
|
146
144
|
},
|
|
147
|
-
airline:
|
|
148
|
-
flightNumber:
|
|
145
|
+
airline: s.airline,
|
|
146
|
+
flightNumber: s.flightNumber,
|
|
149
147
|
paymentOptions: a.map((r) => ({
|
|
150
148
|
id: r.id,
|
|
151
149
|
cash: r.cash,
|
|
@@ -165,69 +163,69 @@ const T = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
165
163
|
name: r.flightDetails.slices[0].segments[0].marketingCarrier.name
|
|
166
164
|
}
|
|
167
165
|
})),
|
|
168
|
-
numberOfStops:
|
|
169
|
-
departureTime:
|
|
170
|
-
arrivalTime:
|
|
171
|
-
awayzGroupId:
|
|
172
|
-
duration:
|
|
173
|
-
airlineProgram:
|
|
174
|
-
durationMinutes:
|
|
175
|
-
departureTime:
|
|
176
|
-
|
|
166
|
+
numberOfStops: s.numberOfStops,
|
|
167
|
+
departureTime: s.departureTime,
|
|
168
|
+
arrivalTime: s.arrivalTime,
|
|
169
|
+
awayzGroupId: s.awayzGroupId,
|
|
170
|
+
duration: s.duration,
|
|
171
|
+
airlineProgram: s.airlineProgram,
|
|
172
|
+
durationMinutes: R({
|
|
173
|
+
departureTime: f(
|
|
174
|
+
s.flightDetails.slices[0].segments[0].departingAt
|
|
177
175
|
),
|
|
178
|
-
arrivalTime:
|
|
179
|
-
|
|
176
|
+
arrivalTime: f(
|
|
177
|
+
s.flightDetails.slices[0].segments.getLast().arrivingAt
|
|
180
178
|
),
|
|
181
|
-
originTimeZone:
|
|
182
|
-
destinationTimeZone:
|
|
183
|
-
duration:
|
|
179
|
+
originTimeZone: s.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
180
|
+
destinationTimeZone: s.flightDetails.slices[0].segments.getLast().destination.timeZone,
|
|
181
|
+
duration: s.flightDetails.slices[0].duration
|
|
184
182
|
}),
|
|
185
183
|
cash: o === 1 / 0 ? -1 : o,
|
|
186
184
|
points: g === 1 / 0 ? -1 : g,
|
|
187
|
-
flightDetails:
|
|
185
|
+
flightDetails: s.flightDetails
|
|
188
186
|
};
|
|
189
187
|
}
|
|
190
188
|
);
|
|
191
|
-
}, N = (
|
|
192
|
-
categoryLogo:
|
|
193
|
-
programLogo:
|
|
189
|
+
}, N = (i) => i ? i.replace(/^0+/, "") : "", te = (i) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${i}.svg`, S = "/img/logo/odynn-eye.svg", E = {
|
|
190
|
+
categoryLogo: S,
|
|
191
|
+
programLogo: S,
|
|
194
192
|
awayzActive: [],
|
|
195
193
|
mainProgram: "Unknown",
|
|
196
194
|
displayProgram: "Unknown",
|
|
197
195
|
id: "Unknown",
|
|
198
196
|
totalAccumulatedPoints: 0,
|
|
199
|
-
category:
|
|
197
|
+
category: q.Airline,
|
|
200
198
|
colour: "#fff",
|
|
201
199
|
// Using App Foreground Colour
|
|
202
200
|
url: "https://www.odynn.com"
|
|
203
|
-
},
|
|
204
|
-
const { airlines: e } = await
|
|
201
|
+
}, ie = async (i) => {
|
|
202
|
+
const { airlines: e } = await K.ensureQueryData({
|
|
205
203
|
queryKey: ["walletAwards"],
|
|
206
|
-
queryFn:
|
|
204
|
+
queryFn: j.getAwards,
|
|
207
205
|
staleTime: 864e5
|
|
208
206
|
// 24 hours
|
|
209
207
|
});
|
|
210
208
|
let c = e.find(
|
|
211
209
|
(a) => {
|
|
212
|
-
var
|
|
213
|
-
return ((n = (
|
|
210
|
+
var s, n, t, o;
|
|
211
|
+
return ((n = (s = a.mainProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : n.includes(i == null ? void 0 : i.toLowerCase())) || ((o = (t = a.displayProgram) == null ? void 0 : t.toLowerCase()) == null ? void 0 : o.includes(i == null ? void 0 : i.toLowerCase()));
|
|
214
212
|
}
|
|
215
|
-
) ??
|
|
213
|
+
) ?? E;
|
|
216
214
|
return c || (c = {
|
|
217
|
-
...
|
|
218
|
-
mainProgram:
|
|
219
|
-
displayProgram:
|
|
220
|
-
id:
|
|
215
|
+
...E,
|
|
216
|
+
mainProgram: i,
|
|
217
|
+
displayProgram: i,
|
|
218
|
+
id: i
|
|
221
219
|
}), c;
|
|
222
220
|
};
|
|
223
221
|
export {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
E as DEFAULT_AIRLINE_PROGRAM,
|
|
223
|
+
X as buildFlightSearchQuery,
|
|
224
|
+
ie as getAirlineProgram,
|
|
225
|
+
U as getFlightNumber,
|
|
226
|
+
te as getLogoPath,
|
|
227
|
+
ee as groupFlightResults,
|
|
228
|
+
B as mapFlightDetailsToResults,
|
|
229
|
+
J as parseFlightDetails,
|
|
232
230
|
N as removeLeadingZeros
|
|
233
231
|
};
|