@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.
Files changed (36) hide show
  1. package/dist/BookingOption-V-FzaupW.js +196 -0
  2. package/dist/FlightItinerary-C4KPpVcF.js +94 -0
  3. package/dist/assets/FlightItinerary.css +1 -1
  4. package/dist/assets/FlightItineraryDropdown.css +1 -0
  5. package/dist/assets/MiniFlightItinerary.css +1 -0
  6. package/dist/assets/_styles.css +1 -1
  7. package/dist/assets/_styles2.css +1 -1
  8. package/dist/components/BookingOption/BookingOption.js +3 -4
  9. package/dist/components/Dialog/Dialog.js +1 -1
  10. package/dist/components/FlightItinerary/FlightItinerary.js +3 -4
  11. package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +22 -30
  12. package/dist/components/FlightResult/FlightResult.js +173 -183
  13. package/dist/components/HorizontalScroller/HorizontalScroller.js +3 -3
  14. package/dist/components/MiniFlightItinerary/MiniFlightItinerary.js +89 -7
  15. package/dist/components/index.js +5 -5
  16. package/dist/constants/endpoints.js +1 -1
  17. package/dist/enums-tLvxh02p.js +4 -0
  18. package/dist/hooks/index.js +3 -3
  19. package/dist/hooks/useFlightSearch/useFlightSearch.js +420 -11
  20. package/dist/{index-D8ljJLcr.js → index-9LVJi5JO.js} +7 -7
  21. package/dist/index-Kopwbl-x.js +19 -0
  22. package/dist/lib/components/FlightItinerary/FlightItinerary.d.ts +1 -6
  23. package/dist/lib/components/FlightItineraryDropdown/FlightItineraryDropdown.d.ts +2 -4
  24. package/dist/lib/constants/endpoints.d.ts +2 -1
  25. package/dist/lib/services/flights/FlightsService.d.ts +1 -0
  26. package/dist/main.js +35 -34
  27. package/dist/services/flights/FlightsService.js +37 -28
  28. package/dist/utils/flightUtils.js +39 -40
  29. package/package.json +1 -1
  30. package/dist/BookingOption-BTupJyHW.js +0 -192
  31. package/dist/FlightItinerary-BYXRMQUD.js +0 -262
  32. package/dist/MiniFlightItinerary-D2tFssaK.js +0 -106
  33. package/dist/assets/_styles5.css +0 -1
  34. package/dist/index-Gj4bRuCQ.js +0 -15
  35. package/dist/index-nI16-czT.js +0 -4
  36. package/dist/useFlightSearch-Dxoeykpk.js +0 -420
@@ -1,10 +1,92 @@
1
- import "react/jsx-runtime";
2
- import "../../dateUtils-Cb9VQiIL.js";
1
+ import { jsxs as o, Fragment as b, jsx as e } from "react/jsx-runtime";
2
+ import { c as v, b as f } from "../../dateUtils-Cb9VQiIL.js";
3
3
  import "../../arrayExtensions-Ce8YopTP.js";
4
- import "react";
5
- import "../../index-D8ljJLcr.js";
6
- import { M as n } from "../../MiniFlightItinerary-D2tFssaK.js";
7
- import '../../assets/_styles.css';/* empty css */
4
+ import { useMemo as y } from "react";
5
+ import { g as C, d as N } from "../../index-9LVJi5JO.js";
6
+ import { a as D, b as F, c as k } from "../../index-Kopwbl-x.js";
7
+ import '../../assets/MiniFlightItinerary.css';const I = ({
8
+ flightDetails: A
9
+ }) => {
10
+ const a = A.flightDetails.slices[0].segments, T = y(() => {
11
+ var t, l, n, s, p, h, g, u;
12
+ const i = [];
13
+ for (let m = 0; m < a.length; m++) {
14
+ const r = a[m], d = a[m + 1], L = v({
15
+ departureAt: r.departingAt,
16
+ departureTimeZone: r.origin.timeZone,
17
+ arrivalAt: r.arrivingAt,
18
+ arrivalTimeZone: r.destination.timeZone
19
+ });
20
+ if (i.push({
21
+ departure: {
22
+ code: (t = r.origin) == null ? void 0 : t.iataCode,
23
+ airport: (l = r.origin) == null ? void 0 : l.name
24
+ },
25
+ arrival: {
26
+ code: (n = r.destination) == null ? void 0 : n.iataCode,
27
+ airport: (s = r.destination) == null ? void 0 : s.name
28
+ },
29
+ time: L
30
+ }), !d)
31
+ break;
32
+ const Z = v({
33
+ departureAt: r.arrivingAt,
34
+ departureTimeZone: r.destination.timeZone,
35
+ arrivalAt: d.departingAt,
36
+ arrivalTimeZone: d.origin.timeZone
37
+ });
38
+ i.push({
39
+ departure: {
40
+ code: (p = r.destination) == null ? void 0 : p.iataCode,
41
+ airport: (h = r.destination) == null ? void 0 : h.name
42
+ },
43
+ arrival: {
44
+ code: (g = d.origin) == null ? void 0 : g.iataCode,
45
+ airport: (u = d.origin) == null ? void 0 : u.name
46
+ },
47
+ time: Z,
48
+ isLayover: !0
49
+ });
50
+ }
51
+ return i;
52
+ }, [a]), c = y(() => {
53
+ var t, l;
54
+ const i = [];
55
+ for (let n = 0; n < a.length; n++) {
56
+ const s = a[n];
57
+ i.push(((t = s.origin) == null ? void 0 : t.iataCode) ?? "");
58
+ }
59
+ return i.push(((l = a.getLast().destination) == null ? void 0 : l.iataCode) ?? ""), i;
60
+ }, [a]);
61
+ return /* @__PURE__ */ o(b, { children: [
62
+ /* @__PURE__ */ e("div", { className: "mobile-mini-flight-itinerary", children: c.map((i, t) => /* @__PURE__ */ o("div", { children: [
63
+ /* @__PURE__ */ e("p", { children: i }),
64
+ t < c.length - 1 && /* @__PURE__ */ e(D, {})
65
+ ] }, t)) }),
66
+ /* @__PURE__ */ e("div", { className: "mini-flight-itinerary", children: T.map(
67
+ (i, t) => i.isLayover ? /* @__PURE__ */ o("div", { className: "layover tip", children: [
68
+ /* @__PURE__ */ e(C, {}),
69
+ /* @__PURE__ */ e("p", { children: f(i.time) }),
70
+ /* @__PURE__ */ o("span", { className: "bottom", children: [
71
+ "Layover in ",
72
+ i.departure.code,
73
+ " (",
74
+ i.departure.airport,
75
+ ")"
76
+ ] })
77
+ ] }) : /* @__PURE__ */ o("div", { className: "flight", children: [
78
+ /* @__PURE__ */ e(F, {}),
79
+ /* @__PURE__ */ e("p", { children: i.departure.code }),
80
+ /* @__PURE__ */ e("div", { className: "timeline", children: /* @__PURE__ */ o("div", { children: [
81
+ /* @__PURE__ */ e(N, {}),
82
+ /* @__PURE__ */ e("p", { children: f(i.time) })
83
+ ] }) }),
84
+ /* @__PURE__ */ e(k, {}),
85
+ /* @__PURE__ */ e("p", { children: i.arrival.code })
86
+ ] }, t)
87
+ ) })
88
+ ] });
89
+ };
8
90
  export {
9
- n as MiniFlightItinerary
91
+ I as MiniFlightItinerary
10
92
  };
@@ -1,10 +1,10 @@
1
- import { F as o } from "../FlightItinerary-BYXRMQUD.js";
1
+ import { F as o } from "../FlightItinerary-C4KPpVcF.js";
2
2
  import { FlightItineraryDropdown as e } from "./FlightItineraryDropdown/FlightItineraryDropdown.js";
3
- import { FlightResult as l } from "./FlightResult/FlightResult.js";
4
- import { M as p } from "../MiniFlightItinerary-D2tFssaK.js";
3
+ import { FlightResult as n } from "./FlightResult/FlightResult.js";
4
+ import { MiniFlightItinerary as F } from "./MiniFlightItinerary/MiniFlightItinerary.js";
5
5
  export {
6
6
  o as FlightItinerary,
7
7
  e as FlightItineraryDropdown,
8
- l as FlightResult,
9
- p as MiniFlightItinerary
8
+ n as FlightResult,
9
+ F as MiniFlightItinerary
10
10
  };
@@ -1,4 +1,4 @@
1
- var s = /* @__PURE__ */ ((r) => (r.GET_AIRPORTS = "/flights/search/airports", r.CASH_FLIGHT_SEARCH = "/flights/search/multi/one-way/cash/", r.CASH_POINTS_FLIGHT_SEARCH = "/flights/search/multi/one-way/points-cash/", r.CASH_OUTBOUND_SEARCH = "/flights/search/multi/outbound", r.CASH_INBOUND_SEARCH = "/flights/search/multi/inbound", r.ROUND_TRIP_FARES = "/flights/search/multi/fares", r))(s || {}), a = /* @__PURE__ */ ((r) => (r.GET_AWARDS = "user/rewards", r.GET_USER_CARDS = "user/cards", r))(a || {});
1
+ var s = /* @__PURE__ */ ((r) => (r.GET_AIRPORTS = "/flights/search/airports", r.CASH_FLIGHT_SEARCH = "/flights/search/multi/one-way/cash/", r.CASH_POINTS_FLIGHT_SEARCH = "/flights/search/multi/one-way/points-cash/", r.CASH_OUTBOUND_SEARCH = "/flights/search/multi/outbound", r.CASH_INBOUND_SEARCH = "/flights/search/multi/inbound", r.ROUND_TRIP_FARES = "/flights/search/multi/fares", r.SUPPORTED_AIRLINE_PROGRAMS = "/flights/search/supported-airlines", r))(s || {}), a = /* @__PURE__ */ ((r) => (r.GET_AWARDS = "user/rewards", r.GET_USER_CARDS = "user/cards", r))(a || {});
2
2
  export {
3
3
  s as EFlightEndpoint,
4
4
  a as EWalletEndpoints
@@ -0,0 +1,4 @@
1
+ var S = /* @__PURE__ */ ((R) => (R.LOCATIONS = "LOCATIONS", R.CHECK_USER = "CHECK_USER", R.USER_REGIONS = "USER_REGIONS", R.CONVERT_CURRENCY = "CONVERT_CURRENCY", R.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", R.SEARCH_LIMIT = "SEARCH_LIMIT", R.PROGRAMS = "PROGRAMS", R.USER_PROGRAMS = "USER_PROGRAMS", R.LINKED_USER_PROGRAMS = "LINKED_USER_PROGRAMS", R.BANKS = "BANKS", R.CARDS = "CARDS", R.USER_CARDS = "USER_CARDS", R.TRIPS = "TRIPS", R.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", R.BOOKING = "BOOKING", R.VALUE_CENTS = "VALUE_CENTS", R.AVAILABILITY_ALERTS = "AVAILABILITY_ALERTS", R.ALERT_NOTIFICATIONS = "ALERT_NOTIFICATIONS", R.POINTS_AS_CASH = "POINTS_AS_CASH", R.GET_USER_REGION = "get_user_region", R.PRICING = "pricing", R.FAQS = "faqs", R.FEATURES = "features", R.AIRLINE_HEALTH = "airline_health", R.SUPPORTED_AIRLINE_PROGRAMS = "supported_airline_programs", R))(S || {});
2
+ export {
3
+ S as E
4
+ };
@@ -1,8 +1,8 @@
1
- import { u as o } from "../useFlightSearch-Dxoeykpk.js";
2
- import { useAirportSearch as t } from "./useAirportSearch/useAirportSearch.js";
1
+ import { useFlightSearch as o } from "./useFlightSearch/useFlightSearch.js";
2
+ import { useAirportSearch as a } from "./useAirportSearch/useAirportSearch.js";
3
3
  import { EBaggage as p } from "./useFlightSearch/useFlightSearch.types.js";
4
4
  export {
5
5
  p as EBaggage,
6
- t as useAirportSearch,
6
+ a as useAirportSearch,
7
7
  o as useFlightSearch
8
8
  };
@@ -1,15 +1,424 @@
1
- import "@odynn/awayz-core";
2
- import "@tanstack/react-query";
1
+ import { useAwayzContext as te, awayzClient as P, getBaseUrl as ne } from "@odynn/awayz-core";
2
+ import { useQuery as re, useMutation as x } from "@tanstack/react-query";
3
3
  import "../../moment-BGjjqtLQ.js";
4
4
  import "../../arrayExtensions-Ce8YopTP.js";
5
- import "../../objectUtils-3IeCVocm.js";
6
- import { u as g } from "../../useFlightSearch-Dxoeykpk.js";
7
- import "react";
8
- import "../../services/flights/FlightsService.js";
9
- import "../../stores/useFlightStore.js";
10
- import "../../types/enums.js";
11
- import "../../types/ECabinClass.js";
12
- import "../../utils/flightUtils.js";
5
+ import { c as z } from "../../objectUtils-3IeCVocm.js";
6
+ import { E as A } from "../../enums-tLvxh02p.js";
7
+ import { useState as D, useRef as oe } from "react";
8
+ import { FlightService as _ } from "../../services/flights/FlightsService.js";
9
+ import se from "../../stores/useFlightStore.js";
10
+ import { EFlightType as J, EFlightPaymentType as k } from "../../types/enums.js";
11
+ import { ECabinClass as ae } from "../../types/ECabinClass.js";
12
+ import { mapDataToFlightDetails as ie, groupFlightResults as ue, buildFlightSearchQuery as ce } from "../../utils/flightUtils.js";
13
+ async function le(o, t) {
14
+ const r = o.getReader();
15
+ let n;
16
+ for (; !(n = await r.read()).done; )
17
+ t(n.value);
18
+ }
19
+ function de(o) {
20
+ let t, r, n, s = !1;
21
+ return function(f) {
22
+ t === void 0 ? (t = f, r = 0, n = -1) : t = pe(t, f);
23
+ const d = t.length;
24
+ let u = 0;
25
+ for (; r < d; ) {
26
+ s && (t[r] === 10 && (u = ++r), s = !1);
27
+ let p = -1;
28
+ for (; r < d && p === -1; ++r)
29
+ switch (t[r]) {
30
+ case 58:
31
+ n === -1 && (n = r - u);
32
+ break;
33
+ case 13:
34
+ s = !0;
35
+ case 10:
36
+ p = r;
37
+ break;
38
+ }
39
+ if (p === -1)
40
+ break;
41
+ o(t.subarray(u, p), n), u = r, n = -1;
42
+ }
43
+ u === d ? t = void 0 : u !== 0 && (t = t.subarray(u), r -= u);
44
+ };
45
+ }
46
+ function fe(o, t, r) {
47
+ let n = B();
48
+ const s = new TextDecoder();
49
+ return function(f, d) {
50
+ if (f.length === 0)
51
+ r == null || r(n), n = B();
52
+ else if (d > 0) {
53
+ const u = s.decode(f.subarray(0, d)), p = d + (f[d + 1] === 32 ? 2 : 1), m = s.decode(f.subarray(p));
54
+ switch (u) {
55
+ case "data":
56
+ n.data = n.data ? n.data + `
57
+ ` + m : m;
58
+ break;
59
+ case "event":
60
+ n.event = m;
61
+ break;
62
+ case "id":
63
+ o(n.id = m);
64
+ break;
65
+ case "retry":
66
+ const y = parseInt(m, 10);
67
+ isNaN(y) || t(n.retry = y);
68
+ break;
69
+ }
70
+ }
71
+ };
72
+ }
73
+ function pe(o, t) {
74
+ const r = new Uint8Array(o.length + t.length);
75
+ return r.set(o), r.set(t, o.length), r;
76
+ }
77
+ function B() {
78
+ return {
79
+ data: "",
80
+ event: "",
81
+ id: "",
82
+ retry: void 0
83
+ };
84
+ }
85
+ var he = function(o, t) {
86
+ var r = {};
87
+ for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && t.indexOf(n) < 0 && (r[n] = o[n]);
88
+ if (o != null && typeof Object.getOwnPropertySymbols == "function")
89
+ for (var s = 0, n = Object.getOwnPropertySymbols(o); s < n.length; s++)
90
+ t.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(o, n[s]) && (r[n[s]] = o[n[s]]);
91
+ return r;
92
+ };
93
+ const Q = "text/event-stream", ge = 1e3, Y = "last-event-id";
94
+ function me(o, t) {
95
+ var { signal: r, headers: n, onopen: s, onmessage: E, onclose: f, onerror: d, openWhenHidden: u, fetch: p } = t, m = he(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
96
+ return new Promise((y, R) => {
97
+ const h = Object.assign({}, n);
98
+ h.accept || (h.accept = Q);
99
+ let b;
100
+ function q() {
101
+ b.abort(), document.hidden || I();
102
+ }
103
+ u || document.addEventListener("visibilitychange", q);
104
+ let C = ge, v = 0;
105
+ function S() {
106
+ document.removeEventListener("visibilitychange", q), window.clearTimeout(v), b.abort();
107
+ }
108
+ r == null || r.addEventListener("abort", () => {
109
+ S(), y();
110
+ });
111
+ const N = p ?? window.fetch, H = s ?? ye;
112
+ async function I() {
113
+ var F;
114
+ b = new AbortController();
115
+ try {
116
+ const T = await N(o, Object.assign(Object.assign({}, m), { headers: h, signal: b.signal }));
117
+ await H(T), await le(T.body, de(fe((g) => {
118
+ g ? h[Y] = g : delete h[Y];
119
+ }, (g) => {
120
+ C = g;
121
+ }, E))), f == null || f(), S(), y();
122
+ } catch (T) {
123
+ if (!b.signal.aborted)
124
+ try {
125
+ const g = (F = d == null ? void 0 : d(T)) !== null && F !== void 0 ? F : C;
126
+ window.clearTimeout(v), v = window.setTimeout(I, g);
127
+ } catch (g) {
128
+ S(), R(g);
129
+ }
130
+ }
131
+ }
132
+ I();
133
+ });
134
+ }
135
+ function ye(o) {
136
+ const t = o.headers.get("content-type");
137
+ if (!(t != null && t.startsWith(Q)))
138
+ throw new Error(`Expected content-type to be ${Q}, Actual: ${t}`);
139
+ }
140
+ const $ = 1, L = ae.ECONOMY;
141
+ let K = new AbortController();
142
+ const be = 3 * 60 * 1e3, G = (o) => {
143
+ if (!o.origin || !o.destination)
144
+ throw new Error("Origin and destination are required.");
145
+ if (!o.dates)
146
+ throw new Error("At least one date is required.");
147
+ if (o.flightType === J.ROUND_TRIP && o.dates.length != 2)
148
+ throw new Error(
149
+ "Two dates are required for round-trip flights: departure and return."
150
+ );
151
+ }, Le = () => {
152
+ const { token: o, config: t } = te(), [r, n] = D(""), [s, E] = D([]), [f, d] = D(!1), u = oe(null), {
153
+ inboundResults: p,
154
+ outboundResults: m,
155
+ setInboundResults: y,
156
+ setOutboundResults: R,
157
+ partialOfferRequestId: h,
158
+ setPartialOfferRequestId: b,
159
+ airlineStatuses: q,
160
+ setAirlineStatuses: C
161
+ } = se(), { data: v } = re({
162
+ queryKey: [A.SUPPORTED_AIRLINE_PROGRAMS],
163
+ queryFn: _.getSupportedAirlinePrograms
164
+ }), S = ({
165
+ data: e,
166
+ inbound: c
167
+ }) => {
168
+ const i = ie(e);
169
+ return (c ? y : R)(ue(i)), i;
170
+ }, {
171
+ mutate: N,
172
+ status: H,
173
+ error: I
174
+ } = x({
175
+ mutationFn: async (e) => {
176
+ G(e);
177
+ const i = {
178
+ passengers: Array.from(
179
+ { length: e.passengers ?? $ },
180
+ () => ({ type: "adult" })
181
+ ),
182
+ origin: e.origin || "",
183
+ destination: e.destination || "",
184
+ cabin_class: e.cabinClass ?? L
185
+ };
186
+ if (e.flightType === J.ONE_WAY) {
187
+ const a = await _.cashOnlySearch({
188
+ ...i,
189
+ departure_dates: e.dates
190
+ });
191
+ return {
192
+ success: a.success,
193
+ data: a.data
194
+ };
195
+ } else {
196
+ const a = await _.roundTripOutboundSearch({
197
+ ...i,
198
+ departure_date: e.dates[0],
199
+ return_date: e.dates[1]
200
+ });
201
+ return {
202
+ success: a.success,
203
+ data: a.data.offers,
204
+ partialOfferRequestId: a.data.id
205
+ };
206
+ }
207
+ },
208
+ onSuccess: (e) => {
209
+ const { success: c, data: i, partialOfferRequestId: a } = e;
210
+ if (!c) {
211
+ console.log("oh lol, it didn't work");
212
+ return;
213
+ }
214
+ S({ data: i }), a && b(a);
215
+ },
216
+ onError: (e) => {
217
+ console.error("Error in outbound flight search:", e);
218
+ },
219
+ onSettled: () => {
220
+ P.invalidateQueries({ queryKey: [A.SEARCH_LIMIT] });
221
+ }
222
+ }), {
223
+ mutate: F,
224
+ status: T,
225
+ error: g
226
+ } = x({
227
+ mutationFn: async ({
228
+ outboundOfferId: e,
229
+ cabinClass: c
230
+ }) => {
231
+ if (!h)
232
+ throw new Error("No partialOfferRequestId found for inbound search.");
233
+ return n(e), await _.roundTripInboundSearch({
234
+ outboundOfferId: e,
235
+ outboundOfferRequestId: h,
236
+ cabinClass: c || L
237
+ });
238
+ },
239
+ onSuccess: (e) => {
240
+ const { success: c, data: i } = e;
241
+ c && S({
242
+ data: i.offers,
243
+ inbound: !0
244
+ });
245
+ },
246
+ onError: (e) => {
247
+ console.error("Error in inbound flight search:", e);
248
+ },
249
+ onSettled: () => {
250
+ P.invalidateQueries({ queryKey: [A.SEARCH_LIMIT] });
251
+ }
252
+ }), {
253
+ mutate: V,
254
+ status: X,
255
+ error: Z
256
+ } = x({
257
+ mutationFn: async ({
258
+ inboundOfferId: e,
259
+ cabinClass: c
260
+ }) => {
261
+ if (!h)
262
+ throw new Error("No partialOfferRequestId found for round-trip fares.");
263
+ return await _.getRoundTripFares({
264
+ outboundOfferId: r,
265
+ outboundOfferRequestId: h,
266
+ inboundOfferId: e,
267
+ cabinClass: c || L
268
+ });
269
+ },
270
+ onSuccess: (e) => {
271
+ const { success: c, data: i } = e;
272
+ if (!c) return;
273
+ const a = i.offers;
274
+ E(z(a));
275
+ },
276
+ onError: (e) => {
277
+ console.error("Error in round-trip fare search:", e);
278
+ },
279
+ onSettled: () => {
280
+ P.invalidateQueries({ queryKey: [A.SEARCH_LIMIT] });
281
+ }
282
+ }), W = async (e) => {
283
+ var U;
284
+ C(() => ({
285
+ ...v == null ? void 0 : v.reduce((O, l) => (O[l] = -1, O), {})
286
+ })), d(!0);
287
+ const c = e.paymentType === k.CASH_AND_MILES ? ['"cash"', '"points"'] : ['"points"'], i = ce({
288
+ originCode: e.origin,
289
+ destinationCode: e.destination,
290
+ dates: e.dates,
291
+ cabinClass: e.cabinClass ?? L,
292
+ passengerCount: e.passengers ?? $,
293
+ paymentType: c
294
+ });
295
+ let a = [], M = 0;
296
+ K = new AbortController(), u.current = setTimeout(
297
+ () => {
298
+ w();
299
+ },
300
+ (((U = t == null ? void 0 : t.flightsConfig) == null ? void 0 : U.streamTimeoutTotalSeconds) ?? be) * 1e3
301
+ ), me(ne() + i, {
302
+ headers: {
303
+ "Content-Type": "application/json",
304
+ Authorization: o ?? "",
305
+ "client-id": (t == null ? void 0 : t.clientId) ?? ""
306
+ },
307
+ openWhenHidden: !0,
308
+ signal: K.signal,
309
+ onmessage(O) {
310
+ try {
311
+ const l = z(JSON.parse(O.data));
312
+ if (l.success === !1)
313
+ return;
314
+ if (l.close === !0) {
315
+ w();
316
+ return;
317
+ }
318
+ if (l.airlineProgram && C((j) => ({
319
+ ...j,
320
+ [l.airlineProgram]: l.status ?? l.statusCode ?? 300
321
+ })), l.status === 200 && l.flights && l.flights.length > 0) {
322
+ M = 0;
323
+ const j = l.flights.map((ee) => ({
324
+ ...ee,
325
+ partners: l.partners ?? []
326
+ }));
327
+ a = [...a, ...j], S({ data: a });
328
+ }
329
+ l.ping && (M++, M >= t.flightsConfig.streamTimeoutPingCount && w());
330
+ } catch (l) {
331
+ console.error("Error parsing message:", l), w();
332
+ }
333
+ },
334
+ onerror(O) {
335
+ throw console.error("EventSource error:", O), w(), O;
336
+ },
337
+ onclose() {
338
+ w();
339
+ },
340
+ keepalive: !1
341
+ });
342
+ }, w = () => {
343
+ K.abort(), u.current && (clearTimeout(u.current), u.current = null), d(!1), P.invalidateQueries({ queryKey: [A.SEARCH_LIMIT] }), C((e) => {
344
+ const c = {};
345
+ for (const i in e) {
346
+ const a = e[i];
347
+ a !== -1 && (c[i] = a);
348
+ }
349
+ return c;
350
+ });
351
+ };
352
+ return {
353
+ /**
354
+ * Loading status for searching both outbound and inbound flights
355
+ * @type {boolean}
356
+ * @default false
357
+ */
358
+ loading: H === "pending" || T === "pending" || f,
359
+ /**
360
+ * Loading status for fares
361
+ * @type {boolean}
362
+ * @default false
363
+ */
364
+ loadingFares: X === "pending",
365
+ outboundError: I,
366
+ inboundError: g,
367
+ roundTripFaresError: Z,
368
+ // Results
369
+ outboundResults: m,
370
+ inboundResults: p,
371
+ roundTripFares: s,
372
+ // Mutation triggers
373
+ /**
374
+ * Used to search for outbound flights
375
+ * @type {function}
376
+ *
377
+ * @param {ISearchFlightArgs} args - The search arguments
378
+ */
379
+ searchOutboundFlights: async (e) => {
380
+ switch (G(e), R([]), w(), e.paymentType) {
381
+ case k.CASH_AND_MILES:
382
+ W(e);
383
+ break;
384
+ case k.CASH:
385
+ N(e);
386
+ break;
387
+ case k.MILES:
388
+ W(e);
389
+ break;
390
+ }
391
+ },
392
+ /**
393
+ * Used to search for inbound flights after selecting an outbound flight
394
+ * @type {function}
395
+ *
396
+ * @param {{ outboundOfferId: string; cabinClass: ECabinClass }} args - The search arguments
397
+ */
398
+ searchInboundFlights: F,
399
+ /**
400
+ * Used to get round-trip fares after selecting both outbound and inbound flights
401
+ * @type {function}
402
+ *
403
+ * @param {{ inboundOfferId: string; cabinClass: ECabinClass }} args - The fare search arguments
404
+ */
405
+ getRoundTripFares: V,
406
+ /**
407
+ * Resets the flight search state, clearing all results and selections
408
+ * @type {function}
409
+ *
410
+ * @returns {void}
411
+ */
412
+ reset: () => {
413
+ w(), R([]), y([]), E([]), b(""), n("");
414
+ },
415
+ /**
416
+ * Points search statuses of airlines during the flight search
417
+ * @type {IAirlineStatuses}
418
+ */
419
+ airlineStatuses: q
420
+ };
421
+ };
13
422
  export {
14
- g as useFlightSearch
423
+ Le as useFlightSearch
15
424
  };
@@ -39,13 +39,13 @@ function M(c) {
39
39
  return t({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 256A208 208 0 1 1 48 256a208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }, child: [] }] })(c);
40
40
  }
41
41
  export {
42
- M as F,
43
- s as a,
44
- L as b,
45
- o as c,
46
- e as d,
47
- i as e,
48
- n as f,
42
+ i as F,
43
+ n as a,
44
+ M as b,
45
+ s as c,
46
+ L as d,
47
+ o as e,
48
+ e as f,
49
49
  d as g,
50
50
  u as h,
51
51
  l as i,
@@ -0,0 +1,19 @@
1
+ import { G as r } from "./iconBase-DSKTHwal.js";
2
+ function n(t) {
3
+ return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M5 12h14" }, child: [] }, { tag: "path", attr: { d: "m12 5 7 7-7 7" }, child: [] }] })(t);
4
+ }
5
+ function a(t) {
6
+ return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "m6 9 6 6 6-6" }, child: [] }] })(t);
7
+ }
8
+ function e(t) {
9
+ return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M2 22h20" }, child: [] }, { tag: "path", attr: { d: "M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z" }, child: [] }] })(t);
10
+ }
11
+ function i(t) {
12
+ return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M2 22h20" }, child: [] }, { tag: "path", attr: { d: "M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z" }, child: [] }] })(t);
13
+ }
14
+ export {
15
+ a as L,
16
+ n as a,
17
+ i as b,
18
+ e as c
19
+ };
@@ -1,11 +1,6 @@
1
1
  import { ISegment } from '@type-op/shared';
2
- import { IAirportLocation } from '../../hooks/useFlightSearch/useFlightSearch.types';
3
2
  interface FlightItineraryProps {
4
- origin: IAirportLocation;
5
- destination: IAirportLocation;
6
3
  itinerary: ISegment[];
7
- onDisableRenderItinerary?: () => void;
8
- isMultiDayFlight?: boolean;
9
4
  }
10
- export declare const FlightItinerary: ({ itinerary, origin, destination, onDisableRenderItinerary, isMultiDayFlight }: FlightItineraryProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const FlightItinerary: ({ itinerary }: FlightItineraryProps) => import("react/jsx-runtime").JSX.Element;
11
6
  export {};
@@ -1,9 +1,7 @@
1
- import { IAirportLocation, IFlightDetails, IFlightResult } from '../../hooks';
1
+ import { IFlightDetails, IFlightResult } from '../../hooks';
2
2
  interface IFlightItineraryDropdownProps {
3
3
  flightDetails: IFlightDetails | IFlightResult;
4
- origin: IAirportLocation;
5
- destination: IAirportLocation;
6
4
  onOpenChange?: (isOpen: boolean) => void;
7
5
  }
8
- export declare const FlightItineraryDropdown: ({ flightDetails, origin, destination, onOpenChange }: IFlightItineraryDropdownProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const FlightItineraryDropdown: ({ flightDetails, onOpenChange }: IFlightItineraryDropdownProps) => import("react/jsx-runtime").JSX.Element;
9
7
  export {};
@@ -4,7 +4,8 @@ export declare enum EFlightEndpoint {
4
4
  CASH_POINTS_FLIGHT_SEARCH = "/flights/search/multi/one-way/points-cash/",
5
5
  CASH_OUTBOUND_SEARCH = "/flights/search/multi/outbound",
6
6
  CASH_INBOUND_SEARCH = "/flights/search/multi/inbound",
7
- ROUND_TRIP_FARES = "/flights/search/multi/fares"
7
+ ROUND_TRIP_FARES = "/flights/search/multi/fares",
8
+ SUPPORTED_AIRLINE_PROGRAMS = "/flights/search/supported-airlines"
8
9
  }
9
10
  export declare enum EWalletEndpoints {
10
11
  GET_AWARDS = "user/rewards",
@@ -16,6 +16,7 @@ declare class _FlightService {
16
16
  }>;
17
17
  roundTripInboundSearch: (args: IRoundTripInboundSearchArgs) => Promise<any>;
18
18
  getRoundTripFares: (args: IRoundTripFareSearchArgs) => Promise<any>;
19
+ getSupportedAirlinePrograms: () => Promise<string[]>;
19
20
  }
20
21
  export declare const FlightService: _FlightService;
21
22
  export {};