@odynn/awayz-flights 0.9.6 → 0.9.8

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 (44) hide show
  1. package/dist/BookingOption-V-FzaupW.js +196 -0
  2. package/dist/FlightItinerary-C4KPpVcF.js +94 -0
  3. package/dist/_commonjsHelpers-MdHo5S7N.js +26 -0
  4. package/dist/{arrayExtensions-DFLvtO8l.js → arrayExtensions-Ce8YopTP.js} +92 -113
  5. package/dist/assets/FlightItinerary.css +1 -1
  6. package/dist/assets/FlightItineraryDropdown.css +1 -1
  7. package/dist/assets/_styles.css +1 -1
  8. package/dist/assets/_styles2.css +1 -1
  9. package/dist/assets/_styles3.css +1 -0
  10. package/dist/assets/_styles4.css +1 -0
  11. package/dist/components/BookingOption/BookingOption.js +5 -6
  12. package/dist/components/Dialog/Dialog.js +20542 -0
  13. package/dist/components/FlightItinerary/FlightItinerary.js +5 -6
  14. package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +23 -29
  15. package/dist/components/FlightResult/FlightResult.js +318 -284
  16. package/dist/components/HorizontalScroller/HorizontalScroller.js +4 -4
  17. package/dist/components/MiniFlightItinerary/MiniFlightItinerary.js +90 -7
  18. package/dist/components/index.js +5 -5
  19. package/dist/constants/endpoints.js +1 -1
  20. package/dist/{dateUtils-CWDSSY2R.js → dateUtils-Cb9VQiIL.js} +1 -1
  21. package/dist/enums-tLvxh02p.js +4 -0
  22. package/dist/hooks/index.js +3 -3
  23. package/dist/hooks/useAirportSearch/useAirportSearch.js +1 -1
  24. package/dist/hooks/useFlightSearch/useFlightSearch.js +422 -12
  25. package/dist/{index-nOT-DH7g.js → index-9LVJi5JO.js} +12 -8
  26. package/dist/index-Kopwbl-x.js +19 -0
  27. package/dist/lib/components/Dialog/Dialog.d.ts +9 -0
  28. package/dist/lib/components/FlightItinerary/FlightItinerary.d.ts +1 -6
  29. package/dist/lib/components/FlightItineraryDropdown/FlightItineraryDropdown.d.ts +2 -4
  30. package/dist/lib/components/FlightResult/FlightResult.d.ts +1 -1
  31. package/dist/lib/constants/endpoints.d.ts +2 -1
  32. package/dist/lib/hooks/useFlightSearch/useFlightSearch.types.d.ts +3 -2
  33. package/dist/lib/services/flights/FlightsService.d.ts +1 -0
  34. package/dist/main.js +36 -35
  35. package/dist/services/flights/FlightsService.js +38 -29
  36. package/dist/services/wallet/WalletService.js +1 -1
  37. package/dist/utils/flightUtils.js +27 -28
  38. package/package.json +2 -1
  39. package/dist/BookingOption-Bf4d2RKS.js +0 -192
  40. package/dist/FlightItinerary-C2Jp2a9c.js +0 -262
  41. package/dist/MiniFlightItinerary-BEdrqoGh.js +0 -105
  42. package/dist/index-Gj4bRuCQ.js +0 -15
  43. package/dist/index-nI16-czT.js +0 -4
  44. package/dist/useFlightSearch-C0DEmnCL.js +0 -412
@@ -1,384 +1,418 @@
1
- import { jsx as i, jsxs as n, Fragment as S } from "react/jsx-runtime";
2
- import { useAwayzContext as he, useFeatureFlags as fe, RewardsService as z, EAmountsDisplayFeature as F, CashValue as K, EToolTipPosition as Q, ClientPointsValue as ue, EInvalidAmountDisplayOption as de, awayzClient as Z, EFlightBookingOptionsDisplayFeature as V, CurrencyService as ye } from "@odynn/awayz-core";
3
- import { useQuery as Ne } from "@tanstack/react-query";
4
- import { p as ve, c as Fe, B as Y } from "../../BookingOption-Bf4d2RKS.js";
5
- import { g as Pe } from "../../dateUtils-CWDSSY2R.js";
6
- import "../../arrayExtensions-DFLvtO8l.js";
7
- import { E as x } from "../../useFlightSearch-C0DEmnCL.js";
8
- import { a as j } from "../../FlightItinerary-C2Jp2a9c.js";
9
- import { useState as P, useMemo as d, useEffect as I } from "react";
10
- import { h as y } from "../../moment-BGjjqtLQ.js";
11
- import { useTranslation as Ee } from "react-i18next";
12
- import { F as Te, a as Ae, b as Oe, c as Ce, d as R } from "../../index-nOT-DH7g.js";
13
- import { EPaymentType as f } from "../../enums/EPaymentType.js";
14
- import { DEFAULT_AIRLINE_PROGRAM as G, getFlightNumber as De, getLogoPath as be, getAirlineProgram as _e } from "../../utils/flightUtils.js";
15
- import { FlightItineraryDropdown as Se } from "../FlightItineraryDropdown/FlightItineraryDropdown.js";
16
- import J from "../HorizontalScroller/HorizontalScroller.js";
17
- async function X(r, m, o) {
18
- if (!r || m === o) return r;
19
- const a = await Z.ensureQueryData({
20
- queryKey: [x.CONVERT_CURRENCY, m, o],
1
+ import { jsx as r, jsxs as n, Fragment as L } from "react/jsx-runtime";
2
+ import { useAwayzContext as Fe, useFeatureFlags as Pe, RewardsService as Y, EAmountsDisplayFeature as u, CashValue as Q, EToolTipPosition as j, ClientPointsValue as Ee, EInvalidAmountDisplayOption as Te, awayzClient as ne, EFlightBookingOptionsDisplayFeature as G, CurrencyService as Ae } from "@odynn/awayz-core";
3
+ import { useQuery as De } from "@tanstack/react-query";
4
+ import { p as w, c as Oe, B as J } from "../../BookingOption-V-FzaupW.js";
5
+ import { g as X } from "../../dateUtils-Cb9VQiIL.js";
6
+ import "../../arrayExtensions-Ce8YopTP.js";
7
+ import { E as H } from "../../enums-tLvxh02p.js";
8
+ import { E as T, F as Z } from "../../FlightItinerary-C4KPpVcF.js";
9
+ import { useRef as be, useState as A, useMemo as v, useEffect as k } from "react";
10
+ import { h as g } from "../../moment-BGjjqtLQ.js";
11
+ import { useTranslation as Ce } from "react-i18next";
12
+ import { b as W, c as _e, d as Se, e as Ie, f as x } from "../../index-9LVJi5JO.js";
13
+ import { EPaymentType as d } from "../../enums/EPaymentType.js";
14
+ import { DEFAULT_AIRLINE_PROGRAM as B, getFlightNumber as Re, getLogoPath as Le, getAirlineProgram as ke } from "../../utils/flightUtils.js";
15
+ import ee from "../Dialog/Dialog.js";
16
+ import ie from "../HorizontalScroller/HorizontalScroller.js";
17
+ import '../../assets/_styles.css';/* empty css */
18
+ const xe = (...e) => e.join(" ");
19
+ async function re(e, h, l) {
20
+ if (!e || h === l) return e;
21
+ const t = await ne.ensureQueryData({
22
+ queryKey: [H.CONVERT_CURRENCY, h, l],
21
23
  staleTime: 1e3 * 60 * 60,
22
24
  // 1 hour
23
- queryFn: () => ye.convertCurrency({
24
- baseCurrency: m,
25
- targetCurrency: o
25
+ queryFn: () => Ae.convertCurrency({
26
+ baseCurrency: h,
27
+ targetCurrency: l
26
28
  })
27
29
  });
28
- return r * a;
30
+ return e * t;
29
31
  }
30
- const Ge = ({
31
- details: r,
32
- onClick: m,
33
- showBestValue: o = !1,
34
- onShowBestValueCalculation: a,
35
- customStyling: w = !1,
36
- customCashComponent: W,
37
- customPointsComponent: B,
38
- onBookWithCash: E,
39
- onBookWithPoints: T
32
+ const Be = ({
33
+ details: e,
34
+ onClick: h,
35
+ showBestValue: l = !1,
36
+ onShowBestValueCalculation: t,
37
+ customStyling: se = !1,
38
+ customCashComponent: ae,
39
+ customPointsComponent: te,
40
+ onBookWithCash: D,
41
+ onBookWithPoints: O
40
42
  }) => {
41
- const { t: A } = Ee(), [ee, k] = P(!1), [N, re] = P(
43
+ const { t: N } = Ce(), b = be(null), [U, ce] = A(!1), [F, le] = A(
42
44
  "none"
43
45
  /* NONE */
44
- ), [ie, ne] = P(!1), { config: O } = he(), L = r.origin, H = r.destination, se = r.flightDetails, l = r.paymentOptions || [], { featureFlags: g } = fe(), C = d(
45
- () => l.filter((e) => e.points === -1),
46
- [l]
47
- ), D = d(
48
- () => l.filter((e) => e.points > -1),
49
- [l]
50
- ), ae = l.filter((e) => e.points === -1).length === 1, te = l.filter((e) => e.points > -1).length === 1, [ce, $] = P(G), p = d(() => {
51
- var e = l.filter((s) => s.points > -1).sort((s, t) => s.points - t.points);
52
- return e.find(
53
- (s) => s.program === r.airlineProgram
54
- ) || e[0];
55
- }, [l, r.airlineProgram]), oe = async () => {
56
- if (!p) {
57
- $(G);
46
+ ), [oe, me] = A(!1), { config: C } = Fe(), pe = e.origin, he = e.destination, P = e.flightDetails, m = e.paymentOptions || [], { featureFlags: p } = Pe(), _ = v(
47
+ () => m.filter((i) => i.points === -1),
48
+ [m]
49
+ ), S = v(
50
+ () => m.filter((i) => i.points > -1),
51
+ [m]
52
+ ), $ = m.filter((i) => i.points === -1).length === 1, ge = m.filter((i) => i.points > -1).length === 1, [fe, M] = A(B), c = v(() => {
53
+ var i = m.filter((s) => s.points > -1).sort((s, a) => s.points - a.points);
54
+ return i.find(
55
+ (s) => s.program === e.airlineProgram
56
+ ) || i[0];
57
+ }, [m, e.airlineProgram]), ue = async () => {
58
+ if (!c) {
59
+ M(B);
58
60
  return;
59
61
  }
60
- const e = await _e(p.program);
61
- $(e);
62
+ const i = await ke(c.program);
63
+ M(i);
62
64
  };
63
- I(() => {
64
- oe();
65
- }, [p]);
66
- const { flightNumbers: le, airlines: u } = d(() => {
67
- const e = [], s = [];
68
- return r.flightDetails.slices.forEach((t) => {
69
- t.segments.forEach((c) => {
70
- const h = De(c);
71
- e.includes(h) || e.push(h);
72
- const v = c.operatingCarrier;
73
- s.some((_) => _.airline === v.name) || s.push({
74
- logo: be(v.iataCode),
75
- airline: v.name
65
+ k(() => {
66
+ ue();
67
+ }, [c]);
68
+ const { flightNumbers: de, airlines: y } = v(() => {
69
+ const i = [], s = [];
70
+ return e.flightDetails.slices.forEach((a) => {
71
+ a.segments.forEach((o) => {
72
+ const f = Re(o);
73
+ i.includes(f) || i.push(f);
74
+ const E = o.operatingCarrier;
75
+ s.some((R) => R.airline === E.name) || s.push({
76
+ logo: Le(E.iataCode),
77
+ airline: E.name
76
78
  });
77
79
  });
78
- }), { flightNumbers: e, airlines: s };
79
- }, [r.flightDetails.slices]), me = () => {
80
- g.flightBookingOptionsDisplayFeature === V.SHEET ? r.cash > 0 ? m(r, f.CASH) : m(r, f.POINTS) : k((e) => !e);
81
- }, b = r == null ? void 0 : r.airlineProgram, { data: U } = Ne({
82
- queryKey: [x.VALUE_CENTS, b, "test"],
83
- queryFn: () => z.getCentPerPoint(b),
80
+ }), { flightNumbers: i, airlines: s };
81
+ }, [e.flightDetails.slices]), Ne = () => {
82
+ p.flightBookingOptionsDisplayFeature === G.SHEET || e.partial ? e.cash > 0 ? h(e, d.CASH) : h(e, d.POINTS) : K();
83
+ }, I = e == null ? void 0 : e.airlineProgram, { data: V } = De({
84
+ queryKey: [H.VALUE_CENTS, I, "test"],
85
+ queryFn: () => Y.getCentPerPoint(I),
84
86
  staleTime: 1 / 0,
85
- enabled: !!b && o
86
- }), q = d(() => {
87
- var e, s;
88
- return (s = (e = r.paymentOptions) == null ? void 0 : e.find(
89
- (t) => {
90
- var c;
91
- return t.program === r.airlineProgram && ((c = t.cashFee) == null ? void 0 : c.amount) !== 0;
87
+ enabled: !!I && l
88
+ }), q = v(() => {
89
+ var i, s;
90
+ return (s = (i = e.paymentOptions) == null ? void 0 : i.find(
91
+ (a) => {
92
+ var o;
93
+ return a.program === e.airlineProgram && ((o = a.cashFee) == null ? void 0 : o.amount) !== 0;
92
94
  }
93
95
  )) == null ? void 0 : s.cashFee;
94
- }, [r.paymentOptions, r.airlineProgram]), pe = async () => {
95
- if (!r || !U || !r.points || !r.cash)
96
+ }, [e.paymentOptions, e.airlineProgram]), ye = async () => {
97
+ if (!e || !V || !e.points || !e.cash)
96
98
  return;
97
- const e = r.currency;
99
+ const i = e.currency;
98
100
  let s = {
99
101
  valueCents: 1,
100
- currency: e
102
+ currency: i
101
103
  };
102
104
  try {
103
- s = await Z.ensureQueryData({
104
- queryKey: [x.VALUE_CENTS, r.airlineProgram],
105
+ s = await ne.ensureQueryData({
106
+ queryKey: [H.VALUE_CENTS, e.airlineProgram],
105
107
  staleTime: 1e3 * 60 * 60,
106
108
  // 1 hour
107
- queryFn: () => z.getCentPerPoint(r.airlineProgram)
109
+ queryFn: () => Y.getCentPerPoint(e.airlineProgram)
108
110
  });
109
- } catch (ge) {
111
+ } catch (ve) {
110
112
  console.warn(
111
113
  "Failed to fetch value cents for airline program:",
112
- r.airlineProgram,
113
- ge
114
+ e.airlineProgram,
115
+ ve
114
116
  );
115
117
  }
116
- const t = q ?? {
118
+ const a = q ?? {
117
119
  amount: 0,
118
- currency: e
119
- }, [c, h] = await Promise.all([
120
- X(
121
- t.amount,
122
- t.currency,
123
- e
120
+ currency: i
121
+ }, [o, f] = await Promise.all([
122
+ re(
123
+ a.amount,
124
+ a.currency,
125
+ i
124
126
  ),
125
- X(
127
+ re(
126
128
  s.valueCents,
127
129
  s.currency,
128
- e
130
+ i
129
131
  )
130
- ]), _ = h * r.points / 100 + c < r.cash;
131
- re(
132
- _ ? "points" : "cash"
132
+ ]), R = f * e.points / 100 + o < e.cash;
133
+ le(
134
+ R ? "points" : "cash"
133
135
  /* CASH */
134
136
  );
135
137
  };
136
- I(() => {
137
- pe();
138
- }, [r, U, q]), I(() => {
139
- const e = y(r.expiresAt), s = y();
140
- if (!(e.year() === y(0).year()) && e.isAfter(s)) {
141
- const c = e.diff(s), h = setTimeout(() => {
142
- ne(!0);
143
- }, c);
138
+ k(() => {
139
+ ye();
140
+ }, [e, V, q]), k(() => {
141
+ const i = g(e.expiresAt), s = g();
142
+ if (!(i.year() === g(0).year()) && i.isAfter(s)) {
143
+ const o = i.diff(s), f = setTimeout(() => {
144
+ me(!0);
145
+ }, o);
144
146
  return () => {
145
- clearTimeout(h);
147
+ clearTimeout(f);
146
148
  };
147
149
  }
148
- }, [r.expiresAt]);
149
- const M = (e, s, t) => {
150
- e.stopPropagation(), g.flightBookingOptionsDisplayFeature === V.SHEET ? m(t, s) : k((c) => !c);
150
+ }, [e.expiresAt]);
151
+ const z = (i, s, a) => {
152
+ i.stopPropagation(), p.flightBookingOptionsDisplayFeature === G.SHEET || a.partial ? h(a, s) : K();
153
+ }, K = () => {
154
+ const i = !U;
155
+ ce(i), i && b.current && b.current.scrollIntoView({ behavior: "smooth" });
151
156
  };
152
- return /* @__PURE__ */ i(
157
+ return /* @__PURE__ */ r(
153
158
  "div",
154
159
  {
155
- className: `${w ? "" : "awayz-"}flight-result`,
156
- onClick: me,
160
+ className: `${se ? "" : "awayz-"}flight-result`,
161
+ onClick: Ne,
157
162
  children: /* @__PURE__ */ n("div", { className: "content", children: [
158
163
  /* @__PURE__ */ n("div", { className: "flight-info", children: [
159
164
  /* @__PURE__ */ n("div", { className: "flight-info-header", children: [
160
165
  /* @__PURE__ */ n("div", { className: "airline-logo", children: [
161
- /* @__PURE__ */ i(
166
+ /* @__PURE__ */ r(
162
167
  "img",
163
168
  {
164
- src: u[0].logo,
165
- alt: u[0].airline,
166
- onError: (e) => e.currentTarget.src = (O == null ? void 0 : O.logoFallbackImageUrl) ?? ""
169
+ src: y[0].logo,
170
+ alt: y[0].airline,
171
+ onError: (i) => i.currentTarget.src = (C == null ? void 0 : C.logoFallbackImageUrl) ?? ""
167
172
  }
168
173
  ),
169
174
  /* @__PURE__ */ n("div", { children: [
170
175
  /* @__PURE__ */ n("p", { children: [
171
- u[0].airline,
172
- u.length > 1 && /* @__PURE__ */ n("sup", { className: "multiple-airlines", children: [
176
+ y[0].airline,
177
+ y.length > 1 && /* @__PURE__ */ n("sup", { className: "multiple-airlines", children: [
173
178
  "+",
174
- u.length - 1
179
+ y.length - 1
175
180
  ] })
176
181
  ] }),
177
- /* @__PURE__ */ i("p", { children: le[0] })
182
+ /* @__PURE__ */ r("p", { children: de[0] })
178
183
  ] })
179
184
  ] }),
180
185
  /* @__PURE__ */ n("div", { className: "flight-times", children: [
181
186
  /* @__PURE__ */ n("div", { className: "flight-duration", children: [
182
- /* @__PURE__ */ i(Te, {}),
183
- /* @__PURE__ */ i("p", { children: Pe(se.slices[0].duration) })
187
+ /* @__PURE__ */ r(W, {}),
188
+ /* @__PURE__ */ r("p", { children: X(P.slices[0].duration) })
184
189
  ] }),
185
- /* @__PURE__ */ i("p", { children: r.numberOfStops > 0 ? `${r.numberOfStops} ${ve(
186
- r.numberOfStops,
190
+ /* @__PURE__ */ r("p", { children: e.numberOfStops > 0 ? `${e.numberOfStops} ${w(
191
+ e.numberOfStops,
187
192
  "Stop"
188
193
  )}` : "Direct" })
189
194
  ] })
190
195
  ] }),
191
196
  /* @__PURE__ */ n("div", { className: "flight-info-content", children: [
192
197
  /* @__PURE__ */ n("div", { className: "flight-info-times", children: [
198
+ /* @__PURE__ */ r("p", { className: "flight-info-date", children: g(e.departureTime).format(
199
+ N(T.DISPLAY_MEDIUM)
200
+ ) }),
193
201
  /* @__PURE__ */ n("p", { className: "flight-info-time", children: [
194
- y(r.departureTime).format(
195
- A(j.TIME_ONLY)
202
+ g(e.departureTime).format(
203
+ N(T.TIME_ONLY)
196
204
  ),
197
205
  " "
198
206
  ] }),
199
- /* @__PURE__ */ i("div", {}),
200
207
  /* @__PURE__ */ n("div", { className: "flight-location", children: [
201
- /* @__PURE__ */ i("p", { children: L.airportCode }),
202
- /* @__PURE__ */ i("div", { className: "flight-location-icon", children: /* @__PURE__ */ i(Ae, {}) })
208
+ /* @__PURE__ */ r("div", { className: "flight-location-icon", children: /* @__PURE__ */ r(_e, {}) }),
209
+ /* @__PURE__ */ r("p", { children: pe.airportCode })
203
210
  ] })
204
211
  ] }),
205
- /* @__PURE__ */ i("div", { className: "flight-icon", children: /* @__PURE__ */ i(Oe, {}) }),
212
+ /* @__PURE__ */ n("div", { className: "flight-icon", children: [
213
+ /* @__PURE__ */ r("span", { children: /* @__PURE__ */ r(Se, {}) }),
214
+ /* @__PURE__ */ n("div", { className: "flight-times", children: [
215
+ /* @__PURE__ */ n("div", { className: "flight-duration", children: [
216
+ /* @__PURE__ */ r(W, {}),
217
+ /* @__PURE__ */ r("p", { children: X(P.slices[0].duration) })
218
+ ] }),
219
+ /* @__PURE__ */ r("p", { children: e.numberOfStops > 0 ? `${e.numberOfStops} ${w(
220
+ e.numberOfStops,
221
+ "Stop"
222
+ )}` : "Direct" })
223
+ ] }),
224
+ /* @__PURE__ */ r(
225
+ ee,
226
+ {
227
+ title: "Flight Details",
228
+ trigger: /* @__PURE__ */ r("p", { className: "view-flight-details", children: "Flight Details" }),
229
+ children: /* @__PURE__ */ r(Z, { itinerary: P.slices[0].segments })
230
+ }
231
+ )
232
+ ] }),
206
233
  /* @__PURE__ */ n("div", { className: "flight-info-times", children: [
234
+ /* @__PURE__ */ r("p", { className: "flight-info-date", children: g(e.arrivalTime).format(
235
+ N(T.DISPLAY_MEDIUM)
236
+ ) }),
207
237
  /* @__PURE__ */ n("p", { className: "flight-info-time", children: [
208
- y(r.arrivalTime).format(
209
- A(j.TIME_ONLY)
238
+ g(e.arrivalTime).format(
239
+ N(T.TIME_ONLY)
210
240
  ),
211
241
  " "
212
242
  ] }),
213
243
  /* @__PURE__ */ n("div", { className: "flight-location", children: [
214
- /* @__PURE__ */ i("p", { children: H.airportCode }),
215
- /* @__PURE__ */ i("div", { className: "flight-location-icon", children: /* @__PURE__ */ i(Ce, {}) })
244
+ /* @__PURE__ */ r("p", { children: he.airportCode }),
245
+ /* @__PURE__ */ r("div", { className: "flight-location-icon", children: /* @__PURE__ */ r(Ie, {}) })
216
246
  ] })
217
247
  ] })
218
248
  ] })
219
249
  ] }),
220
- /* @__PURE__ */ i("div", { className: "flight-footer", children: /* @__PURE__ */ i("div", { className: "booking-options ", children: ie ? /* @__PURE__ */ n("div", { className: "offer-expiry", children: [
221
- /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(R, {}) }),
222
- /* @__PURE__ */ i("p", { className: "expired-tip", children: "Offer Expired" })
223
- ] }) : /* @__PURE__ */ n(S, { children: [
224
- W || r.cash > 0 && /* @__PURE__ */ n(
225
- "div",
250
+ /* @__PURE__ */ n("div", { className: "flight-footer", children: [
251
+ /* @__PURE__ */ r(
252
+ ee,
226
253
  {
227
- className: `amount-value ${N === "cash" && o ? "show-best-value-flag" : ""}`,
228
- onClick: (e) => {
229
- M(e, f.CASH, r);
230
- },
231
- children: [
232
- g.amountsDisplayFeature === F.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ i("b", { children: "Cash" }),
233
- /* @__PURE__ */ n("div", { children: [
234
- /* @__PURE__ */ i("label", { children: ae ? "Book For" : "From" }),
235
- /* @__PURE__ */ n("span", { className: "flight-cash-amount-value", children: [
236
- /* @__PURE__ */ i(
237
- K,
238
- {
239
- amount: r.cash,
240
- currency: r.currency,
241
- position: Q.LEFT
242
- }
243
- ),
244
- g.amountsDisplayFeature === F.CASH_AND_CLIENT_POINTS && /* @__PURE__ */ n(S, { children: [
245
- "/",
246
- " ",
247
- /* @__PURE__ */ i(
248
- ue,
249
- {
250
- currency: r.currency,
251
- cashAmount: r.cash
252
- }
253
- )
254
- ] })
255
- ] })
256
- ] }),
257
- N === "cash" && g.amountsDisplayFeature === F.CASH_AND_TRAVEL_PARTNER_POINTS && o && /* @__PURE__ */ n(
258
- "div",
259
- {
260
- className: "best-value-flag tip",
261
- onClick: (e) => {
262
- e.stopPropagation(), a == null || a(r);
263
- },
264
- children: [
265
- a && /* @__PURE__ */ i(R, {}),
266
- /* @__PURE__ */ i("p", { children: "Best Value" }),
267
- a && /* @__PURE__ */ i("span", { children: "Click to learn more" })
268
- ]
269
- }
270
- )
271
- ]
254
+ title: "Flight Details",
255
+ trigger: /* @__PURE__ */ r("p", { className: "view-flight-details", children: "View Flight Details" }),
256
+ children: /* @__PURE__ */ r(Z, { itinerary: P.slices[0].segments })
272
257
  }
273
258
  ),
274
- B || r.points > 0 && g.amountsDisplayFeature === F.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ n(
275
- "div",
276
- {
277
- className: `amount-value ${N === "points" && o ? "show-best-value-flag" : ""}`,
278
- onClick: (e) => {
279
- M(e, f.POINTS, r);
280
- },
281
- children: [
282
- N === "points" && o && /* @__PURE__ */ n(
283
- "div",
284
- {
285
- className: "best-value-flag tip",
286
- onClick: (e) => {
287
- e.stopPropagation(), a == null || a(r);
288
- },
289
- children: [
290
- a && /* @__PURE__ */ i(R, {}),
291
- /* @__PURE__ */ i("p", { children: "Best Value" }),
292
- a && /* @__PURE__ */ i("span", { children: "Click to learn more" })
293
- ]
294
- }
259
+ /* @__PURE__ */ r("div", { className: "booking-options", children: oe ? /* @__PURE__ */ n("div", { className: "offer-expiry", children: [
260
+ /* @__PURE__ */ r("span", { children: /* @__PURE__ */ r(x, {}) }),
261
+ /* @__PURE__ */ r("p", { className: "expired-tip", children: "Offer Expired" })
262
+ ] }) : /* @__PURE__ */ n(L, { children: [
263
+ ae || e.cash > 0 && /* @__PURE__ */ n(
264
+ "div",
265
+ {
266
+ className: xe(
267
+ "amount-value",
268
+ F === "cash" && l ? "show-best-value-flag" : "",
269
+ p.amountsDisplayFeature !== u.CASH_AND_TRAVEL_PARTNER_POINTS ? "lg" : ""
295
270
  ),
296
- /* @__PURE__ */ i("div", { className: "amount-airline-logo", children: /* @__PURE__ */ i("img", { src: ce.programLogo }) }),
297
- /* @__PURE__ */ n("div", { children: [
298
- /* @__PURE__ */ i("label", { children: te ? "Book For" : "From" }),
299
- /* @__PURE__ */ n("p", { children: [
300
- `${Fe(
301
- p.points
302
- )} ${A("miles")}`,
303
- !!p.cashFee && /* @__PURE__ */ n(S, { children: [
304
- " + ",
305
- /* @__PURE__ */ i(
306
- K,
271
+ onClick: (i) => {
272
+ z(i, d.CASH, e);
273
+ },
274
+ children: [
275
+ p.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS ? /* @__PURE__ */ r("b", { children: "Cash" }) : /* @__PURE__ */ r("b", { children: $ ? "Book For" : "From" }),
276
+ /* @__PURE__ */ n("div", { children: [
277
+ p.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ r("label", { children: $ ? "Book For" : "From" }),
278
+ /* @__PURE__ */ n("span", { className: "flight-cash-amount-value", children: [
279
+ /* @__PURE__ */ r(
280
+ Q,
307
281
  {
308
- amount: p.cashFee.amount,
309
- currency: p.cashFee.currency,
310
- customDisplay: "No fee",
311
- zeroDisplayOption: de.CUSTOM,
312
- position: Q.LEFT
282
+ amount: e.cash,
283
+ currency: e.currency,
284
+ position: j.LEFT
313
285
  }
314
- )
286
+ ),
287
+ p.amountsDisplayFeature === u.CASH_AND_CLIENT_POINTS && /* @__PURE__ */ n(L, { children: [
288
+ "/",
289
+ " ",
290
+ /* @__PURE__ */ r(
291
+ Ee,
292
+ {
293
+ currency: e.currency,
294
+ cashAmount: e.cash
295
+ }
296
+ )
297
+ ] })
298
+ ] })
299
+ ] }),
300
+ F === "cash" && p.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && l && /* @__PURE__ */ n(
301
+ "div",
302
+ {
303
+ className: "best-value-flag tip",
304
+ onClick: (i) => {
305
+ i.stopPropagation(), t == null || t(e);
306
+ },
307
+ children: [
308
+ t && /* @__PURE__ */ r(x, {}),
309
+ /* @__PURE__ */ r("p", { children: "Best Value" }),
310
+ t && /* @__PURE__ */ r("span", { children: "Click to learn more" })
311
+ ]
312
+ }
313
+ )
314
+ ]
315
+ }
316
+ ),
317
+ te || e.points > 0 && p.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ n(
318
+ "div",
319
+ {
320
+ className: `amount-value ${F === "points" && l ? "show-best-value-flag" : ""}`,
321
+ onClick: (i) => {
322
+ z(i, d.POINTS, e);
323
+ },
324
+ children: [
325
+ F === "points" && l && /* @__PURE__ */ n(
326
+ "div",
327
+ {
328
+ className: "best-value-flag tip",
329
+ onClick: (i) => {
330
+ i.stopPropagation(), t == null || t(e);
331
+ },
332
+ children: [
333
+ t && /* @__PURE__ */ r(x, {}),
334
+ /* @__PURE__ */ r("p", { children: "Best Value" }),
335
+ t && /* @__PURE__ */ r("span", { children: "Click to learn more" })
336
+ ]
337
+ }
338
+ ),
339
+ /* @__PURE__ */ r("div", { className: "amount-airline-logo", children: /* @__PURE__ */ r("img", { src: fe.programLogo }) }),
340
+ /* @__PURE__ */ n("div", { children: [
341
+ /* @__PURE__ */ r("label", { children: ge ? "Book For" : "From" }),
342
+ /* @__PURE__ */ n("p", { children: [
343
+ `${Oe(
344
+ c == null ? void 0 : c.points
345
+ )} ${N("miles")}`,
346
+ !!(c != null && c.cashFee) && /* @__PURE__ */ n(L, { children: [
347
+ " + ",
348
+ /* @__PURE__ */ r(
349
+ Q,
350
+ {
351
+ amount: c.cashFee.amount,
352
+ currency: c.cashFee.currency,
353
+ customDisplay: "No fee",
354
+ zeroDisplayOption: Te.CUSTOM,
355
+ position: j.LEFT
356
+ }
357
+ )
358
+ ] })
315
359
  ] })
316
360
  ] })
317
- ] })
318
- ]
319
- }
320
- )
321
- ] }) }) }),
322
- /* @__PURE__ */ i("div", { className: `flight-details ${ee ? "is-open" : ""}`, children: /* @__PURE__ */ n("div", { className: "inner", children: [
323
- /* @__PURE__ */ i(
324
- Se,
325
- {
326
- flightDetails: r,
327
- origin: L,
328
- destination: H
329
- }
330
- ),
331
- /* @__PURE__ */ n("div", { className: "flight-booking-options", children: [
332
- C.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
333
- D.length > 0 && /* @__PURE__ */ i("p", { className: "booking-options-title", children: "Cash Options" }),
334
- /* @__PURE__ */ i(J, { children: C.map((e, s) => /* @__PURE__ */ i(
335
- Y,
336
- {
337
- type: f.CASH,
338
- title: e.fareBrandName,
339
- cashValue: {
340
- amount: e.cash,
341
- currency: r.currency
342
- },
343
- milesValue: void 0,
344
- cashFee: e.cashFee,
345
- setSelected: () => {
346
- E == null || E(e);
347
- },
348
- conditions: e.conditions,
349
- slices: r.flightDetails.slices,
350
- baggages: e.baggages
361
+ ]
362
+ }
363
+ )
364
+ ] }) })
365
+ ] }),
366
+ /* @__PURE__ */ r("div", { className: `flight-details ${U ? "is-open" : ""}`, children: /* @__PURE__ */ r("div", { ref: b, className: "inner", children: /* @__PURE__ */ n("div", { className: "flight-booking-options", children: [
367
+ _.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
368
+ S.length > 0 && /* @__PURE__ */ r("p", { className: "booking-options-title", children: "Cash Options" }),
369
+ /* @__PURE__ */ r(ie, { children: _.map((i, s) => /* @__PURE__ */ r(
370
+ J,
371
+ {
372
+ type: d.CASH,
373
+ title: i.fareBrandName,
374
+ cashValue: {
375
+ amount: i.cash,
376
+ currency: e.currency
351
377
  },
352
- `cash-${s}`
353
- )) })
354
- ] }),
355
- D.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
356
- C.length > 0 && /* @__PURE__ */ i("p", { className: "booking-options-title", children: "Miles Options" }),
357
- /* @__PURE__ */ i(J, { children: D.map((e, s) => /* @__PURE__ */ i(
358
- Y,
359
- {
360
- type: f.POINTS,
361
- title: e.fareBrandName,
362
- cashValue: void 0,
363
- milesValue: e.points,
364
- cashFee: e.cashFee,
365
- setSelected: () => {
366
- T == null || T(e);
367
- },
368
- conditions: e.conditions,
369
- slices: r.flightDetails.slices,
370
- baggages: e.baggages,
371
- program: e.program
378
+ milesValue: void 0,
379
+ cashFee: i.cashFee,
380
+ setSelected: () => {
381
+ D == null || D(i, e);
372
382
  },
373
- `points-${s}`
374
- )) })
375
- ] })
383
+ conditions: i.conditions,
384
+ slices: e.flightDetails.slices,
385
+ baggages: i.baggages
386
+ },
387
+ `cash-${s}`
388
+ )) })
389
+ ] }),
390
+ S.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
391
+ _.length > 0 && /* @__PURE__ */ r("p", { className: "booking-options-title", children: "Miles Options" }),
392
+ /* @__PURE__ */ r(ie, { children: S.map((i, s) => /* @__PURE__ */ r(
393
+ J,
394
+ {
395
+ type: d.POINTS,
396
+ title: i.fareBrandName,
397
+ cashValue: void 0,
398
+ milesValue: i.points,
399
+ cashFee: i.cashFee,
400
+ setSelected: () => {
401
+ O == null || O(i);
402
+ },
403
+ conditions: i.conditions,
404
+ slices: e.flightDetails.slices,
405
+ baggages: i.baggages,
406
+ program: i.program
407
+ },
408
+ `points-${s}`
409
+ )) })
376
410
  ] })
377
- ] }) })
411
+ ] }) }) })
378
412
  ] })
379
413
  }
380
414
  );
381
415
  };
382
416
  export {
383
- Ge as FlightResult
417
+ Be as FlightResult
384
418
  };