@odynn/awayz-core 0.6.30 → 0.6.32

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.
@@ -1,9 +1,8 @@
1
- import { useQuery as L } from "@tanstack/react-query";
2
1
  import "../arrayExtensions-DlcBOj5a.js";
3
- import { E as I, t as R } from "../AccountService-CysoI2i-.js";
4
- import "react";
5
- import { FeatureService as S } from "../services/features/featureService.js";
6
- const U = [
2
+ import { t as F } from "../AccountService-CysoI2i-.js";
3
+ import { useState as e, useEffect as S } from "react";
4
+ import { FeatureService as U } from "../services/features/featureService.js";
5
+ const a = [
7
6
  "DEFAULT_CURRENCY_FEATURE",
8
7
  "TOTAL_DISPLAY_FEATURE",
9
8
  "HOTEL_DETAILS_LAYOUT_FEATURE",
@@ -17,7 +16,7 @@ const U = [
17
16
  "HOTEL_DETAILS_FEATURES",
18
17
  "SEARCH_RADIUS_POSITION_FEATURE",
19
18
  "NAVIGATION_FEATURE"
20
- ], e = [
19
+ ], r = [
21
20
  "CURRENCY_FILTER_FEATURE",
22
21
  "FREE_HOTEL_NIGHTS_FEATURE",
23
22
  "SHOW_BOOKABLE_FEATURE",
@@ -44,29 +43,36 @@ const U = [
44
43
  "HOTEL_FILTERS_FEATURES",
45
44
  "FLIGHT_FILTERS_FEATURES",
46
45
  "WALLET_FEATURES"
47
- ], s = () => {
48
- const { data: T, isSuccess: F } = L({
49
- queryKey: [I.FEATURES, "new"],
50
- queryFn: S.getFeatureFlags,
51
- staleTime: 1 / 0
52
- });
53
- return {
54
- featureFlags: (F && T ? (() => {
55
- const _ = {};
56
- return U.forEach((E) => {
57
- const A = R(E);
58
- T[E] !== void 0 && (_[A] = T[E]);
59
- }), e.forEach((E) => {
60
- const A = R(E);
61
- T[E] !== void 0 && (_[A] = T[E]);
46
+ ], n = () => {
47
+ const [A, L] = e({}), [R, t] = e(!1), I = async () => {
48
+ try {
49
+ const T = await U.getFeatureFlags();
50
+ L(T);
51
+ } catch (T) {
52
+ console.error("Error fetching feature flags:", T);
53
+ } finally {
54
+ t(!0);
55
+ }
56
+ };
57
+ return S(() => {
58
+ I();
59
+ }, []), {
60
+ featureFlags: (R && A ? (() => {
61
+ const T = {};
62
+ return a.forEach((E) => {
63
+ const _ = F(E);
64
+ A[E] !== void 0 && (T[_] = A[E]);
65
+ }), r.forEach((E) => {
66
+ const _ = F(E);
67
+ A[E] !== void 0 && (T[_] = A[E]);
62
68
  }), O.forEach((E) => {
63
- const A = R(E);
64
- T[E] !== void 0 && (_[A] = T[E]);
65
- }), _;
69
+ const _ = F(E);
70
+ A[E] !== void 0 && (T[_] = A[E]);
71
+ }), T;
66
72
  })() : void 0) ?? {},
67
- loaded: F
73
+ loaded: R
68
74
  };
69
75
  };
70
76
  export {
71
- s as default
77
+ n as default
72
78
  };
@@ -1,8 +1,7 @@
1
- interface IFeatures {
1
+ export interface IFeatures {
2
2
  [key: string]: string | number | boolean | string[] | undefined;
3
3
  }
4
4
  export declare class FeatureService {
5
5
  static getFeatures(): Promise<IFeatures>;
6
6
  static getFeatureFlags(): Promise<IFeatures>;
7
7
  }
8
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.6.30",
3
+ "version": "0.6.32",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"