@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.
@@ -1,29 +1,32 @@
1
- import { jsx as r, Fragment as h, jsxs as c } from "react/jsx-runtime";
2
- import { useState as S, useMemo as b, useEffect as x } from "react";
3
- import k from "../Checkbox/Checkbox.js";
4
- import { HotelChains as t } from "../../definitions/HotelChains.js";
5
- import { F as w } from "../../index-5WzIR8j6.js";
6
- import '../../assets/Legend.css';const H = ({
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: d,
8
+ onChange: h,
9
9
  value: n,
10
10
  onOtherFilters: f
11
11
  }) => {
12
- var g, u;
13
- const [p, N] = S(!1), C = (e) => {
14
- const s = e.map((m) => m.hotelGroup);
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
- }, i = b(
16
+ }, c = b(
17
17
  () => C(l),
18
- [l, d]
19
- ), L = (e) => {
20
- const s = n || [], o = s.includes(e) ? s.filter((a) => a !== e) : [...s, e];
21
- s.length === o.length && s.every((a) => o.includes(a)) || d(o);
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 x(() => {
24
- d(C(l));
25
- }, [l]), !i || i.length === 0 ? /* @__PURE__ */ r(h, {}) : /* @__PURE__ */ c("div", { className: `hotel-legend ${p ? "" : "is-open"}`, children: [
26
- /* @__PURE__ */ c(
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(w, { className: "chevron" })
38
+ /* @__PURE__ */ r(x, { className: "chevron" })
36
39
  ]
37
40
  }
38
41
  ),
39
- /* @__PURE__ */ r("div", { className: "filter-content", children: /* @__PURE__ */ c("div", { className: "inner", children: [
40
- (u = (g = i == null ? void 0 : i.sort((e, s) => {
41
- const o = t.toString(e), m = t.toString(s);
42
- return o.localeCompare(m);
43
- })) == null ? void 0 : g.filter((e) => t.toList().includes(e))) == null ? void 0 : u.map((e) => /* @__PURE__ */ r("div", { className: "chain", children: /* @__PURE__ */ r(
44
- k,
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: t.toString(e),
47
- style: { backgroundColor: t.toColour(e) },
48
- onChange: () => L(e),
49
- checked: (n == null ? void 0 : n.includes(e)) || !1
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
- i.some(
53
- (e) => !t.toList().includes(e)
54
- ) && /* @__PURE__ */ c(h, { children: [
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
- k,
60
+ u,
58
61
  {
59
62
  label: "Other Properties",
60
- style: { backgroundColor: t.toColour("other") },
61
- checked: (n == null ? void 0 : n.some(
62
- (e) => !t.toList().includes(e)
63
- )) || !1,
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 = i.filter(
66
- (o) => !t.toList().includes(o)
67
- ), s = n != null && n.some(
68
- (o) => !t.toList().includes(o)
69
- ) ? n.filter((o) => !e.includes(o)) : [...n || [], ...e];
70
- d(s);
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__ */ c(h, { children: [
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
- H as Legend
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-CY3zsgNW.js";
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-CY3zsgNW.js";
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 selected hotel chains.
9
- * @param checkedHotels - The updated list of selected hotel chains.
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: (checkedHotels: string[]) => void;
11
+ onChange: (uncheckedHotels: string[]) => void;
12
12
  /**
13
- * The selected hotel chains.
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.
@@ -172,6 +172,7 @@ export interface ITransferPartner {
172
172
  region: string;
173
173
  partnerProgramCategory: string[];
174
174
  transferTime: string;
175
+ programLogo: string;
175
176
  }
176
177
  export interface IStep {
177
178
  text: string;
@@ -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.14",
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.22",
64
+ "@odynn/awayz-core": "^0.3.23",
65
65
  "@tanstack/react-query": "^5.66.9",
66
66
  "string-comparison": "^1.3.0"
67
67
  }