@odynn/awayz-hotels 0.11.2 → 0.11.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.
- package/dist/hooks/useHotelDetails/useHotelDetails.api.js +34 -34
- package/dist/lib/components/HotelResult/HotelResult.types.d.ts +3 -5
- package/dist/lib/services/booking/BookingService.d.ts +2 -5
- package/dist/lib/services/booking/BookingService.types.d.ts +3 -3
- package/dist/lib/services/hotel/HotelService.d.ts +1 -1
- package/dist/services/booking/BookingService.js +32 -36
- package/dist/services/hotel/HotelService.js +17 -11
- package/package.json +3 -2
|
@@ -12,8 +12,8 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
12
12
|
), I = (t) => !!t.hotelGroup && !!t.hotelId && !!t.checkinDate && !!t.checkoutDate && !!t.rooms && !!t.guests, v = async ({
|
|
13
13
|
hotel: t,
|
|
14
14
|
checkinDate: o,
|
|
15
|
-
checkoutDate:
|
|
16
|
-
updateHotel:
|
|
15
|
+
checkoutDate: n,
|
|
16
|
+
updateHotel: s,
|
|
17
17
|
signal: e
|
|
18
18
|
}) => {
|
|
19
19
|
let r = t, c = t.rooms ?? [];
|
|
@@ -24,28 +24,28 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
24
24
|
};
|
|
25
25
|
let u = !1, i = null;
|
|
26
26
|
try {
|
|
27
|
-
const
|
|
27
|
+
const a = await h.hotelPointsCheck(
|
|
28
28
|
{
|
|
29
29
|
hotelGroup: t.hotelGroup,
|
|
30
30
|
hotelId: t.hotelId,
|
|
31
31
|
checkinDate: o,
|
|
32
|
-
checkoutDate:
|
|
32
|
+
checkoutDate: n
|
|
33
33
|
},
|
|
34
34
|
e
|
|
35
35
|
);
|
|
36
|
-
u =
|
|
36
|
+
u = a.success, i = a.data;
|
|
37
37
|
} catch {
|
|
38
38
|
u = !1, i = null;
|
|
39
39
|
}
|
|
40
40
|
if (u) {
|
|
41
|
-
const
|
|
41
|
+
const a = i, m = !(a.points.pointsValue > 0) && t.bestValue === f.POINTS;
|
|
42
42
|
r = {
|
|
43
43
|
...t,
|
|
44
|
-
awardPoints:
|
|
45
|
-
points:
|
|
46
|
-
pointsType:
|
|
44
|
+
awardPoints: a.points.awardPointsValue ?? a.points.pointsValue,
|
|
45
|
+
points: a.points.pointsValue,
|
|
46
|
+
pointsType: a.points.pointsType,
|
|
47
47
|
bestValue: m ? f.NONE : t.bestValue
|
|
48
|
-
}, c =
|
|
48
|
+
}, c = a.rooms ?? t.rooms ?? [], s(t.hotelId, t.hotelGroup, r);
|
|
49
49
|
}
|
|
50
50
|
return {
|
|
51
51
|
pointsHotelDetails: r,
|
|
@@ -54,8 +54,8 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
54
54
|
}, E = async ({
|
|
55
55
|
hotel: t,
|
|
56
56
|
checkinDate: o,
|
|
57
|
-
checkoutDate:
|
|
58
|
-
guests:
|
|
57
|
+
checkoutDate: n,
|
|
58
|
+
guests: s,
|
|
59
59
|
rooms: e,
|
|
60
60
|
updateHotel: r,
|
|
61
61
|
numberOfNights: c
|
|
@@ -68,31 +68,32 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
68
68
|
};
|
|
69
69
|
const u = (m) => Array.from({ length: m }, () => ({ type: d.ADULT })), i = await y.getAvailableRooms({
|
|
70
70
|
checkinDate: o,
|
|
71
|
-
checkoutDate:
|
|
71
|
+
checkoutDate: n,
|
|
72
72
|
accommodationId: t.cashBookingOffers.accommodationId,
|
|
73
|
-
guests: u(
|
|
73
|
+
guests: u(s),
|
|
74
74
|
rooms: e
|
|
75
|
-
}),
|
|
75
|
+
}), a = {
|
|
76
76
|
...t,
|
|
77
77
|
cashValue: {
|
|
78
78
|
...t.cashValue,
|
|
79
79
|
amount: i.cheapestRate / c || t.cashValue.amount || 0,
|
|
80
80
|
currency: i.currency ?? t.cashValue.currency
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
|
+
...i.accommodation
|
|
82
83
|
};
|
|
83
|
-
return r(t.hotelId, t.hotelGroup,
|
|
84
|
-
cashHotelDetails:
|
|
84
|
+
return r(t.hotelId, t.hotelGroup, a), {
|
|
85
|
+
cashHotelDetails: a,
|
|
85
86
|
cashRooms: i.availableRooms
|
|
86
87
|
};
|
|
87
|
-
}, U = async (t, o,
|
|
88
|
-
const { success:
|
|
88
|
+
}, U = async (t, o, n) => {
|
|
89
|
+
const { success: s, data: e } = await h.getRecommendations({
|
|
89
90
|
days: o,
|
|
90
91
|
hotel: t
|
|
91
92
|
});
|
|
92
|
-
return
|
|
93
|
+
return s && e ? {
|
|
93
94
|
bestCheckout: {
|
|
94
95
|
...e,
|
|
95
|
-
nightlyPointsCost:
|
|
96
|
+
nightlyPointsCost: n ? e.awardPoints : e.nightlyPointsCost
|
|
96
97
|
},
|
|
97
98
|
isAvailable: e.nightlyPointsCost > 0 || e.nightlyCashCost > 0
|
|
98
99
|
} : {
|
|
@@ -101,15 +102,15 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
101
102
|
};
|
|
102
103
|
}, P = (t, o) => {
|
|
103
104
|
var r, c, u, i;
|
|
104
|
-
const
|
|
105
|
+
const n = ((r = t.cashBookingOffers) == null ? void 0 : r.cheapestRateTotalAmount) ?? ((c = t.cashValue) == null ? void 0 : c.amount) ?? 0, s = ((u = t.cashBookingOffers) == null ? void 0 : u.cheapestRateCurrency) ?? ((i = t.cashValue) == null ? void 0 : i.currency) ?? C;
|
|
105
106
|
return {
|
|
106
107
|
bestCheckoutMethod: p.isHotelChain(t.hotelGroup) ? t.bestValue : f.CASH,
|
|
107
|
-
nightlyCashCost:
|
|
108
|
+
nightlyCashCost: n,
|
|
108
109
|
nightlyPointsCost: t.points || 0,
|
|
109
110
|
awardPoints: t.points || 0,
|
|
110
|
-
totalCashCost:
|
|
111
|
+
totalCashCost: n * o,
|
|
111
112
|
totalPointsCost: (t.points || 0) * o,
|
|
112
|
-
currency:
|
|
113
|
+
currency: s,
|
|
113
114
|
sufficientPoints: !0,
|
|
114
115
|
rewardsProgram: p.toProgram(t.hotelGroup),
|
|
115
116
|
optimalProgram: {
|
|
@@ -118,19 +119,18 @@ const G = async (t) => await h.getTransferPartners(
|
|
|
118
119
|
totalProgramPointsValuation: 0
|
|
119
120
|
}
|
|
120
121
|
};
|
|
121
|
-
}, O = (t, o,
|
|
122
|
-
let
|
|
123
|
-
return o && (
|
|
122
|
+
}, O = (t, o, n) => {
|
|
123
|
+
let s = t;
|
|
124
|
+
return o && (s = {
|
|
124
125
|
...t,
|
|
125
126
|
points: o.points,
|
|
126
127
|
awardPoints: o.awardPoints,
|
|
127
128
|
pointsType: o.pointsType,
|
|
128
129
|
bestValue: o.bestValue
|
|
129
|
-
}),
|
|
130
|
-
...
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}), a;
|
|
130
|
+
}), n && (s = {
|
|
131
|
+
...s,
|
|
132
|
+
...n
|
|
133
|
+
}), s;
|
|
134
134
|
};
|
|
135
135
|
export {
|
|
136
136
|
O as combineUpdatedHotelData,
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { ICoordinates } from '@type-op/shared';
|
|
2
|
-
import { IRoom } from '../../services/booking/BookingService.types';
|
|
2
|
+
import { IAmenity, ICheckInInformation, IRoom } from '../../services/booking/BookingService.types';
|
|
3
3
|
export interface IHotelDetails {
|
|
4
4
|
hotelId: string;
|
|
5
5
|
address: string;
|
|
6
|
-
amenities:
|
|
7
|
-
description: string;
|
|
8
|
-
type: string;
|
|
9
|
-
}[];
|
|
6
|
+
amenities: IAmenity[];
|
|
10
7
|
bookingLink: string;
|
|
11
8
|
bookingLinkCash: string;
|
|
12
9
|
bookingLinkPoints: string;
|
|
@@ -60,6 +57,7 @@ export interface IHotelDetails {
|
|
|
60
57
|
multiNight?: number[];
|
|
61
58
|
priority?: boolean;
|
|
62
59
|
awardCategory?: string;
|
|
60
|
+
checkInInformation?: ICheckInInformation;
|
|
63
61
|
}
|
|
64
62
|
export interface IHotelPartner {
|
|
65
63
|
bonus: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGetAvailableRoomsProps, IRoom } from './BookingService.types';
|
|
1
|
+
import { IAccommodation, IGetAvailableRoomsProps, IRoom } from './BookingService.types';
|
|
2
2
|
export declare enum EBookingType {
|
|
3
3
|
Hotel = "awayz_hotel_booking_id",
|
|
4
4
|
Flight = "awayz_flight_booking_id",
|
|
@@ -9,10 +9,7 @@ declare class _BookingService {
|
|
|
9
9
|
cheapestRate: number;
|
|
10
10
|
currency: string;
|
|
11
11
|
availableRooms: IRoom[];
|
|
12
|
-
|
|
13
|
-
cheapestRate: number;
|
|
14
|
-
availableRooms: never[];
|
|
15
|
-
currency?: undefined;
|
|
12
|
+
accommodation: IAccommodation;
|
|
16
13
|
}>;
|
|
17
14
|
}
|
|
18
15
|
export declare const BookingService: _BookingService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ICoordinates } from '@type-op/shared';
|
|
2
|
-
import { EGuestType, ERoomBoardType, ERoomPaymentType } from './BookingService.enums';
|
|
3
2
|
import { Moment } from 'moment';
|
|
4
3
|
import { IPhoto } from '../../components/HotelResult/HotelResult.types';
|
|
4
|
+
import { EGuestType, ERoomBoardType, ERoomPaymentType } from './BookingService.enums';
|
|
5
5
|
export interface IGetAvailableRoomsProps {
|
|
6
6
|
checkinDate: Moment;
|
|
7
7
|
checkoutDate: Moment;
|
|
@@ -107,7 +107,7 @@ export interface IAccommodation {
|
|
|
107
107
|
name: string;
|
|
108
108
|
id: string;
|
|
109
109
|
}
|
|
110
|
-
interface ICheckInInformation {
|
|
110
|
+
export interface ICheckInInformation {
|
|
111
111
|
checkOutBeforeTime: string;
|
|
112
112
|
checkInBeforeTime: string;
|
|
113
113
|
checkInAfterTime: string;
|
|
@@ -179,7 +179,7 @@ interface ICondition {
|
|
|
179
179
|
title: string;
|
|
180
180
|
description: string;
|
|
181
181
|
}
|
|
182
|
-
interface IAmenity {
|
|
182
|
+
export interface IAmenity {
|
|
183
183
|
description: string;
|
|
184
184
|
type: string;
|
|
185
185
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITransferPartner, TServiceResponse } from '@type-op/shared';
|
|
2
2
|
import { IHotelDetails, ILiveHotelCheck } from '../../components/HotelResult/HotelResult.types';
|
|
3
3
|
import { IBestCheckout } from '../../hooks/useHotelDetails/useHotelDetails.types';
|
|
4
4
|
import { IHotelPointsCheckArgs, ISearchByHotelIdRequest, ISearchHotelsParams, ISearchLocation } from './HotelService.types';
|
|
@@ -1,52 +1,48 @@
|
|
|
1
1
|
var p = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { clientInstance as
|
|
5
|
-
import { EDuffelEndpoints as h } from "../../configs/endpoints.js";
|
|
2
|
+
var d = (t, o, a) => o in t ? p(t, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[o] = a;
|
|
3
|
+
var r = (t, o, a) => d(t, typeof o != "symbol" ? o + "" : o, a);
|
|
4
|
+
import { clientInstance as h } from "@odynn/awayz-core";
|
|
6
5
|
import "../../moment-BGjjqtLQ.js";
|
|
7
6
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
8
|
-
import { c
|
|
9
|
-
import { E as
|
|
7
|
+
import { c } from "../../objectUtils-Br6N9tQs.js";
|
|
8
|
+
import { E as i } from "../../DateFormats-DZD30Nea.js";
|
|
10
9
|
import "react";
|
|
10
|
+
import { EDuffelEndpoints as u } from "../../configs/endpoints.js";
|
|
11
11
|
var v = /* @__PURE__ */ ((t) => (t.Hotel = "awayz_hotel_booking_id", t.Flight = "awayz_flight_booking_id", t.Offer = "flight_offer_id", t))(v || {});
|
|
12
12
|
class g {
|
|
13
13
|
constructor() {
|
|
14
|
-
|
|
15
|
-
checkinDate:
|
|
14
|
+
r(this, "getAvailableRooms", async ({
|
|
15
|
+
checkinDate: o,
|
|
16
16
|
checkoutDate: a,
|
|
17
|
-
accommodationId:
|
|
18
|
-
rooms:
|
|
17
|
+
accommodationId: m,
|
|
18
|
+
rooms: s,
|
|
19
19
|
guests: n
|
|
20
20
|
}) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
cheapestRate: 0,
|
|
42
|
-
availableRooms: []
|
|
43
|
-
};
|
|
44
|
-
}
|
|
21
|
+
const { data: _ } = await h.post(
|
|
22
|
+
u.AVAILABLE_ROOMS,
|
|
23
|
+
{
|
|
24
|
+
check_in_date: o.format(i.ServerDate),
|
|
25
|
+
check_out_date: a.format(i.ServerDate),
|
|
26
|
+
accommodation_ids: [m],
|
|
27
|
+
rooms: s,
|
|
28
|
+
guests: n
|
|
29
|
+
}
|
|
30
|
+
), e = _.data.results.getFirst(), l = e.accommodation.rooms.map(
|
|
31
|
+
(f) => c(f)
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
cheapestRate: parseFloat(e.cheapest_rate_total_amount),
|
|
35
|
+
currency: e.cheapest_rate_currency,
|
|
36
|
+
availableRooms: l,
|
|
37
|
+
accommodation: c(
|
|
38
|
+
e.accommodation
|
|
39
|
+
)
|
|
40
|
+
};
|
|
45
41
|
});
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
|
-
const
|
|
44
|
+
const R = new g();
|
|
49
45
|
export {
|
|
50
|
-
|
|
46
|
+
R as BookingService,
|
|
51
47
|
v as EBookingType
|
|
52
48
|
};
|
|
@@ -5,11 +5,11 @@ import { clientInstance as _, clientNoRetryInstance as C } from "@odynn/awayz-co
|
|
|
5
5
|
import { s as T } from "../../stringUtils-DFhHh7H1.js";
|
|
6
6
|
import "../../moment-BGjjqtLQ.js";
|
|
7
7
|
import "../../arrayExtensions-CFEBYUok.js";
|
|
8
|
-
import { c as
|
|
9
|
-
import { E as
|
|
8
|
+
import { c as p } from "../../objectUtils-Br6N9tQs.js";
|
|
9
|
+
import { E as m } from "../../DateFormats-DZD30Nea.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import { EHotelEndpoints as l } from "../../configs/endpoints.js";
|
|
12
|
-
import { EBestCheckoutType as
|
|
12
|
+
import { EBestCheckoutType as h } from "../../enums/EBestCheckoutType.js";
|
|
13
13
|
import { EBestValueType as P } from "../../enums/EBestValueType.js";
|
|
14
14
|
import { ESearchType as S } from "./HotelService.types.js";
|
|
15
15
|
class v {
|
|
@@ -65,8 +65,14 @@ class v {
|
|
|
65
65
|
});
|
|
66
66
|
return t != null && t.success ? {
|
|
67
67
|
success: !0,
|
|
68
|
-
data:
|
|
69
|
-
(s = t.data) == null ? void 0 : s.hotels
|
|
68
|
+
data: p(
|
|
69
|
+
(s = t.data) == null ? void 0 : s.hotels.map((c) => ({
|
|
70
|
+
...c,
|
|
71
|
+
amenities: c.amenities.map((r) => typeof r == "string" ? {
|
|
72
|
+
description: r,
|
|
73
|
+
type: r.toLowerCase().replace(/\s/g, "_")
|
|
74
|
+
} : r)
|
|
75
|
+
}))
|
|
70
76
|
)
|
|
71
77
|
} : {
|
|
72
78
|
success: !1,
|
|
@@ -87,7 +93,7 @@ class v {
|
|
|
87
93
|
});
|
|
88
94
|
return t != null && t.success ? {
|
|
89
95
|
success: !0,
|
|
90
|
-
data:
|
|
96
|
+
data: p(
|
|
91
97
|
(s = t.data) == null ? void 0 : s.hotels
|
|
92
98
|
)
|
|
93
99
|
} : {
|
|
@@ -111,7 +117,7 @@ class v {
|
|
|
111
117
|
}
|
|
112
118
|
}
|
|
113
119
|
);
|
|
114
|
-
return
|
|
120
|
+
return p(s.data);
|
|
115
121
|
} catch {
|
|
116
122
|
return [];
|
|
117
123
|
}
|
|
@@ -121,8 +127,8 @@ class v {
|
|
|
121
127
|
const o = {
|
|
122
128
|
hotel_group: a.hotelGroup,
|
|
123
129
|
hotel_id: a.hotelId,
|
|
124
|
-
check_in_date: a.checkinDate.format(
|
|
125
|
-
check_out_date: a.checkoutDate.format(
|
|
130
|
+
check_in_date: a.checkinDate.format(m.ServerDate),
|
|
131
|
+
check_out_date: a.checkoutDate.format(m.ServerDate)
|
|
126
132
|
};
|
|
127
133
|
try {
|
|
128
134
|
const { data: e } = await C.post(
|
|
@@ -132,7 +138,7 @@ class v {
|
|
|
132
138
|
), c = ((t = e.data) == null ? void 0 : t.length) > 0 ? e.data[0] : null;
|
|
133
139
|
return {
|
|
134
140
|
success: e.success,
|
|
135
|
-
data: c == null ? null :
|
|
141
|
+
data: c == null ? null : p(c)
|
|
136
142
|
};
|
|
137
143
|
} catch (e) {
|
|
138
144
|
const c = e;
|
|
@@ -176,7 +182,7 @@ class v {
|
|
|
176
182
|
awardPoints: e.award_points,
|
|
177
183
|
rewardsProgram: e.hotel_rewards_program,
|
|
178
184
|
valueCents: e.value_cents,
|
|
179
|
-
bestCheckoutMethod: e.best_user_checkout_method === P.CASH ?
|
|
185
|
+
bestCheckoutMethod: e.best_user_checkout_method === P.CASH ? h.CASH : h.POINTS,
|
|
180
186
|
optimalProgram: {
|
|
181
187
|
totalProgramPointsValuation: e.optimal_user_program_checkout.total_program_points_valuation,
|
|
182
188
|
remainingPointsBalance: e.optimal_user_program_checkout.primary_offer_remaining_points_balance,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odynn/awayz-hotels",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
15
15
|
"patch": "npm run build && npm version patch && npm publish --access public",
|
|
16
16
|
"minor": "npm run build && npm version minor && npm publish --access public",
|
|
17
|
-
"major": "npm run build && npm version major && npm publish --access public"
|
|
17
|
+
"major": "npm run build && npm version major && npm publish --access public",
|
|
18
|
+
"yalc-publish": "yalc publish --push"
|
|
18
19
|
},
|
|
19
20
|
"peerDependencies": {
|
|
20
21
|
"react": "^18.3.1",
|