@odynn/awayz-core 0.6.9 → 0.6.11
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/{TripsService-BHByIiRu.js → TripsService-DrPrX2_z.js} +41 -37
- package/dist/configs/defaultAwayzConfig.js +4 -3
- package/dist/configs/endpoints.js +1 -1
- package/dist/hooks/useTripManagement/useTripManagement.js +1 -1
- package/dist/hooks/useTripManagement/useTripManagement.test.js +1 -1
- package/dist/lib/configs/defaultAwayzConfig.d.ts +1 -0
- package/dist/lib/configs/endpoints.d.ts +1 -1
- package/dist/services/trips/TripsService.js +3 -2
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var g = (
|
|
3
|
-
var
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var g = (r, e, s) => e in r ? l(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var t = (r, e, s) => g(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
4
|
import "./arrayExtensions-DlcBOj5a.js";
|
|
5
|
-
import { c as n, f as p, a as
|
|
5
|
+
import { c as n, f as p, a as c, r as T } from "./AccountService-DGz0jGwx.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { EMyTripsEndpoints as i } from "./configs/endpoints.js";
|
|
8
8
|
import { EBookingType as m } from "./services/trips/TripService.types.js";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { DEFAULT_LOGO as y } from "./configs/defaultAwayzConfig.js";
|
|
10
|
+
const b = "https://assets.duffel.com/img/airlines/for-light-background/full-color-lockup/";
|
|
11
|
+
class f {
|
|
11
12
|
constructor() {
|
|
12
|
-
|
|
13
|
+
t(this, "createTrip", async (e) => {
|
|
13
14
|
const { data: s } = await n.post(
|
|
14
15
|
i.TRIPS,
|
|
15
16
|
p({
|
|
@@ -20,7 +21,7 @@ class b {
|
|
|
20
21
|
);
|
|
21
22
|
return s;
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
+
t(this, "getTripsByStatus", async (e) => {
|
|
24
25
|
const { data: s } = await n.get(
|
|
25
26
|
i.TRIPS,
|
|
26
27
|
{
|
|
@@ -29,77 +30,80 @@ class b {
|
|
|
29
30
|
);
|
|
30
31
|
if (!(s != null && s.success))
|
|
31
32
|
return [];
|
|
32
|
-
const
|
|
33
|
+
const a = s.data.map((d) => ({
|
|
33
34
|
...d,
|
|
34
35
|
flightBookings: u(d.flight_bookings ?? []),
|
|
35
|
-
hotelBookings:
|
|
36
|
+
hotelBookings: _(d.hotel_bookings ?? [])
|
|
36
37
|
}));
|
|
37
|
-
return
|
|
38
|
+
return c(a);
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
-
const { data:
|
|
40
|
+
t(this, "updateTrip", async (e, s) => {
|
|
41
|
+
const { data: a } = await n.put(
|
|
41
42
|
`${i.TRIPS}/${e}`,
|
|
42
43
|
T(p(s))
|
|
43
44
|
);
|
|
44
|
-
return
|
|
45
|
+
return a != null && a.success ? {
|
|
45
46
|
success: !0,
|
|
46
|
-
data:
|
|
47
|
+
data: c(a.data),
|
|
47
48
|
message: "Trip updated successfully."
|
|
48
49
|
} : {
|
|
49
50
|
success: !1,
|
|
50
51
|
message: "An error occurred while trying to update the trip."
|
|
51
52
|
};
|
|
52
53
|
});
|
|
53
|
-
|
|
54
|
+
t(this, "deleteTrip", async (e) => {
|
|
54
55
|
const { data: s } = await n.delete(
|
|
55
56
|
`${i.TRIPS}/${e}`
|
|
56
57
|
);
|
|
57
58
|
return s;
|
|
58
59
|
});
|
|
59
|
-
|
|
60
|
+
t(this, "getUncategorisedBookings", async () => {
|
|
60
61
|
const { data: e } = await n.get(
|
|
61
62
|
i.UNCATEGORISED_BOOKINGS
|
|
62
63
|
);
|
|
63
64
|
return e != null && e.success ? {
|
|
64
65
|
flightBookings: u(e.data.flight_bookings ?? []),
|
|
65
|
-
hotelBookings:
|
|
66
|
+
hotelBookings: _(e.data.hotel_bookings ?? [])
|
|
66
67
|
} : {
|
|
67
68
|
flightBookings: [],
|
|
68
69
|
hotelBookings: []
|
|
69
70
|
};
|
|
70
71
|
});
|
|
71
|
-
|
|
72
|
-
const { data:
|
|
72
|
+
t(this, "addBookingToTrip", async (e, s, a) => {
|
|
73
|
+
const { data: o } = await n.put(i.ADD_BOOKING, {
|
|
73
74
|
trip_id: e,
|
|
74
75
|
booking_id: s,
|
|
75
|
-
booking_type:
|
|
76
|
+
booking_type: a
|
|
76
77
|
});
|
|
77
|
-
return
|
|
78
|
+
return o.success;
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
-
const { data:
|
|
80
|
+
t(this, "removeBookingFromTrip", async (e, s, a) => {
|
|
81
|
+
const { data: o } = await n.put(
|
|
81
82
|
i.REMOVE_BOOKING,
|
|
82
83
|
p({
|
|
83
84
|
trip_id: e,
|
|
84
85
|
booking_id: s,
|
|
85
|
-
booking_type:
|
|
86
|
+
booking_type: a
|
|
86
87
|
})
|
|
87
88
|
);
|
|
88
|
-
return
|
|
89
|
+
return o.success;
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
const u = (
|
|
93
|
-
(e) =>
|
|
93
|
+
const u = (r) => r.map(
|
|
94
|
+
(e) => c({
|
|
94
95
|
id: e._id,
|
|
95
96
|
reference: e.booking_reference,
|
|
96
97
|
startDate: e.departure_date,
|
|
97
98
|
endDate: e.arrival_date,
|
|
98
99
|
bookingType: m.FLIGHT,
|
|
99
|
-
airlines: e.slices.map((s) =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
airlines: e.slices.map((s) => {
|
|
101
|
+
var a;
|
|
102
|
+
return {
|
|
103
|
+
logo: (a = s.carriers.operating_iata_codes) != null && a.length ? `${b}${s.carriers.operating_iata_codes[0]}.svg` : y,
|
|
104
|
+
name: s.carriers.operating[0]
|
|
105
|
+
};
|
|
106
|
+
}),
|
|
103
107
|
arrival: {
|
|
104
108
|
airportCode: e.slices.getLast().destination,
|
|
105
109
|
location: ""
|
|
@@ -115,8 +119,8 @@ const u = (a) => a.map(
|
|
|
115
119
|
type: e.type,
|
|
116
120
|
cancelledAt: e.cancelled_at
|
|
117
121
|
})
|
|
118
|
-
),
|
|
119
|
-
(e) =>
|
|
122
|
+
), _ = (r) => r.map(
|
|
123
|
+
(e) => c({
|
|
120
124
|
id: e._id,
|
|
121
125
|
reference: e.reference,
|
|
122
126
|
startDate: e.check_in_date,
|
|
@@ -130,8 +134,8 @@ const u = (a) => a.map(
|
|
|
130
134
|
bookingId: e.booking_id,
|
|
131
135
|
cancelledAt: e.cancelled_at
|
|
132
136
|
})
|
|
133
|
-
),
|
|
137
|
+
), w = new f();
|
|
134
138
|
export {
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
b as D,
|
|
140
|
+
w as T
|
|
137
141
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const o = {
|
|
1
|
+
const o = "https://awayz.com/favicon.ico", t = {
|
|
2
2
|
testMode: !1,
|
|
3
3
|
externalInventory: !1,
|
|
4
4
|
flightsConfig: {
|
|
5
5
|
streamTimeoutPingCount: 3,
|
|
6
6
|
streamTimeoutTotalSeconds: 180
|
|
7
7
|
},
|
|
8
|
-
logoFallbackImageUrl:
|
|
8
|
+
logoFallbackImageUrl: o
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
|
-
o as
|
|
11
|
+
o as DEFAULT_LOGO,
|
|
12
|
+
t as defaultAwayzConfig
|
|
12
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.LINKED_USER_AWARDS = "user/rewards/user-linked", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e.POINTS_AS_CASH = "/
|
|
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.LINKED_USER_AWARDS = "user/rewards/user-linked", e.USER_CARDS = "user/cards", e.ADD_USER_CARDS = "user/cards/add", e.REMOVE_USER_CARDS = "user/cards/remove", e.BANKS = "banks", e.CARDS = "cards", e.POINTS_AS_CASH = "/points-as-cash/available-points", e))(_ || {}), S = /* @__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))(S || {}), R = /* @__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.ACTION_AIRLINE_CHANGES = "/user/bookings/flights/action-airline-initiated-changes", e))(R || {}), I = /* @__PURE__ */ ((e) => (e.POINTS_PER_CENT = "/user/rewards/points-per-cent", e))(I || {}), N = /* @__PURE__ */ ((e) => (e.USER_PREFERENCES = "/user/user-preferences", e))(N || {});
|
|
2
2
|
export {
|
|
3
3
|
r as EAuthEndpoints,
|
|
4
4
|
R as EBookingEndpoints,
|
|
@@ -2,7 +2,7 @@ import { useQuery as p, useMutation as s } from "@tanstack/react-query";
|
|
|
2
2
|
import { h as m } from "../../arrayExtensions-DlcBOj5a.js";
|
|
3
3
|
import { E as e } from "../../AccountService-DGz0jGwx.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { T as t } from "../../TripsService-
|
|
5
|
+
import { T as t } from "../../TripsService-DrPrX2_z.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
7
|
import { awayzClient as o } from "../../configs/awayzClient.js";
|
|
8
8
|
import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';import '../../assets/_styles.css';import '../../assets/_styles5.css';/* empty css */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as p } from "../../arrayExtensions-DlcBOj5a.js";
|
|
2
|
-
import { D as f } from "../../TripsService-
|
|
2
|
+
import { D as f } from "../../TripsService-DrPrX2_z.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { renderHook as o, waitFor as i } from "../../tests/TestWrapper.js";
|
|
5
5
|
import { EMyTripsEndpoints as c } from "../../configs/endpoints.js";
|
|
@@ -33,7 +33,7 @@ export declare enum EWalletEndpoints {
|
|
|
33
33
|
REMOVE_USER_CARDS = "user/cards/remove",
|
|
34
34
|
BANKS = "banks",
|
|
35
35
|
CARDS = "cards",
|
|
36
|
-
POINTS_AS_CASH = "/
|
|
36
|
+
POINTS_AS_CASH = "/points-as-cash/available-points"
|
|
37
37
|
}
|
|
38
38
|
export declare enum EMyTripsEndpoints {
|
|
39
39
|
TRIPS = "user/trips",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "../../arrayExtensions-DlcBOj5a.js";
|
|
2
2
|
import "../../AccountService-DGz0jGwx.js";
|
|
3
|
-
import { T
|
|
3
|
+
import { T } from "../../TripsService-DrPrX2_z.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../configs/endpoints.js";
|
|
6
6
|
import "./TripService.types.js";
|
|
7
|
+
import "../../configs/defaultAwayzConfig.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
T as TripsService
|
|
9
10
|
};
|