@odynn/awayz-hotels 0.2.2 → 0.2.3
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,23 +1,24 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import { a as
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { a as m, b as d } 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 u = ({
|
|
5
5
|
starRating: r,
|
|
6
6
|
userRating: e,
|
|
7
|
-
color:
|
|
7
|
+
color: t = "dark",
|
|
8
8
|
fill: c = !1,
|
|
9
|
-
starColor:
|
|
9
|
+
starColor: s = "primary"
|
|
10
10
|
/* PRIMARY */
|
|
11
11
|
}) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const l = !e || e === 0 || e.toString().toLowerCase() === "none";
|
|
13
|
+
if (!r && l) return null;
|
|
14
|
+
const i = r ? c ? /* @__PURE__ */ n(m, { className: s }) : /* @__PURE__ */ n(d, { className: s }) : null;
|
|
15
|
+
return /* @__PURE__ */ a("div", { className: `rating ${t}`, children: [
|
|
16
|
+
i,
|
|
16
17
|
r ? /* @__PURE__ */ a("p", { children: [
|
|
17
18
|
r,
|
|
18
19
|
"-star"
|
|
19
20
|
] }) : null,
|
|
20
|
-
|
|
21
|
+
l ? null : /* @__PURE__ */ a("p", { children: [
|
|
21
22
|
"(",
|
|
22
23
|
e,
|
|
23
24
|
" rating)"
|
|
@@ -26,5 +27,5 @@ const o = ({
|
|
|
26
27
|
};
|
|
27
28
|
export {
|
|
28
29
|
p as ERatingColor,
|
|
29
|
-
|
|
30
|
+
u as default
|
|
30
31
|
};
|
|
@@ -1,81 +1,87 @@
|
|
|
1
|
-
import { HotelService as
|
|
2
|
-
import { BookingService as
|
|
3
|
-
import { HotelChains as
|
|
4
|
-
import { EBestCheckoutType as
|
|
1
|
+
import { HotelService as f } from "../../services/hotel/HotelService.js";
|
|
2
|
+
import { BookingService as d } from "../../services/booking/BookingService.js";
|
|
3
|
+
import { HotelChains as l } from "../../definitions/HotelChains.js";
|
|
4
|
+
import { EBestCheckoutType as m } from "../../enums/EBestCheckoutType.js";
|
|
5
5
|
import { EGuestType as y } from "../../services/booking/BookingService.enums.js";
|
|
6
|
-
const w = async (o) => await
|
|
7
|
-
|
|
6
|
+
const w = async (o) => await f.getTransferPartners(
|
|
7
|
+
l.toProgram(o)
|
|
8
8
|
), T = async ({
|
|
9
9
|
hotel: o,
|
|
10
10
|
checkinDate: s,
|
|
11
|
-
checkoutDate:
|
|
11
|
+
checkoutDate: n,
|
|
12
12
|
updateHotel: t
|
|
13
13
|
}) => {
|
|
14
|
-
let
|
|
15
|
-
if (!o.liveScrapingCheckNeeded || o.hotelGroup ===
|
|
14
|
+
let e = o, i = o.rooms ?? [];
|
|
15
|
+
if (!o.liveScrapingCheckNeeded || o.hotelGroup === l.Marriott)
|
|
16
16
|
return {
|
|
17
17
|
pointsHotelDetails: o,
|
|
18
18
|
pointsRooms: i
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
let r = !1, c = null;
|
|
21
|
+
try {
|
|
22
|
+
const a = await f.hotelPointsCheck({
|
|
23
|
+
hotelGroup: o.hotelGroup,
|
|
24
|
+
hotelId: o.hotelId,
|
|
25
|
+
checkinDate: s,
|
|
26
|
+
checkoutDate: n
|
|
27
|
+
});
|
|
28
|
+
r = a.success, c = a.data;
|
|
29
|
+
} catch {
|
|
30
|
+
r = !1, c = null;
|
|
31
|
+
}
|
|
32
|
+
if (r) {
|
|
33
|
+
const a = c, u = !(a.points.pointsValue > 0) && o.bestValue === m.POINTS;
|
|
34
|
+
e = {
|
|
29
35
|
...o,
|
|
30
|
-
awardPoints:
|
|
31
|
-
points:
|
|
32
|
-
pointsType:
|
|
33
|
-
bestValue: u ?
|
|
34
|
-
}, i =
|
|
36
|
+
awardPoints: a.points.awardPointsValue ?? a.points.pointsValue,
|
|
37
|
+
points: a.points.pointsValue,
|
|
38
|
+
pointsType: a.points.pointsType,
|
|
39
|
+
bestValue: u ? m.NONE : o.bestValue
|
|
40
|
+
}, i = a.rooms ?? o.rooms ?? [], t(o.hotelId, o.hotelGroup, e);
|
|
35
41
|
}
|
|
36
42
|
return {
|
|
37
|
-
pointsHotelDetails:
|
|
43
|
+
pointsHotelDetails: e,
|
|
38
44
|
pointsRooms: i
|
|
39
45
|
};
|
|
40
46
|
}, A = async ({
|
|
41
47
|
hotel: o,
|
|
42
48
|
checkinDate: s,
|
|
43
|
-
checkoutDate:
|
|
49
|
+
checkoutDate: n,
|
|
44
50
|
guests: t,
|
|
45
|
-
rooms:
|
|
51
|
+
rooms: e,
|
|
46
52
|
updateHotel: i,
|
|
47
53
|
numberOfNights: r
|
|
48
54
|
}) => {
|
|
49
|
-
var
|
|
50
|
-
if (!((
|
|
55
|
+
var u;
|
|
56
|
+
if (!((u = o == null ? void 0 : o.cashBookingOffers) != null && u.accommodationId))
|
|
51
57
|
return {
|
|
52
58
|
cashHotelDetails: o,
|
|
53
59
|
cashRooms: []
|
|
54
60
|
};
|
|
55
|
-
const
|
|
61
|
+
const c = (h) => Array.from({ length: h }, () => ({ type: y.ADULT })), a = await d.getAvailableRooms({
|
|
56
62
|
checkinDate: s,
|
|
57
|
-
checkoutDate:
|
|
63
|
+
checkoutDate: n,
|
|
58
64
|
accommodationId: o.cashBookingOffers.accommodationId,
|
|
59
|
-
guests:
|
|
60
|
-
rooms:
|
|
61
|
-
}),
|
|
65
|
+
guests: c(t),
|
|
66
|
+
rooms: e
|
|
67
|
+
}), p = {
|
|
62
68
|
...o,
|
|
63
69
|
cashValue: {
|
|
64
70
|
...o.cashValue,
|
|
65
|
-
amount:
|
|
66
|
-
currency:
|
|
71
|
+
amount: a.cheapestRate / r || o.cashValue.amount || 0,
|
|
72
|
+
currency: a.currency ?? o.cashValue.currency
|
|
67
73
|
}
|
|
68
74
|
};
|
|
69
|
-
return i(o.hotelId, o.hotelGroup,
|
|
70
|
-
cashHotelDetails:
|
|
71
|
-
cashRooms:
|
|
75
|
+
return i(o.hotelId, o.hotelGroup, p), {
|
|
76
|
+
cashHotelDetails: p,
|
|
77
|
+
cashRooms: a.availableRooms
|
|
72
78
|
};
|
|
73
79
|
}, G = async (o, s) => {
|
|
74
|
-
const { success:
|
|
80
|
+
const { success: n, data: t } = await f.getRecommendations({
|
|
75
81
|
days: s,
|
|
76
82
|
hotels: [o]
|
|
77
83
|
});
|
|
78
|
-
return
|
|
84
|
+
return n ? {
|
|
79
85
|
bestCheckout: t,
|
|
80
86
|
isAvailable: t.nightlyPointsCost > 0 || t.nightlyCashCost > 0
|
|
81
87
|
} : {
|
|
@@ -83,23 +89,23 @@ const w = async (o) => await m.getTransferPartners(
|
|
|
83
89
|
isAvailable: !1
|
|
84
90
|
};
|
|
85
91
|
}, C = (o, s) => {
|
|
86
|
-
var t,
|
|
92
|
+
var t, e;
|
|
87
93
|
return {
|
|
88
|
-
bestCheckoutMethod:
|
|
94
|
+
bestCheckoutMethod: l.isHotelChain(o.hotelGroup) ? o.bestValue : m.CASH,
|
|
89
95
|
nightlyCashCost: ((t = o.cashValue) == null ? void 0 : t.amount) || 0,
|
|
90
96
|
nightlyPointsCost: o.points || 0,
|
|
91
97
|
awardPoints: o.points || 0,
|
|
92
|
-
totalCashCost: (((
|
|
98
|
+
totalCashCost: (((e = o.cashValue) == null ? void 0 : e.amount) || 0) * s,
|
|
93
99
|
totalPointsCost: (o.points || 0) * s,
|
|
94
100
|
currency: "USD",
|
|
95
101
|
sufficientPoints: !0,
|
|
96
|
-
rewardsProgram:
|
|
102
|
+
rewardsProgram: l.toProgram(o.hotelGroup),
|
|
97
103
|
optimalProgram: {
|
|
98
104
|
programs: [],
|
|
99
105
|
remainingPointsBalance: 0
|
|
100
106
|
}
|
|
101
107
|
};
|
|
102
|
-
}, B = (o, s,
|
|
108
|
+
}, B = (o, s, n) => {
|
|
103
109
|
let t = o;
|
|
104
110
|
return s && (t = {
|
|
105
111
|
...o,
|
|
@@ -107,10 +113,10 @@ const w = async (o) => await m.getTransferPartners(
|
|
|
107
113
|
awardPoints: s.awardPoints,
|
|
108
114
|
pointsType: s.pointsType,
|
|
109
115
|
bestValue: s.bestValue
|
|
110
|
-
}),
|
|
116
|
+
}), n && (t = {
|
|
111
117
|
...t,
|
|
112
|
-
cashValue:
|
|
113
|
-
rooms:
|
|
118
|
+
cashValue: n.cashValue,
|
|
119
|
+
rooms: n.rooms
|
|
114
120
|
}), t;
|
|
115
121
|
};
|
|
116
122
|
export {
|
|
@@ -51,5 +51,5 @@ interface IFetchBestCheckoutResponse {
|
|
|
51
51
|
}
|
|
52
52
|
export declare const fetchBestCheckout: (hotel: IHotelDetails, numberOfNights: number) => Promise<IFetchBestCheckoutResponse>;
|
|
53
53
|
export declare const fallbackBestCheckout: (selectedHotelData: IHotelDetails, numberOfNights: number) => IBestCheckout;
|
|
54
|
-
export declare const combineUpdatedHotelData: (base: IHotelDetails,
|
|
54
|
+
export declare const combineUpdatedHotelData: (base: IHotelDetails, liveScraperData: IHotelDetails, cashRoomsData: IHotelDetails) => IHotelDetails;
|
|
55
55
|
export {};
|