@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.
@@ -1,6 +1,6 @@
1
1
  import "../../moment-BGjjqtLQ.js";
2
2
  import "../../arrayExtensions-CFEBYUok.js";
3
- import { a as C } from "../../index-yqIid8Pw.js";
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 { a as ce } from "../../index-yqIid8Pw.js";
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 N } from "../../dateUtils-C1hKW8MF.js";
4
- import { D as B, a as p } from "../../index-yqIid8Pw.js";
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 y } from "../../services/hotel/HotelService.types.js";
12
- import G from "../../stores/useHotelsStore.js";
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 x = (t) => {
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
- }, R = (t) => {
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
- }, Z = () => {
39
- const { setHotels: t, hotels: h, setSearchParams: l } = G(), { config: r } = P(), { userCards: D } = A(), {
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
- x(e), t([]), l({
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
- currency: e.currency || p,
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 || B,
63
+ range_type: e.rangeType || N,
64
64
  hotel_groups: e.hotelGroups || i.toList(),
65
- type: e.searchType || y.CITY,
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, n = N(o, s), a = e.data.map((c) => ({
78
- ...c,
77
+ const { checkinDate: o, checkoutDate: s } = e, c = G(o, s), a = e.data.map((n) => ({
78
+ ...n,
79
79
  nthNightFree: F({
80
- hotel: c,
81
- cards: D ?? [],
82
- nights: n
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 n = e.length < o.length ? e : o, a = e.length >= o.length ? e : o;
95
- for (let c = 0; c < n.length; c++)
96
- e[c] === o[c] && s++;
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
- R(e), t([]), l({
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
- currency: e.currency || p,
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: y.HOTEL,
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 n = 0.8;
131
+ const c = 0.8;
132
132
  return s.data.filter(
133
- (c) => I(c.name.toLowerCase(), e.hotelName.toLowerCase()) >= n
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
- Z as useHotelSearch,
156
- x as validateSearchByCoordsArgs,
157
- R as validateSearchByHotelIdArgs
155
+ X as useHotelSearch,
156
+ R as validateSearchByCoordsArgs,
157
+ x as validateSearchByHotelIdArgs
158
158
  };
@@ -0,0 +1,6 @@
1
+ const U = "USD", s = "mi", D = "US";
2
+ export {
3
+ s as D,
4
+ D as a,
5
+ U as b
6
+ };
@@ -89,10 +89,10 @@ interface ISearchByParams {
89
89
  guests?: number;
90
90
  /**
91
91
  * Optional search currency
92
- * @default 'USD'
92
+ * @default 'US'
93
93
  * @type string
94
94
  */
95
- currency?: string;
95
+ userRegion: string;
96
96
  /**
97
97
  * Optional cash or points search
98
98
  * @default ['cash', 'points']
@@ -12,7 +12,7 @@ export interface ISearchHotelsParams {
12
12
  guests: number;
13
13
  hotel_groups: string[];
14
14
  cash_or_points: string[];
15
- currency: string;
15
+ region_code: string;
16
16
  external_inventory: boolean;
17
17
  use_duffel?: boolean;
18
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@odynn/awayz-hotels",
3
3
  "private": false,
4
- "version": "0.6.23",
4
+ "version": "0.6.24",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -1,5 +0,0 @@
1
- const D = "USD", U = "mi";
2
- export {
3
- U as D,
4
- D as a
5
- };