@odynn/awayz-core 0.10.27 → 0.10.29

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,7 +1,7 @@
1
1
  import { useQuery as g, useMutation as u } from "@tanstack/react-query";
2
2
  import "react/jsx-runtime";
3
3
  import "../../arrayExtensions-DlcBOj5a.js";
4
- import { E as s } from "../../noRetryInstance-DNLgOg0E.js";
4
+ import { E as a } from "../../noRetryInstance-DNLgOg0E.js";
5
5
  import { useState as x } from "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 */
@@ -20,29 +20,29 @@ const lr = (r, i) => {
20
20
  const {
21
21
  data: E,
22
22
  isError: L,
23
- error: O
23
+ error: A
24
24
  } = g({
25
- queryKey: [s.BOOKING, r, t.HOTEL],
25
+ queryKey: [a.BOOKING, r, t.HOTEL],
26
26
  queryFn: () => o.getHotelBooking(r),
27
27
  enabled: i === t.HOTEL && !!r
28
28
  }), {
29
29
  data: n,
30
- isError: A,
31
- error: d
30
+ isError: O,
31
+ error: N
32
32
  } = g({
33
- queryKey: [s.BOOKING, r, t.FLIGHT],
33
+ queryKey: [a.BOOKING, r, t.FLIGHT],
34
34
  queryFn: () => o.getFlightBooking(r),
35
35
  enabled: i === t.FLIGHT && !!r
36
- }), [C, a] = x(
36
+ }), [C, s] = x(
37
37
  e.IDLE
38
- ), N = () => a(e.IDLE), { data: m, isLoading: H } = g({
39
- queryKey: [s.BOOKING, r],
38
+ ), d = () => s(e.IDLE), { data: m, isLoading: H } = g({
39
+ queryKey: [a.BOOKING, a.POINTS_AS_CASH, r],
40
40
  queryFn: () => o.getPointsAsCash(r),
41
41
  enabled: !!r
42
42
  }), {
43
43
  data: P,
44
- mutate: G,
45
- isPending: I,
44
+ mutate: I,
45
+ isPending: G,
46
46
  isError: y,
47
47
  error: w,
48
48
  isSuccess: K
@@ -53,19 +53,19 @@ const lr = (r, i) => {
53
53
  throw m ? new Error("Not supported for bookings made with Points as Cash") : new Error("Not supported for hotel bookings");
54
54
  }
55
55
  }), {
56
- mutate: B,
57
- isPending: S,
58
- error: D
56
+ mutate: S,
57
+ isPending: B,
58
+ error: T
59
59
  } = u({
60
60
  mutationFn: async (c) => o.cancelPointsBooking(c),
61
61
  onSuccess: () => {
62
- l(), a(e.SUCCESS);
62
+ l(), s(e.SUCCESS);
63
63
  },
64
64
  onError: () => {
65
- l(), a(e.POINTS_REFUND_FAILED);
65
+ l(), s(e.POINTS_REFUND_FAILED);
66
66
  }
67
67
  }), {
68
- mutate: T,
68
+ mutate: D,
69
69
  isPending: h,
70
70
  error: q
71
71
  } = u({
@@ -76,23 +76,23 @@ const lr = (r, i) => {
76
76
  return await o.cancelHotelBooking(r);
77
77
  },
78
78
  onMutate: () => {
79
- a(e.PENDING);
79
+ s(e.PENDING);
80
80
  },
81
81
  onSuccess: () => {
82
82
  if (m) {
83
83
  if (i === t.FLIGHT && n)
84
- return B(n.id);
84
+ return S(n.id);
85
85
  if (i === t.HOTEL && E)
86
- return B(E.id);
86
+ return S(E.id);
87
87
  } else
88
- l(), a(e.SUCCESS);
88
+ l(), s(e.SUCCESS);
89
89
  },
90
90
  onError: () => {
91
- a(e.CANCEL_FAILED);
91
+ s(e.CANCEL_FAILED);
92
92
  }
93
93
  }), {
94
- mutate: U,
95
- isPending: _,
94
+ mutate: _,
95
+ isPending: U,
96
96
  isError: v,
97
97
  error: Q
98
98
  } = u({
@@ -114,35 +114,35 @@ const lr = (r, i) => {
114
114
  }
115
115
  }), l = () => {
116
116
  [
117
- [s.BOOKING, r],
118
- [s.TRIPS],
119
- [s.UNCATEGORISED_BOOKINGS]
117
+ [a.BOOKING, r],
118
+ [a.TRIPS],
119
+ [a.UNCATEGORISED_BOOKINGS]
120
120
  ].forEach((c) => {
121
121
  z.invalidateQueries({ queryKey: c });
122
122
  });
123
- }, R = L || A, k = O || d;
123
+ }, R = L || O, k = A || N;
124
124
  return {
125
125
  details: i === t.HOTEL ? E : n,
126
126
  isError: R,
127
127
  error: k,
128
- initiateCancellation: G,
129
- isInitiatingCancellation: I,
128
+ initiateCancellation: I,
129
+ isInitiatingCancellation: G,
130
130
  isInitiateCancellationError: y,
131
131
  initiateCancellationError: w,
132
132
  isInitiateCancellationSuccess: K,
133
133
  initiateCancellationData: P,
134
- cancelBooking: T,
134
+ cancelBooking: D,
135
135
  cancelStatus: C,
136
- resetCancelStatus: N,
136
+ resetCancelStatus: d,
137
137
  cancelBookingError: q,
138
- pointsRefundError: D,
139
- isCancellingBooking: h || S,
138
+ pointsRefundError: T,
139
+ isCancellingBooking: h || B,
140
140
  // Deprecated – remove once awayz-tenant has migrated to cancelStatus
141
- isCancelingBooking: h || S,
141
+ isCancelingBooking: h || B,
142
142
  isCancelBookingSuccess: C === e.SUCCESS,
143
143
  isCancelBookingError: C === e.CANCEL_FAILED,
144
- actionAirlineChanges: U,
145
- isActionAirlineChangesPending: _,
144
+ actionAirlineChanges: _,
145
+ isActionAirlineChangesPending: U,
146
146
  isActionAirlineChangesError: v,
147
147
  actionAirlineChangesError: Q,
148
148
  pointsAsCashDetails: m,
@@ -17,7 +17,7 @@ declare class _BookingService {
17
17
  cancelHotelBooking: (bookingId: string) => Promise<any>;
18
18
  actionAirlineChanges: ({ bookingId, acceptChanges, aicId }: IActionAirlineChangesRequest) => Promise<any>;
19
19
  cancelPointsBooking: (bookingId: string) => Promise<any>;
20
- getPointsAsCash: (bookingId: string) => Promise<IPointsAsCash>;
20
+ getPointsAsCash: (bookingId: string) => Promise<IPointsAsCash | undefined>;
21
21
  }
22
22
  export declare const BookingService: _BookingService;
23
23
  export {};
@@ -210,7 +210,7 @@ class b {
210
210
  const { data: a } = await p.get(
211
211
  `${i.BOOKING_POINTS_AS_CASH}/${t}`
212
212
  );
213
- return {
213
+ return !a.success || !a.data ? void 0 : {
214
214
  ...a.data,
215
215
  cashValue: a.data.cash
216
216
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.10.27",
3
+ "version": "0.10.29",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"