@odynn/awayz-flights 0.5.7 → 0.5.9
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/{FlightResult-7HBkr7Al.js → FlightResult-CXQqIDcc.js} +101 -95
- package/dist/components/FlightResult/FlightResult.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/lib/hooks/useFlightSearch/useFlightSearch.types.d.ts +2 -0
- package/dist/lib/utils/flightUtils.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/utils/flightUtils.js +94 -87
- package/package.json +1 -1
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { jsx as r, jsxs as s, Fragment as
|
|
2
|
-
import { RewardsService as
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { g as
|
|
5
|
-
import { G as
|
|
6
|
-
import { E as
|
|
1
|
+
import { jsx as r, jsxs as s, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { RewardsService as Y, CashValue as k, EToolTipPosition as A, EInvalidAmountDisplayOption as J } from "@odynn/awayz-core";
|
|
3
|
+
import { useQuery as W } from "@tanstack/react-query";
|
|
4
|
+
import { g as X } from "./index-7zRjF0bU.js";
|
|
5
|
+
import { G as Z, g as I, a as f, E as d, F as w, b as V } from "./FlightItinerary-Dy-2zMYt.js";
|
|
6
|
+
import { E as B } from "./enums-DxmoBOKL.js";
|
|
7
7
|
import "./arrayExtensions-DFLvtO8l.js";
|
|
8
|
-
import
|
|
9
|
-
import { h as
|
|
10
|
-
import { useTranslation as
|
|
11
|
-
import { EPaymentType as
|
|
12
|
-
import { isSameDayFlight as
|
|
13
|
-
import { DEFAULT_AIRLINE_PROGRAM as
|
|
14
|
-
import './assets/FlightResult.css';const
|
|
15
|
-
function
|
|
8
|
+
import ii, { useState as M, useMemo as C } from "react";
|
|
9
|
+
import { h as N } from "./moment-BGjjqtLQ.js";
|
|
10
|
+
import { useTranslation as ri } from "react-i18next";
|
|
11
|
+
import { EPaymentType as u } from "./enums/EPaymentType.js";
|
|
12
|
+
import { isSameDayFlight as ei } from "./utils/flightDateUtils.js";
|
|
13
|
+
import { DEFAULT_AIRLINE_PROGRAM as si, getFlightNumber as ni, getLogoPath as ti, getAirlineProgram as oi } from "./utils/flightUtils.js";
|
|
14
|
+
import './assets/FlightResult.css';const ai = (i, n, a = n + "s") => i === 1 ? n : a;
|
|
15
|
+
function ci(i) {
|
|
16
16
|
if (!i || isNaN(i) || i < 0) return "N/A";
|
|
17
|
-
let
|
|
18
|
-
return
|
|
17
|
+
let n = i == null ? void 0 : i.toString().split(".")[0];
|
|
18
|
+
return n == null ? void 0 : n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
20
|
+
function L(i) {
|
|
21
|
+
return Z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z" }, child: [] }] })(i);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const Ti = ({
|
|
24
24
|
details: i,
|
|
25
|
-
onClick:
|
|
25
|
+
onClick: n,
|
|
26
26
|
showBestValue: a = !1,
|
|
27
|
-
onShowBestValueCalculation:
|
|
28
|
-
customStyling:
|
|
27
|
+
onShowBestValueCalculation: o,
|
|
28
|
+
customStyling: S = !1
|
|
29
29
|
}) => {
|
|
30
|
-
const { t: c } =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
x(e);
|
|
35
|
-
}, { flightNumbers: y, airlines: K } = L(() => {
|
|
30
|
+
const { t: c } = ri(), [D, _] = M(!1), m = i.origin, p = i.destination, E = i.flightDetails, O = i.paymentOptions || [], $ = O.filter((e) => e.points === -1).length === 1, R = O.filter((e) => e.points > -1).length === 1, [z, U] = M(si), x = async () => {
|
|
31
|
+
const e = await oi(i.airlineProgram);
|
|
32
|
+
U(e);
|
|
33
|
+
}, { flightNumbers: v, airlines: G } = C(() => {
|
|
36
34
|
const e = [], t = [];
|
|
37
35
|
return i.flightDetails.slices.forEach((g) => {
|
|
38
|
-
g.segments.forEach((
|
|
39
|
-
const l =
|
|
40
|
-
e.includes(l) || e.push(l)
|
|
41
|
-
const T =
|
|
42
|
-
t.some((
|
|
43
|
-
logo:
|
|
36
|
+
g.segments.forEach((P) => {
|
|
37
|
+
const l = ni(P);
|
|
38
|
+
e.includes(l) || e.push(l);
|
|
39
|
+
const T = P.operatingCarrier;
|
|
40
|
+
t.some((H) => H.airline === T.name) || t.push({
|
|
41
|
+
logo: ti(T.iataCode),
|
|
44
42
|
airline: T.name
|
|
45
43
|
});
|
|
46
44
|
});
|
|
47
|
-
}),
|
|
48
|
-
}, [i.flightDetails.slices]),
|
|
49
|
-
i.cash > 0 ?
|
|
50
|
-
},
|
|
45
|
+
}), x(), { flightNumbers: e, airlines: t };
|
|
46
|
+
}, [i.flightDetails.slices]), K = () => {
|
|
47
|
+
i.cash > 0 ? n(i, u.CASH) : n(i, u.POINTS);
|
|
48
|
+
}, j = !ei(
|
|
51
49
|
i.departureTime,
|
|
52
50
|
i.arrivalTime
|
|
53
|
-
),
|
|
54
|
-
queryKey: [
|
|
55
|
-
queryFn: () =>
|
|
51
|
+
), y = i == null ? void 0 : i.airlineProgram, { data: b } = W({
|
|
52
|
+
queryKey: [B.VALUE_CENTS, y],
|
|
53
|
+
queryFn: () => Y.getPointsPerCent(y ?? ""),
|
|
56
54
|
staleTime: 1 / 0,
|
|
57
55
|
placeholderData: 0,
|
|
58
|
-
enabled: !!
|
|
59
|
-
}),
|
|
56
|
+
enabled: !!y && a
|
|
57
|
+
}), q = () => {
|
|
60
58
|
var l;
|
|
61
|
-
if (!i || !
|
|
59
|
+
if (!i || !b || !i.points || !i.cash)
|
|
62
60
|
return {
|
|
63
61
|
pointsCashValue: 0,
|
|
64
|
-
|
|
62
|
+
bestValueStatus: "none"
|
|
63
|
+
/* NONE */
|
|
65
64
|
};
|
|
66
|
-
const e =
|
|
65
|
+
const e = b * i.points / 100, t = ((l = i.cashFee) == null ? void 0 : l.amount) || 0;
|
|
67
66
|
return {
|
|
68
|
-
|
|
67
|
+
bestValueStatus: e + t < i.cash ? "points" : "cash"
|
|
68
|
+
/* CASH */
|
|
69
69
|
};
|
|
70
|
-
}, {
|
|
70
|
+
}, { bestValueStatus: h } = q(), F = C(() => {
|
|
71
71
|
var e, t;
|
|
72
72
|
return (t = (e = i.paymentOptions) == null ? void 0 : e.find(
|
|
73
73
|
(g) => g.program === i.airlineProgram
|
|
@@ -76,11 +76,11 @@ const Ei = ({
|
|
|
76
76
|
return /* @__PURE__ */ r(
|
|
77
77
|
"div",
|
|
78
78
|
{
|
|
79
|
-
className: `${
|
|
80
|
-
onClick:
|
|
79
|
+
className: `${S ? "" : "awayz-"}flight-result`,
|
|
80
|
+
onClick: K,
|
|
81
81
|
children: /* @__PURE__ */ s("div", { className: "content", children: [
|
|
82
82
|
/* @__PURE__ */ r("div", { className: "flight-info", children: /* @__PURE__ */ s("div", { className: "flight-locations", children: [
|
|
83
|
-
/* @__PURE__ */ r("div", { className: "airlines", children:
|
|
83
|
+
/* @__PURE__ */ r("div", { className: "airlines", children: G.map((e, t) => /* @__PURE__ */ r(ii.Fragment, { children: /* @__PURE__ */ s("div", { className: "tip", children: [
|
|
84
84
|
/* @__PURE__ */ r("img", { src: e.logo, alt: e.airline }),
|
|
85
85
|
/* @__PURE__ */ r("span", { className: "right", children: e.airline })
|
|
86
86
|
] }, t) }, t)) }),
|
|
@@ -88,23 +88,23 @@ const Ei = ({
|
|
|
88
88
|
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
89
89
|
m.city,
|
|
90
90
|
",",
|
|
91
|
-
|
|
91
|
+
I(m.country)
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */ r("p", { className: "show-desktop", children:
|
|
94
|
-
c(
|
|
93
|
+
/* @__PURE__ */ r("p", { className: "show-desktop", children: N(i.departureTime).format(
|
|
94
|
+
c(f.DATE_TIME_MEDIUM, d.FlightShortDate)
|
|
95
95
|
) }),
|
|
96
96
|
/* @__PURE__ */ r("p", { className: "show-mobile", children: m.airportCode }),
|
|
97
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children:
|
|
98
|
-
c(
|
|
97
|
+
/* @__PURE__ */ r("p", { className: "show-mobile", children: N(i.departureTime).format(
|
|
98
|
+
c(f.TIME_ONLY, d.FlightTime)
|
|
99
99
|
) })
|
|
100
100
|
] }),
|
|
101
101
|
/* @__PURE__ */ s("div", { className: "flight-duration", children: [
|
|
102
102
|
/* @__PURE__ */ r("span", { className: "line" }),
|
|
103
103
|
/* @__PURE__ */ s("p", { children: [
|
|
104
|
-
|
|
104
|
+
X(E.slices[0].duration),
|
|
105
105
|
" ",
|
|
106
106
|
" - ",
|
|
107
|
-
i.numberOfStops > 0 ? `${i.numberOfStops} ${
|
|
107
|
+
i.numberOfStops > 0 ? `${i.numberOfStops} ${ai(
|
|
108
108
|
i.numberOfStops,
|
|
109
109
|
"Stop"
|
|
110
110
|
)}` : "Direct"
|
|
@@ -115,17 +115,17 @@ const Ei = ({
|
|
|
115
115
|
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
116
116
|
p.city,
|
|
117
117
|
", ",
|
|
118
|
-
|
|
118
|
+
I(p.country)
|
|
119
119
|
] }),
|
|
120
120
|
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
121
|
-
|
|
122
|
-
c(
|
|
121
|
+
N(i.arrivalTime).format(
|
|
122
|
+
c(f.DATE_TIME_MEDIUM, d.FlightShortDate)
|
|
123
123
|
),
|
|
124
124
|
" "
|
|
125
125
|
] }),
|
|
126
126
|
/* @__PURE__ */ r("p", { className: "show-mobile", children: p.airportCode }),
|
|
127
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children:
|
|
128
|
-
c(
|
|
127
|
+
/* @__PURE__ */ r("p", { className: "show-mobile", children: N(i.arrivalTime).format(
|
|
128
|
+
c(f.TIME_ONLY, d.FlightTime)
|
|
129
129
|
) })
|
|
130
130
|
] })
|
|
131
131
|
] }) }),
|
|
@@ -135,17 +135,17 @@ const Ei = ({
|
|
|
135
135
|
{
|
|
136
136
|
className: "flight-detail",
|
|
137
137
|
onClick: (e) => {
|
|
138
|
-
e.stopPropagation(),
|
|
138
|
+
e.stopPropagation(), _(!D);
|
|
139
139
|
},
|
|
140
140
|
children: [
|
|
141
141
|
/* @__PURE__ */ r("p", { children: "Aircraft" }),
|
|
142
142
|
/* @__PURE__ */ s("p", { className: "chevron-text", children: [
|
|
143
|
-
/* @__PURE__ */ r(
|
|
143
|
+
/* @__PURE__ */ r(w, {}),
|
|
144
144
|
/* @__PURE__ */ s("span", { children: [
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
v[0],
|
|
146
|
+
v.length > 1 && /* @__PURE__ */ s("sup", { children: [
|
|
147
147
|
"+",
|
|
148
|
-
|
|
148
|
+
v.length - 1
|
|
149
149
|
] })
|
|
150
150
|
] })
|
|
151
151
|
] })
|
|
@@ -156,34 +156,40 @@ const Ei = ({
|
|
|
156
156
|
i.cash > 0 && /* @__PURE__ */ s(
|
|
157
157
|
"div",
|
|
158
158
|
{
|
|
159
|
-
className: `amount-value ${
|
|
159
|
+
className: `amount-value ${h === "cash" && a ? "show-best-value-flag" : ""}`,
|
|
160
160
|
onClick: (e) => {
|
|
161
|
-
e.stopPropagation(),
|
|
161
|
+
e.stopPropagation(), n(i, u.CASH);
|
|
162
162
|
},
|
|
163
163
|
children: [
|
|
164
|
-
/* @__PURE__ */ r(
|
|
164
|
+
/* @__PURE__ */ r(
|
|
165
|
+
"img",
|
|
166
|
+
{
|
|
167
|
+
src: i.marketingLogo ?? i.airlineLogo,
|
|
168
|
+
alt: "marketing carrier logo"
|
|
169
|
+
}
|
|
170
|
+
),
|
|
165
171
|
/* @__PURE__ */ s("div", { children: [
|
|
166
|
-
/* @__PURE__ */ r("label", { children:
|
|
172
|
+
/* @__PURE__ */ r("label", { children: $ ? "Book For" : "From" }),
|
|
167
173
|
/* @__PURE__ */ r(
|
|
168
|
-
|
|
174
|
+
k,
|
|
169
175
|
{
|
|
170
176
|
amount: i.cash,
|
|
171
177
|
currency: i.currency,
|
|
172
|
-
position:
|
|
178
|
+
position: A.LEFT
|
|
173
179
|
}
|
|
174
180
|
)
|
|
175
181
|
] }),
|
|
176
|
-
|
|
182
|
+
h === "cash" && a && /* @__PURE__ */ s(
|
|
177
183
|
"div",
|
|
178
184
|
{
|
|
179
185
|
className: "best-value-flag tip",
|
|
180
186
|
onClick: (e) => {
|
|
181
|
-
e.stopPropagation(),
|
|
187
|
+
e.stopPropagation(), o == null || o(i);
|
|
182
188
|
},
|
|
183
189
|
children: [
|
|
184
|
-
|
|
190
|
+
o && /* @__PURE__ */ r(L, {}),
|
|
185
191
|
/* @__PURE__ */ r("p", { children: "Best Value" }),
|
|
186
|
-
|
|
192
|
+
o && /* @__PURE__ */ r("span", { children: "Click to learn more" })
|
|
187
193
|
]
|
|
188
194
|
}
|
|
189
195
|
)
|
|
@@ -193,40 +199,40 @@ const Ei = ({
|
|
|
193
199
|
i.points > 0 && /* @__PURE__ */ s(
|
|
194
200
|
"div",
|
|
195
201
|
{
|
|
196
|
-
className: `amount-value ${h && a ? "show-best-value-flag" : ""}`,
|
|
202
|
+
className: `amount-value ${h === "points" && a ? "show-best-value-flag" : ""}`,
|
|
197
203
|
onClick: (e) => {
|
|
198
|
-
e.stopPropagation(),
|
|
204
|
+
e.stopPropagation(), n(i, u.POINTS);
|
|
199
205
|
},
|
|
200
206
|
children: [
|
|
201
|
-
h && a && /* @__PURE__ */ s(
|
|
207
|
+
h === "points" && a && /* @__PURE__ */ s(
|
|
202
208
|
"div",
|
|
203
209
|
{
|
|
204
210
|
className: "best-value-flag tip",
|
|
205
211
|
onClick: (e) => {
|
|
206
|
-
e.stopPropagation(),
|
|
212
|
+
e.stopPropagation(), o == null || o(i);
|
|
207
213
|
},
|
|
208
214
|
children: [
|
|
209
|
-
|
|
215
|
+
o && /* @__PURE__ */ r(L, {}),
|
|
210
216
|
/* @__PURE__ */ r("p", { children: "Best Value" }),
|
|
211
|
-
|
|
217
|
+
o && /* @__PURE__ */ r("span", { children: "Click to learn more" })
|
|
212
218
|
]
|
|
213
219
|
}
|
|
214
220
|
),
|
|
215
|
-
/* @__PURE__ */ r("img", { src:
|
|
221
|
+
/* @__PURE__ */ r("img", { src: z.programLogo }),
|
|
216
222
|
/* @__PURE__ */ s("div", { children: [
|
|
217
|
-
/* @__PURE__ */ r("label", { children:
|
|
223
|
+
/* @__PURE__ */ r("label", { children: R ? "Book For" : "From" }),
|
|
218
224
|
/* @__PURE__ */ s("p", { children: [
|
|
219
|
-
`${
|
|
220
|
-
!!F && /* @__PURE__ */ s(
|
|
225
|
+
`${ci(i.points)} ${c("miles")}`,
|
|
226
|
+
!!F && /* @__PURE__ */ s(Q, { children: [
|
|
221
227
|
" + ",
|
|
222
228
|
/* @__PURE__ */ r(
|
|
223
|
-
|
|
229
|
+
k,
|
|
224
230
|
{
|
|
225
231
|
amount: F.amount,
|
|
226
232
|
currency: F.currency,
|
|
227
233
|
customDisplay: "No fee",
|
|
228
|
-
zeroDisplayOption:
|
|
229
|
-
position:
|
|
234
|
+
zeroDisplayOption: J.CUSTOM,
|
|
235
|
+
position: A.LEFT
|
|
230
236
|
}
|
|
231
237
|
)
|
|
232
238
|
] })
|
|
@@ -238,12 +244,12 @@ const Ei = ({
|
|
|
238
244
|
] })
|
|
239
245
|
] }),
|
|
240
246
|
/* @__PURE__ */ r("div", { className: `flight-details ${D ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { className: "inner", children: /* @__PURE__ */ r(
|
|
241
|
-
|
|
247
|
+
V,
|
|
242
248
|
{
|
|
243
249
|
itinerary: E.slices[0].segments,
|
|
244
250
|
origin: m,
|
|
245
251
|
destination: p,
|
|
246
|
-
isMultiDayFlight:
|
|
252
|
+
isMultiDayFlight: j
|
|
247
253
|
}
|
|
248
254
|
) }) })
|
|
249
255
|
] })
|
|
@@ -251,6 +257,6 @@ const Ei = ({
|
|
|
251
257
|
);
|
|
252
258
|
};
|
|
253
259
|
export {
|
|
254
|
-
|
|
255
|
-
|
|
260
|
+
Ti as F,
|
|
261
|
+
ci as c
|
|
256
262
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "@odynn/awayz-core";
|
|
3
3
|
import "@tanstack/react-query";
|
|
4
|
-
import { F as x } from "../../FlightResult-
|
|
4
|
+
import { F as x } from "../../FlightResult-CXQqIDcc.js";
|
|
5
5
|
import "../../index-7zRjF0bU.js";
|
|
6
6
|
import "../../FlightItinerary-Dy-2zMYt.js";
|
|
7
7
|
import "../../enums-DxmoBOKL.js";
|
package/dist/components/index.js
CHANGED
|
@@ -128,6 +128,7 @@ export interface IFlightPaymentOption {
|
|
|
128
128
|
iataCode: string;
|
|
129
129
|
name: string;
|
|
130
130
|
};
|
|
131
|
+
cabinClass?: string;
|
|
131
132
|
}
|
|
132
133
|
export interface IFlightResult {
|
|
133
134
|
id: string;
|
|
@@ -149,6 +150,7 @@ export interface IFlightResult {
|
|
|
149
150
|
awayzGroupId: string;
|
|
150
151
|
duration: string;
|
|
151
152
|
airlineProgram: string;
|
|
153
|
+
marketingLogo?: string;
|
|
152
154
|
durationMinutes: number;
|
|
153
155
|
flightDetails: IFlightOffer;
|
|
154
156
|
paymentOptions: IFlightPaymentOption[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IFlightOffer, IFlightResult } from '../hooks/useFlightSearch/useFlightSearch.types';
|
|
2
1
|
import { ISegment } from '@type-op/shared';
|
|
2
|
+
import { IFlightOffer, IFlightResult } from '../hooks/useFlightSearch/useFlightSearch.types';
|
|
3
3
|
import { IAirlineProgram } from '../services/wallet/WalletService.types';
|
|
4
4
|
import { ECabinClass } from '../types/ECabinClass';
|
|
5
5
|
/**
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFlightSearch as o } from "./hooks/useFlightSearch/useFlightSearch.js";
|
|
2
2
|
import { useAirportSearch as g } from "./hooks/useAirportSearch/useAirportSearch.js";
|
|
3
3
|
import { EBaggage as s } from "./hooks/useFlightSearch/useFlightSearch.types.js";
|
|
4
|
-
import { F as f, c as l } from "./FlightResult-
|
|
4
|
+
import { F as f, c as l } from "./FlightResult-CXQqIDcc.js";
|
|
5
5
|
import { EPaymentType as x } from "./enums/EPaymentType.js";
|
|
6
6
|
import { DEFAULT_AIRLINE_PROGRAM as C, getAirlineProgram as E, getFlightNumber as F, getLogoPath as c } from "./utils/flightUtils.js";
|
|
7
7
|
import { isSameDayFlight as y } from "./utils/flightDateUtils.js";
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as p } from "../moment-BGjjqtLQ.js";
|
|
1
|
+
import { awayzClient as j } from "@odynn/awayz-core";
|
|
3
2
|
import { d as B, D as Q } from "../index-7zRjF0bU.js";
|
|
4
3
|
import "../arrayExtensions-DFLvtO8l.js";
|
|
5
4
|
import "react";
|
|
6
|
-
import {
|
|
5
|
+
import { h as p } from "../moment-BGjjqtLQ.js";
|
|
6
|
+
import { mapBaggageType as V } from "../hooks/useFlightSearch/useFlightSearch.types.js";
|
|
7
7
|
import { WalletService as Y } from "../services/wallet/WalletService.js";
|
|
8
8
|
import { ERewardProgramCategories as x } from "../services/wallet/WalletService.types.js";
|
|
9
9
|
const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
10
|
-
var
|
|
10
|
+
var n, r, g, m, s, a, i, o, l, c, d, y, C, b, F, D, L, k, A, T, P, O, h, v, R, E, I, _, M, z, N, S, Z, $;
|
|
11
11
|
return {
|
|
12
12
|
id: e.id,
|
|
13
13
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
14
14
|
partial: e == null ? void 0 : e.partial,
|
|
15
15
|
origin: {
|
|
16
|
-
city: ((
|
|
17
|
-
country: ((
|
|
18
|
-
airportCode: ((
|
|
16
|
+
city: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.cityName) || ((g = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : g.name),
|
|
17
|
+
country: ((m = e.slices[0].segments[0].origin) == null ? void 0 : m.iataCountryCode) || ((a = (s = e.slices[0].segments[0].origin) == null ? void 0 : s.city) == null ? void 0 : a.iataCountryCode),
|
|
18
|
+
airportCode: ((i = e.slices[0].segments[0].origin) == null ? void 0 : i.iataCityCode) || ((l = (o = e.slices[0].segments[0].origin) == null ? void 0 : o.city) == null ? void 0 : l.iataCode),
|
|
19
19
|
coordinates: {
|
|
20
|
-
latitude: (d = (
|
|
21
|
-
longitude: (
|
|
20
|
+
latitude: (d = (c = e.slices[0].segments[0].origin) == null ? void 0 : c.city) == null ? void 0 : d.latitude,
|
|
21
|
+
longitude: (C = (y = e.slices[0].segments[0].origin) == null ? void 0 : y.city) == null ? void 0 : C.longitude
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
destination: {
|
|
25
|
-
city: ((
|
|
26
|
-
country: ((
|
|
25
|
+
city: ((F = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : F.cityName) || ((k = (L = (D = e.slices[0].segments.getLast()) == null ? void 0 : D.destination) == null ? void 0 : L.city) == null ? void 0 : k.name),
|
|
26
|
+
country: ((T = (A = e.slices[0].segments.getLast()) == null ? void 0 : A.destination) == null ? void 0 : T.iataCountryCode) || ((h = (O = (P = e.slices[0].segments.getLast()) == null ? void 0 : P.destination) == null ? void 0 : O.city) == null ? void 0 : h.iataCountryCode),
|
|
27
27
|
airportCode: ((R = (v = e.slices[0].segments.getLast()) == null ? void 0 : v.destination) == null ? void 0 : R.iataCityCode) || ((_ = (I = (E = e.slices[0].segments.getLast()) == null ? void 0 : E.destination) == null ? void 0 : I.city) == null ? void 0 : _.iataCode),
|
|
28
28
|
coordinates: {
|
|
29
|
-
latitude: (
|
|
30
|
-
longitude: (
|
|
29
|
+
latitude: (N = (z = (M = e.slices[0].segments.getLast()) == null ? void 0 : M.destination) == null ? void 0 : z.city) == null ? void 0 : N.latitude,
|
|
30
|
+
longitude: ($ = (Z = (S = e.slices[0].segments.getLast()) == null ? void 0 : S.destination) == null ? void 0 : Z.city) == null ? void 0 : $.longitude
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
airline: e.owner.name,
|
|
34
|
-
airlineLogo:
|
|
34
|
+
airlineLogo: u(
|
|
35
|
+
e.slices[0].segments[0].operatingCarrier.iataCode
|
|
36
|
+
),
|
|
37
|
+
marketingLogo: u(
|
|
35
38
|
e.slices[0].segments[0].marketingCarrier.iataCode
|
|
36
39
|
),
|
|
37
40
|
cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
|
|
@@ -58,41 +61,41 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
58
61
|
cabinClass: e.slices[0].segments[0].passengers[0].cabinClass || e.slices[0].segments[0].passengers[0].cabin.name || e.slices[0].segments[0].passengers[0].cabinClassMarketingName || e.slices[0].segments[0].passengers[0].cabin.marketingName
|
|
59
62
|
};
|
|
60
63
|
}), K = (t) => {
|
|
61
|
-
const e = t.operatingCarrierFlightNumber ? t.operatingCarrier : t.marketingCarrier,
|
|
62
|
-
return e.iataCode + " " + W(
|
|
64
|
+
const e = t.operatingCarrierFlightNumber ? t.operatingCarrier : t.marketingCarrier, n = t.operatingCarrierFlightNumber ?? t.marketingCarrierFlightNumber;
|
|
65
|
+
return e.iataCode + " " + W(n);
|
|
63
66
|
}, re = ({
|
|
64
67
|
originCode: t,
|
|
65
68
|
destinationCode: e,
|
|
66
|
-
departureDate:
|
|
67
|
-
cabinClass:
|
|
68
|
-
passengerCount:
|
|
69
|
-
paymentType:
|
|
69
|
+
departureDate: n,
|
|
70
|
+
cabinClass: r,
|
|
71
|
+
passengerCount: g,
|
|
72
|
+
paymentType: m
|
|
70
73
|
}) => {
|
|
71
74
|
let s = "/flights/search/one-way/points-cash?";
|
|
72
|
-
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_date=${
|
|
73
|
-
}, H = (t) => t.flightDetails.slices[0].segments.map((
|
|
75
|
+
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_date=${n}`, s += `&cabin_class=${r}`, s += `&adults=${g}`, s += `&cash_or_points=[${m}]`, s;
|
|
76
|
+
}, H = (t) => t.flightDetails.slices[0].segments.map((n) => K(n)).join("_"), oe = (t) => {
|
|
74
77
|
const e = {};
|
|
75
78
|
t.forEach((s) => {
|
|
76
79
|
const a = H(s);
|
|
77
80
|
if (e[a]) {
|
|
78
|
-
const
|
|
79
|
-
e[a].flight.paymentOptions.push(
|
|
80
|
-
const o =
|
|
81
|
+
const i = U(s);
|
|
82
|
+
e[a].flight.paymentOptions.push(i);
|
|
83
|
+
const o = w(
|
|
81
84
|
e[a].flight.paymentOptions
|
|
82
85
|
);
|
|
83
86
|
e[a].flight.cash = o.lowestCash, e[a].flight.points = o.lowestPoints;
|
|
84
87
|
} else {
|
|
85
|
-
const { origin:
|
|
88
|
+
const { origin: i, destination: o } = s, l = [U(s)], c = w(l);
|
|
86
89
|
e[a] = {
|
|
87
90
|
programs: [],
|
|
88
91
|
flight: {
|
|
89
92
|
id: s.awayzGroupId,
|
|
90
93
|
partial: s.partial,
|
|
91
94
|
origin: {
|
|
92
|
-
city:
|
|
93
|
-
country:
|
|
94
|
-
airportCode:
|
|
95
|
-
coordinates:
|
|
95
|
+
city: i.city,
|
|
96
|
+
country: i.country,
|
|
97
|
+
airportCode: i.airportCode,
|
|
98
|
+
coordinates: i.coordinates
|
|
96
99
|
},
|
|
97
100
|
destination: {
|
|
98
101
|
city: o.city,
|
|
@@ -101,11 +104,14 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
101
104
|
coordinates: o.coordinates
|
|
102
105
|
},
|
|
103
106
|
airline: s.airline,
|
|
104
|
-
airlineLogo:
|
|
107
|
+
airlineLogo: u(
|
|
108
|
+
s.flightDetails.slices[0].segments[0].operatingCarrier.iataCode
|
|
109
|
+
),
|
|
110
|
+
marketingLogo: u(
|
|
105
111
|
s.flightDetails.slices[0].segments[0].marketingCarrier.iataCode
|
|
106
112
|
),
|
|
107
113
|
flightNumber: s.flightNumber,
|
|
108
|
-
paymentOptions:
|
|
114
|
+
paymentOptions: l,
|
|
109
115
|
numberOfStops: s.numberOfStops,
|
|
110
116
|
departureTime: s.departureTime,
|
|
111
117
|
arrivalTime: s.arrivalTime,
|
|
@@ -123,8 +129,8 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
123
129
|
destinationTimeZone: s.flightDetails.slices[0].segments.getLast().destination.timeZone,
|
|
124
130
|
duration: s.flightDetails.slices[0].duration
|
|
125
131
|
}),
|
|
126
|
-
cash:
|
|
127
|
-
points:
|
|
132
|
+
cash: c.lowestCash,
|
|
133
|
+
points: c.lowestPoints,
|
|
128
134
|
flightDetails: s.flightDetails,
|
|
129
135
|
currency: s.flightDetails.baseCurrency,
|
|
130
136
|
cashFee: s.cashFee,
|
|
@@ -134,65 +140,65 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
134
140
|
}
|
|
135
141
|
s.airlineProgram && !e[a].programs.includes(s.airlineProgram) && e[a].programs.push(s.airlineProgram);
|
|
136
142
|
});
|
|
137
|
-
const
|
|
143
|
+
const n = [];
|
|
138
144
|
Object.values(e).forEach((s) => {
|
|
139
145
|
const a = [
|
|
140
146
|
...new Set(
|
|
141
|
-
s.flight.paymentOptions.map((
|
|
147
|
+
s.flight.paymentOptions.map((i) => i.carrier.name)
|
|
142
148
|
)
|
|
143
149
|
];
|
|
144
|
-
s.programs.length > 0 ? s.programs.forEach((
|
|
150
|
+
s.programs.length > 0 ? s.programs.forEach((i) => {
|
|
145
151
|
a.forEach((o) => {
|
|
146
|
-
var
|
|
147
|
-
const
|
|
152
|
+
var c;
|
|
153
|
+
const l = w(
|
|
148
154
|
s.flight.paymentOptions.filter(
|
|
149
|
-
(d) => d.program ===
|
|
155
|
+
(d) => d.program === i || d.cash > 0 && d.carrier.name === o
|
|
150
156
|
)
|
|
151
157
|
);
|
|
152
|
-
|
|
158
|
+
n.push({
|
|
153
159
|
...s.flight,
|
|
154
160
|
airline: o,
|
|
155
|
-
airlineLogo:
|
|
156
|
-
(
|
|
161
|
+
airlineLogo: u(
|
|
162
|
+
(c = s.flight.paymentOptions.find(
|
|
157
163
|
(d) => d.carrier.name === o
|
|
158
|
-
)) == null ? void 0 :
|
|
164
|
+
)) == null ? void 0 : c.carrier.iataCode
|
|
159
165
|
),
|
|
160
|
-
airlineProgram:
|
|
161
|
-
cash:
|
|
162
|
-
points:
|
|
166
|
+
airlineProgram: i,
|
|
167
|
+
cash: l.lowestCash,
|
|
168
|
+
points: l.lowestPoints
|
|
163
169
|
});
|
|
164
170
|
});
|
|
165
|
-
}) : a.forEach((
|
|
166
|
-
var
|
|
167
|
-
const { lowestCash: o } =
|
|
171
|
+
}) : a.forEach((i) => {
|
|
172
|
+
var l;
|
|
173
|
+
const { lowestCash: o } = w(
|
|
168
174
|
s.flight.paymentOptions.filter(
|
|
169
|
-
(
|
|
175
|
+
(c) => c.carrier.name === i
|
|
170
176
|
)
|
|
171
177
|
);
|
|
172
|
-
|
|
178
|
+
n.push({
|
|
173
179
|
...s.flight,
|
|
174
|
-
airline:
|
|
175
|
-
airlineLogo:
|
|
176
|
-
(
|
|
177
|
-
(
|
|
178
|
-
)) == null ? void 0 :
|
|
180
|
+
airline: i,
|
|
181
|
+
airlineLogo: u(
|
|
182
|
+
(l = s.flight.paymentOptions.find(
|
|
183
|
+
(c) => c.carrier.name === i
|
|
184
|
+
)) == null ? void 0 : l.carrier.iataCode
|
|
179
185
|
),
|
|
180
186
|
cash: o
|
|
181
187
|
});
|
|
182
188
|
});
|
|
183
189
|
});
|
|
184
|
-
const { cashlessResults:
|
|
190
|
+
const { cashlessResults: r, otherResults: g } = n.reduce(
|
|
185
191
|
(s, a) => (a.cash <= 0 && a.points > 0 ? s.cashlessResults.push(a) : a.cash > 0 && s.otherResults.push(a), s),
|
|
186
192
|
{ cashlessResults: [], otherResults: [] }
|
|
187
|
-
),
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
(
|
|
191
|
-
) ||
|
|
192
|
-
}),
|
|
193
|
-
}, W = (t) => t ? t.replace(/^0+/, "") : "", ce = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`,
|
|
194
|
-
categoryLogo:
|
|
195
|
-
programLogo:
|
|
193
|
+
), m = g;
|
|
194
|
+
return r.forEach((s) => {
|
|
195
|
+
m.find(
|
|
196
|
+
(i) => i.awayzGroupId === s.awayzGroupId
|
|
197
|
+
) || m.push(s);
|
|
198
|
+
}), m;
|
|
199
|
+
}, W = (t) => t ? t.replace(/^0+/, "") : "", ce = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, u = (t) => `${Q}${t}.svg`, G = "/img/logo/odynn-eye.svg", q = {
|
|
200
|
+
categoryLogo: G,
|
|
201
|
+
programLogo: G,
|
|
196
202
|
awayzActive: [],
|
|
197
203
|
mainProgram: "Unknown",
|
|
198
204
|
displayProgram: "Unknown",
|
|
@@ -203,30 +209,30 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
203
209
|
// Using App Foreground Colour
|
|
204
210
|
url: "https://www.odynn.com"
|
|
205
211
|
}, me = async (t) => {
|
|
206
|
-
const { airlines: e } = await
|
|
212
|
+
const { airlines: e } = await j.ensureQueryData({
|
|
207
213
|
queryKey: ["walletAwards"],
|
|
208
214
|
queryFn: Y.getAwards,
|
|
209
215
|
staleTime: 864e5
|
|
210
216
|
// 24 hours
|
|
211
217
|
});
|
|
212
|
-
let
|
|
213
|
-
(
|
|
214
|
-
var
|
|
215
|
-
return ((
|
|
218
|
+
let n = e.find(
|
|
219
|
+
(r) => {
|
|
220
|
+
var g, m, s, a;
|
|
221
|
+
return ((m = (g = r.mainProgram) == null ? void 0 : g.toLowerCase()) == null ? void 0 : m.includes(t == null ? void 0 : t.toLowerCase())) || ((a = (s = r.displayProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : a.includes(t == null ? void 0 : t.toLowerCase()));
|
|
216
222
|
}
|
|
217
223
|
) ?? q;
|
|
218
|
-
return
|
|
224
|
+
return n || (n = {
|
|
219
225
|
...q,
|
|
220
226
|
mainProgram: t,
|
|
221
227
|
displayProgram: t,
|
|
222
228
|
id: t
|
|
223
|
-
}),
|
|
229
|
+
}), n;
|
|
224
230
|
}, U = (t) => {
|
|
225
|
-
var
|
|
226
|
-
const
|
|
227
|
-
(
|
|
228
|
-
type:
|
|
229
|
-
quantity:
|
|
231
|
+
var g, m, s, a, i, o, l, c, d, y;
|
|
232
|
+
const e = ((s = (m = (g = t.flightDetails.slices.getFirst()) == null ? void 0 : g.segments.getFirst()) == null ? void 0 : m.passengers.getFirst()) == null ? void 0 : s.baggages) ?? [], n = ((o = (i = (a = t.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : i.passengers.getFirst()) == null ? void 0 : o.cabinClass) ?? ((d = (c = (l = t.flightDetails.slices.getFirst()) == null ? void 0 : l.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : d.cabinClassMarketingName), r = e.map(
|
|
233
|
+
(C) => ({
|
|
234
|
+
type: V(C.type),
|
|
235
|
+
quantity: C.quantity
|
|
230
236
|
})
|
|
231
237
|
);
|
|
232
238
|
return {
|
|
@@ -235,24 +241,25 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
235
241
|
points: t.points,
|
|
236
242
|
program: t.airlineProgram,
|
|
237
243
|
baseCurrency: t.flightDetails.baseCurrency,
|
|
238
|
-
fareBrandName: (
|
|
244
|
+
fareBrandName: (y = t.flightDetails.slices.getFirst()) == null ? void 0 : y.fareBrandName,
|
|
245
|
+
cabinClass: n,
|
|
239
246
|
cashFee: t.cashFee,
|
|
240
247
|
conditions: t.flightDetails.conditions,
|
|
241
|
-
baggages:
|
|
248
|
+
baggages: r,
|
|
242
249
|
carrier: {
|
|
243
250
|
iataCode: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.iataCode,
|
|
244
251
|
name: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.name
|
|
245
252
|
}
|
|
246
253
|
};
|
|
247
|
-
},
|
|
254
|
+
}, w = (t) => {
|
|
248
255
|
const e = Math.min(
|
|
249
|
-
...t.filter((
|
|
250
|
-
),
|
|
251
|
-
...t.filter((
|
|
256
|
+
...t.filter((r) => r.cash > 0).map((r) => r.cash)
|
|
257
|
+
), n = Math.min(
|
|
258
|
+
...t.filter((r) => r.points > 0).map((r) => r.points)
|
|
252
259
|
);
|
|
253
260
|
return {
|
|
254
261
|
lowestCash: e === 1 / 0 ? -1 : e,
|
|
255
|
-
lowestPoints:
|
|
262
|
+
lowestPoints: n === 1 / 0 ? -1 : n
|
|
256
263
|
};
|
|
257
264
|
};
|
|
258
265
|
export {
|
|
@@ -260,7 +267,7 @@ export {
|
|
|
260
267
|
re as buildFlightSearchQuery,
|
|
261
268
|
me as getAirlineProgram,
|
|
262
269
|
K as getFlightNumber,
|
|
263
|
-
|
|
270
|
+
u as getFullLogoPath,
|
|
264
271
|
ce as getLogoPath,
|
|
265
272
|
oe as groupFlightResults,
|
|
266
273
|
ne as mapDataToFlightDetails,
|