@odynn/awayz-core 0.10.3 → 0.10.5

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,7 +1,7 @@
1
1
  import { useQuery as U } from "@tanstack/react-query";
2
2
  import "../arrayExtensions-DlcBOj5a.js";
3
3
  import { E as r, t as F } from "../noRetryInstance-C4bqpBc7.js";
4
- import { useMemo as e } from "react";
4
+ import "react";
5
5
  import { FeatureService as N } from "../services/features/featureService.js";
6
6
  const L = [
7
7
  "DEFAULT_CURRENCY_FEATURE",
@@ -54,34 +54,31 @@ const L = [
54
54
  "FLIGHT_FILTERS_FEATURES",
55
55
  "WALLET_FEATURES"
56
56
  ];
57
- var H = /* @__PURE__ */ ((E) => (E.DEFAULT = "default", E.FULL_VCC_PARTIAL_ENABLED = "Full VCC - Partial Enabled", E.FULL_VCC_PARTIAL_DISABLED = "Full VCC - Partial Disabled", E))(H || {}), t = /* @__PURE__ */ ((E) => (E.LIGHT = "light", E.DARK = "dark", E.USER = "user", E))(t || {}), s = /* @__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))(s || {}), a = /* @__PURE__ */ ((E) => (E.RESULT = "result", E.SHEET = "sheet", E))(a || {});
58
- const i = () => {
57
+ var e = /* @__PURE__ */ ((E) => (E.DEFAULT = "default", E.FULL_VCC_PARTIAL_ENABLED = "Full VCC - Partial Enabled", E.FULL_VCC_PARTIAL_DISABLED = "Full VCC - Partial Disabled", E))(e || {}), H = /* @__PURE__ */ ((E) => (E.LIGHT = "light", E.DARK = "dark", E.USER = "user", E))(H || {}), 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 || {}), s = /* @__PURE__ */ ((E) => (E.RESULT = "result", E.SHEET = "sheet", E))(s || {});
58
+ const l = () => {
59
59
  const { data: E, isSuccess: R } = U({
60
60
  queryKey: [r.FEATURES, "new"],
61
61
  queryFn: N.getFeatureFlags,
62
62
  staleTime: 1 / 0
63
- }), O = e(
64
- () => R && E ? (() => {
65
- const T = {};
66
- return L.forEach((_) => {
67
- const A = F(
68
- _.toLowerCase()
69
- );
70
- E[_] !== void 0 && (T[A] = E[_]);
71
- }), S.forEach((_) => {
72
- const A = F(
73
- _.toLowerCase()
74
- );
75
- E[_] !== void 0 && (T[A] = E[_]);
76
- }), I.forEach((_) => {
77
- const A = F(
78
- _.toLowerCase()
79
- );
80
- E[_] !== void 0 && (T[A] = E[_]);
81
- }), T;
82
- })() : null,
83
- [R, E]
84
- );
63
+ }), O = R && E ? (() => {
64
+ const T = {};
65
+ return L.forEach((_) => {
66
+ const A = F(
67
+ _.toLowerCase()
68
+ );
69
+ E[_] !== void 0 && (T[A] = E[_]);
70
+ }), S.forEach((_) => {
71
+ const A = F(
72
+ _.toLowerCase()
73
+ );
74
+ E[_] !== void 0 && (T[A] = E[_]);
75
+ }), I.forEach((_) => {
76
+ const A = F(
77
+ _.toLowerCase()
78
+ );
79
+ E[_] !== void 0 && (T[A] = E[_]);
80
+ }), T;
81
+ })() : null;
85
82
  if (R && E) {
86
83
  const _ = [
87
84
  ...L,
@@ -96,9 +93,9 @@ const i = () => {
96
93
  };
97
94
  };
98
95
  export {
99
- s as EAmountsDisplayFeature,
100
- H as EBookingPaymentMethod,
101
- a as EFlightBookingOptionsDisplayFeature,
102
- t as EThemeFeatureFlag,
103
- i as useFeatureFlags
96
+ t as EAmountsDisplayFeature,
97
+ e as EBookingPaymentMethod,
98
+ s as EFlightBookingOptionsDisplayFeature,
99
+ H as EThemeFeatureFlag,
100
+ l as useFeatureFlags
104
101
  };
@@ -15,7 +15,7 @@ import { useAwayzContext as c } from "../useAwayzContext.js";
15
15
  /* empty css */
16
16
  import "../../context/AwayzContext.js";
17
17
  import { WalletService as o } from "../../services/wallet/WalletService.js";
18
- const x = () => {
18
+ const z = () => {
19
19
  const { user: e } = c(), { data: t } = n({
20
20
  queryKey: [a.PROGRAMS],
21
21
  queryFn: o.getAwards,
@@ -42,12 +42,12 @@ const x = () => {
42
42
  queryKey: [a.USER_CARDS],
43
43
  queryFn: o.getUserCards,
44
44
  placeholderData: []
45
- }), { featureFlags: R, featureFlagsLoaded: S, isAuthenticated: p } = c(), { data: C } = n({
45
+ }), { featureFlags: p, featureFlagsLoaded: R, isAuthenticated: S } = c(), { data: C, isLoading: E } = n({
46
46
  queryKey: [a.POINTS_AS_CASH],
47
47
  queryFn: o.getPointsAsCash,
48
48
  placeholderData: { availablePoints: 0, valuePerPoint: 0, currency: "" },
49
- enabled: S && R.usePointsAsCashFeature && p
50
- }), { mutate: E } = s({
49
+ enabled: R && p.usePointsAsCashFeature && S
50
+ }), { mutate: K } = s({
51
51
  mutationFn: async (r) => {
52
52
  const { mainProgram: u, awardsAmount: d } = typeof r == "string" ? { mainProgram: r, awardsAmount: 0 } : r;
53
53
  await o.addAwardProgram(u, d);
@@ -57,7 +57,7 @@ const x = () => {
57
57
  queryKey: [a.LINKED_USER_PROGRAMS]
58
58
  });
59
59
  }
60
- }), { mutate: K } = s({
60
+ }), { mutate: f } = s({
61
61
  mutationFn: async (r) => {
62
62
  await o.removeAwardProgram(r);
63
63
  },
@@ -66,9 +66,9 @@ const x = () => {
66
66
  queryKey: [a.LINKED_USER_PROGRAMS]
67
67
  });
68
68
  }
69
- }), { mutateAsync: f } = s({
69
+ }), { mutateAsync: q } = s({
70
70
  mutationFn: async ({ mainProgram: r, awardsAmount: u }) => {
71
- const d = t == null ? void 0 : t.find((h) => h.mainProgram === r);
71
+ const d = t == null ? void 0 : t.find((_) => _.mainProgram === r);
72
72
  if (!d)
73
73
  throw new Error("Program not found");
74
74
  return o.setAwardPoints(d.mainProgram, u);
@@ -82,7 +82,7 @@ const x = () => {
82
82
  i.invalidateQueries({ queryKey: [r] });
83
83
  });
84
84
  }
85
- }), { mutateAsync: q } = s({
85
+ }), { mutateAsync: h } = s({
86
86
  mutationFn: async (r) => o.addCardsToWallet(r),
87
87
  onSuccess: () => {
88
88
  i.invalidateQueries({
@@ -111,22 +111,23 @@ const x = () => {
111
111
  bankPrograms: (t == null ? void 0 : t.filter(
112
112
  (r) => r.category.includes(m.BANK)
113
113
  )) || [],
114
- updatePoints: f,
115
- addAwardProgram: E,
116
- removeAwardProgram: K,
114
+ updatePoints: q,
115
+ addAwardProgram: K,
116
+ removeAwardProgram: f,
117
117
  // Card Management
118
118
  banks: A || [],
119
119
  allCards: P || [],
120
120
  userCards: g || [],
121
- addCards: q,
121
+ addCards: h,
122
122
  removeCards: F,
123
123
  pointsAsCash: C || {
124
124
  availablePoints: 0,
125
125
  valuePerPoint: 0,
126
126
  currency: ""
127
- }
127
+ },
128
+ pointsAsCashLoading: E
128
129
  };
129
130
  };
130
131
  export {
131
- x as useWallet
132
+ z as useWallet
132
133
  };
@@ -70,4 +70,8 @@ export interface IWalletHook {
70
70
  * Points as cash value object containing available points and dollar per point value.
71
71
  */
72
72
  pointsAsCash: IPointsAsCashValue;
73
+ /**
74
+ * Whether the points as cash query is currently loading.
75
+ */
76
+ pointsAsCashLoading: boolean;
73
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"