@odynn/awayz-core 0.2.31 → 0.2.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,5 +1,5 @@
|
|
|
1
|
-
import { useQuery as a, useMutation as
|
|
2
|
-
import { E as o, a as
|
|
1
|
+
import { useQuery as a, useMutation as p } from "@tanstack/react-query";
|
|
2
|
+
import { E as o, a as s } from "../../AccountService-8OR0UkZ6.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { WalletService as t } from "../../services/wallet/WalletService.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
@@ -24,12 +24,12 @@ const F = () => {
|
|
|
24
24
|
queryKey: [o.USER_CARDS],
|
|
25
25
|
queryFn: t.getUserCards,
|
|
26
26
|
placeholderData: []
|
|
27
|
-
}), { mutate: c } =
|
|
27
|
+
}), { mutate: c } = p({
|
|
28
28
|
mutationFn: async (e) => {
|
|
29
|
-
const { programId: n, awardsAmount: i } = e,
|
|
30
|
-
if (!
|
|
29
|
+
const { programId: n, awardsAmount: i } = e, m = r == null ? void 0 : r.find((d) => d.id === n);
|
|
30
|
+
if (!m)
|
|
31
31
|
throw new Error("Program not found");
|
|
32
|
-
await t.setAwardPoints(
|
|
32
|
+
await t.setAwardPoints(m.mainProgram, i);
|
|
33
33
|
},
|
|
34
34
|
onSuccess: () => {
|
|
35
35
|
f.invalidateQueries({
|
|
@@ -43,19 +43,19 @@ const F = () => {
|
|
|
43
43
|
return {
|
|
44
44
|
allPrograms: r || [],
|
|
45
45
|
hotelPrograms: (r == null ? void 0 : r.filter(
|
|
46
|
-
(e) => e.category ===
|
|
46
|
+
(e) => e.category === s.HOTEL
|
|
47
47
|
)) || [],
|
|
48
48
|
airlinePrograms: (r == null ? void 0 : r.filter(
|
|
49
|
-
(e) => e.category ===
|
|
49
|
+
(e) => e.category === s.AIRLINE
|
|
50
50
|
)) || [],
|
|
51
51
|
bankPrograms: (r == null ? void 0 : r.filter(
|
|
52
|
-
(e) => e.category ===
|
|
52
|
+
(e) => e.category === s.BANK
|
|
53
53
|
)) || [],
|
|
54
54
|
updatePoints: c,
|
|
55
55
|
getProgramById: g,
|
|
56
|
-
banks: u,
|
|
57
|
-
allCards: l,
|
|
58
|
-
userCards: y
|
|
56
|
+
banks: u || [],
|
|
57
|
+
allCards: l || [],
|
|
58
|
+
userCards: y || []
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
@@ -9,8 +9,8 @@ export declare const useWallet: () => {
|
|
|
9
9
|
bankPrograms: import('../../services').ILoyaltyProgram[];
|
|
10
10
|
updatePoints: import('@tanstack/react-query').UseMutateFunction<void, Error, ISetAwardPointsRequest, unknown>;
|
|
11
11
|
getProgramById: (programId: string) => import('../../services').ILoyaltyProgram | null;
|
|
12
|
-
banks: import('../../services').IBank[]
|
|
13
|
-
allCards: import('../../services').ICard[]
|
|
14
|
-
userCards: import('../../services').ICard[]
|
|
12
|
+
banks: import('../../services').IBank[];
|
|
13
|
+
allCards: import('../../services').ICard[];
|
|
14
|
+
userCards: import('../../services').ICard[];
|
|
15
15
|
};
|
|
16
16
|
export {};
|