@odynn/awayz-core 0.9.28 → 0.9.30
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/{cashUtils-sBirmFfL.js → cashUtils-DJFSvWw5.js} +9 -8
- package/dist/components/CashValue/CashValue.js +62 -62
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +23 -23
- package/dist/hooks/useFeatureFlags.js +4 -5
- package/dist/index-BlYZu1Ej.js +5 -0
- package/dist/lib/components/CashValue/CashValue.d.ts +0 -1
- package/dist/lib/hooks/useFeatureFlags.d.ts +1 -1
- package/dist/lib/services/account/AccountServices.types.d.ts +1 -1
- package/dist/services/currency/CurrencyService.js +18 -17
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { D as o } from "./index-BlYZu1Ej.js";
|
|
2
|
+
const c = (r, t) => {
|
|
2
3
|
var e = new Intl.NumberFormat("en-US", {
|
|
3
4
|
style: "currency",
|
|
4
5
|
currency: t ?? o
|
|
@@ -6,28 +7,28 @@ const o = "USD", a = (r, t) => {
|
|
|
6
7
|
if (!r) return e.format(0);
|
|
7
8
|
const n = parseFloat(r.toString());
|
|
8
9
|
return e.format(n);
|
|
9
|
-
},
|
|
10
|
+
}, i = (r, t) => {
|
|
10
11
|
var e = new Intl.NumberFormat("en-US", {
|
|
11
12
|
style: "currency",
|
|
12
13
|
currency: t ?? o
|
|
13
14
|
});
|
|
14
15
|
return e.format(Math.round(r)).toString().split(".")[0];
|
|
15
|
-
},
|
|
16
|
+
}, u = (r, t, e = 0) => {
|
|
16
17
|
const n = parseFloat((r == null ? void 0 : r.toString()) || "0");
|
|
17
18
|
return new Intl.NumberFormat("en-US", {
|
|
18
19
|
style: "currency",
|
|
19
20
|
currency: t ?? o,
|
|
20
21
|
maximumFractionDigits: e
|
|
21
22
|
}).format(isNaN(n) ? 0 : n);
|
|
22
|
-
},
|
|
23
|
+
}, y = (r, t = "en") => 0 .toLocaleString(t, {
|
|
23
24
|
style: "currency",
|
|
24
25
|
currency: r,
|
|
25
26
|
minimumFractionDigits: 0,
|
|
26
27
|
maximumFractionDigits: 0
|
|
27
28
|
}).replace(/\d/g, "").trim();
|
|
28
29
|
export {
|
|
29
|
-
a,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
c as a,
|
|
31
|
+
u as b,
|
|
32
|
+
y as c,
|
|
33
|
+
i as g
|
|
33
34
|
};
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as g } from "@tanstack/react-query";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { g as
|
|
5
|
-
import { E as
|
|
6
|
-
import { useMemo as
|
|
7
|
-
import { a as
|
|
4
|
+
import { g as E, a as C, b as u } from "../../cashUtils-DJFSvWw5.js";
|
|
5
|
+
import { E as R } from "../../noRetryInstance-DKhe8ju0.js";
|
|
6
|
+
import { useMemo as _ } from "react";
|
|
7
|
+
import { a as N } from "../../index-C8p5kinH.js";
|
|
8
8
|
import "react-i18next";
|
|
9
9
|
import '../../assets/_styles3.css';import '../../assets/_styles.css';import '../../assets/_styles2.css';/* empty css */
|
|
10
10
|
import "../../_styles.flight-booking-CaUgKcMC.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
import { EInvalidAmountDisplayOption as
|
|
13
|
-
import { useAwayzContext as
|
|
12
|
+
import { EInvalidAmountDisplayOption as o, EToolTipPosition as S } from "./CashValueTypes.js";
|
|
13
|
+
import { useAwayzContext as T } from "../../hooks/useAwayzContext.js";
|
|
14
14
|
import "../../configs/awayzClient.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
import "../../context/AwayzContext.js";
|
|
17
|
-
import { CurrencyService as
|
|
18
|
-
import { Tooltip as
|
|
19
|
-
const
|
|
20
|
-
amount:
|
|
21
|
-
currency:
|
|
22
|
-
position:
|
|
23
|
-
zeroDisplayOption:
|
|
24
|
-
customDisplay:
|
|
25
|
-
decimalPlaces: p =
|
|
26
|
-
showConversion:
|
|
17
|
+
import { CurrencyService as D } from "../../services/currency/CurrencyService.js";
|
|
18
|
+
import { Tooltip as I } from "../Tooltip/Tooltip.js";
|
|
19
|
+
const M = 1e3 * 60 * 60, z = ({
|
|
20
|
+
amount: i,
|
|
21
|
+
currency: r,
|
|
22
|
+
position: f = S.RIGHT,
|
|
23
|
+
zeroDisplayOption: A = o.NA,
|
|
24
|
+
customDisplay: v,
|
|
25
|
+
decimalPlaces: p = 2,
|
|
26
|
+
showConversion: y = !1
|
|
27
27
|
}) => {
|
|
28
|
-
var h
|
|
29
|
-
const { user:
|
|
30
|
-
queryKey: [
|
|
31
|
-
queryFn: () =>
|
|
32
|
-
baseCurrency:
|
|
33
|
-
targetCurrency:
|
|
28
|
+
var h;
|
|
29
|
+
const { user: t } = T(), n = ((h = t == null ? void 0 : t.preferences) == null ? void 0 : h.currency) ?? r, s = n !== r, { data: c, isPending: m } = g({
|
|
30
|
+
queryKey: [R.CONVERT_CURRENCY, r, n],
|
|
31
|
+
queryFn: () => D.convertCurrency({
|
|
32
|
+
baseCurrency: r,
|
|
33
|
+
targetCurrency: n
|
|
34
34
|
}),
|
|
35
|
-
enabled: s && !!
|
|
36
|
-
staleTime:
|
|
37
|
-
}), a =
|
|
38
|
-
if (!
|
|
35
|
+
enabled: s && !!r && !!i,
|
|
36
|
+
staleTime: M
|
|
37
|
+
}), a = _(() => {
|
|
38
|
+
if (!t)
|
|
39
39
|
return null;
|
|
40
|
-
let d = typeof
|
|
40
|
+
let d = typeof i == "string" ? parseFloat(i) : i;
|
|
41
41
|
if (s) {
|
|
42
42
|
if (m || !c) return null;
|
|
43
43
|
d = d * c;
|
|
44
44
|
}
|
|
45
45
|
return d;
|
|
46
|
-
}, [
|
|
46
|
+
}, [i, t, m, s, c]);
|
|
47
47
|
if (m && s)
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
if (!
|
|
50
|
-
switch (
|
|
51
|
-
case
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
case
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
case
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
case
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
case
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
case
|
|
62
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ e("span", { className: "currency-conversion loading", children: i });
|
|
49
|
+
if (!n || !a || a < 0)
|
|
50
|
+
switch (A) {
|
|
51
|
+
case o.NA:
|
|
52
|
+
return /* @__PURE__ */ e("span", { children: "N/A" });
|
|
53
|
+
case o.HIDDEN:
|
|
54
|
+
return /* @__PURE__ */ e("span", { className: "hidden", children: "N/A" });
|
|
55
|
+
case o.DISPLAY_AS_ZERO:
|
|
56
|
+
return /* @__PURE__ */ e("span", { children: "0" });
|
|
57
|
+
case o.DISPLAY_AS_ZERO_WITH_CURRENCY:
|
|
58
|
+
return /* @__PURE__ */ e("span", { children: C(0, n ?? r) });
|
|
59
|
+
case o.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL:
|
|
60
|
+
return /* @__PURE__ */ e("span", { children: E(0, n ?? r) });
|
|
61
|
+
case o.CUSTOM:
|
|
62
|
+
return /* @__PURE__ */ e("span", { children: a == 0 ? v : "N/A" });
|
|
63
63
|
default:
|
|
64
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ e("span", { children: "N/A" });
|
|
65
65
|
}
|
|
66
66
|
return /* @__PURE__ */ l("span", { className: "currency-conversion", children: [
|
|
67
67
|
u(
|
|
68
68
|
a,
|
|
69
|
-
|
|
69
|
+
n,
|
|
70
70
|
p
|
|
71
71
|
),
|
|
72
|
-
s &&
|
|
73
|
-
|
|
72
|
+
s && y && /* @__PURE__ */ e(
|
|
73
|
+
I,
|
|
74
74
|
{
|
|
75
|
-
trigger: /* @__PURE__ */
|
|
76
|
-
position:
|
|
75
|
+
trigger: /* @__PURE__ */ e("sup", { children: /* @__PURE__ */ e(N, {}) }),
|
|
76
|
+
position: f,
|
|
77
77
|
children: /* @__PURE__ */ l("div", { className: "currency-conversion-container", children: [
|
|
78
78
|
/* @__PURE__ */ l("p", { children: [
|
|
79
79
|
"Converted from ",
|
|
80
|
-
|
|
80
|
+
r,
|
|
81
81
|
" to ",
|
|
82
|
-
|
|
82
|
+
n
|
|
83
83
|
] }),
|
|
84
84
|
/* @__PURE__ */ l("div", { className: "currency-conversion-amounts", children: [
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { children: u(i, r, p) }) }),
|
|
86
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { children: u(
|
|
87
87
|
a,
|
|
88
|
-
|
|
88
|
+
n,
|
|
89
89
|
p
|
|
90
90
|
) }) }),
|
|
91
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ e("span", { className: "conversion-icon", children: /* @__PURE__ */ e(N, {}) })
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ e("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ l("p", { children: [
|
|
94
94
|
"Current Rate:",
|
|
95
95
|
" ",
|
|
96
96
|
c ? (
|
|
97
97
|
// only leaving 2 decimal places for the conversion rate is
|
|
98
98
|
// not enough, can lead to confusion
|
|
99
99
|
// use Number constructor to strip unnecessary trailing zeros
|
|
100
|
-
`${Number((1 / c).toFixed(5))} ${
|
|
100
|
+
`${Number((1 / c).toFixed(5))} ${r}`
|
|
101
101
|
) : "N/A",
|
|
102
102
|
" ",
|
|
103
103
|
"≈ ",
|
|
104
|
-
|
|
104
|
+
C(1, n)
|
|
105
105
|
] }) })
|
|
106
106
|
] })
|
|
107
107
|
}
|
|
@@ -109,6 +109,6 @@ const O = 1e3 * 60 * 60, G = ({
|
|
|
109
109
|
] });
|
|
110
110
|
};
|
|
111
111
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
z as CashValue,
|
|
113
|
+
M as CurrencyCallStaleTimeMs
|
|
114
114
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { c as M } from "../../cashUtils-
|
|
2
|
+
import { c as M } from "../../cashUtils-DJFSvWw5.js";
|
|
3
3
|
import { e as P, A as l, E as N } from "../../noRetryInstance-DKhe8ju0.js";
|
|
4
4
|
import { a as o } from "../../_styles.flight-booking-CaUgKcMC.js";
|
|
5
5
|
import { useState as f, useCallback as I, useEffect as h } from "react";
|
|
@@ -17,22 +17,22 @@ import "../../context/AwayzContext.js";
|
|
|
17
17
|
/* empty css */
|
|
18
18
|
import { EAuthFlow as T } from "../../types/EAuthFlow.js";
|
|
19
19
|
const x = (s, c) => {
|
|
20
|
-
var m,
|
|
21
|
-
let i = "",
|
|
22
|
-
typeof c == "string" ? i = c : c instanceof P ? (i = c.message,
|
|
20
|
+
var m, y;
|
|
21
|
+
let i = "", d = c;
|
|
22
|
+
typeof c == "string" ? i = c : c instanceof P ? (i = c.message, d = {
|
|
23
23
|
message: c.message,
|
|
24
24
|
cause: c.cause,
|
|
25
25
|
status: c.status,
|
|
26
26
|
data: (m = c == null ? void 0 : c.response) == null ? void 0 : m.data
|
|
27
|
-
}) : i = c.message, (
|
|
27
|
+
}) : i = c.message, (y = window.parent) == null || y.postMessage(
|
|
28
28
|
{
|
|
29
29
|
type: "auth_error",
|
|
30
|
-
details: { message: i, action: s, info:
|
|
30
|
+
details: { message: i, action: s, info: d }
|
|
31
31
|
},
|
|
32
32
|
"*"
|
|
33
33
|
);
|
|
34
34
|
}, le = (s) => {
|
|
35
|
-
const [c, i] = f(!0), [
|
|
35
|
+
const [c, i] = f(!0), [d, m] = f(!1), [y, A] = f(), [S, k] = f(), [C, _] = f([]), [p, F] = f([]), g = I(
|
|
36
36
|
async (t) => {
|
|
37
37
|
s != null && s.onSuccess && (s == null || s.onSuccess(t)), s != null && s.onSuccessAsync && await (s == null ? void 0 : s.onSuccessAsync(t)), i(!1), m(!0), A(t.token), k(t.user), O.invalidateQueries();
|
|
38
38
|
},
|
|
@@ -59,13 +59,13 @@ const x = (s, c) => {
|
|
|
59
59
|
u("no awayz token returned after exchanging id token");
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
localStorage.setItem(o.TOKEN, n.token), await
|
|
63
|
-
const { data:
|
|
62
|
+
localStorage.setItem(o.TOKEN, n.token), await g(n);
|
|
63
|
+
const { data: E, ...K } = await l.getRequestLimit();
|
|
64
64
|
if (!K.success) {
|
|
65
65
|
console.error({ reqLimitError: K });
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
E == null || E.forEach(
|
|
69
69
|
(H) => window.parent.postMessage(
|
|
70
70
|
{
|
|
71
71
|
type: "request_limit",
|
|
@@ -89,7 +89,7 @@ const x = (s, c) => {
|
|
|
89
89
|
u(e);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
await
|
|
92
|
+
await g({
|
|
93
93
|
user: e,
|
|
94
94
|
token: localStorage.getItem(o.TOKEN)
|
|
95
95
|
});
|
|
@@ -126,11 +126,11 @@ const x = (s, c) => {
|
|
|
126
126
|
if (e.data.type !== "auth") return;
|
|
127
127
|
const r = (w = e.data) == null ? void 0 : w.idToken, a = e.data.refreshToken, n = s.isTestMode ? e.data.overrideTokenExchangeEndpoint : void 0;
|
|
128
128
|
if (!r) {
|
|
129
|
-
const
|
|
129
|
+
const E = `received message ${JSON.stringify(
|
|
130
130
|
e.data
|
|
131
131
|
)}
|
|
132
132
|
no idToken in body`;
|
|
133
|
-
u(
|
|
133
|
+
u(E);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
localStorage.setItem(o.REFRESH_TOKEN, a), await R(r, a, n);
|
|
@@ -146,9 +146,9 @@ const x = (s, c) => {
|
|
|
146
146
|
};
|
|
147
147
|
}, []), {
|
|
148
148
|
isAuthenticating: c,
|
|
149
|
-
isAuthenticated:
|
|
150
|
-
token:
|
|
151
|
-
user:
|
|
149
|
+
isAuthenticated: d,
|
|
150
|
+
token: y,
|
|
151
|
+
user: S,
|
|
152
152
|
supportedRegions: C,
|
|
153
153
|
supportedCurrencies: p,
|
|
154
154
|
signIn: async (t) => {
|
|
@@ -158,7 +158,7 @@ const x = (s, c) => {
|
|
|
158
158
|
u(e.message);
|
|
159
159
|
else {
|
|
160
160
|
const a = (r = e.data) == null ? void 0 : r.refreshToken;
|
|
161
|
-
localStorage.setItem(o.REFRESH_TOKEN, a), await
|
|
161
|
+
localStorage.setItem(o.REFRESH_TOKEN, a), await g(e.data);
|
|
162
162
|
}
|
|
163
163
|
return e;
|
|
164
164
|
},
|
|
@@ -169,7 +169,7 @@ const x = (s, c) => {
|
|
|
169
169
|
u(e.message);
|
|
170
170
|
else {
|
|
171
171
|
const a = (r = e.data) == null ? void 0 : r.refreshToken;
|
|
172
|
-
localStorage.setItem(o.REFRESH_TOKEN, a), await
|
|
172
|
+
localStorage.setItem(o.REFRESH_TOKEN, a), await g(e.data);
|
|
173
173
|
}
|
|
174
174
|
return e;
|
|
175
175
|
},
|
|
@@ -186,7 +186,7 @@ const x = (s, c) => {
|
|
|
186
186
|
u(r.message);
|
|
187
187
|
else {
|
|
188
188
|
const n = (a = r.data) == null ? void 0 : a.refreshToken;
|
|
189
|
-
localStorage.setItem(o.REFRESH_TOKEN, n), await
|
|
189
|
+
localStorage.setItem(o.REFRESH_TOKEN, n), await g(r.data);
|
|
190
190
|
}
|
|
191
191
|
return r;
|
|
192
192
|
},
|
|
@@ -198,12 +198,12 @@ const x = (s, c) => {
|
|
|
198
198
|
const e = await q.setCurrency(t);
|
|
199
199
|
if (!e.success || !e.data)
|
|
200
200
|
return console.error("Failed to set preferred currency:", e), !1;
|
|
201
|
-
if (
|
|
201
|
+
if (S) {
|
|
202
202
|
const r = {
|
|
203
|
-
...
|
|
203
|
+
...S,
|
|
204
204
|
preferences: {
|
|
205
|
-
...
|
|
206
|
-
currency: e.data.currency
|
|
205
|
+
...S.preferences,
|
|
206
|
+
currency: e.data.currency
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
k(r), O.invalidateQueries({
|
|
@@ -19,8 +19,7 @@ const L = [
|
|
|
19
19
|
"NAVIGATION_FEATURE",
|
|
20
20
|
"BOOKING_PAYMENT_METHOD_FEATURE",
|
|
21
21
|
"AMOUNTS_DISPLAY_FEATURE",
|
|
22
|
-
"FLIGHT_BOOKING_OPTIONS_DISPLAY_FEATURE"
|
|
23
|
-
"HOTEL_EXAMPLE_FEATURE"
|
|
22
|
+
"FLIGHT_BOOKING_OPTIONS_DISPLAY_FEATURE"
|
|
24
23
|
], S = [
|
|
25
24
|
"CURRENCY_FILTER_FEATURE",
|
|
26
25
|
"FREE_HOTEL_NIGHTS_FEATURE",
|
|
@@ -53,7 +52,7 @@ const L = [
|
|
|
53
52
|
"FLIGHT_FILTERS_FEATURES",
|
|
54
53
|
"WALLET_FEATURES"
|
|
55
54
|
];
|
|
56
|
-
var N = /* @__PURE__ */ ((E) => (E.DEFAULT = "default", E.FULL_VCC_PARTIAL_ENABLED = "Full VCC - Partial Enabled", E.FULL_VCC_PARTIAL_DISABLED = "Full VCC - Partial Disabled", E))(N || {}),
|
|
55
|
+
var N = /* @__PURE__ */ ((E) => (E.DEFAULT = "default", E.FULL_VCC_PARTIAL_ENABLED = "Full VCC - Partial Enabled", E.FULL_VCC_PARTIAL_DISABLED = "Full VCC - Partial Disabled", E))(N || {}), t = /* @__PURE__ */ ((E) => (E.CASH_ONLY = "Cash Only", E.CASH_AND_TRAVEL_PARTNER_POINTS = "Cash And Travel Partner Points", E.CASH_AND_CLIENT_POINTS = "Cash And Client Points", E))(t || {}), H = /* @__PURE__ */ ((E) => (E.RESULT = "result", E.SHEET = "sheet", E))(H || {});
|
|
57
56
|
const l = () => {
|
|
58
57
|
const { data: E, isSuccess: R } = U({
|
|
59
58
|
queryKey: [e.FEATURES, "new"],
|
|
@@ -92,8 +91,8 @@ const l = () => {
|
|
|
92
91
|
};
|
|
93
92
|
};
|
|
94
93
|
export {
|
|
95
|
-
|
|
94
|
+
t as EAmountsDisplayFeature,
|
|
96
95
|
N as EBookingPaymentMethod,
|
|
97
|
-
|
|
96
|
+
H as EFlightBookingOptionsDisplayFeature,
|
|
98
97
|
l as useFeatureFlags
|
|
99
98
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : Lowercase<S>;
|
|
2
|
-
declare const StringFeatureFlag: readonly ["DEFAULT_CURRENCY_FEATURE", "TOTAL_DISPLAY_FEATURE", "HOTEL_DETAILS_LAYOUT_FEATURE", "TRIP_MANAGEMENT_FEATURE", "FLIGHT_FILTER_LAYOUT_FEATURE", "WALLET_MANAGEMENT_FEATURE", "WALLET_PROGRAM_TYPES_FEATURES", "FLIGHT_PAGINATION_FEATURE", "AVAILABILITY_ALERTS_DISPLAY_FEATURE", "PAYMENT_TYPE_FEATURE", "HOTEL_DETAILS_FEATURES", "SEARCH_RADIUS_POSITION_FEATURE", "NAVIGATION_FEATURE", "BOOKING_PAYMENT_METHOD_FEATURE", "AMOUNTS_DISPLAY_FEATURE", "FLIGHT_BOOKING_OPTIONS_DISPLAY_FEATURE"
|
|
2
|
+
declare const StringFeatureFlag: readonly ["DEFAULT_CURRENCY_FEATURE", "TOTAL_DISPLAY_FEATURE", "HOTEL_DETAILS_LAYOUT_FEATURE", "TRIP_MANAGEMENT_FEATURE", "FLIGHT_FILTER_LAYOUT_FEATURE", "WALLET_MANAGEMENT_FEATURE", "WALLET_PROGRAM_TYPES_FEATURES", "FLIGHT_PAGINATION_FEATURE", "AVAILABILITY_ALERTS_DISPLAY_FEATURE", "PAYMENT_TYPE_FEATURE", "HOTEL_DETAILS_FEATURES", "SEARCH_RADIUS_POSITION_FEATURE", "NAVIGATION_FEATURE", "BOOKING_PAYMENT_METHOD_FEATURE", "AMOUNTS_DISPLAY_FEATURE", "FLIGHT_BOOKING_OPTIONS_DISPLAY_FEATURE"];
|
|
3
3
|
declare const BooleanFeatureFlag: readonly ["CURRENCY_FILTER_FEATURE", "FREE_HOTEL_NIGHTS_FEATURE", "SHOW_BOOKABLE_FEATURE", "FILTER_PRESETS_FEATURE", "SPLIT_HOTEL_CHAINS_FEATURE", "FLIGHT_SHOW_ANIMATION_FEATURE", "SHOW_FOOTER_FEATURE", "SHOW_AVAILABILITY_ALERTS_FEATURE", "USE_POINTS_AS_CASH_FEATURE", "HAS_HEADER_FEATURE", "SHOW_FLIGHTS_TRANSFER_PARTNER_FEATURE", "HOTEL_POINTS_ONLY_FEATURE", "FREE_HOTEL_NIGHTS_FEATURE", "HOTEL_DISPLAY_BEST_VALUE_FEATURE", "HOTEL_DISPLAY_POINTS_BREAKDOWN_FEATURE", "TAB_NAVIGATION_FEATURE", "ADD_AIRLINE_HEALTH_PAGE_FEATURE", "SHOW_NAVIGATION_POPUP_FEATURE", "SHOW_ONLY_BOOKABLE_FEATURE", "CASH_BOOKING_FEATURE", "DISABLE_FREE_USER_CASH_BOOKING_FEATURE", "ENABLE_EASY_SUPPORT_BOT_FEATURE", "SHOW_ONLY_BOOKABLE_FEATURE", "HIDE_FLIGHT_SEARCH_CONTAINER_FEATURE", "HIDE_HOTEL_SEARCH_CONTAINER_FEATURE"];
|
|
4
4
|
declare const ListFeatureFlag: readonly ["WALLET_PROGRAM_TYPES_FEATURES", "HOTEL_FILTERS_FEATURES", "FLIGHT_FILTERS_FEATURES", "WALLET_FEATURES"];
|
|
5
5
|
export declare enum EBookingPaymentMethod {
|
|
@@ -2,7 +2,8 @@ import '../../assets/_styles3.css';import '../../assets/_styles5.css';import '..
|
|
|
2
2
|
var m = (t, r, e) => r in t ? y(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
3
|
var n = (t, r, e) => m(t, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import {
|
|
5
|
+
import { E } from "../../index-BlYZu1Ej.js";
|
|
6
|
+
import { A as C, E as _, c as s } from "../../noRetryInstance-DKhe8ju0.js";
|
|
6
7
|
import "react";
|
|
7
8
|
import { ECurrencyEndpoints as i } from "../../configs/endpoints.js";
|
|
8
9
|
import "react/jsx-runtime";
|
|
@@ -16,7 +17,7 @@ import "@tanstack/react-query";
|
|
|
16
17
|
import "../../index-Cv-wvFlM.js";
|
|
17
18
|
import "../../context/AwayzContext.js";
|
|
18
19
|
/* empty css */
|
|
19
|
-
import { awayzClient as
|
|
20
|
+
import { awayzClient as R } from "../../configs/awayzClient.js";
|
|
20
21
|
class d {
|
|
21
22
|
constructor() {
|
|
22
23
|
n(this, "convertCurrency", async ({
|
|
@@ -24,20 +25,20 @@ class d {
|
|
|
24
25
|
targetCurrency: e
|
|
25
26
|
}) => {
|
|
26
27
|
try {
|
|
27
|
-
const { success:
|
|
28
|
-
queryKey: [
|
|
28
|
+
const { success: o, data: c } = await R.ensureQueryData({
|
|
29
|
+
queryKey: [_.CHECK_USER],
|
|
29
30
|
queryFn: C.checkUser
|
|
30
31
|
});
|
|
31
|
-
if (!
|
|
32
|
+
if (!o)
|
|
32
33
|
throw new Error("Failed to fetch user data");
|
|
33
|
-
const { userRegion: u, preferences: p } =
|
|
34
|
+
const { userRegion: u, preferences: p } = c, { data: a } = await s.post(i.CURRENCY_CONVERSION, {
|
|
34
35
|
target_currency: e ?? p.currency ?? u.currency,
|
|
35
36
|
base_currency: r
|
|
36
37
|
});
|
|
37
|
-
if (
|
|
38
|
-
return a.data.conversion_rate;
|
|
39
|
-
} catch (
|
|
40
|
-
console.error(
|
|
38
|
+
if (o && a.data)
|
|
39
|
+
return a.data.conversion_rate * (1 + E);
|
|
40
|
+
} catch (o) {
|
|
41
|
+
console.error(o);
|
|
41
42
|
}
|
|
42
43
|
return 0;
|
|
43
44
|
});
|
|
@@ -52,18 +53,18 @@ class d {
|
|
|
52
53
|
n(this, "convertToCurrency", async ({
|
|
53
54
|
baseCurrency: r,
|
|
54
55
|
targetCurrency: e,
|
|
55
|
-
amount:
|
|
56
|
+
amount: o
|
|
56
57
|
}) => {
|
|
57
58
|
try {
|
|
58
|
-
const { data:
|
|
59
|
+
const { data: c } = await s.post(i.CURRENCY_CONVERSION, {
|
|
59
60
|
target_currency: e,
|
|
60
61
|
base_currency: r,
|
|
61
|
-
amount:
|
|
62
|
+
amount: o
|
|
62
63
|
});
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
65
|
-
} catch (
|
|
66
|
-
console.error(
|
|
64
|
+
if (c.success)
|
|
65
|
+
return c.data.conversion_result;
|
|
66
|
+
} catch (c) {
|
|
67
|
+
console.error(c);
|
|
67
68
|
}
|
|
68
69
|
return 0;
|
|
69
70
|
});
|