@odynn/awayz-core 0.10.23 → 0.10.25

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,84 +1,88 @@
1
- import { useQuery as n, useMutation as s } from "@tanstack/react-query";
1
+ import { useQuery as s, useMutation as i } from "@tanstack/react-query";
2
2
  import "react/jsx-runtime";
3
3
  import "../../arrayExtensions-DlcBOj5a.js";
4
- import { E as a, d as u } from "../../noRetryInstance-DNLgOg0E.js";
4
+ import { E as a, d as l } from "../../noRetryInstance-DNLgOg0E.js";
5
5
  import "react";
6
6
  import "react-i18next";
7
7
  import '../../assets/_styles4.css';import '../../assets/_styles6.css';import '../../assets/_styles5.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles3.css';/* empty css */
8
8
  /* empty css */
9
9
  /* empty css */
10
- import { awayzClient as i } from "../../configs/awayzClient.js";
10
+ import { awayzClient as d } from "../../configs/awayzClient.js";
11
11
  /* empty css */
12
12
  /* empty css */
13
13
  import "../../index-Cv-wvFlM.js";
14
- import { useAwayzContext as c } from "../useAwayzContext.js";
14
+ import { useAwayzContext as h } from "../useAwayzContext.js";
15
15
  /* empty css */
16
16
  import "../../context/AwayzContext.js";
17
- import { WalletService as o } from "../../services/wallet/WalletService.js";
17
+ import { WalletService as n } from "../../services/wallet/WalletService.js";
18
18
  const U = {
19
19
  availablePoints: 0,
20
20
  valuePerPoint: 0,
21
21
  currency: ""
22
22
  }, z = () => {
23
- const { user: r } = c(), { data: t } = n({
23
+ const { user: r, featureFlags: c, featureFlagsLoaded: y, isAuthenticated: o } = h(), { data: t = [] } = s({
24
24
  queryKey: [a.PROGRAMS],
25
- queryFn: o.getAwards,
26
- placeholderData: []
27
- }), { data: l } = n({
25
+ queryFn: n.getAwards,
26
+ placeholderData: [],
27
+ enabled: o
28
+ }), { data: A = [] } = s({
28
29
  queryKey: [a.USER_PROGRAMS, r == null ? void 0 : r.id],
29
- queryFn: () => r != null && r.id ? o.getUserAwards(r.id) : [],
30
+ queryFn: () => r != null && r.id ? n.getUserAwards(r.id) : [],
30
31
  placeholderData: [],
31
- enabled: !!(r != null && r.id)
32
- }), { data: y } = n({
32
+ enabled: o
33
+ }), { data: S = [] } = s({
33
34
  queryKey: [a.LINKED_USER_PROGRAMS, r == null ? void 0 : r.id],
34
- queryFn: () => r != null && r.id ? o.getLinkedUserAwards(r.id) : [],
35
+ queryFn: () => r != null && r.id ? n.getLinkedUserAwards(r.id) : [],
35
36
  placeholderData: [],
36
- enabled: !!(r != null && r.id)
37
- }), { data: A } = n({
37
+ enabled: o
38
+ }), { data: g = [] } = s({
38
39
  queryKey: [a.BANKS],
39
- queryFn: o.getBanks,
40
- placeholderData: []
41
- }), { data: S } = n({
40
+ queryFn: n.getBanks,
41
+ placeholderData: [],
42
+ enabled: o
43
+ }), { data: P = [] } = s({
42
44
  queryKey: [a.CARDS],
43
- queryFn: o.getCards,
44
- placeholderData: []
45
- }), { data: g } = n({
45
+ queryFn: n.getCards,
46
+ placeholderData: [],
47
+ enabled: o
48
+ }), { data: R = [] } = s({
46
49
  queryKey: [a.USER_CARDS],
47
- queryFn: o.getUserCards,
48
- placeholderData: []
49
- }), { featureFlags: P, featureFlagsLoaded: R, isAuthenticated: p } = c(), {
50
- data: C = U,
51
- isFetching: E
52
- } = n({
50
+ queryFn: n.getUserCards,
51
+ placeholderData: [],
52
+ enabled: o
53
+ }), {
54
+ data: p = U,
55
+ isFetching: C
56
+ } = s({
53
57
  queryKey: [a.POINTS_AS_CASH],
54
- queryFn: o.getPointsAsCash,
55
- enabled: R && P.usePointsAsCashFeature && p,
58
+ queryFn: n.getPointsAsCash,
59
+ enabled: y && c.usePointsAsCashFeature && o,
56
60
  retry: !1
57
- }), { mutate: K } = s({
61
+ }), { mutate: E } = i({
58
62
  mutationFn: async (e) => {
59
- const { mainProgram: m, awardsAmount: d } = typeof e == "string" ? { mainProgram: e, awardsAmount: 0 } : e;
60
- await o.addAwardProgram(m, d);
63
+ const { mainProgram: m, awardsAmount: u } = typeof e == "string" ? { mainProgram: e, awardsAmount: 0 } : e;
64
+ await n.addAwardProgram(m, u);
61
65
  },
62
66
  onSuccess: () => {
63
- i.invalidateQueries({
67
+ d.invalidateQueries({
64
68
  queryKey: [a.LINKED_USER_PROGRAMS]
65
69
  });
66
70
  }
67
- }), { mutate: f } = s({
71
+ }), { mutate: K } = i({
68
72
  mutationFn: async (e) => {
69
- await o.removeAwardProgram(e);
73
+ await n.removeAwardProgram(e);
70
74
  },
71
75
  onSuccess: () => {
72
- i.invalidateQueries({
76
+ d.invalidateQueries({
73
77
  queryKey: [a.LINKED_USER_PROGRAMS]
74
78
  });
75
79
  }
76
- }), { mutateAsync: F } = s({
80
+ }), { mutateAsync: f } = i({
77
81
  mutationFn: async ({ mainProgram: e, awardsAmount: m }) => {
78
- const d = t == null ? void 0 : t.find((h) => h.mainProgram === e);
79
- if (!d)
82
+ const u = t == null ? void 0 : t.find((q) => q.mainProgram === e);
83
+ if (!u)
80
84
  throw new Error("Program not found");
81
- return o.setAwardPoints(d.mainProgram, m);
85
+ return n.setAwardPoints(u.mainProgram, m);
82
86
  },
83
87
  onSuccess: () => {
84
88
  [
@@ -86,20 +90,20 @@ const U = {
86
90
  a.USER_PROGRAMS,
87
91
  a.PROGRAMS
88
92
  ].forEach((e) => {
89
- i.invalidateQueries({ queryKey: [e] });
93
+ d.invalidateQueries({ queryKey: [e] });
90
94
  });
91
95
  }
92
- }), { mutateAsync: _ } = s({
93
- mutationFn: async (e) => o.addCardsToWallet(e),
96
+ }), { mutateAsync: F } = i({
97
+ mutationFn: async (e) => n.addCardsToWallet(e),
94
98
  onSuccess: () => {
95
- i.invalidateQueries({
99
+ d.invalidateQueries({
96
100
  queryKey: [a.USER_CARDS]
97
101
  });
98
102
  }
99
- }), { mutateAsync: q } = s({
100
- mutationFn: async (e) => o.removeCardsFromWallet(e),
103
+ }), { mutateAsync: _ } = i({
104
+ mutationFn: async (e) => n.removeCardsFromWallet(e),
101
105
  onSuccess: () => {
102
- i.invalidateQueries({
106
+ d.invalidateQueries({
103
107
  queryKey: [a.USER_CARDS]
104
108
  });
105
109
  }
@@ -107,28 +111,28 @@ const U = {
107
111
  return {
108
112
  // Program Management
109
113
  allPrograms: t || [],
110
- userPrograms: l || [],
111
- linkedUserPrograms: y || [],
114
+ userPrograms: A || [],
115
+ linkedUserPrograms: S || [],
112
116
  hotelPrograms: (t == null ? void 0 : t.filter(
113
- (e) => e.category.includes(u.HOTEL)
117
+ (e) => e.category.includes(l.HOTEL)
114
118
  )) || [],
115
119
  airlinePrograms: (t == null ? void 0 : t.filter(
116
- (e) => e.category.includes(u.AIRLINE)
120
+ (e) => e.category.includes(l.AIRLINE)
117
121
  )) || [],
118
122
  bankPrograms: (t == null ? void 0 : t.filter(
119
- (e) => e.category.includes(u.BANK)
123
+ (e) => e.category.includes(l.BANK)
120
124
  )) || [],
121
- updatePoints: F,
122
- addAwardProgram: K,
123
- removeAwardProgram: f,
125
+ updatePoints: f,
126
+ addAwardProgram: E,
127
+ removeAwardProgram: K,
124
128
  // Card Management
125
- banks: A || [],
126
- allCards: S || [],
127
- userCards: g || [],
128
- addCards: _,
129
- removeCards: q,
130
- pointsAsCash: C,
131
- pointsAsCashLoading: E
129
+ banks: g || [],
130
+ allCards: P || [],
131
+ userCards: R || [],
132
+ addCards: F,
133
+ removeCards: _,
134
+ pointsAsCash: p,
135
+ pointsAsCashLoading: C
132
136
  };
133
137
  };
134
138
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"