@odynn/awayz-core 0.3.21 → 0.3.23
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.
- package/dist/{AccountService-D_6U8vP6.js → AccountService-cvx__9rR.js} +55 -55
- package/dist/{TripsService-BbbkMtx6.js → TripsService-G1T_Co8r.js} +1 -1
- package/dist/components/CashValue/CashValue.js +198 -194
- package/dist/components/CashValue/CashValue.stories.js +30 -14
- package/dist/components/CashValue/CashValueTypes.js +3 -3
- package/dist/components/Wallet/Card/Card.stories.js +2 -2
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.js +1 -1
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +1 -1
- package/dist/hooks/useSearchLimit.js +17 -15
- package/dist/hooks/useTripManagement/useTripManagement.js +2 -2
- package/dist/hooks/useTripManagement/useTripManagement.test.js +2 -2
- package/dist/hooks/useWallet/useWallet.js +72 -42
- package/dist/hooks/useWallet/useWallet.test.js +80 -46
- package/dist/lib/components/CashValue/CashValue.stories.d.ts +2 -0
- package/dist/lib/components/CashValue/CashValueTypes.d.ts +2 -0
- package/dist/lib/hooks/useSearchLimit.d.ts +3 -1
- package/dist/lib/hooks/useWallet/useWallet.types.d.ts +16 -2
- package/dist/lib/services/bookings/BookingService.d.ts +1 -1
- package/dist/lib/services/wallet/WalletService.d.ts +3 -0
- package/dist/main.js +1 -1
- package/dist/providers/AwayzProvider.js +1 -1
- package/dist/services/account/AccountService.js +1 -1
- package/dist/services/bookings/BookingService.js +1 -1
- package/dist/services/currency/CurrencyService.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/instance.js +1 -1
- package/dist/services/instanceConfig.js +1 -1
- package/dist/services/noRetryInstance.js +1 -1
- package/dist/services/trips/TripsService.js +2 -2
- package/dist/services/wallet/WalletService.js +55 -26
- package/package.json +1 -1
|
@@ -3,10 +3,10 @@ import { CashValue as n } from "./CashValue.js";
|
|
|
3
3
|
import { AwayzProvider as a } from "../../providers/AwayzProvider.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../context/AwayzContext.js";
|
|
6
|
+
import "@tanstack/react-query";
|
|
6
7
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
7
|
-
import "../../AccountService-
|
|
8
|
+
import "../../AccountService-cvx__9rR.js";
|
|
8
9
|
import "../../configs/awayzClient.js";
|
|
9
|
-
import "@tanstack/react-query";
|
|
10
10
|
import { EAuthFlow as i } from "../../types/EAuthFlow.js";
|
|
11
11
|
import "../../services/noRetryInstance.js";
|
|
12
12
|
import { EToolTipPosition as t, EInvalidAmountDisplayOption as o } from "./CashValueTypes.js";
|
|
@@ -14,7 +14,7 @@ import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '..
|
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
16
|
/* empty css */
|
|
17
|
-
const
|
|
17
|
+
const f = {
|
|
18
18
|
title: "Core/Cash Value",
|
|
19
19
|
component: n,
|
|
20
20
|
parameters: {
|
|
@@ -56,32 +56,46 @@ const h = {
|
|
|
56
56
|
}
|
|
57
57
|
)
|
|
58
58
|
]
|
|
59
|
-
},
|
|
59
|
+
}, h = {
|
|
60
60
|
name: "Euro to Dollar Cash Value",
|
|
61
61
|
args: {
|
|
62
62
|
amount: 100,
|
|
63
63
|
currency: "EUR"
|
|
64
64
|
}
|
|
65
|
-
},
|
|
65
|
+
}, _ = {
|
|
66
66
|
name: "Invalid Amount",
|
|
67
67
|
args: {
|
|
68
68
|
amount: "invalid",
|
|
69
69
|
currency: "EUR"
|
|
70
70
|
}
|
|
71
|
-
},
|
|
71
|
+
}, v = {
|
|
72
72
|
name: "Zero Amount with Display as Zero",
|
|
73
73
|
args: {
|
|
74
74
|
amount: 0,
|
|
75
75
|
zeroDisplayOption: o.DISPLAY_AS_ZERO,
|
|
76
76
|
currency: "EUR"
|
|
77
77
|
}
|
|
78
|
-
},
|
|
78
|
+
}, I = {
|
|
79
|
+
name: "Zero Amount with Display as Zero With Currency",
|
|
80
|
+
args: {
|
|
81
|
+
amount: 0,
|
|
82
|
+
zeroDisplayOption: o.DISPLAY_AS_ZERO_WITH_CURRENCY,
|
|
83
|
+
currency: "EUR"
|
|
84
|
+
}
|
|
85
|
+
}, U = {
|
|
86
|
+
name: "Zero Amount with Display as Zero With Currency No Decimal",
|
|
87
|
+
args: {
|
|
88
|
+
amount: 0,
|
|
89
|
+
zeroDisplayOption: o.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL,
|
|
90
|
+
currency: "EUR"
|
|
91
|
+
}
|
|
92
|
+
}, b = {
|
|
79
93
|
name: "Negative Amount",
|
|
80
94
|
args: {
|
|
81
95
|
amount: -100,
|
|
82
96
|
currency: "EUR"
|
|
83
97
|
}
|
|
84
|
-
},
|
|
98
|
+
}, N = {
|
|
85
99
|
name: "Custom Zero Amount",
|
|
86
100
|
args: {
|
|
87
101
|
amount: 0,
|
|
@@ -91,10 +105,12 @@ const h = {
|
|
|
91
105
|
}
|
|
92
106
|
};
|
|
93
107
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
N as CustomZeroAmount,
|
|
109
|
+
h as Default,
|
|
110
|
+
_ as InvalidAmount,
|
|
111
|
+
b as NegativeAmount,
|
|
112
|
+
v as ZeroAmount,
|
|
113
|
+
I as ZeroCurrencyAmount,
|
|
114
|
+
U as ZeroCurrencyNoDecimalAmount,
|
|
115
|
+
f as default
|
|
100
116
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _ = /* @__PURE__ */ ((r) => (r.TOP = "top", r.BOTTOM = "bottom", r.RIGHT = "right", r.LEFT = "left", r))(_ || {}), e = /* @__PURE__ */ ((r) => (r.NA = "N/A", r.HIDDEN = "Hidden", r.DISPLAY_AS_ZERO = "Display as Zero", r.DISPLAY_AS_ZERO_WITH_CURRENCY = "Display as Zero with Currency", r.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL = "Display as Zero with Currency (No Decimal)", r.CUSTOM = "Custom", r))(e || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
e as EInvalidAmountDisplayOption,
|
|
4
|
+
_ as EToolTipPosition
|
|
5
5
|
};
|
|
@@ -3,10 +3,10 @@ import { Card as r } from "./Card.js";
|
|
|
3
3
|
import { AwayzProvider as a } from "../../../providers/AwayzProvider.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../../context/AwayzContext.js";
|
|
6
|
+
import "@tanstack/react-query";
|
|
6
7
|
import "../../../arrayExtensions-DlcBOj5a.js";
|
|
7
|
-
import "../../../AccountService-
|
|
8
|
+
import "../../../AccountService-cvx__9rR.js";
|
|
8
9
|
import "../../../configs/awayzClient.js";
|
|
9
|
-
import "@tanstack/react-query";
|
|
10
10
|
import { EAuthFlow as e } from "../../../types/EAuthFlow.js";
|
|
11
11
|
import "../../../services/noRetryInstance.js";
|
|
12
12
|
import '../../../assets/_styles5.css';import '../../../assets/_styles4.css';import '../../../assets/_styles3.css';import '../../../assets/_styles.css';/* empty css */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { f as U, d as r, A as o, E as v } from "../../AccountService-
|
|
2
|
+
import { f as U, d as r, A as o, E as v } from "../../AccountService-cvx__9rR.js";
|
|
3
3
|
import { useState as E, useCallback as R, useEffect as y } from "react";
|
|
4
4
|
import { EAuthFlow as S } from "../../types/EAuthFlow.js";
|
|
5
5
|
import { awayzClient as A } from "../../configs/awayzClient.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQuery as a, useMutation as s } from "@tanstack/react-query";
|
|
2
2
|
import { EBookingType as e } from "../../services/trips/TripService.types.js";
|
|
3
3
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import { E as t } from "../../AccountService-
|
|
4
|
+
import { E as t } from "../../AccountService-cvx__9rR.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { BookingService as o } from "../../services/bookings/BookingService.js";
|
|
7
7
|
import "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { renderHook as t, waitFor as r } from "../../tests/TestWrapper.js";
|
|
2
2
|
import { useBookingManagement as a } from "./useBookingManagement.js";
|
|
3
|
-
import { c as i } from "../../AccountService-
|
|
3
|
+
import { c as i } from "../../AccountService-cvx__9rR.js";
|
|
4
4
|
import "../../services/noRetryInstance.js";
|
|
5
5
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
6
6
|
import "react";
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { E as s, A as i, b as n } from "../AccountService-D_6U8vP6.js";
|
|
2
1
|
import { useQuery as u } from "@tanstack/react-query";
|
|
3
2
|
import "../arrayExtensions-DlcBOj5a.js";
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { E as m, A as c, b as f } from "../AccountService-cvx__9rR.js";
|
|
4
|
+
import { useEffect as d } from "react";
|
|
5
|
+
import { useAwayzContext as y } from "./useAwayzContext.js";
|
|
6
|
+
var i = /* @__PURE__ */ ((r) => (r.HOTEL = "Hotel", r.FLIGHT = "Flight", r))(i || {});
|
|
7
|
+
const H = (r) => {
|
|
8
|
+
const { isAuthenticated: o } = y(), { data: t } = u({
|
|
9
|
+
queryKey: [m.SEARCH_LIMIT],
|
|
10
10
|
queryFn: async () => {
|
|
11
|
-
const { data:
|
|
12
|
-
if (!
|
|
13
|
-
console.error({ reqLimitError:
|
|
11
|
+
const { data: s, ...e } = await c.getRequestLimit();
|
|
12
|
+
if (!e.success) {
|
|
13
|
+
console.error({ reqLimitError: e });
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return f(s);
|
|
17
17
|
},
|
|
18
|
-
enabled:
|
|
18
|
+
enabled: o
|
|
19
19
|
});
|
|
20
|
-
return
|
|
21
|
-
|
|
20
|
+
return d(() => {
|
|
21
|
+
t && (r == null || r());
|
|
22
|
+
}, [t, r]), t ? [i.FLIGHT, i.HOTEL].map(
|
|
23
|
+
(s) => t.find((e) => e.searchType === s)
|
|
22
24
|
) : [void 0, void 0];
|
|
23
25
|
};
|
|
24
26
|
export {
|
|
25
|
-
|
|
27
|
+
H as useSearchLimit
|
|
26
28
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useQuery as p, useMutation as s } from "@tanstack/react-query";
|
|
2
2
|
import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as e } from "../../AccountService-
|
|
3
|
+
import { E as e } from "../../AccountService-cvx__9rR.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { T as t } from "../../TripsService-
|
|
5
|
+
import { T as t } from "../../TripsService-G1T_Co8r.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import "../../context/AwayzContext.js";
|
|
8
8
|
import { awayzClient as o } from "../../configs/awayzClient.js";
|
|
@@ -4,8 +4,8 @@ import { useTripManagement as n } from "./useTripManagement.js";
|
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react";
|
|
6
6
|
import "../../context/AwayzContext.js";
|
|
7
|
-
import { D as f } from "../../TripsService-
|
|
8
|
-
import { c } from "../../AccountService-
|
|
7
|
+
import { D as f } from "../../TripsService-G1T_Co8r.js";
|
|
8
|
+
import { c } from "../../AccountService-cvx__9rR.js";
|
|
9
9
|
import { EMyTripsEndpoints as d } from "../../configs/endpoints.js";
|
|
10
10
|
import "../../configs/awayzClient.js";
|
|
11
11
|
import "@tanstack/react-query";
|
|
@@ -1,86 +1,116 @@
|
|
|
1
|
-
import { useQuery as
|
|
1
|
+
import { useQuery as n, useMutation as i } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
-
import { E as t, a as
|
|
3
|
+
import { E as t, a as d } from "../../AccountService-cvx__9rR.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { WalletService as a } from "../../services/wallet/WalletService.js";
|
|
6
5
|
import "react/jsx-runtime";
|
|
7
6
|
import "../../context/AwayzContext.js";
|
|
8
|
-
import { awayzClient as
|
|
7
|
+
import { awayzClient as s } from "../../configs/awayzClient.js";
|
|
8
|
+
import { useAwayzContext as f } from "../useAwayzContext.js";
|
|
9
9
|
import "../../services/noRetryInstance.js";
|
|
10
10
|
import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';/* empty css */
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import { WalletService as o } from "../../services/wallet/WalletService.js";
|
|
16
|
+
const B = () => {
|
|
17
|
+
const { user: e } = f(), { data: a } = n({
|
|
17
18
|
queryKey: [t.PROGRAMS],
|
|
18
|
-
queryFn:
|
|
19
|
+
queryFn: o.getAwards,
|
|
19
20
|
placeholderData: []
|
|
20
|
-
}), { data:
|
|
21
|
+
}), { data: y } = n({
|
|
22
|
+
queryKey: [t.USER_PROGRAMS, e == null ? void 0 : e.id],
|
|
23
|
+
queryFn: () => e != null && e.id ? o.getUserAwards(e.id) : [],
|
|
24
|
+
placeholderData: [],
|
|
25
|
+
enabled: !!(e != null && e.id)
|
|
26
|
+
}), { data: l } = n({
|
|
21
27
|
queryKey: [t.BANKS],
|
|
22
|
-
queryFn:
|
|
28
|
+
queryFn: o.getBanks,
|
|
23
29
|
placeholderData: []
|
|
24
|
-
}), { data:
|
|
30
|
+
}), { data: g } = n({
|
|
25
31
|
queryKey: [t.CARDS],
|
|
26
|
-
queryFn:
|
|
32
|
+
queryFn: o.getCards,
|
|
27
33
|
placeholderData: []
|
|
28
|
-
}), { data:
|
|
34
|
+
}), { data: p } = n({
|
|
29
35
|
queryKey: [t.USER_CARDS],
|
|
30
|
-
queryFn:
|
|
36
|
+
queryFn: o.getUserCards,
|
|
31
37
|
placeholderData: []
|
|
32
|
-
}), { mutate:
|
|
33
|
-
mutationFn: async (
|
|
34
|
-
const { mainProgram:
|
|
35
|
-
|
|
38
|
+
}), { mutate: A } = i({
|
|
39
|
+
mutationFn: async (r) => {
|
|
40
|
+
const { mainProgram: m, awardsAmount: u } = typeof r == "string" ? { mainProgram: r, awardsAmount: 0 } : r;
|
|
41
|
+
await o.addAwardProgram(m, u);
|
|
42
|
+
},
|
|
43
|
+
onSuccess: () => {
|
|
44
|
+
s.invalidateQueries({
|
|
45
|
+
queryKey: [t.PROGRAMS]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}), { mutate: P } = i({
|
|
49
|
+
mutationFn: async (r) => {
|
|
50
|
+
await o.removeAwardProgram(r);
|
|
51
|
+
},
|
|
52
|
+
onSuccess: () => {
|
|
53
|
+
s.invalidateQueries({
|
|
54
|
+
queryKey: [t.PROGRAMS]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}), { mutate: R } = i({
|
|
58
|
+
mutationFn: async (r) => {
|
|
59
|
+
const { mainProgram: m, awardsAmount: u } = r, c = a == null ? void 0 : a.find(
|
|
60
|
+
(w) => w.mainProgram === m
|
|
36
61
|
);
|
|
37
|
-
if (!
|
|
62
|
+
if (!c)
|
|
38
63
|
throw new Error("Program not found");
|
|
39
|
-
await
|
|
64
|
+
await o.setAwardPoints(c.mainProgram, u);
|
|
40
65
|
},
|
|
41
66
|
onSuccess: () => {
|
|
42
|
-
|
|
67
|
+
s.invalidateQueries({
|
|
43
68
|
queryKey: [t.PROGRAMS]
|
|
44
69
|
});
|
|
45
70
|
}
|
|
46
|
-
}), { mutate:
|
|
47
|
-
mutationFn: async (
|
|
48
|
-
await
|
|
71
|
+
}), { mutate: S } = i({
|
|
72
|
+
mutationFn: async (r) => {
|
|
73
|
+
await o.addCardsToWallet(r);
|
|
49
74
|
},
|
|
50
75
|
onSuccess: () => {
|
|
51
|
-
|
|
76
|
+
s.invalidateQueries({
|
|
52
77
|
queryKey: [t.USER_CARDS]
|
|
53
78
|
});
|
|
54
79
|
}
|
|
55
|
-
}), { mutate:
|
|
56
|
-
mutationFn: async (
|
|
57
|
-
await
|
|
80
|
+
}), { mutate: C } = i({
|
|
81
|
+
mutationFn: async (r) => {
|
|
82
|
+
await o.removeCardsFromWallet(r);
|
|
58
83
|
},
|
|
59
84
|
onSuccess: () => {
|
|
60
|
-
|
|
85
|
+
s.invalidateQueries({
|
|
61
86
|
queryKey: [t.USER_CARDS]
|
|
62
87
|
});
|
|
63
88
|
}
|
|
64
89
|
});
|
|
65
90
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
91
|
+
// Program Management
|
|
92
|
+
allPrograms: a || [],
|
|
93
|
+
userPrograms: y || [],
|
|
94
|
+
hotelPrograms: (a == null ? void 0 : a.filter(
|
|
95
|
+
(r) => r.category.includes(d.HOTEL)
|
|
69
96
|
)) || [],
|
|
70
|
-
airlinePrograms: (
|
|
71
|
-
(
|
|
97
|
+
airlinePrograms: (a == null ? void 0 : a.filter(
|
|
98
|
+
(r) => r.category.includes(d.AIRLINE)
|
|
72
99
|
)) || [],
|
|
73
|
-
bankPrograms: (
|
|
74
|
-
(
|
|
100
|
+
bankPrograms: (a == null ? void 0 : a.filter(
|
|
101
|
+
(r) => r.category.includes(d.BANK)
|
|
75
102
|
)) || [],
|
|
76
|
-
updatePoints:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
updatePoints: R,
|
|
104
|
+
addAwardProgram: A,
|
|
105
|
+
removeAwardProgram: P,
|
|
106
|
+
// Car Management
|
|
107
|
+
banks: l || [],
|
|
108
|
+
allCards: g || [],
|
|
109
|
+
userCards: p || [],
|
|
110
|
+
addCards: S,
|
|
111
|
+
removeCards: C
|
|
82
112
|
};
|
|
83
113
|
};
|
|
84
114
|
export {
|
|
85
|
-
|
|
115
|
+
B as useWallet
|
|
86
116
|
};
|