@odynn/awayz-flights 0.9.7 → 0.9.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/BookingOption-V-FzaupW.js +196 -0
- package/dist/FlightItinerary-C4KPpVcF.js +94 -0
- package/dist/assets/FlightItinerary.css +1 -1
- package/dist/assets/FlightItineraryDropdown.css +1 -0
- package/dist/assets/MiniFlightItinerary.css +1 -0
- package/dist/assets/_styles.css +1 -1
- package/dist/assets/_styles2.css +1 -1
- package/dist/components/BookingOption/BookingOption.js +3 -4
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/FlightItinerary/FlightItinerary.js +3 -4
- package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +22 -30
- package/dist/components/FlightResult/FlightResult.js +173 -183
- package/dist/components/HorizontalScroller/HorizontalScroller.js +3 -3
- package/dist/components/MiniFlightItinerary/MiniFlightItinerary.js +89 -7
- package/dist/components/index.js +5 -5
- package/dist/constants/endpoints.js +1 -1
- package/dist/enums-tLvxh02p.js +4 -0
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/useFlightSearch/useFlightSearch.js +420 -11
- package/dist/{index-D8ljJLcr.js → index-9LVJi5JO.js} +7 -7
- package/dist/index-Kopwbl-x.js +19 -0
- package/dist/lib/components/FlightItinerary/FlightItinerary.d.ts +1 -6
- package/dist/lib/components/FlightItineraryDropdown/FlightItineraryDropdown.d.ts +2 -4
- package/dist/lib/constants/endpoints.d.ts +2 -1
- package/dist/lib/services/flights/FlightsService.d.ts +1 -0
- package/dist/main.js +35 -34
- package/dist/services/flights/FlightsService.js +37 -28
- package/dist/utils/flightUtils.js +39 -40
- package/package.json +1 -1
- package/dist/BookingOption-BTupJyHW.js +0 -192
- package/dist/FlightItinerary-BYXRMQUD.js +0 -262
- package/dist/MiniFlightItinerary-D2tFssaK.js +0 -106
- package/dist/assets/_styles5.css +0 -1
- package/dist/index-Gj4bRuCQ.js +0 -15
- package/dist/index-nI16-czT.js +0 -4
- package/dist/useFlightSearch-Dxoeykpk.js +0 -420
package/dist/main.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAirportSearch as
|
|
3
|
-
import { EBaggage as
|
|
4
|
-
import {
|
|
5
|
-
import { FlightItineraryDropdown as
|
|
6
|
-
import { FlightResult as
|
|
7
|
-
import {
|
|
8
|
-
import { EPaymentType as
|
|
9
|
-
import { DEFAULT_AIRLINE_PROGRAM as
|
|
10
|
-
import { isSameDayFlight as
|
|
11
|
-
import { EFlightPaymentType as d, EFlightType as
|
|
12
|
-
import { ECabinClass as
|
|
13
|
-
import { c as
|
|
14
|
-
import { c as
|
|
1
|
+
import { useFlightSearch as a } from "./hooks/useFlightSearch/useFlightSearch.js";
|
|
2
|
+
import { useAirportSearch as Y } from "./hooks/useAirportSearch/useAirportSearch.js";
|
|
3
|
+
import { EBaggage as p } from "./hooks/useFlightSearch/useFlightSearch.types.js";
|
|
4
|
+
import { F as l, g as n } from "./FlightItinerary-C4KPpVcF.js";
|
|
5
|
+
import { FlightItineraryDropdown as f } from "./components/FlightItineraryDropdown/FlightItineraryDropdown.js";
|
|
6
|
+
import { FlightResult as S } from "./components/FlightResult/FlightResult.js";
|
|
7
|
+
import { MiniFlightItinerary as F } from "./components/MiniFlightItinerary/MiniFlightItinerary.js";
|
|
8
|
+
import { EPaymentType as y } from "./enums/EPaymentType.js";
|
|
9
|
+
import { DEFAULT_AIRLINE_PROGRAM as A, getAirlineProgram as C, getFlightNumber as c, getLogoPath as b } from "./utils/flightUtils.js";
|
|
10
|
+
import { isSameDayFlight as L } from "./utils/flightDateUtils.js";
|
|
11
|
+
import { EFlightPaymentType as d, EFlightType as H } from "./types/enums.js";
|
|
12
|
+
import { ECabinClass as R, getCabinClassLabel as U, getCabinClassList as O } from "./types/ECabinClass.js";
|
|
13
|
+
import { c as z, g as B, b as G, a as _ } from "./dateUtils-Cb9VQiIL.js";
|
|
14
|
+
import { c as W } from "./BookingOption-V-FzaupW.js";
|
|
15
15
|
import "./arrayExtensions-Ce8YopTP.js";
|
|
16
16
|
import "react";
|
|
17
|
+
var r = /* @__PURE__ */ ((e) => (e.USStringDateFormat = "MMM DD, YYYY", e.USStringDateTimeFormat = "MMM DD, YYYY, h:mm A (z)", e.FlightShortDate = "MMM DD - h:mm A", e.FlightTime = "h:mm A", e.DateFormat = "MM/DD", e.StringDateFormat = "MMM DD", e.FullDateFormat = "MM/DD/YYYY", e.ServerDate = "YYYY-MM-DD", e.GoogleDateFormat = "YYYYMMDDTHHmmssZ", e.AppleDateFormat = "YYYYMMDDTHHmmss", e.USStringDateWithTimeFormat = "MMM DD, YYYY, h:mm A", e))(r || {});
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
A as DEFAULT_AIRLINE_PROGRAM,
|
|
20
|
+
p as EBaggage,
|
|
21
|
+
R as ECabinClass,
|
|
22
|
+
r as EDateFormats,
|
|
22
23
|
d as EFlightPaymentType,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
H as EFlightType,
|
|
25
|
+
y as EPaymentType,
|
|
25
26
|
l as FlightItinerary,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
f as FlightItineraryDropdown,
|
|
28
|
+
S as FlightResult,
|
|
29
|
+
F as MiniFlightItinerary,
|
|
30
|
+
z as calculateTimeDifference,
|
|
31
|
+
W as commaSeparatedNumber,
|
|
32
|
+
C as getAirlineProgram,
|
|
33
|
+
U as getCabinClassLabel,
|
|
34
|
+
O as getCabinClassList,
|
|
34
35
|
n as getCountryNameByCode,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
B as getDuration,
|
|
37
|
+
c as getFlightNumber,
|
|
38
|
+
b as getLogoPath,
|
|
38
39
|
G as getTimeString,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
_ as getTimezoneOffsetOrCode,
|
|
41
|
+
L as isSameDayFlight,
|
|
42
|
+
Y as useAirportSearch,
|
|
42
43
|
a as useFlightSearch
|
|
43
44
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
|
-
var p = (
|
|
3
|
-
var
|
|
4
|
-
import { clientInstance as
|
|
2
|
+
var p = (o, s, a) => s in o ? g(o, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : o[s] = a;
|
|
3
|
+
var c = (o, s, a) => p(o, typeof s != "symbol" ? s + "" : s, a);
|
|
4
|
+
import { clientInstance as u } from "@odynn/awayz-core";
|
|
5
5
|
import "../../moment-BGjjqtLQ.js";
|
|
6
6
|
import "../../arrayExtensions-Ce8YopTP.js";
|
|
7
7
|
import { c as f } from "../../objectUtils-3IeCVocm.js";
|
|
8
8
|
import "react";
|
|
9
|
-
import { EFlightEndpoint as
|
|
9
|
+
import { EFlightEndpoint as d } from "../../constants/endpoints.js";
|
|
10
10
|
class y {
|
|
11
11
|
constructor() {
|
|
12
|
-
|
|
12
|
+
c(this, "getAirports", async (s) => {
|
|
13
13
|
try {
|
|
14
|
-
const { data: a } = await
|
|
15
|
-
`${
|
|
14
|
+
const { data: a } = await u.get(
|
|
15
|
+
`${d.GET_AIRPORTS}?search_term=${s}`
|
|
16
16
|
);
|
|
17
17
|
return a.data.map((e) => {
|
|
18
|
-
var
|
|
18
|
+
var i;
|
|
19
19
|
return {
|
|
20
20
|
city: {
|
|
21
21
|
name: e.city_name,
|
|
@@ -27,7 +27,7 @@ class y {
|
|
|
27
27
|
},
|
|
28
28
|
country: {
|
|
29
29
|
code: e.iata_country_code,
|
|
30
|
-
name: (
|
|
30
|
+
name: (i = e.country) == null ? void 0 : i.name
|
|
31
31
|
},
|
|
32
32
|
name: e.name,
|
|
33
33
|
iataCode: e.iata_code,
|
|
@@ -40,11 +40,11 @@ class y {
|
|
|
40
40
|
return [];
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
var a, n, e,
|
|
43
|
+
c(this, "cashOnlySearch", async (s) => {
|
|
44
|
+
var a, n, e, i, m, r;
|
|
45
45
|
try {
|
|
46
|
-
const { data: t } = await
|
|
47
|
-
|
|
46
|
+
const { data: t } = await u.post(
|
|
47
|
+
d.CASH_FLIGHT_SEARCH,
|
|
48
48
|
s
|
|
49
49
|
);
|
|
50
50
|
if (!t.success)
|
|
@@ -52,28 +52,28 @@ class y {
|
|
|
52
52
|
success: !1,
|
|
53
53
|
message: t.message
|
|
54
54
|
};
|
|
55
|
-
const
|
|
55
|
+
const _ = ((n = (a = t.data) == null ? void 0 : a.flights) == null ? void 0 : n.flatMap(
|
|
56
56
|
(l) => l.offers
|
|
57
57
|
)) ?? [];
|
|
58
58
|
return {
|
|
59
59
|
success: !0,
|
|
60
|
-
data: f(
|
|
60
|
+
data: f(_)
|
|
61
61
|
};
|
|
62
62
|
} catch (t) {
|
|
63
63
|
return console.error(JSON.stringify(t)), t.message === "canceled" ? {
|
|
64
64
|
success: !1,
|
|
65
|
-
message: ((
|
|
65
|
+
message: ((i = (e = t == null ? void 0 : t.response) == null ? void 0 : e.data) == null ? void 0 : i.message) || (t == null ? void 0 : t.message)
|
|
66
66
|
} : {
|
|
67
67
|
success: !1,
|
|
68
|
-
message: ((
|
|
68
|
+
message: ((r = (m = t == null ? void 0 : t.response) == null ? void 0 : m.data) == null ? void 0 : r.message) || (t == null ? void 0 : t.message)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
c(this, "roundTripOutboundSearch", async (s) => {
|
|
73
73
|
var a, n;
|
|
74
74
|
try {
|
|
75
|
-
const { data: e } = await
|
|
76
|
-
|
|
75
|
+
const { data: e } = await u.post(
|
|
76
|
+
d.CASH_OUTBOUND_SEARCH,
|
|
77
77
|
{ ...s, to: s.return_date, from: s.departure_date }
|
|
78
78
|
);
|
|
79
79
|
if (!e.success) throw e;
|
|
@@ -88,11 +88,11 @@ class y {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
|
|
91
|
+
c(this, "roundTripInboundSearch", async (s) => {
|
|
92
92
|
var a, n;
|
|
93
93
|
try {
|
|
94
|
-
const { data: e } = await
|
|
95
|
-
|
|
94
|
+
const { data: e } = await u.get(
|
|
95
|
+
d.CASH_INBOUND_SEARCH,
|
|
96
96
|
{
|
|
97
97
|
params: {
|
|
98
98
|
outbound_offer_id: s.outboundOfferId,
|
|
@@ -110,11 +110,11 @@ class y {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
|
|
113
|
+
c(this, "getRoundTripFares", async (s) => {
|
|
114
114
|
var a, n;
|
|
115
115
|
try {
|
|
116
|
-
const { data: e } = await
|
|
117
|
-
|
|
116
|
+
const { data: e } = await u.get(
|
|
117
|
+
d.ROUND_TRIP_FARES,
|
|
118
118
|
{
|
|
119
119
|
params: {
|
|
120
120
|
outbound_offer_id: s.outboundOfferId,
|
|
@@ -133,9 +133,18 @@ class y {
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
+
c(this, "getSupportedAirlinePrograms", async () => {
|
|
137
|
+
const { data: s } = await u.get(
|
|
138
|
+
d.SUPPORTED_AIRLINE_PROGRAMS
|
|
139
|
+
);
|
|
140
|
+
if (!s.success) throw s;
|
|
141
|
+
return s.data.reward_programs.map(
|
|
142
|
+
(a) => a.long_name
|
|
143
|
+
);
|
|
144
|
+
});
|
|
136
145
|
}
|
|
137
146
|
}
|
|
138
|
-
const
|
|
147
|
+
const C = new y();
|
|
139
148
|
export {
|
|
140
|
-
|
|
149
|
+
C as FlightService
|
|
141
150
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
import { defaultAwayzConfig as q, awayzClient as H } from "@odynn/awayz-core";
|
|
2
2
|
import { d as B } from "../dateUtils-Cb9VQiIL.js";
|
|
3
3
|
import "../arrayExtensions-Ce8YopTP.js";
|
|
4
|
-
import { D as K } from "../index-nI16-czT.js";
|
|
5
4
|
import "react";
|
|
6
5
|
import { h as u } from "../moment-BGjjqtLQ.js";
|
|
7
|
-
import { EFlightEndpoint as
|
|
8
|
-
import { mapBaggageType as
|
|
9
|
-
import { WalletService as
|
|
10
|
-
import { ERewardProgramCategories as
|
|
11
|
-
const
|
|
12
|
-
var i,
|
|
6
|
+
import { EFlightEndpoint as K } from "../constants/endpoints.js";
|
|
7
|
+
import { mapBaggageType as Y } from "../hooks/useFlightSearch/useFlightSearch.types.js";
|
|
8
|
+
import { WalletService as Q } from "../services/wallet/WalletService.js";
|
|
9
|
+
import { ERewardProgramCategories as W } from "../services/wallet/WalletService.types.js";
|
|
10
|
+
const J = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/", ce = (t) => t == null ? void 0 : t.map((e) => {
|
|
11
|
+
var i, p, o, c, s, a, n, r, l, m, g, d, y, F, b, w, L, A, D, h, P, T, O, k, I, R, _, v, E, M, $, z, G, S;
|
|
13
12
|
return {
|
|
14
13
|
id: e.id,
|
|
15
14
|
points: (e == null ? void 0 : e.points) >= 0 ? e.points : -1,
|
|
16
15
|
partial: e == null ? void 0 : e.partial,
|
|
17
16
|
origin: {
|
|
18
|
-
city: ((i = e.slices[0].segments[0].origin) == null ? void 0 : i.cityName) || ((o = (
|
|
17
|
+
city: ((i = e.slices[0].segments[0].origin) == null ? void 0 : i.cityName) || ((o = (p = e.slices[0].segments[0].origin) == null ? void 0 : p.city) == null ? void 0 : o.name),
|
|
19
18
|
country: ((c = e.slices[0].segments[0].origin) == null ? void 0 : c.iataCountryCode) || ((a = (s = e.slices[0].segments[0].origin) == null ? void 0 : s.city) == null ? void 0 : a.iataCountryCode),
|
|
20
|
-
airportCode: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.
|
|
19
|
+
airportCode: ((n = e.slices[0].segments[0].origin) == null ? void 0 : n.iataCode) || ((l = (r = e.slices[0].segments[0].origin) == null ? void 0 : r.city) == null ? void 0 : l.iataCode),
|
|
21
20
|
coordinates: {
|
|
22
21
|
latitude: (g = (m = e.slices[0].segments[0].origin) == null ? void 0 : m.city) == null ? void 0 : g.latitude,
|
|
23
22
|
longitude: (y = (d = e.slices[0].segments[0].origin) == null ? void 0 : d.city) == null ? void 0 : y.longitude
|
|
24
23
|
}
|
|
25
24
|
},
|
|
26
25
|
destination: {
|
|
27
|
-
city: ((b = (F = e.slices[0].segments.getLast()) == null ? void 0 : F.destination) == null ? void 0 : b.cityName) || ((
|
|
28
|
-
country: ((
|
|
29
|
-
airportCode: ((
|
|
26
|
+
city: ((b = (F = e.slices[0].segments.getLast()) == null ? void 0 : F.destination) == null ? void 0 : b.cityName) || ((A = (L = (w = e.slices[0].segments.getLast()) == null ? void 0 : w.destination) == null ? void 0 : L.city) == null ? void 0 : A.name),
|
|
27
|
+
country: ((h = (D = e.slices[0].segments.getLast()) == null ? void 0 : D.destination) == null ? void 0 : h.iataCountryCode) || ((O = (T = (P = e.slices[0].segments.getLast()) == null ? void 0 : P.destination) == null ? void 0 : T.city) == null ? void 0 : O.iataCountryCode),
|
|
28
|
+
airportCode: ((I = (k = e.slices[0].segments.getLast()) == null ? void 0 : k.destination) == null ? void 0 : I.iataCode) || ((v = (_ = (R = e.slices[0].segments.getLast()) == null ? void 0 : R.destination) == null ? void 0 : _.city) == null ? void 0 : v.iataCode),
|
|
30
29
|
coordinates: {
|
|
31
30
|
latitude: ($ = (M = (E = e.slices[0].segments.getLast()) == null ? void 0 : E.destination) == null ? void 0 : M.city) == null ? void 0 : $.latitude,
|
|
32
31
|
longitude: (S = (G = (z = e.slices[0].segments.getLast()) == null ? void 0 : z.destination) == null ? void 0 : G.city) == null ? void 0 : S.longitude
|
|
@@ -64,27 +63,27 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
64
63
|
}), j = (t) => {
|
|
65
64
|
const e = t.operatingCarrierFlightNumber ? t.operatingCarrier : t.marketingCarrier, i = t.operatingCarrierFlightNumber ?? t.marketingCarrierFlightNumber;
|
|
66
65
|
return e.iataCode + " " + X(i);
|
|
67
|
-
},
|
|
66
|
+
}, me = ({
|
|
68
67
|
originCode: t,
|
|
69
68
|
destinationCode: e,
|
|
70
69
|
dates: i,
|
|
71
|
-
cabinClass:
|
|
70
|
+
cabinClass: p,
|
|
72
71
|
passengerCount: o,
|
|
73
72
|
paymentType: c
|
|
74
73
|
}) => {
|
|
75
|
-
let s = `${
|
|
76
|
-
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, s += `&cabin_class=${
|
|
77
|
-
}, V = (t) => t.flightDetails.slices[0].segments.map((i) => j(i)).join("_") + "_" + u(t.departureTime).format("YYYYMMDD"), le = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "",
|
|
74
|
+
let s = `${K.CASH_POINTS_FLIGHT_SEARCH}?`;
|
|
75
|
+
return s += `origin=${t}`, s += `&destination=${e}`, s += `&departure_dates=[${i.map((a) => `"${a}"`).join(",")}]`, s += `&cabin_class=${p}`, s += `&adults=${o}`, s += `&cash_or_points=[${c}]`, s;
|
|
76
|
+
}, V = (t) => t.flightDetails.slices[0].segments.map((i) => j(i)).join("_") + "_" + u(t.departureTime).format("YYYYMMDD"), le = (t) => t ? t.replace(/[_-]/g, " ").split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ") : "", pe = (t) => {
|
|
78
77
|
const e = {};
|
|
79
78
|
t.forEach((s) => {
|
|
80
79
|
const a = V(s);
|
|
81
80
|
if (e[a]) {
|
|
82
81
|
const n = U(s);
|
|
83
82
|
e[a].flight.paymentOptions.push(n);
|
|
84
|
-
const { lowestCash: r, currency:
|
|
85
|
-
e[a].flight.points = m, e[a].flight.cashFee = g, e[a].flight.cash = r,
|
|
83
|
+
const { lowestCash: r, currency: l, lowestPoints: m, cashFee: g } = x(e[a].flight.paymentOptions);
|
|
84
|
+
e[a].flight.points = m, e[a].flight.cashFee = g, e[a].flight.cash = r, l && (e[a].flight.currency = l);
|
|
86
85
|
} else {
|
|
87
|
-
const { origin: n, destination: r } = s,
|
|
86
|
+
const { origin: n, destination: r } = s, l = [U(s)], m = x(l);
|
|
88
87
|
e[a] = {
|
|
89
88
|
programs: [],
|
|
90
89
|
flight: {
|
|
@@ -107,7 +106,7 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
107
106
|
s.flightDetails.slices[0].segments[0].operatingCarrier.iataCode
|
|
108
107
|
),
|
|
109
108
|
flightNumber: s.flightNumber,
|
|
110
|
-
paymentOptions:
|
|
109
|
+
paymentOptions: l,
|
|
111
110
|
numberOfStops: s.numberOfStops,
|
|
112
111
|
departureTime: s.departureTime,
|
|
113
112
|
arrivalTime: s.arrivalTime,
|
|
@@ -147,14 +146,14 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
147
146
|
s.programs.length > 0 ? s.programs.forEach((n) => {
|
|
148
147
|
const r = s.flight.paymentOptions.filter(
|
|
149
148
|
(m) => m.program === n && m.points > 0
|
|
150
|
-
),
|
|
149
|
+
), l = r.length > 0 ? Math.min(...r.map((m) => m.points)) : -1;
|
|
151
150
|
i.push({
|
|
152
151
|
...s.flight,
|
|
153
152
|
airline: a.carrier.name,
|
|
154
153
|
airlineLogo: C(a.carrier.iataCode),
|
|
155
154
|
airlineProgram: n,
|
|
156
155
|
cash: a.cash !== 1 / 0 ? a.cash : -1,
|
|
157
|
-
points:
|
|
156
|
+
points: l
|
|
158
157
|
});
|
|
159
158
|
}) : i.push({
|
|
160
159
|
...s.flight,
|
|
@@ -163,16 +162,16 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
163
162
|
cash: a.cash !== 1 / 0 ? a.cash : -1
|
|
164
163
|
});
|
|
165
164
|
});
|
|
166
|
-
const { cashlessResults:
|
|
165
|
+
const { cashlessResults: p, otherResults: o } = i.reduce(
|
|
167
166
|
(s, a) => (a.cash <= 0 && a.points > 0 ? s.cashlessResults.push(a) : a.cash > 0 && s.otherResults.push(a), s),
|
|
168
167
|
{ cashlessResults: [], otherResults: [] }
|
|
169
168
|
), c = [...o];
|
|
170
|
-
return
|
|
169
|
+
return p.forEach((s) => {
|
|
171
170
|
(!c.find(
|
|
172
171
|
(n) => n.awayzGroupId === s.awayzGroupId
|
|
173
172
|
) || o.length === 0) && c.push(s);
|
|
174
173
|
}), c;
|
|
175
|
-
}, X = (t) => t ? t.replace(/^0+/, "") : "",
|
|
174
|
+
}, X = (t) => t ? t.replace(/^0+/, "") : "", ge = (t) => `https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/${t}.svg`, C = (t) => `${J}${t}.svg`, Z = q.logoFallbackImageUrl, N = {
|
|
176
175
|
categoryLogo: Z,
|
|
177
176
|
programLogo: Z,
|
|
178
177
|
awayzActive: [],
|
|
@@ -180,21 +179,21 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
180
179
|
displayProgram: "Unknown",
|
|
181
180
|
id: "Unknown",
|
|
182
181
|
totalAccumulatedPoints: 0,
|
|
183
|
-
category:
|
|
182
|
+
category: W.Airline,
|
|
184
183
|
colour: "#fff",
|
|
185
184
|
// Using App Foreground Colour
|
|
186
185
|
url: "https://www.odynn.com"
|
|
187
|
-
},
|
|
186
|
+
}, ue = async (t) => {
|
|
188
187
|
const { airlines: e } = await H.ensureQueryData({
|
|
189
188
|
queryKey: ["walletAwards"],
|
|
190
|
-
queryFn:
|
|
189
|
+
queryFn: Q.getAwards,
|
|
191
190
|
staleTime: 864e5
|
|
192
191
|
// 24 hours
|
|
193
192
|
});
|
|
194
193
|
let i = e.find(
|
|
195
|
-
(
|
|
194
|
+
(p) => {
|
|
196
195
|
var o, c, s, a;
|
|
197
|
-
return ((c = (o =
|
|
196
|
+
return ((c = (o = p.mainProgram) == null ? void 0 : o.toLowerCase()) == null ? void 0 : c.includes(t == null ? void 0 : t.toLowerCase())) || ((a = (s = p.displayProgram) == null ? void 0 : s.toLowerCase()) == null ? void 0 : a.includes(t == null ? void 0 : t.toLowerCase()));
|
|
198
197
|
}
|
|
199
198
|
) ?? N;
|
|
200
199
|
return i || (i = {
|
|
@@ -204,10 +203,10 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
204
203
|
id: t
|
|
205
204
|
}), i;
|
|
206
205
|
}, U = (t) => {
|
|
207
|
-
var o, c, s, a, n, r,
|
|
208
|
-
const e = ((s = (c = (o = t.flightDetails.slices.getFirst()) == null ? void 0 : o.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : s.baggages) ?? [], i = ((r = (n = (a = t.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : n.passengers.getFirst()) == null ? void 0 : r.cabinClassMarketingName) ?? ((g = (m = (
|
|
206
|
+
var o, c, s, a, n, r, l, m, g, d;
|
|
207
|
+
const e = ((s = (c = (o = t.flightDetails.slices.getFirst()) == null ? void 0 : o.segments.getFirst()) == null ? void 0 : c.passengers.getFirst()) == null ? void 0 : s.baggages) ?? [], i = ((r = (n = (a = t.flightDetails.slices.getFirst()) == null ? void 0 : a.segments.getFirst()) == null ? void 0 : n.passengers.getFirst()) == null ? void 0 : r.cabinClassMarketingName) ?? ((g = (m = (l = t.flightDetails.slices.getFirst()) == null ? void 0 : l.segments.getFirst()) == null ? void 0 : m.passengers.getFirst()) == null ? void 0 : g.cabinClass), p = e.map(
|
|
209
208
|
(y) => ({
|
|
210
|
-
type:
|
|
209
|
+
type: Y(y.type),
|
|
211
210
|
quantity: y.quantity
|
|
212
211
|
})
|
|
213
212
|
);
|
|
@@ -221,7 +220,7 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
221
220
|
cabinClass: i,
|
|
222
221
|
cashFee: t.cashFee,
|
|
223
222
|
conditions: t.flightDetails.conditions,
|
|
224
|
-
baggages:
|
|
223
|
+
baggages: p,
|
|
225
224
|
carrier: {
|
|
226
225
|
iataCode: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.iataCode,
|
|
227
226
|
name: t.flightDetails.slices.getFirst().segments.getFirst().marketingCarrier.name
|
|
@@ -253,13 +252,13 @@ const me = (t) => t == null ? void 0 : t.map((e) => {
|
|
|
253
252
|
};
|
|
254
253
|
export {
|
|
255
254
|
N as DEFAULT_AIRLINE_PROGRAM,
|
|
256
|
-
|
|
255
|
+
me as buildFlightSearchQuery,
|
|
257
256
|
le as formatCabinClass,
|
|
258
|
-
|
|
257
|
+
ue as getAirlineProgram,
|
|
259
258
|
j as getFlightNumber,
|
|
260
259
|
C as getFullLogoPath,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
ge as getLogoPath,
|
|
261
|
+
pe as groupFlightResults,
|
|
262
|
+
ce as mapDataToFlightDetails,
|
|
264
263
|
X as removeLeadingZeros
|
|
265
264
|
};
|
package/package.json
CHANGED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { jsxs as r, jsx as o, Fragment as d } from "react/jsx-runtime";
|
|
2
|
-
import { useFeatureFlags as H, useWallet as Y, EBookingPaymentMethod as $, convertCashToClientPoints as M, CashValue as C, EToolTipPosition as y, EInvalidAmountDisplayOption as u, EAmountsDisplayFeature as j, ClientPointsValue as q } from "@odynn/awayz-core";
|
|
3
|
-
import { useQuery as z } from "@tanstack/react-query";
|
|
4
|
-
import "./moment-BGjjqtLQ.js";
|
|
5
|
-
import "./arrayExtensions-Ce8YopTP.js";
|
|
6
|
-
import W, { useState as g, useEffect as x } from "react";
|
|
7
|
-
import { F as v } from "./index-Gj4bRuCQ.js";
|
|
8
|
-
import { h as Z, i as O, j as K, k as Q } from "./index-D8ljJLcr.js";
|
|
9
|
-
import { EPaymentType as D } from "./enums/EPaymentType.js";
|
|
10
|
-
import { EBaggage as L } from "./hooks/useFlightSearch/useFlightSearch.types.js";
|
|
11
|
-
import { getAirlineProgram as b, formatCabinClass as G } from "./utils/flightUtils.js";
|
|
12
|
-
import './assets/_styles4.css';/* empty css */
|
|
13
|
-
const k = (e, l, t = l + "s") => e === 1 ? l : t, J = (e) => e ? e.toLowerCase().replace(/-/g, " ").split(" ").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" ") : "";
|
|
14
|
-
function X(e, l = !0) {
|
|
15
|
-
if ((!e || isNaN(e) || e < 0) && l) return "N/A";
|
|
16
|
-
let t = e == null ? void 0 : e.toString().split(".")[0];
|
|
17
|
-
return t == null ? void 0 : t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
18
|
-
}
|
|
19
|
-
const V = "USD", Co = ({
|
|
20
|
-
type: e,
|
|
21
|
-
title: l,
|
|
22
|
-
cashValue: t,
|
|
23
|
-
milesValue: I,
|
|
24
|
-
cashFee: p,
|
|
25
|
-
setSelected: F,
|
|
26
|
-
conditions: s,
|
|
27
|
-
slices: c,
|
|
28
|
-
baggages: f,
|
|
29
|
-
program: N
|
|
30
|
-
}) => {
|
|
31
|
-
var S, R, T;
|
|
32
|
-
const { featureFlags: h } = H(), [m, U] = g(!1), [A, w] = g(), { pointsAsCash: P } = Y(), i = s == null ? void 0 : s.refundBeforeDeparture, a = s == null ? void 0 : s.changeBeforeDeparture, E = (i != null && i.allowed ? 1 : 0) + (a != null && a.allowed ? 1 : 0) + (((R = (S = c == null ? void 0 : c[0]) == null ? void 0 : S.segments) == null ? void 0 : R.length) || 0), { data: _ } = z({
|
|
33
|
-
queryKey: ["airlineProgram", N],
|
|
34
|
-
queryFn: () => b(N),
|
|
35
|
-
enabled: !!N
|
|
36
|
-
});
|
|
37
|
-
return x(() => {
|
|
38
|
-
h.bookingPaymentMethodFeature === $.FULL_VCC_PARTIAL_DISABLED && M({
|
|
39
|
-
cashAmount: (t == null ? void 0 : t.amount) ?? 0,
|
|
40
|
-
currency: (t == null ? void 0 : t.currency) ?? "",
|
|
41
|
-
pointsAsCash: P
|
|
42
|
-
}).then((n) => {
|
|
43
|
-
P.availablePoints < n && w("Insufficient points balance.");
|
|
44
|
-
});
|
|
45
|
-
}, [t, h]), /* @__PURE__ */ r(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
className: "flight-booking-option",
|
|
49
|
-
onClick: (n) => n.stopPropagation(),
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ r("div", { className: "rate-details", children: [
|
|
52
|
-
e === D.POINTS && /* @__PURE__ */ o("img", { src: _ == null ? void 0 : _.programLogo }),
|
|
53
|
-
/* @__PURE__ */ o("p", { className: "fare-brand-name", children: J(l) })
|
|
54
|
-
] }),
|
|
55
|
-
e === D.CASH && /* @__PURE__ */ r("div", { className: "fare-comparison-content", children: [
|
|
56
|
-
f == null ? void 0 : f.map((n, B) => /* @__PURE__ */ r(W.Fragment, { children: [
|
|
57
|
-
n.type === L.CHECKED && /* @__PURE__ */ r("div", { className: "fare-option checked", children: [
|
|
58
|
-
/* @__PURE__ */ o("p", { children: "Checked bags:" }),
|
|
59
|
-
/* @__PURE__ */ o("p", { children: n.quantity })
|
|
60
|
-
] }),
|
|
61
|
-
n.type === L.CARRY_ON && /* @__PURE__ */ r("div", { className: "fare-option", children: [
|
|
62
|
-
/* @__PURE__ */ o("p", { children: "Carry-on bags:" }),
|
|
63
|
-
/* @__PURE__ */ o("p", { children: n.quantity })
|
|
64
|
-
] }),
|
|
65
|
-
n.type === null && /* @__PURE__ */ r("div", { className: "fare-option", children: [
|
|
66
|
-
/* @__PURE__ */ o(Z, {}),
|
|
67
|
-
/* @__PURE__ */ o("p", { children: "N/A" })
|
|
68
|
-
] })
|
|
69
|
-
] }, B)),
|
|
70
|
-
/* @__PURE__ */ r("div", { className: "fare-option refundable", children: [
|
|
71
|
-
"Refundable:",
|
|
72
|
-
" ",
|
|
73
|
-
i != null && i.allowed ? /* @__PURE__ */ o(O, { className: "yes" }) : /* @__PURE__ */ o(v, { className: "no" })
|
|
74
|
-
] }),
|
|
75
|
-
/* @__PURE__ */ r("div", { className: "fare-option changeable", children: [
|
|
76
|
-
"Changeable:",
|
|
77
|
-
" ",
|
|
78
|
-
a != null && a.allowed ? /* @__PURE__ */ o(O, { className: "yes" }) : /* @__PURE__ */ o(v, { className: "no" })
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ r(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: "fare-option show-more-toggle",
|
|
84
|
-
onClick: (n) => {
|
|
85
|
-
n.stopPropagation(), U(!m);
|
|
86
|
-
},
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ o("p", { children: m ? `Hide ${k(E, "option")}` : `+${E} ${k(E, "option")}` }),
|
|
89
|
-
/* @__PURE__ */ o("p", { children: m ? /* @__PURE__ */ o(K, {}) : /* @__PURE__ */ o(Q, {}) })
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
),
|
|
93
|
-
m && /* @__PURE__ */ r(d, { children: [
|
|
94
|
-
(i == null ? void 0 : i.allowed) && /* @__PURE__ */ r("div", { className: "fare-option", children: [
|
|
95
|
-
"Refundable Penalty:",
|
|
96
|
-
" ",
|
|
97
|
-
/* @__PURE__ */ o(
|
|
98
|
-
C,
|
|
99
|
-
{
|
|
100
|
-
amount: i.penaltyAmount || 0,
|
|
101
|
-
currency: i.penaltyCurrency || "",
|
|
102
|
-
zeroDisplayOption: u.DISPLAY_AS_ZERO_WITH_CURRENCY,
|
|
103
|
-
position: y.LEFT
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
] }),
|
|
107
|
-
(a == null ? void 0 : a.allowed) && /* @__PURE__ */ r("div", { className: "fare-option", children: [
|
|
108
|
-
"Changeable Penalty:",
|
|
109
|
-
" ",
|
|
110
|
-
/* @__PURE__ */ o(
|
|
111
|
-
C,
|
|
112
|
-
{
|
|
113
|
-
amount: a.penaltyAmount || 0,
|
|
114
|
-
currency: a.penaltyCurrency || "",
|
|
115
|
-
zeroDisplayOption: u.DISPLAY_AS_ZERO_WITH_CURRENCY,
|
|
116
|
-
position: y.LEFT
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
] }),
|
|
120
|
-
(T = c == null ? void 0 : c[0].segments) == null ? void 0 : T.map((n) => /* @__PURE__ */ r(
|
|
121
|
-
"div",
|
|
122
|
-
{
|
|
123
|
-
className: "fare-option checked",
|
|
124
|
-
children: [
|
|
125
|
-
/* @__PURE__ */ r("p", { children: [
|
|
126
|
-
n.origin.iataCode,
|
|
127
|
-
" - ",
|
|
128
|
-
n.destination.iataCode,
|
|
129
|
-
":"
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ r("div", { children: [
|
|
132
|
-
/* @__PURE__ */ o("img", { src: n.operatingCarrier.logo }),
|
|
133
|
-
/* @__PURE__ */ o("p", { children: G(n.passengers[0].cabinClass) })
|
|
134
|
-
] })
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
`${n.origin.iataCode}-${n.destination.iataCode}`
|
|
138
|
-
))
|
|
139
|
-
] })
|
|
140
|
-
] }),
|
|
141
|
-
/* @__PURE__ */ o(
|
|
142
|
-
"button",
|
|
143
|
-
{
|
|
144
|
-
onClick: (n) => {
|
|
145
|
-
n.stopPropagation(), F();
|
|
146
|
-
},
|
|
147
|
-
disabled: !!A,
|
|
148
|
-
children: e === D.CASH && t ? /* @__PURE__ */ o(d, { children: A ? /* @__PURE__ */ o("p", { children: A }) : /* @__PURE__ */ r(d, { children: [
|
|
149
|
-
/* @__PURE__ */ o(
|
|
150
|
-
C,
|
|
151
|
-
{
|
|
152
|
-
amount: t.amount,
|
|
153
|
-
currency: t.currency,
|
|
154
|
-
position: y.LEFT,
|
|
155
|
-
zeroDisplayOption: u.DISPLAY_AS_ZERO_WITH_CURRENCY,
|
|
156
|
-
decimalPlaces: 2
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
h.amountsDisplayFeature === j.CASH_AND_CLIENT_POINTS && /* @__PURE__ */ r(d, { children: [
|
|
160
|
-
" / ",
|
|
161
|
-
/* @__PURE__ */ o(
|
|
162
|
-
q,
|
|
163
|
-
{
|
|
164
|
-
currency: t.currency,
|
|
165
|
-
cashAmount: t.amount
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
] })
|
|
169
|
-
] }) }) : /* @__PURE__ */ r(d, { children: [
|
|
170
|
-
`${X(I)} miles + `,
|
|
171
|
-
/* @__PURE__ */ o(
|
|
172
|
-
C,
|
|
173
|
-
{
|
|
174
|
-
amount: (p == null ? void 0 : p.amount) || 0,
|
|
175
|
-
currency: (p == null ? void 0 : p.currency) || V,
|
|
176
|
-
position: y.LEFT,
|
|
177
|
-
customDisplay: "No fee",
|
|
178
|
-
zeroDisplayOption: u.CUSTOM
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
] })
|
|
182
|
-
}
|
|
183
|
-
)
|
|
184
|
-
]
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
export {
|
|
189
|
-
Co as B,
|
|
190
|
-
X as c,
|
|
191
|
-
k as p
|
|
192
|
-
};
|