@odynn/awayz-core 0.9.0 → 0.9.1
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/hooks/useFeatureFlags.js +45 -43
- package/dist/providers/AwayzProvider.js +10 -10
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { useQuery as U } from "@tanstack/react-query";
|
|
1
2
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
4
|
-
import { FeatureService as
|
|
5
|
-
const
|
|
3
|
+
import { E as O, t as F } from "../noRetryInstance-oiHCni_Z.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { FeatureService as t } from "../services/features/featureService.js";
|
|
6
|
+
const L = [
|
|
6
7
|
"DEFAULT_CURRENCY_FEATURE",
|
|
7
8
|
"TOTAL_DISPLAY_FEATURE",
|
|
8
9
|
"HOTEL_DETAILS_LAYOUT_FEATURE",
|
|
@@ -17,7 +18,7 @@ const O = [
|
|
|
17
18
|
"SEARCH_RADIUS_POSITION_FEATURE",
|
|
18
19
|
"NAVIGATION_FEATURE",
|
|
19
20
|
"AMOUNTS_DISPLAY_FEATURE"
|
|
20
|
-
],
|
|
21
|
+
], e = [
|
|
21
22
|
"CURRENCY_FILTER_FEATURE",
|
|
22
23
|
"FREE_HOTEL_NIGHTS_FEATURE",
|
|
23
24
|
"SHOW_BOOKABLE_FEATURE",
|
|
@@ -38,51 +39,52 @@ const O = [
|
|
|
38
39
|
"ADD_AIRLINE_HEALTH_PAGE_FEATURE",
|
|
39
40
|
"SHOW_NAVIGATION_POPUP_FEATURE",
|
|
40
41
|
"SHOW_ONLY_BOOKABLE_FEATURE"
|
|
41
|
-
],
|
|
42
|
+
], S = [
|
|
42
43
|
"HOTEL_DETAILS_FEATURE",
|
|
43
44
|
"WALLET_PROGRAM_TYPES_FEATURES",
|
|
44
45
|
"HOTEL_FILTERS_FEATURES",
|
|
45
46
|
"FLIGHT_FILTERS_FEATURES",
|
|
46
47
|
"WALLET_FEATURES"
|
|
47
48
|
];
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
49
|
+
var r = /* @__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))(r || {});
|
|
50
|
+
const n = () => {
|
|
51
|
+
const { data: E, isSuccess: R } = U({
|
|
52
|
+
queryKey: [O.FEATURES, "new"],
|
|
53
|
+
queryFn: t.getFeatureFlags,
|
|
54
|
+
staleTime: 1 / 0
|
|
55
|
+
}), I = R && E ? (() => {
|
|
56
|
+
const _ = {};
|
|
57
|
+
return L.forEach((T) => {
|
|
58
|
+
const A = F(
|
|
59
|
+
T.toLowerCase()
|
|
60
|
+
);
|
|
61
|
+
E[T] !== void 0 && (_[A] = E[T]);
|
|
62
|
+
}), e.forEach((T) => {
|
|
63
|
+
const A = F(
|
|
64
|
+
T.toLowerCase()
|
|
65
|
+
);
|
|
66
|
+
E[T] !== void 0 && (_[A] = E[T]);
|
|
67
|
+
}), S.forEach((T) => {
|
|
68
|
+
const A = F(
|
|
69
|
+
T.toLowerCase()
|
|
70
|
+
);
|
|
71
|
+
E[T] !== void 0 && (_[A] = E[T]);
|
|
72
|
+
}), _;
|
|
73
|
+
})() : null;
|
|
74
|
+
if (R && E) {
|
|
75
|
+
const T = [
|
|
76
|
+
...L,
|
|
77
|
+
...e,
|
|
78
|
+
...S
|
|
79
|
+
].filter((A) => E[A] === void 0);
|
|
80
|
+
T.length > 0 && console.error("Missing feature flags:", T);
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
featureFlags: I ?? {},
|
|
84
|
+
loaded: R
|
|
83
85
|
};
|
|
84
86
|
};
|
|
85
87
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
r as EAmountsDisplayFeature,
|
|
89
|
+
n as useFeatureFlags
|
|
88
90
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { QueryClientProvider as m } from "@tanstack/react-query";
|
|
3
3
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
4
4
|
import { a as r } from "../_styles.flight-booking-DEUJthTJ.js";
|
|
@@ -7,30 +7,30 @@ import { setCustomBaseUrl as i, setBaseUrl as d } from "../configs/baseUrl.js";
|
|
|
7
7
|
import { defaultAwayzConfig as p } from "../configs/defaultAwayzConfig.js";
|
|
8
8
|
import { setGatewayBaseUrl as h } from "../configs/gatewayBaseUrl.js";
|
|
9
9
|
import { AwayzContext as w } from "../context/AwayzContext.js";
|
|
10
|
-
import { useAwayzAuth as
|
|
10
|
+
import { useAwayzAuth as n } from "../hooks/useAwayzAuth/useAwayzAuth.js";
|
|
11
11
|
import "react-i18next";
|
|
12
12
|
import '../assets/_styles3.css';import '../assets/_styles4.css';import '../assets/_styles.css';import '../assets/_styles2.css';/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
|
-
import { awayzClient as
|
|
14
|
+
import { awayzClient as y } from "../configs/awayzClient.js";
|
|
15
15
|
import "../noRetryInstance-oiHCni_Z.js";
|
|
16
16
|
/* empty css */
|
|
17
17
|
/* empty css */
|
|
18
|
-
import { useFeatureFlags as
|
|
19
|
-
const K = ({ children: o, config: e }) => {
|
|
20
|
-
const a =
|
|
18
|
+
import { useFeatureFlags as A } from "../hooks/useFeatureFlags.js";
|
|
19
|
+
const K = ({ children: t, config: e }) => /* @__PURE__ */ o(m, { client: y, children: /* @__PURE__ */ o(F, { config: e, children: t }) }), F = ({ children: t, config: e }) => {
|
|
20
|
+
const a = n({
|
|
21
21
|
authFlow: e.authFlow,
|
|
22
22
|
onSuccess: e.onAuthSuccess,
|
|
23
23
|
onError: e.onAuthFailure,
|
|
24
24
|
trustedOrigins: e.trustedOrigins,
|
|
25
25
|
isTestMode: e.testMode
|
|
26
|
-
}), { featureFlags: s, loaded: l } =
|
|
26
|
+
}), { featureFlags: s, loaded: l } = A();
|
|
27
27
|
return u(() => {
|
|
28
28
|
if (!e.clientId) {
|
|
29
29
|
console.error("You need to provide a client ID to the AwayzProvider");
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
localStorage.setItem(r.CLIENT_ID, e.clientId), localStorage.setItem(r.AUTH_FLOW, e.authFlow), e.debugRefreshToken && e.testMode && (localStorage.setItem(r.REFRESH_TOKEN, e.debugRefreshToken), localStorage.setItem(r.TOKEN, e.debugRefreshToken)), e.overrideBaseUrl ? i(e.overrideBaseUrl) : d(e.testMode ?? !1), h(e.gatewayBaseUrl);
|
|
33
|
-
}, [e]), /* @__PURE__ */
|
|
33
|
+
}, [e]), /* @__PURE__ */ o(
|
|
34
34
|
w.Provider,
|
|
35
35
|
{
|
|
36
36
|
value: {
|
|
@@ -42,9 +42,9 @@ const K = ({ children: o, config: e }) => {
|
|
|
42
42
|
featureFlags: s,
|
|
43
43
|
featureFlagsLoaded: l
|
|
44
44
|
},
|
|
45
|
-
children:
|
|
45
|
+
children: t
|
|
46
46
|
}
|
|
47
|
-
)
|
|
47
|
+
);
|
|
48
48
|
};
|
|
49
49
|
export {
|
|
50
50
|
K as AwayzProvider
|