@revolugo/common 6.15.8-alpha.3 → 6.15.8-alpha.30
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 +3 -3
- package/src/amenities/index.ts +3 -0
- package/src/cancellation-policies.ts +1 -1
- package/src/constants/locales.ts +2 -0
- package/src/icons/index.ts +3 -2
- package/src/types/elements/elements-events.ts +1 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/to-lang.ts +39 -0
- package/src/utils/to-locale.ts +39 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "6.15.8-alpha.
|
|
3
|
+
"version": "6.15.8-alpha.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Revolugo common",
|
|
6
6
|
"author": "Revolugo",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"@asteasolutions/zod-to-openapi": "8.4.0",
|
|
33
33
|
"change-case": "5.4.4",
|
|
34
34
|
"dayjs": "1.11.19",
|
|
35
|
-
"ky": "1.14.
|
|
35
|
+
"ky": "1.14.3",
|
|
36
36
|
"slugify": "1.6.6",
|
|
37
37
|
"type-fest": "5.4.1",
|
|
38
38
|
"uuid": "13.0.0",
|
|
39
|
-
"zod": "4.3.
|
|
39
|
+
"zod": "4.3.6"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "vitest"
|
package/src/amenities/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const AMENITY_TO_ICONS = Object.freeze({
|
|
2
2
|
AirConditioning: 'wind',
|
|
3
3
|
AirportTransportation: 'planeTakeOff',
|
|
4
|
+
Bed: 'bed',
|
|
4
5
|
BusinessCenter: 'building',
|
|
5
6
|
CarRentDesk: 'car',
|
|
6
7
|
ChildrenAllowed: 'baby',
|
|
@@ -14,6 +15,7 @@ export const AMENITY_TO_ICONS = Object.freeze({
|
|
|
14
15
|
ExteriorRoomEntrance: 'doorOpen',
|
|
15
16
|
FamilyRooms: 'usersThree',
|
|
16
17
|
FitnessFacility: 'gym',
|
|
18
|
+
Floor: 'arrowHorizontal',
|
|
17
19
|
GameRoom: 'gameController',
|
|
18
20
|
GolfCourse: 'golf',
|
|
19
21
|
HairDryer: 'hairDryer',
|
|
@@ -38,6 +40,7 @@ export const AMENITY_TO_ICONS = Object.freeze({
|
|
|
38
40
|
TennisCourt: 'tennisBall',
|
|
39
41
|
TvInRoom: 'monitor',
|
|
40
42
|
TwentyFourHourSecurity: 'shield',
|
|
43
|
+
Users: 'users',
|
|
41
44
|
ValetParking: 'car',
|
|
42
45
|
VideoCheckOut: 'filmReel',
|
|
43
46
|
VoiceMail: 'phone',
|
|
@@ -454,7 +454,7 @@ export function getSanitizedCancellationPolicies({
|
|
|
454
454
|
}: {
|
|
455
455
|
checkInDate: string
|
|
456
456
|
cancellationPolicies: ICancellationPolicy[]
|
|
457
|
-
timezone
|
|
457
|
+
timezone?: string
|
|
458
458
|
initialDate?: string
|
|
459
459
|
}): ICancellationPolicy[] {
|
|
460
460
|
if (!cancellationPolicies.length) {
|
package/src/constants/locales.ts
CHANGED
|
@@ -19,6 +19,8 @@ export enum Lang {
|
|
|
19
19
|
PT = 'pt',
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export type ExtendedLocale = Locale | Lang
|
|
23
|
+
|
|
22
24
|
export function langFromString(langStr: string): Lang | undefined {
|
|
23
25
|
return Object.entries(Lang).find(entry => {
|
|
24
26
|
if (entry[0].toLocaleLowerCase() === langStr.toLocaleLowerCase()) {
|
package/src/icons/index.ts
CHANGED
|
@@ -125,11 +125,11 @@ export const ICONS_NAME = Object.freeze({
|
|
|
125
125
|
money: 'ph:money',
|
|
126
126
|
monitor: 'ph:monitor',
|
|
127
127
|
mosque: 'ph:mosque',
|
|
128
|
+
msOffice365: 'custom:ms-office-365',
|
|
129
|
+
msOutlook: 'custom:ms-outlook',
|
|
128
130
|
musicNotes: 'ph:music-notes',
|
|
129
131
|
noSmoking: 'ph:cigarette-slash',
|
|
130
132
|
note: 'ph:note',
|
|
131
|
-
office365: 'custom:ms-office-365',
|
|
132
|
-
outlook: 'custom:ms-outlook',
|
|
133
133
|
paintBrush: 'ph:paint-brush',
|
|
134
134
|
palette: 'ph:palette',
|
|
135
135
|
paperPlaneTilt: 'ph:paper-plane-tilt',
|
|
@@ -173,6 +173,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
173
173
|
tent: 'ph:tent',
|
|
174
174
|
thermometerHot: 'ph:thermometer-hot',
|
|
175
175
|
thumbsUp: 'ph:thumbs-up',
|
|
176
|
+
timer: 'ph:timer',
|
|
176
177
|
tooth: 'ph:tooth',
|
|
177
178
|
train: 'ph:train',
|
|
178
179
|
trash: 'ph:trash-simple',
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
HotelRoomOffersResponse,
|
|
14
14
|
} from './hotel-room-offer.ts'
|
|
15
15
|
import type { Hotel } from './hotel.ts'
|
|
16
|
-
import type { Locale } from '
|
|
16
|
+
import type { Locale } from '@revolugo/common/constants'
|
|
17
17
|
|
|
18
18
|
export enum ElementsEvent {
|
|
19
19
|
BookingCreated = 'booking:created',
|
package/src/utils/index.ts
CHANGED
|
@@ -52,6 +52,8 @@ export * from './sort-by.ts'
|
|
|
52
52
|
export * from './sum-by.ts'
|
|
53
53
|
export * from './sum.ts'
|
|
54
54
|
export * from './to-boolean.ts'
|
|
55
|
+
export * from './to-lang.ts'
|
|
56
|
+
export * from './to-locale.ts'
|
|
55
57
|
export * from './transform-schema-keys.ts'
|
|
56
58
|
export * from './uniq.ts'
|
|
57
59
|
export * from './uniq-by.ts'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Lang, Locale } from '../constants/locales.ts'
|
|
2
|
+
|
|
3
|
+
import type { ExtendedLocale } from '../constants/locales.ts'
|
|
4
|
+
|
|
5
|
+
export function toLang(localeOrLang: ExtendedLocale): Lang {
|
|
6
|
+
switch (localeOrLang) {
|
|
7
|
+
case Lang.EN:
|
|
8
|
+
case Locale.en_US: {
|
|
9
|
+
return Lang.EN
|
|
10
|
+
}
|
|
11
|
+
case Lang.FR:
|
|
12
|
+
case Locale.fr_FR: {
|
|
13
|
+
return Lang.FR
|
|
14
|
+
}
|
|
15
|
+
case Lang.DE:
|
|
16
|
+
case Locale.de_DE: {
|
|
17
|
+
return Lang.DE
|
|
18
|
+
}
|
|
19
|
+
case Lang.ES:
|
|
20
|
+
case Locale.es_ES: {
|
|
21
|
+
return Lang.ES
|
|
22
|
+
}
|
|
23
|
+
case Lang.IT:
|
|
24
|
+
case Locale.it_IT: {
|
|
25
|
+
return Lang.IT
|
|
26
|
+
}
|
|
27
|
+
case Lang.NL:
|
|
28
|
+
case Locale.nl_NL: {
|
|
29
|
+
return Lang.NL
|
|
30
|
+
}
|
|
31
|
+
case Lang.PT:
|
|
32
|
+
case Locale.pt_PT: {
|
|
33
|
+
return Lang.PT
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
return Lang.EN
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Lang, Locale } from '../constants/locales.ts'
|
|
2
|
+
|
|
3
|
+
import type { ExtendedLocale } from '../constants/locales.ts'
|
|
4
|
+
|
|
5
|
+
export function toLocale(localeOrLang: ExtendedLocale): Locale {
|
|
6
|
+
switch (localeOrLang) {
|
|
7
|
+
case Lang.EN:
|
|
8
|
+
case Locale.en_US: {
|
|
9
|
+
return Locale.en_US
|
|
10
|
+
}
|
|
11
|
+
case Lang.FR:
|
|
12
|
+
case Locale.fr_FR: {
|
|
13
|
+
return Locale.fr_FR
|
|
14
|
+
}
|
|
15
|
+
case Lang.DE:
|
|
16
|
+
case Locale.de_DE: {
|
|
17
|
+
return Locale.de_DE
|
|
18
|
+
}
|
|
19
|
+
case Lang.ES:
|
|
20
|
+
case Locale.es_ES: {
|
|
21
|
+
return Locale.es_ES
|
|
22
|
+
}
|
|
23
|
+
case Lang.IT:
|
|
24
|
+
case Locale.it_IT: {
|
|
25
|
+
return Locale.it_IT
|
|
26
|
+
}
|
|
27
|
+
case Lang.NL:
|
|
28
|
+
case Locale.nl_NL: {
|
|
29
|
+
return Locale.nl_NL
|
|
30
|
+
}
|
|
31
|
+
case Lang.PT:
|
|
32
|
+
case Locale.pt_PT: {
|
|
33
|
+
return Locale.pt_PT
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
return Locale.en_US
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|