@odynn/awayz-hotels 0.3.14 → 0.3.16
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/Legend/Legend.js +49 -46
- package/dist/{enums-CY3zsgNW.js → enums-DQwp1Z7V.js} +1 -1
- package/dist/hooks/useHotelSearch/useHotelSearch.js +1 -1
- package/dist/hooks/useLocationSearch/useLocationSearch.js +1 -1
- package/dist/lib/components/Legend/Legend.d.ts +5 -4
- package/dist/lib/hooks/useHotelDetails/useHotelDetails.types.d.ts +1 -0
- package/dist/lib/main.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { HotelChains as
|
|
5
|
-
import
|
|
6
|
-
import '../../assets/Legend.css';const
|
|
1
|
+
import { jsx as r, Fragment as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as L, useMemo as b, useEffect as y } from "react";
|
|
3
|
+
import { F as x } from "../../index-5WzIR8j6.js";
|
|
4
|
+
import { HotelChains as i } from "../../definitions/HotelChains.js";
|
|
5
|
+
import u from "../Checkbox/Checkbox.js";
|
|
6
|
+
import '../../assets/Legend.css';const j = ({
|
|
7
7
|
hotelResults: l,
|
|
8
|
-
onChange:
|
|
8
|
+
onChange: h,
|
|
9
9
|
value: n,
|
|
10
10
|
onOtherFilters: f
|
|
11
11
|
}) => {
|
|
12
|
-
var g,
|
|
13
|
-
const [p, N] =
|
|
14
|
-
const s = e.map((
|
|
12
|
+
var g, k;
|
|
13
|
+
const [p, N] = L(!1), C = (e) => {
|
|
14
|
+
const s = e.map((o) => o.hotelGroup);
|
|
15
15
|
return Array.from(new Set(s));
|
|
16
|
-
},
|
|
16
|
+
}, c = b(
|
|
17
17
|
() => C(l),
|
|
18
|
-
[l,
|
|
19
|
-
),
|
|
20
|
-
const s = n || [],
|
|
21
|
-
s.length ===
|
|
18
|
+
[l, h]
|
|
19
|
+
), S = (e) => {
|
|
20
|
+
const s = n || [], t = s.includes(e) ? s.filter((m) => m !== e) : [...s, e];
|
|
21
|
+
s.length === t.length && s.every((m) => t.includes(m)) || h(t);
|
|
22
22
|
};
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
return y(() => {
|
|
24
|
+
const e = C(l), s = (n || []).filter(
|
|
25
|
+
(t) => e.includes(t)
|
|
26
|
+
);
|
|
27
|
+
JSON.stringify(s.sort()) !== JSON.stringify((n || []).sort()) && h(s);
|
|
28
|
+
}, [l]), !c || c.length === 0 ? /* @__PURE__ */ r(a, {}) : /* @__PURE__ */ d("div", { className: `hotel-legend ${p ? "" : "is-open"}`, children: [
|
|
29
|
+
/* @__PURE__ */ d(
|
|
27
30
|
"div",
|
|
28
31
|
{
|
|
29
32
|
className: "header",
|
|
@@ -32,47 +35,47 @@ import '../../assets/Legend.css';const H = ({
|
|
|
32
35
|
},
|
|
33
36
|
children: [
|
|
34
37
|
/* @__PURE__ */ r("p", { children: "Legend" }),
|
|
35
|
-
/* @__PURE__ */ r(
|
|
38
|
+
/* @__PURE__ */ r(x, { className: "chevron" })
|
|
36
39
|
]
|
|
37
40
|
}
|
|
38
41
|
),
|
|
39
|
-
/* @__PURE__ */ r("div", { className: "filter-content", children: /* @__PURE__ */
|
|
40
|
-
(
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
})) == null ? void 0 : g.filter((e) =>
|
|
44
|
-
|
|
42
|
+
/* @__PURE__ */ r("div", { className: "filter-content", children: /* @__PURE__ */ d("div", { className: "inner", children: [
|
|
43
|
+
(k = (g = c == null ? void 0 : c.sort((e, s) => {
|
|
44
|
+
const t = i.toString(e), o = i.toString(s);
|
|
45
|
+
return t.localeCompare(o);
|
|
46
|
+
})) == null ? void 0 : g.filter((e) => i.toList().includes(e))) == null ? void 0 : k.map((e) => /* @__PURE__ */ r("div", { className: "chain", children: /* @__PURE__ */ r(
|
|
47
|
+
u,
|
|
45
48
|
{
|
|
46
|
-
label:
|
|
47
|
-
style: { backgroundColor:
|
|
48
|
-
onChange: () =>
|
|
49
|
-
checked: (n
|
|
49
|
+
label: i.toString(e),
|
|
50
|
+
style: { backgroundColor: i.toColour(e) },
|
|
51
|
+
onChange: () => S(e),
|
|
52
|
+
checked: !(n != null && n.includes(e))
|
|
50
53
|
}
|
|
51
54
|
) }, e)),
|
|
52
|
-
|
|
53
|
-
(e) => !
|
|
54
|
-
) && /* @__PURE__ */
|
|
55
|
+
c.some(
|
|
56
|
+
(e) => !i.toList().includes(e)
|
|
57
|
+
) && /* @__PURE__ */ d(a, { children: [
|
|
55
58
|
/* @__PURE__ */ r("hr", {}),
|
|
56
59
|
/* @__PURE__ */ r("div", { className: "chain", children: /* @__PURE__ */ r(
|
|
57
|
-
|
|
60
|
+
u,
|
|
58
61
|
{
|
|
59
62
|
label: "Other Properties",
|
|
60
|
-
style: { backgroundColor:
|
|
61
|
-
checked: (n
|
|
62
|
-
(e) => !
|
|
63
|
-
))
|
|
63
|
+
style: { backgroundColor: i.toColour("other") },
|
|
64
|
+
checked: !(n != null && n.some(
|
|
65
|
+
(e) => !i.toList().includes(e)
|
|
66
|
+
)),
|
|
64
67
|
onChange: () => {
|
|
65
|
-
const e =
|
|
66
|
-
(o) => !
|
|
67
|
-
),
|
|
68
|
-
(o) => !
|
|
69
|
-
) ? n.filter((o) => !e.includes(o)) : [...n || [], ...e];
|
|
70
|
-
|
|
68
|
+
const e = c.filter(
|
|
69
|
+
(o) => !i.toList().includes(o)
|
|
70
|
+
), t = (n == null ? void 0 : n.some(
|
|
71
|
+
(o) => !i.toList().includes(o)
|
|
72
|
+
)) ? n.filter((o) => !e.includes(o)) : [...n || [], ...e];
|
|
73
|
+
h(t);
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
) })
|
|
74
77
|
] }),
|
|
75
|
-
!!f && /* @__PURE__ */
|
|
78
|
+
!!f && /* @__PURE__ */ d(a, { children: [
|
|
76
79
|
/* @__PURE__ */ r("hr", {}),
|
|
77
80
|
/* @__PURE__ */ r("p", { onClick: f, className: "more-filters", children: "More Filters" })
|
|
78
81
|
] })
|
|
@@ -80,5 +83,5 @@ import '../../assets/Legend.css';const H = ({
|
|
|
80
83
|
] });
|
|
81
84
|
};
|
|
82
85
|
export {
|
|
83
|
-
|
|
86
|
+
j as Legend
|
|
84
87
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var S = /* @__PURE__ */ ((R) => (R.LOCATIONS = "LOCATIONS", R.CHECK_USER = "CHECK_USER", R.USER_REGIONS = "USER_REGIONS", R.CONVERT_CURRENCY = "CONVERT_CURRENCY", R.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", R.SEARCH_LIMIT = "SEARCH_LIMIT", R.PROGRAMS = "PROGRAMS", R.BANKS = "BANKS", R.CARDS = "CARDS", R.USER_CARDS = "USER_CARDS", R.TRIPS = "TRIPS", R.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", R.BOOKING = "BOOKING", R))(S || {});
|
|
1
|
+
var S = /* @__PURE__ */ ((R) => (R.LOCATIONS = "LOCATIONS", R.CHECK_USER = "CHECK_USER", R.USER_REGIONS = "USER_REGIONS", R.CONVERT_CURRENCY = "CONVERT_CURRENCY", R.CLIENT_COMPONENT_KEY = "CLIENT_COMPONENT_KEY", R.SEARCH_LIMIT = "SEARCH_LIMIT", R.PROGRAMS = "PROGRAMS", R.USER_PROGRAMS = "USER_PROGRAMS", R.BANKS = "BANKS", R.CARDS = "CARDS", R.USER_CARDS = "USER_CARDS", R.TRIPS = "TRIPS", R.UNCATEGORISED_BOOKINGS = "UNCATEGORISED_BOOKINGS", R.BOOKING = "BOOKING", R))(S || {});
|
|
2
2
|
export {
|
|
3
3
|
S as E
|
|
4
4
|
};
|
|
@@ -5,7 +5,7 @@ import { HotelChains as s } from "../../definitions/HotelChains.js";
|
|
|
5
5
|
import { h as a } from "../../moment-BGjjqtLQ.js";
|
|
6
6
|
import P from "../../stores/useHotelsStore.js";
|
|
7
7
|
import { g as T } from "../../dateUtils-C1hKW8MF.js";
|
|
8
|
-
import { E as f } from "../../enums-
|
|
8
|
+
import { E as f } from "../../enums-DQwp1Z7V.js";
|
|
9
9
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import { checkNthNightFree as B } from "../../utilities/hotelUtils/freeNightUtils.js";
|
|
@@ -2,7 +2,7 @@ import { useQuery as u } from "@tanstack/react-query";
|
|
|
2
2
|
import { HotelService as l } from "../../services/hotel/HotelService.js";
|
|
3
3
|
import "../../moment-BGjjqtLQ.js";
|
|
4
4
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
5
|
-
import { E as d } from "../../enums-
|
|
5
|
+
import { E as d } from "../../enums-DQwp1Z7V.js";
|
|
6
6
|
import { useState as f, useEffect as L } from "react";
|
|
7
7
|
import { defaultSimilarityThreshold as p, defaultLocationSortOrder as y, duffelTestHotelLocation as T } from "../../configs/defaults.js";
|
|
8
8
|
import { sortLocationResults as E } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
@@ -5,12 +5,12 @@ export interface ILegendProps {
|
|
|
5
5
|
*/
|
|
6
6
|
hotelResults: IHotelDetails[];
|
|
7
7
|
/**
|
|
8
|
-
* Callback function to handle changes in the
|
|
9
|
-
* @param
|
|
8
|
+
* Callback function to handle changes in the unchecked hotel chains.
|
|
9
|
+
* @param uncheckedHotels - The updated list of unchecked hotel chains.
|
|
10
10
|
*/
|
|
11
|
-
onChange: (
|
|
11
|
+
onChange: (uncheckedHotels: string[]) => void;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The unchecked hotel chains.
|
|
14
14
|
*/
|
|
15
15
|
value: string[];
|
|
16
16
|
/**
|
|
@@ -21,6 +21,7 @@ export interface ILegendProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* The `Legend` component displays a list of hotel chains and allows users to filter hotels based on their loyalty programs.
|
|
23
23
|
* It also provides an option to view more filters if available.
|
|
24
|
+
* The component uses unchecked items to track which hotel chains should be filtered out.
|
|
24
25
|
*
|
|
25
26
|
* @param {ILegendProps} props - The properties for the Legend component.
|
|
26
27
|
* @returns {JSX.Element} The rendered Legend component.
|
package/dist/lib/main.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { IRoom, IRate } from './services/booking/BookingService.types';
|
|
|
2
2
|
import { IHotelDetails } from './components/HotelResult/HotelResult.types';
|
|
3
3
|
import { IPointsAsCash } from './utilities/pointsAsCashUtils';
|
|
4
4
|
import { checkNthNightFree } from './utilities/hotelUtils/freeNightUtils';
|
|
5
|
+
import { IAirlineProgram } from './services/wallet/WalletService.types';
|
|
5
6
|
export { ESearchType } from './services/hotel/HotelService.types';
|
|
6
7
|
export * from './components';
|
|
7
8
|
export * from './hooks';
|
|
8
9
|
export * from './enums';
|
|
9
10
|
export * from './configs';
|
|
10
|
-
export type { IRoom, IRate, IHotelDetails, IPointsAsCash, checkNthNightFree };
|
|
11
|
+
export type { IRoom, IRate, IHotelDetails, IPointsAsCash, checkNthNightFree, IAirlineProgram };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-hotels",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.16",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@odynn/awayz-core": "^0.3.
|
|
64
|
+
"@odynn/awayz-core": "^0.3.23",
|
|
65
65
|
"@tanstack/react-query": "^5.66.9",
|
|
66
66
|
"string-comparison": "^1.3.0"
|
|
67
67
|
}
|