@odynn/awayz-core 0.3.8 → 0.3.10

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,15 +1,15 @@
1
1
  var _ = Object.defineProperty;
2
2
  var g = (a, e, s) => e in a ? _(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
3
- var t = (a, e, s) => g(a, typeof e != "symbol" ? e + "" : e, s);
3
+ var r = (a, e, s) => g(a, typeof e != "symbol" ? e + "" : e, s);
4
4
  import { c as n, j as p, b as o, r as T } from "./AccountService-D_6U8vP6.js";
5
- import { EBookingType as l } from "./services/trips/TripService.types.js";
5
+ import { EBookingType as m } from "./services/trips/TripService.types.js";
6
6
  import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
7
7
  import "./arrayExtensions-DlcBOj5a.js";
8
8
  import "react";
9
9
  const y = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
10
10
  class b {
11
11
  constructor() {
12
- t(this, "createTrip", async (e) => {
12
+ r(this, "createTrip", async (e) => {
13
13
  const { data: s } = await n.post(
14
14
  i.TRIPS,
15
15
  p({
@@ -20,7 +20,7 @@ class b {
20
20
  );
21
21
  return s;
22
22
  });
23
- t(this, "getTripsByStatus", async (e) => {
23
+ r(this, "getTripsByStatus", async (e) => {
24
24
  const { data: s } = await n.get(
25
25
  i.TRIPS,
26
26
  {
@@ -29,53 +29,64 @@ class b {
29
29
  );
30
30
  if (!(s != null && s.success))
31
31
  return [];
32
- const r = s.data.map((d) => ({
32
+ const t = s.data.map((d) => ({
33
33
  ...d,
34
34
  flightBookings: u(d.flight_bookings ?? []),
35
- hotelBookings: m(d.hotel_bookings ?? [])
35
+ hotelBookings: l(d.hotel_bookings ?? [])
36
36
  }));
37
- return o(r);
37
+ return o(t);
38
38
  });
39
- t(this, "updateTrip", async (e, s) => {
40
- const { data: r } = await n.put(
39
+ r(this, "updateTrip", async (e, s) => {
40
+ const { data: t } = await n.put(
41
41
  `${i.TRIPS}/${e}`,
42
42
  T(p(s))
43
43
  );
44
- return r != null && r.success ? {
44
+ return t != null && t.success ? {
45
45
  success: !0,
46
- data: o(r.data),
46
+ data: o(t.data),
47
47
  message: "Trip updated successfully."
48
48
  } : {
49
49
  success: !1,
50
50
  message: "An error occurred while trying to update the trip."
51
51
  };
52
52
  });
53
- t(this, "deleteTrip", async (e) => {
53
+ r(this, "deleteTrip", async (e) => {
54
54
  const { data: s } = await n.delete(
55
55
  `${i.TRIPS}/${e}`
56
56
  );
57
57
  return s;
58
58
  });
59
- t(this, "getUncategorisedBookings", async () => {
59
+ r(this, "getUncategorisedBookings", async () => {
60
60
  const { data: e } = await n.get(
61
61
  i.UNCATEGORISED_BOOKINGS
62
62
  );
63
63
  return e != null && e.success ? {
64
64
  flightBookings: u(e.data.flight_bookings ?? []),
65
- hotelBookings: m(e.data.hotel_bookings ?? [])
65
+ hotelBookings: l(e.data.hotel_bookings ?? [])
66
66
  } : {
67
67
  flightBookings: [],
68
68
  hotelBookings: []
69
69
  };
70
70
  });
71
- t(this, "addBookingToTrip", async (e, s, r) => {
71
+ r(this, "addBookingToTrip", async (e, s, t) => {
72
72
  const { data: c } = await n.put(i.ADD_BOOKING, {
73
73
  trip_id: e,
74
74
  booking_id: s,
75
- booking_type: r
75
+ booking_type: t
76
76
  });
77
77
  return c.success;
78
78
  });
79
+ r(this, "removeBookingFromTrip", async (e, s, t) => {
80
+ const { data: c } = await n.put(
81
+ i.REMOVE_BOOKING,
82
+ p({
83
+ trip_id: e,
84
+ booking_id: s,
85
+ booking_type: t
86
+ })
87
+ );
88
+ return c.success;
89
+ });
79
90
  }
80
91
  }
81
92
  const u = (a) => a.map(
@@ -84,7 +95,7 @@ const u = (a) => a.map(
84
95
  reference: e.booking_reference,
85
96
  startDate: e.departure_date,
86
97
  endDate: e.arrival_date,
87
- bookingType: l.FLIGHT,
98
+ bookingType: m.FLIGHT,
88
99
  airlines: e.slices.map((s) => ({
89
100
  logo: y + ".svg",
90
101
  name: s.carriers.operating[0]
@@ -101,24 +112,26 @@ const u = (a) => a.map(
101
112
  passengers: e.passengers.length,
102
113
  hasAirlineChanges: !1,
103
114
  orderId: e.order_id,
104
- type: e.type
115
+ type: e.type,
116
+ cancelledAt: e.cancelled_at
105
117
  })
106
- ), m = (a) => a.map(
118
+ ), l = (a) => a.map(
107
119
  (e) => o({
108
120
  id: e._id,
109
121
  reference: e.reference,
110
122
  startDate: e.check_in_date,
111
123
  endDate: e.check_out_date,
112
- bookingType: l.HOTEL,
124
+ bookingType: m.HOTEL,
113
125
  name: e.rooms[0].name,
114
126
  image: e.images[0],
115
127
  guests: e.number_of_guests,
116
128
  address: Object.values(e.address).filter((s) => s).map((s) => s.trim()).join(", "),
117
129
  rooms: e.rooms.length,
118
- bookingId: e.booking_id
130
+ bookingId: e.booking_id,
131
+ cancelledAt: e.cancelled_at
119
132
  })
120
- ), w = new b();
133
+ ), O = new b();
121
134
  export {
122
135
  y as D,
123
- w as T
136
+ O as T
124
137
  };
@@ -1,8 +1,8 @@
1
- var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), _ = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.USER_CARDS = "user/cards", e.BANKS = "banks", e.CARDS = "cards", e))(_ || {}), S = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(S || {}), I = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e))(I || {});
1
+ var r = /* @__PURE__ */ ((e) => (e.SIGN_IN = "auth/user-login", e.SIGN_UP = "auth/sign-up", e.ME = "user", e.RESEND_VERIFICATION_EMAIL = "auth/resend-verification-email", e.UPDATE_USER_DETAILS = "account/update/user", e.CONFIRM_EMAIL = "account/verifyAccount", e.FORGOT_PASSWORD = "email/sendVeri", e.RESEND_OTP = "email/sendForgotPasswordVerification", e.RESET_PASSWORD = "account/updateUserPassword", e.REQUEST_LIMIT = "user/request-limit", e.APPLE_SOCIAL_SIGN_UP = "tp/apple/get/user", e.GOOGLE_SOCIAL_SIGN_UP = "tp/google/get/user", e.UPDATE_USER = "account/details/addUserDetails", e.ACKNOWLEDGEMENT = "account/update/userAcknowledgement", e.REGIONS = "user/region", e.UPDATE_USER_REGION = "/account/update/userRegion", e.UPDATE_PASSENGER_DETAILS = "/account/awayz", e.REFRESH_TOKEN = "auth/refresh-token", e.EXCHANGE_TOKEN = "user/exchange-token", e.REFRESH_EMBED_TOKEN = "user/refresh-token", e.OAUTH_INITIATE = "user/oauth2/initiate", e.OAUTH_CALLBACK = "user/oauth2/callback", e))(r || {}), a = /* @__PURE__ */ ((e) => (e.CURRENCY_CONVERSION = "currency/convert", e))(a || {}), _ = /* @__PURE__ */ ((e) => (e.USER_AWARDS = "user/rewards", e.USER_CARDS = "user/cards", e.BANKS = "banks", e.CARDS = "cards", e))(_ || {}), I = /* @__PURE__ */ ((e) => (e.TRIPS = "user/trips", e.ADD_BOOKING = "user/trips/add-booking-to-trip", e.REMOVE_BOOKING = "user/trips/remove-booking-from-trip", e.UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings", e))(I || {}), O = /* @__PURE__ */ ((e) => (e.USER_HOTEL_BOOKINGS = "/user/bookings/hotels", e.USER_FLIGHT_BOOKINGS = "/user/bookings/flights", e.INITIATE_FLIGHT_CANCEL = "/duffel/flights/initiate-order-cancellation", e.CONFIRM_FLIGHT_CANCEL = "/duffel/flights/confirm-order-cancellation", e.CANCEL_HOTEL_BOOKING = "/duffel/hotels/cancel", e))(O || {});
2
2
  export {
3
3
  r as EAuthEndpoints,
4
- I as EBookingEndpoints,
4
+ O as EBookingEndpoints,
5
5
  a as ECurrencyEndpoints,
6
- S as EMyTripsEndpoints,
6
+ I as EMyTripsEndpoints,
7
7
  _ as EWalletEndpoints
8
8
  };
@@ -1,63 +1,64 @@
1
- import { useQuery as u, useMutation as p } from "@tanstack/react-query";
2
- import { h as c } from "../../arrayExtensions-DlcBOj5a.js";
1
+ import { useQuery as p, useMutation as s } from "@tanstack/react-query";
2
+ import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
3
3
  import { E as e } from "../../AccountService-D_6U8vP6.js";
4
4
  import "react";
5
- import { T as o } from "../../TripsService-DvAgBZGs.js";
5
+ import { T as t } from "../../TripsService-BbbkMtx6.js";
6
6
  import "react/jsx-runtime";
7
7
  import "../../context/AwayzContext.js";
8
- import { awayzClient as i } from "../../configs/awayzClient.js";
8
+ import { awayzClient as o } from "../../configs/awayzClient.js";
9
9
  import "../../services/noRetryInstance.js";
10
10
  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
- const F = ({
15
- tripId: s,
16
- tripDetails: n
14
+ const b = ({
15
+ tripId: u,
16
+ tripDetails: a
17
17
  }) => {
18
- if (!s)
18
+ if (!u)
19
19
  throw new Error("Trip ID is required");
20
- if (!n || Object.keys(n).length === 0)
20
+ if (!a || Object.keys(a).length === 0)
21
21
  throw new Error("Trip details must be provided for update");
22
- }, J = () => {
23
- const { data: s = [] } = u({
22
+ }, $ = () => {
23
+ const { data: u = [] } = p({
24
24
  queryKey: [
25
25
  e.TRIPS,
26
26
  "past"
27
27
  /* PAST */
28
28
  ],
29
- queryFn: () => o.getTripsByStatus(
29
+ queryFn: () => t.getTripsByStatus(
30
30
  "past"
31
31
  /* PAST */
32
32
  )
33
- }), { data: n = [] } = u({
33
+ }), { data: a = [] } = p({
34
34
  queryKey: [
35
35
  e.TRIPS,
36
36
  "upcoming"
37
37
  /* UPCOMING */
38
38
  ],
39
- queryFn: () => o.getTripsByStatus(
39
+ queryFn: () => t.getTripsByStatus(
40
40
  "upcoming"
41
41
  /* UPCOMING */
42
42
  )
43
- }), { data: a } = u({
43
+ }), { data: n } = p({
44
44
  queryKey: [e.UNCATEGORISED_BOOKINGS],
45
- queryFn: () => o.getUncategorisedBookings()
45
+ queryFn: () => t.getUncategorisedBookings()
46
46
  }), {
47
47
  mutate: y,
48
- isPending: m,
49
- isError: g,
50
- error: E
51
- } = p({
52
- mutationFn: async ({ tripId: r, tripDetails: t }) => (F({ tripId: r, tripDetails: t }), await o.updateTrip(r, t)),
48
+ isPending: g,
49
+ isError: E,
50
+ error: S,
51
+ isSuccess: l
52
+ } = s({
53
+ mutationFn: async ({ tripId: r, tripDetails: i }) => (b({ tripId: r, tripDetails: i }), await t.updateTrip(r, i)),
53
54
  onSuccess: () => {
54
- i.invalidateQueries({
55
+ o.invalidateQueries({
55
56
  queryKey: [
56
57
  e.TRIPS,
57
58
  "past"
58
59
  /* PAST */
59
60
  ]
60
- }), i.invalidateQueries({
61
+ }), o.invalidateQueries({
61
62
  queryKey: [
62
63
  e.TRIPS,
63
64
  "upcoming"
@@ -66,26 +67,27 @@ const F = ({
66
67
  });
67
68
  }
68
69
  }), {
69
- mutate: l,
70
- isPending: S,
71
- isError: q,
72
- error: w
73
- } = p({
70
+ mutate: q,
71
+ isPending: w,
72
+ isError: v,
73
+ error: P,
74
+ isSuccess: B
75
+ } = s({
74
76
  mutationFn: async (r) => {
75
77
  if (!r)
76
78
  throw new Error("Trip details are required to create a trip");
77
79
  if (!r.name || !r.startDate || !r.endDate)
78
80
  throw new Error("Trip name, start date, and end date are required");
79
- return await o.createTrip(r);
81
+ return await t.createTrip(r);
80
82
  },
81
83
  onSuccess: () => {
82
- i.invalidateQueries({
84
+ o.invalidateQueries({
83
85
  queryKey: [
84
86
  e.TRIPS,
85
87
  "past"
86
88
  /* PAST */
87
89
  ]
88
- }), i.invalidateQueries({
90
+ }), o.invalidateQueries({
89
91
  queryKey: [
90
92
  e.TRIPS,
91
93
  "upcoming"
@@ -94,104 +96,149 @@ const F = ({
94
96
  });
95
97
  }
96
98
  }), {
97
- mutate: P,
98
- isPending: K,
99
- isError: f,
100
- error: I
101
- } = p({
99
+ mutate: K,
100
+ isPending: I,
101
+ isError: k,
102
+ error: f,
103
+ isSuccess: R
104
+ } = s({
102
105
  mutationFn: async (r) => {
103
106
  if (!r)
104
107
  throw new Error("Trip ID is required to delete a trip");
105
- await o.deleteTrip(r);
108
+ await t.deleteTrip(r);
106
109
  },
107
110
  onSuccess: () => {
108
- i.invalidateQueries({
111
+ o.invalidateQueries({
109
112
  queryKey: [
110
113
  e.TRIPS,
111
114
  "past"
112
115
  /* PAST */
113
116
  ]
114
- }), i.invalidateQueries({
117
+ }), o.invalidateQueries({
115
118
  queryKey: [
116
119
  e.TRIPS,
117
120
  "upcoming"
118
121
  /* UPCOMING */
119
122
  ]
120
- }), i.invalidateQueries({
123
+ }), o.invalidateQueries({
121
124
  queryKey: [e.UNCATEGORISED_BOOKINGS]
122
125
  });
123
126
  }
124
127
  }), {
125
- mutate: B,
126
- isPending: h,
127
- isError: v,
128
- error: R
129
- } = p({
128
+ mutate: h,
129
+ isPending: Q,
130
+ isError: F,
131
+ error: O
132
+ } = s({
130
133
  mutationFn: async ({
131
134
  tripId: r,
132
- booking: t
135
+ booking: i
133
136
  }) => {
134
137
  if (!r)
135
138
  throw new Error("Trip ID is required to add a booking");
136
- if (!t)
139
+ if (!i)
137
140
  throw new Error("Booking is required to add a booking");
138
- return await o.addBookingToTrip(
141
+ return await t.addBookingToTrip(
142
+ r,
143
+ i.id,
144
+ i.bookingType
145
+ );
146
+ },
147
+ onSuccess: () => {
148
+ o.invalidateQueries({
149
+ queryKey: [
150
+ e.TRIPS,
151
+ "past"
152
+ /* PAST */
153
+ ]
154
+ }), o.invalidateQueries({
155
+ queryKey: [
156
+ e.TRIPS,
157
+ "upcoming"
158
+ /* UPCOMING */
159
+ ]
160
+ }), o.invalidateQueries({
161
+ queryKey: [e.UNCATEGORISED_BOOKINGS]
162
+ });
163
+ }
164
+ }), {
165
+ mutate: U,
166
+ isPending: D,
167
+ isError: C,
168
+ error: G
169
+ } = s({
170
+ mutationFn: async ({
171
+ tripId: r,
172
+ booking: i
173
+ }) => {
174
+ if (!r)
175
+ throw new Error("Trip ID is required to remove a booking");
176
+ if (!i)
177
+ throw new Error("Booking is required to remove a booking");
178
+ return await t.removeBookingFromTrip(
139
179
  r,
140
- t.id,
141
- t.bookingType
180
+ i.id,
181
+ i.bookingType
142
182
  );
143
183
  },
144
184
  onSuccess: () => {
145
- i.invalidateQueries({
185
+ o.invalidateQueries({
146
186
  queryKey: [
147
187
  e.TRIPS,
148
188
  "past"
149
189
  /* PAST */
150
190
  ]
151
- }), i.invalidateQueries({
191
+ }), o.invalidateQueries({
152
192
  queryKey: [
153
193
  e.TRIPS,
154
194
  "upcoming"
155
195
  /* UPCOMING */
156
196
  ]
157
- }), i.invalidateQueries({
197
+ }), o.invalidateQueries({
158
198
  queryKey: [e.UNCATEGORISED_BOOKINGS]
159
199
  });
160
200
  }
161
- }), k = [...s, ...n], d = (a == null ? void 0 : a.flightBookings) || [], T = (a == null ? void 0 : a.hotelBookings) || [], Q = [
201
+ }), N = [...u, ...a], d = (n == null ? void 0 : n.flightBookings) || [], T = (n == null ? void 0 : n.hotelBookings) || [], A = [
162
202
  ...d,
163
203
  ...T
164
- ].sort((r, t) => c(r.startDate).diff(c(t.startDate)));
204
+ ].sort((r, i) => m(r.startDate).diff(m(i.startDate)));
165
205
  return {
166
206
  // Trips
167
- allTrips: k,
168
- pastTrips: s,
169
- upcomingTrips: n,
207
+ allTrips: N,
208
+ pastTrips: u,
209
+ upcomingTrips: a,
170
210
  // Bookings
171
- allUncategorisedBookings: Q,
211
+ allUncategorisedBookings: A,
172
212
  uncategorisedFlightBookings: d,
173
213
  uncategorisedHotelBookings: T,
174
214
  // Trip Management
175
- createTrip: l,
176
- isCreateTripPending: S,
177
- isCreateTripError: q,
178
- createTripError: w,
215
+ createTrip: q,
216
+ isCreateTripPending: w,
217
+ isCreateTripError: v,
218
+ createTripError: P,
219
+ isCreateTripSuccess: B,
179
220
  updateTrip: y,
180
- isUpdateTripPending: m,
181
- isUpdateTripError: g,
182
- updateTripError: E,
183
- deleteTrip: P,
184
- isDeleteTripPending: K,
185
- isDeleteTripError: f,
186
- deleteTripError: I,
221
+ isUpdateTripPending: g,
222
+ isUpdateTripError: E,
223
+ updateTripError: S,
224
+ isUpdateTripSuccess: l,
225
+ deleteTrip: K,
226
+ isDeleteTripPending: I,
227
+ isDeleteTripError: k,
228
+ deleteTripError: f,
229
+ isDeleteTripSuccess: R,
187
230
  // Booking Management
188
- addBookingToTrip: B,
189
- isAddBookingToTripPending: h,
190
- isAddBookingToTripError: v,
191
- addBookingToTripError: R
231
+ addBookingToTrip: h,
232
+ isAddBookingToTripPending: Q,
233
+ isAddBookingToTripError: F,
234
+ addBookingToTripError: O,
235
+ removeBookingFromTrip: U,
236
+ isRemoveBookingFromTripPending: D,
237
+ isRemoveBookingFromTripError: C,
238
+ removeBookingFromTripError: G
192
239
  };
193
240
  };
194
241
  export {
195
- J as useTripManagement,
196
- F as validateUpdateTripArgs
242
+ $ as useTripManagement,
243
+ b as validateUpdateTripArgs
197
244
  };
@@ -4,7 +4,7 @@ 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-DvAgBZGs.js";
7
+ import { D as f } from "../../TripsService-BbbkMtx6.js";
8
8
  import { c as d } from "../../AccountService-D_6U8vP6.js";
9
9
  import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
10
10
  import "../../configs/awayzClient.js";
@@ -34,6 +34,7 @@ export declare enum EWalletEndpoints {
34
34
  export declare enum EMyTripsEndpoints {
35
35
  TRIPS = "user/trips",
36
36
  ADD_BOOKING = "user/trips/add-booking-to-trip",
37
+ REMOVE_BOOKING = "user/trips/remove-booking-from-trip",
37
38
  UNCATEGORISED_BOOKINGS = "/user/trips/get-uncategorized-bookings"
38
39
  }
39
40
  export declare enum EBookingEndpoints {
@@ -48,6 +48,10 @@ export interface IUseTripManagement {
48
48
  * Indicates if there was an error while creating a trip
49
49
  */
50
50
  isCreateTripError: boolean;
51
+ /**
52
+ * Indicates if the trip was successfully created
53
+ */
54
+ isCreateTripSuccess: boolean;
51
55
  /**
52
56
  * Error object if there was an error while creating a trip
53
57
  */
@@ -65,6 +69,10 @@ export interface IUseTripManagement {
65
69
  * Indicates if there was an error while updating a trip
66
70
  */
67
71
  isUpdateTripError: boolean;
72
+ /**
73
+ * Indicates if the trip was successfully updated
74
+ */
75
+ isUpdateTripSuccess: boolean;
68
76
  /**
69
77
  * Error object if there was an error while updating a trip
70
78
  */
@@ -82,6 +90,10 @@ export interface IUseTripManagement {
82
90
  * Indicates if there was an error while deleting a trip
83
91
  */
84
92
  isDeleteTripError: boolean;
93
+ /**
94
+ * Indicates if the trip was successfully deleted
95
+ */
96
+ isDeleteTripSuccess: boolean;
85
97
  /**
86
98
  * Error object if there was an error while deleting a trip
87
99
  */
@@ -106,4 +118,24 @@ export interface IUseTripManagement {
106
118
  * Error object if there was an error while adding a booking to a trip
107
119
  */
108
120
  addBookingToTripError: Error | null;
121
+ /**
122
+ * Function to remove a booking from a trip
123
+ * @param args - Object containing tripId and bookingId to be removed
124
+ */
125
+ removeBookingFromTrip: (args: {
126
+ tripId: string;
127
+ booking: IBooking;
128
+ }) => void;
129
+ /**
130
+ * Indicates if the remove booking from trip request is pending
131
+ */
132
+ isRemoveBookingFromTripPending: boolean;
133
+ /**
134
+ * Indicates if there was an error while removing a booking from a trip
135
+ */
136
+ isRemoveBookingFromTripError: boolean;
137
+ /**
138
+ * Error object if there was an error while removing a booking from a trip
139
+ */
140
+ removeBookingFromTripError: Error | null;
109
141
  }
@@ -1,4 +1,3 @@
1
- import { Moment } from 'moment';
2
1
  export declare enum EBookingType {
3
2
  HOTEL = "hotel",
4
3
  FLIGHT = "flight"
@@ -21,9 +20,9 @@ export interface ITrip {
21
20
  export interface IBooking {
22
21
  id: string;
23
22
  reference: string;
24
- startDate: Moment;
25
- endDate: Moment;
26
- cancelledAt?: Moment;
23
+ startDate: string;
24
+ endDate: string;
25
+ cancelledAt?: string;
27
26
  bookingType: EBookingType;
28
27
  }
29
28
  export interface IHotelBooking extends IBooking {
@@ -14,6 +14,7 @@ declare class _TripsService {
14
14
  deleteTrip: (tripId: string) => Promise<any>;
15
15
  getUncategorisedBookings: () => Promise<IUncategorizedBookings>;
16
16
  addBookingToTrip: (tripId: string, bookingId: string, bookingType: EBookingType) => Promise<any>;
17
+ removeBookingFromTrip: (tripId: string, bookingId: string, bookingType: EBookingType) => Promise<any>;
17
18
  }
18
19
  export declare const TripsService: _TripsService;
19
20
  export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Enum representing supported hotel currency options.
3
+ *
4
+ * @remarks
5
+ * This enum defines the set of currency codes that can be used for hotel-related transactions.
6
+ *
7
+ * @enum {string}
8
+ * @property {string} AUD - Australian Dollar
9
+ * @property {string} GBP - British Pound Sterling
10
+ * @property {string} EUR - Euro
11
+ * @property {string} USD - United States Dollar
12
+ */
13
+ export declare enum EHotelCurrencyOption {
14
+ AUD = "AUD",
15
+ GBP = "GBP",
16
+ EUR = "EUR",
17
+ USD = "USD"
18
+ }
19
+ /**
20
+ * Maps each hotel currency option to its corresponding currency symbol.
21
+ *
22
+ * @remarks
23
+ * This object uses the {@link EHotelCurrencyOption} enum as keys and provides the appropriate
24
+ * currency symbol as a string value for each supported currency.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * currencySymbols[EHotelCurrencyOption.USD]; // Returns: '$'
29
+ * currencySymbols[EHotelCurrencyOption.AUD]; // Returns: 'A$'
30
+ * ```
31
+ */
32
+ export declare const currencySymbols: Record<EHotelCurrencyOption, string>;
@@ -1 +1,2 @@
1
1
  export * from './EAuthFlow';
2
+ export * from './ECurrency';
package/dist/main.js CHANGED
@@ -1,39 +1,42 @@
1
1
  import { AwayzProvider as r } from "./providers/AwayzProvider.js";
2
- import { useAwayzContext as p } from "./hooks/useAwayzContext.js";
2
+ import { useAwayzContext as n } from "./hooks/useAwayzContext.js";
3
3
  import { useSearchLimit as i } from "./hooks/useSearchLimit.js";
4
4
  import { useWallet as m } from "./hooks/useWallet/useWallet.js";
5
- import { useTripManagement as f, validateUpdateTripArgs as s } from "./hooks/useTripManagement/useTripManagement.js";
5
+ import { useTripManagement as f, validateUpdateTripArgs as l } from "./hooks/useTripManagement/useTripManagement.js";
6
6
  import { useBookingManagement as c } from "./hooks/useBookingManagement/useBookingManagement.js";
7
- import { EAuthFlow as u } from "./types/EAuthFlow.js";
8
- import { c as A, i as B } from "./AccountService-D_6U8vP6.js";
9
- import { clientNoRetryInstance as d } from "./services/noRetryInstance.js";
10
- import { CurrencyService as k } from "./services/currency/CurrencyService.js";
11
- import { EBookingType as w } from "./services/trips/TripService.types.js";
12
- import { awayzClient as E } from "./configs/awayzClient.js";
13
- import { CashValue as I } from "./components/CashValue/CashValue.js";
14
- import { EInvalidAmountDisplayOption as M, EToolTipPosition as P } from "./components/CashValue/CashValueTypes.js";
15
- import { FlightBooking as U } from "./components/Bookings/FlightBooking/FlightBooking.js";
16
- import { HotelBooking as H } from "./components/Bookings/HotelBooking/HotelBooking.js";
17
- import { getBaseUrl as N } from "./configs/baseUrl.js";
7
+ import { EAuthFlow as y } from "./types/EAuthFlow.js";
8
+ import { EHotelCurrencyOption as A, currencySymbols as B } from "./types/ECurrency.js";
9
+ import { c as E, i as T } from "./AccountService-D_6U8vP6.js";
10
+ import { clientNoRetryInstance as h } from "./services/noRetryInstance.js";
11
+ import { CurrencyService as v } from "./services/currency/CurrencyService.js";
12
+ import { EBookingType as z } from "./services/trips/TripService.types.js";
13
+ import { awayzClient as S } from "./configs/awayzClient.js";
14
+ import { CashValue as H } from "./components/CashValue/CashValue.js";
15
+ import { EInvalidAmountDisplayOption as O, EToolTipPosition as P } from "./components/CashValue/CashValueTypes.js";
16
+ import { FlightBooking as b } from "./components/Bookings/FlightBooking/FlightBooking.js";
17
+ import { HotelBooking as L } from "./components/Bookings/HotelBooking/HotelBooking.js";
18
+ import { getBaseUrl as R } from "./configs/baseUrl.js";
18
19
  export {
19
20
  r as AwayzProvider,
20
- I as CashValue,
21
- k as CurrencyService,
22
- u as EAuthFlow,
23
- w as EBookingType,
24
- M as EInvalidAmountDisplayOption,
21
+ H as CashValue,
22
+ v as CurrencyService,
23
+ y as EAuthFlow,
24
+ z as EBookingType,
25
+ A as EHotelCurrencyOption,
26
+ O as EInvalidAmountDisplayOption,
25
27
  P as EToolTipPosition,
26
- U as FlightBooking,
27
- H as HotelBooking,
28
- E as awayzClient,
29
- A as clientInstance,
30
- d as clientNoRetryInstance,
31
- N as getBaseUrl,
32
- B as instance,
33
- p as useAwayzContext,
28
+ b as FlightBooking,
29
+ L as HotelBooking,
30
+ S as awayzClient,
31
+ E as clientInstance,
32
+ h as clientNoRetryInstance,
33
+ B as currencySymbols,
34
+ R as getBaseUrl,
35
+ T as instance,
36
+ n as useAwayzContext,
34
37
  c as useBookingManagement,
35
38
  i as useSearchLimit,
36
39
  f as useTripManagement,
37
40
  m as useWallet,
38
- s as validateUpdateTripArgs
41
+ l as validateUpdateTripArgs
39
42
  };
@@ -2,7 +2,7 @@ import "../../AccountService-D_6U8vP6.js";
2
2
  import "./TripService.types.js";
3
3
  import "../../configs/endpoints.js";
4
4
  import "../../arrayExtensions-DlcBOj5a.js";
5
- import { T as s } from "../../TripsService-DvAgBZGs.js";
5
+ import { T as s } from "../../TripsService-BbbkMtx6.js";
6
6
  import "react";
7
7
  export {
8
8
  s as TripsService
@@ -0,0 +1,11 @@
1
+ var D = /* @__PURE__ */ ((U) => (U.AUD = "AUD", U.GBP = "GBP", U.EUR = "EUR", U.USD = "USD", U))(D || {});
2
+ const A = {
3
+ AUD: "A$",
4
+ GBP: "£",
5
+ EUR: "€",
6
+ USD: "$"
7
+ };
8
+ export {
9
+ D as EHotelCurrencyOption,
10
+ A as currencySymbols
11
+ };
@@ -1,4 +1,7 @@
1
- import { EAuthFlow as t } from "./EAuthFlow.js";
1
+ import { EAuthFlow as e } from "./EAuthFlow.js";
2
+ import { EHotelCurrencyOption as c, currencySymbols as l } from "./ECurrency.js";
2
3
  export {
3
- t as EAuthFlow
4
+ e as EAuthFlow,
5
+ c as EHotelCurrencyOption,
6
+ l as currencySymbols
4
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odynn/awayz-core",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"