@odynn/awayz-flights 0.10.7 → 0.10.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 (31) hide show
  1. package/dist/{FlightItinerary-BvAVMr_3.js → FlightItinerary-Bn345w_C.js} +0 -1
  2. package/dist/FlightsService-BgXzj6SR.js +155 -0
  3. package/dist/assets/_styles.css +1 -1
  4. package/dist/components/BookingOption/BookingOption.js +193 -11
  5. package/dist/components/Dialog/Dialog.js +8 -9
  6. package/dist/components/FlightItinerary/FlightItinerary.js +1 -1
  7. package/dist/components/FlightItineraryDropdown/FlightItineraryDropdown.js +9 -13
  8. package/dist/components/HorizontalScroller/HorizontalScroller.js +2 -2
  9. package/dist/components/MiniFlightItinerary/MiniFlightItinerary.js +7 -7
  10. package/dist/components/index.js +7 -9
  11. package/dist/hooks/useAirportSearch/useAirportSearch.js +9 -8
  12. package/dist/hooks/useFlightSearch/useFlightSearch.js +560 -560
  13. package/dist/index-B9NLqDyM.js +39 -0
  14. package/dist/lib/components/index.d.ts +0 -1
  15. package/dist/lib/services/wallet/WalletService.mappers.d.ts +21 -0
  16. package/dist/main.js +29 -31
  17. package/dist/numberUtils-DxNMfbMM.js +8 -0
  18. package/dist/services/flights/FlightsService.js +5 -145
  19. package/dist/services/wallet/WalletService.js +26 -29
  20. package/dist/services/wallet/WalletService.mappers.js +74 -0
  21. package/dist/utils/flightUtils.js +13 -12
  22. package/package.json +1 -1
  23. package/dist/BookingOption-D566Ie2y.js +0 -205
  24. package/dist/assets/_styles2.css +0 -1
  25. package/dist/components/FlightResult/FlightResult.js +0 -416
  26. package/dist/enums-DPFgYLjY.js +0 -4
  27. package/dist/index-9LVJi5JO.js +0 -55
  28. package/dist/lib/components/FlightResult/FlightResult.d.ts +0 -40
  29. package/dist/objectUtils-3IeCVocm.js +0 -7
  30. /package/dist/assets/{_styles4.css → BookingOption.css} +0 -0
  31. /package/dist/assets/{_styles3.css → Dialog.css} +0 -0
@@ -1,205 +0,0 @@
1
- import { jsxs as t, jsx as o, Fragment as d } from "react/jsx-runtime";
2
- import { useAwayzContext as M, useFeatureFlags as $, useWallet as x, EBookingPaymentMethod as j, convertCashToClientPoints as q, CashValue as u, EToolTipPosition as y, EInvalidAmountDisplayOption as f, EAmountsDisplayFeature as W, ClientPointsValue as b } 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 G, { useState as k, useEffect as K } from "react";
7
- import { G as Q } from "./iconBase-DSKTHwal.js";
8
- import { h as J, i as O, j as X, k as V } from "./index-9LVJi5JO.js";
9
- import { EPaymentType as D } from "./enums/EPaymentType.js";
10
- import { EBaggage as I } from "./hooks/useFlightSearch/useFlightSearch.types.js";
11
- import { getAirlineProgram as oo, formatCabinClass as ro } from "./utils/flightUtils.js";
12
- import './assets/_styles4.css';/* empty css */
13
- const U = (e, l, n = l + "s") => e === 1 ? l : n, to = (e) => e ? e.toLowerCase().replace(/-/g, " ").split(" ").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" ") : "";
14
- function no(e, l = !0) {
15
- if ((!e || isNaN(e) || e < 0) && l) return "N/A";
16
- let n = e == null ? void 0 : e.toString().split(".")[0];
17
- return n == null ? void 0 : n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
18
- }
19
- const eo = "USD";
20
- function F(e) {
21
- return Q({ attr: { viewBox: "0 0 352 512" }, child: [{ tag: "path", attr: { d: "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }, child: [] }] })(e);
22
- }
23
- const ho = ({
24
- type: e,
25
- title: l,
26
- cashValue: n,
27
- milesValue: w,
28
- cashFee: p,
29
- setSelected: B,
30
- conditions: c,
31
- slices: s,
32
- baggages: N,
33
- program: h
34
- }) => {
35
- var L, T, v;
36
- const { config: A } = M(), { featureFlags: g } = $(), [m, H] = k(!1), [E, Y] = k(), { pointsAsCash: P } = x(), i = c == null ? void 0 : c.refundBeforeDeparture, a = c == null ? void 0 : c.changeBeforeDeparture, S = (i != null && i.allowed ? 1 : 0) + (a != null && a.allowed ? 1 : 0) + (((T = (L = s == null ? void 0 : s[0]) == null ? void 0 : L.segments) == null ? void 0 : T.length) || 0), { data: _ } = Z({
37
- queryKey: ["airlineProgram", h],
38
- queryFn: () => oo(h),
39
- enabled: !!h
40
- });
41
- return K(() => {
42
- g.bookingPaymentMethodFeature === j.FULL_VCC_PARTIAL_DISABLED && q({
43
- cashAmount: (n == null ? void 0 : n.amount) ?? 0,
44
- currency: (n == null ? void 0 : n.currency) ?? "",
45
- pointsAsCash: P
46
- }).then((r) => {
47
- P.availablePoints < r && Y("Insufficient points balance.");
48
- });
49
- }, [n, g]), /* @__PURE__ */ t(
50
- "div",
51
- {
52
- className: "flight-booking-option",
53
- onClick: (r) => r.stopPropagation(),
54
- children: [
55
- /* @__PURE__ */ t("div", { className: "rate-details", children: [
56
- e === D.POINTS && /* @__PURE__ */ o("img", { src: _ == null ? void 0 : _.programLogo }),
57
- /* @__PURE__ */ o("p", { className: "fare-brand-name", children: to(l) })
58
- ] }),
59
- e === D.CASH && /* @__PURE__ */ t("div", { className: "fare-comparison-content", children: [
60
- N == null ? void 0 : N.map((r, C) => /* @__PURE__ */ t(G.Fragment, { children: [
61
- r.type === I.CHECKED && /* @__PURE__ */ t("div", { className: "fare-option checked", children: [
62
- /* @__PURE__ */ o("p", { children: "Checked bags:" }),
63
- /* @__PURE__ */ o("p", { children: r.quantity })
64
- ] }),
65
- r.type === I.CARRY_ON && /* @__PURE__ */ t("div", { className: "fare-option", children: [
66
- /* @__PURE__ */ o("p", { children: "Carry-on bags:" }),
67
- /* @__PURE__ */ o("p", { children: r.quantity })
68
- ] }),
69
- r.type === null && /* @__PURE__ */ t("div", { className: "fare-option", children: [
70
- /* @__PURE__ */ o(J, {}),
71
- /* @__PURE__ */ o("p", { children: "N/A" })
72
- ] })
73
- ] }, C)),
74
- /* @__PURE__ */ t("div", { className: "fare-option refundable", children: [
75
- "Refundable:",
76
- " ",
77
- i != null && i.allowed ? /* @__PURE__ */ o(O, { className: "yes" }) : /* @__PURE__ */ o(F, { className: "no" })
78
- ] }),
79
- /* @__PURE__ */ t("div", { className: "fare-option changeable", children: [
80
- "Changeable:",
81
- " ",
82
- a != null && a.allowed ? /* @__PURE__ */ o(O, { className: "yes" }) : /* @__PURE__ */ o(F, { className: "no" })
83
- ] }),
84
- /* @__PURE__ */ t(
85
- "div",
86
- {
87
- className: "fare-option show-more-toggle",
88
- onClick: (r) => {
89
- r.stopPropagation(), H(!m);
90
- },
91
- children: [
92
- /* @__PURE__ */ o("p", { children: m ? `Hide ${U(S, "option")}` : `+${S} ${U(S, "option")}` }),
93
- /* @__PURE__ */ o("p", { children: m ? /* @__PURE__ */ o(X, {}) : /* @__PURE__ */ o(V, {}) })
94
- ]
95
- }
96
- ),
97
- m && /* @__PURE__ */ t(d, { children: [
98
- (i == null ? void 0 : i.allowed) && /* @__PURE__ */ t("div", { className: "fare-option", children: [
99
- "Refundable Penalty:",
100
- " ",
101
- /* @__PURE__ */ o(
102
- u,
103
- {
104
- amount: i.penaltyAmount || 0,
105
- currency: i.penaltyCurrency || "",
106
- zeroDisplayOption: f.DISPLAY_AS_ZERO_WITH_CURRENCY,
107
- position: y.LEFT
108
- }
109
- )
110
- ] }),
111
- (a == null ? void 0 : a.allowed) && /* @__PURE__ */ t("div", { className: "fare-option", children: [
112
- "Changeable Penalty:",
113
- " ",
114
- /* @__PURE__ */ o(
115
- u,
116
- {
117
- amount: a.penaltyAmount || 0,
118
- currency: a.penaltyCurrency || "",
119
- zeroDisplayOption: f.DISPLAY_AS_ZERO_WITH_CURRENCY,
120
- position: y.LEFT
121
- }
122
- )
123
- ] }),
124
- (v = s == null ? void 0 : s[0].segments) == null ? void 0 : v.map((r) => {
125
- var C, R;
126
- return /* @__PURE__ */ t(
127
- "div",
128
- {
129
- className: "fare-option checked",
130
- children: [
131
- /* @__PURE__ */ t("p", { children: [
132
- r.origin.iataCode,
133
- " - ",
134
- r.destination.iataCode,
135
- ":"
136
- ] }),
137
- /* @__PURE__ */ t("div", { children: [
138
- /* @__PURE__ */ o(
139
- "img",
140
- {
141
- src: r.operatingCarrier.logo ?? r.operatingCarrier.logoSymbolUrl ?? ((C = r.marketingCarrier) == null ? void 0 : C.logo) ?? ((R = r.marketingCarrier) == null ? void 0 : R.logoSymbolUrl),
142
- onError: (z) => z.currentTarget.src = (A == null ? void 0 : A.logoFallbackImageUrl) ?? ""
143
- }
144
- ),
145
- /* @__PURE__ */ o("p", { children: ro(r.passengers[0].cabinClass) })
146
- ] })
147
- ]
148
- },
149
- `${r.origin.iataCode}-${r.destination.iataCode}`
150
- );
151
- })
152
- ] })
153
- ] }),
154
- /* @__PURE__ */ o(
155
- "button",
156
- {
157
- onClick: (r) => {
158
- r.stopPropagation(), B();
159
- },
160
- disabled: !!E,
161
- children: e === D.CASH && n ? /* @__PURE__ */ o(d, { children: E ? /* @__PURE__ */ o("p", { children: E }) : /* @__PURE__ */ t(d, { children: [
162
- /* @__PURE__ */ o(
163
- u,
164
- {
165
- amount: n.amount,
166
- currency: n.currency,
167
- position: y.LEFT,
168
- zeroDisplayOption: f.DISPLAY_AS_ZERO_WITH_CURRENCY,
169
- decimalPlaces: 2
170
- }
171
- ),
172
- g.amountsDisplayFeature === W.CASH_AND_CLIENT_POINTS && /* @__PURE__ */ t(d, { children: [
173
- " / ",
174
- /* @__PURE__ */ o(
175
- b,
176
- {
177
- currency: n.currency,
178
- cashAmount: n.amount
179
- }
180
- )
181
- ] })
182
- ] }) }) : /* @__PURE__ */ t(d, { children: [
183
- `${no(w)} miles + `,
184
- /* @__PURE__ */ o(
185
- u,
186
- {
187
- amount: (p == null ? void 0 : p.amount) || 0,
188
- currency: (p == null ? void 0 : p.currency) || eo,
189
- position: y.LEFT,
190
- customDisplay: "No fee",
191
- zeroDisplayOption: f.CUSTOM
192
- }
193
- )
194
- ] })
195
- }
196
- )
197
- ]
198
- }
199
- );
200
- };
201
- export {
202
- ho as B,
203
- no as c,
204
- U as p
205
- };
@@ -1 +0,0 @@
1
- @import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";*{font-family:Inter,sans-serif!important;margin:0;padding:0;box-sizing:border-box}:root{font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.tip{position:relative}.tip>span{background-color:var(--dark, #14181f);color:#fff;padding:.5rem;border-radius:.5rem;position:absolute;bottom:110%;left:50%;transform:translate(-50%);display:none;transition:all .2s ease-in-out;z-index:100;width:max-content;font-size:.6rem;font-weight:600;text-transform:uppercase;line-height:.8rem;text-align:center;box-sizing:border-box;pointer-events:none}@media screen and (max-width: 480px){.tip>span{width:fit-content}}.tip>span.left{right:100%;top:50%;bottom:auto;left:auto;transform:translateY(-50%)}.tip>span.left:before{left:auto;right:-7.5px;top:50%;transform:translateY(-50%) rotate(-90deg)}.tip>span.right{left:100%;top:50%;bottom:auto;right:auto;transform:translateY(-50%)}.tip>span.right:before{left:-7.5px;right:auto;top:50%;transform:translateY(-50%) rotate(90deg)}.tip>span.bottom{top:100%;left:50%;right:auto;bottom:auto;transform:translate(-50%)}.tip>span.bottom:before{left:50%;right:auto;top:-5px;transform:translate(-50%) rotate(180deg)}.tip>span:before{content:"";position:absolute;bottom:-5px;left:50%;transform:translate(-50%);width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid var(--dark, #14181f)}.tip:hover>span,.tip:focus>span{display:flex;animation:tip-fade-up .2s ease-in-out}.tip:hover>span.right,.tip:focus>span.right{animation:tip-fade-right .2s ease-in-out}.tip:hover>span.left,.tip:focus>span.left{animation:tip-fade-left .2s ease-in-out}.tip:hover>span.bottom,.tip:focus>span.bottom{animation:tip-fade-down .2s ease-in-out}@keyframes slide-in-right{0%{opacity:0;transform:translate(0)}50%{transform:translate(-100vw);opacity:0}50.001%{opacity:0;transform:translate(105vw)}50.002%{opacity:1;transform:translate(100vw)}to{transform:translate(0)}}@keyframes slide-in-left{0%{opacity:0;transform:translate(0)}50%{transform:translate(100vw);opacity:0}50.001%{opacity:0;transform:translate(-100vw)}50.002%{opacity:1;transform:translate(-100vw)}to{transform:translate(0)}}@keyframes slide-out-right{0%{transform:translate(0)}to{transform:translate(100vw);opacity:1}}@keyframes slide-out-left{0%{transform:translate(0)}to{transform:translate(-100vw);opacity:1}}@keyframes slide-up{0%{transform:translateY(100%)}to{transform:translate(0);opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes fade-in{0%{opacity:0;scale:.9}to{opacity:1;scale:1}}@keyframes scale-out{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes scale-in{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes no-no{0%{transform:translate(0)}20%{transform:translate(-20px)}40%{transform:translate(15px)}60%{transform:translate(-10px)}80%{transform:translate(5px)}to{transform:translate(0)}}@keyframes loading-track{0%{transform:translate(-100%);opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0;transform:translate(100%)}}@keyframes loading-in{0%{height:0}to{height:5px}}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes shine{0%{background-position:right}}@keyframes text-pulse{0%{opacity:.75}35%{opacity:1}65%{opacity:1}to{opacity:.75}}@keyframes pulse{0%{opacity:.85}35%{opacity:1}65%{opacity:1}to{opacity:.85}}@keyframes shimmer{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}@keyframes fade-up{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes fade-down{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes fade-right{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes spring-in{0%{opacity:0;transform:scale(.8)}70%{opacity:1;transform:scale(1.05)}to{opacity:1;transform:scale(1)}}@keyframes ripple{0%{transform:scale(1)}to{transform:scale(1.1,1.4)}}@keyframes tip-fade-right{0%{opacity:0;transform:translate(-20px,-50%)}to{opacity:1;transform:translateY(-50%)}}@keyframes tip-fade-left{0%{opacity:0;transform:translate(20px,-50%)}to{opacity:1;transform:translateY(-50%)}}@keyframes tip-fade-down{0%{opacity:0;transform:translate(-50%,-20px)}to{opacity:1;transform:translate(-50%)}}@keyframes tip-fade-up{0%{opacity:0;transform:translate(-50%,5px)}to{opacity:1;transform:translate(-50%)}}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@keyframes slide-out{0%{transform:translate(0);opacity:1}to{transform:translate(100%);opacity:0}}@keyframes scale-fade-in{0%{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}@keyframes scroll-horizontally{0%{transform:translate(0)}to{transform:translate(-50%)}}.horizontal-scroller-container{position:relative}.horizontal-scroller-container.show-left-fade:before{opacity:1}.horizontal-scroller-container.show-right-fade:after{opacity:1}.horizontal-scroller-container .horizontal-scroller{display:flex;overflow-x:auto;scroll-behavior:smooth;gap:1rem}.horizontal-scroller-container .scroll-arrow{position:absolute;top:50%;transform:translateY(-50%);width:40px;height:40px;border-radius:50%;background-color:var(--foreground, #fff);border:1px solid var(--border, #e7eef3);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease;z-index:2}.horizontal-scroller-container .scroll-arrow:hover{background-color:var(--background, #f9fdff)}.horizontal-scroller-container .scroll-arrow:active{transform:translateY(-50%) scale(.95)}.horizontal-scroller-container .scroll-arrow-left{left:0}.horizontal-scroller-container .scroll-arrow-right{right:0}
@@ -1,416 +0,0 @@
1
- import { jsx as i, jsxs as n, Fragment as R } 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 Ae, awayzClient as ne, EFlightBookingOptionsDisplayFeature as w, CurrencyService as Te } from "@odynn/awayz-core";
3
- import { useQuery as De } from "@tanstack/react-query";
4
- import { p as G, c as Oe, B as J } from "../../BookingOption-D566Ie2y.js";
5
- import { g as X } from "../../dateUtils-Cb9VQiIL.js";
6
- import "../../arrayExtensions-Ce8YopTP.js";
7
- import { E as x } from "../../enums-DPFgYLjY.js";
8
- import { E as P, F as Z } from "../../FlightItinerary-BvAVMr_3.js";
9
- import { useRef as Ce, useState as E, useMemo as d, useEffect as L } from "react";
10
- import { h as f } from "../../moment-BGjjqtLQ.js";
11
- import { useTranslation as Se } from "react-i18next";
12
- import { b as W, c as _e, d as be, e as Ie, f as k } from "../../index-9LVJi5JO.js";
13
- import { EPaymentType as y } from "../../enums/EPaymentType.js";
14
- import { DEFAULT_AIRLINE_PROGRAM as B, getLogoPath as Re, getAirlineProgram as Le } from "../../utils/flightUtils.js";
15
- import ee from "../Dialog/Dialog.js";
16
- import re from "../HorizontalScroller/HorizontalScroller.js";
17
- import '../../assets/_styles.css';/* empty css */
18
- const ke = (...e) => e.join(" ");
19
- async function ie(e, g, o) {
20
- if (!e || g === o) return e;
21
- const c = await ne.ensureQueryData({
22
- queryKey: [x.CONVERT_CURRENCY, g, o],
23
- staleTime: 1e3 * 60 * 60,
24
- // 1 hour
25
- queryFn: () => Te.convertCurrency({
26
- baseCurrency: g,
27
- targetCurrency: o
28
- })
29
- });
30
- return e * c;
31
- }
32
- const er = ({
33
- details: e,
34
- onClick: g,
35
- showBestValue: o = !1,
36
- onShowBestValueCalculation: c,
37
- customStyling: se = !1,
38
- customCashComponent: ae,
39
- customPointsComponent: te,
40
- onBookWithCash: A,
41
- onBookWithPoints: T
42
- }) => {
43
- const { t: N } = Se(), D = Ce(null), [H, ce] = E(!1), [v, oe] = E(
44
- "none"
45
- /* NONE */
46
- ), [le, me] = E(!1), { config: O } = Fe(), pe = e.origin, he = e.destination, F = e.flightDetails, l = e.paymentOptions || [], { featureFlags: m } = Pe(), C = d(
47
- () => l.filter((r) => r.points === -1),
48
- [l]
49
- ), S = d(
50
- () => l.filter((r) => r.points > -1),
51
- [l]
52
- ), U = l.filter((r) => r.points === -1).length === 1, ge = l.filter((r) => r.points > -1).length === 1, [fe, V] = E(B), a = d(() => {
53
- var r = l.filter((s) => s.points > -1).sort((s, t) => s.points - t.points);
54
- return r.find(
55
- (s) => s.program === e.airlineProgram
56
- ) || r[0];
57
- }, [l, e.airlineProgram]), ue = async () => {
58
- if (!a) {
59
- V(B);
60
- return;
61
- }
62
- const r = await Le(a.program);
63
- V(r);
64
- };
65
- L(() => {
66
- ue();
67
- }, [a]);
68
- const _ = d(() => ({
69
- logo: Re(e.displayAirlineIataCode),
70
- airline: e.airline
71
- }), [e]), $ = d(() => {
72
- const r = /* @__PURE__ */ new Set(), s = [];
73
- return e.flightDetails.slices.forEach((t) => {
74
- t.segments.forEach((p) => {
75
- var I;
76
- const h = (I = p.operatingCarrier) == null ? void 0 : I.name;
77
- h && !r.has(h) && (r.add(h), s.push(h));
78
- });
79
- }), s;
80
- }, [e]), de = () => {
81
- m.flightBookingOptionsDisplayFeature === w.SHEET || e.partial ? e.cash > 0 ? g(e, y.CASH) : g(e, y.POINTS) : K();
82
- }, b = e == null ? void 0 : e.airlineProgram, { data: M } = De({
83
- queryKey: [x.VALUE_CENTS, b, "test"],
84
- queryFn: () => Y.getCentPerPoint(b),
85
- staleTime: 1 / 0,
86
- enabled: !!b && o
87
- }), q = d(() => {
88
- var r, s;
89
- return (s = (r = e.paymentOptions) == null ? void 0 : r.find(
90
- (t) => {
91
- var p;
92
- return t.program === e.airlineProgram && ((p = t.cashFee) == null ? void 0 : p.amount) !== 0;
93
- }
94
- )) == null ? void 0 : s.cashFee;
95
- }, [e.paymentOptions, e.airlineProgram]), ye = async () => {
96
- if (!e || !M || !e.points || !e.cash)
97
- return;
98
- const r = e.currency;
99
- let s = {
100
- valueCents: 1,
101
- currency: r
102
- };
103
- try {
104
- s = await ne.ensureQueryData({
105
- queryKey: [x.VALUE_CENTS, e.airlineProgram],
106
- staleTime: 1e3 * 60 * 60,
107
- // 1 hour
108
- queryFn: () => Y.getCentPerPoint(e.airlineProgram)
109
- });
110
- } catch (ve) {
111
- console.warn(
112
- "Failed to fetch value cents for airline program:",
113
- e.airlineProgram,
114
- ve
115
- );
116
- }
117
- const t = q ?? {
118
- amount: 0,
119
- currency: r
120
- }, [p, h] = await Promise.all([
121
- ie(
122
- t.amount,
123
- t.currency,
124
- r
125
- ),
126
- ie(
127
- s.valueCents,
128
- s.currency,
129
- r
130
- )
131
- ]), Ne = h * e.points / 100 + p < e.cash;
132
- oe(
133
- Ne ? "points" : "cash"
134
- /* CASH */
135
- );
136
- };
137
- L(() => {
138
- ye();
139
- }, [e, M, q]), L(() => {
140
- const r = f(e.expiresAt), s = f();
141
- if (!(r.year() === f(0).year()) && r.isAfter(s)) {
142
- const p = r.diff(s), h = setTimeout(() => {
143
- me(!0);
144
- }, p);
145
- return () => {
146
- clearTimeout(h);
147
- };
148
- }
149
- }, [e.expiresAt]);
150
- const z = (r, s, t) => {
151
- r.stopPropagation(), m.flightBookingOptionsDisplayFeature === w.SHEET || t.partial ? g(t, s) : K();
152
- }, K = () => {
153
- const r = !H;
154
- ce(r), r && D.current && D.current.scrollIntoView({ behavior: "smooth" });
155
- };
156
- return !(e.cash > 0) && !!!a ? null : /* @__PURE__ */ i(
157
- "div",
158
- {
159
- className: `${se ? "" : "awayz-"}flight-result`,
160
- onClick: de,
161
- children: /* @__PURE__ */ n("div", { className: "content", children: [
162
- /* @__PURE__ */ n("div", { className: "flight-info", children: [
163
- /* @__PURE__ */ n("div", { className: "flight-info-header", children: [
164
- /* @__PURE__ */ n("div", { className: "airline-logo", children: [
165
- /* @__PURE__ */ i(
166
- "img",
167
- {
168
- src: _.logo,
169
- alt: _.airline,
170
- onError: (r) => r.currentTarget.src = (O == null ? void 0 : O.logoFallbackImageUrl) ?? ""
171
- }
172
- ),
173
- /* @__PURE__ */ i("div", { children: /* @__PURE__ */ n("p", { children: [
174
- _.airline,
175
- $.length > 1 && /* @__PURE__ */ n("sup", { className: "multiple-airlines", children: [
176
- "+",
177
- $.length - 1
178
- ] })
179
- ] }) })
180
- ] }),
181
- /* @__PURE__ */ n("div", { className: "flight-times", children: [
182
- /* @__PURE__ */ n("div", { className: "flight-duration", children: [
183
- /* @__PURE__ */ i(W, {}),
184
- /* @__PURE__ */ i("p", { children: X(F.slices[0].duration) })
185
- ] }),
186
- /* @__PURE__ */ i("p", { children: e.numberOfStops > 0 ? `${e.numberOfStops} ${G(
187
- e.numberOfStops,
188
- "Stop"
189
- )}` : "Direct" })
190
- ] })
191
- ] }),
192
- /* @__PURE__ */ n("div", { className: "flight-info-content", children: [
193
- /* @__PURE__ */ n("div", { className: "flight-info-times", children: [
194
- /* @__PURE__ */ i("p", { className: "flight-info-date", children: f(e.departureTime).format(
195
- N(P.DISPLAY_MEDIUM)
196
- ) }),
197
- /* @__PURE__ */ n("p", { className: "flight-info-time", children: [
198
- f(e.departureTime).format(
199
- N(P.TIME_ONLY)
200
- ),
201
- " "
202
- ] }),
203
- /* @__PURE__ */ n("div", { className: "flight-location", children: [
204
- /* @__PURE__ */ i("div", { className: "flight-location-icon", children: /* @__PURE__ */ i(_e, {}) }),
205
- /* @__PURE__ */ i("p", { children: pe.airportCode })
206
- ] })
207
- ] }),
208
- /* @__PURE__ */ n("div", { className: "flight-icon", children: [
209
- /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(be, {}) }),
210
- /* @__PURE__ */ n("div", { className: "flight-times", children: [
211
- /* @__PURE__ */ n("div", { className: "flight-duration", children: [
212
- /* @__PURE__ */ i(W, {}),
213
- /* @__PURE__ */ i("p", { children: X(F.slices[0].duration) })
214
- ] }),
215
- /* @__PURE__ */ i("p", { children: e.numberOfStops > 0 ? `${e.numberOfStops} ${G(
216
- e.numberOfStops,
217
- "Stop"
218
- )}` : "Direct" })
219
- ] }),
220
- /* @__PURE__ */ i(
221
- ee,
222
- {
223
- title: "Flight Details",
224
- trigger: /* @__PURE__ */ i("p", { className: "view-flight-details", children: "Flight Details" }),
225
- children: /* @__PURE__ */ i(Z, { itinerary: F.slices[0].segments })
226
- }
227
- )
228
- ] }),
229
- /* @__PURE__ */ n("div", { className: "flight-info-times", children: [
230
- /* @__PURE__ */ i("p", { className: "flight-info-date", children: f(e.arrivalTime).format(
231
- N(P.DISPLAY_MEDIUM)
232
- ) }),
233
- /* @__PURE__ */ n("p", { className: "flight-info-time", children: [
234
- f(e.arrivalTime).format(
235
- N(P.TIME_ONLY)
236
- ),
237
- " "
238
- ] }),
239
- /* @__PURE__ */ n("div", { className: "flight-location", children: [
240
- /* @__PURE__ */ i("p", { children: he.airportCode }),
241
- /* @__PURE__ */ i("div", { className: "flight-location-icon", children: /* @__PURE__ */ i(Ie, {}) })
242
- ] })
243
- ] })
244
- ] })
245
- ] }),
246
- /* @__PURE__ */ n("div", { className: "flight-footer", children: [
247
- /* @__PURE__ */ i(
248
- ee,
249
- {
250
- title: "Flight Details",
251
- trigger: /* @__PURE__ */ i("p", { className: "view-flight-details", children: "View Flight Details" }),
252
- children: /* @__PURE__ */ i(Z, { itinerary: F.slices[0].segments })
253
- }
254
- ),
255
- /* @__PURE__ */ i("div", { className: "booking-options", children: le ? /* @__PURE__ */ n("div", { className: "offer-expiry", children: [
256
- /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(k, {}) }),
257
- /* @__PURE__ */ i("p", { className: "expired-tip", children: "Offer Expired" })
258
- ] }) : /* @__PURE__ */ n(R, { children: [
259
- ae || e.cash > 0 && /* @__PURE__ */ n(
260
- "div",
261
- {
262
- className: ke(
263
- "amount-value",
264
- v === "cash" && o ? "show-best-value-flag" : "",
265
- m.amountsDisplayFeature !== u.CASH_AND_TRAVEL_PARTNER_POINTS ? "lg" : ""
266
- ),
267
- onClick: (r) => {
268
- z(r, y.CASH, e);
269
- },
270
- children: [
271
- m.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS ? /* @__PURE__ */ i("b", { children: "Cash" }) : /* @__PURE__ */ i("b", { children: U ? "Book For" : "From" }),
272
- /* @__PURE__ */ n("div", { children: [
273
- m.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ i("label", { children: U ? "Book For" : "From" }),
274
- /* @__PURE__ */ n("span", { className: "flight-cash-amount-value", children: [
275
- /* @__PURE__ */ i(
276
- Q,
277
- {
278
- amount: e.cash,
279
- currency: e.currency,
280
- position: j.LEFT,
281
- showOriginal: !1
282
- }
283
- ),
284
- m.amountsDisplayFeature === u.CASH_AND_CLIENT_POINTS && /* @__PURE__ */ n(R, { children: [
285
- "/",
286
- " ",
287
- /* @__PURE__ */ i(
288
- Ee,
289
- {
290
- currency: e.currency,
291
- cashAmount: e.cash
292
- }
293
- )
294
- ] })
295
- ] })
296
- ] }),
297
- v === "cash" && m.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && o && /* @__PURE__ */ n(
298
- "div",
299
- {
300
- className: "best-value-flag tip",
301
- onClick: (r) => {
302
- r.stopPropagation(), c == null || c(e);
303
- },
304
- children: [
305
- c && /* @__PURE__ */ i(k, {}),
306
- /* @__PURE__ */ i("p", { children: "Best Value" }),
307
- c && /* @__PURE__ */ i("span", { children: "Click to learn more" })
308
- ]
309
- }
310
- )
311
- ]
312
- }
313
- ),
314
- te || e.points > 0 && a && m.amountsDisplayFeature === u.CASH_AND_TRAVEL_PARTNER_POINTS && /* @__PURE__ */ n(
315
- "div",
316
- {
317
- className: `amount-value ${v === "points" && o ? "show-best-value-flag" : ""}`,
318
- onClick: (r) => {
319
- z(r, y.POINTS, e);
320
- },
321
- children: [
322
- v === "points" && o && /* @__PURE__ */ n(
323
- "div",
324
- {
325
- className: "best-value-flag tip",
326
- onClick: (r) => {
327
- r.stopPropagation(), c == null || c(e);
328
- },
329
- children: [
330
- c && /* @__PURE__ */ i(k, {}),
331
- /* @__PURE__ */ i("p", { children: "Best Value" }),
332
- c && /* @__PURE__ */ i("span", { children: "Click to learn more" })
333
- ]
334
- }
335
- ),
336
- /* @__PURE__ */ i("div", { className: "amount-airline-logo", children: /* @__PURE__ */ i("img", { src: fe.programLogo }) }),
337
- /* @__PURE__ */ n("div", { children: [
338
- /* @__PURE__ */ i("label", { children: ge ? "Book For" : "From" }),
339
- /* @__PURE__ */ n("p", { children: [
340
- `${Oe(
341
- a == null ? void 0 : a.points
342
- )} ${N("miles")}`,
343
- !!(a != null && a.cashFee) && /* @__PURE__ */ n(R, { children: [
344
- " + ",
345
- /* @__PURE__ */ i(
346
- Q,
347
- {
348
- amount: a.cashFee.amount,
349
- currency: a.cashFee.currency,
350
- customDisplay: "No fee",
351
- zeroDisplayOption: Ae.CUSTOM,
352
- position: j.LEFT,
353
- showOriginal: !1
354
- }
355
- )
356
- ] })
357
- ] })
358
- ] })
359
- ]
360
- }
361
- )
362
- ] }) })
363
- ] }),
364
- /* @__PURE__ */ i("div", { className: `flight-details ${H ? "is-open" : ""}`, children: /* @__PURE__ */ i("div", { ref: D, className: "inner", children: /* @__PURE__ */ n("div", { className: "flight-booking-options", children: [
365
- C.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
366
- S.length > 0 && /* @__PURE__ */ i("p", { className: "booking-options-title", children: "Cash Options" }),
367
- /* @__PURE__ */ i(re, { children: C.map((r, s) => /* @__PURE__ */ i(
368
- J,
369
- {
370
- type: y.CASH,
371
- title: r.fareBrandName,
372
- cashValue: {
373
- amount: r.cash,
374
- currency: e.currency
375
- },
376
- milesValue: void 0,
377
- cashFee: r.cashFee,
378
- setSelected: () => {
379
- A == null || A(r, e);
380
- },
381
- conditions: r.conditions,
382
- slices: e.flightDetails.slices,
383
- baggages: r.baggages
384
- },
385
- `cash-${s}`
386
- )) })
387
- ] }),
388
- S.length > 0 && /* @__PURE__ */ n("div", { className: "booking-options-section", children: [
389
- C.length > 0 && /* @__PURE__ */ i("p", { className: "booking-options-title", children: "Miles Options" }),
390
- /* @__PURE__ */ i(re, { children: S.map((r, s) => /* @__PURE__ */ i(
391
- J,
392
- {
393
- type: y.POINTS,
394
- title: r.fareBrandName,
395
- cashValue: void 0,
396
- milesValue: r.points,
397
- cashFee: r.cashFee,
398
- setSelected: () => {
399
- T == null || T(r);
400
- },
401
- conditions: r.conditions,
402
- slices: e.flightDetails.slices,
403
- baggages: r.baggages,
404
- program: r.program
405
- },
406
- `points-${s}`
407
- )) })
408
- ] })
409
- ] }) }) })
410
- ] })
411
- }
412
- );
413
- };
414
- export {
415
- er as FlightResult
416
- };
@@ -1,4 +0,0 @@
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.CLIENT_DETAILS = "client-details", R))(S || {});
2
- export {
3
- S as E
4
- };