@odynn/awayz-core 0.2.32 → 0.3.0
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-Ct4hShV-.js +2037 -0
- package/dist/DateFormats-DZD30Nea.js +4 -0
- package/dist/{_commonjsHelpers-B52_cu2H.js → _commonjsHelpers-MdHo5S7N.js} +2 -2
- package/dist/{AccountService-8OR0UkZ6.js → arrayExtensions-DlcBOj5a.js} +1338 -3360
- package/dist/assets/FlightBooking.css +1 -0
- package/dist/assets/HotelBooking.css +1 -0
- package/dist/assets/Menu.css +1 -0
- package/dist/components/Bookings/FlightBooking/FlightBooking.js +88 -0
- package/dist/components/Bookings/HotelBooking/HotelBooking.js +75 -0
- package/dist/components/CashValue/CashValue.js +519 -2173
- package/dist/components/CashValue/CashValue.stories.js +18 -17
- package/dist/components/Menu/Menu.js +2491 -0
- package/dist/configs/endpoints.js +4 -2
- package/dist/hooks/useAwayzAuth/useAwayzAuth.js +12 -11
- package/dist/hooks/useBookingManagement/useBookingManagement.js +79 -0
- package/dist/hooks/useBookingManagement/useBookingManagement.test.js +79 -0
- package/dist/hooks/useBookingManagement/useBookingManagement.types.js +1 -0
- package/dist/hooks/useSearchLimit.js +2 -1
- package/dist/hooks/useTripManagement/mocks/index.js +19 -0
- package/dist/hooks/useTripManagement/useTripManagement.js +190 -0
- package/dist/hooks/useTripManagement/useTripManagement.test.js +205 -0
- package/dist/hooks/useTripManagement/useTripManagement.types.js +1 -0
- package/dist/hooks/useWallet/useWallet.js +7 -6
- package/dist/hooks/useWallet/useWallet.test.js +17 -12851
- package/dist/index-COgXcb6p.js +1696 -0
- package/dist/{index-B7QVGqcx.js → index-Cv-wvFlM.js} +1 -1
- package/dist/lib/components/Bookings/FlightBooking/FlightBooking.d.ts +59 -0
- package/dist/lib/components/Bookings/HotelBooking/HotelBooking.d.ts +52 -0
- package/dist/lib/components/Menu/Menu.d.ts +13 -0
- package/dist/lib/configs/endpoints.d.ts +12 -0
- package/dist/lib/hooks/useBookingManagement/mocks/FlightBooking200.json.d.ts +312 -0
- package/dist/lib/hooks/useBookingManagement/mocks/HotelBooking200.json.d.ts +92 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.d.ts +11 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.test.d.ts +1 -0
- package/dist/lib/hooks/useBookingManagement/useBookingManagement.types.d.ts +49 -0
- package/dist/lib/hooks/useTripManagement/mocks/PastTrip200.json.d.ts +20 -0
- package/dist/lib/hooks/useTripManagement/mocks/UncategorisedBookings200.json.d.ts +123 -0
- package/dist/lib/hooks/useTripManagement/mocks/UpcomingTrip200.json.d.ts +20 -0
- package/dist/lib/hooks/useTripManagement/mocks/UpdatedTrip200.json.d.ts +18 -0
- package/dist/lib/hooks/useTripManagement/mocks/index.d.ts +5 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.d.ts +9 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.test.d.ts +1 -0
- package/dist/lib/hooks/useTripManagement/useTripManagement.types.d.ts +109 -0
- package/dist/lib/main.d.ts +1 -0
- package/dist/lib/services/bookings/BookingService.d.ts +10 -0
- package/dist/lib/services/bookings/BookingService.types.d.ts +110 -0
- package/dist/lib/services/trips/TripService.types.d.ts +124 -0
- package/dist/lib/services/trips/TripsService.d.ts +19 -0
- package/dist/main.js +23 -20
- package/dist/providers/AwayzProvider.js +8 -7
- package/dist/services/account/AccountService.js +3 -2
- package/dist/services/bookings/BookingService.js +51 -0
- package/dist/services/bookings/BookingService.types.js +1 -0
- package/dist/services/currency/CurrencyService.js +11 -10
- package/dist/services/index.js +1 -1
- package/dist/services/instance.js +4 -3
- package/dist/services/instanceConfig.js +7 -6
- package/dist/services/noRetryInstance.js +1 -1
- package/dist/services/trips/TripService.types.js +9 -0
- package/dist/services/trips/TripsService.js +81 -0
- package/dist/services/wallet/WalletService.js +18 -23
- package/dist/tests/TestWrapper.js +2 -2
- package/dist/vi.ClIskdbk-k6t29WRA.js +12860 -0
- package/package.json +2 -1
|
@@ -1,6 +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 || {}),
|
|
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 || {});
|
|
2
2
|
export {
|
|
3
3
|
r as EAuthEndpoints,
|
|
4
|
+
I as EBookingEndpoints,
|
|
4
5
|
a as ECurrencyEndpoints,
|
|
5
|
-
S as
|
|
6
|
+
S as EMyTripsEndpoints,
|
|
7
|
+
_ as EWalletEndpoints
|
|
6
8
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
+
import { j as U, e as r, A as o, E as v } from "../../AccountService-Ct4hShV-.js";
|
|
2
3
|
import { useState as E, useCallback as R, useEffect as y } from "react";
|
|
3
4
|
import { EAuthFlow as S } from "../../types/EAuthFlow.js";
|
|
4
5
|
import { awayzClient as A } from "../../configs/awayzClient.js";
|
|
5
6
|
const H = (s, t) => {
|
|
6
|
-
var f,
|
|
7
|
-
let c = "",
|
|
8
|
-
typeof t == "string" ? c = t : t instanceof U ? (c = t.message,
|
|
7
|
+
var f, d;
|
|
8
|
+
let c = "", m = t;
|
|
9
|
+
typeof t == "string" ? c = t : t instanceof U ? (c = t.message, m = {
|
|
9
10
|
message: t.message,
|
|
10
11
|
cause: t.cause,
|
|
11
12
|
status: t.status,
|
|
12
13
|
data: (f = t == null ? void 0 : t.response) == null ? void 0 : f.data
|
|
13
|
-
}) : c = t.message, (
|
|
14
|
+
}) : c = t.message, (d = window.parent) == null || d.postMessage(
|
|
14
15
|
{
|
|
15
16
|
type: "auth_error",
|
|
16
|
-
details: { message: c, action: s, info:
|
|
17
|
+
details: { message: c, action: s, info: m }
|
|
17
18
|
},
|
|
18
19
|
"*"
|
|
19
20
|
);
|
|
20
|
-
},
|
|
21
|
-
const [t, c] = E(!0), [
|
|
21
|
+
}, G = (s) => {
|
|
22
|
+
const [t, c] = E(!0), [m, f] = E(!1), [d, T] = E(), [O, k] = E(), [I, K] = E([]), w = R(
|
|
22
23
|
async (a) => {
|
|
23
24
|
s != null && s.onSuccess && (s == null || s.onSuccess(a)), s != null && s.onSuccessAsync && await (s == null ? void 0 : s.onSuccessAsync(a)), c(!1), f(!0), T(a.token), k(a.user), A.invalidateQueries();
|
|
24
25
|
},
|
|
@@ -135,8 +136,8 @@ const H = (s, t) => {
|
|
|
135
136
|
};
|
|
136
137
|
}, []), {
|
|
137
138
|
isAuthenticating: t,
|
|
138
|
-
isAuthenticated:
|
|
139
|
-
token:
|
|
139
|
+
isAuthenticated: m,
|
|
140
|
+
token: d,
|
|
140
141
|
user: O,
|
|
141
142
|
supportedRegions: I,
|
|
142
143
|
signIn: async (a) => {
|
|
@@ -172,5 +173,5 @@ const H = (s, t) => {
|
|
|
172
173
|
};
|
|
173
174
|
export {
|
|
174
175
|
H as authFailurePostMessage,
|
|
175
|
-
|
|
176
|
+
G as useAwayzAuth
|
|
176
177
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useQuery as n, useMutation as a } from "@tanstack/react-query";
|
|
2
|
+
import { EBookingType as i } from "../../services/trips/TripService.types.js";
|
|
3
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
4
|
+
import { E as o } from "../../AccountService-Ct4hShV-.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { BookingService as e } from "../../services/bookings/BookingService.js";
|
|
7
|
+
import "react/jsx-runtime";
|
|
8
|
+
import "../../context/AwayzContext.js";
|
|
9
|
+
import { awayzClient as s } from "../../configs/awayzClient.js";
|
|
10
|
+
import "../../services/noRetryInstance.js";
|
|
11
|
+
import '../../assets/_styles.css';/* empty css */
|
|
12
|
+
const x = (r, t) => {
|
|
13
|
+
const {
|
|
14
|
+
data: l,
|
|
15
|
+
isError: c,
|
|
16
|
+
error: u
|
|
17
|
+
} = n({
|
|
18
|
+
queryKey: [o.BOOKING, r, t],
|
|
19
|
+
queryFn: () => e.getHotelBooking(r),
|
|
20
|
+
enabled: t === i.HOTEL && !!r
|
|
21
|
+
}), {
|
|
22
|
+
data: m,
|
|
23
|
+
isError: B,
|
|
24
|
+
error: E
|
|
25
|
+
} = n({
|
|
26
|
+
queryKey: [o.BOOKING, r, t],
|
|
27
|
+
queryFn: () => e.getFlightBooking(r),
|
|
28
|
+
enabled: t === i.FLIGHT && !!r
|
|
29
|
+
}), {
|
|
30
|
+
mutate: g,
|
|
31
|
+
isPending: f,
|
|
32
|
+
isError: F,
|
|
33
|
+
error: O
|
|
34
|
+
} = a({
|
|
35
|
+
mutationFn: async () => {
|
|
36
|
+
if (t === i.FLIGHT)
|
|
37
|
+
return e.initiateCancelFlightBooking(r);
|
|
38
|
+
throw new Error("Not supported for hotel bookings");
|
|
39
|
+
},
|
|
40
|
+
onSuccess: () => {
|
|
41
|
+
s.invalidateQueries({
|
|
42
|
+
queryKey: [o.BOOKING, r, t]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}), {
|
|
46
|
+
mutate: h,
|
|
47
|
+
isPending: C,
|
|
48
|
+
isError: H,
|
|
49
|
+
error: K
|
|
50
|
+
} = a({
|
|
51
|
+
mutationFn: async () => {
|
|
52
|
+
if (t === i.FLIGHT)
|
|
53
|
+
return e.confirmCancelFlightBooking(r);
|
|
54
|
+
if (t === i.HOTEL)
|
|
55
|
+
return e.cancelHotelBooking(r);
|
|
56
|
+
},
|
|
57
|
+
onSuccess: () => {
|
|
58
|
+
s.invalidateQueries({
|
|
59
|
+
queryKey: [o.BOOKING, r, t]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}), y = c || B, G = u || E;
|
|
63
|
+
return {
|
|
64
|
+
details: t === i.HOTEL ? l : m,
|
|
65
|
+
isError: y,
|
|
66
|
+
error: G,
|
|
67
|
+
initiateCancellation: g,
|
|
68
|
+
isInitiatingCancellation: f,
|
|
69
|
+
isInitiateCancellationError: F,
|
|
70
|
+
initiateCancellationError: O,
|
|
71
|
+
cancelBooking: h,
|
|
72
|
+
isCancelingBooking: C,
|
|
73
|
+
isCancelBookingError: H,
|
|
74
|
+
cancelBookingError: K
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
x as useBookingManagement
|
|
79
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { renderHook as r, waitFor as c } from "../../tests/TestWrapper.js";
|
|
2
|
+
import { useBookingManagement as i } from "./useBookingManagement.js";
|
|
3
|
+
import { c as o } from "../../AccountService-Ct4hShV-.js";
|
|
4
|
+
import "../../services/noRetryInstance.js";
|
|
5
|
+
import "../../arrayExtensions-DlcBOj5a.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { EBookingEndpoints as a } from "../../configs/endpoints.js";
|
|
8
|
+
import "../../configs/awayzClient.js";
|
|
9
|
+
import "react/jsx-runtime";
|
|
10
|
+
import "../../context/AwayzContext.js";
|
|
11
|
+
import "@tanstack/react-query";
|
|
12
|
+
import { EBookingType as l } from "../../services/trips/TripService.types.js";
|
|
13
|
+
import '../../assets/_styles.css';/* empty css */
|
|
14
|
+
import { d, v as s, t as _, g as t } from "../../vi.ClIskdbk-k6t29WRA.js";
|
|
15
|
+
const p = "Hotel booking found", u = !0, m = { _id: "67f6c1dbbbc4c3c745210abb", user_id: "67d82b1c52c4a4dbe4e640c0", status: "availability confirmed", accommodation_id: "acc_0000AWPt1SGInbu4X9MWOg", number_of_guests: 2, rate_id: "rat_0000AsvJMj2fyryIptLP72", quote_id: "quo_0000AsvJOwZ3PPyHaFBszA", base_amount: "159.08", base_currency: "EUR", tax_amount: null, tax_currency: "EUR", fee_amount: "0.00", fee_currency: "EUR", total_amount: "159.08", total_currency: "EUR", check_in_date: "2025-04-29", check_out_date: "2025-04-30", images: ["https://travelport.leonardocontentcloud.com/imageRepo/7/0/141/226/276/VIENR_7187550009_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/311/VIENR_7830110131_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/406/VIENR_7831079802_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/413/VIENR_7830110068_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/603/VIENR_7836605121_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/617/VIENR_7836587109_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/623/VIENR_7836596533_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/141/226/280/VIENR_7187549817_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/589/VIENR_7836587064_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/365/VIENR_7830109308_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/319/VIENR_8279893960_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/342/VIENR_8279862750_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/303/VIENR_7830110109_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/423/VIENR_7830110088_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/325/VIENR_8279819269_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/307/VIENR_8279804316_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/312/VIENR_8279860525_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/152/865/334/VIENR_8279819315_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/153/641/860/VIENR_8454780814_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/155/931/795/VIENR_8549019991_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/339/VIENR_7830109664_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/386/VIENR_7830109180_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/444/VIENR_7830109282_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/393/VIENR_7830109711_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/331/VIENR_7830109210_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/454/VIENR_7830109964_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/345/VIENR_7831125904_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/294/VIENR_7830109970_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/358/VIENR_7830109736_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/464/VIENR_7830109689_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/319/VIENR_7830109259_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/399/VIENR_7830109928_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/599/VIENR_7836606896_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/609/VIENR_7830109997_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/585/VIENR_7836587084_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/581/VIENR_7836611335_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/433/VIENR_7830109875_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/634/VIENR_7836608919_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/325/VIENR_7830110062_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/629/VIENR_7836587030_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/721/373/VIENR_7830109903_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/147/750/595/VIENR_7836596445_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/7/0/164/563/809/VIENR_8953587933_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/3/0/183/490/977/VIENR_9897245093_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/2/0/184/483/935/VIENR_8953599865_H.jpg"], rooms: [{ beds: [], photo: [], total_amount: "159.08", name: "Standard Room When You Arrive At The Hotel We Will Do Our Best To Meet Your Room Type" }], address: { line_one: "RECHTE WIENZEILE 87", city_name: "VIENNA", postal_code: "1050 ", country_code: "AT", region: null }, guests: [], created_at: "2025-04-09T18:52:11.461Z", updated_at: "2025-04-09T18:52:11.461Z", __v: 0 }, g = {
|
|
16
|
+
message: p,
|
|
17
|
+
success: u,
|
|
18
|
+
data: m
|
|
19
|
+
}, y = { _id: "6811290ef16af25943018944", flight_offer_id: "off_0000AtaoutgusFy7zHL7pJ", user_id: "67d82b1c52c4a4dbe4e640c0", status: "flight confirmed", available_actions: ["cancel", "change", "update"], total_currency: "USD", arrival_date: "2025-05-28T21:46:00.000Z", base_amount: "196.19", extras_amount: "0.00", extras_currency: "USD", base_currency: "USD", conditions: { refund_before_departure: { penalty_currency: null, penalty_amount: null, allowed: !1 }, change_before_departure: { penalty_currency: "GBP", penalty_amount: "30.00", allowed: !0 } }, departure_date: "2025-05-28T18:54:00.000Z", passengers: [{ id: "pas_0000AtaoutTnf1TdKbCeNV", type: null }], slices: [{ carriers: { marketing: ["Duffel Airways"], operating: ["Duffel Airways"] }, id: "sli_0000AtaoutgusFy7zHL7pI", origin: "JFK", destination: "LAX", fare_brand_name: null }], tax_amount: "35.31", tax_currency: "USD", total_amount: "231.50", type: "instant", synced_at: "2025-04-29T19:31:52Z", order_id: "ord_0000AtapDdwhJRoTNzMZrU", booking_reference: "4LGE5O", cancelled_at: null, payment_status: { paid_at: "2025-04-29T19:31:52Z", price_guarantee_expires_at: null, payment_required_by: null, awaiting_payment: !1 }, documents: [{ passenger_ids: ["pas_0000AtaoutTnf1TdKbCeNV"], unique_identifier: "1", type: "electronic_ticket" }], services: [], createdAt: "2025-04-29T19:31:26.348Z", updatedAt: "2025-04-29T19:31:52.467Z", __v: 0, data: { void_window_ends_at: null, documents: [{ passenger_ids: ["pas_0000AtaoutTnf1TdKbCeNV"], unique_identifier: "1", type: "electronic_ticket" }], synced_at: "2025-04-29T19:31:52Z", available_actions: ["update"], airline_initiated_changes: [], cancellation: null, tax_currency: "USD", base_currency: "USD", base_amount: "196.19", tax_amount: "35.31", total_currency: "USD", offer_id: "off_0000AtaoutgusFy7zHL7pJ", booking_reference: "4LGE5O", created_at: "2025-04-29T19:31:52.316759Z", payment_status: { paid_at: "2025-04-29T19:31:52Z", price_guarantee_expires_at: null, payment_required_by: null, awaiting_payment: !1 }, live_mode: !1, total_amount: "231.50", slices: [{ destination_type: "airport", origin_type: "airport", fare_brand_name: "Basic", segments: [{ origin_terminal: "2", destination_terminal: "1", aircraft: { iata_code: "773", name: "Boeing 777-300", id: "arc_00009VMF8AhXSSRnQDI6HE" }, departing_at: "2025-05-28T20:54:00", arriving_at: "2025-05-28T23:46:00", operating_carrier: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, marketing_carrier: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, stops: [], operating_carrier_flight_number: "2682", marketing_carrier_flight_number: "2682", distance: "3974.2717774447433", passengers: [{ baggages: [{ quantity: 1, type: "checked" }, { quantity: 1, type: "carry_on" }], cabin_class_marketing_name: "Economy", passenger_id: "pas_0000AtaoutTnf1TdKbCeNV", seat: null, cabin_class: "economy" }], duration: "PT5H52M", destination: { city_name: "Los Angeles", icao_code: "KLAX", iata_country_code: "US", iata_code: "LAX", iata_city_code: "LAX", latitude: 33.942045, longitude: -118.408263, city: { city_name: null, icao_code: null, iata_country_code: "US", iata_code: "LAX", iata_city_code: "LAX", latitude: null, longitude: null, time_zone: null, type: "city", name: "Los Angeles", id: "cit_lax_us" }, time_zone: "America/Los_Angeles", type: "airport", name: "Los Angeles International Airport", id: "arp_lax_us" }, origin: { city_name: "New York", icao_code: "KJFK", iata_country_code: "US", iata_code: "JFK", iata_city_code: "NYC", latitude: 40.640556, longitude: -73.778519, city: { city_name: null, icao_code: null, iata_country_code: "US", iata_code: "NYC", iata_city_code: "NYC", latitude: null, longitude: null, time_zone: null, type: "city", name: "New York", id: "cit_nyc_us" }, time_zone: "America/New_York", type: "airport", name: "John F. Kennedy International Airport", id: "arp_jfk_us" }, id: "seg_0000AtaoutgusFy7zHL7pH" }], conditions: { change_before_departure: { penalty_currency: "GBP", penalty_amount: "30.00", allowed: !0 } }, duration: "PT5H52M", destination: { city_name: "Los Angeles", icao_code: "KLAX", iata_country_code: "US", iata_code: "LAX", iata_city_code: "LAX", latitude: 33.942045, longitude: -118.408263, city: { city_name: null, icao_code: null, iata_country_code: "US", iata_code: "LAX", iata_city_code: "LAX", latitude: null, longitude: null, time_zone: null, type: "city", name: "Los Angeles", id: "cit_lax_us" }, time_zone: "America/Los_Angeles", type: "airport", name: "Los Angeles International Airport", id: "arp_lax_us" }, origin: { city_name: "New York", icao_code: "KJFK", iata_country_code: "US", iata_code: "JFK", iata_city_code: "NYC", latitude: 40.640556, longitude: -73.778519, city: { city_name: null, icao_code: null, iata_country_code: "US", iata_code: "NYC", iata_city_code: "NYC", latitude: null, longitude: null, time_zone: null, type: "city", name: "New York", id: "cit_nyc_us" }, time_zone: "America/New_York", type: "airport", name: "John F. Kennedy International Airport", id: "arp_jfk_us" }, id: "sli_0000AtaoutgusFy7zHL7pI" }], passengers: [{ born_on: "2007-04-29", loyalty_programme_accounts: [], family_name: "Botha", given_name: "Adriaan", gender: "m", infant_passenger_id: null, phone_number: "+12345642342", user_id: null, email: "adriaan.botha@typedev.co.za", title: "mr", type: "adult", id: "pas_0000AtaoutTnf1TdKbCeNV" }], conditions: { refund_before_departure: { penalty_currency: null, penalty_amount: null, allowed: !1 }, change_before_departure: { penalty_currency: "GBP", penalty_amount: "30.00", allowed: !0 } }, cancelled_at: null, changes: [], content: "managed", services: [], users: ["icu_0000Asbm8q0FlWOhf0fDUm"], metadata: null, type: "instant", owner: { logo_symbol_url: "https://assets.duffel.com/img/airlines/for-light-background/full-color-logo/ZZ.svg", logo_lockup_url: null, conditions_of_carriage_url: "https://duffelairways.com/dummy-url/conditions-of-carriage", iata_code: "ZZ", name: "Duffel Airways", id: "arl_00009VME7D6ivUu8dn35WK" }, id: "ord_0000AtapDdwhJRoTNzMZrU" } }, f = "Flight booking found", R = !0, h = {
|
|
20
|
+
data: y,
|
|
21
|
+
message: f,
|
|
22
|
+
success: R
|
|
23
|
+
};
|
|
24
|
+
d("useBookingManagement", () => {
|
|
25
|
+
s.mocked(o.get).mockImplementation((e) => e.includes(a.USER_HOTEL_BOOKINGS) ? Promise.resolve({
|
|
26
|
+
data: g
|
|
27
|
+
}) : e.includes(a.USER_FLIGHT_BOOKINGS) ? Promise.resolve({
|
|
28
|
+
data: h
|
|
29
|
+
}) : Promise.resolve({ data: {} })), s.mocked(o.post).mockImplementation((e) => e.includes(a.CANCEL_HOTEL_BOOKING) ? Promise.resolve({
|
|
30
|
+
data: { success: !0 }
|
|
31
|
+
}) : Promise.resolve({ data: {} })), s.mocked(o.put).mockImplementation(() => Promise.resolve({ data: { success: !0 } })), d("Hotel Booking Management", () => {
|
|
32
|
+
_("Can fetch hotel booking by id", async () => {
|
|
33
|
+
const { result: e } = r(
|
|
34
|
+
() => i("67f6c1dbbbc4c3c745210abb", l.HOTEL)
|
|
35
|
+
);
|
|
36
|
+
await c(() => {
|
|
37
|
+
var n;
|
|
38
|
+
t(e.current.details).toBeDefined(), t((n = e.current.details) == null ? void 0 : n.id).toBe("67f6c1dbbbc4c3c745210abb");
|
|
39
|
+
});
|
|
40
|
+
}), _("Can cancel hotel booking", async () => {
|
|
41
|
+
const { result: e } = r(
|
|
42
|
+
() => i("67f6c1dbbbc4c3c745210abb", l.HOTEL)
|
|
43
|
+
);
|
|
44
|
+
e.current.cancelBooking(), await c(() => {
|
|
45
|
+
t(e.current.isCancelingBooking).toBe(!1), t(e.current.isCancelBookingError).toBe(!1), t(o.post).toHaveBeenCalledWith(
|
|
46
|
+
`${a.CANCEL_HOTEL_BOOKING}/67f6c1dbbbc4c3c745210abb`
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}), d("Flight Booking Management", () => {
|
|
51
|
+
_("Can fetch flight booking by id", async () => {
|
|
52
|
+
const { result: e } = r(
|
|
53
|
+
() => i("6811290ef16af25943018944", l.FLIGHT)
|
|
54
|
+
);
|
|
55
|
+
await c(() => {
|
|
56
|
+
var n;
|
|
57
|
+
t(e.current.details).toBeDefined(), t((n = e.current.details) == null ? void 0 : n.id).toBe("6811290ef16af25943018944");
|
|
58
|
+
});
|
|
59
|
+
}), _("Can initiate cancellation of flight booking", async () => {
|
|
60
|
+
const { result: e } = r(
|
|
61
|
+
() => i("6811290ef16af25943018944", l.FLIGHT)
|
|
62
|
+
);
|
|
63
|
+
e.current.initiateCancellation(), await c(() => {
|
|
64
|
+
t(e.current.isInitiatingCancellation).toBe(!1), t(e.current.isInitiateCancellationError).toBe(!1), t(o.put).toHaveBeenCalledWith(
|
|
65
|
+
`${a.INITIATE_FLIGHT_CANCEL}/6811290ef16af25943018944`
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
}), _("Can confirm cancellation of flight booking", async () => {
|
|
69
|
+
const { result: e } = r(
|
|
70
|
+
() => i("6811290ef16af25943018944", l.FLIGHT)
|
|
71
|
+
);
|
|
72
|
+
e.current.cancelBooking(), await c(() => {
|
|
73
|
+
t(e.current.isCancelingBooking).toBe(!1), t(e.current.isCancelBookingError).toBe(!1), t(o.put).toHaveBeenCalledWith(
|
|
74
|
+
`${a.CONFIRM_FLIGHT_CANCEL}/6811290ef16af25943018944`
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { E as s,
|
|
1
|
+
import { E as s, A as i, b as n } from "../AccountService-Ct4hShV-.js";
|
|
2
2
|
import { useQuery as u } from "@tanstack/react-query";
|
|
3
|
+
import "../arrayExtensions-DlcBOj5a.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { useAwayzContext as c } from "./useAwayzContext.js";
|
|
5
6
|
var o = /* @__PURE__ */ ((e) => (e.HOTEL = "Hotel", e.FLIGHT = "Flight", e))(o || {});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const e = [{ _id: "682f2c81a6cc24f39d99eefe", name: "Jet's Landed", user_id: "67fd23bc3a7cbcd0a8757cdc", start_date: "2025-01-21", end_date: "2025-01-26", hotel_bookings: [], flight_bookings: [], created_at: "2025-05-22T13:54:09.085Z", updated_at: "2025-05-22T13:57:31.638Z", __v: 0 }], s = {
|
|
2
|
+
success: !0,
|
|
3
|
+
data: e
|
|
4
|
+
}, a = !0, t = [{ _id: "682f2c51a6cc24f39d99eecb", name: "Jet's JumpOff", user_id: "67fd23bc3a7cbcd0a8757cdc", start_date: "2025-06-23", end_date: "2025-06-26", hotel_bookings: [], flight_bookings: [], created_at: "2025-05-22T13:53:21.392Z", updated_at: "2025-05-22T13:53:21.392Z", __v: 0 }], o = {
|
|
5
|
+
success: a,
|
|
6
|
+
data: t
|
|
7
|
+
}, c = !0, n = { _id: "682ffebaa6cc24f39d99fdc7", name: "Updated Trip", user_id: "67fd23bc3a7cbcd0a8757cdc", start_date: "2025-09-09", end_date: "2025-09-21", hotel_bookings: [], flight_bookings: [], created_at: "2025-05-23T04:51:06.811Z", updated_at: "2025-05-23T05:30:47.144Z", __v: 0 }, r = {
|
|
8
|
+
success: c,
|
|
9
|
+
data: n
|
|
10
|
+
}, _ = !0, d = { hotel_bookings: [{ _id: "6839bfd88672ca8a09862823", user_id: "67d82b1c52c4a4dbe4e640c0", status: "booking confirmed", accommodation_id: "acc_0000AWPszvlu6zjbTePuxQ", number_of_guests: 2, rate_id: "rat_0000Aucdmscz0HEHDGqxfc", quote_id: "quo_0000AucdnqAnrnymNn6EzF", base_amount: "2970.00", base_currency: "EUR", tax_amount: "0.00", tax_currency: "EUR", fee_amount: "0.00", fee_currency: "EUR", total_amount: "2970.00", total_currency: "EUR", check_in_date: "2025-06-23", check_out_date: "2025-06-29", images: ["https://travelport.leonardocontentcloud.com/imageRepo/7/0/166/647/121/vierz-entrance-6310-hor-clsc_H.jpg", "https://travelport.leonardocontentcloud.com/imageRepo/3/0/183/668/598/rz-vierz-vienna-sunset-38389_Classic-Hor_H.jpg"], rooms: [{ beds: null, photos: [], total_amount: "2970.00", name: "Deluxe, Guest Room, 1 King" }], address: { line_one: "Schubertring 5-7", city_name: "Vienna", postal_code: "1010 ", country_code: "AT", region: null }, guests: [{ family_name: "Botha", given_name: "Adriaan", user_id: null }, { family_name: "Doe", given_name: "John", user_id: null }], created_at: "2025-05-30T14:25:28.716Z", updated_at: "2025-05-30T14:27:08.631Z", __v: 0, booking_id: "bok_0000Aucdx2TzTC0lAMSc24", reference: "OY3EHG" }], flight_bookings: [{ _id: "6839beb48672ca8a09862483", flight_offer_id: "off_0000AucdLMS6m6Um63c7m8", user_id: "67d82b1c52c4a4dbe4e640c0", status: "flight confirmed", available_actions: ["cancel", "change", "update"], total_currency: "USD", arrival_date: "2025-07-04T02:16:00.000Z", base_amount: "76.27", extras_amount: "0.00", extras_currency: "USD", base_currency: "USD", conditions: { refund_before_departure: { penalty_currency: "GBP", penalty_amount: "10.00", allowed: !0 }, change_before_departure: { penalty_currency: null, penalty_amount: null, allowed: !1 } }, departure_date: "2025-07-04T00:19:00.000Z", passengers: [{ id: "pas_0000AucdLMBnkjS3HTz6NZ", type: null }], slices: [{ id: "sli_0000AucdLMS6m6Um63c7m7", origin: "VIE", destination: "CDG", fare_brand_name: null, carriers: { marketing: ["Duffel Airways"], operating: ["Duffel Airways"] } }], tax_amount: "13.73", tax_currency: "USD", total_amount: "90.00", type: "instant", synced_at: "2025-05-30T14:21:11Z", order_id: "ord_0000AucdQ6tTnRRInXiCLg", booking_reference: "QGEHM5", cancelled_at: null, payment_status: { paid_at: "2025-05-30T14:21:11Z", price_guarantee_expires_at: null, payment_required_by: null, awaiting_payment: !1 }, documents: [{ passenger_ids: ["pas_0000AucdLMBnkjS3HTz6NZ"], unique_identifier: "1", type: "electronic_ticket" }], services: [], createdAt: "2025-05-30T14:20:36.839Z", updatedAt: "2025-05-30T14:21:11.541Z", __v: 0 }] }, i = {
|
|
11
|
+
success: _,
|
|
12
|
+
data: d
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
s as PastTrip200,
|
|
16
|
+
i as UncategorisedBookings200,
|
|
17
|
+
o as UpcomingTrip200,
|
|
18
|
+
r as UpdatedTrip200
|
|
19
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { useQuery as d, useMutation as p } from "@tanstack/react-query";
|
|
2
|
+
import { h as c } from "../../arrayExtensions-DlcBOj5a.js";
|
|
3
|
+
import { E as e } from "../../AccountService-Ct4hShV-.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { TripsService as o } from "../../services/trips/TripsService.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "../../context/AwayzContext.js";
|
|
8
|
+
import { awayzClient as t } from "../../configs/awayzClient.js";
|
|
9
|
+
import "../../services/noRetryInstance.js";
|
|
10
|
+
import '../../assets/_styles.css';/* empty css */
|
|
11
|
+
const U = ({
|
|
12
|
+
tripId: s,
|
|
13
|
+
tripDetails: a
|
|
14
|
+
}) => {
|
|
15
|
+
if (!s)
|
|
16
|
+
throw new Error("Trip ID is required");
|
|
17
|
+
if (!a || Object.keys(a).length === 0)
|
|
18
|
+
throw new Error("Trip details must be provided for update");
|
|
19
|
+
}, z = () => {
|
|
20
|
+
const { data: s = [] } = d({
|
|
21
|
+
queryKey: [
|
|
22
|
+
e.TRIPS,
|
|
23
|
+
"past"
|
|
24
|
+
/* PAST */
|
|
25
|
+
],
|
|
26
|
+
queryFn: () => o.getTripsByStatus(
|
|
27
|
+
"past"
|
|
28
|
+
/* PAST */
|
|
29
|
+
)
|
|
30
|
+
}), { data: a = [] } = d({
|
|
31
|
+
queryKey: [
|
|
32
|
+
e.TRIPS,
|
|
33
|
+
"upcoming"
|
|
34
|
+
/* UPCOMING */
|
|
35
|
+
],
|
|
36
|
+
queryFn: () => o.getTripsByStatus(
|
|
37
|
+
"upcoming"
|
|
38
|
+
/* UPCOMING */
|
|
39
|
+
)
|
|
40
|
+
}), { data: n } = d({
|
|
41
|
+
queryKey: [e.UNCATEGORISED_BOOKINGS],
|
|
42
|
+
queryFn: () => o.getUncategorisedBookings()
|
|
43
|
+
}), {
|
|
44
|
+
mutate: y,
|
|
45
|
+
isPending: g,
|
|
46
|
+
isError: m,
|
|
47
|
+
error: E
|
|
48
|
+
} = p({
|
|
49
|
+
mutationFn: async ({ tripId: r, tripDetails: i }) => (U({ tripId: r, tripDetails: i }), await o.updateTrip(r, i)),
|
|
50
|
+
onSuccess: () => {
|
|
51
|
+
t.invalidateQueries({
|
|
52
|
+
queryKey: [
|
|
53
|
+
e.TRIPS,
|
|
54
|
+
"past"
|
|
55
|
+
/* PAST */
|
|
56
|
+
]
|
|
57
|
+
}), t.invalidateQueries({
|
|
58
|
+
queryKey: [
|
|
59
|
+
e.TRIPS,
|
|
60
|
+
"upcoming"
|
|
61
|
+
/* UPCOMING */
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}), {
|
|
66
|
+
mutate: l,
|
|
67
|
+
isPending: w,
|
|
68
|
+
isError: q,
|
|
69
|
+
error: S
|
|
70
|
+
} = p({
|
|
71
|
+
mutationFn: async (r) => {
|
|
72
|
+
if (!r)
|
|
73
|
+
throw new Error("Trip details are required to create a trip");
|
|
74
|
+
if (!r.name || !r.startDate || !r.endDate)
|
|
75
|
+
throw new Error("Trip name, start date, and end date are required");
|
|
76
|
+
return await o.createTrip(r);
|
|
77
|
+
},
|
|
78
|
+
onSuccess: () => {
|
|
79
|
+
t.invalidateQueries({
|
|
80
|
+
queryKey: [
|
|
81
|
+
e.TRIPS,
|
|
82
|
+
"past"
|
|
83
|
+
/* PAST */
|
|
84
|
+
]
|
|
85
|
+
}), t.invalidateQueries({
|
|
86
|
+
queryKey: [
|
|
87
|
+
e.TRIPS,
|
|
88
|
+
"upcoming"
|
|
89
|
+
/* UPCOMING */
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}), {
|
|
94
|
+
mutate: P,
|
|
95
|
+
isPending: f,
|
|
96
|
+
isError: h,
|
|
97
|
+
error: K
|
|
98
|
+
} = p({
|
|
99
|
+
mutationFn: async (r) => {
|
|
100
|
+
if (!r)
|
|
101
|
+
throw new Error("Trip ID is required to delete a trip");
|
|
102
|
+
await o.deleteTrip(r);
|
|
103
|
+
},
|
|
104
|
+
onSuccess: () => {
|
|
105
|
+
t.invalidateQueries({
|
|
106
|
+
queryKey: [
|
|
107
|
+
e.TRIPS,
|
|
108
|
+
"past"
|
|
109
|
+
/* PAST */
|
|
110
|
+
]
|
|
111
|
+
}), t.invalidateQueries({
|
|
112
|
+
queryKey: [
|
|
113
|
+
e.TRIPS,
|
|
114
|
+
"upcoming"
|
|
115
|
+
/* UPCOMING */
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}), {
|
|
120
|
+
mutate: k,
|
|
121
|
+
isPending: B,
|
|
122
|
+
isError: I,
|
|
123
|
+
error: v
|
|
124
|
+
} = p({
|
|
125
|
+
mutationFn: async ({
|
|
126
|
+
tripId: r,
|
|
127
|
+
booking: i
|
|
128
|
+
}) => {
|
|
129
|
+
if (!r)
|
|
130
|
+
throw new Error("Trip ID is required to add a booking");
|
|
131
|
+
if (!i)
|
|
132
|
+
throw new Error("Booking is required to add a booking");
|
|
133
|
+
return await o.addBookingToTrip(
|
|
134
|
+
r,
|
|
135
|
+
i.id,
|
|
136
|
+
i.bookingType
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
onSuccess: () => {
|
|
140
|
+
t.invalidateQueries({
|
|
141
|
+
queryKey: [
|
|
142
|
+
e.TRIPS,
|
|
143
|
+
"past"
|
|
144
|
+
/* PAST */
|
|
145
|
+
]
|
|
146
|
+
}), t.invalidateQueries({
|
|
147
|
+
queryKey: [
|
|
148
|
+
e.TRIPS,
|
|
149
|
+
"upcoming"
|
|
150
|
+
/* UPCOMING */
|
|
151
|
+
]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}), R = [...s, ...a], u = (n == null ? void 0 : n.flightBookings) || [], T = (n == null ? void 0 : n.hotelBookings) || [], Q = [
|
|
155
|
+
...u,
|
|
156
|
+
...T
|
|
157
|
+
].sort((r, i) => c(r.startDate).diff(c(i.startDate)));
|
|
158
|
+
return {
|
|
159
|
+
// Trips
|
|
160
|
+
allTrips: R,
|
|
161
|
+
pastTrips: s,
|
|
162
|
+
upcomingTrips: a,
|
|
163
|
+
// Bookings
|
|
164
|
+
allUncategorisedBookings: Q,
|
|
165
|
+
uncategorisedFlightBookings: u,
|
|
166
|
+
uncategorisedHotelBookings: T,
|
|
167
|
+
// Trip Management
|
|
168
|
+
createTrip: l,
|
|
169
|
+
isCreateTripPending: w,
|
|
170
|
+
isCreateTripError: q,
|
|
171
|
+
createTripError: S,
|
|
172
|
+
updateTrip: y,
|
|
173
|
+
isUpdateTripPending: g,
|
|
174
|
+
isUpdateTripError: m,
|
|
175
|
+
updateTripError: E,
|
|
176
|
+
deleteTrip: P,
|
|
177
|
+
isDeleteTripPending: f,
|
|
178
|
+
isDeleteTripError: h,
|
|
179
|
+
deleteTripError: K,
|
|
180
|
+
// Booking Management
|
|
181
|
+
addBookingToTrip: k,
|
|
182
|
+
isAddBookingToTripPending: B,
|
|
183
|
+
isAddBookingToTripError: I,
|
|
184
|
+
addBookingToTripError: v
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
z as useTripManagement,
|
|
189
|
+
U as validateUpdateTripArgs
|
|
190
|
+
};
|