@odynn/awayz-hotels 0.12.4 → 0.12.6
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/components/HotelResult/HotelResult.js +6 -6
- package/dist/definitions/HotelChains.js +2 -1
- package/dist/hooks/useAvailabilityAlertNotifications/useAvailabilityAlertNotifications.js +3 -2
- package/dist/hooks/useAvailabilityAlerts/useAvailabilityAlerts.js +20 -24
- package/dist/hooks/useHotelDetails/useHotelDetails.api.js +36 -35
- package/dist/hooks/useHotelDetails/useHotelDetails.js +7 -6
- package/dist/hooks/useHotelSearch/useHotelSearch.js +9 -8
- package/dist/hooks/useLocationSearch/useLocationSearch.js +15 -14
- package/dist/lib/hooks/useHotelDetails/useHotelDetails.api.d.ts +1 -1
- package/dist/lib/hooks/useHotelDetails/useHotelDetails.d.ts +1 -1
- package/dist/lib/services/availabilityAlerts/AvailabilityAlertsService.d.ts +3 -3
- package/dist/lib/services/booking/BookingService.d.ts +2 -2
- package/dist/lib/services/booking/BookingService.mappers.d.ts +14 -0
- package/dist/lib/services/booking/BookingService.types.d.ts +11 -6
- package/dist/lib/services/hotel/HotelService.d.ts +4 -4
- package/dist/lib/services/hotel/HotelService.mappers.d.ts +24 -0
- package/dist/lib/services/hotel/HotelService.types.d.ts +109 -0
- package/dist/lib/services/wallet/WalletService.mappers.d.ts +21 -0
- package/dist/services/availabilityAlerts/AvailabilityAlertsService.js +56 -27
- package/dist/services/booking/BookingService.js +26 -29
- package/dist/services/booking/BookingService.mappers.js +113 -0
- package/dist/services/hotel/HotelService.js +35 -44
- package/dist/services/hotel/HotelService.mappers.js +218 -0
- package/dist/services/wallet/WalletService.js +26 -29
- package/dist/services/wallet/WalletService.mappers.js +74 -0
- package/package.json +1 -1
- package/dist/objectUtils-Br6N9tQs.js +0 -15
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as Q, jsxs as C, Fragment as D } from "react/jsx-runtime";
|
|
2
2
|
import { useFeatureFlags as _, EAmountsDisplayFeature as E, CashValue as U, ClientPointsValue as F } from "@odynn/awayz-core";
|
|
3
|
-
import {
|
|
4
|
-
import { h as CA } from "../../moment-BGjjqtLQ.js";
|
|
3
|
+
import { h as $ } from "../../moment-BGjjqtLQ.js";
|
|
5
4
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
|
+
import { p as AA, o as CA } from "../../stringUtils-BmTiWFHF.js";
|
|
6
6
|
import { useState as L, useRef as QA, useEffect as v } from "react";
|
|
7
7
|
import { G as IA, d as gA, e as BA, f as EA, c as eA, g as tA, h as aA } from "../../index-dGpDC9bM.js";
|
|
8
8
|
import { HotelChains as rA } from "../../definitions/HotelChains.js";
|
|
@@ -10,12 +10,12 @@ import { EHotelSortOption as nA } from "../../enums/index.js";
|
|
|
10
10
|
import { getHotelImageUrls as oA, getBookingOptions as lA, isDuffelHotelId as sA, getHotelRatingInfo as cA, loadImageWithFallback as vA } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
11
11
|
import { Ratings as dA, ERatingColor as fA } from "../Banners/Ratings/Ratings.js";
|
|
12
12
|
import '../../assets/_styles.css';/* empty css */
|
|
13
|
-
const iA = (...A) => A.join(" ");
|
|
14
13
|
function j(A, n = !0) {
|
|
15
14
|
if ((!A || isNaN(A) || A < 0) && n) return "N/A";
|
|
16
15
|
let I = A == null ? void 0 : A.toString().split(".")[0];
|
|
17
16
|
return I == null ? void 0 : I.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
18
17
|
}
|
|
18
|
+
const iA = (...A) => A.join(" ");
|
|
19
19
|
function T(A) {
|
|
20
20
|
return IA({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M316.9 18C311.6 7 300.4 0 288.1 0s-23.4 7-28.8 18L195 150.3 51.4 171.5c-12 1.8-22 10.2-25.7 21.7s-.7 24.2 7.9 32.7L137.8 329 113.2 474.7c-2 12 3 24.2 12.9 31.3s23 8 33.8 2.3l128.3-68.5 128.3 68.5c10.8 5.7 23.9 4.9 33.8-2.3s14.9-19.3 12.9-31.3L438.5 329 542.7 225.9c8.6-8.5 11.7-21.2 7.9-32.7s-13.7-19.9-25.7-21.7L381.2 150.3 316.9 18z" }, child: [] }] })(A);
|
|
21
21
|
}
|
|
@@ -63,7 +63,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
|
|
|
63
63
|
if (c.stopPropagation(), o) o(A);
|
|
64
64
|
else
|
|
65
65
|
throw new Error("Could not display availability calendar.");
|
|
66
|
-
}, p = typeof A.nthNightFree == "number" && A.nthNightFree > 0, b = x && !sA(A.hotelId) && g.amountsDisplayFeature === E.CASH_AND_TRAVEL_PARTNER_POINTS, B =
|
|
66
|
+
}, p = typeof A.nthNightFree == "number" && A.nthNightFree > 0, b = x && !sA(A.hotelId) && g.amountsDisplayFeature === E.CASH_AND_TRAVEL_PARTNER_POINTS, B = $(G).diff(m, "days") || 1, H = a * B, S = p ? A.awardPoints : A.points, z = S * B, M = j(S), Z = j(z);
|
|
67
67
|
return /* @__PURE__ */ Q(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
@@ -119,7 +119,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
|
|
|
119
119
|
/* @__PURE__ */ C("p", { children: [
|
|
120
120
|
B,
|
|
121
121
|
" ",
|
|
122
|
-
|
|
122
|
+
AA(B, "Night")
|
|
123
123
|
] })
|
|
124
124
|
] }),
|
|
125
125
|
A.freeNight && /* @__PURE__ */ C("div", { children: [
|
|
@@ -129,7 +129,7 @@ const hA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
|
|
|
129
129
|
W && p && /* @__PURE__ */ C("div", { children: [
|
|
130
130
|
/* @__PURE__ */ Q(tA, {}),
|
|
131
131
|
/* @__PURE__ */ C("p", { children: [
|
|
132
|
-
|
|
132
|
+
CA(A.nthNightFree),
|
|
133
133
|
" Night Free"
|
|
134
134
|
] })
|
|
135
135
|
] }),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
2
|
import "../moment-BGjjqtLQ.js";
|
|
3
3
|
import "../arrayExtensions-CFEBYUok.js";
|
|
4
|
+
import { c as o } from "../stringUtils-BmTiWFHF.js";
|
|
4
5
|
import "react";
|
|
5
6
|
const t = {
|
|
6
7
|
Marriott: "marriott",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { awayzClient as i } from "@odynn/awayz-core";
|
|
2
2
|
import { useQuery as m, useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import "react/jsx-runtime";
|
|
3
4
|
import "../../moment-BGjjqtLQ.js";
|
|
4
5
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
6
|
import { E as e } from "../../enums-DPFgYLjY.js";
|
|
6
7
|
import "react";
|
|
7
8
|
import { AvailabilityAlertsService as r } from "../../services/availabilityAlerts/AvailabilityAlertsService.js";
|
|
8
|
-
const
|
|
9
|
+
const N = () => {
|
|
9
10
|
const {
|
|
10
11
|
data: a = [],
|
|
11
12
|
error: o,
|
|
@@ -39,5 +40,5 @@ const E = () => {
|
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
N as useAvailabilityAlertNotifications
|
|
43
44
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { awayzClient as v } from "@odynn/awayz-core";
|
|
2
2
|
import { useQuery as f, useMutation as p } from "@tanstack/react-query";
|
|
3
|
+
import "react/jsx-runtime";
|
|
3
4
|
import "../../moment-BGjjqtLQ.js";
|
|
4
5
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
|
-
import { c as b } from "../../objectUtils-Br6N9tQs.js";
|
|
6
6
|
import { E as u } from "../../enums-DPFgYLjY.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { AvailabilityAlertsService as
|
|
9
|
-
const
|
|
8
|
+
import { AvailabilityAlertsService as d } from "../../services/availabilityAlerts/AvailabilityAlertsService.js";
|
|
9
|
+
const b = ({
|
|
10
10
|
checkin: r,
|
|
11
11
|
checkout: t,
|
|
12
12
|
hotelGroup: a,
|
|
@@ -41,7 +41,7 @@ const h = ({
|
|
|
41
41
|
throw new Error("Hotel description is required");
|
|
42
42
|
if (!A)
|
|
43
43
|
throw new Error("Hotel program name is required");
|
|
44
|
-
},
|
|
44
|
+
}, h = ({
|
|
45
45
|
alertId: r,
|
|
46
46
|
checkin: t,
|
|
47
47
|
checkout: a,
|
|
@@ -51,8 +51,8 @@ const h = ({
|
|
|
51
51
|
hotelImage: i,
|
|
52
52
|
hotelAddress: s,
|
|
53
53
|
hotelDescription: A,
|
|
54
|
-
hotelProgramName:
|
|
55
|
-
archived:
|
|
54
|
+
hotelProgramName: w,
|
|
55
|
+
archived: y,
|
|
56
56
|
acknowledged: E
|
|
57
57
|
}) => {
|
|
58
58
|
if (!r)
|
|
@@ -66,27 +66,27 @@ const h = ({
|
|
|
66
66
|
i,
|
|
67
67
|
s,
|
|
68
68
|
A,
|
|
69
|
+
w,
|
|
69
70
|
y,
|
|
70
|
-
c,
|
|
71
71
|
E
|
|
72
72
|
].some(
|
|
73
73
|
(m) => m != null && m !== ""
|
|
74
74
|
))
|
|
75
75
|
throw new Error("At least one field must be provided for update");
|
|
76
|
-
},
|
|
76
|
+
}, H = () => {
|
|
77
77
|
const { data: r = [] } = f({
|
|
78
78
|
queryKey: [u.AVAILABILITY_ALERTS],
|
|
79
|
-
queryFn: () =>
|
|
79
|
+
queryFn: () => d.getMyActiveAlerts()
|
|
80
80
|
}), { data: t = [] } = f({
|
|
81
81
|
queryKey: [u.ALERT_NOTIFICATIONS],
|
|
82
|
-
queryFn: () =>
|
|
82
|
+
queryFn: () => d.getAlertNotifications()
|
|
83
83
|
}), {
|
|
84
84
|
mutate: a,
|
|
85
85
|
isPending: o,
|
|
86
86
|
isError: n,
|
|
87
87
|
error: l
|
|
88
88
|
} = p({
|
|
89
|
-
mutationFn: async (e) => (
|
|
89
|
+
mutationFn: async (e) => (b(e), await d.createAvailabilityAlert(e)),
|
|
90
90
|
onSuccess: () => {
|
|
91
91
|
v.invalidateQueries({
|
|
92
92
|
queryKey: [u.AVAILABILITY_ALERTS]
|
|
@@ -96,14 +96,10 @@ const h = ({
|
|
|
96
96
|
mutate: i,
|
|
97
97
|
isPending: s,
|
|
98
98
|
isError: A,
|
|
99
|
-
error:
|
|
100
|
-
data:
|
|
99
|
+
error: w,
|
|
100
|
+
data: y
|
|
101
101
|
} = p({
|
|
102
|
-
mutationFn: async (e) =>
|
|
103
|
-
q(e);
|
|
104
|
-
const d = await w.updateAvailabilityAlert(e);
|
|
105
|
-
return b(d);
|
|
106
|
-
},
|
|
102
|
+
mutationFn: async (e) => (h(e), d.updateAvailabilityAlert(e)),
|
|
107
103
|
onSuccess: () => {
|
|
108
104
|
v.invalidateQueries({
|
|
109
105
|
queryKey: [u.AVAILABILITY_ALERTS]
|
|
@@ -124,14 +120,14 @@ const h = ({
|
|
|
124
120
|
updateAvailabilityAlert: i,
|
|
125
121
|
isUpdateAvailabilityAlertPending: s,
|
|
126
122
|
isUpdateAvailabilityAlertError: A,
|
|
127
|
-
updateAvailabilityAlertError:
|
|
128
|
-
updatedAvailabilityAlert:
|
|
123
|
+
updateAvailabilityAlertError: w,
|
|
124
|
+
updatedAvailabilityAlert: y,
|
|
129
125
|
// convenience function to update acknowledgment
|
|
130
|
-
updateAcknowledgement: (e,
|
|
126
|
+
updateAcknowledgement: (e, c = !0) => i({ alertId: e, acknowledged: c })
|
|
131
127
|
};
|
|
132
128
|
};
|
|
133
129
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
H as useAvailabilityAlerts,
|
|
131
|
+
b as validateCreateAvailabilityAlert,
|
|
132
|
+
h as validateUpdateAvailabilityAlert
|
|
137
133
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import { b as C } from "../../index-CJj9N0Xq.js";
|
|
1
3
|
import "../../moment-BGjjqtLQ.js";
|
|
2
4
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
3
|
-
import { b as C } from "../../index-CJj9N0Xq.js";
|
|
4
5
|
import "react";
|
|
5
6
|
import { HotelChains as p } from "../../definitions/HotelChains.js";
|
|
6
7
|
import { EBestCheckoutType as f } from "../../enums/EBestCheckoutType.js";
|
|
7
8
|
import { BookingService as y } from "../../services/booking/BookingService.js";
|
|
8
9
|
import { EGuestType as d } from "../../services/booking/BookingService.enums.js";
|
|
9
10
|
import { HotelService as h } from "../../services/hotel/HotelService.js";
|
|
10
|
-
const
|
|
11
|
+
const I = async (t) => await h.getTransferPartners(
|
|
11
12
|
p.toProgram(t)
|
|
12
|
-
),
|
|
13
|
+
), v = (t) => !!t.hotelGroup && !!t.hotelId && !!t.checkinDate && !!t.checkoutDate && !!t.rooms && !!t.guests, E = async ({
|
|
13
14
|
hotel: t,
|
|
14
15
|
checkinDate: o,
|
|
15
16
|
checkoutDate: n,
|
|
16
17
|
updateHotel: s,
|
|
17
|
-
signal:
|
|
18
|
+
signal: i
|
|
18
19
|
}) => {
|
|
19
20
|
let r = t, c = t.rooms ?? [];
|
|
20
21
|
if (!t.liveScrapingCheckNeeded || t.hotelGroup === p.Marriott)
|
|
@@ -22,7 +23,7 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
22
23
|
pointsHotelDetails: t,
|
|
23
24
|
pointsRooms: c
|
|
24
25
|
};
|
|
25
|
-
let u = !1,
|
|
26
|
+
let u = !1, e = null;
|
|
26
27
|
try {
|
|
27
28
|
const a = await h.hotelPointsCheck(
|
|
28
29
|
{
|
|
@@ -31,78 +32,78 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
31
32
|
checkinDate: o,
|
|
32
33
|
checkoutDate: n
|
|
33
34
|
},
|
|
34
|
-
|
|
35
|
+
i
|
|
35
36
|
);
|
|
36
|
-
u = a.success,
|
|
37
|
+
u = a.success, e = a.data;
|
|
37
38
|
} catch {
|
|
38
|
-
u = !1,
|
|
39
|
+
u = !1, e = null;
|
|
39
40
|
}
|
|
40
41
|
if (u) {
|
|
41
|
-
const a =
|
|
42
|
+
const a = e, l = !(a.points.pointsValue > 0) && t.bestValue === f.POINTS;
|
|
42
43
|
r = {
|
|
43
44
|
...t,
|
|
44
45
|
awardPoints: a.points.awardPointsValue ?? a.points.pointsValue,
|
|
45
46
|
points: a.points.pointsValue,
|
|
46
47
|
pointsType: a.points.pointsType,
|
|
47
|
-
bestValue:
|
|
48
|
+
bestValue: l ? f.NONE : t.bestValue
|
|
48
49
|
}, c = a.rooms ?? t.rooms ?? [], s(t.hotelId, t.hotelGroup, r);
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
51
52
|
pointsHotelDetails: r,
|
|
52
53
|
pointsRooms: c
|
|
53
54
|
};
|
|
54
|
-
},
|
|
55
|
+
}, U = async ({
|
|
55
56
|
hotel: t,
|
|
56
57
|
checkinDate: o,
|
|
57
58
|
checkoutDate: n,
|
|
58
59
|
guests: s,
|
|
59
|
-
rooms:
|
|
60
|
+
rooms: i,
|
|
60
61
|
updateHotel: r,
|
|
61
62
|
numberOfNights: c
|
|
62
63
|
}) => {
|
|
63
|
-
var
|
|
64
|
-
if (!((
|
|
64
|
+
var m;
|
|
65
|
+
if (!((m = t == null ? void 0 : t.cashBookingOffers) != null && m.accommodationId))
|
|
65
66
|
return {
|
|
66
67
|
cashHotelDetails: t,
|
|
67
68
|
cashRooms: []
|
|
68
69
|
};
|
|
69
|
-
const u = (
|
|
70
|
+
const u = (l) => Array.from({ length: l }, () => ({ type: d.ADULT })), e = await y.getAvailableRooms({
|
|
70
71
|
checkinDate: o,
|
|
71
72
|
checkoutDate: n,
|
|
72
73
|
accommodationId: t.cashBookingOffers.accommodationId,
|
|
73
74
|
guests: u(s),
|
|
74
|
-
rooms:
|
|
75
|
+
rooms: i
|
|
75
76
|
}), a = {
|
|
76
77
|
...t,
|
|
77
78
|
cashValue: {
|
|
78
79
|
...t.cashValue,
|
|
79
|
-
amount:
|
|
80
|
-
currency:
|
|
80
|
+
amount: e.cheapestRate / c || t.cashValue.amount || 0,
|
|
81
|
+
currency: e.currency ?? t.cashValue.currency
|
|
81
82
|
},
|
|
82
|
-
...
|
|
83
|
+
...e.accommodation
|
|
83
84
|
};
|
|
84
85
|
return r(t.hotelId, t.hotelGroup, a), {
|
|
85
86
|
cashHotelDetails: a,
|
|
86
|
-
cashRooms:
|
|
87
|
+
cashRooms: e.availableRooms
|
|
87
88
|
};
|
|
88
|
-
},
|
|
89
|
-
const { success: s, data:
|
|
89
|
+
}, O = async (t, o, n) => {
|
|
90
|
+
const { success: s, data: i } = await h.getRecommendations({
|
|
90
91
|
days: o,
|
|
91
92
|
hotel: t
|
|
92
93
|
});
|
|
93
|
-
return s &&
|
|
94
|
+
return s && i ? {
|
|
94
95
|
bestCheckout: {
|
|
95
|
-
...
|
|
96
|
-
nightlyPointsCost: n ?
|
|
96
|
+
...i,
|
|
97
|
+
nightlyPointsCost: n ? i.awardPoints : i.nightlyPointsCost
|
|
97
98
|
},
|
|
98
|
-
isAvailable:
|
|
99
|
+
isAvailable: i.nightlyPointsCost > 0 || i.nightlyCashCost > 0
|
|
99
100
|
} : {
|
|
100
101
|
bestCheckout: P(t, o),
|
|
101
102
|
isAvailable: !1
|
|
102
103
|
};
|
|
103
104
|
}, P = (t, o) => {
|
|
104
|
-
var r, c, u,
|
|
105
|
-
const n = ((r = t.cashBookingOffers) == null ? void 0 : r.cheapestRateTotalAmount) ?? ((c = t.cashValue) == null ? void 0 : c.amount) ?? 0, s = ((u = t.cashBookingOffers) == null ? void 0 : u.cheapestRateCurrency) ?? ((
|
|
105
|
+
var r, c, u, e;
|
|
106
|
+
const n = ((r = t.cashBookingOffers) == null ? void 0 : r.cheapestRateTotalAmount) ?? ((c = t.cashValue) == null ? void 0 : c.amount) ?? 0, s = ((u = t.cashBookingOffers) == null ? void 0 : u.cheapestRateCurrency) ?? ((e = t.cashValue) == null ? void 0 : e.currency) ?? C;
|
|
106
107
|
return {
|
|
107
108
|
bestCheckoutMethod: p.isHotelChain(t.hotelGroup) ? t.bestValue : f.CASH,
|
|
108
109
|
nightlyCashCost: n,
|
|
@@ -119,7 +120,7 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
119
120
|
totalProgramPointsValuation: 0
|
|
120
121
|
}
|
|
121
122
|
};
|
|
122
|
-
},
|
|
123
|
+
}, H = (t, o, n) => {
|
|
123
124
|
let s = t;
|
|
124
125
|
return o && (s = {
|
|
125
126
|
...t,
|
|
@@ -133,11 +134,11 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
133
134
|
}), s;
|
|
134
135
|
};
|
|
135
136
|
export {
|
|
136
|
-
|
|
137
|
+
H as combineUpdatedHotelData,
|
|
137
138
|
P as fallbackBestCheckout,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
U as fetchAvailableRooms,
|
|
140
|
+
O as fetchBestCheckout,
|
|
141
|
+
E as fetchPointsCheck,
|
|
142
|
+
I as fetchTransferPartners,
|
|
143
|
+
v as isPartialHotelDetails
|
|
143
144
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { b as
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import { b as oe } from "../../index-CJj9N0Xq.js";
|
|
3
|
+
import { g as ae } from "../../dateUtils-C1hKW8MF.js";
|
|
3
4
|
import { E as N } from "../../DateFormats-DZD30Nea.js";
|
|
4
5
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
6
|
import { useState as ce, useMemo as D } from "react";
|
|
@@ -14,7 +15,7 @@ import { IhgFreeNightCards as de } from "../../definitions/IhgFreeNightCards.js"
|
|
|
14
15
|
import { HotelService as pe } from "../../services/hotel/HotelService.js";
|
|
15
16
|
import { calculatePointsAsCash as ge } from "../../utilities/pointsAsCashUtils.js";
|
|
16
17
|
import { isDuffelHotelId as ye } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
17
|
-
const
|
|
18
|
+
const Ne = (a) => {
|
|
18
19
|
var H, R, O, q, A, S, G, _, B, w, K, P, E;
|
|
19
20
|
if (!a)
|
|
20
21
|
throw new Error(
|
|
@@ -48,7 +49,7 @@ const Ee = (a) => {
|
|
|
48
49
|
),
|
|
49
50
|
guests: a.guests,
|
|
50
51
|
rooms: a.rooms,
|
|
51
|
-
currency: ((c = f == null ? void 0 : f.userRegion) == null ? void 0 : c.currency) ||
|
|
52
|
+
currency: ((c = f == null ? void 0 : f.userRegion) == null ? void 0 : c.currency) || oe,
|
|
52
53
|
cash_or_points: ["cash", "points"],
|
|
53
54
|
use_duffel: m == null ? void 0 : m.supportsDuffel
|
|
54
55
|
});
|
|
@@ -58,7 +59,7 @@ const Ee = (a) => {
|
|
|
58
59
|
}), t = D(() => {
|
|
59
60
|
var c;
|
|
60
61
|
return s ? i != null && i.success && ((c = i.data) != null && c[0]) ? i.data[0] : {} : a;
|
|
61
|
-
}, [s, i, a]), h = D(() =>
|
|
62
|
+
}, [s, i, a]), h = D(() => ae(e.checkinDate, e.checkoutDate), [e]), I = (c, l) => {
|
|
62
63
|
U({
|
|
63
64
|
checkinDate: n(c),
|
|
64
65
|
checkoutDate: n(l)
|
|
@@ -203,5 +204,5 @@ const Ee = (a) => {
|
|
|
203
204
|
};
|
|
204
205
|
};
|
|
205
206
|
export {
|
|
206
|
-
|
|
207
|
+
Ne as useHotelDetails
|
|
207
208
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useAwayzContext as x, useWallet as P, awayzClient as f } from "@odynn/awayz-core";
|
|
2
2
|
import { useMutation as k } from "@tanstack/react-query";
|
|
3
|
-
import
|
|
4
|
-
import { D as R, a as
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import { D as R, a as D } from "../../index-CJj9N0Xq.js";
|
|
5
|
+
import { g as y } from "../../dateUtils-C1hKW8MF.js";
|
|
5
6
|
import { E as _ } from "../../enums-DPFgYLjY.js";
|
|
6
7
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
7
8
|
import { useEffect as K } from "react";
|
|
@@ -36,7 +37,7 @@ const O = (t) => {
|
|
|
36
37
|
throw new Error(
|
|
37
38
|
`Invalid hotel group: ${t.hotelGroup}. Please use one of the following: ${a.toList().join(", ")}`
|
|
38
39
|
);
|
|
39
|
-
},
|
|
40
|
+
}, re = () => {
|
|
40
41
|
const { setHotels: t, hotels: s, setSearchParams: p } = S(), { config: c, featureFlags: m } = x(), { userCards: h } = P(), {
|
|
41
42
|
mutate: H,
|
|
42
43
|
isPending: v,
|
|
@@ -57,7 +58,7 @@ const O = (t) => {
|
|
|
57
58
|
guests: e.guests || 2,
|
|
58
59
|
rooms: e.rooms || 1,
|
|
59
60
|
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
60
|
-
region_code: e.userRegion ||
|
|
61
|
+
region_code: e.userRegion || D,
|
|
61
62
|
lat: e.coordinates.latitude,
|
|
62
63
|
lon: e.coordinates.longitude,
|
|
63
64
|
search_range: e.searchRange || 10,
|
|
@@ -76,7 +77,7 @@ const O = (t) => {
|
|
|
76
77
|
},
|
|
77
78
|
onSuccess: (e) => {
|
|
78
79
|
if (e.success) {
|
|
79
|
-
const { checkinDate: o, checkoutDate: r, searchCoordinates: i } = e, u =
|
|
80
|
+
const { checkinDate: o, checkoutDate: r, searchCoordinates: i } = e, u = y(o, r), n = e.data.map((l) => ({
|
|
80
81
|
...l,
|
|
81
82
|
distance: I(
|
|
82
83
|
i.latitude,
|
|
@@ -126,7 +127,7 @@ const O = (t) => {
|
|
|
126
127
|
guests: e.guests || 2,
|
|
127
128
|
rooms: e.rooms || 1,
|
|
128
129
|
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
129
|
-
region_code: e.userRegion ||
|
|
130
|
+
region_code: e.userRegion || D,
|
|
130
131
|
lat: e.coordinates.latitude,
|
|
131
132
|
lon: e.coordinates.longitude,
|
|
132
133
|
search_range: 0.5,
|
|
@@ -162,7 +163,7 @@ const O = (t) => {
|
|
|
162
163
|
if (!s.length || !h) return;
|
|
163
164
|
const { searchParams: e } = S.getState();
|
|
164
165
|
if (!(e != null && e.checkinDate) || !(e != null && e.checkoutDate)) return;
|
|
165
|
-
const o =
|
|
166
|
+
const o = y(
|
|
166
167
|
e.checkinDate,
|
|
167
168
|
e.checkoutDate
|
|
168
169
|
), r = s.map((i) => ({
|
|
@@ -186,7 +187,7 @@ const O = (t) => {
|
|
|
186
187
|
};
|
|
187
188
|
};
|
|
188
189
|
export {
|
|
189
|
-
|
|
190
|
+
re as useHotelSearch,
|
|
190
191
|
O as validateSearchByCoordsArgs,
|
|
191
192
|
$ as validateSearchByHotelIdArgs
|
|
192
193
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { useQuery as u } from "@tanstack/react-query";
|
|
2
2
|
import { HotelService as l } from "../../services/hotel/HotelService.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
3
4
|
import "../../moment-BGjjqtLQ.js";
|
|
4
5
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
6
|
import { E as d } from "../../enums-DPFgYLjY.js";
|
|
6
|
-
import { useState as f, useEffect as
|
|
7
|
-
import { defaultSimilarityThreshold as
|
|
7
|
+
import { useState as f, useEffect as p } from "react";
|
|
8
|
+
import { defaultSimilarityThreshold as L, defaultLocationSortOrder as y, duffelTestHotelLocation as T } from "../../configs/defaults.js";
|
|
8
9
|
import { sortLocationResults as E } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
9
10
|
import { useAwayzContext as S } from "@odynn/awayz-core";
|
|
10
11
|
const D = 500, O = (t, e = D) => {
|
|
11
|
-
const [
|
|
12
|
-
return
|
|
12
|
+
const [r, s] = f(t);
|
|
13
|
+
return p(() => {
|
|
13
14
|
const o = setTimeout(() => {
|
|
14
|
-
|
|
15
|
+
s(t);
|
|
15
16
|
}, e);
|
|
16
17
|
return () => {
|
|
17
18
|
clearTimeout(o);
|
|
18
19
|
};
|
|
19
|
-
}, [t, e]),
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
queryKey: [d.LOCATIONS,
|
|
20
|
+
}, [t, e]), r;
|
|
21
|
+
}, b = (t, e = L, r = y) => {
|
|
22
|
+
const s = O(t), { config: o } = S(), { data: i, isLoading: n } = u({
|
|
23
|
+
queryKey: [d.LOCATIONS, s],
|
|
23
24
|
queryFn: () => l.getLocations(t),
|
|
24
25
|
enabled: !!t
|
|
25
26
|
// Only run the query if searchInput is not empty
|
|
26
|
-
}),
|
|
27
|
+
}), m = (i == null ? void 0 : i.data) || [];
|
|
27
28
|
let a = E(
|
|
28
29
|
t,
|
|
29
30
|
e,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
r,
|
|
32
|
+
m
|
|
32
33
|
).map(
|
|
33
|
-
({ score: x, startsWithText: A, ...
|
|
34
|
+
({ score: x, startsWithText: A, ...c }) => c
|
|
34
35
|
);
|
|
35
36
|
return o != null && o.testMode && (o != null && o.supportsDuffel) && (a = [
|
|
36
37
|
T,
|
|
@@ -41,5 +42,5 @@ const D = 500, O = (t, e = D) => {
|
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
+
b as useLocationSearch
|
|
45
46
|
};
|
|
@@ -3,7 +3,7 @@ import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
|
|
|
3
3
|
import { IRoom } from '../../services/booking/BookingService.types';
|
|
4
4
|
import { IPointsAsCash } from '../../utilities/pointsAsCashUtils';
|
|
5
5
|
import { IBestCheckout } from './useHotelDetails.types';
|
|
6
|
-
export declare const fetchTransferPartners: (hotelGroup: string) => Promise<
|
|
6
|
+
export declare const fetchTransferPartners: (hotelGroup: string) => Promise<any>;
|
|
7
7
|
interface IPointsCheckResult {
|
|
8
8
|
pointsHotelDetails: IHotelDetails;
|
|
9
9
|
pointsRooms: IRoom[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IPartialHotelDetails } from './useHotelDetails.api';
|
|
2
2
|
import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
|
|
3
3
|
export declare const useHotelDetails: (hotelInput: IHotelDetails | IPartialHotelDetails) => {
|
|
4
|
-
transferPartners:
|
|
4
|
+
transferPartners: any;
|
|
5
5
|
loadingTransferPartners: boolean;
|
|
6
6
|
loadingHotelDetails: boolean;
|
|
7
7
|
pointsRooms: import('../../main').IRoom[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IAvailabilityAlert, IAvailabilityAlertNotification, ICreateAvailabilityAlertRequest, IUpdateAvailabilityAlertRequest } from '../../hooks/useAvailabilityAlerts/useAvailabilityAlerts.types';
|
|
2
|
-
import {
|
|
1
|
+
import { IAvailabilityAlert, IAvailabilityAlertNotification, ICreateAvailabilityAlertRequest, IUpdateAvailabilityAlertRequest, IUpdateAvailabilityAlertResponse } from '../../hooks/useAvailabilityAlerts/useAvailabilityAlerts.types';
|
|
2
|
+
import { ICreateAlertResponse } from './AvailabilityAlertsService.types';
|
|
3
3
|
declare class _AvailabilityAlertsService {
|
|
4
4
|
getMyActiveAlerts: () => Promise<IAvailabilityAlert[]>;
|
|
5
5
|
createAvailabilityAlert: (request: ICreateAvailabilityAlertRequest) => Promise<ICreateAlertResponse>;
|
|
6
|
-
updateAvailabilityAlert: (request: IUpdateAvailabilityAlertRequest) => Promise<
|
|
6
|
+
updateAvailabilityAlert: (request: IUpdateAvailabilityAlertRequest) => Promise<IUpdateAvailabilityAlertResponse>;
|
|
7
7
|
getAlertNotifications: () => Promise<IAvailabilityAlertNotification[]>;
|
|
8
8
|
}
|
|
9
9
|
export declare const AvailabilityAlertsService: _AvailabilityAlertsService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IGetAvailableRoomsProps, IRoom } from './BookingService.types';
|
|
2
2
|
export declare enum EBookingType {
|
|
3
3
|
Hotel = "awayz_hotel_booking_id",
|
|
4
4
|
Flight = "awayz_flight_booking_id",
|
|
@@ -9,7 +9,7 @@ declare class _BookingService {
|
|
|
9
9
|
cheapestRate: number;
|
|
10
10
|
currency: string;
|
|
11
11
|
availableRooms: IRoom[];
|
|
12
|
-
accommodation: IAccommodation;
|
|
12
|
+
accommodation: import('./BookingService.types').IAccommodation;
|
|
13
13
|
}>;
|
|
14
14
|
}
|
|
15
15
|
export declare const BookingService: _BookingService;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAccommodation, IAccommodationResponse, IRate, IRateResponse, IRoom, IRoomResponse } from './BookingService.types';
|
|
2
|
+
/**
|
|
3
|
+
* Map Duffel API rate response to IRate.
|
|
4
|
+
*/
|
|
5
|
+
export declare const mapRateResponse: (rate: IRateResponse) => IRate;
|
|
6
|
+
/**
|
|
7
|
+
* Map Duffel API room response to IRoom.
|
|
8
|
+
* Note: Duffel rooms have a simpler structure than hotel search rooms.
|
|
9
|
+
*/
|
|
10
|
+
export declare const mapRoomResponse: (room: IRoomResponse) => IRoom;
|
|
11
|
+
/**
|
|
12
|
+
* Map Duffel API accommodation response to IAccommodation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const mapAccommodationResponse: (acc: IAccommodationResponse) => IAccommodation;
|
|
@@ -19,7 +19,7 @@ export interface IAccommodationSearchResponse {
|
|
|
19
19
|
check_in_date: string;
|
|
20
20
|
id: string;
|
|
21
21
|
}
|
|
22
|
-
interface IAccommodationResponse {
|
|
22
|
+
export interface IAccommodationResponse {
|
|
23
23
|
check_in_information: ICheckInInformationResponse;
|
|
24
24
|
supported_loyalty_programme: string;
|
|
25
25
|
review_score: number;
|
|
@@ -43,20 +43,20 @@ interface ICheckInInformationResponse {
|
|
|
43
43
|
check_in_before_time: string;
|
|
44
44
|
check_in_after_time: string;
|
|
45
45
|
}
|
|
46
|
-
interface IRoomResponse {
|
|
46
|
+
export interface IRoomResponse {
|
|
47
47
|
beds: IBed[];
|
|
48
48
|
photos: IPhoto[];
|
|
49
49
|
rates: IRateResponse[];
|
|
50
50
|
name: string;
|
|
51
51
|
}
|
|
52
|
-
interface IRateResponse {
|
|
52
|
+
export interface IRateResponse {
|
|
53
53
|
public_currency: string;
|
|
54
54
|
due_at_accommodation_currency: string;
|
|
55
55
|
due_at_accommodation_amount: number | null;
|
|
56
56
|
quantity_available: number;
|
|
57
57
|
public_amount: number | null;
|
|
58
58
|
deal_types: string | null;
|
|
59
|
-
cancellation_timeline:
|
|
59
|
+
cancellation_timeline: ICancellationTimelineResponse[];
|
|
60
60
|
board_type: ERoomBoardType;
|
|
61
61
|
supported_loyalty_programme: string | null;
|
|
62
62
|
available_payment_methods: string[];
|
|
@@ -73,7 +73,12 @@ interface IRateResponse {
|
|
|
73
73
|
source: string;
|
|
74
74
|
id: string;
|
|
75
75
|
}
|
|
76
|
-
interface
|
|
76
|
+
interface ICancellationTimelineResponse {
|
|
77
|
+
before: string;
|
|
78
|
+
currency: string;
|
|
79
|
+
refund_amount: string | number;
|
|
80
|
+
}
|
|
81
|
+
export interface ILocationResponse {
|
|
77
82
|
geographic_coordinates: ICoordinates;
|
|
78
83
|
address: IAddressResponse;
|
|
79
84
|
}
|
|
@@ -204,6 +209,6 @@ interface IAddress {
|
|
|
204
209
|
interface ICancellationTimeline {
|
|
205
210
|
before: string;
|
|
206
211
|
currency: string;
|
|
207
|
-
refundAmount:
|
|
212
|
+
refundAmount: number;
|
|
208
213
|
}
|
|
209
214
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IHotelDetails
|
|
1
|
+
import { TServiceResponse } from '@type-op/shared';
|
|
2
|
+
import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
|
|
3
3
|
import { IBestCheckout } from '../../hooks/useHotelDetails/useHotelDetails.types';
|
|
4
4
|
import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
|
|
5
5
|
declare class _HotelService {
|
|
6
6
|
getLocations: (searchInputQuery: string) => Promise<TServiceResponse<ISearchLocation[]>>;
|
|
7
7
|
searchByCoords: (request: ISearchHotelsParams) => Promise<TServiceResponse<IHotelDetails[]>>;
|
|
8
8
|
searchByHotelId: (request: ISearchByHotelIdRequest) => Promise<TServiceResponse<IHotelDetails[]>>;
|
|
9
|
-
getTransferPartners: (program: string) => Promise<
|
|
9
|
+
getTransferPartners: (program: string) => Promise<any>;
|
|
10
10
|
hotelPointsCheck: (args: IHotelPointsCheckArgs, signal?: AbortSignal) => Promise<{
|
|
11
11
|
success: any;
|
|
12
|
-
data: ILiveHotelCheck | null;
|
|
12
|
+
data: import('../../components/HotelResult/HotelResult.types').ILiveHotelCheck | null;
|
|
13
13
|
message?: undefined;
|
|
14
14
|
} | {
|
|
15
15
|
success: boolean;
|