@odynn/awayz-hotels 0.1.0
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/README.md +1 -0
- package/dist/arrayExtensions-fPXUw0L-.js +6 -0
- package/dist/assets/HotelResults.css +1 -0
- package/dist/assets/_styles.css +1 -0
- package/dist/components/HotelResult/HotelResult.js +88 -0
- package/dist/components/HotelResult/HotelResult.types.js +1 -0
- package/dist/components/HotelResult/HotelResultSkeleton.js +25 -0
- package/dist/components/HotelResults/HotelResults.js +16 -0
- package/dist/components/index.js +6 -0
- package/dist/configs/endpoints.js +4 -0
- package/dist/configs/settings.js +4 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/useHotelSearch/useHotelSearch.js +45 -0
- package/dist/hooks/useHotelSearch/useHotelSearch.types.js +1 -0
- package/dist/hooks/useLocationSearch.js +17 -0
- package/dist/lib/components/HotelResult/HotelResult.d.ts +16 -0
- package/dist/lib/components/HotelResult/HotelResult.types.d.ts +82 -0
- package/dist/lib/components/HotelResult/HotelResultSkeleton.d.ts +2 -0
- package/dist/lib/components/HotelResults/HotelResults.d.ts +7 -0
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/configs/endpoints.d.ts +5 -0
- package/dist/lib/configs/settings.d.ts +1 -0
- package/dist/lib/hooks/index.d.ts +2 -0
- package/dist/lib/hooks/useHotelSearch/useHotelSearch.d.ts +11 -0
- package/dist/lib/hooks/useHotelSearch/useHotelSearch.types.d.ts +85 -0
- package/dist/lib/hooks/useLocationSearch.d.ts +6 -0
- package/dist/lib/main.d.ts +3 -0
- package/dist/lib/services/hotel/HotelService.d.ts +10 -0
- package/dist/lib/services/hotel/HotelService.types.d.ts +156 -0
- package/dist/lib/services/instance.d.ts +2 -0
- package/dist/main.js +12 -0
- package/dist/services/hotel/HotelService.js +101 -0
- package/dist/services/hotel/HotelService.types.js +4 -0
- package/dist/services/instance.js +1697 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# TODO: Add Readme
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";@media (prefers-color-scheme: dark){body[data-theme=auto]{--background: #14181f;--opaque-background: #20242880;--foreground: #22272d;--text: #c3c9d2;--text-light: #c3c9d260;--border: #3b4048}}@media (prefers-color-scheme: light){body[data-theme=auto]{--background: #f9fdff;--opaque-background: #f9fdff95;--foreground: #fff;--text: #252e34;--text-light: #252e3460;--border: #e7eef3}}body[data-theme=light]{--background: #f9fdff;--opaque-background: #f9fdff95;--foreground: #fff;--text: #252e34;--text-light: #252e3460;--border: #e7eef3}*{font-family:Inter,sans-serif!important;margin:0;padding:0;box-sizing:border-box}:root{font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.awayz-hotel-results{display:flex;flex-direction:column;gap:1rem}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";@media (prefers-color-scheme: dark){body[data-theme=auto]{--background: #14181f;--opaque-background: #20242880;--foreground: #22272d;--text: #c3c9d2;--text-light: #c3c9d260;--border: #3b4048}}@media (prefers-color-scheme: light){body[data-theme=auto]{--background: #f9fdff;--opaque-background: #f9fdff95;--foreground: #fff;--text: #252e34;--text-light: #252e3460;--border: #e7eef3}}body[data-theme=light]{--background: #f9fdff;--opaque-background: #f9fdff95;--foreground: #fff;--text: #252e34;--text-light: #252e3460;--border: #e7eef3}*{font-family:Inter,sans-serif!important;margin:0;padding:0;box-sizing:border-box}:root{font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.awayz-hotel-result{background-color:var(--foreground, #fff);border:1px solid var(--border, #e7eef3);border-radius:.5rem;display:flex;overflow:hidden;cursor:pointer;animation:spring-in .5s ease-in-out both}.awayz-hotel-result:nth-child(1){animation-delay:.1s}.awayz-hotel-result:nth-child(2){animation-delay:.2s}.awayz-hotel-result:nth-child(3){animation-delay:.3s}.awayz-hotel-result:nth-child(4){animation-delay:.4s}.awayz-hotel-result:nth-child(5){animation-delay:.5s}.awayz-hotel-result:nth-child(6){animation-delay:.6s}.awayz-hotel-result:nth-child(7){animation-delay:.7s}.awayz-hotel-result:nth-child(8){animation-delay:.8s}.awayz-hotel-result:nth-child(9){animation-delay:.9s}.awayz-hotel-result:nth-child(10){animation-delay:1s}.awayz-hotel-result.search-skeleton .content .hotel-data{display:flex;flex-direction:column;gap:.5rem}.awayz-hotel-result.search-skeleton .content .hotel-image{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent}.awayz-hotel-result.search-skeleton .content .hotel-name{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:20px;width:75%;border-radius:4px}.awayz-hotel-result.search-skeleton .content .hotel-address{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:15px;width:95%;border-radius:4px}.awayz-hotel-result.search-skeleton .content .hotel-dates{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:15px;width:45%;border-radius:4px}.awayz-hotel-result.search-skeleton .content .payments>div{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:40px;width:100%;border-radius:4px;border-color:#fff}.awayz-hotel-result.search-skeleton .content .payments>div:first-of-type{width:25%}.awayz-hotel-result.skeleton{animation:spring-in .5s ease-in-out both}.awayz-hotel-result.skeleton:nth-child(1){animation-delay:.1s}.awayz-hotel-result.skeleton:nth-child(2){animation-delay:.2s}.awayz-hotel-result.skeleton:nth-child(3){animation-delay:.3s}.awayz-hotel-result.skeleton:nth-child(4){animation-delay:.4s}.awayz-hotel-result.skeleton:nth-child(5){animation-delay:.5s}.awayz-hotel-result.skeleton .content .hotel-image{background-color:var(--text-light, rgba(37, 46, 52, .2509803922));background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent}.awayz-hotel-result.skeleton .content .info{display:flex;flex-direction:column;gap:10px}.awayz-hotel-result.skeleton .content .info .hotel-name{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:20px;width:75%;border-radius:4px}.awayz-hotel-result.skeleton .content .info .hotel-address{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:15px;width:95%;border-radius:4px}.awayz-hotel-result.skeleton .content .info .hotel-dates{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:15px;width:45%;border-radius:4px}.awayz-hotel-result.skeleton .content .payments>div{background-color:var(--border, #e7eef3);background-size:300%;background-position:100% 0;animation:shimmer 2s infinite;color:transparent;height:40px;width:100%;border-radius:4px;border-color:#fff}.awayz-hotel-result.skeleton .content .payments>div:first-of-type{width:25%}.awayz-hotel-result .no-point-availability{display:flex;gap:8px;color:#ff7f2f;flex-direction:row;background-color:#ff7f2f20;border:1px solid #ff7f2f;padding:5px 8px;border-radius:4px;align-items:center;margin-top:5px}.awayz-hotel-result .no-point-availability p{font-size:.6rem;text-transform:uppercase;font-weight:500}.awayz-hotel-result .content{padding:1rem;flex:1;display:flex;flex-direction:column;gap:.5rem}.awayz-hotel-result .content .details{display:flex;gap:.5rem}.awayz-hotel-result .content .details .hotel-image{min-width:150px;width:150px;min-height:100px;background-position:center;background-size:cover;border-radius:.25rem;padding:.5rem;display:flex;flex-direction:row;align-items:flex-start;gap:.4rem}@media screen and (max-width: 1024px){.awayz-hotel-result .content .details{flex-direction:column}.awayz-hotel-result .content .details .hotel-image{width:100%;min-width:100%;min-height:150px}}.awayz-hotel-result .content .details .hotel-chain{background-color:var(--foreground, #fff);padding:.2rem .5em;display:flex;gap:.5rem;align-items:center;border-radius:.25rem;font-size:.8rem;max-width:fit-content}.awayz-hotel-result .content .details .hotel-live-tag{background-color:var(--foreground, #fff);color:#1495f2;padding:.2rem .5em;display:flex;gap:.5rem;align-items:center;border-radius:.25rem;font-size:.8rem;max-width:fit-content}.awayz-hotel-result .content .details .info{display:flex;flex-direction:column;width:100%}.awayz-hotel-result .content .details .info .hotel-data{flex:1}.awayz-hotel-result .content .details .info .hotel-data .hotel-name{font-weight:500}.awayz-hotel-result .content .details .info .hotel-data .hotel-address{font-size:.8rem;opacity:.6}.awayz-hotel-result .content .details .info .best-value{display:flex;flex-direction:column}.awayz-hotel-result .content .details .info .best-value p{margin:0}.awayz-hotel-result .content .details .info .best-value p:first-child{font-size:.6rem;opacity:.6;margin-top:2px}.awayz-hotel-result .content .details .info .best-value p span{font-size:.6rem;opacity:.6}.awayz-hotel-result .content .details .info .best-value p:last-child{font-size:1.4rem;font-weight:500}.awayz-hotel-result .content .payments{display:flex;align-items:center;gap:1rem}.awayz-hotel-result .content .payments .payment-details{background-color:var(--foreground, #fff);padding:.4rem .5rem;border-radius:.25rem;display:flex;flex-direction:column;border:1px solid var(--border, #e7eef3);flex:1;position:relative;gap:.1rem}.awayz-hotel-result .content .payments .payment-details .best-value{background-color:#1495f2;color:var(--foreground, #fff);padding:.2rem .5rem;border-radius:.25rem;text-align:center;font-size:.6rem;font-weight:500;width:fit-content;position:absolute;right:4px;top:4px}.awayz-hotel-result .content .payments .payment-details p{margin:0;font-weight:500}.awayz-hotel-result .content .payments .payment-details p:first-child{color:#1495f2;font-size:.7rem}.awayz-hotel-result .content .payments .payment-details p>span:not(.currency-conversion){opacity:.4;font-size:.8rem}.awayz-hotel-result button{margin:0;background-color:#1495f2;color:var(--foreground, #fff);border:none;overflow:hidden;width:0;padding:0;display:flex;align-items:center;justify-content:center;transition:all .2s ease-in-out}.hotel-information{display:flex;flex-wrap:wrap;gap:10px;align-items:center;font-size:x-small;color:#1495f2;margin-bottom:5px}.hotel-information>div{display:flex;align-items:center;gap:5px;border-radius:.5rem;padding:5px;border:1px solid var(--border, #e7eef3)}.hotel-information>div p{color:var(--text-light, rgba(37, 46, 52, .2509803922))}.insufficient-points{opacity:.6;transition:all .2s ease-in-out}.insufficient-points:hover{opacity:1}.go-to-journey-button button{width:30px}.go-to-journey-button b{min-width:30px;white-space:nowrap;overflow:hidden;max-lines:1;text-overflow:ellipsis}.go-to-journey-button :hover{cursor:pointer}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i } from "react";
|
|
3
|
+
import '../../assets/_styles.css';/* empty css */
|
|
4
|
+
import "../../arrayExtensions-fPXUw0L-.js";
|
|
5
|
+
const n = (...e) => e.join(" ");
|
|
6
|
+
function c(e) {
|
|
7
|
+
if (!e || isNaN(e) || e < 0) return "N/A";
|
|
8
|
+
let r = e == null ? void 0 : e.toString().split(".")[0];
|
|
9
|
+
return r == null ? void 0 : r.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
10
|
+
}
|
|
11
|
+
const o = (e, r) => {
|
|
12
|
+
if (e <= 0) return "N/A";
|
|
13
|
+
var s = new Intl.NumberFormat("en-US", {
|
|
14
|
+
style: "currency",
|
|
15
|
+
currency: "USD"
|
|
16
|
+
});
|
|
17
|
+
return e ? s.format(Math.round(e)).toString().split(".")[0] : s.format(0);
|
|
18
|
+
}, N = ({
|
|
19
|
+
details: e,
|
|
20
|
+
useCustomStyling: r = !1
|
|
21
|
+
}) => {
|
|
22
|
+
const [s, l] = i(!1);
|
|
23
|
+
return /* @__PURE__ */ a(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: n(
|
|
27
|
+
r ? "hotel-result" : "awayz-hotel-result",
|
|
28
|
+
// insufficient_points ? 'insufficient-points' : '',
|
|
29
|
+
s ? "go-to-journey-button" : ""
|
|
30
|
+
),
|
|
31
|
+
"data-testid": "search-result",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ a(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: "content",
|
|
37
|
+
onClick: () => {
|
|
38
|
+
l(!s);
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ a("div", { className: "details", children: [
|
|
42
|
+
/* @__PURE__ */ t(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: "hotel-image",
|
|
46
|
+
style: {
|
|
47
|
+
backgroundImage: `url(${e.images[0]})`
|
|
48
|
+
},
|
|
49
|
+
children: /* @__PURE__ */ t("div", { className: "hotel-chain" })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ t("div", { className: "info", children: /* @__PURE__ */ a("div", { className: "hotel-data", children: [
|
|
53
|
+
/* @__PURE__ */ t("div", { className: "hotel-information" }),
|
|
54
|
+
/* @__PURE__ */ t("p", { className: "hotel-name", children: e.name }),
|
|
55
|
+
/* @__PURE__ */ t("p", { className: "hotel-address", children: e.address })
|
|
56
|
+
] }) })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ a("div", { className: "payments", children: [
|
|
59
|
+
/* @__PURE__ */ a("div", { className: "payment-details", children: [
|
|
60
|
+
/* @__PURE__ */ t("p", { children: "POINTS" }),
|
|
61
|
+
/* @__PURE__ */ t("p", { children: c(e.awardPoints) }),
|
|
62
|
+
e.bestValue === "points" && /* @__PURE__ */ t("p", { className: "best-value", children: "Best Value" })
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ a("div", { className: "payment-details", children: [
|
|
65
|
+
/* @__PURE__ */ t("p", { children: "CASH" }),
|
|
66
|
+
/* @__PURE__ */ t("p", { children: o(e.cashValue.amount) }),
|
|
67
|
+
e.bestValue === "cash" && /* @__PURE__ */ t("p", { className: "best-value", children: "Best Value" })
|
|
68
|
+
] })
|
|
69
|
+
] })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ t(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
"data-testid": "go-to-journey-button",
|
|
77
|
+
onClick: () => {
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ t("b", { children: "->" })
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
N as HotelResult
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/_styles.css';/* empty css */
|
|
3
|
+
const i = () => /* @__PURE__ */ e("div", { className: "awayz-hotel-result search-skeleton", children: /* @__PURE__ */ a("div", { className: "content", children: [
|
|
4
|
+
/* @__PURE__ */ a("div", { className: "details", children: [
|
|
5
|
+
/* @__PURE__ */ e("div", { className: "hotel-image" }),
|
|
6
|
+
/* @__PURE__ */ e("div", { className: "info", children: /* @__PURE__ */ a("div", { className: "hotel-data", children: [
|
|
7
|
+
/* @__PURE__ */ e("p", { className: "hotel-name" }),
|
|
8
|
+
/* @__PURE__ */ e("p", { className: "hotel-address" }),
|
|
9
|
+
/* @__PURE__ */ e("div", { className: "star-ratings" })
|
|
10
|
+
] }) })
|
|
11
|
+
] }),
|
|
12
|
+
/* @__PURE__ */ a("div", { className: "payments", children: [
|
|
13
|
+
/* @__PURE__ */ a("div", { className: "payment-details", children: [
|
|
14
|
+
/* @__PURE__ */ e("p", {}),
|
|
15
|
+
/* @__PURE__ */ e("p", {})
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ a("div", { className: "payment-details", children: [
|
|
18
|
+
/* @__PURE__ */ e("p", {}),
|
|
19
|
+
/* @__PURE__ */ e("p", {})
|
|
20
|
+
] })
|
|
21
|
+
] })
|
|
22
|
+
] }) });
|
|
23
|
+
export {
|
|
24
|
+
i as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { HotelResult as o } from "../HotelResult/HotelResult.js";
|
|
3
|
+
import '../../assets/HotelResults.css';const m = ({
|
|
4
|
+
hotelResults: s,
|
|
5
|
+
useCustomStyling: l = !1
|
|
6
|
+
}) => /* @__PURE__ */ t("div", { className: "awayz-hotel-results", children: s.map((e) => /* @__PURE__ */ t(
|
|
7
|
+
o,
|
|
8
|
+
{
|
|
9
|
+
details: e,
|
|
10
|
+
useCustomStyling: l
|
|
11
|
+
},
|
|
12
|
+
e.hotelId
|
|
13
|
+
)) });
|
|
14
|
+
export {
|
|
15
|
+
m as HotelResults
|
|
16
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState as r } from "react";
|
|
2
|
+
import { HotelService as n } from "../../services/hotel/HotelService.js";
|
|
3
|
+
import { ESearchType as u } from "../../services/hotel/HotelService.types.js";
|
|
4
|
+
const _ = () => {
|
|
5
|
+
const [h, s] = r([]), [a, t] = r(!1);
|
|
6
|
+
return {
|
|
7
|
+
results: h,
|
|
8
|
+
loading: a,
|
|
9
|
+
searchByCoords: async (e) => {
|
|
10
|
+
t(!0);
|
|
11
|
+
const c = {
|
|
12
|
+
check_in_date: e.checkinDate,
|
|
13
|
+
check_out_date: e.checkoutDate,
|
|
14
|
+
guests: e.guests || 2,
|
|
15
|
+
rooms: e.rooms || 1,
|
|
16
|
+
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
17
|
+
currency: e.currency || "USD",
|
|
18
|
+
lat: e.coords.latitude,
|
|
19
|
+
lon: e.coords.longitude,
|
|
20
|
+
search_range: e.searchRange || 10,
|
|
21
|
+
range_type: e.rangeType || "mi",
|
|
22
|
+
hotel_groups: e.hotelGroups || ["accor"],
|
|
23
|
+
type: e.searchType || u.CITY
|
|
24
|
+
}, o = await n.searchByCoords(c);
|
|
25
|
+
o.success && s(o.data), t(!1);
|
|
26
|
+
},
|
|
27
|
+
searchByHotelId: async (e) => {
|
|
28
|
+
t(!0);
|
|
29
|
+
const c = {
|
|
30
|
+
check_in_date: e.checkinDate,
|
|
31
|
+
check_out_date: e.checkoutDate,
|
|
32
|
+
hotel_id: e.hotelId,
|
|
33
|
+
rooms: e.rooms || 1,
|
|
34
|
+
guests: e.guests || 2,
|
|
35
|
+
currency: e.currency || "USD",
|
|
36
|
+
cash_or_points: e.cashOrPoints || ["cash", "points"],
|
|
37
|
+
hotel_group: e.hotelGroup
|
|
38
|
+
}, o = await n.searchByHotelId(c);
|
|
39
|
+
o.success && s(o.data), t(!1);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
_ as useHotelSearch
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useState as t } from "react";
|
|
2
|
+
import { HotelService as i } from "../services/hotel/HotelService.js";
|
|
3
|
+
const l = () => {
|
|
4
|
+
const [e, a] = t([]), [c, o] = t(!1);
|
|
5
|
+
return {
|
|
6
|
+
locations: e,
|
|
7
|
+
loading: c,
|
|
8
|
+
searchLocations: async (n) => {
|
|
9
|
+
o(!0);
|
|
10
|
+
const s = await i.getLocations(n);
|
|
11
|
+
s.success && a(s.data), o(!1);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
l as useLocationSearch
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IHotelDetails } from './HotelResult.types';
|
|
2
|
+
export interface IHotelResultProps {
|
|
3
|
+
/**
|
|
4
|
+
* The details of the hotel retrieved from the `useHotelSearch` hook.
|
|
5
|
+
*/
|
|
6
|
+
details: IHotelDetails;
|
|
7
|
+
/**
|
|
8
|
+
* Flag to determine if custom styling should be used. If `false`, the component will use the default Awayz Style.
|
|
9
|
+
*/
|
|
10
|
+
useCustomStyling?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Component for displaying hotel result details retrieved from the `useHotelSearch` hook.
|
|
14
|
+
*/
|
|
15
|
+
declare const HotelResult: ({ details, useCustomStyling }: IHotelResultProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export { HotelResult };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface IHotelDetails {
|
|
2
|
+
hotelId: string;
|
|
3
|
+
address: string;
|
|
4
|
+
amenities: string[];
|
|
5
|
+
bookingLink: string;
|
|
6
|
+
bookingLinkCash: string;
|
|
7
|
+
bookingLinkPoints: string;
|
|
8
|
+
cashValue: {
|
|
9
|
+
currency: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
};
|
|
12
|
+
city: string;
|
|
13
|
+
cityCode: string;
|
|
14
|
+
coordinates: {
|
|
15
|
+
latitude: number | string;
|
|
16
|
+
longitude: number | string;
|
|
17
|
+
};
|
|
18
|
+
country: string;
|
|
19
|
+
countryCode: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
description: string;
|
|
22
|
+
hotelGroup: string;
|
|
23
|
+
hotelStatus: string;
|
|
24
|
+
images: string[];
|
|
25
|
+
legacyCoordinates: number[];
|
|
26
|
+
name: string;
|
|
27
|
+
points: number;
|
|
28
|
+
reviewCount: string | null;
|
|
29
|
+
reviewRating: string | null;
|
|
30
|
+
slugCity: string;
|
|
31
|
+
state: string | null;
|
|
32
|
+
stateCode: string | null;
|
|
33
|
+
subdivision: string;
|
|
34
|
+
telephone: string | null;
|
|
35
|
+
status: string;
|
|
36
|
+
writeAt: string;
|
|
37
|
+
hasCalendarCash: boolean;
|
|
38
|
+
cashAvailable: boolean;
|
|
39
|
+
awardPoints: number;
|
|
40
|
+
rooms: any[];
|
|
41
|
+
hasCalendarPoints: boolean;
|
|
42
|
+
pointsType: string;
|
|
43
|
+
premiumPointsAvailable: boolean;
|
|
44
|
+
standardPointsAvailable: boolean;
|
|
45
|
+
liveScrapingCheckNeeded: boolean;
|
|
46
|
+
partners: IHotelPartner[];
|
|
47
|
+
hotelProgram: IHotelProgram;
|
|
48
|
+
bestValue: string;
|
|
49
|
+
pointsAsCash: IPointsAsCash;
|
|
50
|
+
}
|
|
51
|
+
interface IHotelPartner {
|
|
52
|
+
program: string;
|
|
53
|
+
ratio: number;
|
|
54
|
+
bonus: number;
|
|
55
|
+
transferMinutes: number;
|
|
56
|
+
minimumTransfer: number;
|
|
57
|
+
transferDenominator: number;
|
|
58
|
+
stepBonus: {
|
|
59
|
+
bonus: number;
|
|
60
|
+
stepThreshold: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface IHotelProgram {
|
|
64
|
+
program: string;
|
|
65
|
+
ratio: number;
|
|
66
|
+
bonus: number;
|
|
67
|
+
transferMinutes: number;
|
|
68
|
+
minimumTransfer: number;
|
|
69
|
+
transferDenominator: number;
|
|
70
|
+
stepBonus: {
|
|
71
|
+
bonus: number;
|
|
72
|
+
stepThreshold: number;
|
|
73
|
+
};
|
|
74
|
+
valueCent: number;
|
|
75
|
+
}
|
|
76
|
+
interface IPointsAsCash {
|
|
77
|
+
pointsAsCashRequired: number;
|
|
78
|
+
pointsAsCashAvailable: number;
|
|
79
|
+
totalPointsUsed: number;
|
|
80
|
+
awardProgram: string | number;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IHotelDetails } from '../HotelResult/HotelResult.types';
|
|
2
|
+
export interface IHotelResultsProps {
|
|
3
|
+
hotelResults: IHotelDetails[];
|
|
4
|
+
useCustomStyling?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const HotelResults: ({ hotelResults, useCustomStyling }: IHotelResultsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { HotelResults };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiNjAzMmMyYWI4Y2QzNDIwMDMzNTY5NmRhIiwiaWF0IjoxNzM3NTQ5ODIwfQ.aw-zmEK_z3OwL31altrLGLGppTNCCUsgMRZiD9DkWEw";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
|
|
2
|
+
import { ISearchByCoordsParams, ISearchByHotelIdParams } from './useHotelSearch.types';
|
|
3
|
+
/**
|
|
4
|
+
* Awayz Hook to handle all hotel search logic
|
|
5
|
+
*/
|
|
6
|
+
export declare const useHotelSearch: () => {
|
|
7
|
+
results: IHotelDetails[];
|
|
8
|
+
loading: boolean;
|
|
9
|
+
searchByCoords: (args: ISearchByCoordsParams) => Promise<void>;
|
|
10
|
+
searchByHotelId: (args: ISearchByHotelIdParams) => Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ICoordinates } from '@type-op/shared';
|
|
2
|
+
import { ESearchType } from '../../main';
|
|
3
|
+
export interface ISearchByCoordsParams extends ISearchByParams {
|
|
4
|
+
/**
|
|
5
|
+
* Required search coordinates
|
|
6
|
+
* @type ICoordinates
|
|
7
|
+
* @example { latitude: 123.456, longitude: 123.456 }
|
|
8
|
+
*/
|
|
9
|
+
coords: ICoordinates;
|
|
10
|
+
/**
|
|
11
|
+
* Optional search range in miles
|
|
12
|
+
* @default 10
|
|
13
|
+
* @type number
|
|
14
|
+
*/
|
|
15
|
+
searchRange?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Optional search type
|
|
18
|
+
* @default 'mi'
|
|
19
|
+
* @type string
|
|
20
|
+
*/
|
|
21
|
+
rangeType?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional hotel groups to search
|
|
24
|
+
* @default ['accor', 'choice', 'hilton', 'hyatt', 'ihg', 'marriott', 'wyndham']
|
|
25
|
+
* @type string[]
|
|
26
|
+
*/
|
|
27
|
+
hotelGroups?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Optional search type
|
|
30
|
+
* @default 'City Search'
|
|
31
|
+
* @type ESearchType
|
|
32
|
+
*/
|
|
33
|
+
searchType?: ESearchType;
|
|
34
|
+
}
|
|
35
|
+
export interface ISearchByHotelIdParams extends ISearchByParams {
|
|
36
|
+
/**
|
|
37
|
+
* Required hotel ID
|
|
38
|
+
* @type string
|
|
39
|
+
*/
|
|
40
|
+
hotelId: string;
|
|
41
|
+
/**
|
|
42
|
+
* Required hotel group
|
|
43
|
+
* @type string
|
|
44
|
+
*/
|
|
45
|
+
hotelGroup: string;
|
|
46
|
+
}
|
|
47
|
+
interface ISearchByParams {
|
|
48
|
+
/**
|
|
49
|
+
* Required check-in date
|
|
50
|
+
* @type string
|
|
51
|
+
* @example '2021-12-31'
|
|
52
|
+
*/
|
|
53
|
+
checkinDate: string;
|
|
54
|
+
/**
|
|
55
|
+
* Required check-out date
|
|
56
|
+
* @type string
|
|
57
|
+
* @example '2022-01-01'
|
|
58
|
+
*/
|
|
59
|
+
checkoutDate: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional number of rooms
|
|
62
|
+
* @default 1
|
|
63
|
+
* @type number
|
|
64
|
+
*/
|
|
65
|
+
rooms?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Optional number of guests
|
|
68
|
+
* @default 2
|
|
69
|
+
* @type number
|
|
70
|
+
*/
|
|
71
|
+
guests?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Optional search currency
|
|
74
|
+
* @default 'USD'
|
|
75
|
+
* @type string
|
|
76
|
+
*/
|
|
77
|
+
currency?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Optional cash or points search
|
|
80
|
+
* @default ['cash', 'points']
|
|
81
|
+
* @type string[]
|
|
82
|
+
*/
|
|
83
|
+
cashOrPoints?: string[];
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
|
|
2
|
+
import { IHotelDetails } from '../../components/HotelResult/HotelResult.types';
|
|
3
|
+
import { TServiceResponse } from '@type-op/shared';
|
|
4
|
+
declare class _HotelService {
|
|
5
|
+
getLocations: (searchInputQuery: string) => Promise<TServiceResponse<ISearchLocation[]>>;
|
|
6
|
+
searchByCoords: (request: ISearchHotelsParams) => Promise<TServiceResponse<IHotelDetails[]>>;
|
|
7
|
+
searchByHotelId: (request: ISearchByHotelIdRequest) => Promise<TServiceResponse<IHotelDetails[]>>;
|
|
8
|
+
}
|
|
9
|
+
export declare const HotelService: _HotelService;
|
|
10
|
+
export {};
|