@odynn/awayz-flights 0.2.2 → 0.2.4
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,57 @@
|
|
|
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 I } from "react/jsx-runtime";
|
|
2
|
+
import T, { useState as N, useMemo as R } from "react";
|
|
3
|
+
import { g as u, E as v, F as B, a as L } from "../../FlightItinerary-DgpK1LYF.js";
|
|
4
|
+
import { DEFAULT_AIRLINE_PROGRAM as $, getFlightNumber as x, getLogoPath as M, getAirlineProgram as b } from "../../utils/flightUtils.js";
|
|
5
|
+
import { h as F } from "../../arrayExtensions-DWKenJCh.js";
|
|
6
|
+
import { g as j } from "../../dateUtils-DeNLG5hw.js";
|
|
7
|
+
import { EPaymentType as o } from "../../enums/EPaymentType.js";
|
|
8
|
+
import { CashValue as y } from "@odynn/awayz-core";
|
|
9
|
+
import '../../assets/FlightResult.css';function H(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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const Q = ({ details: i, onClick: a }) => {
|
|
15
|
+
var d;
|
|
16
|
+
const [g, C] = N(!1), c = i.origin, l = i.destination, p = i.flightDetails, D = !i.paymentOptions || i.paymentOptions.length === 1, [S, P] = N($), A = async () => {
|
|
17
|
+
const n = await b(i.airlineProgram);
|
|
18
|
+
P(n);
|
|
19
|
+
}, { flightNumbers: h, airlines: O } = R(() => {
|
|
20
|
+
const n = [], t = [];
|
|
21
|
+
return i.flightDetails.slices.forEach((k) => {
|
|
22
|
+
k.segments.forEach((s) => {
|
|
23
|
+
const f = x(s);
|
|
24
|
+
n.includes(f) || n.push(f);
|
|
25
|
+
const m = s.operatingCarrierFlightNumber ? s.operatingCarrier : s.marketingCarrier;
|
|
26
|
+
t.some((E) => E.airline === m.name) || t.push({
|
|
27
|
+
logo: M(m.iataCode),
|
|
28
|
+
airline: m.name
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
|
-
}),
|
|
31
|
+
}), A(), { flightNumbers: n, airlines: t };
|
|
31
32
|
}, [i.flightDetails.slices]);
|
|
32
|
-
return /* @__PURE__ */ r("div", { className: "flight-result", onClick: () =>
|
|
33
|
+
return /* @__PURE__ */ r("div", { className: "flight-result", onClick: () => {
|
|
34
|
+
i.cash > 0 ? a(i, o.CASH) : a(i, o.POINTS);
|
|
35
|
+
}, children: /* @__PURE__ */ e("div", { className: "content", children: [
|
|
33
36
|
/* @__PURE__ */ r("div", { className: "flight-info", children: /* @__PURE__ */ e("div", { className: "flight-locations", children: [
|
|
34
|
-
/* @__PURE__ */ r("div", { className: "airlines", children:
|
|
37
|
+
/* @__PURE__ */ r("div", { className: "airlines", children: O.map((n, t) => /* @__PURE__ */ r(T.Fragment, { children: /* @__PURE__ */ r("div", { className: "tip", children: /* @__PURE__ */ r("img", { src: n.logo, alt: n.airline }) }, t) }, t)) }),
|
|
35
38
|
/* @__PURE__ */ e("div", { className: "flight-location", children: [
|
|
36
39
|
/* @__PURE__ */ e("p", { children: [
|
|
37
|
-
|
|
40
|
+
c.city,
|
|
38
41
|
",",
|
|
39
|
-
|
|
42
|
+
u(c.country)
|
|
40
43
|
] }),
|
|
41
|
-
/* @__PURE__ */ r("p", { children:
|
|
44
|
+
/* @__PURE__ */ r("p", { children: F(i.departureTime).format(
|
|
42
45
|
// isMobile
|
|
43
46
|
// ? EDateFormats.FlightTime
|
|
44
47
|
// :
|
|
45
|
-
|
|
48
|
+
v.FlightShortDate
|
|
46
49
|
) })
|
|
47
50
|
] }),
|
|
48
51
|
/* @__PURE__ */ e("div", { className: "flight-duration", children: [
|
|
49
52
|
/* @__PURE__ */ r("span", { className: "line" }),
|
|
50
53
|
/* @__PURE__ */ e("p", { children: [
|
|
51
|
-
|
|
54
|
+
j(p.slices[0].duration),
|
|
52
55
|
" ",
|
|
53
56
|
" - ",
|
|
54
57
|
i.numberOfStops > 0 ? `${i.numberOfStops} Stop${i.numberOfStops > 1 ? "s" : ""}` : "Direct"
|
|
@@ -57,16 +60,16 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
57
60
|
] }),
|
|
58
61
|
/* @__PURE__ */ e("div", { children: [
|
|
59
62
|
/* @__PURE__ */ e("p", { children: [
|
|
60
|
-
|
|
63
|
+
l.city,
|
|
61
64
|
", ",
|
|
62
|
-
|
|
65
|
+
u(l.country)
|
|
63
66
|
] }),
|
|
64
67
|
/* @__PURE__ */ e("p", { children: [
|
|
65
|
-
|
|
68
|
+
F(i.arrivalTime).format(
|
|
66
69
|
// isMobile
|
|
67
70
|
// ? EDateFormats.FlightTime
|
|
68
71
|
// :
|
|
69
|
-
|
|
72
|
+
v.FlightShortDate
|
|
70
73
|
),
|
|
71
74
|
" "
|
|
72
75
|
] })
|
|
@@ -78,18 +81,18 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
78
81
|
"div",
|
|
79
82
|
{
|
|
80
83
|
className: "flight-detail",
|
|
81
|
-
onClick: (
|
|
82
|
-
|
|
84
|
+
onClick: (n) => {
|
|
85
|
+
n.stopPropagation(), C(!g);
|
|
83
86
|
},
|
|
84
87
|
children: [
|
|
85
88
|
/* @__PURE__ */ r("p", { children: "Aircraft" }),
|
|
86
89
|
/* @__PURE__ */ e("p", { className: "chevron-text", children: [
|
|
87
|
-
/* @__PURE__ */ r(
|
|
90
|
+
/* @__PURE__ */ r(B, {}),
|
|
88
91
|
/* @__PURE__ */ e("span", { children: [
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
h[0],
|
|
93
|
+
h.length > 1 && /* @__PURE__ */ e("sup", { children: [
|
|
91
94
|
"+",
|
|
92
|
-
|
|
95
|
+
h.length - 1
|
|
93
96
|
] })
|
|
94
97
|
] })
|
|
95
98
|
] })
|
|
@@ -111,13 +114,13 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
111
114
|
"div",
|
|
112
115
|
{
|
|
113
116
|
className: "cash-value",
|
|
114
|
-
onClick: (
|
|
115
|
-
|
|
117
|
+
onClick: (n) => {
|
|
118
|
+
n.stopPropagation(), a(i, o.CASH);
|
|
116
119
|
},
|
|
117
120
|
children: [
|
|
118
|
-
/* @__PURE__ */ r("p", { children:
|
|
121
|
+
/* @__PURE__ */ r("p", { children: D ? "Book For" : "From" }),
|
|
119
122
|
/* @__PURE__ */ r("p", { children: /* @__PURE__ */ r(
|
|
120
|
-
|
|
123
|
+
y,
|
|
121
124
|
{
|
|
122
125
|
amount: i.cash,
|
|
123
126
|
currency: i.currency
|
|
@@ -130,27 +133,39 @@ const z = ({ details: i, onClick: n }) => {
|
|
|
130
133
|
"div",
|
|
131
134
|
{
|
|
132
135
|
className: "points-value",
|
|
133
|
-
onClick: (
|
|
134
|
-
|
|
136
|
+
onClick: (n) => {
|
|
137
|
+
n.stopPropagation(), a(i, o.POINTS);
|
|
135
138
|
},
|
|
136
139
|
children: [
|
|
137
|
-
/* @__PURE__ */ r("img", { src:
|
|
138
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ r("img", { src: S.programLogo }),
|
|
141
|
+
/* @__PURE__ */ e("p", { children: [
|
|
142
|
+
`${H(i.points)} miles`,
|
|
143
|
+
((d = i.cashFee) == null ? void 0 : d.amount) > 0 && /* @__PURE__ */ e(I, { children: [
|
|
144
|
+
" + ",
|
|
145
|
+
/* @__PURE__ */ r(
|
|
146
|
+
y,
|
|
147
|
+
{
|
|
148
|
+
amount: i.cashFee.amount,
|
|
149
|
+
currency: i.cashFee.currency
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] })
|
|
153
|
+
] })
|
|
139
154
|
]
|
|
140
155
|
}
|
|
141
156
|
)
|
|
142
157
|
] })
|
|
143
158
|
] }),
|
|
144
|
-
/* @__PURE__ */ r("div", { className: `flight-details ${
|
|
145
|
-
|
|
159
|
+
/* @__PURE__ */ r("div", { className: `flight-details ${g ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { className: "inner", children: /* @__PURE__ */ r(
|
|
160
|
+
L,
|
|
146
161
|
{
|
|
147
|
-
itinerary:
|
|
148
|
-
origin:
|
|
149
|
-
destination:
|
|
162
|
+
itinerary: p.slices[0].segments,
|
|
163
|
+
origin: c,
|
|
164
|
+
destination: l
|
|
150
165
|
}
|
|
151
166
|
) }) })
|
|
152
167
|
] }) });
|
|
153
168
|
};
|
|
154
169
|
export {
|
|
155
|
-
|
|
170
|
+
Q as FlightResult
|
|
156
171
|
};
|
|
@@ -47,21 +47,21 @@ function oe(o, t, r) {
|
|
|
47
47
|
if (c.length === 0)
|
|
48
48
|
r == null || r(n), n = U();
|
|
49
49
|
else if (u > 0) {
|
|
50
|
-
const a = s.decode(c.subarray(0, u)), d = u + (c[u + 1] === 32 ? 2 : 1),
|
|
50
|
+
const a = s.decode(c.subarray(0, u)), d = u + (c[u + 1] === 32 ? 2 : 1), b = s.decode(c.subarray(d));
|
|
51
51
|
switch (a) {
|
|
52
52
|
case "data":
|
|
53
53
|
n.data = n.data ? n.data + `
|
|
54
|
-
` +
|
|
54
|
+
` + b : b;
|
|
55
55
|
break;
|
|
56
56
|
case "event":
|
|
57
|
-
n.event =
|
|
57
|
+
n.event = b;
|
|
58
58
|
break;
|
|
59
59
|
case "id":
|
|
60
|
-
o(n.id =
|
|
60
|
+
o(n.id = b);
|
|
61
61
|
break;
|
|
62
62
|
case "retry":
|
|
63
|
-
const
|
|
64
|
-
isNaN(
|
|
63
|
+
const g = parseInt(b, 10);
|
|
64
|
+
isNaN(g) || t(n.retry = g);
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -89,8 +89,8 @@ var ae = function(o, t) {
|
|
|
89
89
|
};
|
|
90
90
|
const x = "text/event-stream", ie = 1e3, z = "last-event-id";
|
|
91
91
|
function ue(o, t) {
|
|
92
|
-
var { signal: r, headers: n, onopen: s, onmessage: v, onclose: c, onerror: u, openWhenHidden: a, fetch: d } = t,
|
|
93
|
-
return new Promise((
|
|
92
|
+
var { signal: r, headers: n, onopen: s, onmessage: v, onclose: c, onerror: u, openWhenHidden: a, fetch: d } = t, b = ae(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
93
|
+
return new Promise((g, _) => {
|
|
94
94
|
const p = Object.assign({}, n);
|
|
95
95
|
p.accept || (p.accept = x);
|
|
96
96
|
let m;
|
|
@@ -103,19 +103,19 @@ function ue(o, t) {
|
|
|
103
103
|
document.removeEventListener("visibilitychange", w), window.clearTimeout(E), m.abort();
|
|
104
104
|
}
|
|
105
105
|
r == null || r.addEventListener("abort", () => {
|
|
106
|
-
S(),
|
|
106
|
+
S(), g();
|
|
107
107
|
});
|
|
108
108
|
const q = d ?? window.fetch, P = s ?? ce;
|
|
109
109
|
async function T() {
|
|
110
110
|
var C;
|
|
111
111
|
m = new AbortController();
|
|
112
112
|
try {
|
|
113
|
-
const O = await q(o, Object.assign(Object.assign({},
|
|
113
|
+
const O = await q(o, Object.assign(Object.assign({}, b), { headers: p, signal: m.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(), g();
|
|
119
119
|
} catch (O) {
|
|
120
120
|
if (!m.signal.aborted)
|
|
121
121
|
try {
|
|
@@ -146,8 +146,8 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
146
146
|
}, Ee = () => {
|
|
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
|
-
outboundResults:
|
|
150
|
-
setInboundResults:
|
|
149
|
+
outboundResults: b,
|
|
150
|
+
setInboundResults: g,
|
|
151
151
|
setOutboundResults: _,
|
|
152
152
|
partialOfferRequestId: p,
|
|
153
153
|
setPartialOfferRequestId: m
|
|
@@ -157,7 +157,7 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
157
157
|
inbound: f
|
|
158
158
|
}) => {
|
|
159
159
|
const i = V(e, l);
|
|
160
|
-
return (f ?
|
|
160
|
+
return (f ? g : _)(G(i)), i;
|
|
161
161
|
}, {
|
|
162
162
|
mutate: F,
|
|
163
163
|
status: E,
|
|
@@ -197,7 +197,6 @@ 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");
|
|
@@ -321,7 +320,7 @@ const de = 3 * 60 * 1e3, $ = (o) => {
|
|
|
321
320
|
inboundError: T,
|
|
322
321
|
roundTripFaresError: h,
|
|
323
322
|
// Results
|
|
324
|
-
outboundResults:
|
|
323
|
+
outboundResults: b,
|
|
325
324
|
inboundResults: d,
|
|
326
325
|
roundTripFares: s,
|
|
327
326
|
// Mutation triggers
|
|
@@ -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, h, g, M, P, N,
|
|
8
|
+
var r, t, a, n, i, o, m, h, g, M, P, N, A, L, w, d, p, c, y, C, b, l, u, D, k, O, z, f, v, _, $, Z, E, G;
|
|
9
9
|
return {
|
|
10
10
|
id: e.id,
|
|
11
11
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
@@ -16,25 +16,25 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
16
16
|
airportCode: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.iataCityCode) || ((g = (h = e.slices[0].segments[0].origin) == null ? void 0 : h.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: ((w = (
|
|
23
|
+
city: ((w = (L = e.slices[0].segments.getLast()) == null ? void 0 : L.destination) == null ? void 0 : w.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) || ((f = (z = (O = e.slices[0].segments.getLast()) == null ? void 0 : O.destination) == null ? void 0 : z.city) == null ? void 0 : f.iataCode),
|
|
26
26
|
coordinates: {
|
|
27
27
|
latitude: ($ = (_ = (v = e.slices[0].segments.getLast()) == null ? void 0 : v.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,12 +43,13 @@ 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))
|
|
@@ -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 = `${h.iataCode}_${g.iataCode}-${g.flightNumber}`, N = i.awayzMarketerMatchId,
|
|
69
|
+
}, M = i.awayzMatchId, P = `${h.iataCode}_${g.iataCode}-${g.flightNumber}`, N = i.awayzMarketerMatchId, A = !!h.flightNumber && h.flightNumber != "", L = !!g.flightNumber && g.flightNumber != "", w = 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,7 +74,7 @@ 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
79
|
if (w.length) {
|
|
79
80
|
i.slices[0].comparisonKey = w[0].awayzGroupId;
|
|
@@ -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
|
}
|
|
@@ -231,11 +233,9 @@ const B = (s) => s == null ? void 0 : s.map((e) => {
|
|
|
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,
|