@odynn/awayz-core 0.5.7 → 0.5.8
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,4 +1,4 @@
|
|
|
1
|
-
import { useQuery as
|
|
1
|
+
import { useQuery as u, useMutation as c } from "@tanstack/react-query";
|
|
2
2
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
3
3
|
import { E as o } from "../../AccountService-CtMwRIoL.js";
|
|
4
4
|
import "react";
|
|
@@ -13,51 +13,51 @@ import "react-i18next";
|
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { BookingService as
|
|
16
|
+
import { BookingService as n } from "../../services/bookings/BookingService.js";
|
|
17
17
|
const W = (r, e) => {
|
|
18
18
|
const {
|
|
19
|
-
data:
|
|
20
|
-
isError:
|
|
21
|
-
error:
|
|
22
|
-
} =
|
|
19
|
+
data: m,
|
|
20
|
+
isError: E,
|
|
21
|
+
error: g
|
|
22
|
+
} = u({
|
|
23
23
|
queryKey: [o.BOOKING, r, i.HOTEL],
|
|
24
|
-
queryFn: () =>
|
|
24
|
+
queryFn: () => n.getHotelBooking(r),
|
|
25
25
|
enabled: e === i.HOTEL && !!r
|
|
26
26
|
}), {
|
|
27
|
-
data:
|
|
28
|
-
isError:
|
|
29
|
-
error:
|
|
30
|
-
} =
|
|
27
|
+
data: t,
|
|
28
|
+
isError: B,
|
|
29
|
+
error: C
|
|
30
|
+
} = u({
|
|
31
31
|
queryKey: [o.BOOKING, r, i.FLIGHT],
|
|
32
|
-
queryFn: () =>
|
|
32
|
+
queryFn: () => n.getFlightBooking(r),
|
|
33
33
|
enabled: e === i.FLIGHT && !!r
|
|
34
34
|
}), {
|
|
35
|
-
mutate:
|
|
36
|
-
isPending:
|
|
37
|
-
isError:
|
|
38
|
-
error:
|
|
39
|
-
isSuccess:
|
|
35
|
+
mutate: h,
|
|
36
|
+
isPending: p,
|
|
37
|
+
isError: F,
|
|
38
|
+
error: f,
|
|
39
|
+
isSuccess: O
|
|
40
40
|
} = c({
|
|
41
41
|
mutationFn: async () => {
|
|
42
42
|
if (e === i.FLIGHT)
|
|
43
|
-
return
|
|
43
|
+
return n.initiateCancelFlightBooking(r);
|
|
44
44
|
throw new Error("Not supported for hotel bookings");
|
|
45
45
|
},
|
|
46
46
|
onSuccess: () => {
|
|
47
47
|
a();
|
|
48
48
|
}
|
|
49
49
|
}), {
|
|
50
|
-
mutate:
|
|
51
|
-
isPending:
|
|
50
|
+
mutate: H,
|
|
51
|
+
isPending: l,
|
|
52
52
|
isError: S,
|
|
53
53
|
error: G,
|
|
54
54
|
isSuccess: y
|
|
55
55
|
} = c({
|
|
56
56
|
mutationFn: async () => {
|
|
57
57
|
if (e === i.FLIGHT)
|
|
58
|
-
return
|
|
58
|
+
return n.confirmCancelFlightBooking(r);
|
|
59
59
|
if (e === i.HOTEL)
|
|
60
|
-
return
|
|
60
|
+
return n.cancelHotelBooking(r);
|
|
61
61
|
},
|
|
62
62
|
onSuccess: () => {
|
|
63
63
|
a();
|
|
@@ -69,11 +69,11 @@ const W = (r, e) => {
|
|
|
69
69
|
error: d
|
|
70
70
|
} = c({
|
|
71
71
|
mutationFn: async (s) => {
|
|
72
|
-
if (e === i.FLIGHT && (
|
|
73
|
-
return
|
|
72
|
+
if (e === i.FLIGHT && (t != null && t.airlineInitiatedChanges))
|
|
73
|
+
return n.actionAirlineChanges({
|
|
74
74
|
bookingId: r,
|
|
75
75
|
acceptChanges: s,
|
|
76
|
-
aicId:
|
|
76
|
+
aicId: t.airlineInitiatedChanges[0].id
|
|
77
77
|
});
|
|
78
78
|
throw new Error("Not supported for hotel bookings");
|
|
79
79
|
},
|
|
@@ -88,18 +88,19 @@ const W = (r, e) => {
|
|
|
88
88
|
].forEach((s) => {
|
|
89
89
|
q.invalidateQueries({ queryKey: s });
|
|
90
90
|
});
|
|
91
|
-
}, I =
|
|
91
|
+
}, I = E || B, N = g || C;
|
|
92
92
|
return {
|
|
93
|
-
details: e === i.HOTEL ?
|
|
93
|
+
details: e === i.HOTEL ? m : t,
|
|
94
94
|
isError: I,
|
|
95
95
|
error: N,
|
|
96
|
-
initiateCancellation:
|
|
97
|
-
isInitiatingCancellation:
|
|
98
|
-
isInitiateCancellationError:
|
|
99
|
-
initiateCancellationError:
|
|
100
|
-
isInitiateCancellationSuccess:
|
|
101
|
-
cancelBooking:
|
|
102
|
-
isCancellingBooking:
|
|
96
|
+
initiateCancellation: h,
|
|
97
|
+
isInitiatingCancellation: p,
|
|
98
|
+
isInitiateCancellationError: F,
|
|
99
|
+
initiateCancellationError: f,
|
|
100
|
+
isInitiateCancellationSuccess: O,
|
|
101
|
+
cancelBooking: H,
|
|
102
|
+
isCancellingBooking: l,
|
|
103
|
+
isCancelingBooking: l,
|
|
103
104
|
isCancelBookingError: S,
|
|
104
105
|
cancelBookingError: G,
|
|
105
106
|
isCancelBookingSuccess: y,
|
|
@@ -47,11 +47,16 @@ export interface IUseBookingManagement {
|
|
|
47
47
|
*/
|
|
48
48
|
isCancellingBooking: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* Indicates if
|
|
50
|
+
* Indicates if the cancel booking request is pending
|
|
51
|
+
* @deprecated Use `isCancellingBooking` instead
|
|
52
|
+
*/
|
|
53
|
+
isCancelingBooking: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates if there was an error while cancelling the booking
|
|
51
56
|
*/
|
|
52
57
|
isCancelBookingError: boolean;
|
|
53
58
|
/**
|
|
54
|
-
* The error object if there was an error while
|
|
59
|
+
* The error object if there was an error while cancelling the booking
|
|
55
60
|
*/
|
|
56
61
|
cancelBookingError: Error | null;
|
|
57
62
|
/**
|