@revolugo/common 6.14.6 → 6.15.0-beta.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/package.json +14 -9
- package/src/amenities/index.ts +51 -0
- package/src/assets/index.ts +3 -0
- package/src/assets/placeholder-hotel.png +0 -0
- package/src/assets/placeholder-room.png +0 -0
- package/src/constants/hotel-room-offer.ts +11 -0
- package/src/constants/index.ts +2 -1
- package/src/constants/locales.ts +5 -5
- package/src/constants/tax.ts +9 -0
- package/src/icons/index.ts +2 -1
- package/src/schemas/cancellation-policies.ts +18 -0
- package/src/schemas/currency.ts +7 -0
- package/src/schemas/hotel-offer-request.ts +43 -0
- package/src/schemas/hotel-offer.ts +58 -0
- package/src/schemas/hotel-room-offer.ts +99 -0
- package/src/schemas/hotel-room.ts +106 -0
- package/src/schemas/hotel.ts +360 -0
- package/src/schemas/index.ts +10 -0
- package/src/schemas/list-polling-meta.ts +43 -0
- package/src/schemas/tag.ts +13 -0
- package/src/schemas/taxes.ts +34 -0
- package/src/types/elements/booking-flow.ts +6 -0
- package/src/types/elements/contact-person.ts +11 -0
- package/src/types/elements/elements-events.ts +84 -0
- package/src/types/elements/hotel-offer-request.ts +14 -15
- package/src/types/elements/hotel-offers-filters.ts +19 -0
- package/src/types/elements/hotel.ts +2 -0
- package/src/types/elements/index.ts +3 -0
- package/src/types/http-exception/base.exception.ts +1 -1
- package/src/types/severities.ts +1 -0
- package/src/utils/case-transformers.ts +5 -5
- package/src/utils/get-sanitized-room-count.ts +29 -0
- package/src/utils/images.ts +3 -3
- package/src/utils/index.ts +4 -0
- package/src/utils/is-object.ts +2 -0
- package/src/utils/keys-case-transformer.ts +118 -0
- package/src/utils/transform-schema-keys.ts +143 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { CountryIso2Code } from '../constants/index.ts'
|
|
5
|
+
|
|
6
|
+
import { CURRENCY_SCHEMA } from './currency.ts'
|
|
7
|
+
|
|
8
|
+
export const AMENITIES_SCHEMA = z.object({
|
|
9
|
+
air_conditioning: z
|
|
10
|
+
.boolean()
|
|
11
|
+
.optional()
|
|
12
|
+
.openapi({ description: 'Air conditioning.' }),
|
|
13
|
+
airport_transportation: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.openapi({ description: 'Airport transportation service.' }),
|
|
17
|
+
business_center: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.optional()
|
|
20
|
+
.openapi({ description: 'Business center.' }),
|
|
21
|
+
car_rent_desk: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.optional()
|
|
24
|
+
.openapi({ description: 'Car rental desk service.' }),
|
|
25
|
+
children_allowed: z
|
|
26
|
+
.boolean()
|
|
27
|
+
.optional()
|
|
28
|
+
.openapi({ description: 'Children welcomed.' }),
|
|
29
|
+
clothing_iron: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.openapi({ description: 'Clothing iron.' }),
|
|
33
|
+
coffee_tea_maker: z
|
|
34
|
+
.boolean()
|
|
35
|
+
.optional()
|
|
36
|
+
.openapi({ description: 'Coffea/tea maker.' }),
|
|
37
|
+
combination: z.boolean().optional().openapi({ description: 'Combination.' }),
|
|
38
|
+
continental_breakfast: z
|
|
39
|
+
.boolean()
|
|
40
|
+
.optional()
|
|
41
|
+
.openapi({ description: 'Continental Breakfast.' }),
|
|
42
|
+
data_ports: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.optional()
|
|
45
|
+
.openapi({ description: 'Data ports in room.' }),
|
|
46
|
+
dry_cleaning: z
|
|
47
|
+
.boolean()
|
|
48
|
+
.optional()
|
|
49
|
+
.openapi({ description: 'Dry cleaning.' }),
|
|
50
|
+
electronic_room_keys: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.openapi({ description: 'Electornic room keys.' }),
|
|
54
|
+
exterior_room_entrance: z
|
|
55
|
+
.boolean()
|
|
56
|
+
.optional()
|
|
57
|
+
.openapi({ description: 'Exterior room entrance.' }),
|
|
58
|
+
family_rooms: z
|
|
59
|
+
.boolean()
|
|
60
|
+
.optional()
|
|
61
|
+
.openapi({ description: 'Family rooms.' }),
|
|
62
|
+
fitness_facility: z
|
|
63
|
+
.boolean()
|
|
64
|
+
.optional()
|
|
65
|
+
.openapi({ description: 'Fitness facility.' }),
|
|
66
|
+
game_room: z.boolean().optional().openapi({ description: 'Game room.' }),
|
|
67
|
+
golf_course: z.boolean().optional().openapi({ description: 'Golf course.' }),
|
|
68
|
+
hair_dryer: z.boolean().optional().openapi({ description: 'Hair dryer.' }),
|
|
69
|
+
handicap_accessible: z
|
|
70
|
+
.boolean()
|
|
71
|
+
.optional()
|
|
72
|
+
.openapi({ description: 'Handicap Accessible.' }),
|
|
73
|
+
in_house_bar: z
|
|
74
|
+
.boolean()
|
|
75
|
+
.optional()
|
|
76
|
+
.openapi({ description: 'In house bar.' }),
|
|
77
|
+
in_house_dining: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.openapi({ description: 'In house dining.' }),
|
|
81
|
+
in_room_movies: z
|
|
82
|
+
.boolean()
|
|
83
|
+
.optional()
|
|
84
|
+
.openapi({ description: 'In room movies.' }),
|
|
85
|
+
indoor_pool: z.boolean().optional().openapi({ description: 'Indoor pool.' }),
|
|
86
|
+
interior_room_entrance: z
|
|
87
|
+
.boolean()
|
|
88
|
+
.optional()
|
|
89
|
+
.openapi({ description: 'Interior room entrance.' }),
|
|
90
|
+
kitchen: z.boolean().optional().openapi({ description: 'Kitchen.' }),
|
|
91
|
+
map: z.boolean().optional().openapi({ description: 'Map.' }),
|
|
92
|
+
meeting_rooms: z
|
|
93
|
+
.boolean()
|
|
94
|
+
.optional()
|
|
95
|
+
.openapi({ description: 'Meeting rooms.' }),
|
|
96
|
+
mini_bar_in_room: z
|
|
97
|
+
.boolean()
|
|
98
|
+
.optional()
|
|
99
|
+
.openapi({ description: 'mini bar in room.' }),
|
|
100
|
+
non_smoking_rooms: z
|
|
101
|
+
.boolean()
|
|
102
|
+
.optional()
|
|
103
|
+
.openapi({ description: 'Non smoking rooms.' }),
|
|
104
|
+
outdoor_pool: z
|
|
105
|
+
.boolean()
|
|
106
|
+
.optional()
|
|
107
|
+
.openapi({ description: 'Outdoor pool.' }),
|
|
108
|
+
parking_garage: z
|
|
109
|
+
.boolean()
|
|
110
|
+
.optional()
|
|
111
|
+
.openapi({ description: 'Parking garage.' }),
|
|
112
|
+
pets_allowed: z
|
|
113
|
+
.boolean()
|
|
114
|
+
.optional()
|
|
115
|
+
.openapi({ description: 'Pets allowed.' }),
|
|
116
|
+
restricted_access: z
|
|
117
|
+
.boolean()
|
|
118
|
+
.optional()
|
|
119
|
+
.openapi({ description: 'Restricted access.' }),
|
|
120
|
+
room_service: z
|
|
121
|
+
.boolean()
|
|
122
|
+
.optional()
|
|
123
|
+
.openapi({ description: 'Room service.' }),
|
|
124
|
+
safe: z.boolean().optional().openapi({ description: 'Safe in room.' }),
|
|
125
|
+
sauna: z.boolean().optional().openapi({ description: 'Sauna.' }),
|
|
126
|
+
t_v_in_room: z.boolean().optional().openapi({ description: 'TV in room.' }),
|
|
127
|
+
tennis_court: z
|
|
128
|
+
.boolean()
|
|
129
|
+
.optional()
|
|
130
|
+
.openapi({ description: 'Tennis court.' }),
|
|
131
|
+
twenty_four_hour_security: z
|
|
132
|
+
.boolean()
|
|
133
|
+
.optional()
|
|
134
|
+
.openapi({ description: ' 24/7 security.' }),
|
|
135
|
+
valet_parking: z
|
|
136
|
+
.boolean()
|
|
137
|
+
.optional()
|
|
138
|
+
.openapi({ description: 'Valet parking.' }),
|
|
139
|
+
video_check_out: z
|
|
140
|
+
.boolean()
|
|
141
|
+
.optional()
|
|
142
|
+
.openapi({ description: 'Video check out.' }),
|
|
143
|
+
voice_mail: z.boolean().optional().openapi({ description: 'Voice mail.' }),
|
|
144
|
+
wake_up_service: z
|
|
145
|
+
.boolean()
|
|
146
|
+
.optional()
|
|
147
|
+
.openapi({ description: 'Wake up service.' }),
|
|
148
|
+
whirpool: z.boolean().optional().openapi({ description: 'Whirpool.' }),
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
export const HOTEL_IMAGE = z.object({
|
|
152
|
+
caption: z.string().nullish(),
|
|
153
|
+
is_hero_image: z.boolean(),
|
|
154
|
+
l: z.string(),
|
|
155
|
+
m: z.string(),
|
|
156
|
+
s: z.string(),
|
|
157
|
+
xl: z.string(),
|
|
158
|
+
xs: z.string(),
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const HOTEL_IMAGES = z.array(HOTEL_IMAGE).openapi({
|
|
162
|
+
description:
|
|
163
|
+
'List of hotel images in various sizes featuring an indicator for the primary (hero) image',
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
export const HOTEL_REVIEW_RATING_SCHEMA = z
|
|
167
|
+
.object({
|
|
168
|
+
category: z
|
|
169
|
+
.string()
|
|
170
|
+
.openapi({
|
|
171
|
+
description: 'Category of the collected reviews for the Hotel.',
|
|
172
|
+
})
|
|
173
|
+
.nullish()
|
|
174
|
+
.optional(),
|
|
175
|
+
rating: z.number().openapi({
|
|
176
|
+
description: 'Rating of the collected review for the Hotel.',
|
|
177
|
+
}),
|
|
178
|
+
})
|
|
179
|
+
.openapi({
|
|
180
|
+
description: 'Review rating with category collected for the Hotel.',
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
export const HOTEL_REVIEW_RATINGS_SCHEMA = z
|
|
184
|
+
.array(HOTEL_REVIEW_RATING_SCHEMA)
|
|
185
|
+
.openapi({
|
|
186
|
+
description:
|
|
187
|
+
'List of meta reviews (category and rating) that are summary of verified reviews collected across the web on the Hotel to help choose the best option.',
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
export const IMAGES_SCHEMA = z
|
|
191
|
+
.object({
|
|
192
|
+
count: z
|
|
193
|
+
.number()
|
|
194
|
+
.openapi({ description: 'Number of images.' })
|
|
195
|
+
.optional()
|
|
196
|
+
.nullish(),
|
|
197
|
+
highres: z
|
|
198
|
+
.boolean()
|
|
199
|
+
.openapi({ description: 'Whether images exist in highres format.' })
|
|
200
|
+
.optional()
|
|
201
|
+
.nullish(),
|
|
202
|
+
|
|
203
|
+
lowres: z
|
|
204
|
+
.boolean()
|
|
205
|
+
.openapi({ description: 'Whether images exist in lowres format.' })
|
|
206
|
+
.optional()
|
|
207
|
+
.nullish(),
|
|
208
|
+
prefix: z
|
|
209
|
+
.string()
|
|
210
|
+
.openapi({ description: 'Base URL for the images.' })
|
|
211
|
+
.optional()
|
|
212
|
+
.nullish(),
|
|
213
|
+
suffix: z
|
|
214
|
+
.string()
|
|
215
|
+
.openapi({
|
|
216
|
+
description:
|
|
217
|
+
'This parameter usually represents the extension of the image (e.g.: .jpg, .png)',
|
|
218
|
+
})
|
|
219
|
+
.optional()
|
|
220
|
+
.nullish(),
|
|
221
|
+
thumb: z
|
|
222
|
+
.boolean()
|
|
223
|
+
.openapi({
|
|
224
|
+
description:
|
|
225
|
+
'Whether images exist in thumb format (for thumbnails preview).',
|
|
226
|
+
})
|
|
227
|
+
.optional()
|
|
228
|
+
.nullish(),
|
|
229
|
+
})
|
|
230
|
+
.openapi({
|
|
231
|
+
description:
|
|
232
|
+
'🛑 DEPRECATED - Hotel images details.\n\nIn order to retrieve a specific image you need to construct the complete URL from the images parameters: **[images.prefix][highres|lowres|thumb]/[index]/[images.suffix]**. If **images.count = n**, then index is in [0...n-1] range.\n\ne.g.: https://s3.eu-west-3.amazonaws.com/revolugo/hotels/yhKY/images/highres/0.jpg',
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
export const VENUES_SCHEMA = z
|
|
236
|
+
.array(
|
|
237
|
+
z.object({
|
|
238
|
+
description: z.string().optional().nullish(),
|
|
239
|
+
name: z.string(),
|
|
240
|
+
travel_times: z
|
|
241
|
+
.object({
|
|
242
|
+
driving: z.number().optional(),
|
|
243
|
+
transit: z.number().optional(),
|
|
244
|
+
walking: z.number().optional(),
|
|
245
|
+
})
|
|
246
|
+
.optional()
|
|
247
|
+
.nullish(),
|
|
248
|
+
}),
|
|
249
|
+
)
|
|
250
|
+
.optional()
|
|
251
|
+
export const HOTEL_SCHEMA = z
|
|
252
|
+
.object({
|
|
253
|
+
address: z
|
|
254
|
+
.string()
|
|
255
|
+
.openapi({ description: 'Hotel address.' })
|
|
256
|
+
.optional()
|
|
257
|
+
.nullish(),
|
|
258
|
+
address2: z
|
|
259
|
+
.string()
|
|
260
|
+
.openapi({ description: 'Second part of hotel address.' })
|
|
261
|
+
.optional()
|
|
262
|
+
.nullish(),
|
|
263
|
+
amenities: AMENITIES_SCHEMA.nullish(),
|
|
264
|
+
check_in_time: z
|
|
265
|
+
.string()
|
|
266
|
+
.openapi({ description: 'Check in time of the hotel.' })
|
|
267
|
+
.optional()
|
|
268
|
+
.nullish(),
|
|
269
|
+
check_out_time: z
|
|
270
|
+
.string()
|
|
271
|
+
.openapi({ description: 'Check out time of the hotel.' })
|
|
272
|
+
.optional()
|
|
273
|
+
.nullish(),
|
|
274
|
+
city: z.string().openapi({ description: 'City' }).optional().nullish(),
|
|
275
|
+
country: z
|
|
276
|
+
.string()
|
|
277
|
+
.openapi({ description: 'Country' })
|
|
278
|
+
.optional()
|
|
279
|
+
.nullish(),
|
|
280
|
+
country_code: z
|
|
281
|
+
.string()
|
|
282
|
+
.refine(check =>
|
|
283
|
+
Object.values(CountryIso2Code).includes(check as CountryIso2Code),
|
|
284
|
+
)
|
|
285
|
+
.openapi({ description: 'Hotel country code in ISO2.' })
|
|
286
|
+
.optional()
|
|
287
|
+
.nullish(),
|
|
288
|
+
currency: CURRENCY_SCHEMA.openapi({ description: 'Hotel currency.' })
|
|
289
|
+
.optional()
|
|
290
|
+
.nullish(),
|
|
291
|
+
description: z
|
|
292
|
+
.string()
|
|
293
|
+
.openapi({ description: 'Hotel description.' })
|
|
294
|
+
.optional()
|
|
295
|
+
.nullish(),
|
|
296
|
+
distance: z
|
|
297
|
+
.number()
|
|
298
|
+
.optional()
|
|
299
|
+
.openapi({
|
|
300
|
+
description: 'Distance from a requested location, expressed in meters',
|
|
301
|
+
})
|
|
302
|
+
.optional()
|
|
303
|
+
.nullish(),
|
|
304
|
+
email: z
|
|
305
|
+
.string()
|
|
306
|
+
.openapi({ description: 'Hotel email.' })
|
|
307
|
+
.optional()
|
|
308
|
+
.nullish(),
|
|
309
|
+
fax: z
|
|
310
|
+
.string()
|
|
311
|
+
.openapi({ description: 'Hotel fax number.' })
|
|
312
|
+
.optional()
|
|
313
|
+
.nullish(),
|
|
314
|
+
hotel_images: HOTEL_IMAGES.nullish(),
|
|
315
|
+
hotel_review_ratings: HOTEL_REVIEW_RATINGS_SCHEMA.optional().nullish(),
|
|
316
|
+
id: z.string().openapi({ description: 'Hotel id.' }),
|
|
317
|
+
images: IMAGES_SCHEMA.nullish(),
|
|
318
|
+
latitude: z.number().openapi({ description: 'Hotel latitude.' }),
|
|
319
|
+
longitude: z.number().openapi({ description: 'Hotel longitude.' }),
|
|
320
|
+
name: z.string().openapi({ description: 'Hotel name.' }),
|
|
321
|
+
phone: z
|
|
322
|
+
.string()
|
|
323
|
+
.openapi({ description: 'Hotel phone number.' })
|
|
324
|
+
.optional()
|
|
325
|
+
.nullish(),
|
|
326
|
+
policy: z
|
|
327
|
+
.string()
|
|
328
|
+
.openapi({ description: 'Internal policy of the hotel.' })
|
|
329
|
+
.optional()
|
|
330
|
+
.nullish(),
|
|
331
|
+
postal_code: z
|
|
332
|
+
.string()
|
|
333
|
+
.openapi({ description: 'Hotel address postal code.' })
|
|
334
|
+
.optional()
|
|
335
|
+
.nullish(),
|
|
336
|
+
rating: z
|
|
337
|
+
.number()
|
|
338
|
+
.optional()
|
|
339
|
+
.nullish()
|
|
340
|
+
.openapi({ description: 'Hotel Star rating.' }),
|
|
341
|
+
state: z
|
|
342
|
+
.string()
|
|
343
|
+
.openapi({ description: 'Hotel address state.' })
|
|
344
|
+
.optional()
|
|
345
|
+
.nullish(),
|
|
346
|
+
ta_id: z
|
|
347
|
+
.string()
|
|
348
|
+
.optional()
|
|
349
|
+
.openapi({ description: 'TripAdvisor property id. When applicable.' })
|
|
350
|
+
.optional()
|
|
351
|
+
.nullish(),
|
|
352
|
+
timezone: z.string().openapi({ description: 'Hotel timezone.' }),
|
|
353
|
+
venues: VENUES_SCHEMA,
|
|
354
|
+
website: z
|
|
355
|
+
.string()
|
|
356
|
+
.openapi({ description: 'Hotel website url.' })
|
|
357
|
+
.optional()
|
|
358
|
+
.nullish(),
|
|
359
|
+
})
|
|
360
|
+
.openapi('hotelApi')
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './cancellation-policies.ts'
|
|
2
|
+
export * from './currency.ts'
|
|
3
|
+
export * from './hotel-offer-request.ts'
|
|
4
|
+
export * from './hotel-offer.ts'
|
|
5
|
+
export * from './hotel-room-offer.ts'
|
|
6
|
+
export * from './hotel-room.ts'
|
|
7
|
+
export * from './hotel.ts'
|
|
8
|
+
export * from './list-polling-meta.ts'
|
|
9
|
+
export * from './tag.ts'
|
|
10
|
+
export * from './taxes.ts'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { PollerStatus } from '@revolugo/common/constants'
|
|
5
|
+
|
|
6
|
+
export const ENDING_BEFORE_SCHEMA = z.string().optional().nullable().openapi({
|
|
7
|
+
description:
|
|
8
|
+
'A cursor to use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const STARTING_AFTER_SCHEMA = z.string().optional().nullable().openapi({
|
|
12
|
+
description:
|
|
13
|
+
'A cursor to use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.',
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const STATUS_SCHEMA = z
|
|
17
|
+
.nativeEnum(PollerStatus)
|
|
18
|
+
.openapi({ description: 'Status of the response data.' })
|
|
19
|
+
.openapi('pollerStatus')
|
|
20
|
+
|
|
21
|
+
export const LIMIT_SCHEMA = z
|
|
22
|
+
.number()
|
|
23
|
+
.optional()
|
|
24
|
+
.openapi({ description: 'A limit on the number of object to be returned.' })
|
|
25
|
+
.openapi('limit')
|
|
26
|
+
|
|
27
|
+
export const LIST_META_SCHEMA = z
|
|
28
|
+
.object({
|
|
29
|
+
ending_before: ENDING_BEFORE_SCHEMA,
|
|
30
|
+
limit: LIMIT_SCHEMA,
|
|
31
|
+
starting_after: STARTING_AFTER_SCHEMA,
|
|
32
|
+
total_count: z.number().nullish(),
|
|
33
|
+
})
|
|
34
|
+
.openapi('metaApiResponse')
|
|
35
|
+
.openapi({
|
|
36
|
+
description:
|
|
37
|
+
'Meta information about the response list, such as pagination cursors or status.',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const LIST_POLLING_META_SCHEMA = LIST_META_SCHEMA.extend({
|
|
41
|
+
status: STATUS_SCHEMA,
|
|
42
|
+
}).openapi('metaApiPollingResponse')
|
|
43
|
+
/* eslint-enable camelcase */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
export const TAG_SCHEMA = z.object({
|
|
5
|
+
bg: z.string().optional().nullish(),
|
|
6
|
+
color: z.string().optional().nullish(),
|
|
7
|
+
description: z.string().optional().nullish(),
|
|
8
|
+
fa_icon: z.string().optional().nullish(),
|
|
9
|
+
name: z.string(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const TAGS_SCHEMA = z.array(TAG_SCHEMA).optional().default([])
|
|
13
|
+
/* eslint-enable camelcase */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { TaxFrequency, TaxMode } from '../constants/index.ts'
|
|
5
|
+
|
|
6
|
+
export const TAX_SCHEMA = z
|
|
7
|
+
.object({
|
|
8
|
+
amount: z.number().optional().nullish().openapi({
|
|
9
|
+
description: 'Tax amount expressed in the requested currency.',
|
|
10
|
+
}),
|
|
11
|
+
code: z.string().optional().openapi({ description: 'Tax code.' }),
|
|
12
|
+
description: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.nullish()
|
|
16
|
+
.openapi({ description: 'Tax description.' }),
|
|
17
|
+
percentage: z
|
|
18
|
+
.number()
|
|
19
|
+
.optional()
|
|
20
|
+
.nullish()
|
|
21
|
+
.openapi({ description: 'Tax percentage on the total amount.' }),
|
|
22
|
+
tax_frequency: z.nativeEnum(TaxFrequency).openapi({
|
|
23
|
+
description:
|
|
24
|
+
'Tax frequency. Specifies if the tax applies per stay or per night',
|
|
25
|
+
}),
|
|
26
|
+
tax_mode: z.nativeEnum(TaxMode).openapi({
|
|
27
|
+
description:
|
|
28
|
+
'Tax mode. Specifies if the tax applies per occupant, per booking or per room',
|
|
29
|
+
}),
|
|
30
|
+
})
|
|
31
|
+
.openapi('taxApi')
|
|
32
|
+
|
|
33
|
+
export const TAXES_SCHEMA = z.array(TAX_SCHEMA).optional()
|
|
34
|
+
/* eslint-enable camelcase */
|
|
@@ -157,3 +157,14 @@ export interface ContactPersonOrganization {
|
|
|
157
157
|
*/
|
|
158
158
|
zipCode: string
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
export interface PrebookFormValues {
|
|
162
|
+
emailAddress: ContactPerson['email']
|
|
163
|
+
firstName: ContactPerson['firstName']
|
|
164
|
+
lastName: ContactPerson['lastName']
|
|
165
|
+
nationality: ContactPerson['nationality']
|
|
166
|
+
phoneCountry: CountryIso2Code
|
|
167
|
+
phoneNumber: string
|
|
168
|
+
salutation: ContactPerson['salutation']
|
|
169
|
+
specialRequests: ContactPerson['remarks']
|
|
170
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { BookingState } from './booking-flow.ts'
|
|
2
|
+
import type { BookingPolicies } from './booking-policy.ts'
|
|
3
|
+
import type { Booking } from './booking.ts'
|
|
4
|
+
import type { CancellationPolicy } from './cancellation-policy.ts'
|
|
5
|
+
import type { PrebookFormValues } from './contact-person.ts'
|
|
6
|
+
import type { CurrencyType } from './currency.ts'
|
|
7
|
+
import type { HotelOfferRequestResponse } from './hotel-offer-request.ts'
|
|
8
|
+
import type { HotelOffer } from './hotel-offer.ts'
|
|
9
|
+
import type { HotelOffersFilters } from './hotel-offers-filters.ts'
|
|
10
|
+
import type { HotelRoomOfferRequestResponse } from './hotel-room-offer-request.ts'
|
|
11
|
+
import type {
|
|
12
|
+
HotelRoomOffer,
|
|
13
|
+
HotelRoomOffersResponse,
|
|
14
|
+
} from './hotel-room-offer.ts'
|
|
15
|
+
import type { Hotel } from './hotel.ts'
|
|
16
|
+
import type { Locale } from 'change-case'
|
|
17
|
+
|
|
18
|
+
export enum ElementsEvent {
|
|
19
|
+
BookingCreated = 'booking:created',
|
|
20
|
+
BookingFlowStepUpdated = 'booking-flow-step:updated',
|
|
21
|
+
BookingManagerNewBooking = 'booking-manager:new-booking',
|
|
22
|
+
BookingManagerRetrieve = 'booking-manager:retrieve',
|
|
23
|
+
BookingManagerRetrieveFail = 'booking-manager:retrieve-fail',
|
|
24
|
+
BookingPolicyCreated = 'booking-policy:created',
|
|
25
|
+
CancellationPoliciesUpdated = 'cancellation-policies:updated',
|
|
26
|
+
CurrencyUpdated = 'currency:updated',
|
|
27
|
+
HotelOfferItemMouseleave = 'hotel-offer:item:mouseleave',
|
|
28
|
+
HotelOfferItemMouseover = 'hotel-offer:item:mouseover',
|
|
29
|
+
HotelOfferItemVisible = 'hotel-offer:item:visible',
|
|
30
|
+
HotelOfferRequestCreated = 'hotel-offer-request:created',
|
|
31
|
+
HotelOfferRequestRetrieved = 'hotel-offer-request:retrieved',
|
|
32
|
+
HotelOffersFiltersUpdated = 'hotel-offers:filters:updated',
|
|
33
|
+
HotelOffersItemClick = 'hotel-offer:item:click',
|
|
34
|
+
HotelOffersMarkerClick = 'hotel-offers:marker:click',
|
|
35
|
+
HotelOffersPollingStarted = 'hotel-offers:polling:started',
|
|
36
|
+
HotelOffersRetrieved = 'hotel-offers:retrieved',
|
|
37
|
+
HotelOffersViewShowMap = 'hotel-offers-view:show-map',
|
|
38
|
+
HotelRetrieved = 'hotel:retrieved',
|
|
39
|
+
HotelRoomOfferRequestCreated = 'hotel-room-offer-request:created',
|
|
40
|
+
HotelRoomOfferRequestRetrieved = 'hotel-room-offer-request:retrieved',
|
|
41
|
+
HotelRoomOffersBtnClick = 'hotel-room-offers:click:btn',
|
|
42
|
+
HotelRoomOffersPriceIncreased = 'hotel-room-offers:price-increased',
|
|
43
|
+
HotelRoomOffersRetrieved = 'hotel-room-offers:retrieved',
|
|
44
|
+
LangUpdated = 'lang:updated',
|
|
45
|
+
PaymentSuccess = 'payment:success',
|
|
46
|
+
PrebookForm = 'prebook:form',
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ElementsEventCallbacks {
|
|
50
|
+
[ElementsEvent.BookingCreated]: Booking
|
|
51
|
+
[ElementsEvent.BookingFlowStepUpdated]: BookingState
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
[ElementsEvent.BookingManagerNewBooking]: any
|
|
54
|
+
[ElementsEvent.BookingManagerRetrieve]: Booking
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
[ElementsEvent.BookingManagerRetrieveFail]: any
|
|
57
|
+
[ElementsEvent.BookingPolicyCreated]: BookingPolicies
|
|
58
|
+
[ElementsEvent.CancellationPoliciesUpdated]: CancellationPolicy[]
|
|
59
|
+
[ElementsEvent.CurrencyUpdated]: CurrencyType
|
|
60
|
+
[ElementsEvent.HotelOfferItemMouseleave]: [HotelOffer, number]
|
|
61
|
+
[ElementsEvent.HotelOfferItemMouseover]: [HotelOffer, number]
|
|
62
|
+
[ElementsEvent.HotelOfferItemVisible]: [HotelOffer, number]
|
|
63
|
+
[ElementsEvent.HotelOfferRequestCreated]: HotelOfferRequestResponse
|
|
64
|
+
[ElementsEvent.HotelOfferRequestRetrieved]: HotelOfferRequestResponse
|
|
65
|
+
[ElementsEvent.HotelOffersFiltersUpdated]: Partial<HotelOffersFilters>
|
|
66
|
+
[ElementsEvent.HotelOffersItemClick]: [HotelOffer, number]
|
|
67
|
+
[ElementsEvent.HotelOffersMarkerClick]: HotelOffer
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
+
[ElementsEvent.HotelOffersPollingStarted]: any
|
|
70
|
+
[ElementsEvent.HotelOffersRetrieved]: HotelOffer[]
|
|
71
|
+
[ElementsEvent.HotelOffersViewShowMap]: boolean
|
|
72
|
+
[ElementsEvent.HotelRetrieved]: Hotel
|
|
73
|
+
[ElementsEvent.HotelRoomOfferRequestCreated]: HotelRoomOfferRequestResponse
|
|
74
|
+
[ElementsEvent.HotelRoomOfferRequestRetrieved]: HotelRoomOfferRequestResponse
|
|
75
|
+
[ElementsEvent.HotelRoomOffersBtnClick]: HotelRoomOffer
|
|
76
|
+
[ElementsEvent.HotelRoomOffersPriceIncreased]: [
|
|
77
|
+
HotelRoomOffer,
|
|
78
|
+
HotelRoomOffer,
|
|
79
|
+
]
|
|
80
|
+
[ElementsEvent.HotelRoomOffersRetrieved]: HotelRoomOffersResponse
|
|
81
|
+
[ElementsEvent.LangUpdated]: Locale
|
|
82
|
+
[ElementsEvent.PaymentSuccess]: Booking
|
|
83
|
+
[ElementsEvent.PrebookForm]: PrebookFormValues
|
|
84
|
+
}
|
|
@@ -40,14 +40,14 @@ export interface HotelOfferRequest {
|
|
|
40
40
|
* <b style="color: red;"> when no address parameter passed.</b>
|
|
41
41
|
* @type {number}
|
|
42
42
|
*/
|
|
43
|
-
latitude
|
|
43
|
+
latitude: number
|
|
44
44
|
/**
|
|
45
45
|
* Search location longitude.
|
|
46
46
|
*
|
|
47
47
|
* <b style="color: red;"> when no address parameter passed.</b>
|
|
48
48
|
* @type {number}
|
|
49
49
|
*/
|
|
50
|
-
longitude
|
|
50
|
+
longitude: number
|
|
51
51
|
/**
|
|
52
52
|
* The total number of rooms requested for the stay. Results may display offers matching a different room count than the requested one, however those results will always provide enough occupancy for the total guest count needed.
|
|
53
53
|
*
|
|
@@ -156,16 +156,15 @@ export interface HotelOfferRequestResponse {
|
|
|
156
156
|
id: string
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
export
|
|
160
|
-
HotelOfferRequest
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
>
|
|
159
|
+
export interface HotelOfferRequestCreate {
|
|
160
|
+
address?: HotelOfferRequest['address']
|
|
161
|
+
adultCount: HotelOfferRequest['adultCount']
|
|
162
|
+
checkInDate: HotelOfferRequest['checkInDate']
|
|
163
|
+
checkOutDate: HotelOfferRequest['checkOutDate']
|
|
164
|
+
children?: HotelOfferRequest['children']
|
|
165
|
+
eventMetadata?: HotelOfferRequest['eventMetadata']
|
|
166
|
+
latitude?: HotelOfferRequest['latitude']
|
|
167
|
+
longitude?: HotelOfferRequest['longitude']
|
|
168
|
+
roomCount: HotelOfferRequest['roomCount']
|
|
169
|
+
sourceMarket: HotelOfferRequest['sourceMarket']
|
|
170
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HotelOffersSortByOrderType } from './hotel-offer-list.ts'
|
|
2
|
+
import type { HotelOffersSortByEnum } from './hotel-offer.ts'
|
|
3
|
+
|
|
4
|
+
export enum FilterName {
|
|
5
|
+
Price = 'price',
|
|
6
|
+
Rating = 'rating',
|
|
7
|
+
ReviewRating = 'review_rating',
|
|
8
|
+
SortBy = 'sort_by',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface HotelOffersFilters {
|
|
12
|
+
[FilterName.Rating]: string
|
|
13
|
+
[FilterName.ReviewRating]?: number
|
|
14
|
+
[FilterName.Price]: [number, number]
|
|
15
|
+
[FilterName.SortBy]: {
|
|
16
|
+
direction: HotelOffersSortByOrderType
|
|
17
|
+
value: HotelOffersSortByEnum
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export type * from './bed.ts'
|
|
2
|
+
export type * from './booking-flow.ts'
|
|
2
3
|
export type * from './booking-policy.ts'
|
|
3
4
|
export type * from './cancellation-policy.ts'
|
|
5
|
+
export * from './elements-events.ts'
|
|
4
6
|
export type * from './event-metadata.ts'
|
|
5
7
|
export type * from './hotel-image.ts'
|
|
6
8
|
export type * from './hotel-images.ts'
|
|
7
9
|
export type * from './hotel-offer-request.ts'
|
|
10
|
+
export * from './hotel-offers-filters.ts'
|
|
8
11
|
export type * from './hotel-room-offer.ts'
|
|
9
12
|
export * from './hotel-room-offer-type.ts'
|
|
10
13
|
export * from './hotel-room-offer-package-type.ts'
|