@odynn/awayz-hotels 0.6.1 → 0.6.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.
|
@@ -61,7 +61,7 @@ const QA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
|
|
|
61
61
|
if (a.stopPropagation(), E) E(A);
|
|
62
62
|
else
|
|
63
63
|
throw new Error("Could not display availability calendar.");
|
|
64
|
-
}, s =
|
|
64
|
+
}, s = typeof A.nthNightFree == "number" && A.nthNightFree > 0;
|
|
65
65
|
return /* @__PURE__ */ C(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
@@ -115,7 +115,7 @@ const QA = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAGiCAYAAAAfl6KSAA
|
|
|
115
115
|
/* @__PURE__ */ Q(k, {}),
|
|
116
116
|
/* @__PURE__ */ Q("p", { children: "Free Night" })
|
|
117
117
|
] }),
|
|
118
|
-
s && /* @__PURE__ */ C("div", { children: [
|
|
118
|
+
S && s && /* @__PURE__ */ C("div", { children: [
|
|
119
119
|
/* @__PURE__ */ Q(G, {}),
|
|
120
120
|
/* @__PURE__ */ C("p", { children: [
|
|
121
121
|
Y(A.nthNightFree),
|
|
@@ -1,133 +1,134 @@
|
|
|
1
|
-
import { HotelChains as
|
|
1
|
+
import { HotelChains as p } from "../../definitions/HotelChains.js";
|
|
2
2
|
import { EBestCheckoutType as m } from "../../enums/EBestCheckoutType.js";
|
|
3
|
-
import { BookingService as
|
|
4
|
-
import { EGuestType as
|
|
5
|
-
import { HotelService as
|
|
6
|
-
const w = async (
|
|
7
|
-
|
|
3
|
+
import { BookingService as y } from "../../services/booking/BookingService.js";
|
|
4
|
+
import { EGuestType as C } from "../../services/booking/BookingService.enums.js";
|
|
5
|
+
import { HotelService as h } from "../../services/hotel/HotelService.js";
|
|
6
|
+
const w = async (s) => await h.getTransferPartners(
|
|
7
|
+
p.toProgram(s)
|
|
8
8
|
), T = async ({
|
|
9
|
-
hotel:
|
|
10
|
-
checkinDate:
|
|
11
|
-
checkoutDate:
|
|
12
|
-
updateHotel:
|
|
9
|
+
hotel: s,
|
|
10
|
+
checkinDate: t,
|
|
11
|
+
checkoutDate: n,
|
|
12
|
+
updateHotel: e
|
|
13
13
|
}) => {
|
|
14
|
-
let
|
|
15
|
-
if (!
|
|
14
|
+
let a = s, i = s.rooms ?? [];
|
|
15
|
+
if (!s.liveScrapingCheckNeeded || s.hotelGroup === p.Marriott)
|
|
16
16
|
return {
|
|
17
|
-
pointsHotelDetails:
|
|
17
|
+
pointsHotelDetails: s,
|
|
18
18
|
pointsRooms: i
|
|
19
19
|
};
|
|
20
20
|
let r = !1, c = null;
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
23
|
-
hotelGroup:
|
|
24
|
-
hotelId:
|
|
25
|
-
checkinDate:
|
|
26
|
-
checkoutDate:
|
|
22
|
+
const o = await h.hotelPointsCheck({
|
|
23
|
+
hotelGroup: s.hotelGroup,
|
|
24
|
+
hotelId: s.hotelId,
|
|
25
|
+
checkinDate: t,
|
|
26
|
+
checkoutDate: n
|
|
27
27
|
});
|
|
28
|
-
r =
|
|
28
|
+
r = o.success, c = o.data;
|
|
29
29
|
} catch {
|
|
30
30
|
r = !1, c = null;
|
|
31
31
|
}
|
|
32
32
|
if (r) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
...
|
|
36
|
-
awardPoints:
|
|
37
|
-
points:
|
|
38
|
-
pointsType:
|
|
39
|
-
bestValue: u ? m.NONE :
|
|
40
|
-
}, i =
|
|
33
|
+
const o = c, u = !(o.points.pointsValue > 0) && s.bestValue === m.POINTS;
|
|
34
|
+
a = {
|
|
35
|
+
...s,
|
|
36
|
+
awardPoints: o.points.awardPointsValue ?? o.points.pointsValue,
|
|
37
|
+
points: o.points.pointsValue,
|
|
38
|
+
pointsType: o.points.pointsType,
|
|
39
|
+
bestValue: u ? m.NONE : s.bestValue
|
|
40
|
+
}, i = o.rooms ?? s.rooms ?? [], e(s.hotelId, s.hotelGroup, a);
|
|
41
41
|
}
|
|
42
42
|
return {
|
|
43
|
-
pointsHotelDetails:
|
|
43
|
+
pointsHotelDetails: a,
|
|
44
44
|
pointsRooms: i
|
|
45
45
|
};
|
|
46
46
|
}, A = async ({
|
|
47
|
-
hotel:
|
|
48
|
-
checkinDate:
|
|
49
|
-
checkoutDate:
|
|
50
|
-
guests:
|
|
51
|
-
rooms:
|
|
47
|
+
hotel: s,
|
|
48
|
+
checkinDate: t,
|
|
49
|
+
checkoutDate: n,
|
|
50
|
+
guests: e,
|
|
51
|
+
rooms: a,
|
|
52
52
|
updateHotel: i,
|
|
53
53
|
numberOfNights: r
|
|
54
54
|
}) => {
|
|
55
55
|
var u;
|
|
56
|
-
if (!((u =
|
|
56
|
+
if (!((u = s == null ? void 0 : s.cashBookingOffers) != null && u.accommodationId))
|
|
57
57
|
return {
|
|
58
|
-
cashHotelDetails:
|
|
58
|
+
cashHotelDetails: s,
|
|
59
59
|
cashRooms: []
|
|
60
60
|
};
|
|
61
|
-
const c = (
|
|
62
|
-
checkinDate:
|
|
63
|
-
checkoutDate:
|
|
64
|
-
accommodationId:
|
|
65
|
-
guests: c(
|
|
66
|
-
rooms:
|
|
67
|
-
}),
|
|
68
|
-
...
|
|
61
|
+
const c = (f) => Array.from({ length: f }, () => ({ type: C.ADULT })), o = await y.getAvailableRooms({
|
|
62
|
+
checkinDate: t,
|
|
63
|
+
checkoutDate: n,
|
|
64
|
+
accommodationId: s.cashBookingOffers.accommodationId,
|
|
65
|
+
guests: c(e),
|
|
66
|
+
rooms: a
|
|
67
|
+
}), l = {
|
|
68
|
+
...s,
|
|
69
69
|
cashValue: {
|
|
70
|
-
...
|
|
71
|
-
amount:
|
|
72
|
-
currency:
|
|
70
|
+
...s.cashValue,
|
|
71
|
+
amount: o.cheapestRate / r || s.cashValue.amount || 0,
|
|
72
|
+
currency: o.currency ?? s.cashValue.currency
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
return i(
|
|
76
|
-
cashHotelDetails:
|
|
77
|
-
cashRooms:
|
|
75
|
+
return i(s.hotelId, s.hotelGroup, l), {
|
|
76
|
+
cashHotelDetails: l,
|
|
77
|
+
cashRooms: o.availableRooms
|
|
78
78
|
};
|
|
79
|
-
},
|
|
80
|
-
const { success:
|
|
81
|
-
days:
|
|
82
|
-
hotel:
|
|
79
|
+
}, B = async (s, t, n) => {
|
|
80
|
+
const { success: e, data: a } = await h.getRecommendations({
|
|
81
|
+
days: t,
|
|
82
|
+
hotel: s
|
|
83
83
|
});
|
|
84
|
-
return
|
|
84
|
+
return e && a ? {
|
|
85
85
|
bestCheckout: {
|
|
86
|
-
...
|
|
87
|
-
nightlyPointsCost:
|
|
86
|
+
...a,
|
|
87
|
+
nightlyPointsCost: n ? a.awardPoints : a.nightlyPointsCost
|
|
88
88
|
},
|
|
89
|
-
isAvailable:
|
|
89
|
+
isAvailable: a.nightlyPointsCost > 0 || a.nightlyCashCost > 0
|
|
90
90
|
} : {
|
|
91
|
-
bestCheckout:
|
|
91
|
+
bestCheckout: d(s, t),
|
|
92
92
|
isAvailable: !1
|
|
93
93
|
};
|
|
94
|
-
},
|
|
95
|
-
var
|
|
94
|
+
}, d = (s, t) => {
|
|
95
|
+
var i, r, c, o;
|
|
96
|
+
const n = ((i = s.cashBookingOffers) == null ? void 0 : i.cheapestRateTotalAmount) ?? ((r = s.cashValue) == null ? void 0 : r.amount) ?? 0, e = ((c = s.cashBookingOffers) == null ? void 0 : c.cheapestRateCurrency) ?? ((o = s.cashValue) == null ? void 0 : o.currency) ?? "USD";
|
|
96
97
|
return {
|
|
97
|
-
bestCheckoutMethod:
|
|
98
|
-
nightlyCashCost:
|
|
99
|
-
nightlyPointsCost:
|
|
100
|
-
awardPoints:
|
|
101
|
-
totalCashCost:
|
|
102
|
-
totalPointsCost: (
|
|
103
|
-
currency:
|
|
98
|
+
bestCheckoutMethod: p.isHotelChain(s.hotelGroup) ? s.bestValue : m.CASH,
|
|
99
|
+
nightlyCashCost: n,
|
|
100
|
+
nightlyPointsCost: s.points || 0,
|
|
101
|
+
awardPoints: s.points || 0,
|
|
102
|
+
totalCashCost: n * t,
|
|
103
|
+
totalPointsCost: (s.points || 0) * t,
|
|
104
|
+
currency: e,
|
|
104
105
|
sufficientPoints: !0,
|
|
105
|
-
rewardsProgram:
|
|
106
|
+
rewardsProgram: p.toProgram(s.hotelGroup),
|
|
106
107
|
optimalProgram: {
|
|
107
108
|
programs: [],
|
|
108
109
|
remainingPointsBalance: 0,
|
|
109
110
|
totalProgramPointsValuation: 0
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
|
-
},
|
|
113
|
-
let
|
|
114
|
-
return
|
|
115
|
-
...
|
|
116
|
-
points:
|
|
117
|
-
awardPoints:
|
|
118
|
-
pointsType:
|
|
119
|
-
bestValue:
|
|
120
|
-
}),
|
|
121
|
-
...
|
|
122
|
-
cashValue:
|
|
123
|
-
rooms:
|
|
124
|
-
}),
|
|
113
|
+
}, G = (s, t, n) => {
|
|
114
|
+
let e = s;
|
|
115
|
+
return t && (e = {
|
|
116
|
+
...s,
|
|
117
|
+
points: t.points,
|
|
118
|
+
awardPoints: t.awardPoints,
|
|
119
|
+
pointsType: t.pointsType,
|
|
120
|
+
bestValue: t.bestValue
|
|
121
|
+
}), n && (e = {
|
|
122
|
+
...e,
|
|
123
|
+
cashValue: n.cashValue,
|
|
124
|
+
rooms: n.rooms
|
|
125
|
+
}), e;
|
|
125
126
|
};
|
|
126
127
|
export {
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
G as combineUpdatedHotelData,
|
|
129
|
+
d as fallbackBestCheckout,
|
|
129
130
|
A as fetchAvailableRooms,
|
|
130
|
-
|
|
131
|
+
B as fetchBestCheckout,
|
|
131
132
|
T as fetchPointsCheck,
|
|
132
133
|
w as fetchTransferPartners
|
|
133
134
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-hotels",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@odynn/awayz-core": "
|
|
69
|
+
"@odynn/awayz-core": ">= 0.6.0",
|
|
70
70
|
"@tanstack/react-query": "^5.66.9",
|
|
71
71
|
"string-comparison": "^1.3.0"
|
|
72
72
|
}
|