@odynn/awayz-hotels 0.2.0 → 0.2.2
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,27 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as a, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { a as d, b as i } from "../../../index-D8bHwbxH.js";
|
|
3
3
|
import '../../../assets/Ratings.css';var p = /* @__PURE__ */ ((r) => (r.INHERIT = "inherit", r.PRIMARY = "primary", r.LIGHT = "light", r.DARK = "dark", r))(p || {});
|
|
4
|
-
const
|
|
4
|
+
const o = ({
|
|
5
5
|
starRating: r,
|
|
6
|
-
userRating:
|
|
7
|
-
color:
|
|
6
|
+
userRating: e,
|
|
7
|
+
color: n = "dark",
|
|
8
8
|
fill: c = !1,
|
|
9
|
-
starColor:
|
|
9
|
+
starColor: l = "primary"
|
|
10
10
|
/* PRIMARY */
|
|
11
11
|
}) => {
|
|
12
|
-
if (!r && !
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
12
|
+
if (!r && !e) return null;
|
|
13
|
+
const m = !e || e === 0 || e.toString().toLowerCase() === "none", t = r ? c ? /* @__PURE__ */ s(d, { className: l }) : /* @__PURE__ */ s(i, { className: l }) : null;
|
|
14
|
+
return /* @__PURE__ */ a("div", { className: `rating ${n}`, children: [
|
|
15
|
+
t,
|
|
16
|
+
r ? /* @__PURE__ */ a("p", { children: [
|
|
17
|
+
r,
|
|
18
|
+
"-star"
|
|
19
|
+
] }) : null,
|
|
20
|
+
m ? null : /* @__PURE__ */ a("p", { children: [
|
|
18
21
|
"(",
|
|
19
|
-
|
|
22
|
+
e,
|
|
20
23
|
" rating)"
|
|
21
|
-
] })
|
|
24
|
+
] })
|
|
22
25
|
] });
|
|
23
26
|
};
|
|
24
27
|
export {
|
|
25
28
|
p as ERatingColor,
|
|
26
|
-
|
|
29
|
+
o as default
|
|
27
30
|
};
|
|
@@ -1,67 +1,61 @@
|
|
|
1
1
|
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as N, useRef as H, useEffect as m } from "react";
|
|
3
3
|
import '../../assets/_styles.css';/* empty css */
|
|
4
|
-
import { o as
|
|
4
|
+
import { o as S } from "../../stringUtils-CvWpky85.js";
|
|
5
5
|
import "../../moment-BGjjqtLQ.js";
|
|
6
6
|
import "../../arrayExtensions-cyilNkdJ.js";
|
|
7
|
-
import { UnavailableDate as
|
|
8
|
-
import { c as
|
|
9
|
-
import { HotelChains as
|
|
10
|
-
import
|
|
11
|
-
import { getBookingOptions as
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { UnavailableDate as B } from "../Banners/UnavailableDate/UnavailableDate.js";
|
|
8
|
+
import { c as j, d as w, e as T, f as G, g as E } from "../../index-D8bHwbxH.js";
|
|
9
|
+
import { HotelChains as v } from "../../definitions/HotelChains.js";
|
|
10
|
+
import z, { ERatingColor as D } from "../Banners/Ratings/Ratings.js";
|
|
11
|
+
import { getBookingOptions as L } from "../../utilities/hotelUtils/hotelUtils.js";
|
|
12
|
+
import { CashValue as M } from "@odynn/awayz-core";
|
|
13
|
+
const O = (...e) => e.join(" ");
|
|
14
|
+
function P(e) {
|
|
14
15
|
if (!e || isNaN(e) || e < 0) return "N/A";
|
|
15
16
|
let n = e == null ? void 0 : e.toString().split(".")[0];
|
|
16
17
|
return n == null ? void 0 : n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
if (e <= 0) return "N/A";
|
|
20
|
-
var a = new Intl.NumberFormat("en-US", {
|
|
21
|
-
style: "currency",
|
|
22
|
-
currency: "USD"
|
|
23
|
-
});
|
|
24
|
-
return e ? a.format(Math.round(e)).toString().split(".")[0] : a.format(0);
|
|
25
|
-
}, _ = ({
|
|
19
|
+
const te = ({
|
|
26
20
|
details: e,
|
|
27
21
|
onHotelSelect: n,
|
|
28
|
-
onViewDetails:
|
|
29
|
-
customStyling:
|
|
30
|
-
isSelected:
|
|
22
|
+
onViewDetails: C,
|
|
23
|
+
customStyling: y = !1,
|
|
24
|
+
isSelected: c,
|
|
31
25
|
showBookableTag: R = !1,
|
|
32
|
-
customBookableTag:
|
|
26
|
+
customBookableTag: F = "Bookable"
|
|
33
27
|
}) => {
|
|
34
|
-
var
|
|
35
|
-
const [
|
|
36
|
-
transferPartners:
|
|
37
|
-
bestBookingOption:
|
|
38
|
-
alternateBookingOption:
|
|
39
|
-
hasPoints:
|
|
40
|
-
} =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
clearTimeout(
|
|
28
|
+
var g;
|
|
29
|
+
const [i, u] = N(c), d = H(null), {
|
|
30
|
+
transferPartners: a,
|
|
31
|
+
bestBookingOption: l,
|
|
32
|
+
alternateBookingOption: s,
|
|
33
|
+
hasPoints: V
|
|
34
|
+
} = L(e), [r, I] = N(0), h = a == null ? void 0 : a[r], p = typeof e.cashValue.amount == "number" ? e.cashValue.amount : parseFloat(e.cashValue.amount), { currency: b } = e.cashValue, f = (h == null ? void 0 : h.value) > 0 || (l == null ? void 0 : l.value) > 0 || (s == null ? void 0 : s.value) > 0 || p > 0;
|
|
35
|
+
m(() => {
|
|
36
|
+
c !== void 0 && u(c);
|
|
37
|
+
}, [c]), m(() => {
|
|
38
|
+
const k = setTimeout(() => {
|
|
39
|
+
const x = r >= (a == null ? void 0 : a.length) - 1 ? 0 : r + 1;
|
|
40
|
+
return I(x), () => {
|
|
41
|
+
clearTimeout(k);
|
|
48
42
|
};
|
|
49
43
|
}, 2e3);
|
|
50
|
-
}, [
|
|
51
|
-
const A =
|
|
52
|
-
return
|
|
53
|
-
|
|
44
|
+
}, [r, a == null ? void 0 : a.length]);
|
|
45
|
+
const A = v.isHotelChain(e.hotelGroup);
|
|
46
|
+
return m(() => {
|
|
47
|
+
i && d.current.scrollIntoView({
|
|
54
48
|
behavior: "smooth",
|
|
55
49
|
block: "center"
|
|
56
50
|
});
|
|
57
|
-
}, [
|
|
51
|
+
}, [i]), /* @__PURE__ */ o(
|
|
58
52
|
"div",
|
|
59
53
|
{
|
|
60
|
-
ref:
|
|
61
|
-
className:
|
|
62
|
-
|
|
54
|
+
ref: d,
|
|
55
|
+
className: O(
|
|
56
|
+
y ? "hotel-result" : "awayz-hotel-result",
|
|
63
57
|
// insufficient_points ? 'insufficient-points' : '',
|
|
64
|
-
|
|
58
|
+
i ? "go-to-journey-button" : ""
|
|
65
59
|
),
|
|
66
60
|
"data-testid": "search-result",
|
|
67
61
|
children: [
|
|
@@ -70,7 +64,7 @@ const L = (e, n) => {
|
|
|
70
64
|
{
|
|
71
65
|
className: "content",
|
|
72
66
|
onClick: () => {
|
|
73
|
-
|
|
67
|
+
u(!i), n(e);
|
|
74
68
|
},
|
|
75
69
|
children: [
|
|
76
70
|
/* @__PURE__ */ o("div", { className: "details", children: [
|
|
@@ -82,35 +76,35 @@ const L = (e, n) => {
|
|
|
82
76
|
backgroundImage: `url(${e.images[0]})`
|
|
83
77
|
},
|
|
84
78
|
children: /* @__PURE__ */ o("div", { className: "hotel-chain", children: [
|
|
85
|
-
/* @__PURE__ */ t(
|
|
86
|
-
/* @__PURE__ */ t("p", { children:
|
|
79
|
+
/* @__PURE__ */ t(j, {}),
|
|
80
|
+
/* @__PURE__ */ t("p", { children: v.toString(e.hotelGroup) })
|
|
87
81
|
] })
|
|
88
82
|
}
|
|
89
83
|
),
|
|
90
84
|
/* @__PURE__ */ o("div", { className: "info", children: [
|
|
91
85
|
/* @__PURE__ */ o("div", { className: "hotel-data", children: [
|
|
92
86
|
/* @__PURE__ */ o("div", { className: "hotel-information", children: [
|
|
93
|
-
!!((
|
|
94
|
-
/* @__PURE__ */ t(
|
|
95
|
-
/* @__PURE__ */ t("p", { children:
|
|
87
|
+
!!((g = e.cashBookingOffers) != null && g.accommodationId) && R && /* @__PURE__ */ o("div", { children: [
|
|
88
|
+
/* @__PURE__ */ t(w, {}),
|
|
89
|
+
/* @__PURE__ */ t("p", { children: F })
|
|
96
90
|
] }),
|
|
97
91
|
/* @__PURE__ */ t(
|
|
98
|
-
|
|
92
|
+
z,
|
|
99
93
|
{
|
|
100
94
|
starRating: e.chainRating ?? 0,
|
|
101
|
-
starColor:
|
|
95
|
+
starColor: D.PRIMARY,
|
|
102
96
|
userRating: e.reviewRating ?? "",
|
|
103
97
|
fill: !0
|
|
104
98
|
}
|
|
105
99
|
),
|
|
106
100
|
e.freeNight && /* @__PURE__ */ o("div", { children: [
|
|
107
|
-
/* @__PURE__ */ t(
|
|
101
|
+
/* @__PURE__ */ t(T, {}),
|
|
108
102
|
/* @__PURE__ */ t("p", { children: "Free Night" })
|
|
109
103
|
] }),
|
|
110
104
|
typeof e.nthNightFree == "number" && e.nthNightFree > 0 && /* @__PURE__ */ o("div", { children: [
|
|
111
|
-
/* @__PURE__ */ t(
|
|
105
|
+
/* @__PURE__ */ t(G, {}),
|
|
112
106
|
/* @__PURE__ */ o("p", { children: [
|
|
113
|
-
|
|
107
|
+
S(e.nthNightFree),
|
|
114
108
|
" Night Free"
|
|
115
109
|
] })
|
|
116
110
|
] })
|
|
@@ -119,10 +113,10 @@ const L = (e, n) => {
|
|
|
119
113
|
/* @__PURE__ */ t("p", { className: "hotel-address", children: e.address })
|
|
120
114
|
] }),
|
|
121
115
|
/* @__PURE__ */ t(
|
|
122
|
-
|
|
116
|
+
B,
|
|
123
117
|
{
|
|
124
|
-
hasPoints:
|
|
125
|
-
isAvailable:
|
|
118
|
+
hasPoints: V,
|
|
119
|
+
isAvailable: f,
|
|
126
120
|
selectedHotel: () => {
|
|
127
121
|
},
|
|
128
122
|
chainName: e.hotelGroup
|
|
@@ -130,15 +124,15 @@ const L = (e, n) => {
|
|
|
130
124
|
)
|
|
131
125
|
] })
|
|
132
126
|
] }),
|
|
133
|
-
|
|
127
|
+
f && /* @__PURE__ */ o("div", { className: "payments", children: [
|
|
134
128
|
A && /* @__PURE__ */ o("div", { className: "payment-details", children: [
|
|
135
129
|
/* @__PURE__ */ t("p", { children: "POINTS" }),
|
|
136
|
-
/* @__PURE__ */ t("p", { children:
|
|
130
|
+
/* @__PURE__ */ t("p", { children: P(e.awardPoints) }),
|
|
137
131
|
e.bestValue === "points" && /* @__PURE__ */ t("p", { className: "best-value", children: "Best Value" })
|
|
138
132
|
] }),
|
|
139
133
|
/* @__PURE__ */ o("div", { className: "payment-details", children: [
|
|
140
134
|
/* @__PURE__ */ t("p", { children: "CASH" }),
|
|
141
|
-
/* @__PURE__ */ t(
|
|
135
|
+
/* @__PURE__ */ t(M, { amount: p, currency: b }),
|
|
142
136
|
e.bestValue === "cash" && /* @__PURE__ */ t("p", { className: "best-value", children: "Best Value" })
|
|
143
137
|
] })
|
|
144
138
|
] })
|
|
@@ -150,9 +144,9 @@ const L = (e, n) => {
|
|
|
150
144
|
{
|
|
151
145
|
"data-testid": "go-to-journey-button",
|
|
152
146
|
onClick: () => {
|
|
153
|
-
|
|
147
|
+
C(e);
|
|
154
148
|
},
|
|
155
|
-
children: /* @__PURE__ */ t(
|
|
149
|
+
children: /* @__PURE__ */ t(E, {})
|
|
156
150
|
}
|
|
157
151
|
)
|
|
158
152
|
]
|
|
@@ -160,5 +154,5 @@ const L = (e, n) => {
|
|
|
160
154
|
);
|
|
161
155
|
};
|
|
162
156
|
export {
|
|
163
|
-
|
|
157
|
+
te as HotelResult
|
|
164
158
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-hotels",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@odynn/awayz-core": "^0.2.
|
|
68
|
+
"@odynn/awayz-core": "^0.2.1",
|
|
69
69
|
"@tanstack/react-query": "^5.66.9"
|
|
70
70
|
}
|
|
71
71
|
}
|