@odynn/awayz-flights 0.2.11 → 0.2.13
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/FlightItinerary-CbOK0KD8.js +371 -0
- package/dist/{arrayExtensions-DWKenJCh.js → arrayExtensions-CfTQ-f6-.js} +4 -4
- package/dist/assets/FlightResult.css +1 -1
- package/dist/components/FlightItinerary/FlightItinerary.js +3 -3
- package/dist/components/FlightResult/FlightResult.js +63 -65
- package/dist/{dateUtils-DeNLG5hw.js → dateUtils-D4IuGaiy.js} +3 -3
- package/dist/hooks/useAirportSearch/useAirportSearch.js +1 -1
- package/dist/hooks/useFlightSearch/useFlightSearch.js +50 -50
- package/dist/services/flights/FlightsService.js +1 -1
- package/dist/services/wallet/WalletService.js +1 -1
- package/dist/stores/useFlightStore.js +14 -14
- package/dist/utils/flightUtils.js +2 -2
- package/package.json +2 -2
- package/dist/FlightItinerary-DgpK1LYF.js +0 -371
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { jsxs as a, jsx as c, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import g, { useMemo as q } from "react";
|
|
3
|
+
import { l as J, h as P } from "./arrayExtensions-CfTQ-f6-.js";
|
|
4
|
+
import { ECabinClass as Q } from "./types/enums.js";
|
|
5
|
+
import { a as $, b as x, d as k } from "./dateUtils-D4IuGaiy.js";
|
|
6
|
+
import { DUFFEL_ASSET_PATH as X } from "./constants/constants.js";
|
|
7
|
+
import './assets/FlightItinerary.css';const S = (e) => {
|
|
8
|
+
var t;
|
|
9
|
+
if (!e) return "";
|
|
10
|
+
try {
|
|
11
|
+
return (t = J.byIso(e)) == null ? void 0 : t.country;
|
|
12
|
+
} catch (r) {
|
|
13
|
+
return console.error(r), "";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var y = /* @__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))(y || {}), G = {
|
|
17
|
+
color: void 0,
|
|
18
|
+
size: void 0,
|
|
19
|
+
className: void 0,
|
|
20
|
+
style: void 0,
|
|
21
|
+
attr: void 0
|
|
22
|
+
}, B = g.createContext && /* @__PURE__ */ g.createContext(G), R = ["attr", "size", "title"];
|
|
23
|
+
function ee(e, t) {
|
|
24
|
+
if (e == null) return {};
|
|
25
|
+
var r = te(e, t), i, o;
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
28
|
+
for (o = 0; o < s.length; o++)
|
|
29
|
+
i = s[o], !(t.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(e, i) && (r[i] = e[i]);
|
|
30
|
+
}
|
|
31
|
+
return r;
|
|
32
|
+
}
|
|
33
|
+
function te(e, t) {
|
|
34
|
+
if (e == null) return {};
|
|
35
|
+
var r = {};
|
|
36
|
+
for (var i in e)
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(e, i)) {
|
|
38
|
+
if (t.indexOf(i) >= 0) continue;
|
|
39
|
+
r[i] = e[i];
|
|
40
|
+
}
|
|
41
|
+
return r;
|
|
42
|
+
}
|
|
43
|
+
function Z() {
|
|
44
|
+
return Z = Object.assign ? Object.assign.bind() : function(e) {
|
|
45
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
46
|
+
var r = arguments[t];
|
|
47
|
+
for (var i in r)
|
|
48
|
+
Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}, Z.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
function E(e, t) {
|
|
54
|
+
var r = Object.keys(e);
|
|
55
|
+
if (Object.getOwnPropertySymbols) {
|
|
56
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
57
|
+
t && (i = i.filter(function(o) {
|
|
58
|
+
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
59
|
+
})), r.push.apply(r, i);
|
|
60
|
+
}
|
|
61
|
+
return r;
|
|
62
|
+
}
|
|
63
|
+
function F(e) {
|
|
64
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
65
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
66
|
+
t % 2 ? E(Object(r), !0).forEach(function(i) {
|
|
67
|
+
re(e, i, r[i]);
|
|
68
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : E(Object(r)).forEach(function(i) {
|
|
69
|
+
Object.defineProperty(e, i, Object.getOwnPropertyDescriptor(r, i));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return e;
|
|
73
|
+
}
|
|
74
|
+
function re(e, t, r) {
|
|
75
|
+
return t = ie(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
|
|
76
|
+
}
|
|
77
|
+
function ie(e) {
|
|
78
|
+
var t = ne(e, "string");
|
|
79
|
+
return typeof t == "symbol" ? t : t + "";
|
|
80
|
+
}
|
|
81
|
+
function ne(e, t) {
|
|
82
|
+
if (typeof e != "object" || !e) return e;
|
|
83
|
+
var r = e[Symbol.toPrimitive];
|
|
84
|
+
if (r !== void 0) {
|
|
85
|
+
var i = r.call(e, t);
|
|
86
|
+
if (typeof i != "object") return i;
|
|
87
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
88
|
+
}
|
|
89
|
+
return (t === "string" ? String : Number)(e);
|
|
90
|
+
}
|
|
91
|
+
function I(e) {
|
|
92
|
+
return e && e.map((t, r) => /* @__PURE__ */ g.createElement(t.tag, F({
|
|
93
|
+
key: r
|
|
94
|
+
}, t.attr), I(t.child)));
|
|
95
|
+
}
|
|
96
|
+
function z(e) {
|
|
97
|
+
return (t) => /* @__PURE__ */ g.createElement(ae, Z({
|
|
98
|
+
attr: F({}, e.attr)
|
|
99
|
+
}, t), I(e.child));
|
|
100
|
+
}
|
|
101
|
+
function ae(e) {
|
|
102
|
+
var t = (r) => {
|
|
103
|
+
var {
|
|
104
|
+
attr: i,
|
|
105
|
+
size: o,
|
|
106
|
+
title: s
|
|
107
|
+
} = e, p = ee(e, R), u = o || r.size || "1em", l;
|
|
108
|
+
return r.className && (l = r.className), e.className && (l = (l ? l + " " : "") + e.className), /* @__PURE__ */ g.createElement("svg", Z({
|
|
109
|
+
stroke: "currentColor",
|
|
110
|
+
fill: "currentColor",
|
|
111
|
+
strokeWidth: "0"
|
|
112
|
+
}, r.attr, i, p, {
|
|
113
|
+
className: l,
|
|
114
|
+
style: F(F({
|
|
115
|
+
color: e.color || r.color
|
|
116
|
+
}, r.style), e.style),
|
|
117
|
+
height: u,
|
|
118
|
+
width: u,
|
|
119
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
120
|
+
}), s && /* @__PURE__ */ g.createElement("title", null, s), e.children);
|
|
121
|
+
};
|
|
122
|
+
return B !== void 0 ? /* @__PURE__ */ g.createElement(B.Consumer, null, (r) => t(r)) : t(G);
|
|
123
|
+
}
|
|
124
|
+
function K(e) {
|
|
125
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" }, child: [] }] })(e);
|
|
126
|
+
}
|
|
127
|
+
function ge(e) {
|
|
128
|
+
return z({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z" }, child: [] }] })(e);
|
|
129
|
+
}
|
|
130
|
+
function oe(e) {
|
|
131
|
+
return z({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z" }, child: [] }] })(e);
|
|
132
|
+
}
|
|
133
|
+
const pe = ({
|
|
134
|
+
itinerary: e,
|
|
135
|
+
origin: t,
|
|
136
|
+
destination: r,
|
|
137
|
+
onDisableRenderItinerary: i,
|
|
138
|
+
isMultiDayFlight: o
|
|
139
|
+
}) => {
|
|
140
|
+
var u, l, f, D, j, w;
|
|
141
|
+
const s = () => Q.ECONOMY, p = q(() => {
|
|
142
|
+
var h, v, b, C, O, T, M, N, Y, _, H;
|
|
143
|
+
const n = [];
|
|
144
|
+
for (let A = 0; A < e.length; A++) {
|
|
145
|
+
const d = e[A], m = e[A + 1];
|
|
146
|
+
if (!m)
|
|
147
|
+
break;
|
|
148
|
+
const L = {
|
|
149
|
+
arrival: {
|
|
150
|
+
airport: (h = d.destination) == null ? void 0 : h.name,
|
|
151
|
+
city: ((v = d.destination) == null ? void 0 : v.cityName) ?? ((C = (b = d.destination) == null ? void 0 : b.city) == null ? void 0 : C.name),
|
|
152
|
+
country: S((O = d.destination) == null ? void 0 : O.iataCountryCode),
|
|
153
|
+
time: d.arrivingAt,
|
|
154
|
+
arrivalTimeZone: d.destination.timeZone
|
|
155
|
+
},
|
|
156
|
+
departure: {
|
|
157
|
+
airport: (T = m.origin) == null ? void 0 : T.name,
|
|
158
|
+
city: ((M = m.origin) == null ? void 0 : M.cityName) ?? ((Y = (N = m.origin) == null ? void 0 : N.city) == null ? void 0 : Y.name),
|
|
159
|
+
country: S((_ = d.destination) == null ? void 0 : _.iataCountryCode),
|
|
160
|
+
time: m.departingAt,
|
|
161
|
+
airline: m.operatingCarrier.name,
|
|
162
|
+
airlineCode: m.operatingCarrier.iataCode,
|
|
163
|
+
aircraft: (H = m.aircraft) == null ? void 0 : H.name,
|
|
164
|
+
flightNumber: m.operatingCarrierFlightNumber,
|
|
165
|
+
cabin: m.passengers[0].cabinClassMarketingName ?? s(),
|
|
166
|
+
departureTimeZone: m.origin.timeZone
|
|
167
|
+
},
|
|
168
|
+
layoverTime: $({
|
|
169
|
+
// we need to swap around the departure and arrival times
|
|
170
|
+
departureAt: d.arrivingAt,
|
|
171
|
+
departureTimeZone: d.destination.timeZone,
|
|
172
|
+
arrivalAt: m.departingAt,
|
|
173
|
+
arrivalTimeZone: m.origin.timeZone
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
L.layoverTime <= 0 && (i == null || i()), n.push(L);
|
|
177
|
+
}
|
|
178
|
+
return n;
|
|
179
|
+
}, [e]);
|
|
180
|
+
return /* @__PURE__ */ a("div", { className: "flight-itinerary", children: [
|
|
181
|
+
/* @__PURE__ */ c(
|
|
182
|
+
V,
|
|
183
|
+
{
|
|
184
|
+
airport: e[0].origin.name,
|
|
185
|
+
city: t.city,
|
|
186
|
+
country: S(t.country),
|
|
187
|
+
departureAt: e[0].departingAt,
|
|
188
|
+
departureTimeZone: e[0].origin.timeZone,
|
|
189
|
+
arrivalAt: e[0].arrivingAt,
|
|
190
|
+
arrivalTimeZone: e[0].destination.timeZone,
|
|
191
|
+
airline: e[0].operatingCarrier.name,
|
|
192
|
+
airlineCode: e[0].operatingCarrier.iataCode,
|
|
193
|
+
aircraft: (u = e[0].aircraft) == null ? void 0 : u.name,
|
|
194
|
+
flightNumber: e[0].operatingCarrierFlightNumber,
|
|
195
|
+
cabin: e[0].passengers[0].cabinClassMarketingName ?? s(),
|
|
196
|
+
isMultiDayFlight: o
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
p.map((n, h) => {
|
|
200
|
+
var v, b, C, O, T, M, N, Y;
|
|
201
|
+
return /* @__PURE__ */ a(g.Fragment, { children: [
|
|
202
|
+
/* @__PURE__ */ c(
|
|
203
|
+
U,
|
|
204
|
+
{
|
|
205
|
+
airport: n.arrival.airport,
|
|
206
|
+
city: n.arrival.city,
|
|
207
|
+
country: n.arrival.country,
|
|
208
|
+
time: n.arrival.time,
|
|
209
|
+
isLayover: !0,
|
|
210
|
+
layoverTime: k(n.layoverTime),
|
|
211
|
+
arrivalTimeZone: x(
|
|
212
|
+
n.arrival.arrivalTimeZone,
|
|
213
|
+
n.arrival.time
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
/* @__PURE__ */ c(
|
|
218
|
+
V,
|
|
219
|
+
{
|
|
220
|
+
airport: (v = n.departure) == null ? void 0 : v.airport,
|
|
221
|
+
city: (b = n.departure) == null ? void 0 : b.city,
|
|
222
|
+
country: (C = n.departure) == null ? void 0 : C.country,
|
|
223
|
+
departureAt: n.departure.time,
|
|
224
|
+
departureTimeZone: n.departure.departureTimeZone,
|
|
225
|
+
arrivalAt: e[h + 1].arrivingAt,
|
|
226
|
+
arrivalTimeZone: e[h + 1].destination.timeZone,
|
|
227
|
+
airline: (O = n.departure) == null ? void 0 : O.airline,
|
|
228
|
+
airlineCode: (T = n.departure) == null ? void 0 : T.airlineCode,
|
|
229
|
+
aircraft: (M = n.departure) == null ? void 0 : M.aircraft,
|
|
230
|
+
flightNumber: (N = n.departure) == null ? void 0 : N.flightNumber,
|
|
231
|
+
cabin: (Y = n.departure) == null ? void 0 : Y.cabin
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
] }, n.departure.flightNumber || h);
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ c(
|
|
237
|
+
U,
|
|
238
|
+
{
|
|
239
|
+
airport: (f = (l = e.getLast()) == null ? void 0 : l.destination) == null ? void 0 : f.name,
|
|
240
|
+
city: r.city,
|
|
241
|
+
country: S(r.country),
|
|
242
|
+
time: (D = e.getLast()) == null ? void 0 : D.arrivingAt,
|
|
243
|
+
arrivalTimeZone: x(
|
|
244
|
+
(j = e.getLast()) == null ? void 0 : j.destination.timeZone,
|
|
245
|
+
(w = e.getLast()) == null ? void 0 : w.arrivingAt
|
|
246
|
+
),
|
|
247
|
+
isMultiDayFlight: o
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] });
|
|
251
|
+
}, V = ({
|
|
252
|
+
airport: e,
|
|
253
|
+
city: t,
|
|
254
|
+
country: r,
|
|
255
|
+
airline: i,
|
|
256
|
+
airlineCode: o,
|
|
257
|
+
flightNumber: s,
|
|
258
|
+
aircraft: p,
|
|
259
|
+
cabin: u,
|
|
260
|
+
departureAt: l,
|
|
261
|
+
departureTimeZone: f,
|
|
262
|
+
arrivalAt: D,
|
|
263
|
+
arrivalTimeZone: j,
|
|
264
|
+
isMultiDayFlight: w
|
|
265
|
+
}) => {
|
|
266
|
+
const n = $({
|
|
267
|
+
departureAt: l,
|
|
268
|
+
departureTimeZone: f,
|
|
269
|
+
arrivalAt: D,
|
|
270
|
+
arrivalTimeZone: j
|
|
271
|
+
});
|
|
272
|
+
return /* @__PURE__ */ a("div", { className: "departure", children: [
|
|
273
|
+
/* @__PURE__ */ a("p", { children: [
|
|
274
|
+
P(l).format(y.FlightTime),
|
|
275
|
+
" ",
|
|
276
|
+
/* @__PURE__ */ a("span", { className: "time-zone", children: [
|
|
277
|
+
"(",
|
|
278
|
+
x(f, l),
|
|
279
|
+
")"
|
|
280
|
+
] }),
|
|
281
|
+
/* @__PURE__ */ c("br", {}),
|
|
282
|
+
w ? /* @__PURE__ */ a("div", { className: "travel-time", children: [
|
|
283
|
+
/* @__PURE__ */ c(K, {}),
|
|
284
|
+
/* @__PURE__ */ a("span", { children: [
|
|
285
|
+
" ",
|
|
286
|
+
"Departure:",
|
|
287
|
+
" ",
|
|
288
|
+
P(l).format(y.StringDateFormat)
|
|
289
|
+
] })
|
|
290
|
+
] }) : /* @__PURE__ */ c(W, {}),
|
|
291
|
+
/* @__PURE__ */ a("div", { className: "travel-time", children: [
|
|
292
|
+
/* @__PURE__ */ c(oe, {}),
|
|
293
|
+
/* @__PURE__ */ a("span", { children: [
|
|
294
|
+
"Travel Time: ",
|
|
295
|
+
k(n)
|
|
296
|
+
] })
|
|
297
|
+
] })
|
|
298
|
+
] }),
|
|
299
|
+
/* @__PURE__ */ a("div", { children: [
|
|
300
|
+
/* @__PURE__ */ a("span", { children: [
|
|
301
|
+
e,
|
|
302
|
+
", ",
|
|
303
|
+
t,
|
|
304
|
+
", ",
|
|
305
|
+
r
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ c("img", { src: `${X}${o}.svg`, alt: i }),
|
|
308
|
+
/* @__PURE__ */ a("p", { children: [
|
|
309
|
+
/* @__PURE__ */ c("strong", { children: "Aircraft:" }),
|
|
310
|
+
" ",
|
|
311
|
+
p
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ a("p", { children: [
|
|
314
|
+
/* @__PURE__ */ c("strong", { children: "Flight:" }),
|
|
315
|
+
" ",
|
|
316
|
+
o,
|
|
317
|
+
" ",
|
|
318
|
+
s
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ a("p", { children: [
|
|
321
|
+
/* @__PURE__ */ c("strong", { children: "Cabin:" }),
|
|
322
|
+
" ",
|
|
323
|
+
u
|
|
324
|
+
] })
|
|
325
|
+
] })
|
|
326
|
+
] });
|
|
327
|
+
}, U = ({
|
|
328
|
+
airport: e,
|
|
329
|
+
city: t,
|
|
330
|
+
country: r,
|
|
331
|
+
time: i,
|
|
332
|
+
isLayover: o,
|
|
333
|
+
layoverTime: s,
|
|
334
|
+
arrivalTimeZone: p,
|
|
335
|
+
isMultiDayFlight: u
|
|
336
|
+
}) => /* @__PURE__ */ a("div", { className: `arrival ${o ? "layover" : ""}`, children: [
|
|
337
|
+
/* @__PURE__ */ a("p", { children: [
|
|
338
|
+
P(i).format(y.FlightTime),
|
|
339
|
+
" ",
|
|
340
|
+
/* @__PURE__ */ a("span", { className: "time-zone", children: [
|
|
341
|
+
"(",
|
|
342
|
+
p,
|
|
343
|
+
")"
|
|
344
|
+
] }),
|
|
345
|
+
u && !o ? /* @__PURE__ */ a("div", { className: "travel-time", children: [
|
|
346
|
+
/* @__PURE__ */ c(K, {}),
|
|
347
|
+
/* @__PURE__ */ a("span", { children: [
|
|
348
|
+
"Arrival: ",
|
|
349
|
+
P(i).format(y.StringDateFormat)
|
|
350
|
+
] })
|
|
351
|
+
] }) : /* @__PURE__ */ c(W, {})
|
|
352
|
+
] }),
|
|
353
|
+
/* @__PURE__ */ a("div", { children: [
|
|
354
|
+
/* @__PURE__ */ a("p", { children: [
|
|
355
|
+
o ? "Layover in" : "",
|
|
356
|
+
" ",
|
|
357
|
+
e,
|
|
358
|
+
", ",
|
|
359
|
+
t,
|
|
360
|
+
", ",
|
|
361
|
+
r
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ c("i", { children: o ? s : "" })
|
|
364
|
+
] })
|
|
365
|
+
] });
|
|
366
|
+
export {
|
|
367
|
+
y as E,
|
|
368
|
+
ge as F,
|
|
369
|
+
pe as a,
|
|
370
|
+
S as g
|
|
371
|
+
};
|