@odynn/awayz-hotels 0.6.12 → 0.6.14

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,12 +1,14 @@
1
- import { useHotelSearch as r } from "./useHotelSearch/useHotelSearch.js";
2
- import { useLocationSearch as l } from "./useLocationSearch/useLocationSearch.js";
1
+ import { useAvailabilityAlertNotifications as t } from "./useAvailabilityAlertNotifications/useAvailabilityAlertNotifications.js";
2
+ import { useAvailabilityAlerts as i } from "./useAvailabilityAlerts/useAvailabilityAlerts.js";
3
3
  import { useHotelDetails as a } from "./useHotelDetails/useHotelDetails.js";
4
- import { useHotelSort as i } from "./useHotelSort/useHotelSort.js";
5
- import { useAvailabilityAlerts as p } from "./useAvailabilityAlerts/useAvailabilityAlerts.js";
4
+ import { useHotelSearch as f } from "./useHotelSearch/useHotelSearch.js";
5
+ import { useHotelSort as p } from "./useHotelSort/useHotelSort.js";
6
+ import { useLocationSearch as x } from "./useLocationSearch/useLocationSearch.js";
6
7
  export {
7
- p as useAvailabilityAlerts,
8
+ t as useAvailabilityAlertNotifications,
9
+ i as useAvailabilityAlerts,
8
10
  a as useHotelDetails,
9
- r as useHotelSearch,
10
- i as useHotelSort,
11
- l as useLocationSearch
11
+ f as useHotelSearch,
12
+ p as useHotelSort,
13
+ x as useLocationSearch
12
14
  };
@@ -1,15 +1,15 @@
1
- import { useMutation as d } from "@tanstack/react-query";
2
- import { HotelService as m } from "../../services/hotel/HotelService.js";
3
- import { ESearchType as p } from "../../services/hotel/HotelService.types.js";
4
- import { HotelChains as s } from "../../definitions/HotelChains.js";
5
- import { h as a } from "../../moment-BGjjqtLQ.js";
6
- import P from "../../stores/useHotelsStore.js";
7
- import { g as T } from "../../dateUtils-C1hKW8MF.js";
8
- import { E as f } from "../../enums-DxmoBOKL.js";
1
+ import { useAwayzContext as P, useWallet as T, awayzClient as d } from "@odynn/awayz-core";
2
+ import { useMutation as m } from "@tanstack/react-query";
3
+ import { g as B } from "../../dateUtils-C1hKW8MF.js";
4
+ import { E as p } from "../../enums-DxmoBOKL.js";
9
5
  import "../../arrayExtensions-CFEBYUok.js";
10
6
  import "react";
11
- import { checkNthNightFree as B } from "../../utilities/hotelUtils/freeNightUtils.js";
12
- import { useAwayzContext as G, useWallet as x, awayzClient as k } from "@odynn/awayz-core";
7
+ import { h as a } from "../../moment-BGjjqtLQ.js";
8
+ import { HotelChains as s } from "../../definitions/HotelChains.js";
9
+ import { HotelService as f } from "../../services/hotel/HotelService.js";
10
+ import { ESearchType as k } from "../../services/hotel/HotelService.types.js";
11
+ import G from "../../stores/useHotelsStore.js";
12
+ import { checkNthNightFree as x } from "../../utilities/hotelUtils/freeNightUtils.js";
13
13
  const A = (t) => {
14
14
  if (!t.checkinDate || !t.checkoutDate)
15
15
  throw new Error("Check-in and checkout dates are required.");
@@ -35,13 +35,13 @@ const A = (t) => {
35
35
  `Invalid hotel group: ${t.hotelGroup}. Please use one of the following: ${s.toList().join(", ")}`
36
36
  );
37
37
  }, Y = () => {
38
- const { setHotels: t, hotels: i, setSearchParams: l } = P(), { config: u } = G(), { userCards: y } = x(), {
38
+ const { setHotels: t, hotels: i, setSearchParams: l } = G(), { config: u } = P(), { userCards: y } = T(), {
39
39
  mutate: D,
40
40
  isPending: w,
41
41
  status: S,
42
42
  isError: _,
43
43
  error: E
44
- } = d({
44
+ } = m({
45
45
  mutationFn: async (e) => {
46
46
  A(e), t([]), l({
47
47
  checkinDate: a(e.checkinDate),
@@ -61,20 +61,20 @@ const A = (t) => {
61
61
  search_range: e.searchRange || 10,
62
62
  range_type: e.rangeType || "mi",
63
63
  hotel_groups: e.hotelGroups || s.toList(),
64
- type: e.searchType || p.CITY,
64
+ type: e.searchType || k.CITY,
65
65
  external_inventory: (u == null ? void 0 : u.externalInventory) || !1
66
66
  };
67
67
  return {
68
- ...await m.searchByCoords(o),
68
+ ...await f.searchByCoords(o),
69
69
  checkinDate: e.checkinDate,
70
70
  checkoutDate: e.checkoutDate
71
71
  };
72
72
  },
73
73
  onSuccess: (e) => {
74
74
  if (e.success) {
75
- const { checkinDate: o, checkoutDate: r } = e, n = T(o, r), h = e.data.map((c) => ({
75
+ const { checkinDate: o, checkoutDate: r } = e, n = B(o, r), h = e.data.map((c) => ({
76
76
  ...c,
77
- nthNightFree: B({
77
+ nthNightFree: x({
78
78
  hotel: c,
79
79
  cards: y ?? [],
80
80
  nights: n
@@ -84,7 +84,7 @@ const A = (t) => {
84
84
  }
85
85
  },
86
86
  onSettled: () => {
87
- k.invalidateQueries({ queryKey: [f.SEARCH_LIMIT] });
87
+ d.invalidateQueries({ queryKey: [p.SEARCH_LIMIT] });
88
88
  }
89
89
  });
90
90
  function C(e, o) {
@@ -100,7 +100,7 @@ const A = (t) => {
100
100
  status: v,
101
101
  isError: L,
102
102
  error: q
103
- } = d({
103
+ } = m({
104
104
  mutationFn: async (e) => {
105
105
  N(e), t([]), l({
106
106
  checkinDate: a(e.checkinDate),
@@ -120,9 +120,9 @@ const A = (t) => {
120
120
  search_range: 0.5,
121
121
  range_type: "km",
122
122
  hotel_groups: [e.hotelGroup],
123
- type: p.HOTEL,
123
+ type: k.HOTEL,
124
124
  external_inventory: !1
125
- }, r = await m.searchByCoords(o);
125
+ }, r = await f.searchByCoords(o);
126
126
  if (!r.success)
127
127
  throw new Error(r.message || "Hotel search failed");
128
128
  const n = 0.8;
@@ -134,7 +134,7 @@ const A = (t) => {
134
134
  t(e);
135
135
  },
136
136
  onSettled: () => {
137
- k.invalidateQueries({ queryKey: [f.SEARCH_LIMIT] });
137
+ d.invalidateQueries({ queryKey: [p.SEARCH_LIMIT] });
138
138
  }
139
139
  });
140
140
  return {
@@ -1,6 +1,7 @@
1
- export { useHotelSearch } from './useHotelSearch/useHotelSearch';
2
- export { useLocationSearch } from './useLocationSearch/useLocationSearch';
1
+ export { useAvailabilityAlertNotifications } from './useAvailabilityAlertNotifications/useAvailabilityAlertNotifications';
2
+ export { useAvailabilityAlerts } from './useAvailabilityAlerts/useAvailabilityAlerts';
3
3
  export { useHotelDetails } from './useHotelDetails/useHotelDetails';
4
+ export { useHotelSearch } from './useHotelSearch/useHotelSearch';
4
5
  export { useHotelSort } from './useHotelSort/useHotelSort';
5
- export { useAvailabilityAlerts } from './useAvailabilityAlerts/useAvailabilityAlerts';
6
+ export { useLocationSearch } from './useLocationSearch/useLocationSearch';
6
7
  export * from './useHotelDetails/useHotelDetails.types';
@@ -1,5 +1,5 @@
1
- import { ISearchByCoordsParams, ISearchByHotelIdParams } from './useHotelSearch.types';
2
1
  import { IHotelDetails } from '../../main';
2
+ import { ISearchByCoordsParams, ISearchByHotelIdParams } from './useHotelSearch.types';
3
3
  /**
4
4
  * Utility function to validate search-by-coordinates input
5
5
  */
package/dist/main.js CHANGED
@@ -2,28 +2,30 @@ import { ESearchType as t } from "./services/hotel/HotelService.types.js";
2
2
  import { HotelResult as l } from "./components/HotelResult/HotelResult.js";
3
3
  import { HotelResults as a } from "./components/HotelResults/HotelResults.js";
4
4
  import { Legend as p } from "./components/Legend/Legend.js";
5
- import { useHotelSearch as s } from "./hooks/useHotelSearch/useHotelSearch.js";
6
- import { useLocationSearch as u } from "./hooks/useLocationSearch/useLocationSearch.js";
7
- import { useHotelDetails as d } from "./hooks/useHotelDetails/useHotelDetails.js";
8
- import { useHotelSort as c } from "./hooks/useHotelSort/useHotelSort.js";
9
- import { useAvailabilityAlerts as h } from "./hooks/useAvailabilityAlerts/useAvailabilityAlerts.js";
10
- import { EHotelSortOption as A, ESortingOrder as E } from "./enums/index.js";
11
- import { defaultLocationSortOrder as O, defaultSimilarityThreshold as T, duffelTestHotelLocation as b } from "./configs/defaults.js";
12
- import { EAvailabilityAlertStatus as v } from "./enums/EAvailabilityAlert.js";
5
+ import { useAvailabilityAlertNotifications as m } from "./hooks/useAvailabilityAlertNotifications/useAvailabilityAlertNotifications.js";
6
+ import { useAvailabilityAlerts as u } from "./hooks/useAvailabilityAlerts/useAvailabilityAlerts.js";
7
+ import { useHotelDetails as c } from "./hooks/useHotelDetails/useHotelDetails.js";
8
+ import { useHotelSearch as n } from "./hooks/useHotelSearch/useHotelSearch.js";
9
+ import { useHotelSort as A } from "./hooks/useHotelSort/useHotelSort.js";
10
+ import { useLocationSearch as y } from "./hooks/useLocationSearch/useLocationSearch.js";
11
+ import { EHotelSortOption as L, ESortingOrder as b } from "./enums/index.js";
12
+ import { defaultLocationSortOrder as O, defaultSimilarityThreshold as T, duffelTestHotelLocation as g } from "./configs/defaults.js";
13
+ import { EAvailabilityAlertStatus as D } from "./enums/EAvailabilityAlert.js";
13
14
  export {
14
- v as EAvailabilityAlertStatus,
15
- A as EHotelSortOption,
15
+ D as EAvailabilityAlertStatus,
16
+ L as EHotelSortOption,
16
17
  t as ESearchType,
17
- E as ESortingOrder,
18
+ b as ESortingOrder,
18
19
  l as HotelResult,
19
20
  a as HotelResults,
20
21
  p as Legend,
21
22
  O as defaultLocationSortOrder,
22
23
  T as defaultSimilarityThreshold,
23
- b as duffelTestHotelLocation,
24
- h as useAvailabilityAlerts,
25
- d as useHotelDetails,
26
- s as useHotelSearch,
27
- c as useHotelSort,
28
- u as useLocationSearch
24
+ g as duffelTestHotelLocation,
25
+ m as useAvailabilityAlertNotifications,
26
+ u as useAvailabilityAlerts,
27
+ c as useHotelDetails,
28
+ n as useHotelSearch,
29
+ A as useHotelSort,
30
+ y as useLocationSearch
29
31
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.6.12",
4
+ "version": "0.6.14",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"