@odynn/awayz-flights 0.2.2 → 0.2.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.
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
import { jsx as r, jsxs as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { g as
|
|
4
|
-
import { DEFAULT_AIRLINE_PROGRAM as
|
|
5
|
-
import { h as
|
|
6
|
-
import { g as
|
|
7
|
-
import { EPaymentType as
|
|
8
|
-
import { CashValue as
|
|
9
|
-
import '../../assets/FlightResult.css';function
|
|
1
|
+
import { jsx as r, jsxs as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import I, { useState as f, useMemo as T } from "react";
|
|
3
|
+
import { g as N, E as u, F as R, a as B } from "../../FlightItinerary-DgpK1LYF.js";
|
|
4
|
+
import { DEFAULT_AIRLINE_PROGRAM as L, getFlightNumber as $, getLogoPath as x, getAirlineProgram as M } from "../../utils/flightUtils.js";
|
|
5
|
+
import { h as v } from "../../arrayExtensions-DWKenJCh.js";
|
|
6
|
+
import { g as b } from "../../dateUtils-DeNLG5hw.js";
|
|
7
|
+
import { EPaymentType as o } from "../../enums/EPaymentType.js";
|
|
8
|
+
import { CashValue as F } from "@odynn/awayz-core";
|
|
9
|
+
import '../../assets/FlightResult.css';function j(i) {
|
|
10
10
|
if (!i || isNaN(i) || i < 0) return "N/A";
|
|
11
|
-
let
|
|
12
|
-
return
|
|
11
|
+
let a = i == null ? void 0 : i.toString().split(".")[0];
|
|
12
|
+
return a == null ? void 0 : a.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const [
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
}, { flightNumbers:
|
|
19
|
-
const
|
|
20
|
-
return i.flightDetails.slices.forEach((
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
t.some((
|
|
26
|
-
logo:
|
|
27
|
-
airline:
|
|
14
|
+
const K = ({ details: i, onClick: a }) => {
|
|
15
|
+
const [g, y] = f(!1), c = i.origin, l = i.destination, p = i.flightDetails, C = !i.paymentOptions || i.paymentOptions.length === 1, [D, S] = f(L), P = async () => {
|
|
16
|
+
const n = await M(i.airlineProgram);
|
|
17
|
+
S(n);
|
|
18
|
+
}, { flightNumbers: h, airlines: A } = T(() => {
|
|
19
|
+
const n = [], t = [];
|
|
20
|
+
return i.flightDetails.slices.forEach((O) => {
|
|
21
|
+
O.segments.forEach((s) => {
|
|
22
|
+
const d = $(s);
|
|
23
|
+
n.includes(d) || n.push(d);
|
|
24
|
+
const m = s.operatingCarrierFlightNumber ? s.operatingCarrier : s.marketingCarrier;
|
|
25
|
+
t.some((k) => k.airline === m.name) || t.push({
|
|
26
|
+
logo: x(m.iataCode),
|
|
27
|
+
airline: m.name
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
|
-
}),
|
|
30
|
+
}), P(), { flightNumbers: n, airlines: t };
|
|
31
31
|
}, [i.flightDetails.slices]);
|
|
32
|
-
return /* @__PURE__ */ r("div", { className: "flight-result", onClick: () =>
|
|
32
|
+
return /* @__PURE__ */ r("div", { className: "flight-result", onClick: () => {
|
|
33
|
+
i.cash > 0 ? a(i, o.CASH) : a(i, o.POINTS);
|
|
34
|
+
}, children: /* @__PURE__ */ e("div", { className: "content", children: [
|
|
33
35
|
/* @__PURE__ */ r("div", { className: "flight-info", children: /* @__PURE__ */ e("div", { className: "flight-locations", children: [
|
|
34
|
-
/* @__PURE__ */ r("div", { className: "airlines", children:
|
|
36
|
+
/* @__PURE__ */ r("div", { className: "airlines", children: A.map((n, t) => /* @__PURE__ */ r(I.Fragment, { children: /* @__PURE__ */ r("div", { className: "tip", children: /* @__PURE__ */ r("img", { src: n.logo, alt: n.airline }) }, t) }, t)) }),
|
|
35
37
|
/* @__PURE__ */ e("div", { className: "flight-location", children: [
|
|
36
38
|
/* @__PURE__ */ e("p", { children: [
|
|
37
|
-
|
|
39
|
+
c.city,
|
|
38
40
|
",",
|
|
39
|
-
|
|
41
|
+
N(c.country)
|
|
40
42
|
] }),
|
|
41
|
-
/* @__PURE__ */ r("p", { children:
|
|
43
|
+
/* @__PURE__ */ r("p", { children: v(i.departureTime).format(
|
|
42
44
|
// isMobile
|
|
43
45
|
// ? EDateFormats.FlightTime
|
|
44
46
|
// :
|
|
45
|
-
|
|
47
|
+
u.FlightShortDate
|
|
46
48
|
) })
|
|
47
49
|
] }),
|
|
48
50
|
/* @__PURE__ */ e("div", { className: "flight-duration", children: [
|
|
49
51
|
/* @__PURE__ */ r("span", { className: "line" }),
|
|
50
52
|
/* @__PURE__ */ e("p", { children: [
|
|
51
|
-
|
|
53
|
+
b(p.slices[0].duration),
|
|
52
54
|
" ",
|
|
53
55
|
" - ",
|
|
54
56
|
i.numberOfStops > 0 ? `${i.numberOfStops} Stop${i.numberOfStops > 1 ? "s" : ""}` : "Direct"
|
|
@@ -57,16 +59,16 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
57
59
|
] }),
|
|
58
60
|
/* @__PURE__ */ e("div", { children: [
|
|
59
61
|
/* @__PURE__ */ e("p", { children: [
|
|
60
|
-
|
|
62
|
+
l.city,
|
|
61
63
|
", ",
|
|
62
|
-
|
|
64
|
+
N(l.country)
|
|
63
65
|
] }),
|
|
64
66
|
/* @__PURE__ */ e("p", { children: [
|
|
65
|
-
|
|
67
|
+
v(i.arrivalTime).format(
|
|
66
68
|
// isMobile
|
|
67
69
|
// ? EDateFormats.FlightTime
|
|
68
70
|
// :
|
|
69
|
-
|
|
71
|
+
u.FlightShortDate
|
|
70
72
|
),
|
|
71
73
|
" "
|
|
72
74
|
] })
|
|
@@ -78,18 +80,18 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
78
80
|
"div",
|
|
79
81
|
{
|
|
80
82
|
className: "flight-detail",
|
|
81
|
-
onClick: (
|
|
82
|
-
|
|
83
|
+
onClick: (n) => {
|
|
84
|
+
n.stopPropagation(), y(!g);
|
|
83
85
|
},
|
|
84
86
|
children: [
|
|
85
87
|
/* @__PURE__ */ r("p", { children: "Aircraft" }),
|
|
86
88
|
/* @__PURE__ */ e("p", { className: "chevron-text", children: [
|
|
87
|
-
/* @__PURE__ */ r(
|
|
89
|
+
/* @__PURE__ */ r(R, {}),
|
|
88
90
|
/* @__PURE__ */ e("span", { children: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
h[0],
|
|
92
|
+
h.length > 1 && /* @__PURE__ */ e("sup", { children: [
|
|
91
93
|
"+",
|
|
92
|
-
|
|
94
|
+
h.length - 1
|
|
93
95
|
] })
|
|
94
96
|
] })
|
|
95
97
|
] })
|
|
@@ -111,13 +113,13 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
111
113
|
"div",
|
|
112
114
|
{
|
|
113
115
|
className: "cash-value",
|
|
114
|
-
onClick: (
|
|
115
|
-
|
|
116
|
+
onClick: (n) => {
|
|
117
|
+
n.stopPropagation(), a(i, o.CASH);
|
|
116
118
|
},
|
|
117
119
|
children: [
|
|
118
120
|
/* @__PURE__ */ r("p", { children: C ? "Book For" : "From" }),
|
|
119
121
|
/* @__PURE__ */ r("p", { children: /* @__PURE__ */ r(
|
|
120
|
-
|
|
122
|
+
F,
|
|
121
123
|
{
|
|
122
124
|
amount: i.cash,
|
|
123
125
|
currency: i.currency
|
|
@@ -130,27 +132,39 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
130
132
|
"div",
|
|
131
133
|
{
|
|
132
134
|
className: "points-value",
|
|
133
|
-
onClick: (
|
|
134
|
-
|
|
135
|
+
onClick: (n) => {
|
|
136
|
+
n.stopPropagation(), a(i, o.POINTS);
|
|
135
137
|
},
|
|
136
138
|
children: [
|
|
137
139
|
/* @__PURE__ */ r("img", { src: D.programLogo }),
|
|
138
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ e("p", { children: [
|
|
141
|
+
`${j(i.points)} miles`,
|
|
142
|
+
i.cashFee.amount > 0 && /* @__PURE__ */ e(E, { children: [
|
|
143
|
+
" + ",
|
|
144
|
+
/* @__PURE__ */ r(
|
|
145
|
+
F,
|
|
146
|
+
{
|
|
147
|
+
amount: i.cashFee.amount,
|
|
148
|
+
currency: i.cashFee.currency
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] })
|
|
152
|
+
] })
|
|
139
153
|
]
|
|
140
154
|
}
|
|
141
155
|
)
|
|
142
156
|
] })
|
|
143
157
|
] }),
|
|
144
|
-
/* @__PURE__ */ r("div", { className: `flight-details ${
|
|
145
|
-
|
|
158
|
+
/* @__PURE__ */ r("div", { className: `flight-details ${g ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { className: "inner", children: /* @__PURE__ */ r(
|
|
159
|
+
B,
|
|
146
160
|
{
|
|
147
|
-
itinerary:
|
|
148
|
-
origin:
|
|
149
|
-
destination:
|
|
161
|
+
itinerary: p.slices[0].segments,
|
|
162
|
+
origin: c,
|
|
163
|
+
destination: l
|
|
150
164
|
}
|
|
151
165
|
) }) })
|
|
152
166
|
] }) });
|
|
153
167
|
};
|
|
154
168
|
export {
|
|
155
|
-
|
|
169
|
+
K as FlightResult
|
|
156
170
|
};
|
|
@@ -60,8 +60,8 @@ function oe(o, t, r) {
|
|
|
60
60
|
o(n.id = g);
|
|
61
61
|
break;
|
|
62
62
|
case "retry":
|
|
63
|
-
const
|
|
64
|
-
isNaN(
|
|
63
|
+
const m = parseInt(g, 10);
|
|
64
|
+
isNaN(m) || t(n.retry = m);
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -90,34 +90,34 @@ var ae = function(o, t) {
|
|
|
90
90
|
const x = "text/event-stream", ie = 1e3, z = "last-event-id";
|
|
91
91
|
function ue(o, t) {
|
|
92
92
|
var { signal: r, headers: n, onopen: s, onmessage: v, onclose: c, onerror: u, openWhenHidden: a, fetch: d } = t, g = ae(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
93
|
-
return new Promise((
|
|
93
|
+
return new Promise((m, _) => {
|
|
94
94
|
const p = Object.assign({}, n);
|
|
95
95
|
p.accept || (p.accept = x);
|
|
96
|
-
let
|
|
96
|
+
let y;
|
|
97
97
|
function w() {
|
|
98
|
-
|
|
98
|
+
y.abort(), document.hidden || T();
|
|
99
99
|
}
|
|
100
100
|
a || document.addEventListener("visibilitychange", w);
|
|
101
101
|
let F = ie, E = 0;
|
|
102
102
|
function S() {
|
|
103
|
-
document.removeEventListener("visibilitychange", w), window.clearTimeout(E),
|
|
103
|
+
document.removeEventListener("visibilitychange", w), window.clearTimeout(E), y.abort();
|
|
104
104
|
}
|
|
105
105
|
r == null || r.addEventListener("abort", () => {
|
|
106
|
-
S(),
|
|
106
|
+
S(), m();
|
|
107
107
|
});
|
|
108
108
|
const q = d ?? window.fetch, P = s ?? ce;
|
|
109
109
|
async function T() {
|
|
110
110
|
var C;
|
|
111
|
-
|
|
111
|
+
y = new AbortController();
|
|
112
112
|
try {
|
|
113
|
-
const O = await q(o, Object.assign(Object.assign({}, g), { headers: p, signal:
|
|
113
|
+
const O = await q(o, Object.assign(Object.assign({}, g), { headers: p, signal: y.signal }));
|
|
114
114
|
await P(O), await ne(O.body, re(oe((h) => {
|
|
115
115
|
h ? p[z] = h : delete p[z];
|
|
116
116
|
}, (h) => {
|
|
117
117
|
F = h;
|
|
118
|
-
}, v))), c == null || c(), S(),
|
|
118
|
+
}, v))), c == null || c(), S(), m();
|
|
119
119
|
} catch (O) {
|
|
120
|
-
if (!
|
|
120
|
+
if (!y.signal.aborted)
|
|
121
121
|
try {
|
|
122
122
|
const h = (C = u == null ? void 0 : u(O)) !== null && C !== void 0 ? C : F;
|
|
123
123
|
window.clearTimeout(E), E = window.setTimeout(T, h);
|
|
@@ -147,17 +147,17 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
147
147
|
const { token: o, config: t } = ee(), [r, n] = N(""), [s, v] = N([]), [c, u] = N(!1), a = K(null), {
|
|
148
148
|
inboundResults: d,
|
|
149
149
|
outboundResults: g,
|
|
150
|
-
setInboundResults:
|
|
150
|
+
setInboundResults: m,
|
|
151
151
|
setOutboundResults: _,
|
|
152
152
|
partialOfferRequestId: p,
|
|
153
|
-
setPartialOfferRequestId:
|
|
153
|
+
setPartialOfferRequestId: y
|
|
154
154
|
} = Z(), w = ({
|
|
155
155
|
data: e,
|
|
156
156
|
previousResults: l,
|
|
157
157
|
inbound: f
|
|
158
158
|
}) => {
|
|
159
159
|
const i = V(e, l);
|
|
160
|
-
return (f ?
|
|
160
|
+
return (f ? m : _)(G(i)), i;
|
|
161
161
|
}, {
|
|
162
162
|
mutate: F,
|
|
163
163
|
status: E,
|
|
@@ -197,13 +197,12 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
onSuccess: (e) => {
|
|
200
|
-
console.log({ result: e });
|
|
201
200
|
const { success: l, data: f, partialOfferRequestId: i } = e;
|
|
202
201
|
if (!l) {
|
|
203
202
|
console.log("oh lol, it didn't work");
|
|
204
203
|
return;
|
|
205
204
|
}
|
|
206
|
-
w({ data: f }), i &&
|
|
205
|
+
w({ data: f }), i && y(i);
|
|
207
206
|
},
|
|
208
207
|
onError: (e) => {
|
|
209
208
|
console.error("Error in outbound flight search:", e);
|
|
@@ -278,19 +277,19 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
278
277
|
signal: j.signal,
|
|
279
278
|
onmessage(A) {
|
|
280
279
|
try {
|
|
281
|
-
const
|
|
282
|
-
if (
|
|
280
|
+
const b = W(JSON.parse(A.data));
|
|
281
|
+
if (b.success === !1)
|
|
283
282
|
return;
|
|
284
|
-
if (
|
|
283
|
+
if (b.close === !0) {
|
|
285
284
|
R();
|
|
286
285
|
return;
|
|
287
286
|
}
|
|
288
|
-
|
|
289
|
-
data:
|
|
287
|
+
b.flights && (console.log({ parsed: b.flights }), I = 0, i = w({
|
|
288
|
+
data: b.flights,
|
|
290
289
|
previousResults: i
|
|
291
|
-
})),
|
|
292
|
-
} catch (
|
|
293
|
-
console.error("Error parsing message:",
|
|
290
|
+
})), b.ping && (I++, I >= t.flightsConfig.streamTimeoutPingCount && R());
|
|
291
|
+
} catch (b) {
|
|
292
|
+
console.error("Error parsing message:", b), R();
|
|
294
293
|
}
|
|
295
294
|
},
|
|
296
295
|
onerror(A) {
|
|
@@ -75,8 +75,10 @@ export interface IFlightPaymentOption {
|
|
|
75
75
|
id: string;
|
|
76
76
|
cash: number;
|
|
77
77
|
points: number;
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
cashFee: {
|
|
79
|
+
amount: number;
|
|
80
|
+
currency: string;
|
|
81
|
+
};
|
|
80
82
|
baseCurrency: string;
|
|
81
83
|
fareBrandName: string;
|
|
82
84
|
program: string;
|
|
@@ -102,6 +104,10 @@ export interface IFlightResult {
|
|
|
102
104
|
destination: IAirportLocation;
|
|
103
105
|
cash: number;
|
|
104
106
|
points: number;
|
|
107
|
+
cashFee: {
|
|
108
|
+
amount: number;
|
|
109
|
+
currency: string;
|
|
110
|
+
};
|
|
105
111
|
numberOfStops: number;
|
|
106
112
|
departureTime: Date;
|
|
107
113
|
arrivalTime: Date;
|
|
@@ -151,6 +157,10 @@ export interface IFlightOffer {
|
|
|
151
157
|
partial: boolean;
|
|
152
158
|
owner: IOwner;
|
|
153
159
|
id: string;
|
|
160
|
+
cashFee: {
|
|
161
|
+
amount: number;
|
|
162
|
+
currency: string;
|
|
163
|
+
};
|
|
154
164
|
}
|
|
155
165
|
export interface IPaymentRequirements {
|
|
156
166
|
requiresInstantPayment: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { h as
|
|
1
|
+
import { h as F } from "../arrayExtensions-DWKenJCh.js";
|
|
2
2
|
import { c as K } from "../dateUtils-DeNLG5hw.js";
|
|
3
3
|
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
7
|
const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
8
|
-
var r, t, a, n, i, o, m,
|
|
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, f, _, $, Z, E, G;
|
|
9
9
|
return {
|
|
10
10
|
id: e.id,
|
|
11
11
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
@@ -13,28 +13,28 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
13
13
|
origin: {
|
|
14
14
|
city: ((r = e.slices[0].segments[0].origin) == null ? void 0 : r.cityName) || ((a = (t = e.slices[0].segments[0].origin) == null ? void 0 : t.city) == null ? void 0 : a.name),
|
|
15
15
|
country: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.iataCountryCode) || ((o = (i = e.slices[0].segments[0].origin) == null ? void 0 : i.city) == null ? void 0 : o.iataCountryCode),
|
|
16
|
-
airportCode: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.iataCityCode) || ((g = (
|
|
16
|
+
airportCode: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.iataCityCode) || ((g = (w = e.slices[0].segments[0].origin) == null ? void 0 : w.city) == null ? void 0 : g.iataCode),
|
|
17
17
|
coordinates: {
|
|
18
18
|
latitude: (P = (M = e.slices[0].segments[0].origin) == null ? void 0 : M.city) == null ? void 0 : P.latitude,
|
|
19
|
-
longitude: (
|
|
19
|
+
longitude: (A = (N = e.slices[0].segments[0].origin) == null ? void 0 : N.city) == null ? void 0 : A.longitude
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
destination: {
|
|
23
|
-
city: ((
|
|
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) || ((
|
|
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: ($ = (_ = (
|
|
27
|
+
latitude: ($ = (_ = (f = e.slices[0].segments.getLast()) == null ? void 0 : f.destination) == null ? void 0 : _.city) == null ? void 0 : $.latitude,
|
|
28
28
|
longitude: (G = (E = (Z = e.slices[0].segments.getLast()) == null ? void 0 : Z.destination) == null ? void 0 : E.city) == null ? void 0 : G.longitude
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
airline: e.owner.name,
|
|
32
|
-
cash: parseFloat(e.totalAmount),
|
|
32
|
+
cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
|
|
33
33
|
currency: e.baseCurrency,
|
|
34
34
|
flightNumber: j(e.slices[0].segments[0]),
|
|
35
35
|
awayzGroupId: e.slices[0].comparisonKey || e.awayzRouteId || e.awayzGroupId || e.id,
|
|
36
|
-
departureTime:
|
|
37
|
-
arrivalTime:
|
|
36
|
+
departureTime: F(e.slices[0].segments[0].departingAt).toDate(),
|
|
37
|
+
arrivalTime: F(
|
|
38
38
|
e.slices[0].segments[e.slices[0].segments.length - 1].arrivingAt
|
|
39
39
|
).toDate(),
|
|
40
40
|
numberOfStops: e.slices[0].segments.length - 1,
|
|
@@ -43,19 +43,20 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
43
43
|
airlineProgram: e.airlineProgram,
|
|
44
44
|
paymentOptions: [],
|
|
45
45
|
durationMinutes: K({
|
|
46
|
-
departureTime:
|
|
47
|
-
arrivalTime:
|
|
46
|
+
departureTime: F(e.slices[0].segments[0].departingAt),
|
|
47
|
+
arrivalTime: F(e.slices[0].segments.getLast().arrivingAt),
|
|
48
48
|
originTimeZone: e.slices[0].segments[0].origin.timeZone,
|
|
49
49
|
destinationTimeZone: e.slices[0].segments.getLast().destination.timeZone,
|
|
50
50
|
duration: e.slices[0].duration
|
|
51
|
-
})
|
|
51
|
+
}),
|
|
52
|
+
cashFee: e.cashFee
|
|
52
53
|
};
|
|
53
54
|
}), ee = (s, e) => {
|
|
54
55
|
if (!(e != null && e.length))
|
|
55
56
|
return B(s);
|
|
56
57
|
const r = [...e], t = [], a = {};
|
|
57
58
|
for (const i of s) {
|
|
58
|
-
const o = i.slices[0].segments, m = o[0],
|
|
59
|
+
const o = i.slices[0].segments, m = o[0], w = {
|
|
59
60
|
iataCode: m.operatingCarrier.iataCode,
|
|
60
61
|
flightNumber: T(
|
|
61
62
|
m.operatingCarrierFlightNumber
|
|
@@ -65,7 +66,7 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
65
66
|
flightNumber: T(
|
|
66
67
|
m.marketingCarrierFlightNumber
|
|
67
68
|
)
|
|
68
|
-
}, M = i.awayzMatchId, P = `${
|
|
69
|
+
}, M = i.awayzMatchId, P = `${w.iataCode}_${g.iataCode}-${g.flightNumber}`, N = i.awayzMarketerMatchId, A = !!w.flightNumber && w.flightNumber != "", L = !!g.flightNumber && g.flightNumber != "", h = r.filter((d, p) => {
|
|
69
70
|
const c = d.flightDetails, y = d.flightDetails.slices[0].segments[0].operatingCarrierFlightNumber, C = c.id && // TODO: Maybe expand on this - Id check ensures it is a duffel flight
|
|
70
71
|
!!y && y !== "";
|
|
71
72
|
if (!(c.slices[0].segments.length === (o == null ? void 0 : o.length) && !c.slices[0].segments.find(
|
|
@@ -73,11 +74,11 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
73
74
|
)))
|
|
74
75
|
return !1;
|
|
75
76
|
let l = !1;
|
|
76
|
-
return (
|
|
77
|
+
return (L && A && c.awayzMatchId === M || !C && c.awayzMatchId === P || A && !L && c.awayzMarketerMatchId === N) && (l = !0), l && (a[c.id] = p), l;
|
|
77
78
|
});
|
|
78
|
-
if (
|
|
79
|
-
i.slices[0].comparisonKey =
|
|
80
|
-
const d =
|
|
79
|
+
if (h.length) {
|
|
80
|
+
i.slices[0].comparisonKey = h[0].awayzGroupId;
|
|
81
|
+
const d = h.find((p) => {
|
|
81
82
|
var C, b, l, u;
|
|
82
83
|
const c = (C = p.flightDetails.slices[0].fareBrandName) == null ? void 0 : C.toLowerCase(), y = (b = i.slices[0].fareBrandName) == null ? void 0 : b.toLowerCase();
|
|
83
84
|
return y === c || // Special Case for AC Only match on first word
|
|
@@ -160,10 +161,10 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
160
161
|
duration: t.duration,
|
|
161
162
|
airlineProgram: t.airlineProgram,
|
|
162
163
|
durationMinutes: K({
|
|
163
|
-
departureTime:
|
|
164
|
+
departureTime: F(
|
|
164
165
|
t.flightDetails.slices[0].segments[0].departingAt
|
|
165
166
|
),
|
|
166
|
-
arrivalTime:
|
|
167
|
+
arrivalTime: F(
|
|
167
168
|
t.flightDetails.slices[0].segments.getLast().arrivingAt
|
|
168
169
|
),
|
|
169
170
|
originTimeZone: t.flightDetails.slices[0].segments[0].origin.timeZone,
|
|
@@ -173,7 +174,8 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
173
174
|
cash: m.lowestCash,
|
|
174
175
|
points: m.lowestPoints,
|
|
175
176
|
flightDetails: t.flightDetails,
|
|
176
|
-
currency: t.flightDetails.baseCurrency
|
|
177
|
+
currency: t.flightDetails.baseCurrency,
|
|
178
|
+
cashFee: t.cashFee
|
|
177
179
|
}
|
|
178
180
|
};
|
|
179
181
|
}
|
|
@@ -226,16 +228,14 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
226
228
|
displayProgram: s,
|
|
227
229
|
id: s
|
|
228
230
|
}), r;
|
|
229
|
-
}, U = (s) => ({
|
|
231
|
+
}, U = (s) => (console.log({ flight: s }), {
|
|
230
232
|
id: s.id,
|
|
231
233
|
cash: s.cash,
|
|
232
234
|
points: s.points,
|
|
233
235
|
program: s.airlineProgram,
|
|
234
|
-
cashFeeCurrency: s.flightDetails.baseCurrency,
|
|
235
|
-
//TODO: Add Cash Fee Amount
|
|
236
|
-
cashFeeAmount: 0,
|
|
237
236
|
baseCurrency: s.flightDetails.baseCurrency,
|
|
238
237
|
fareBrandName: s.flightDetails.slices[0].fareBrandName,
|
|
238
|
+
cashFee: s.cashFee,
|
|
239
239
|
conditions: {
|
|
240
240
|
//TODO: Add Refund and Change Conditions
|
|
241
241
|
refundBeforeDeparture: !0,
|