@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 l, useMutation as c } from "@tanstack/react-query";
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 t } from "../../services/bookings/BookingService.js";
16
+ import { BookingService as n } from "../../services/bookings/BookingService.js";
17
17
  const W = (r, e) => {
18
18
  const {
19
- data: u,
20
- isError: m,
21
- error: E
22
- } = l({
19
+ data: m,
20
+ isError: E,
21
+ error: g
22
+ } = u({
23
23
  queryKey: [o.BOOKING, r, i.HOTEL],
24
- queryFn: () => t.getHotelBooking(r),
24
+ queryFn: () => n.getHotelBooking(r),
25
25
  enabled: e === i.HOTEL && !!r
26
26
  }), {
27
- data: n,
28
- isError: g,
29
- error: B
30
- } = l({
27
+ data: t,
28
+ isError: B,
29
+ error: C
30
+ } = u({
31
31
  queryKey: [o.BOOKING, r, i.FLIGHT],
32
- queryFn: () => t.getFlightBooking(r),
32
+ queryFn: () => n.getFlightBooking(r),
33
33
  enabled: e === i.FLIGHT && !!r
34
34
  }), {
35
- mutate: C,
36
- isPending: h,
37
- isError: p,
38
- error: F,
39
- isSuccess: f
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 t.initiateCancelFlightBooking(r);
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: O,
51
- isPending: H,
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 t.confirmCancelFlightBooking(r);
58
+ return n.confirmCancelFlightBooking(r);
59
59
  if (e === i.HOTEL)
60
- return t.cancelHotelBooking(r);
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 && (n != null && n.airlineInitiatedChanges))
73
- return t.actionAirlineChanges({
72
+ if (e === i.FLIGHT && (t != null && t.airlineInitiatedChanges))
73
+ return n.actionAirlineChanges({
74
74
  bookingId: r,
75
75
  acceptChanges: s,
76
- aicId: n.airlineInitiatedChanges[0].id
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 = m || g, N = E || B;
91
+ }, I = E || B, N = g || C;
92
92
  return {
93
- details: e === i.HOTEL ? u : n,
93
+ details: e === i.HOTEL ? m : t,
94
94
  isError: I,
95
95
  error: N,
96
- initiateCancellation: C,
97
- isInitiatingCancellation: h,
98
- isInitiateCancellationError: p,
99
- initiateCancellationError: F,
100
- isInitiateCancellationSuccess: f,
101
- cancelBooking: O,
102
- isCancellingBooking: H,
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 there was an error while canceling the booking
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 canceling the booking
59
+ * The error object if there was an error while cancelling the booking
55
60
  */
56
61
  cancelBookingError: Error | null;
57
62
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"