@odynn/awayz-flights 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsx as r, jsxs as e, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { g as y, E as c, F as
|
|
4
|
-
import { DEFAULT_AIRLINE_PROGRAM as
|
|
1
|
+
import { jsx as r, jsxs as e, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import R, { useState as F, useMemo as B } from "react";
|
|
3
|
+
import { g as y, E as c, F as M, a as $ } from "../../FlightItinerary-COx1k-zp.js";
|
|
4
|
+
import { DEFAULT_AIRLINE_PROGRAM as x, getFlightNumber as j, getLogoPath as H, getAirlineProgram as U } from "../../utils/flightUtils.js";
|
|
5
5
|
import { h } from "../../moment-BGjjqtLQ.js";
|
|
6
|
-
import { g as
|
|
6
|
+
import { g as _ } from "../../index-D0Heof44.js";
|
|
7
7
|
import "../../arrayExtensions-DFLvtO8l.js";
|
|
8
8
|
import { EPaymentType as m } from "../../enums/EPaymentType.js";
|
|
9
|
-
import { CashValue as C, EInvalidAmountDisplayOption as
|
|
10
|
-
import { isSameDayFlight as
|
|
11
|
-
import '../../assets/FlightResult.css';function
|
|
9
|
+
import { CashValue as C, EInvalidAmountDisplayOption as z } from "@odynn/awayz-core";
|
|
10
|
+
import { isSameDayFlight as G } from "../../utils/flightDateUtils.js";
|
|
11
|
+
import '../../assets/FlightResult.css';function V(i) {
|
|
12
12
|
if (!i || isNaN(i) || i < 0) return "N/A";
|
|
13
13
|
let o = i == null ? void 0 : i.toString().split(".")[0];
|
|
14
14
|
return o == null ? void 0 : o.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const ei = ({ details: i, onClick: o }) => {
|
|
17
17
|
var u;
|
|
18
|
-
const [d, D] = F(!1), n = i.origin, t = i.destination, f = i.flightDetails, N =
|
|
19
|
-
const a = await
|
|
20
|
-
|
|
21
|
-
}, { flightNumbers: p, airlines:
|
|
18
|
+
const [d, D] = F(!1), n = i.origin, t = i.destination, f = i.flightDetails, N = i.paymentOptions || [], S = N.filter((a) => a.cash).length === 1, P = N.filter((a) => a.points).length === 1, [O, T] = F(x), k = async () => {
|
|
19
|
+
const a = await U(i.airlineProgram);
|
|
20
|
+
T(a);
|
|
21
|
+
}, { flightNumbers: p, airlines: A } = B(() => {
|
|
22
22
|
const a = [], s = [];
|
|
23
|
-
return i.flightDetails.slices.forEach((
|
|
24
|
-
|
|
25
|
-
const v =
|
|
23
|
+
return i.flightDetails.slices.forEach((E) => {
|
|
24
|
+
E.segments.forEach((l) => {
|
|
25
|
+
const v = j(l);
|
|
26
26
|
a.includes(v) || a.push(v);
|
|
27
27
|
const g = l.operatingCarrierFlightNumber ? l.operatingCarrier : l.marketingCarrier;
|
|
28
|
-
s.some((
|
|
29
|
-
logo:
|
|
28
|
+
s.some((I) => I.airline === g.name) || s.push({
|
|
29
|
+
logo: H(g.iataCode),
|
|
30
30
|
airline: g.name
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
-
}),
|
|
34
|
-
}, [i.flightDetails.slices]),
|
|
33
|
+
}), k(), { flightNumbers: a, airlines: s };
|
|
34
|
+
}, [i.flightDetails.slices]), b = () => {
|
|
35
35
|
i.cash > 0 ? o(i, m.CASH) : o(i, m.POINTS);
|
|
36
|
-
},
|
|
36
|
+
}, w = !G(
|
|
37
37
|
i.departureTime,
|
|
38
38
|
i.arrivalTime
|
|
39
39
|
);
|
|
40
|
-
return /* @__PURE__ */ r("div", { className: "flight-result", onClick:
|
|
40
|
+
return /* @__PURE__ */ r("div", { className: "flight-result", onClick: b, children: /* @__PURE__ */ e("div", { className: "content", children: [
|
|
41
41
|
/* @__PURE__ */ r("div", { className: "flight-info", children: /* @__PURE__ */ e("div", { className: "flight-locations", children: [
|
|
42
|
-
/* @__PURE__ */ r("div", { className: "airlines", children:
|
|
42
|
+
/* @__PURE__ */ r("div", { className: "airlines", children: A.map((a, s) => /* @__PURE__ */ r(R.Fragment, { children: /* @__PURE__ */ e("div", { className: "tip", children: [
|
|
43
43
|
/* @__PURE__ */ r("img", { src: a.logo, alt: a.airline }),
|
|
44
44
|
/* @__PURE__ */ r("span", { className: "right", children: a.airline })
|
|
45
45
|
] }, s) }, s)) }),
|
|
@@ -58,7 +58,7 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
58
58
|
/* @__PURE__ */ e("div", { className: "flight-duration", children: [
|
|
59
59
|
/* @__PURE__ */ r("span", { className: "line" }),
|
|
60
60
|
/* @__PURE__ */ e("p", { children: [
|
|
61
|
-
|
|
61
|
+
_(f.slices[0].duration),
|
|
62
62
|
" ",
|
|
63
63
|
" - ",
|
|
64
64
|
i.numberOfStops > 0 ? `${i.numberOfStops} Stop${i.numberOfStops > 1 ? "s" : ""}` : "Direct"
|
|
@@ -93,7 +93,7 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
93
93
|
children: [
|
|
94
94
|
/* @__PURE__ */ r("p", { children: "Aircraft" }),
|
|
95
95
|
/* @__PURE__ */ e("p", { className: "chevron-text", children: [
|
|
96
|
-
/* @__PURE__ */ r(
|
|
96
|
+
/* @__PURE__ */ r(M, {}),
|
|
97
97
|
/* @__PURE__ */ e("span", { children: [
|
|
98
98
|
p[0],
|
|
99
99
|
p.length > 1 && /* @__PURE__ */ e("sup", { children: [
|
|
@@ -121,7 +121,7 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
121
121
|
children: [
|
|
122
122
|
/* @__PURE__ */ r("img", { src: i.airlineLogo }),
|
|
123
123
|
/* @__PURE__ */ e("div", { children: [
|
|
124
|
-
/* @__PURE__ */ r("label", { children:
|
|
124
|
+
/* @__PURE__ */ r("label", { children: S ? "Book For" : "From" }),
|
|
125
125
|
/* @__PURE__ */ r(
|
|
126
126
|
C,
|
|
127
127
|
{
|
|
@@ -141,12 +141,12 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
141
141
|
a.stopPropagation(), o(i, m.POINTS);
|
|
142
142
|
},
|
|
143
143
|
children: [
|
|
144
|
-
/* @__PURE__ */ r("img", { src:
|
|
144
|
+
/* @__PURE__ */ r("img", { src: O.programLogo }),
|
|
145
145
|
/* @__PURE__ */ e("div", { children: [
|
|
146
|
-
/* @__PURE__ */ r("label", { children:
|
|
146
|
+
/* @__PURE__ */ r("label", { children: P ? "Book For" : "From" }),
|
|
147
147
|
/* @__PURE__ */ e("p", { children: [
|
|
148
|
-
`${
|
|
149
|
-
((u = i.cashFee) == null ? void 0 : u.amount) > 0 && /* @__PURE__ */ e(
|
|
148
|
+
`${V(i.points)} miles`,
|
|
149
|
+
((u = i.cashFee) == null ? void 0 : u.amount) > 0 && /* @__PURE__ */ e(L, { children: [
|
|
150
150
|
" + ",
|
|
151
151
|
/* @__PURE__ */ r(
|
|
152
152
|
C,
|
|
@@ -154,7 +154,7 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
154
154
|
amount: i.cashFee.amount,
|
|
155
155
|
currency: i.cashFee.currency,
|
|
156
156
|
customDisplay: "No fee",
|
|
157
|
-
zeroDisplayOption:
|
|
157
|
+
zeroDisplayOption: z.CUSTOM
|
|
158
158
|
}
|
|
159
159
|
)
|
|
160
160
|
] })
|
|
@@ -166,16 +166,16 @@ const ii = ({ details: i, onClick: o }) => {
|
|
|
166
166
|
] })
|
|
167
167
|
] }),
|
|
168
168
|
/* @__PURE__ */ r("div", { className: `flight-details ${d ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { className: "inner", children: /* @__PURE__ */ r(
|
|
169
|
-
|
|
169
|
+
$,
|
|
170
170
|
{
|
|
171
171
|
itinerary: f.slices[0].segments,
|
|
172
172
|
origin: n,
|
|
173
173
|
destination: t,
|
|
174
|
-
isMultiDayFlight:
|
|
174
|
+
isMultiDayFlight: w
|
|
175
175
|
}
|
|
176
176
|
) }) })
|
|
177
177
|
] }) });
|
|
178
178
|
};
|
|
179
179
|
export {
|
|
180
|
-
|
|
180
|
+
ei as FlightResult
|
|
181
181
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-flights",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
67
|
-
"@odynn/awayz-core": "^0.3.
|
|
67
|
+
"@odynn/awayz-core": "^0.3.11",
|
|
68
68
|
"@tanstack/react-query": "^5.67.1",
|
|
69
69
|
"country-code-lookup": "^0.1.3"
|
|
70
70
|
}
|