@odynn/awayz-hotels 0.6.23 → 0.6.24
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/hooks/useHotelDetails/useHotelDetails.api.js +1 -1
- package/dist/hooks/useHotelDetails/useHotelDetails.js +1 -1
- package/dist/hooks/useHotelSearch/useHotelSearch.js +28 -28
- package/dist/index-CJj9N0Xq.js +6 -0
- package/dist/lib/hooks/useHotelSearch/useHotelSearch.types.d.ts +2 -2
- package/dist/lib/services/hotel/HotelService.types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/index-yqIid8Pw.js +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../moment-BGjjqtLQ.js";
|
|
2
2
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
3
|
-
import {
|
|
3
|
+
import { b as C } from "../../index-CJj9N0Xq.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { HotelChains as p } from "../../definitions/HotelChains.js";
|
|
6
6
|
import { EBestCheckoutType as f } from "../../enums/EBestCheckoutType.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as ae } from "../../dateUtils-C1hKW8MF.js";
|
|
2
|
-
import {
|
|
2
|
+
import { b as ce } from "../../index-CJj9N0Xq.js";
|
|
3
3
|
import { E as T } from "../../DateFormats-DZD30Nea.js";
|
|
4
4
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
5
|
import { useState as se, useMemo as D } from "react";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useAwayzContext as P, useWallet as A, awayzClient as d } from "@odynn/awayz-core";
|
|
2
2
|
import { useMutation as m } from "@tanstack/react-query";
|
|
3
|
-
import { g as
|
|
4
|
-
import { D as
|
|
3
|
+
import { g as G } from "../../dateUtils-C1hKW8MF.js";
|
|
4
|
+
import { D as N, a as p } from "../../index-CJj9N0Xq.js";
|
|
5
5
|
import { E as f } from "../../enums-D9aZqf8G.js";
|
|
6
6
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import { h as u } from "../../moment-BGjjqtLQ.js";
|
|
9
9
|
import { HotelChains as i } from "../../definitions/HotelChains.js";
|
|
10
10
|
import { HotelService as k } from "../../services/hotel/HotelService.js";
|
|
11
|
-
import { ESearchType as
|
|
12
|
-
import
|
|
11
|
+
import { ESearchType as D } from "../../services/hotel/HotelService.types.js";
|
|
12
|
+
import B from "../../stores/useHotelsStore.js";
|
|
13
13
|
import { checkNthNightFree as F } from "../../utilities/hotelUtils/freeNightUtils.js";
|
|
14
|
-
const
|
|
14
|
+
const R = (t) => {
|
|
15
15
|
if (!t.checkinDate || !t.checkoutDate)
|
|
16
16
|
throw new Error("Check-in and checkout dates are required.");
|
|
17
17
|
if (!t.coordinates)
|
|
@@ -24,7 +24,7 @@ const x = (t) => {
|
|
|
24
24
|
)}`
|
|
25
25
|
);
|
|
26
26
|
});
|
|
27
|
-
},
|
|
27
|
+
}, x = (t) => {
|
|
28
28
|
if (!t.checkinDate || !t.checkoutDate)
|
|
29
29
|
throw new Error("Check-in and checkout dates are required.");
|
|
30
30
|
if (!t.hotelName)
|
|
@@ -35,8 +35,8 @@ const x = (t) => {
|
|
|
35
35
|
throw new Error(
|
|
36
36
|
`Invalid hotel group: ${t.hotelGroup}. Please use one of the following: ${i.toList().join(", ")}`
|
|
37
37
|
);
|
|
38
|
-
},
|
|
39
|
-
const { setHotels: t, hotels: h, setSearchParams: l } =
|
|
38
|
+
}, X = () => {
|
|
39
|
+
const { setHotels: t, hotels: h, setSearchParams: l } = B(), { config: r } = P(), { userCards: y } = A(), {
|
|
40
40
|
mutate: _,
|
|
41
41
|
isPending: w,
|
|
42
42
|
status: E,
|
|
@@ -44,7 +44,7 @@ const x = (t) => {
|
|
|
44
44
|
error: C
|
|
45
45
|
} = m({
|
|
46
46
|
mutationFn: async (e) => {
|
|
47
|
-
|
|
47
|
+
R(e), t([]), l({
|
|
48
48
|
checkinDate: u(e.checkinDate),
|
|
49
49
|
checkoutDate: u(e.checkoutDate),
|
|
50
50
|
guests: e.guests || 2,
|
|
@@ -56,13 +56,13 @@ const x = (t) => {
|
|
|
56
56
|
guests: e.guests || 2,
|
|
57
57
|
rooms: e.rooms || 1,
|
|
58
58
|
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
59
|
-
|
|
59
|
+
region_code: e.userRegion || p,
|
|
60
60
|
lat: e.coordinates.latitude,
|
|
61
61
|
lon: e.coordinates.longitude,
|
|
62
62
|
search_range: e.searchRange || 10,
|
|
63
|
-
range_type: e.rangeType ||
|
|
63
|
+
range_type: e.rangeType || N,
|
|
64
64
|
hotel_groups: e.hotelGroups || i.toList(),
|
|
65
|
-
type: e.searchType ||
|
|
65
|
+
type: e.searchType || D.CITY,
|
|
66
66
|
external_inventory: (r == null ? void 0 : r.externalInventory) || !1,
|
|
67
67
|
use_duffel: r == null ? void 0 : r.supportsDuffel
|
|
68
68
|
};
|
|
@@ -74,12 +74,12 @@ const x = (t) => {
|
|
|
74
74
|
},
|
|
75
75
|
onSuccess: (e) => {
|
|
76
76
|
if (e.success) {
|
|
77
|
-
const { checkinDate: o, checkoutDate: s } = e,
|
|
78
|
-
...
|
|
77
|
+
const { checkinDate: o, checkoutDate: s } = e, c = G(o, s), a = e.data.map((n) => ({
|
|
78
|
+
...n,
|
|
79
79
|
nthNightFree: F({
|
|
80
|
-
hotel:
|
|
81
|
-
cards:
|
|
82
|
-
nights:
|
|
80
|
+
hotel: n,
|
|
81
|
+
cards: y ?? [],
|
|
82
|
+
nights: c
|
|
83
83
|
})
|
|
84
84
|
}));
|
|
85
85
|
t(a);
|
|
@@ -91,9 +91,9 @@ const x = (t) => {
|
|
|
91
91
|
});
|
|
92
92
|
function I(e, o) {
|
|
93
93
|
let s = 0;
|
|
94
|
-
const
|
|
95
|
-
for (let
|
|
96
|
-
e[
|
|
94
|
+
const c = e.length < o.length ? e : o, a = e.length >= o.length ? e : o;
|
|
95
|
+
for (let n = 0; n < c.length; n++)
|
|
96
|
+
e[n] === o[n] && s++;
|
|
97
97
|
return s / a.length;
|
|
98
98
|
}
|
|
99
99
|
const {
|
|
@@ -104,7 +104,7 @@ const x = (t) => {
|
|
|
104
104
|
error: q
|
|
105
105
|
} = m({
|
|
106
106
|
mutationFn: async (e) => {
|
|
107
|
-
|
|
107
|
+
x(e), t([]), l({
|
|
108
108
|
checkinDate: u(e.checkinDate),
|
|
109
109
|
checkoutDate: u(e.checkoutDate),
|
|
110
110
|
guests: e.guests || 2,
|
|
@@ -116,21 +116,21 @@ const x = (t) => {
|
|
|
116
116
|
guests: e.guests || 2,
|
|
117
117
|
rooms: e.rooms || 1,
|
|
118
118
|
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
119
|
-
|
|
119
|
+
region_code: e.userRegion || p,
|
|
120
120
|
lat: e.coordinates.latitude,
|
|
121
121
|
lon: e.coordinates.longitude,
|
|
122
122
|
search_range: 0.5,
|
|
123
123
|
range_type: "km",
|
|
124
124
|
hotel_groups: [e.hotelGroup],
|
|
125
|
-
type:
|
|
125
|
+
type: D.HOTEL,
|
|
126
126
|
external_inventory: !1,
|
|
127
127
|
use_duffel: r == null ? void 0 : r.supportsDuffel
|
|
128
128
|
}, s = await k.searchByCoords(o);
|
|
129
129
|
if (!s.success)
|
|
130
130
|
throw new Error(s.message || "Hotel search failed");
|
|
131
|
-
const
|
|
131
|
+
const c = 0.8;
|
|
132
132
|
return s.data.filter(
|
|
133
|
-
(
|
|
133
|
+
(n) => I(n.name.toLowerCase(), e.hotelName.toLowerCase()) >= c
|
|
134
134
|
);
|
|
135
135
|
},
|
|
136
136
|
onSuccess: (e) => {
|
|
@@ -152,7 +152,7 @@ const x = (t) => {
|
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
154
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
X as useHotelSearch,
|
|
156
|
+
R as validateSearchByCoordsArgs,
|
|
157
|
+
x as validateSearchByHotelIdArgs
|
|
158
158
|
};
|
|
@@ -89,10 +89,10 @@ interface ISearchByParams {
|
|
|
89
89
|
guests?: number;
|
|
90
90
|
/**
|
|
91
91
|
* Optional search currency
|
|
92
|
-
* @default '
|
|
92
|
+
* @default 'US'
|
|
93
93
|
* @type string
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
userRegion: string;
|
|
96
96
|
/**
|
|
97
97
|
* Optional cash or points search
|
|
98
98
|
* @default ['cash', 'points']
|
package/package.json
CHANGED