@odynn/awayz-core 0.10.4 → 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
|
|
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
|
|
58
|
-
const
|
|
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 =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})() : {},
|
|
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,
|
|
@@ -91,14 +88,14 @@ const i = () => {
|
|
|
91
88
|
_.length > 0 && console.error("Missing feature flags:", _);
|
|
92
89
|
}
|
|
93
90
|
return {
|
|
94
|
-
featureFlags: O,
|
|
91
|
+
featureFlags: O ?? {},
|
|
95
92
|
loaded: R
|
|
96
93
|
};
|
|
97
94
|
};
|
|
98
95
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
|
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:
|
|
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:
|
|
50
|
-
}), { mutate:
|
|
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:
|
|
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:
|
|
69
|
+
}), { mutateAsync: q } = s({
|
|
70
70
|
mutationFn: async ({ mainProgram: r, awardsAmount: u }) => {
|
|
71
|
-
const d = t == null ? void 0 : t.find((
|
|
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:
|
|
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:
|
|
115
|
-
addAwardProgram:
|
|
116
|
-
removeAwardProgram:
|
|
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:
|
|
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
|
-
|
|
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
|
}
|