@revolugo/common 7.0.1-alpha.0 → 7.0.1
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/package.json +2 -2
- package/src/cancellation-policies.test.ts +2 -8
- package/src/cancellation-policies.ts +4 -57
- package/src/currencies/types.ts +1 -1
- package/src/currencies/utils.ts +52 -52
- package/src/schemas/hotel-room-offer.ts +13 -18
- package/src/schemas/hotel-room.ts +4 -1
- package/src/types/calendar.ts +2 -2
- package/src/types/elements/amenity.ts +10 -10
- package/src/types/elements/booking-policy.ts +7 -7
- package/src/types/elements/booking.ts +15 -15
- package/src/types/elements/contact-person.ts +0 -7
- package/src/types/elements/event-metadata.ts +6 -6
- package/src/types/elements/hotel-offer-list.ts +1 -1
- package/src/types/elements/hotel-offer-request.ts +21 -21
- package/src/types/elements/hotel-offer.ts +15 -15
- package/src/types/elements/hotel-offers-filters.ts +1 -1
- package/src/types/elements/hotel-room-offer-request.ts +22 -22
- package/src/types/elements/hotel-room-offer.ts +15 -15
- package/src/types/elements/hotel-room.ts +6 -6
- package/src/types/elements/hotel-rooming-list.ts +8 -8
- package/src/types/elements/hotel.ts +6 -6
- package/src/types/elements/meta-polling.ts +6 -6
- package/src/types/event.ts +1 -1
- package/src/types/hotel-contract.ts +1 -1
- package/src/types/hotel-room-stock.ts +1 -1
- package/src/types/pagination.ts +2 -2
- package/src/utils/create-composite-key.ts +2 -2
- package/src/utils/debounce.ts +1 -1
- package/src/utils/get-sanitized-room-count.ts +1 -1
- package/src/utils/poller.ts +55 -56
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "7.0.1
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Revolugo common",
|
|
6
6
|
"author": "Revolugo",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dayjs": "1.11.19",
|
|
35
35
|
"ky": "1.14.3",
|
|
36
36
|
"slugify": "1.6.6",
|
|
37
|
-
"type-fest": "5.4.
|
|
37
|
+
"type-fest": "5.4.3",
|
|
38
38
|
"uuid": "13.0.0",
|
|
39
39
|
"zod": "4.3.6"
|
|
40
40
|
},
|
|
@@ -238,10 +238,7 @@ describe('sanitizeCancellationPolicies', () => {
|
|
|
238
238
|
|
|
239
239
|
describe('when Booking Date < Release Date < Check In Date', () => {
|
|
240
240
|
const releaseDate = '2021-01-05'
|
|
241
|
-
const
|
|
242
|
-
.add(1, 'day')
|
|
243
|
-
.format('YYYY-MM-DD')
|
|
244
|
-
const releaseDatetime = getFormattedUTCLocalTime(releaseDateCP, timezone)
|
|
241
|
+
const releaseDatetime = getFormattedUTCLocalTime(releaseDate, timezone)
|
|
245
242
|
const bookingDatetime = getFormattedUTCLocalTime(
|
|
246
243
|
'2021-01-01T10:00:00',
|
|
247
244
|
timezone,
|
|
@@ -407,10 +404,7 @@ describe('sanitizeCancellationPolicies', () => {
|
|
|
407
404
|
|
|
408
405
|
describe('when Booking Date < Release Date < DF_0', () => {
|
|
409
406
|
const releaseDate = '2020-12-30'
|
|
410
|
-
const
|
|
411
|
-
.add(1, 'day')
|
|
412
|
-
.format('YYYY-MM-DD')
|
|
413
|
-
const releaseDatetime = getFormattedUTCLocalTime(releaseDateCP, timezone)
|
|
407
|
+
const releaseDatetime = getFormattedUTCLocalTime(releaseDate, timezone)
|
|
414
408
|
const bookingDatetime = getFormattedUTCLocalTime(
|
|
415
409
|
'2020-12-20T10:00:00',
|
|
416
410
|
timezone,
|
|
@@ -34,31 +34,6 @@ export interface SanitizeCancellationPolicies {
|
|
|
34
34
|
timezone?: string
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function initReleaseDateUTC({
|
|
38
|
-
checkInDate,
|
|
39
|
-
releaseDate,
|
|
40
|
-
timezone,
|
|
41
|
-
}: {
|
|
42
|
-
releaseDate?: string
|
|
43
|
-
timezone: string
|
|
44
|
-
checkInDate: string
|
|
45
|
-
}): string | undefined {
|
|
46
|
-
if (!releaseDate) {
|
|
47
|
-
return undefined
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (dayjs(releaseDate).isSameOrAfter(dayjs(checkInDate))) {
|
|
51
|
-
return dayjs.tz(releaseDate, timezone).startOf('day').utc().format()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return dayjs
|
|
55
|
-
.tz(releaseDate, timezone)
|
|
56
|
-
.add(1, 'day')
|
|
57
|
-
.startOf('day')
|
|
58
|
-
.utc()
|
|
59
|
-
.format()
|
|
60
|
-
}
|
|
61
|
-
|
|
62
37
|
// eslint-disable-next-line complexity, max-statements, max-lines-per-function
|
|
63
38
|
export function sanitizeCancellationPolicies({
|
|
64
39
|
bookingDatetime,
|
|
@@ -87,11 +62,8 @@ export function sanitizeCancellationPolicies({
|
|
|
87
62
|
|
|
88
63
|
const nextDayCheckInDateUTC = nextDay(checkInDatetimeUTC)
|
|
89
64
|
|
|
90
|
-
const releaseDatetimeUTC =
|
|
91
|
-
|
|
92
|
-
releaseDate,
|
|
93
|
-
timezone,
|
|
94
|
-
})
|
|
65
|
+
const releaseDatetimeUTC =
|
|
66
|
+
releaseDate && dayjs.tz(releaseDate, timezone).startOf('day').utc().format()
|
|
95
67
|
|
|
96
68
|
if (dayjs(bookingDatetimeUTC).isAfter(nextDayCheckInDateUTC)) {
|
|
97
69
|
return sanitizeCancellationPolicies({
|
|
@@ -480,10 +452,10 @@ export function getSanitizedCancellationPolicies({
|
|
|
480
452
|
initialDate,
|
|
481
453
|
timezone,
|
|
482
454
|
}: {
|
|
483
|
-
cancellationPolicies: ICancellationPolicy[]
|
|
484
455
|
checkInDate: string
|
|
485
|
-
|
|
456
|
+
cancellationPolicies: ICancellationPolicy[]
|
|
486
457
|
timezone?: string
|
|
458
|
+
initialDate?: string
|
|
487
459
|
}): ICancellationPolicy[] {
|
|
488
460
|
if (!cancellationPolicies.length) {
|
|
489
461
|
return []
|
|
@@ -539,28 +511,3 @@ export function isFreeCancellable(cps: ICancellationPolicy[]): boolean {
|
|
|
539
511
|
dayjs().isBetween(dayjs(freeCp.dateFrom), dayjs(freeCp.dateTo)))
|
|
540
512
|
)
|
|
541
513
|
}
|
|
542
|
-
|
|
543
|
-
export function filterForCustomers(
|
|
544
|
-
cps: ICancellationPolicy[],
|
|
545
|
-
): ICancellationPolicy[] {
|
|
546
|
-
const now = dayjs()
|
|
547
|
-
const nowPlus2Hours = now.add(2, 'hours')
|
|
548
|
-
|
|
549
|
-
return cps.reduce<ICancellationPolicy[]>((result, cp) => {
|
|
550
|
-
if (
|
|
551
|
-
dayjs(cp.dateFrom).isSameOrBefore(nowPlus2Hours) &&
|
|
552
|
-
dayjs(cp.dateTo).isAfter(nowPlus2Hours)
|
|
553
|
-
) {
|
|
554
|
-
result.push({
|
|
555
|
-
...cp,
|
|
556
|
-
dateFrom: now.format(),
|
|
557
|
-
})
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
if (dayjs(cp.dateFrom).isAfter(nowPlus2Hours)) {
|
|
561
|
-
result.push(cp)
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return result
|
|
565
|
-
}, [])
|
|
566
|
-
}
|
package/src/currencies/types.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { CurrencyCode } from './constants.ts'
|
|
|
3
3
|
export interface ICurrency {
|
|
4
4
|
code: CurrencyCode
|
|
5
5
|
decimalDigits: number
|
|
6
|
-
deprecated?: boolean
|
|
7
6
|
name: string
|
|
8
7
|
namePlural: string
|
|
9
8
|
rounding: number
|
|
10
9
|
symbol: string
|
|
11
10
|
symbolNative: string
|
|
12
11
|
zeroDecimal: boolean
|
|
12
|
+
deprecated?: boolean
|
|
13
13
|
}
|
package/src/currencies/utils.ts
CHANGED
|
@@ -98,39 +98,6 @@ export class MoneyCalculator {
|
|
|
98
98
|
this.isNormalized = isNormalized
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
public ceil(): this {
|
|
102
|
-
this.amount = Math.ceil(this.amount)
|
|
103
|
-
|
|
104
|
-
return this
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public convert({
|
|
108
|
-
currency,
|
|
109
|
-
exchangeRate,
|
|
110
|
-
}: {
|
|
111
|
-
currency: CurrencyCode
|
|
112
|
-
exchangeRate: number
|
|
113
|
-
}): this {
|
|
114
|
-
if (this.currency === currency || this.amount === 0) {
|
|
115
|
-
return this
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const startingIsNormalized = this.isNormalized
|
|
119
|
-
|
|
120
|
-
if (startingIsNormalized) {
|
|
121
|
-
this.denormalize()
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
this.amount *= exchangeRate
|
|
125
|
-
this.currency = currency
|
|
126
|
-
|
|
127
|
-
if (startingIsNormalized) {
|
|
128
|
-
this.normalize()
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return this
|
|
132
|
-
}
|
|
133
|
-
|
|
134
101
|
public denormalize(): this {
|
|
135
102
|
if (!this.isNormalized) {
|
|
136
103
|
return this
|
|
@@ -146,25 +113,6 @@ export class MoneyCalculator {
|
|
|
146
113
|
return this
|
|
147
114
|
}
|
|
148
115
|
|
|
149
|
-
public floor(): this {
|
|
150
|
-
this.amount = Math.floor(this.amount)
|
|
151
|
-
|
|
152
|
-
return this
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
public format(locale?: string, space?: string): string {
|
|
156
|
-
return formatAmount({
|
|
157
|
-
amount: this.amount,
|
|
158
|
-
currency: this.currency,
|
|
159
|
-
locale,
|
|
160
|
-
space,
|
|
161
|
-
})
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public getAmount(): number {
|
|
165
|
-
return this.amount
|
|
166
|
-
}
|
|
167
|
-
|
|
168
116
|
public markup(percentage: number): this {
|
|
169
117
|
this.amount /= 1 - percentage
|
|
170
118
|
|
|
@@ -191,11 +139,63 @@ export class MoneyCalculator {
|
|
|
191
139
|
return this
|
|
192
140
|
}
|
|
193
141
|
|
|
142
|
+
public ceil(): this {
|
|
143
|
+
this.amount = Math.ceil(this.amount)
|
|
144
|
+
|
|
145
|
+
return this
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public floor(): this {
|
|
149
|
+
this.amount = Math.floor(this.amount)
|
|
150
|
+
|
|
151
|
+
return this
|
|
152
|
+
}
|
|
153
|
+
|
|
194
154
|
public round(): this {
|
|
195
155
|
this.amount = Math.round(this.amount)
|
|
196
156
|
|
|
197
157
|
return this
|
|
198
158
|
}
|
|
159
|
+
|
|
160
|
+
public format(locale?: string, space?: string): string {
|
|
161
|
+
return formatAmount({
|
|
162
|
+
amount: this.amount,
|
|
163
|
+
currency: this.currency,
|
|
164
|
+
locale,
|
|
165
|
+
space,
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
public getAmount(): number {
|
|
170
|
+
return this.amount
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public convert({
|
|
174
|
+
currency,
|
|
175
|
+
exchangeRate,
|
|
176
|
+
}: {
|
|
177
|
+
exchangeRate: number
|
|
178
|
+
currency: CurrencyCode
|
|
179
|
+
}): this {
|
|
180
|
+
if (this.currency === currency || this.amount === 0) {
|
|
181
|
+
return this
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const startingIsNormalized = this.isNormalized
|
|
185
|
+
|
|
186
|
+
if (startingIsNormalized) {
|
|
187
|
+
this.denormalize()
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
this.amount *= exchangeRate
|
|
191
|
+
this.currency = currency
|
|
192
|
+
|
|
193
|
+
if (startingIsNormalized) {
|
|
194
|
+
this.normalize()
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return this
|
|
198
|
+
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
export function ceilNormalizedAmount({
|
|
@@ -5,14 +5,12 @@ import {
|
|
|
5
5
|
BreakfastOption,
|
|
6
6
|
HotelRoomOfferType,
|
|
7
7
|
PackageType,
|
|
8
|
-
StayTaxesInfoEnum,
|
|
9
8
|
} from '../constants/index.ts'
|
|
10
9
|
|
|
11
10
|
import { CANCELLATION_POLICY_SCHEMA } from './cancellation-policies.ts'
|
|
12
11
|
import { CURRENCY_SCHEMA } from './currency.ts'
|
|
13
12
|
import { SOURCE_MARKET_SCHEMA } from './hotel-offer-request.ts'
|
|
14
13
|
import { HOTEL_ROOMS_SCHEMA } from './hotel-room.ts'
|
|
15
|
-
import { LIST_POLLING_META_SCHEMA } from './list-polling-meta.ts'
|
|
16
14
|
import { TAGS_SCHEMA } from './tag.ts'
|
|
17
15
|
import { TAXES_SCHEMA } from './taxes.ts'
|
|
18
16
|
|
|
@@ -29,17 +27,21 @@ export const PACKAGE_TYPES_DESCRIPTION = `An **Hotel Room Offer** of type **${Ho
|
|
|
29
27
|
|
|
30
28
|
export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
31
29
|
.object({
|
|
32
|
-
breakfast_count: z.number().min(0).nullish().openapi({
|
|
30
|
+
breakfast_count: z.number().min(0).optional().nullish().openapi({
|
|
33
31
|
description:
|
|
34
32
|
'Quantity of breakfast per night included in the given **Hotel Room Offer**',
|
|
35
33
|
}),
|
|
36
34
|
breakfast_option: z.enum(BreakfastOption).openapi({
|
|
37
35
|
description: BREAKFAST_OPTION_DESCRIPTION,
|
|
38
36
|
}),
|
|
39
|
-
breakfast_price_per_guest_per_night: z
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
breakfast_price_per_guest_per_night: z
|
|
38
|
+
.number()
|
|
39
|
+
.optional()
|
|
40
|
+
.nullish()
|
|
41
|
+
.openapi({
|
|
42
|
+
description:
|
|
43
|
+
'Price of breakfast per guest per night for the given **Hotel Room Offer**, expressed in the requested **currency**, when applicable.\n\n <div style="background-color: #ffffef; padding: 20px; border: 1px solid lightgrey; border-radius: 5px;"><b style="color: red; margin-top: 10px;">🛑 DEPRECATED.</b>\n\n <b style="color: orange;">Field renamed to "breakfast_unit_price"</div>',
|
|
44
|
+
}),
|
|
43
45
|
breakfast_unit_price: z.number().optional().nullish().openapi({
|
|
44
46
|
description:
|
|
45
47
|
'Price of breakfast per guest per night for the given **Hotel Room Offer**, expressed in the requested **currency**, when applicable.',
|
|
@@ -52,6 +54,7 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
52
54
|
}),
|
|
53
55
|
count: z
|
|
54
56
|
.number()
|
|
57
|
+
.optional()
|
|
55
58
|
.nullish()
|
|
56
59
|
.openapi({
|
|
57
60
|
description: `When **type = ${HotelRoomOfferType.HotelRoom}**: this parameters represents the available quantity for the given **Hotel Room Offer**.
|
|
@@ -70,15 +73,13 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
70
73
|
.openapi({
|
|
71
74
|
description: PACKAGE_TYPES_DESCRIPTION,
|
|
72
75
|
})
|
|
73
|
-
.nullish()
|
|
76
|
+
.nullish()
|
|
77
|
+
.optional(),
|
|
74
78
|
price: z.number().openapi({
|
|
75
79
|
description:
|
|
76
80
|
'Price with taxes NOT INCLUDED of the given **Hotel Room Offer** including breakfast(s) when applicable, expressed in the requested **currency**.',
|
|
77
81
|
}),
|
|
78
82
|
source_market: SOURCE_MARKET_SCHEMA,
|
|
79
|
-
stay_taxes_info: z
|
|
80
|
-
.enum(StayTaxesInfoEnum)
|
|
81
|
-
.openapi({ description: 'Either INCLUDED, NOT_INCLUDED or UNKNOWN' }),
|
|
82
83
|
tags: TAGS_SCHEMA,
|
|
83
84
|
tax_included_price: z.number().openapi({
|
|
84
85
|
description: `Price of the given **Hotel Room Offer** including breakfast(s) when applicable, and including all taxes from returned **taxes** list parameter expressed in the requested **currency**.\n\nThis data is not returned for a **Hotel Room Offer** of type **${HotelRoomOfferType.HotelRoom}**, you'll need to compute and display the actual tax included price of the final **Hotel Room** package corresponding to the guest count and night count requested, or make a call to the **[Create Hotel Room Offer](/v1/documentation#operation/postV1Hotel_room_offers)** endpoint in order to get a valid and bookable **Hotel Room Offer** where **type = ${HotelRoomOfferType.Package}** based on a packaged list of **Hotel Room Offers** of type **${HotelRoomOfferType.HotelRoom}**.`,
|
|
@@ -89,16 +90,10 @@ export const HOTEL_ROOM_OFFER_SCHEMA = z
|
|
|
89
90
|
.openapi({
|
|
90
91
|
description: `Hotel Room Offer type.\n\n **Hotel Room Offers** with **type = "${HotelRoomOfferType.Package}"** are **Hotel Room Offers** that are already bookable and you'll be able to follow the next step of the **Booking Flow** calling **[Create Booking Policies endpoint](/v1/documentation#operation/postV1Booking_policies)**. \n\n Otherwise, you'll be able to create a new **Hotel Room Offer** with **type = "${HotelRoomOfferType.Package}"** from multiple **Hotel Room Offers** with **type = "${HotelRoomOfferType.HotelRoom}"**. See **[Create Hotel Room Offer endpoint](/v1/documentation#operation/postV1Hotel_room_offers)** for details.`,
|
|
91
92
|
})
|
|
93
|
+
.nullish()
|
|
92
94
|
.optional(),
|
|
93
95
|
})
|
|
94
96
|
.openapi('hotelRoomOfferApi', {
|
|
95
97
|
description: 'Description of the Hotel Room Offer.',
|
|
96
98
|
})
|
|
97
|
-
|
|
98
|
-
export const HOTEL_ROOM_OFFERS_SCHEMA = z.array(HOTEL_ROOM_OFFER_SCHEMA)
|
|
99
|
-
|
|
100
|
-
export const HOTEL_ROOM_OFFERS_RESPONSE_SCHEMA = z.object({
|
|
101
|
-
data: HOTEL_ROOM_OFFERS_SCHEMA,
|
|
102
|
-
meta: LIST_POLLING_META_SCHEMA,
|
|
103
|
-
})
|
|
104
99
|
/* eslint-enable camelcase */
|
|
@@ -57,7 +57,10 @@ export const HOTEL_ROOM_SCHEMA = z
|
|
|
57
57
|
.openapi({ description: 'Whether high resolution images are available.' })
|
|
58
58
|
.optional()
|
|
59
59
|
.nullish(),
|
|
60
|
-
id: z
|
|
60
|
+
id: z
|
|
61
|
+
.string()
|
|
62
|
+
.optional()
|
|
63
|
+
.openapi({ description: 'Hotel Room id, when applicable.' }),
|
|
61
64
|
image_indexes: z.array(z.number()).optional().nullish().openapi({
|
|
62
65
|
description:
|
|
63
66
|
'List of indexes corresponding to image names for the given Hotel Room among the related hotel images.',
|
package/src/types/calendar.ts
CHANGED
|
@@ -6,11 +6,11 @@ export interface ICalendarRange<
|
|
|
6
6
|
T extends ICalendarRangeDay = ICalendarRangeDay,
|
|
7
7
|
U = Record<string, unknown> | undefined,
|
|
8
8
|
> {
|
|
9
|
-
id: string
|
|
10
|
-
data: U
|
|
11
9
|
dateFrom: string
|
|
12
10
|
dateTo: string
|
|
13
11
|
days: T[]
|
|
12
|
+
data: U
|
|
13
|
+
id: string
|
|
14
14
|
name: string
|
|
15
15
|
resourceId: string
|
|
16
16
|
}
|
|
@@ -113,12 +113,6 @@ export interface Amenities {
|
|
|
113
113
|
* @memberof Amenities
|
|
114
114
|
*/
|
|
115
115
|
handicapAccessible?: boolean
|
|
116
|
-
/**
|
|
117
|
-
* Indoor pool.
|
|
118
|
-
* @type {boolean}
|
|
119
|
-
* @memberof Amenities
|
|
120
|
-
*/
|
|
121
|
-
indoorPool?: boolean
|
|
122
116
|
/**
|
|
123
117
|
* In house bar.
|
|
124
118
|
* @type {boolean}
|
|
@@ -137,6 +131,12 @@ export interface Amenities {
|
|
|
137
131
|
* @memberof Amenities
|
|
138
132
|
*/
|
|
139
133
|
inRoomMovies?: boolean
|
|
134
|
+
/**
|
|
135
|
+
* Indoor pool.
|
|
136
|
+
* @type {boolean}
|
|
137
|
+
* @memberof Amenities
|
|
138
|
+
*/
|
|
139
|
+
indoorPool?: boolean
|
|
140
140
|
/**
|
|
141
141
|
* Interior room entrance.
|
|
142
142
|
* @type {boolean}
|
|
@@ -216,17 +216,17 @@ export interface Amenities {
|
|
|
216
216
|
*/
|
|
217
217
|
sauna?: boolean
|
|
218
218
|
/**
|
|
219
|
-
*
|
|
219
|
+
* TV in room.
|
|
220
220
|
* @type {boolean}
|
|
221
221
|
* @memberof Amenities
|
|
222
222
|
*/
|
|
223
|
-
|
|
223
|
+
tVInRoom?: boolean
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
225
|
+
* Tennis court.
|
|
226
226
|
* @type {boolean}
|
|
227
227
|
* @memberof Amenities
|
|
228
228
|
*/
|
|
229
|
-
|
|
229
|
+
tennisCourt?: boolean
|
|
230
230
|
/**
|
|
231
231
|
* 24/7 security.
|
|
232
232
|
* @type {boolean}
|
|
@@ -3,12 +3,6 @@ import type { CurrencyType } from './currency.ts'
|
|
|
3
3
|
import type { HotelRoomOffer } from './hotel-room-offer.ts'
|
|
4
4
|
|
|
5
5
|
export interface BookingPolicies {
|
|
6
|
-
/**
|
|
7
|
-
* **Booking Policy** id
|
|
8
|
-
* @type {string}
|
|
9
|
-
* @memberof BookingPolicies
|
|
10
|
-
*/
|
|
11
|
-
id: string
|
|
12
6
|
/**
|
|
13
7
|
* The total number of adults who will be staying in the property.
|
|
14
8
|
* @type {number}
|
|
@@ -45,7 +39,6 @@ export interface BookingPolicies {
|
|
|
45
39
|
* @memberof BookingPolicies
|
|
46
40
|
*/
|
|
47
41
|
currency: CurrencyType
|
|
48
|
-
|
|
49
42
|
/**
|
|
50
43
|
* Expiration date for this **Booking Policy**.
|
|
51
44
|
*
|
|
@@ -54,6 +47,7 @@ export interface BookingPolicies {
|
|
|
54
47
|
* @memberof BookingPolicies
|
|
55
48
|
*/
|
|
56
49
|
expiresAt: string | null
|
|
50
|
+
|
|
57
51
|
hasRoomingLists: boolean
|
|
58
52
|
/**
|
|
59
53
|
* Hotel id
|
|
@@ -67,6 +61,12 @@ export interface BookingPolicies {
|
|
|
67
61
|
* @memberof BookingPolicies
|
|
68
62
|
*/
|
|
69
63
|
hotelRoomOffer: HotelRoomOffer
|
|
64
|
+
/**
|
|
65
|
+
* **Booking Policy** id
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @memberof BookingPolicies
|
|
68
|
+
*/
|
|
69
|
+
id: string
|
|
70
70
|
/**
|
|
71
71
|
* Indicates whether the price of the **Hotel Room Offer** (without breakfast included) has increased compared to the price returned by [Retrieve Hotel Room Offers endpoint](/v1/documentation#operation/getV1Hotel_room_offers).
|
|
72
72
|
*
|
|
@@ -10,12 +10,6 @@ import type { SourceMarket } from './source-market.ts'
|
|
|
10
10
|
import type { Tax } from './tax.ts'
|
|
11
11
|
|
|
12
12
|
export interface Booking {
|
|
13
|
-
/**
|
|
14
|
-
* Booking Id
|
|
15
|
-
* @type {string}
|
|
16
|
-
* @memberof Booking
|
|
17
|
-
*/
|
|
18
|
-
id?: string | null
|
|
19
13
|
/**
|
|
20
14
|
* The total number of adults who will be staying in the property.
|
|
21
15
|
* @type {number}
|
|
@@ -106,6 +100,12 @@ export interface Booking {
|
|
|
106
100
|
* @memberof Booking
|
|
107
101
|
*/
|
|
108
102
|
hotelId: string
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @type {HotelRoomOffer}
|
|
106
|
+
* @memberof Booking
|
|
107
|
+
*/
|
|
108
|
+
hotelRoomOffer: HotelRoomOffer
|
|
109
109
|
/**
|
|
110
110
|
* Hotel rooming lists of a hotel booking
|
|
111
111
|
* @type {Array<HotelRoomingList>}
|
|
@@ -113,11 +113,11 @@ export interface Booking {
|
|
|
113
113
|
*/
|
|
114
114
|
hotelRoomingLists?: HotelRoomingList[]
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @type {
|
|
116
|
+
* Booking Id
|
|
117
|
+
* @type {string}
|
|
118
118
|
* @memberof Booking
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
id?: string | null
|
|
121
121
|
/**
|
|
122
122
|
* The list of invoices and credit notes (when applicable) direct urls associated to the Booking.
|
|
123
123
|
* @type {Array<InvoiceApi>}
|
|
@@ -184,18 +184,18 @@ export interface Booking {
|
|
|
184
184
|
* @memberof Booking
|
|
185
185
|
*/
|
|
186
186
|
taxAmount: number
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* @type {Array<Tax>}
|
|
190
|
-
* @memberof Booking
|
|
191
|
-
*/
|
|
192
|
-
taxes?: Tax[] | null
|
|
193
187
|
/**
|
|
194
188
|
* Price of the booking including taxes expressed in the booking currency.
|
|
195
189
|
* @type {number}
|
|
196
190
|
* @memberof Booking
|
|
197
191
|
*/
|
|
198
192
|
taxIncludedPrice: number
|
|
193
|
+
/**
|
|
194
|
+
*
|
|
195
|
+
* @type {Array<Tax>}
|
|
196
|
+
* @memberof Booking
|
|
197
|
+
*/
|
|
198
|
+
taxes?: Tax[] | null
|
|
199
199
|
/**
|
|
200
200
|
* Link to Revolugo terms and conditions under which the booking is made.
|
|
201
201
|
* @type {string}
|
|
@@ -167,11 +167,4 @@ export interface PrebookFormValues {
|
|
|
167
167
|
phoneNumber: string
|
|
168
168
|
salutation: ContactPerson['salutation']
|
|
169
169
|
specialRequests: ContactPerson['remarks']
|
|
170
|
-
organizationAddress?: string
|
|
171
|
-
organizationCity?: string
|
|
172
|
-
organizationCountry?: string
|
|
173
|
-
organizationName?: string
|
|
174
|
-
organizationState?: string
|
|
175
|
-
organizationVatNumber?: string
|
|
176
|
-
organizationZipCode?: string
|
|
177
170
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
export interface EventMetadata {
|
|
2
|
-
/**
|
|
3
|
-
* Unique id of the event
|
|
4
|
-
* @type {string}
|
|
5
|
-
* @memberof EventMetadata
|
|
6
|
-
*/
|
|
7
|
-
id?: string
|
|
8
2
|
/**
|
|
9
3
|
* End date of the event formatted as YYYY-MM-DD.
|
|
10
4
|
* @type {string}
|
|
@@ -17,6 +11,12 @@ export interface EventMetadata {
|
|
|
17
11
|
* @memberof EventMetadata
|
|
18
12
|
*/
|
|
19
13
|
dateStart?: string
|
|
14
|
+
/**
|
|
15
|
+
* Unique id of the event
|
|
16
|
+
* @type {string}
|
|
17
|
+
* @memberof EventMetadata
|
|
18
|
+
*/
|
|
19
|
+
id?: string
|
|
20
20
|
/**
|
|
21
21
|
* Image URL of the event
|
|
22
22
|
* @type {string}
|
|
@@ -12,11 +12,11 @@ export type HotelOffersSortByOrderType = `${HotelOffersSortByOrderEnum}`
|
|
|
12
12
|
|
|
13
13
|
export interface HotelOffersListPayload {
|
|
14
14
|
currency: CurrencyType
|
|
15
|
+
hotelOfferRequestId: string
|
|
15
16
|
endingBefore?: string | null
|
|
16
17
|
filterByPrice?: string
|
|
17
18
|
filterByReviewRating?: number
|
|
18
19
|
filterByStar?: string
|
|
19
|
-
hotelOfferRequestId: string
|
|
20
20
|
hotelRoomOffersLimit?: number
|
|
21
21
|
includeHotelContentDetails?: boolean | null
|
|
22
22
|
lang?: Locale
|
|
@@ -2,11 +2,6 @@ import type { EventMetadata } from './event-metadata.ts'
|
|
|
2
2
|
import type { SourceMarket } from './source-market.ts'
|
|
3
3
|
|
|
4
4
|
export interface HotelOfferRequest {
|
|
5
|
-
/**
|
|
6
|
-
* id of the **Hotel Offer Request**
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
id: string
|
|
10
5
|
/**
|
|
11
6
|
* This endpoint allows to find the geo-coordinates of a known address, place or locality via this free-text address query field. This address will eventually be geocoded into a latitude/longitude pair.
|
|
12
7
|
*
|
|
@@ -34,12 +29,6 @@ export interface HotelOfferRequest {
|
|
|
34
29
|
* @type {string}
|
|
35
30
|
*/
|
|
36
31
|
children?: string | null
|
|
37
|
-
/**
|
|
38
|
-
* Date of the **Hotel Room Offer Request** creation
|
|
39
|
-
* @type {string}
|
|
40
|
-
* @memberof HotelOfferRequestApiResponse
|
|
41
|
-
*/
|
|
42
|
-
createdAt: string
|
|
43
32
|
/**
|
|
44
33
|
*
|
|
45
34
|
* @type {EventMetadata}
|
|
@@ -71,15 +60,20 @@ export interface HotelOfferRequest {
|
|
|
71
60
|
* @type {SourceMarket}
|
|
72
61
|
*/
|
|
73
62
|
sourceMarket: SourceMarket
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface HotelOfferRequestResponse {
|
|
77
63
|
/**
|
|
78
|
-
*
|
|
64
|
+
* Date of the **Hotel Room Offer Request** creation
|
|
79
65
|
* @type {string}
|
|
80
66
|
* @memberof HotelOfferRequestApiResponse
|
|
81
67
|
*/
|
|
68
|
+
createdAt: string
|
|
69
|
+
/**
|
|
70
|
+
* id of the **Hotel Offer Request**
|
|
71
|
+
* @type {string}
|
|
72
|
+
*/
|
|
82
73
|
id: string
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface HotelOfferRequestResponse {
|
|
83
77
|
/**
|
|
84
78
|
* This endpoint allows to find the geo-coordinates of a known address, place or locality via this free-text address query field. This address will eventually be geocoded into a latitude/longitude pair.
|
|
85
79
|
*
|
|
@@ -112,12 +106,6 @@ export interface HotelOfferRequestResponse {
|
|
|
112
106
|
* @memberof HotelOfferRequestApiResponse
|
|
113
107
|
*/
|
|
114
108
|
children?: string | null
|
|
115
|
-
/**
|
|
116
|
-
* Date of the **Hotel Offer Request** creation
|
|
117
|
-
* @type {string}
|
|
118
|
-
* @memberof HotelOfferRequestApiResponse
|
|
119
|
-
*/
|
|
120
|
-
createdAt: string
|
|
121
109
|
/**
|
|
122
110
|
*
|
|
123
111
|
* @type {EventMetadataApi}
|
|
@@ -154,6 +142,18 @@ export interface HotelOfferRequestResponse {
|
|
|
154
142
|
* @memberof HotelOfferRequestApiResponse
|
|
155
143
|
*/
|
|
156
144
|
sourceMarket: SourceMarket
|
|
145
|
+
/**
|
|
146
|
+
* Date of the **Hotel Offer Request** creation
|
|
147
|
+
* @type {string}
|
|
148
|
+
* @memberof HotelOfferRequestApiResponse
|
|
149
|
+
*/
|
|
150
|
+
createdAt: string
|
|
151
|
+
/**
|
|
152
|
+
* id of the **Hotel Offer Request**
|
|
153
|
+
* @type {string}
|
|
154
|
+
* @memberof HotelOfferRequestApiResponse
|
|
155
|
+
*/
|
|
156
|
+
id: string
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export interface HotelOfferRequestCreate {
|
|
@@ -9,12 +9,6 @@ import type { TravelTimeItem } from './travel-times.ts'
|
|
|
9
9
|
import type { CurrencyCode } from '../../currencies/constants.ts'
|
|
10
10
|
|
|
11
11
|
export interface HotelOffer {
|
|
12
|
-
/**
|
|
13
|
-
* Hotel id.
|
|
14
|
-
* @type {string}
|
|
15
|
-
* @memberof HotelOffer
|
|
16
|
-
*/
|
|
17
|
-
id: string
|
|
18
12
|
/**
|
|
19
13
|
* Hotel address.
|
|
20
14
|
* @type {string}
|
|
@@ -108,11 +102,11 @@ export interface HotelOffer {
|
|
|
108
102
|
*/
|
|
109
103
|
hotelReviewRatings?: HotelReviewRating[] | null
|
|
110
104
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @type {
|
|
105
|
+
* Hotel id.
|
|
106
|
+
* @type {string}
|
|
113
107
|
* @memberof HotelOffer
|
|
114
108
|
*/
|
|
115
|
-
|
|
109
|
+
id: string
|
|
116
110
|
/**
|
|
117
111
|
*
|
|
118
112
|
* @type {HotelImages}
|
|
@@ -168,12 +162,6 @@ export interface HotelOffer {
|
|
|
168
162
|
* @memberof HotelOffer
|
|
169
163
|
*/
|
|
170
164
|
state?: string | null
|
|
171
|
-
/**
|
|
172
|
-
*
|
|
173
|
-
* @type {Array<Tag>}
|
|
174
|
-
* @memberof HotelOffer
|
|
175
|
-
*/
|
|
176
|
-
tags?: Tag[]
|
|
177
165
|
/**
|
|
178
166
|
* TripAdvisor property id. When applicable.
|
|
179
167
|
* @type {string}
|
|
@@ -198,6 +186,18 @@ export interface HotelOffer {
|
|
|
198
186
|
* @memberof HotelOffer
|
|
199
187
|
*/
|
|
200
188
|
website?: string | null
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @type {Array<HotelRoomOffer>}
|
|
192
|
+
* @memberof HotelOffer
|
|
193
|
+
*/
|
|
194
|
+
hotelRoomOffers: HotelRoomOffer[]
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
* @type {Array<Tag>}
|
|
198
|
+
* @memberof HotelOffer
|
|
199
|
+
*/
|
|
200
|
+
tags?: Tag[]
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
export enum HotelOffersSortByEnum {
|
|
@@ -9,9 +9,9 @@ export enum FilterName {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface HotelOffersFilters {
|
|
12
|
-
[FilterName.Price]: [number, number]
|
|
13
12
|
[FilterName.Rating]: string
|
|
14
13
|
[FilterName.ReviewRating]?: number
|
|
14
|
+
[FilterName.Price]: [number, number]
|
|
15
15
|
[FilterName.SortBy]: {
|
|
16
16
|
direction: HotelOffersSortByOrderType
|
|
17
17
|
value: HotelOffersSortByEnum
|
|
@@ -2,12 +2,6 @@ import type { EventMetadata } from './event-metadata.ts'
|
|
|
2
2
|
import type { SourceMarket } from './source-market.ts'
|
|
3
3
|
|
|
4
4
|
export interface HotelRoomOfferRequest {
|
|
5
|
-
/**
|
|
6
|
-
* id of the **Hotel Room Offer Request**
|
|
7
|
-
* @type {string}
|
|
8
|
-
* @memberof HotelRoomOfferRequest
|
|
9
|
-
*/
|
|
10
|
-
id: string
|
|
11
5
|
/**
|
|
12
6
|
* Requested number of adult(s) to be accommodated.
|
|
13
7
|
* @type {number}
|
|
@@ -32,12 +26,6 @@ export interface HotelRoomOfferRequest {
|
|
|
32
26
|
* @memberof HotelRoomOfferRequest
|
|
33
27
|
*/
|
|
34
28
|
children?: string | null
|
|
35
|
-
/**
|
|
36
|
-
* Date of the **Hotel Room Offer Request** creation
|
|
37
|
-
* @type {string}
|
|
38
|
-
* @memberof HotelRoomOfferRequest
|
|
39
|
-
*/
|
|
40
|
-
createdAt: string
|
|
41
29
|
/**
|
|
42
30
|
*
|
|
43
31
|
* @type {EventMetadata}
|
|
@@ -62,15 +50,21 @@ export interface HotelRoomOfferRequest {
|
|
|
62
50
|
* @memberof HotelRoomOfferRequest
|
|
63
51
|
*/
|
|
64
52
|
sourceMarket: SourceMarket
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Date of the **Hotel Room Offer Request** creation
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @memberof HotelRoomOfferRequest
|
|
57
|
+
*/
|
|
58
|
+
createdAt: string
|
|
68
59
|
/**
|
|
69
60
|
* id of the **Hotel Room Offer Request**
|
|
70
61
|
* @type {string}
|
|
71
|
-
* @memberof
|
|
62
|
+
* @memberof HotelRoomOfferRequest
|
|
72
63
|
*/
|
|
73
64
|
id: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface HotelRoomOfferRequestResponse {
|
|
74
68
|
/**
|
|
75
69
|
* Requested number of adult(s) to be accommodated.
|
|
76
70
|
* @type {number}
|
|
@@ -95,12 +89,6 @@ export interface HotelRoomOfferRequestResponse {
|
|
|
95
89
|
* @memberof HotelRoomOfferRequestApiResponse
|
|
96
90
|
*/
|
|
97
91
|
children?: string | null
|
|
98
|
-
/**
|
|
99
|
-
* Date of the **Hotel Room Offer Request** creation
|
|
100
|
-
* @type {string}
|
|
101
|
-
* @memberof HotelRoomOfferRequestApiResponse
|
|
102
|
-
*/
|
|
103
|
-
createdAt: string
|
|
104
92
|
/**
|
|
105
93
|
*
|
|
106
94
|
* @type {EventMetadataApi}
|
|
@@ -125,6 +113,18 @@ export interface HotelRoomOfferRequestResponse {
|
|
|
125
113
|
* @memberof HotelRoomOfferRequestApiResponse
|
|
126
114
|
*/
|
|
127
115
|
sourceMarket: SourceMarket
|
|
116
|
+
/**
|
|
117
|
+
* Date of the **Hotel Room Offer Request** creation
|
|
118
|
+
* @type {string}
|
|
119
|
+
* @memberof HotelRoomOfferRequestApiResponse
|
|
120
|
+
*/
|
|
121
|
+
createdAt: string
|
|
122
|
+
/**
|
|
123
|
+
* id of the **Hotel Room Offer Request**
|
|
124
|
+
* @type {string}
|
|
125
|
+
* @memberof HotelRoomOfferRequestApiResponse
|
|
126
|
+
*/
|
|
127
|
+
id: string
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export type HotelRoomOfferRequestCreate = Pick<
|
|
@@ -70,12 +70,6 @@ export interface HotelRoomOffersDataResponse {
|
|
|
70
70
|
* @interface HotelRoomOffer
|
|
71
71
|
*/
|
|
72
72
|
export interface HotelRoomOffer {
|
|
73
|
-
/**
|
|
74
|
-
* Hotel Room Offer id.
|
|
75
|
-
* @type {string}
|
|
76
|
-
* @memberof HotelRoomOffer
|
|
77
|
-
*/
|
|
78
|
-
id?: string
|
|
79
73
|
/**
|
|
80
74
|
* Quantity of breakfast per night included in the given **Hotel Room Offer**
|
|
81
75
|
* @type {number}
|
|
@@ -144,6 +138,12 @@ export interface HotelRoomOffer {
|
|
|
144
138
|
* @memberof HotelRoomOffer
|
|
145
139
|
*/
|
|
146
140
|
hotelRooms: HotelRoom[]
|
|
141
|
+
/**
|
|
142
|
+
* Hotel Room Offer id.
|
|
143
|
+
* @type {string}
|
|
144
|
+
* @memberof HotelRoomOffer
|
|
145
|
+
*/
|
|
146
|
+
id?: string
|
|
147
147
|
/**
|
|
148
148
|
* An **Hotel Room Offer** of type **PACKAGE** can be of **4 types**, described by **package_type** parameter:
|
|
149
149
|
*
|
|
@@ -157,7 +157,7 @@ export interface HotelRoomOffer {
|
|
|
157
157
|
* @type {string}
|
|
158
158
|
* @memberof HotelRoomOffer
|
|
159
159
|
*/
|
|
160
|
-
packageType?: HotelRoomOfferPackageType
|
|
160
|
+
packageType?: HotelRoomOfferPackageType
|
|
161
161
|
/**
|
|
162
162
|
* Price with taxes NOT INCLUDED of the given **Hotel Room Offer** including breakfast(s) when applicable, expressed in the requested **currency**.
|
|
163
163
|
* @type {number}
|
|
@@ -172,16 +172,18 @@ export interface HotelRoomOffer {
|
|
|
172
172
|
sourceMarket: SourceMarket
|
|
173
173
|
/**
|
|
174
174
|
*
|
|
175
|
-
* @type {
|
|
175
|
+
* @type {Array<Tag>}
|
|
176
176
|
* @memberof HotelRoomOffer
|
|
177
177
|
*/
|
|
178
|
-
|
|
178
|
+
tags?: Tag[]
|
|
179
179
|
/**
|
|
180
|
+
* Price of the given **Hotel Room Offer** including breakfast(s) when applicable, and including all taxes from returned **taxes** list parameter expressed in the requested **currency**.
|
|
180
181
|
*
|
|
181
|
-
*
|
|
182
|
+
* This data is not returned for a **Hotel Room Offer** of type **HOTEL_ROOM**, you'll need to compute and display the actual tax included price of the final **Hotel Room** package corresponding to the guest count and night count requested, or make a call to the **[Create Hotel Room Offer](/v1/documentation#operation/postV1Hotel_room_offers)** endpoint in order to get a valid and bookable **Hotel Room Offer** where **type = PACKAGE** based on a packaged list of **Hotel Room Offers** of type **HOTEL_ROOM**.
|
|
183
|
+
* @type {number}
|
|
182
184
|
* @memberof HotelRoomOffer
|
|
183
185
|
*/
|
|
184
|
-
|
|
186
|
+
taxIncludedPrice: number
|
|
185
187
|
/**
|
|
186
188
|
*
|
|
187
189
|
* @type {Array<Tax>}
|
|
@@ -190,13 +192,11 @@ export interface HotelRoomOffer {
|
|
|
190
192
|
taxes?: Tax[]
|
|
191
193
|
|
|
192
194
|
/**
|
|
193
|
-
* Price of the given **Hotel Room Offer** including breakfast(s) when applicable, and including all taxes from returned **taxes** list parameter expressed in the requested **currency**.
|
|
194
195
|
*
|
|
195
|
-
*
|
|
196
|
-
* @type {number}
|
|
196
|
+
* @type {StayTaxesInfo}
|
|
197
197
|
* @memberof HotelRoomOffer
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
stayTaxesInfo: StayTaxesInfo
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Hotel Room Offer type.
|
|
@@ -2,12 +2,6 @@ import type { Bed } from './bed.ts'
|
|
|
2
2
|
import type { HotelImage } from './hotel-image.ts'
|
|
3
3
|
|
|
4
4
|
export interface HotelRoom {
|
|
5
|
-
/**
|
|
6
|
-
* Hotel Room id, when applicable.
|
|
7
|
-
* @type {string}
|
|
8
|
-
* @memberof HotelRoom
|
|
9
|
-
*/
|
|
10
|
-
id: string
|
|
11
5
|
/**
|
|
12
6
|
* List of amenities in the room. May be subject to changes at the Hotel.
|
|
13
7
|
* @type {Array<string>}
|
|
@@ -58,6 +52,12 @@ export interface HotelRoom {
|
|
|
58
52
|
* @memberof HotelRoom
|
|
59
53
|
*/
|
|
60
54
|
highresImages?: boolean | null
|
|
55
|
+
/**
|
|
56
|
+
* Hotel Room id, when applicable.
|
|
57
|
+
* @type {string}
|
|
58
|
+
* @memberof HotelRoom
|
|
59
|
+
*/
|
|
60
|
+
id: string
|
|
61
61
|
/**
|
|
62
62
|
* List of indexes corresponding to image names for the given Hotel Room among the related hotel images.
|
|
63
63
|
* @type {Array<number>}
|
|
@@ -6,22 +6,16 @@ export interface HotelRoomingListGuest {
|
|
|
6
6
|
* @type {string}
|
|
7
7
|
* @memberof HotelRoomingListGuest
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
fullname: string
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @type {string}
|
|
13
13
|
* @memberof HotelRoomingListGuest
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
id: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface HotelRoomingList {
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @memberof HotelRoomingList
|
|
23
|
-
*/
|
|
24
|
-
id: string
|
|
25
19
|
/**
|
|
26
20
|
*
|
|
27
21
|
* @type {HotelRoom}
|
|
@@ -40,6 +34,12 @@ export interface HotelRoomingList {
|
|
|
40
34
|
* @memberof HotelRoomingList
|
|
41
35
|
*/
|
|
42
36
|
hotelRoomingListGuests: HotelRoomingListGuest[]
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof HotelRoomingList
|
|
41
|
+
*/
|
|
42
|
+
id: string
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
45
|
* @type {string}
|
|
@@ -6,12 +6,6 @@ import type { HotelReviewRating } from './hotel-review-rating.ts'
|
|
|
6
6
|
import type { TravelTimeItem } from './travel-times.ts'
|
|
7
7
|
|
|
8
8
|
export interface Hotel {
|
|
9
|
-
/**
|
|
10
|
-
* Hotel id.
|
|
11
|
-
* @type {string}
|
|
12
|
-
* @memberof HotelApi
|
|
13
|
-
*/
|
|
14
|
-
id: string
|
|
15
9
|
/**
|
|
16
10
|
* Hotel address.
|
|
17
11
|
* @type {string}
|
|
@@ -102,6 +96,12 @@ export interface Hotel {
|
|
|
102
96
|
* @memberof HotelApi
|
|
103
97
|
*/
|
|
104
98
|
hotelReviewRatings?: HotelReviewRating[] | null
|
|
99
|
+
/**
|
|
100
|
+
* Hotel id.
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @memberof HotelApi
|
|
103
|
+
*/
|
|
104
|
+
id: string
|
|
105
105
|
/**
|
|
106
106
|
*
|
|
107
107
|
* @type {HotelImages}
|
|
@@ -22,16 +22,16 @@ export interface MetaPollingResponse {
|
|
|
22
22
|
* @memberof MetaApiPollingResponse
|
|
23
23
|
*/
|
|
24
24
|
startingAfter?: string | null
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @type {PollerType}
|
|
28
|
-
* @memberof MetaApiPollingResponse
|
|
29
|
-
*/
|
|
30
|
-
status: PollerType
|
|
31
25
|
/**
|
|
32
26
|
*
|
|
33
27
|
* @type {number}
|
|
34
28
|
* @memberof HotelOffersApiResponseMeta
|
|
35
29
|
*/
|
|
36
30
|
totalCount?: number | null
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {PollerType}
|
|
34
|
+
* @memberof MetaApiPollingResponse
|
|
35
|
+
*/
|
|
36
|
+
status: PollerType
|
|
37
37
|
}
|
package/src/types/event.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { IHotelRoomStock } from './hotel-room-stock.ts'
|
|
2
2
|
|
|
3
3
|
export interface IHotelContract {
|
|
4
|
-
id: string
|
|
5
4
|
createdAt: string
|
|
6
5
|
forcedTotalComissionsAmount: number
|
|
7
6
|
forcedTotalPurchasedAmount: number
|
|
8
7
|
forcedTotalVatComissionsAmount: number
|
|
9
8
|
hotelId: string
|
|
10
9
|
hotelRoomStocks?: IHotelRoomStock[]
|
|
10
|
+
id: string
|
|
11
11
|
name: string
|
|
12
12
|
status: string
|
|
13
13
|
updatedAt: string
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BreakfastOption } from '../constants/hotel.ts'
|
|
2
2
|
|
|
3
3
|
export interface IHotelRoomStock {
|
|
4
|
-
id?: string
|
|
5
4
|
breakfastOption: BreakfastOption
|
|
6
5
|
breakfastRetrocommission?: number
|
|
7
6
|
breakfastUnitPrice?: number
|
|
@@ -10,6 +9,7 @@ export interface IHotelRoomStock {
|
|
|
10
9
|
eventScoped: boolean
|
|
11
10
|
hotelContractId?: string
|
|
12
11
|
hotelRoomId: string
|
|
12
|
+
id?: string
|
|
13
13
|
marginRate: number
|
|
14
14
|
minNightCount?: number
|
|
15
15
|
rate: number
|
package/src/types/pagination.ts
CHANGED
|
@@ -17,10 +17,10 @@ export interface IPaginationOptions {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface IPaginationPageInfo {
|
|
20
|
-
endCursor: string | null
|
|
21
20
|
hasNextPage: boolean
|
|
22
21
|
hasPreviousPage: boolean
|
|
23
22
|
startCursor: string | null
|
|
23
|
+
endCursor: string | null
|
|
24
24
|
totalCount: number
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -30,8 +30,8 @@ export interface IPaginationEdge<T> {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface IPaginationConnection<T> {
|
|
33
|
-
edges: IPaginationEdge<T>[]
|
|
34
33
|
pageInfo: IPaginationPageInfo
|
|
34
|
+
edges: IPaginationEdge<T>[]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export enum PaginationException {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface CompositeLeafAttributes {
|
|
2
2
|
excludedTokens?: string[]
|
|
3
|
-
parentKey?: string
|
|
4
3
|
removeSplitCharacters?: boolean
|
|
4
|
+
parentKey?: string
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export enum CompositeAttributesType {
|
|
@@ -17,6 +17,7 @@ type CompositeKeyOptions<T> =
|
|
|
17
17
|
? CompositeKeyOptions<U>
|
|
18
18
|
: CompositeLeafAttributes & {
|
|
19
19
|
attributes: CompositeOmitAttributes<T> | CompositeAttributesType
|
|
20
|
+
sort?: (keyof T)[]
|
|
20
21
|
children?: {
|
|
21
22
|
[K in keyof T]?: NonNullable<T[K]> extends object
|
|
22
23
|
? CompositeKeyOptions<NonNullable<T[K]>>
|
|
@@ -24,7 +25,6 @@ type CompositeKeyOptions<T> =
|
|
|
24
25
|
? CompositeKeyOptions<U>
|
|
25
26
|
: CompositeLeafAttributes
|
|
26
27
|
}
|
|
27
|
-
sort?: (keyof T)[]
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export function createCompositeKey<T>(
|
package/src/utils/debounce.ts
CHANGED
|
@@ -17,8 +17,8 @@ export interface DebouncedFunction<
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
interface DebouncedPromise<FunctionReturn> {
|
|
20
|
-
reject: (reason?: any) => void
|
|
21
20
|
resolve: (result: FunctionReturn) => void
|
|
21
|
+
reject: (reason?: any) => void
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function debounce<Args extends any[], F extends (...args: Args) => any>(
|
|
@@ -6,8 +6,8 @@ export function getSanitizedRoomCount({
|
|
|
6
6
|
roomCount,
|
|
7
7
|
}: {
|
|
8
8
|
adultCount: number
|
|
9
|
-
maxAdultsPerRoom?: number
|
|
10
9
|
roomCount: number
|
|
10
|
+
maxAdultsPerRoom?: number
|
|
11
11
|
}): number {
|
|
12
12
|
// Ensure at least enough rooms for each adult and at most MAX_ADULTS_PER_ROOM per room
|
|
13
13
|
if (!Number.isFinite(roomCount) || roomCount < 1) {
|
package/src/utils/poller.ts
CHANGED
|
@@ -45,14 +45,13 @@ export class Poller<V extends IPollerResponse> {
|
|
|
45
45
|
minCallCount: 1,
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
private pollings: Record<string, string> = {}
|
|
48
49
|
private events: TPollerEvents<V> = {
|
|
49
50
|
complete: () => undefined,
|
|
50
51
|
data: () => undefined,
|
|
51
52
|
error: () => undefined,
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
private pollings: Record<string, string> = {}
|
|
55
|
-
|
|
56
55
|
static getInstance<R extends IPollerResponse>(): Poller<R> {
|
|
57
56
|
if (!Poller.instance) {
|
|
58
57
|
Poller.instance = new Poller<R>() as Poller<IPollerResponse>
|
|
@@ -61,13 +60,6 @@ export class Poller<V extends IPollerResponse> {
|
|
|
61
60
|
return Poller.instance as Poller<R>
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
on(
|
|
65
|
-
eventName: TPollerEventName,
|
|
66
|
-
eventCallback: TPollerEventCallback<V>,
|
|
67
|
-
): void {
|
|
68
|
-
this.events[eventName] = eventCallback
|
|
69
|
-
}
|
|
70
|
-
|
|
71
63
|
poll(request: TRequest<V>, options: TOptions<V>): Poller<V> {
|
|
72
64
|
const buildedOptions = this.buildPollerOptions(options)
|
|
73
65
|
this.storeCurrentPolling(buildedOptions)
|
|
@@ -83,6 +75,13 @@ export class Poller<V extends IPollerResponse> {
|
|
|
83
75
|
return this
|
|
84
76
|
}
|
|
85
77
|
|
|
78
|
+
on(
|
|
79
|
+
eventName: TPollerEventName,
|
|
80
|
+
eventCallback: TPollerEventCallback<V>,
|
|
81
|
+
): void {
|
|
82
|
+
this.events[eventName] = eventCallback
|
|
83
|
+
}
|
|
84
|
+
|
|
86
85
|
public stop(type: string): void {
|
|
87
86
|
if (type && this.pollings[type]) {
|
|
88
87
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
@@ -90,25 +89,6 @@ export class Poller<V extends IPollerResponse> {
|
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
private buildPollerOptions(options: TOptions<V>): TOptions<V> {
|
|
94
|
-
const compactedOptions = Object.entries(options).reduce<
|
|
95
|
-
Record<string, unknown>
|
|
96
|
-
>((acc, [key, value]) => {
|
|
97
|
-
if (value !== undefined) {
|
|
98
|
-
const tKey = key as keyof TOptions<V>
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
-
acc[tKey] = value as any
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return acc
|
|
104
|
-
}, {}) as TOptions<V>
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
...this.defaultOptions,
|
|
108
|
-
...compactedOptions,
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
92
|
private dispatch(
|
|
113
93
|
eventName: TPollerEventName,
|
|
114
94
|
payload?: TPollerEventCallbackArg<V>,
|
|
@@ -116,27 +96,6 @@ export class Poller<V extends IPollerResponse> {
|
|
|
116
96
|
this.events[eventName](payload)
|
|
117
97
|
}
|
|
118
98
|
|
|
119
|
-
private isActivePoller(options: TOptions<V>): boolean {
|
|
120
|
-
if (options.type) {
|
|
121
|
-
return (
|
|
122
|
-
!!this.pollings[options.type] &&
|
|
123
|
-
this.pollings[options.type] === options.uuid
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return true
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private isInProgress(result: V): boolean {
|
|
131
|
-
return (result?.meta?.status ?? '') !== 'COMPLETE'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private onComplete(result: V, options: TOptions<V>) {
|
|
135
|
-
this.dispatch('data', result)
|
|
136
|
-
this.dispatch('complete', result)
|
|
137
|
-
this.removeCurrentPolling(options)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
99
|
private async onRequest(
|
|
141
100
|
result: V,
|
|
142
101
|
request: TRequest<V>,
|
|
@@ -189,6 +148,53 @@ export class Poller<V extends IPollerResponse> {
|
|
|
189
148
|
}
|
|
190
149
|
}
|
|
191
150
|
|
|
151
|
+
private onComplete(result: V, options: TOptions<V>) {
|
|
152
|
+
this.dispatch('data', result)
|
|
153
|
+
this.dispatch('complete', result)
|
|
154
|
+
this.removeCurrentPolling(options)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private isInProgress(result: V): boolean {
|
|
158
|
+
return (result?.meta?.status ?? '') !== 'COMPLETE'
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private buildPollerOptions(options: TOptions<V>): TOptions<V> {
|
|
162
|
+
const compactedOptions = Object.entries(options).reduce<
|
|
163
|
+
Record<string, unknown>
|
|
164
|
+
>((acc, [key, value]) => {
|
|
165
|
+
if (value !== undefined) {
|
|
166
|
+
const tKey = key as keyof TOptions<V>
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
168
|
+
acc[tKey] = value as any
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return acc
|
|
172
|
+
}, {}) as TOptions<V>
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
...this.defaultOptions,
|
|
176
|
+
...compactedOptions,
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private storeCurrentPolling(options: TOptions<V>): void {
|
|
181
|
+
if (options.type && !options.uuid) {
|
|
182
|
+
options.uuid = uuidv4()
|
|
183
|
+
this.pollings[options.type] = options.uuid
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private isActivePoller(options: TOptions<V>): boolean {
|
|
188
|
+
if (options.type) {
|
|
189
|
+
return (
|
|
190
|
+
!!this.pollings[options.type] &&
|
|
191
|
+
this.pollings[options.type] === options.uuid
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return true
|
|
196
|
+
}
|
|
197
|
+
|
|
192
198
|
private pause(options: TOptions<V>): Promise<void> {
|
|
193
199
|
return new Promise(resolve => {
|
|
194
200
|
setTimeout(resolve, options.interval)
|
|
@@ -201,13 +207,6 @@ export class Poller<V extends IPollerResponse> {
|
|
|
201
207
|
delete this.pollings[options.type]
|
|
202
208
|
}
|
|
203
209
|
}
|
|
204
|
-
|
|
205
|
-
private storeCurrentPolling(options: TOptions<V>): void {
|
|
206
|
-
if (options.type && !options.uuid) {
|
|
207
|
-
options.uuid = uuidv4()
|
|
208
|
-
this.pollings[options.type] = options.uuid
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
210
|
}
|
|
212
211
|
|
|
213
212
|
export type PollerReturn<R extends IPollerResponse = IPollerResponse> =
|