@odynn/awayz-hotels 0.1.23 → 0.1.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.
@@ -1,10 +1,11 @@
1
- import { useMutation as i } from "@tanstack/react-query";
2
- import { HotelService as n } from "../../services/hotel/HotelService.js";
3
- import { ESearchType as D } from "../../services/hotel/HotelService.types.js";
1
+ import { useMutation as h } from "@tanstack/react-query";
2
+ import { HotelService as u } from "../../services/hotel/HotelService.js";
3
+ import { ESearchType as w } from "../../services/hotel/HotelService.types.js";
4
4
  import { HotelChains as t } from "../../definitions/HotelChains.js";
5
5
  import { h as c } from "../../moment-BGjjqtLQ.js";
6
- import S from "../../stores/useHotelsStore.js";
7
- const w = (o) => {
6
+ import D from "../../stores/useHotelsStore.js";
7
+ import { useAwayzContext as S } from "@odynn/awayz-auth";
8
+ const _ = (o) => {
8
9
  if (!o.checkinDate || !o.checkoutDate)
9
10
  throw new Error("Checkin and checkout dates are required");
10
11
  if (!o.coordinates)
@@ -17,7 +18,7 @@ const w = (o) => {
17
18
  )}`
18
19
  );
19
20
  });
20
- }, y = (o) => {
21
+ }, E = (o) => {
21
22
  if (!o.checkinDate || !o.checkoutDate)
22
23
  throw new Error("Checkin and checkout dates are required");
23
24
  if (!o.hotelId)
@@ -28,15 +29,15 @@ const w = (o) => {
28
29
  throw new Error(
29
30
  `Invalid hotel group: ${o.hotelGroup}. Please use one of the following: ${t.toList().join(", ")}`
30
31
  );
31
- }, G = () => {
32
- const { setHotels: o, hotels: r, setSearchParams: h } = S(), {
33
- mutate: u,
34
- status: a,
35
- isError: l,
36
- error: d
37
- } = i({
32
+ }, L = () => {
33
+ const { setHotels: o, hotels: r, setSearchParams: i } = D(), { config: n } = S(), {
34
+ mutate: a,
35
+ status: l,
36
+ isError: d,
37
+ error: m
38
+ } = h({
38
39
  mutationFn: async (e) => {
39
- w(e), h({
40
+ _(e), i({
40
41
  checkinDate: c(e.checkinDate),
41
42
  checkoutDate: c(e.checkoutDate),
42
43
  guests: e.guests || 2,
@@ -54,21 +55,22 @@ const w = (o) => {
54
55
  search_range: e.searchRange || 10,
55
56
  range_type: e.rangeType || "mi",
56
57
  hotel_groups: e.hotelGroups || t.toList(),
57
- type: e.searchType || D.CITY
58
+ type: e.searchType || w.CITY,
59
+ external_inventory: (n == null ? void 0 : n.externalInventory) || !1
58
60
  };
59
- return await n.searchByCoords(s);
61
+ return await u.searchByCoords(s);
60
62
  },
61
63
  onSuccess: (e) => {
62
64
  e.success && o(e.data);
63
65
  }
64
66
  }), {
65
67
  mutate: p,
66
- status: m,
67
- isError: k,
68
- error: f
69
- } = i({
68
+ status: k,
69
+ isError: f,
70
+ error: y
71
+ } = h({
70
72
  mutationFn: async (e) => {
71
- y(e), h({
73
+ E(e), i({
72
74
  checkinDate: c(e.checkinDate),
73
75
  checkoutDate: c(e.checkoutDate),
74
76
  guests: e.guests || 2,
@@ -84,7 +86,7 @@ const w = (o) => {
84
86
  cash_or_points: e.cashOrPoints || ["cash", "points"],
85
87
  hotel_group: e.hotelGroup
86
88
  };
87
- return await n.searchByHotelId(s);
89
+ return await u.searchByHotelId(s);
88
90
  },
89
91
  onSuccess: (e) => {
90
92
  e.success && o(e.data);
@@ -92,15 +94,15 @@ const w = (o) => {
92
94
  });
93
95
  return {
94
96
  results: r,
95
- loading: a === "pending" || m === "pending",
96
- isCoordsSearchError: l,
97
- coordsSearchError: d,
98
- isHotelIdSearchError: k,
99
- hotelIdSearchError: f,
100
- searchByCoords: u,
97
+ loading: l === "pending" || k === "pending",
98
+ isCoordsSearchError: d,
99
+ coordsSearchError: m,
100
+ isHotelIdSearchError: f,
101
+ hotelIdSearchError: y,
102
+ searchByCoords: a,
101
103
  searchByHotelId: p
102
104
  };
103
105
  };
104
106
  export {
105
- G as useHotelSearch
107
+ L as useHotelSearch
106
108
  };
@@ -13,6 +13,7 @@ export interface ISearchHotelsParams {
13
13
  hotel_groups: string[];
14
14
  cash_or_points: string[];
15
15
  currency: string;
16
+ external_inventory: boolean;
16
17
  }
17
18
  export declare enum ESearchType {
18
19
  HOTEL = "Hotel Search",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.1.23",
4
+ "version": "0.1.24",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -65,7 +65,7 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@odynn/awayz-auth": "^0.1.18",
68
+ "@odynn/awayz-auth": "^0.1.24",
69
69
  "@tanstack/react-query": "^5.66.9"
70
70
  }
71
71
  }