@odynn/awayz-flights 0.6.1 → 0.6.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.
- package/dist/FlightResult-Dy1E7ip1.js +299 -0
- package/dist/components/FlightResult/FlightResult.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/lib/utils/flightUtils.d.ts +4 -10
- package/dist/main.js +1 -1
- package/dist/utils/flightUtils.js +61 -83
- package/package.json +1 -1
- package/dist/FlightResult-BUwYiRUk.js +0 -254
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { jsx as i, jsxs as n, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { RewardsService as S, CashValue as _, EToolTipPosition as L, EInvalidAmountDisplayOption as B, awayzClient as z, CurrencyService as rr } from "@odynn/awayz-core";
|
|
3
|
+
import { useQuery as er } from "@tanstack/react-query";
|
|
4
|
+
import { g as ir } from "./index-7zRjF0bU.js";
|
|
5
|
+
import { G as nr, g as R, a as d, E as N, F as tr, b as ar } from "./FlightItinerary-Dy-2zMYt.js";
|
|
6
|
+
import { E as D } from "./enums-DxmoBOKL.js";
|
|
7
|
+
import "./arrayExtensions-DFLvtO8l.js";
|
|
8
|
+
import sr, { useState as C, useMemo as $, useEffect as or } from "react";
|
|
9
|
+
import { h as v } from "./moment-BGjjqtLQ.js";
|
|
10
|
+
import { useTranslation as cr } from "react-i18next";
|
|
11
|
+
import { EPaymentType as P } from "./enums/EPaymentType.js";
|
|
12
|
+
import { isSameDayFlight as lr } from "./utils/flightDateUtils.js";
|
|
13
|
+
import { DEFAULT_AIRLINE_PROGRAM as mr, getFlightNumber as pr, getLogoPath as hr, getAirlineProgram as gr } from "./utils/flightUtils.js";
|
|
14
|
+
import './assets/FlightResult.css';const fr = (r, t, o = t + "s") => r === 1 ? t : o;
|
|
15
|
+
function ur(r) {
|
|
16
|
+
if (!r || isNaN(r) || r < 0) return "N/A";
|
|
17
|
+
let t = r == null ? void 0 : r.toString().split(".")[0];
|
|
18
|
+
return t == null ? void 0 : t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
19
|
+
}
|
|
20
|
+
function U(r) {
|
|
21
|
+
return nr({ 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: [] }] })(r);
|
|
22
|
+
}
|
|
23
|
+
async function q(r, t, o) {
|
|
24
|
+
if (!r || t === o) return r;
|
|
25
|
+
const s = await z.ensureQueryData({
|
|
26
|
+
queryKey: [D.CONVERT_CURRENCY, t, o],
|
|
27
|
+
staleTime: 1e3 * 60 * 60,
|
|
28
|
+
// 1 hour
|
|
29
|
+
queryFn: () => rr.convertCurrency({
|
|
30
|
+
baseCurrency: t,
|
|
31
|
+
targetCurrency: o
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
return r * s;
|
|
35
|
+
}
|
|
36
|
+
const Ir = ({
|
|
37
|
+
details: r,
|
|
38
|
+
onClick: t,
|
|
39
|
+
showBestValue: o = !1,
|
|
40
|
+
onShowBestValueCalculation: s,
|
|
41
|
+
customStyling: K = !1
|
|
42
|
+
}) => {
|
|
43
|
+
const { t: l } = cr(), [O, x] = C(!1), [m, Q] = C(
|
|
44
|
+
"none"
|
|
45
|
+
/* NONE */
|
|
46
|
+
), p = r.origin, h = r.destination, A = r.flightDetails, b = r.paymentOptions || [], w = b.filter((e) => e.points === -1).length === 1, G = b.filter((e) => e.points > -1).length === 1, [Y, j] = C(mr), H = async () => {
|
|
47
|
+
const e = await gr(r.airlineProgram);
|
|
48
|
+
j(e);
|
|
49
|
+
}, { flightNumbers: F, airlines: J } = $(() => {
|
|
50
|
+
const e = [], a = [];
|
|
51
|
+
return r.flightDetails.slices.forEach((c) => {
|
|
52
|
+
c.segments.forEach((f) => {
|
|
53
|
+
const u = pr(f);
|
|
54
|
+
e.includes(u) || e.push(u);
|
|
55
|
+
const y = f.operatingCarrier;
|
|
56
|
+
a.some((E) => E.airline === y.name) || a.push({
|
|
57
|
+
logo: hr(y.iataCode),
|
|
58
|
+
airline: y.name
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}), H(), { flightNumbers: e, airlines: a };
|
|
62
|
+
}, [r.flightDetails.slices]), W = () => {
|
|
63
|
+
r.cash > 0 ? t(r, P.CASH) : t(r, P.POINTS);
|
|
64
|
+
}, X = !lr(
|
|
65
|
+
r.departureTime,
|
|
66
|
+
r.arrivalTime
|
|
67
|
+
), T = r == null ? void 0 : r.airlineProgram, { data: I } = er({
|
|
68
|
+
queryKey: [D.VALUE_CENTS, T, "test"],
|
|
69
|
+
queryFn: () => S.getCentPerPoint(T),
|
|
70
|
+
staleTime: 1 / 0,
|
|
71
|
+
enabled: !!T && o
|
|
72
|
+
}), g = $(() => {
|
|
73
|
+
var e, a;
|
|
74
|
+
return (a = (e = r.paymentOptions) == null ? void 0 : e.find(
|
|
75
|
+
(c) => c.program === r.airlineProgram
|
|
76
|
+
)) == null ? void 0 : a.cashFee;
|
|
77
|
+
}, [r.paymentOptions, r.airlineProgram]), Z = async () => {
|
|
78
|
+
var k;
|
|
79
|
+
if (!r || !I || !r.points || !r.cash)
|
|
80
|
+
return;
|
|
81
|
+
const e = r.currency;
|
|
82
|
+
let a = {
|
|
83
|
+
valueCents: 1,
|
|
84
|
+
currency: e
|
|
85
|
+
};
|
|
86
|
+
try {
|
|
87
|
+
a = await z.ensureQueryData({
|
|
88
|
+
queryKey: [D.VALUE_CENTS, r.airlineProgram],
|
|
89
|
+
staleTime: 1e3 * 60 * 60,
|
|
90
|
+
// 1 hour
|
|
91
|
+
queryFn: () => S.getCentPerPoint(r.airlineProgram)
|
|
92
|
+
});
|
|
93
|
+
} catch {
|
|
94
|
+
console.warn(
|
|
95
|
+
"Failed to fetch value cents for airline program:",
|
|
96
|
+
r.airlineProgram
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const c = ((k = r.paymentOptions.find(
|
|
100
|
+
(M) => M.program === r.airlineProgram
|
|
101
|
+
)) == null ? void 0 : k.cashFee) ?? {
|
|
102
|
+
amount: 0,
|
|
103
|
+
currency: e
|
|
104
|
+
}, [f, u] = await Promise.all([
|
|
105
|
+
q(c.amount, c.currency, e),
|
|
106
|
+
q(
|
|
107
|
+
a.valueCents,
|
|
108
|
+
a.currency,
|
|
109
|
+
e
|
|
110
|
+
)
|
|
111
|
+
]), E = u * r.points / 100 + f < r.cash;
|
|
112
|
+
Q(
|
|
113
|
+
E ? "points" : "cash"
|
|
114
|
+
/* CASH */
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
return or(() => {
|
|
118
|
+
Z();
|
|
119
|
+
}, [r, I, g]), /* @__PURE__ */ i(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: `${K ? "" : "awayz-"}flight-result`,
|
|
123
|
+
onClick: W,
|
|
124
|
+
children: /* @__PURE__ */ n("div", { className: "content", children: [
|
|
125
|
+
/* @__PURE__ */ i("div", { className: "flight-info", children: /* @__PURE__ */ n("div", { className: "flight-locations", children: [
|
|
126
|
+
/* @__PURE__ */ i("div", { className: "airlines", children: J.map((e, a) => /* @__PURE__ */ i(sr.Fragment, { children: /* @__PURE__ */ n("div", { className: "tip", children: [
|
|
127
|
+
/* @__PURE__ */ i("img", { src: e.logo, alt: e.airline }),
|
|
128
|
+
/* @__PURE__ */ i("span", { className: "right", children: e.airline })
|
|
129
|
+
] }, a) }, a)) }),
|
|
130
|
+
/* @__PURE__ */ n("div", { className: "flight-location", children: [
|
|
131
|
+
/* @__PURE__ */ n("p", { className: "show-desktop", children: [
|
|
132
|
+
p.city,
|
|
133
|
+
",",
|
|
134
|
+
R(p.country)
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ i("p", { className: "show-desktop", children: v(r.departureTime).format(
|
|
137
|
+
l(d.DATE_TIME_MEDIUM, N.FlightShortDate)
|
|
138
|
+
) }),
|
|
139
|
+
/* @__PURE__ */ i("p", { className: "show-mobile", children: p.airportCode }),
|
|
140
|
+
/* @__PURE__ */ i("p", { className: "show-mobile", children: v(r.departureTime).format(
|
|
141
|
+
l(d.TIME_ONLY, N.FlightTime)
|
|
142
|
+
) })
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ n("div", { className: "flight-duration", children: [
|
|
145
|
+
/* @__PURE__ */ i("span", { className: "line" }),
|
|
146
|
+
/* @__PURE__ */ n("p", { children: [
|
|
147
|
+
ir(A.slices[0].duration),
|
|
148
|
+
" ",
|
|
149
|
+
" - ",
|
|
150
|
+
r.numberOfStops > 0 ? `${r.numberOfStops} ${fr(
|
|
151
|
+
r.numberOfStops,
|
|
152
|
+
"Stop"
|
|
153
|
+
)}` : "Direct"
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ i("span", { className: "line" })
|
|
156
|
+
] }),
|
|
157
|
+
/* @__PURE__ */ n("div", { children: [
|
|
158
|
+
/* @__PURE__ */ n("p", { className: "show-desktop", children: [
|
|
159
|
+
h.city,
|
|
160
|
+
", ",
|
|
161
|
+
R(h.country)
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ n("p", { className: "show-desktop", children: [
|
|
164
|
+
v(r.arrivalTime).format(
|
|
165
|
+
l(d.DATE_TIME_MEDIUM, N.FlightShortDate)
|
|
166
|
+
),
|
|
167
|
+
" "
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ i("p", { className: "show-mobile", children: h.airportCode }),
|
|
170
|
+
/* @__PURE__ */ i("p", { className: "show-mobile", children: v(r.arrivalTime).format(
|
|
171
|
+
l(d.TIME_ONLY, N.FlightTime)
|
|
172
|
+
) })
|
|
173
|
+
] })
|
|
174
|
+
] }) }),
|
|
175
|
+
/* @__PURE__ */ n("div", { className: "flight-footer", children: [
|
|
176
|
+
/* @__PURE__ */ i("div", { className: "flight-detail-container", children: /* @__PURE__ */ n(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
className: "flight-detail",
|
|
180
|
+
onClick: (e) => {
|
|
181
|
+
e.stopPropagation(), x(!O);
|
|
182
|
+
},
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ i("p", { children: "Aircraft" }),
|
|
185
|
+
/* @__PURE__ */ n("p", { className: "chevron-text", children: [
|
|
186
|
+
/* @__PURE__ */ i(tr, {}),
|
|
187
|
+
/* @__PURE__ */ n("span", { children: [
|
|
188
|
+
F[0],
|
|
189
|
+
F.length > 1 && /* @__PURE__ */ n("sup", { children: [
|
|
190
|
+
"+",
|
|
191
|
+
F.length - 1
|
|
192
|
+
] })
|
|
193
|
+
] })
|
|
194
|
+
] })
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
) }),
|
|
198
|
+
/* @__PURE__ */ n("div", { className: "booking-options ", children: [
|
|
199
|
+
r.cash > 0 && /* @__PURE__ */ n(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
className: `amount-value ${m === "cash" && o ? "show-best-value-flag" : ""}`,
|
|
203
|
+
onClick: (e) => {
|
|
204
|
+
e.stopPropagation(), t(r, P.CASH);
|
|
205
|
+
},
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ i("b", { children: "Cash" }),
|
|
208
|
+
/* @__PURE__ */ n("div", { children: [
|
|
209
|
+
/* @__PURE__ */ i("label", { children: w ? "Book For" : "From" }),
|
|
210
|
+
/* @__PURE__ */ i(
|
|
211
|
+
_,
|
|
212
|
+
{
|
|
213
|
+
amount: r.cash,
|
|
214
|
+
currency: r.currency,
|
|
215
|
+
position: L.LEFT
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] }),
|
|
219
|
+
m === "cash" && o && /* @__PURE__ */ n(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: "best-value-flag tip",
|
|
223
|
+
onClick: (e) => {
|
|
224
|
+
e.stopPropagation(), s == null || s(r);
|
|
225
|
+
},
|
|
226
|
+
children: [
|
|
227
|
+
s && /* @__PURE__ */ i(U, {}),
|
|
228
|
+
/* @__PURE__ */ i("p", { children: "Best Value" }),
|
|
229
|
+
s && /* @__PURE__ */ i("span", { children: "Click to learn more" })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
r.points > 0 && /* @__PURE__ */ n(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: `amount-value ${m === "points" && o ? "show-best-value-flag" : ""}`,
|
|
240
|
+
onClick: (e) => {
|
|
241
|
+
e.stopPropagation(), t(r, P.POINTS);
|
|
242
|
+
},
|
|
243
|
+
children: [
|
|
244
|
+
m === "points" && o && /* @__PURE__ */ n(
|
|
245
|
+
"div",
|
|
246
|
+
{
|
|
247
|
+
className: "best-value-flag tip",
|
|
248
|
+
onClick: (e) => {
|
|
249
|
+
e.stopPropagation(), s == null || s(r);
|
|
250
|
+
},
|
|
251
|
+
children: [
|
|
252
|
+
s && /* @__PURE__ */ i(U, {}),
|
|
253
|
+
/* @__PURE__ */ i("p", { children: "Best Value" }),
|
|
254
|
+
s && /* @__PURE__ */ i("span", { children: "Click to learn more" })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
/* @__PURE__ */ i("img", { src: Y.programLogo }),
|
|
259
|
+
/* @__PURE__ */ n("div", { children: [
|
|
260
|
+
/* @__PURE__ */ i("label", { children: G ? "Book For" : "From" }),
|
|
261
|
+
/* @__PURE__ */ n("p", { children: [
|
|
262
|
+
`${ur(r.points)} ${l("miles")}`,
|
|
263
|
+
!!g && /* @__PURE__ */ n(V, { children: [
|
|
264
|
+
" + ",
|
|
265
|
+
/* @__PURE__ */ i(
|
|
266
|
+
_,
|
|
267
|
+
{
|
|
268
|
+
amount: g.amount,
|
|
269
|
+
currency: g.currency,
|
|
270
|
+
customDisplay: "No fee",
|
|
271
|
+
zeroDisplayOption: B.CUSTOM,
|
|
272
|
+
position: L.LEFT
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
] })
|
|
276
|
+
] })
|
|
277
|
+
] })
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
] })
|
|
282
|
+
] }),
|
|
283
|
+
/* @__PURE__ */ i("div", { className: `flight-details ${O ? "is-open" : ""}`, children: /* @__PURE__ */ i("div", { className: "inner", children: /* @__PURE__ */ i(
|
|
284
|
+
ar,
|
|
285
|
+
{
|
|
286
|
+
itinerary: A.slices[0].segments,
|
|
287
|
+
origin: p,
|
|
288
|
+
destination: h,
|
|
289
|
+
isMultiDayFlight: X
|
|
290
|
+
}
|
|
291
|
+
) }) })
|
|
292
|
+
] })
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
export {
|
|
297
|
+
Ir as F,
|
|
298
|
+
ur as c
|
|
299
|
+
};
|
|
@@ -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-Dy1E7ip1.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
|
@@ -37,9 +37,9 @@ export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dep
|
|
|
37
37
|
}) => string;
|
|
38
38
|
/**
|
|
39
39
|
* This function organizes flight results into groups based on a unique flight key, consolidates payment options,
|
|
40
|
-
* and calculates the lowest cash and points values for each group. It
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* and calculates the lowest cash and points values for each group. It finds the cheapest cash option and duplicates
|
|
41
|
+
* it for each airline program, ignoring multiple cash carriers. Finally, it ensures that cashless results are
|
|
42
|
+
* included in the final results if they are not already present by cash results.
|
|
43
43
|
*
|
|
44
44
|
* @param flights - An array of flight results to be grouped and processed.
|
|
45
45
|
*
|
|
@@ -49,19 +49,13 @@ export declare const buildFlightSearchQuery: ({ originCode, destinationCode, dep
|
|
|
49
49
|
* American: 1 Cash Pricing - 1 Miles Pricing
|
|
50
50
|
* Hawaiian: 3 Cash Pricing - 2 Miles Pricing
|
|
51
51
|
*
|
|
52
|
-
* We will get the following results displayed on the UI:
|
|
52
|
+
* We will get the following results displayed on the UI (using cheapest cash option):
|
|
53
53
|
*
|
|
54
54
|
* | Flight Number | Marketing Carrier | Cash | Miles |
|
|
55
55
|
* | ------------- | ----------------- | ---- | ----------------------- |
|
|
56
|
-
* | AS 939 | Alaska | $163 | Alaska Mileage 7500 pts |
|
|
57
56
|
* | AS 939 | American | $123 | Alaska Mileage 7500 pts |
|
|
58
|
-
* | AS 939 | Hawaiian | $201 | Alaska Mileage 7500 pts |
|
|
59
|
-
* | AS 939 | Alaska | $163 | AAdvantage 6500 pts |
|
|
60
57
|
* | AS 939 | American | $123 | AAdvantage 6500 pts |
|
|
61
|
-
* | AS 939 | Hawaiian | $201 | AAdvantage 6500 pts |
|
|
62
|
-
* | AS 939 | Alaska | $163 | Hawaiian Miles 8500 pts |
|
|
63
58
|
* | AS 939 | American | $123 | Hawaiian Miles 8500 pts |
|
|
64
|
-
* | AS 939 | Hawaiian | $201 | Hawaiian Miles 8500 pts |
|
|
65
59
|
*
|
|
66
60
|
* @returns An array of flight results, with duplicates removed and cashless results included.
|
|
67
61
|
*/
|
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-Dy1E7ip1.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";
|
|
@@ -3,35 +3,35 @@ import { d as B, D as Q } from "../index-7zRjF0bU.js";
|
|
|
3
3
|
import "../arrayExtensions-DFLvtO8l.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { h as p } from "../moment-BGjjqtLQ.js";
|
|
6
|
-
import { mapBaggageType as
|
|
7
|
-
import { WalletService as
|
|
8
|
-
import { ERewardProgramCategories as
|
|
6
|
+
import { mapBaggageType as Y } from "../hooks/useFlightSearch/useFlightSearch.types.js";
|
|
7
|
+
import { WalletService as x } from "../services/wallet/WalletService.js";
|
|
8
|
+
import { ERewardProgramCategories as H } from "../services/wallet/WalletService.types.js";
|
|
9
9
|
const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
10
|
-
var a,
|
|
10
|
+
var a, l, c, n, s, i, r, o, g, m, u, d, y, b, w, F, D, L, h, A, P, T, O, k, v, I, R, E, _, z, M, N, 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: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.cityName) || ((
|
|
16
|
+
city: ((a = e.slices[0].segments[0].origin) == null ? void 0 : a.cityName) || ((c = (l = e.slices[0].segments[0].origin) == null ? void 0 : l.city) == null ? void 0 : c.name),
|
|
17
17
|
country: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.iataCountryCode) || ((i = (s = e.slices[0].segments[0].origin) == null ? void 0 : s.city) == null ? void 0 : i.iataCountryCode),
|
|
18
|
-
airportCode: ((r = e.slices[0].segments[0].origin) == null ? void 0 : r.iataCityCode) || ((
|
|
18
|
+
airportCode: ((r = e.slices[0].segments[0].origin) == null ? void 0 : r.iataCityCode) || ((g = (o = e.slices[0].segments[0].origin) == null ? void 0 : o.city) == null ? void 0 : g.iataCode),
|
|
19
19
|
coordinates: {
|
|
20
20
|
latitude: (u = (m = e.slices[0].segments[0].origin) == null ? void 0 : m.city) == null ? void 0 : u.latitude,
|
|
21
21
|
longitude: (y = (d = e.slices[0].segments[0].origin) == null ? void 0 : d.city) == null ? void 0 : y.longitude
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
destination: {
|
|
25
|
-
city: ((
|
|
26
|
-
country: ((
|
|
27
|
-
airportCode: ((
|
|
25
|
+
city: ((w = (b = e.slices[0].segments.getLast()) == null ? void 0 : b.destination) == null ? void 0 : w.cityName) || ((L = (D = (F = e.slices[0].segments.getLast()) == null ? void 0 : F.destination) == null ? void 0 : D.city) == null ? void 0 : L.name),
|
|
26
|
+
country: ((A = (h = e.slices[0].segments.getLast()) == null ? void 0 : h.destination) == null ? void 0 : A.iataCountryCode) || ((O = (T = (P = e.slices[0].segments.getLast()) == null ? void 0 : P.destination) == null ? void 0 : T.city) == null ? void 0 : O.iataCountryCode),
|
|
27
|
+
airportCode: ((v = (k = e.slices[0].segments.getLast()) == null ? void 0 : k.destination) == null ? void 0 : v.iataCityCode) || ((E = (R = (I = e.slices[0].segments.getLast()) == null ? void 0 : I.destination) == null ? void 0 : R.city) == null ? void 0 : E.iataCode),
|
|
28
28
|
coordinates: {
|
|
29
|
-
latitude: (
|
|
30
|
-
longitude: ($ = (Z = (
|
|
29
|
+
latitude: (M = (z = (_ = e.slices[0].segments.getLast()) == null ? void 0 : _.destination) == null ? void 0 : z.city) == null ? void 0 : M.latitude,
|
|
30
|
+
longitude: ($ = (Z = (N = e.slices[0].segments.getLast()) == null ? void 0 : N.destination) == null ? void 0 : Z.city) == null ? void 0 : $.longitude
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
airline: e.owner.name,
|
|
34
|
-
airlineLogo:
|
|
34
|
+
airlineLogo: C(
|
|
35
35
|
e.slices[0].segments[0].operatingCarrier.iataCode
|
|
36
36
|
),
|
|
37
37
|
cash: e.totalAmount ? parseFloat(e.totalAmount) : 0,
|
|
@@ -64,25 +64,25 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
64
64
|
originCode: t,
|
|
65
65
|
destinationCode: e,
|
|
66
66
|
departureDate: a,
|
|
67
|
-
cabinClass:
|
|
68
|
-
passengerCount:
|
|
67
|
+
cabinClass: l,
|
|
68
|
+
passengerCount: c,
|
|
69
69
|
paymentType: n
|
|
70
70
|
}) => {
|
|
71
71
|
let s = "/flights/search/one-way/points-cash?";
|
|
72
|
-
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_date=${a}`, s += `&cabin_class=${
|
|
73
|
-
},
|
|
72
|
+
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_date=${a}`, s += `&cabin_class=${l}`, s += `&adults=${c}`, s += `&cash_or_points=[${n}]`, s;
|
|
73
|
+
}, V = (t) => t.flightDetails.slices[0].segments.map((a) => K(a)).join("_"), oe = (t) => {
|
|
74
74
|
const e = {};
|
|
75
75
|
t.forEach((s) => {
|
|
76
|
-
const i =
|
|
76
|
+
const i = V(s);
|
|
77
77
|
if (e[i]) {
|
|
78
78
|
const r = U(s);
|
|
79
79
|
e[i].flight.paymentOptions.push(r);
|
|
80
|
-
const { lowestCash: o, currency:
|
|
80
|
+
const { lowestCash: o, currency: g, lowestPoints: m } = q(
|
|
81
81
|
e[i].flight.paymentOptions
|
|
82
82
|
);
|
|
83
|
-
e[i].flight.points = m, e[i].flight.cash = o,
|
|
83
|
+
e[i].flight.points = m, e[i].flight.cash = o, g && (e[i].flight.currency = g);
|
|
84
84
|
} else {
|
|
85
|
-
const { origin: r, destination: o } = s,
|
|
85
|
+
const { origin: r, destination: o } = s, g = [U(s)], m = q(g);
|
|
86
86
|
e[i] = {
|
|
87
87
|
programs: [],
|
|
88
88
|
flight: {
|
|
@@ -101,11 +101,11 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
101
101
|
coordinates: o.coordinates
|
|
102
102
|
},
|
|
103
103
|
airline: s.airline,
|
|
104
|
-
airlineLogo:
|
|
104
|
+
airlineLogo: C(
|
|
105
105
|
s.flightDetails.slices[0].segments[0].operatingCarrier.iataCode
|
|
106
106
|
),
|
|
107
107
|
flightNumber: s.flightNumber,
|
|
108
|
-
paymentOptions:
|
|
108
|
+
paymentOptions: g,
|
|
109
109
|
numberOfStops: s.numberOfStops,
|
|
110
110
|
departureTime: s.departureTime,
|
|
111
111
|
arrivalTime: s.arrivalTime,
|
|
@@ -136,61 +136,39 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
136
136
|
});
|
|
137
137
|
const a = [];
|
|
138
138
|
Object.values(e).forEach((s) => {
|
|
139
|
-
const i =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
];
|
|
139
|
+
const i = s.flight.paymentOptions.filter((r) => r.cash > 0).reduce(
|
|
140
|
+
(r, o) => o.cash < r.cash ? o : r,
|
|
141
|
+
{ cash: 1 / 0, carrier: { name: "", iataCode: "" } }
|
|
142
|
+
);
|
|
144
143
|
s.programs.length > 0 ? s.programs.forEach((r) => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
s.flight.paymentOptions.filter(
|
|
149
|
-
(u) => u.program === r || u.cash > 0 && u.carrier.name === o
|
|
150
|
-
)
|
|
151
|
-
);
|
|
152
|
-
a.push({
|
|
153
|
-
...s.flight,
|
|
154
|
-
airline: o,
|
|
155
|
-
airlineLogo: w(
|
|
156
|
-
(m = s.flight.paymentOptions.find(
|
|
157
|
-
(u) => u.carrier.name === o
|
|
158
|
-
)) == null ? void 0 : m.carrier.iataCode
|
|
159
|
-
),
|
|
160
|
-
airlineProgram: r,
|
|
161
|
-
cash: c.lowestCash,
|
|
162
|
-
points: c.lowestPoints
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}) : i.forEach((r) => {
|
|
166
|
-
var c;
|
|
167
|
-
const { lowestCash: o } = C(
|
|
168
|
-
s.flight.paymentOptions.filter(
|
|
169
|
-
(m) => m.carrier.name === r
|
|
170
|
-
)
|
|
171
|
-
);
|
|
144
|
+
const o = s.flight.paymentOptions.filter(
|
|
145
|
+
(m) => m.program === r && m.points > 0
|
|
146
|
+
), g = o.length > 0 ? Math.min(...o.map((m) => m.points)) : -1;
|
|
172
147
|
a.push({
|
|
173
148
|
...s.flight,
|
|
174
|
-
airline:
|
|
175
|
-
airlineLogo:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
),
|
|
180
|
-
cash: o
|
|
149
|
+
airline: i.carrier.name,
|
|
150
|
+
airlineLogo: C(i.carrier.iataCode),
|
|
151
|
+
airlineProgram: r,
|
|
152
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1,
|
|
153
|
+
points: g
|
|
181
154
|
});
|
|
155
|
+
}) : a.push({
|
|
156
|
+
...s.flight,
|
|
157
|
+
airline: i.carrier.name,
|
|
158
|
+
airlineLogo: C(i.carrier.iataCode),
|
|
159
|
+
cash: i.cash !== 1 / 0 ? i.cash : -1
|
|
182
160
|
});
|
|
183
161
|
});
|
|
184
|
-
const { cashlessResults:
|
|
162
|
+
const { cashlessResults: l, otherResults: c } = a.reduce(
|
|
185
163
|
(s, i) => (i.cash <= 0 && i.points > 0 ? s.cashlessResults.push(i) : i.cash > 0 && s.otherResults.push(i), s),
|
|
186
164
|
{ cashlessResults: [], otherResults: [] }
|
|
187
|
-
), n =
|
|
188
|
-
return
|
|
165
|
+
), n = c;
|
|
166
|
+
return l.forEach((s) => {
|
|
189
167
|
n.find(
|
|
190
168
|
(r) => r.awayzGroupId === s.awayzGroupId
|
|
191
169
|
) || n.push(s);
|
|
192
170
|
}), n;
|
|
193
|
-
}, W = (t) => t ? t.replace(/^0+/, "") : "", ce = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`,
|
|
171
|
+
}, W = (t) => t ? t.replace(/^0+/, "") : "", ce = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${Q}${t}.svg`, G = "/img/logo/odynn-eye.svg", S = {
|
|
194
172
|
categoryLogo: G,
|
|
195
173
|
programLogo: G,
|
|
196
174
|
awayzActive: [],
|
|
@@ -198,34 +176,34 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
198
176
|
displayProgram: "Unknown",
|
|
199
177
|
id: "Unknown",
|
|
200
178
|
totalAccumulatedPoints: 0,
|
|
201
|
-
category:
|
|
179
|
+
category: H.Airline,
|
|
202
180
|
colour: "#fff",
|
|
203
181
|
// Using App Foreground Colour
|
|
204
182
|
url: "https://www.odynn.com"
|
|
205
183
|
}, me = async (t) => {
|
|
206
184
|
const { airlines: e } = await j.ensureQueryData({
|
|
207
185
|
queryKey: ["walletAwards"],
|
|
208
|
-
queryFn:
|
|
186
|
+
queryFn: x.getAwards,
|
|
209
187
|
staleTime: 864e5
|
|
210
188
|
// 24 hours
|
|
211
189
|
});
|
|
212
190
|
let a = e.find(
|
|
213
|
-
(
|
|
214
|
-
var
|
|
215
|
-
return ((n = (
|
|
191
|
+
(l) => {
|
|
192
|
+
var c, n, s, i;
|
|
193
|
+
return ((n = (c = l.mainProgram) == null ? void 0 : c.toLowerCase()) == null ? void 0 : n.includes(t == null ? void 0 : t.toLowerCase())) || ((i = (s = l.displayProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : i.includes(t == null ? void 0 : t.toLowerCase()));
|
|
216
194
|
}
|
|
217
|
-
) ??
|
|
195
|
+
) ?? S;
|
|
218
196
|
return a || (a = {
|
|
219
|
-
...
|
|
197
|
+
...S,
|
|
220
198
|
mainProgram: t,
|
|
221
199
|
displayProgram: t,
|
|
222
200
|
id: t
|
|
223
201
|
}), a;
|
|
224
202
|
}, U = (t) => {
|
|
225
|
-
var
|
|
226
|
-
const e = ((s = (n = (
|
|
203
|
+
var c, n, s, i, r, o, g, m, u, d;
|
|
204
|
+
const e = ((s = (n = (c = t.flightDetails.slices.getFirst()) == null ? void 0 : c.segments.getFirst()) == null ? void 0 : n.passengers.getFirst()) == null ? void 0 : s.baggages) ?? [], a = ((o = (r = (i = t.flightDetails.slices.getFirst()) == null ? void 0 : i.segments.getFirst()) == null ? void 0 : r.passengers.getFirst()) == null ? void 0 : o.cabinClassMarketingName) ?? ((u = (m = (g = t.flightDetails.slices.getFirst()) == null ? void 0 : g.segments.getFirst()) == null ? void 0 : m.passengers.getFirst()) == null ? void 0 : u.cabinClass), l = e.map(
|
|
227
205
|
(y) => ({
|
|
228
|
-
type:
|
|
206
|
+
type: Y(y.type),
|
|
229
207
|
quantity: y.quantity
|
|
230
208
|
})
|
|
231
209
|
);
|
|
@@ -239,32 +217,32 @@ const ne = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
239
217
|
cabinClass: a,
|
|
240
218
|
cashFee: t.cashFee,
|
|
241
219
|
conditions: t.flightDetails.conditions,
|
|
242
|
-
baggages:
|
|
220
|
+
baggages: l,
|
|
243
221
|
carrier: {
|
|
244
222
|
iataCode: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.iataCode,
|
|
245
223
|
name: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.name
|
|
246
224
|
}
|
|
247
225
|
};
|
|
248
|
-
},
|
|
226
|
+
}, q = (t) => {
|
|
249
227
|
const e = t.filter((n) => n.cash > 0);
|
|
250
228
|
let a = { cash: 1 / 0, baseCurrency: "" };
|
|
251
229
|
for (const n of e)
|
|
252
230
|
n.cash < a.cash && (a = n);
|
|
253
|
-
const
|
|
231
|
+
const l = Math.min(
|
|
254
232
|
...t.filter((n) => n.points > 0).map((n) => n.points)
|
|
255
|
-
),
|
|
233
|
+
), c = a.cash;
|
|
256
234
|
return {
|
|
257
|
-
lowestCash:
|
|
258
|
-
lowestPoints:
|
|
235
|
+
lowestCash: c === 1 / 0 ? -1 : c,
|
|
236
|
+
lowestPoints: l === 1 / 0 ? -1 : l,
|
|
259
237
|
currency: a.baseCurrency === "" ? null : a.baseCurrency
|
|
260
238
|
};
|
|
261
239
|
};
|
|
262
240
|
export {
|
|
263
|
-
|
|
241
|
+
S as DEFAULT_AIRLINE_PROGRAM,
|
|
264
242
|
re as buildFlightSearchQuery,
|
|
265
243
|
me as getAirlineProgram,
|
|
266
244
|
K as getFlightNumber,
|
|
267
|
-
|
|
245
|
+
C as getFullLogoPath,
|
|
268
246
|
ce as getLogoPath,
|
|
269
247
|
oe as groupFlightResults,
|
|
270
248
|
ne as mapDataToFlightDetails,
|
package/package.json
CHANGED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as s, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import { RewardsService as Y, CashValue as A, EToolTipPosition as I, 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 C, 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
|
-
import "./arrayExtensions-DFLvtO8l.js";
|
|
8
|
-
import ii, { useState as k, useMemo as M } 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 ti, getLogoPath as ni, getAirlineProgram as oi } from "./utils/flightUtils.js";
|
|
14
|
-
import './assets/FlightResult.css';const ai = (i, t, a = t + "s") => i === 1 ? t : a;
|
|
15
|
-
function ci(i) {
|
|
16
|
-
if (!i || isNaN(i) || i < 0) return "N/A";
|
|
17
|
-
let t = i == null ? void 0 : i.toString().split(".")[0];
|
|
18
|
-
return t == null ? void 0 : t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
19
|
-
}
|
|
20
|
-
function S(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
|
-
}
|
|
23
|
-
const Ti = ({
|
|
24
|
-
details: i,
|
|
25
|
-
onClick: t,
|
|
26
|
-
showBestValue: a = !1,
|
|
27
|
-
onShowBestValueCalculation: o,
|
|
28
|
-
customStyling: L = !1
|
|
29
|
-
}) => {
|
|
30
|
-
const { t: l } = ri(), [T, _] = k(!1), m = i.origin, p = i.destination, E = i.flightDetails, D = i.paymentOptions || [], $ = D.filter((e) => e.points === -1).length === 1, R = D.filter((e) => e.points > -1).length === 1, [z, U] = k(si), x = async () => {
|
|
31
|
-
const e = await oi(i.airlineProgram);
|
|
32
|
-
U(e);
|
|
33
|
-
}, { flightNumbers: v, airlines: G } = M(() => {
|
|
34
|
-
const e = [], n = [];
|
|
35
|
-
return i.flightDetails.slices.forEach((g) => {
|
|
36
|
-
g.segments.forEach((P) => {
|
|
37
|
-
const O = ti(P);
|
|
38
|
-
e.includes(O) || e.push(O);
|
|
39
|
-
const F = P.operatingCarrier;
|
|
40
|
-
n.some((H) => H.airline === F.name) || n.push({
|
|
41
|
-
logo: ni(F.iataCode),
|
|
42
|
-
airline: F.name
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}), x(), { flightNumbers: e, airlines: n };
|
|
46
|
-
}, [i.flightDetails.slices]), K = () => {
|
|
47
|
-
i.cash > 0 ? t(i, u.CASH) : t(i, u.POINTS);
|
|
48
|
-
}, j = !ei(
|
|
49
|
-
i.departureTime,
|
|
50
|
-
i.arrivalTime
|
|
51
|
-
), y = i == null ? void 0 : i.airlineProgram, { data: b } = W({
|
|
52
|
-
queryKey: [B.VALUE_CENTS, y],
|
|
53
|
-
queryFn: () => Y.getCentPerPoint(y ?? ""),
|
|
54
|
-
staleTime: 1 / 0,
|
|
55
|
-
enabled: !!y && a
|
|
56
|
-
}), c = M(() => {
|
|
57
|
-
var e, n;
|
|
58
|
-
return (n = (e = i.paymentOptions) == null ? void 0 : e.find(
|
|
59
|
-
(g) => g.program === i.airlineProgram
|
|
60
|
-
)) == null ? void 0 : n.cashFee;
|
|
61
|
-
}, [i.paymentOptions, i.airlineProgram]), q = () => {
|
|
62
|
-
if (!i || !b || !i.points || !i.cash)
|
|
63
|
-
return {
|
|
64
|
-
pointsCashValue: 0,
|
|
65
|
-
bestValueStatus: "none"
|
|
66
|
-
/* NONE */
|
|
67
|
-
};
|
|
68
|
-
const e = b.valueCents * i.points / 100, n = (c == null ? void 0 : c.amount) || 0;
|
|
69
|
-
return {
|
|
70
|
-
bestValueStatus: e + n < i.cash ? "points" : "cash"
|
|
71
|
-
/* CASH */
|
|
72
|
-
};
|
|
73
|
-
}, { bestValueStatus: h } = q();
|
|
74
|
-
return /* @__PURE__ */ r(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: `${L ? "" : "awayz-"}flight-result`,
|
|
78
|
-
onClick: K,
|
|
79
|
-
children: /* @__PURE__ */ s("div", { className: "content", children: [
|
|
80
|
-
/* @__PURE__ */ r("div", { className: "flight-info", children: /* @__PURE__ */ s("div", { className: "flight-locations", children: [
|
|
81
|
-
/* @__PURE__ */ r("div", { className: "airlines", children: G.map((e, n) => /* @__PURE__ */ r(ii.Fragment, { children: /* @__PURE__ */ s("div", { className: "tip", children: [
|
|
82
|
-
/* @__PURE__ */ r("img", { src: e.logo, alt: e.airline }),
|
|
83
|
-
/* @__PURE__ */ r("span", { className: "right", children: e.airline })
|
|
84
|
-
] }, n) }, n)) }),
|
|
85
|
-
/* @__PURE__ */ s("div", { className: "flight-location", children: [
|
|
86
|
-
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
87
|
-
m.city,
|
|
88
|
-
",",
|
|
89
|
-
C(m.country)
|
|
90
|
-
] }),
|
|
91
|
-
/* @__PURE__ */ r("p", { className: "show-desktop", children: N(i.departureTime).format(
|
|
92
|
-
l(f.DATE_TIME_MEDIUM, d.FlightShortDate)
|
|
93
|
-
) }),
|
|
94
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children: m.airportCode }),
|
|
95
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children: N(i.departureTime).format(
|
|
96
|
-
l(f.TIME_ONLY, d.FlightTime)
|
|
97
|
-
) })
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ s("div", { className: "flight-duration", children: [
|
|
100
|
-
/* @__PURE__ */ r("span", { className: "line" }),
|
|
101
|
-
/* @__PURE__ */ s("p", { children: [
|
|
102
|
-
X(E.slices[0].duration),
|
|
103
|
-
" ",
|
|
104
|
-
" - ",
|
|
105
|
-
i.numberOfStops > 0 ? `${i.numberOfStops} ${ai(
|
|
106
|
-
i.numberOfStops,
|
|
107
|
-
"Stop"
|
|
108
|
-
)}` : "Direct"
|
|
109
|
-
] }),
|
|
110
|
-
/* @__PURE__ */ r("span", { className: "line" })
|
|
111
|
-
] }),
|
|
112
|
-
/* @__PURE__ */ s("div", { children: [
|
|
113
|
-
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
114
|
-
p.city,
|
|
115
|
-
", ",
|
|
116
|
-
C(p.country)
|
|
117
|
-
] }),
|
|
118
|
-
/* @__PURE__ */ s("p", { className: "show-desktop", children: [
|
|
119
|
-
N(i.arrivalTime).format(
|
|
120
|
-
l(f.DATE_TIME_MEDIUM, d.FlightShortDate)
|
|
121
|
-
),
|
|
122
|
-
" "
|
|
123
|
-
] }),
|
|
124
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children: p.airportCode }),
|
|
125
|
-
/* @__PURE__ */ r("p", { className: "show-mobile", children: N(i.arrivalTime).format(
|
|
126
|
-
l(f.TIME_ONLY, d.FlightTime)
|
|
127
|
-
) })
|
|
128
|
-
] })
|
|
129
|
-
] }) }),
|
|
130
|
-
/* @__PURE__ */ s("div", { className: "flight-footer", children: [
|
|
131
|
-
/* @__PURE__ */ r("div", { className: "flight-detail-container", children: /* @__PURE__ */ s(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
className: "flight-detail",
|
|
135
|
-
onClick: (e) => {
|
|
136
|
-
e.stopPropagation(), _(!T);
|
|
137
|
-
},
|
|
138
|
-
children: [
|
|
139
|
-
/* @__PURE__ */ r("p", { children: "Aircraft" }),
|
|
140
|
-
/* @__PURE__ */ s("p", { className: "chevron-text", children: [
|
|
141
|
-
/* @__PURE__ */ r(w, {}),
|
|
142
|
-
/* @__PURE__ */ s("span", { children: [
|
|
143
|
-
v[0],
|
|
144
|
-
v.length > 1 && /* @__PURE__ */ s("sup", { children: [
|
|
145
|
-
"+",
|
|
146
|
-
v.length - 1
|
|
147
|
-
] })
|
|
148
|
-
] })
|
|
149
|
-
] })
|
|
150
|
-
]
|
|
151
|
-
}
|
|
152
|
-
) }),
|
|
153
|
-
/* @__PURE__ */ s("div", { className: "booking-options ", children: [
|
|
154
|
-
i.cash > 0 && /* @__PURE__ */ s(
|
|
155
|
-
"div",
|
|
156
|
-
{
|
|
157
|
-
className: `amount-value ${h === "cash" && a ? "show-best-value-flag" : ""}`,
|
|
158
|
-
onClick: (e) => {
|
|
159
|
-
e.stopPropagation(), t(i, u.CASH);
|
|
160
|
-
},
|
|
161
|
-
children: [
|
|
162
|
-
/* @__PURE__ */ r("b", { children: "Cash" }),
|
|
163
|
-
/* @__PURE__ */ s("div", { children: [
|
|
164
|
-
/* @__PURE__ */ r("label", { children: $ ? "Book For" : "From" }),
|
|
165
|
-
/* @__PURE__ */ r(
|
|
166
|
-
A,
|
|
167
|
-
{
|
|
168
|
-
amount: i.cash,
|
|
169
|
-
currency: i.currency,
|
|
170
|
-
position: I.LEFT
|
|
171
|
-
}
|
|
172
|
-
)
|
|
173
|
-
] }),
|
|
174
|
-
h === "cash" && a && /* @__PURE__ */ s(
|
|
175
|
-
"div",
|
|
176
|
-
{
|
|
177
|
-
className: "best-value-flag tip",
|
|
178
|
-
onClick: (e) => {
|
|
179
|
-
e.stopPropagation(), o == null || o(i);
|
|
180
|
-
},
|
|
181
|
-
children: [
|
|
182
|
-
o && /* @__PURE__ */ r(S, {}),
|
|
183
|
-
/* @__PURE__ */ r("p", { children: "Best Value" }),
|
|
184
|
-
o && /* @__PURE__ */ r("span", { children: "Click to learn more" })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
i.points > 0 && /* @__PURE__ */ s(
|
|
192
|
-
"div",
|
|
193
|
-
{
|
|
194
|
-
className: `amount-value ${h === "points" && a ? "show-best-value-flag" : ""}`,
|
|
195
|
-
onClick: (e) => {
|
|
196
|
-
e.stopPropagation(), t(i, u.POINTS);
|
|
197
|
-
},
|
|
198
|
-
children: [
|
|
199
|
-
h === "points" && a && /* @__PURE__ */ s(
|
|
200
|
-
"div",
|
|
201
|
-
{
|
|
202
|
-
className: "best-value-flag tip",
|
|
203
|
-
onClick: (e) => {
|
|
204
|
-
e.stopPropagation(), o == null || o(i);
|
|
205
|
-
},
|
|
206
|
-
children: [
|
|
207
|
-
o && /* @__PURE__ */ r(S, {}),
|
|
208
|
-
/* @__PURE__ */ r("p", { children: "Best Value" }),
|
|
209
|
-
o && /* @__PURE__ */ r("span", { children: "Click to learn more" })
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
/* @__PURE__ */ r("img", { src: z.programLogo }),
|
|
214
|
-
/* @__PURE__ */ s("div", { children: [
|
|
215
|
-
/* @__PURE__ */ r("label", { children: R ? "Book For" : "From" }),
|
|
216
|
-
/* @__PURE__ */ s("p", { children: [
|
|
217
|
-
`${ci(i.points)} ${l("miles")}`,
|
|
218
|
-
!!c && /* @__PURE__ */ s(Q, { children: [
|
|
219
|
-
" + ",
|
|
220
|
-
/* @__PURE__ */ r(
|
|
221
|
-
A,
|
|
222
|
-
{
|
|
223
|
-
amount: c.amount,
|
|
224
|
-
currency: c.currency,
|
|
225
|
-
customDisplay: "No fee",
|
|
226
|
-
zeroDisplayOption: J.CUSTOM,
|
|
227
|
-
position: I.LEFT
|
|
228
|
-
}
|
|
229
|
-
)
|
|
230
|
-
] })
|
|
231
|
-
] })
|
|
232
|
-
] })
|
|
233
|
-
]
|
|
234
|
-
}
|
|
235
|
-
)
|
|
236
|
-
] })
|
|
237
|
-
] }),
|
|
238
|
-
/* @__PURE__ */ r("div", { className: `flight-details ${T ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { className: "inner", children: /* @__PURE__ */ r(
|
|
239
|
-
V,
|
|
240
|
-
{
|
|
241
|
-
itinerary: E.slices[0].segments,
|
|
242
|
-
origin: m,
|
|
243
|
-
destination: p,
|
|
244
|
-
isMultiDayFlight: j
|
|
245
|
-
}
|
|
246
|
-
) }) })
|
|
247
|
-
] })
|
|
248
|
-
}
|
|
249
|
-
);
|
|
250
|
-
};
|
|
251
|
-
export {
|
|
252
|
-
Ti as F,
|
|
253
|
-
ci as c
|
|
254
|
-
};
|