@revolugo/common 6.13.2 → 6.13.3-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolugo/common",
3
- "version": "6.13.2",
3
+ "version": "6.13.3-beta.0",
4
4
  "private": false,
5
5
  "description": "Revolugo common",
6
6
  "author": "Revolugo",
@@ -502,3 +502,12 @@ export function adjustForCustomers(
502
502
  dateTo: adjustIfFullHour(policy.dateTo).format(),
503
503
  }))
504
504
  }
505
+
506
+ export function isFreeCancellable(cps: ICancellationPolicy[]): boolean {
507
+ const freeCp = cps.find(cp => cp.penaltyPercentage === 0)
508
+ return (
509
+ !!freeCp &&
510
+ (dayjs().isBefore(dayjs(freeCp.dateFrom)) ||
511
+ dayjs().isBetween(dayjs(freeCp.dateFrom), dayjs(freeCp.dateTo)))
512
+ )
513
+ }
@@ -31,6 +31,7 @@ export enum Environment {
31
31
  export enum NodeEnv {
32
32
  Development = 'development',
33
33
  Production = 'production',
34
+ Test = 'test',
34
35
  }
35
36
 
36
37
  export enum LogLevel {
@@ -8,3 +8,5 @@ export * from './locales.ts'
8
8
  export * from './measurement.ts'
9
9
  export * from './poller.ts'
10
10
  export * from './time.ts'
11
+ export * from './stay-taxes-info.ts'
12
+ export * from './venue.ts'
@@ -0,0 +1,7 @@
1
+ export enum StayTaxesInfoEnum {
2
+ Included = 'included',
3
+ NotIncluded = 'not_included',
4
+ Unknown = 'unknown',
5
+ }
6
+
7
+ export type StayTaxesInfo = `${StayTaxesInfoEnum}`
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_VENUE_LATITUDE = 48.858_222
2
+ export const DEFAULT_VENUE_LONGITUDE = 2.2945
@@ -20,6 +20,7 @@ export const ICONS_NAME = Object.freeze({
20
20
  calendar: 'ph:calendar-blank',
21
21
  car: 'ph:car',
22
22
  caretDown: 'ph:caret-down',
23
+ caretLeft: 'ph:caret-left',
23
24
  caretRight: 'ph:caret-right',
24
25
  caretUp: 'ph:caret-up',
25
26
  caretUpDown: 'ph:caret-up-down',
@@ -83,8 +84,11 @@ export const ICONS_NAME = Object.freeze({
83
84
  gavel: 'ph:gavel',
84
85
  gear: 'ph:gear',
85
86
  globe: 'ph:globe',
87
+ golf: 'ph:golf',
88
+ googleColored: 'flat-color-icons:google',
86
89
  graph: 'ph:graph',
87
90
  gym: 'ph:barbell',
91
+ hairDryer: 'ph:hair-dryer',
88
92
  hammer: 'ph:hammer',
89
93
  handPeace: 'ph:hand-peace',
90
94
  heart: 'ph:heart',
@@ -93,6 +97,7 @@ export const ICONS_NAME = Object.freeze({
93
97
  idBadge: 'ph:identification-badge',
94
98
  image: 'ph:image',
95
99
  images: 'ph:images',
100
+ imagesSquare: 'ph:images-square',
96
101
  info: 'ph:info',
97
102
  key: 'ph:key',
98
103
  leaf: 'ph:leaf',
@@ -111,8 +116,10 @@ export const ICONS_NAME = Object.freeze({
111
116
  minus: 'ph:minus',
112
117
  minusCircle: 'ph:minus-circle',
113
118
  money: 'ph:money',
119
+ monitor: 'ph:monitor',
114
120
  mosque: 'ph:mosque',
115
121
  musicNotes: 'ph:music-notes',
122
+ noSmoking: 'ph:cigarette-slash',
116
123
  note: 'ph:note',
117
124
  paintBrush: 'ph:paint-brush',
118
125
  palette: 'ph:palette',
@@ -123,6 +130,7 @@ export const ICONS_NAME = Object.freeze({
123
130
  pencil: 'ph:pencil',
124
131
  phone: 'ph:phone',
125
132
  pill: 'ph:pill',
133
+ planeTakeOff: 'ph:airplane-takeoff',
126
134
  plus: 'ph:plus',
127
135
  plusCircle: 'ph:plus-circle',
128
136
  policeCar: 'ph:police-car',
@@ -146,10 +154,13 @@ export const ICONS_NAME = Object.freeze({
146
154
  storefront: 'ph:storefront',
147
155
  student: 'ph:student',
148
156
  subway: 'ph:subway',
157
+ swimmingPool: 'ph:swimming-pool',
149
158
  synagogue: 'ph:synagogue',
150
159
  tShirt: 'ph:t-shirt',
151
160
  taxi: 'ph:taxi',
161
+ tennisBall: 'ph:tennis-ball',
152
162
  tent: 'ph:tent',
163
+ thermometerHot: 'ph:thermometer-hot',
153
164
  thumbsUp: 'ph:thumbs-up',
154
165
  tooth: 'ph:tooth',
155
166
  train: 'ph:train',
@@ -164,11 +175,14 @@ export const ICONS_NAME = Object.freeze({
164
175
  users: 'ph:users',
165
176
  usersThree: 'ph:users-three',
166
177
  van: 'ph:van',
178
+ vault: 'ph:vault',
167
179
  walking: 'ph:person-simple-walk',
168
180
  warning: 'ph:warning',
169
181
  warningCircle: 'ph:warning-circle',
182
+ wheelchair: 'ph:wheelchair',
170
183
  wifiHigh: 'ph:wifi-high',
171
184
  wifiSlash: 'ph:wifi-slash',
185
+ wind: 'ph:wind',
172
186
  wine: 'ph:wine',
173
187
  wrench: 'ph:wrench',
174
188
  })
@@ -193,20 +207,3 @@ export const ICONS_TO_FA_ICONS: Partial<
193
207
  star: 'star',
194
208
  van: 'van-shuttle',
195
209
  }
196
-
197
- export const FA_ICONS_TO_ICONS = {
198
- bus: ICONS_NAME.bus,
199
- child: ICONS_NAME.baby,
200
- clock: ICONS_NAME.clock,
201
- 'euro-sign': ICONS_NAME.euro,
202
- 'hand-peace': ICONS_NAME.handPeace,
203
- heart: ICONS_NAME.heart,
204
- house: ICONS_NAME.house,
205
- 'id-badge': ICONS_NAME.idBadge,
206
- leaf: ICONS_NAME.leaf,
207
- 'mug-hot': ICONS_NAME.coffee,
208
- 'person-running': ICONS_NAME.running,
209
- shirt: ICONS_NAME.shirt,
210
- star: ICONS_NAME.star,
211
- 'van-shuttle': ICONS_NAME.van,
212
- }
@@ -8,7 +8,10 @@ import type { SourceMarket } from './source-market.ts'
8
8
  import type { Tag } from './tag.ts'
9
9
  import type { Tax } from './tax.ts'
10
10
  // eslint-disable-next-line no-restricted-imports
11
- import type { BreakfastOptionType } from '../../constants/index.ts'
11
+ import type {
12
+ BreakfastOptionType,
13
+ StayTaxesInfo,
14
+ } from '../../constants/index.ts'
12
15
 
13
16
  export interface HotelRoomOffersDataResponse {
14
17
  /**
@@ -187,6 +190,14 @@ export interface HotelRoomOffer {
187
190
  * @memberof HotelRoomOffer
188
191
  */
189
192
  taxes?: Tax[]
193
+
194
+ /**
195
+ *
196
+ * @type {StayTaxesInfo}
197
+ * @memberof HotelRoomOffer
198
+ */
199
+ stayTaxesInfo: StayTaxesInfo
200
+
190
201
  /**
191
202
  * Hotel Room Offer type.
192
203
  *
@@ -1,4 +1,5 @@
1
1
  import type { Bed } from './bed.ts'
2
+ import type { HotelImage } from './hotel-image.ts'
2
3
 
3
4
  export interface HotelRoom {
4
5
  /**
@@ -63,6 +64,12 @@ export interface HotelRoom {
63
64
  * @memberof HotelRoom
64
65
  */
65
66
  imageIndexes?: number[] | null
67
+ /**
68
+ * List of images for the given Hotel Room.
69
+ * @type {Array<string>}
70
+ * @memberof HotelRoom
71
+ */
72
+ images?: HotelImage[] | null
66
73
  /**
67
74
  * Whether low resolution images are available.
68
75
  * @type {boolean}
@@ -27,6 +27,8 @@ export * from './is-equal.ts'
27
27
  export * from './is-nil.ts'
28
28
  export * from './key-by.ts'
29
29
  export * from './lang-default-fallbacks.ts'
30
+ export * from './map-keys.ts'
31
+ export * from './map-values.ts'
30
32
  export * from './merge.ts'
31
33
  export * from './omit-by.ts'
32
34
  export * from './omit.ts'
@@ -43,6 +45,7 @@ export * from './sort-by.ts'
43
45
  export * from './sum-by.ts'
44
46
  export * from './sum.ts'
45
47
  export * from './to-boolean.ts'
48
+ export * from './uniq.ts'
46
49
  export * from './uniq-by.ts'
47
50
  export * from './uniq-with.ts'
48
51
  export * from './validators.ts'
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Map over all the keys of an object to return
3
+ * a new object
4
+ */
5
+ export const mapKeys = <
6
+ TValue,
7
+ TKey extends string | number | symbol,
8
+ TNewKey extends string | number | symbol,
9
+ >(
10
+ obj: Record<TKey, TValue>,
11
+ mapFunc: (key: TKey, value: TValue) => TNewKey,
12
+ ): Record<TNewKey, TValue> => {
13
+ const keys = Object.keys(obj) as TKey[]
14
+ return keys.reduce(
15
+ (acc, key) => {
16
+ acc[mapFunc(key as TKey, obj[key])] = obj[key]
17
+ return acc
18
+ },
19
+ {} as Record<TNewKey, TValue>,
20
+ )
21
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Map over all the keys to create a new object
3
+ */
4
+ export const mapValues = <
5
+ TValue,
6
+ TKey extends string | number | symbol,
7
+ TNewValue,
8
+ >(
9
+ obj: Record<TKey, TValue>,
10
+ mapFunc: (value: TValue, key: TKey) => TNewValue,
11
+ ): Record<TKey, TNewValue> => {
12
+ const keys = Object.keys(obj) as TKey[]
13
+ return keys.reduce(
14
+ (acc, key) => {
15
+ acc[key] = mapFunc(obj[key], key)
16
+ return acc
17
+ },
18
+ {} as Record<TKey, TNewValue>,
19
+ )
20
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Given a list of items returns a new list with only
3
+ * unique items. Accepts an optional identity function
4
+ * to convert each item in the list to a comparable identity
5
+ * value
6
+ */
7
+ export function uniq<T>(
8
+ array: readonly T[],
9
+ toKey?: (item: T) => string | number | symbol,
10
+ ): T[] {
11
+ const valueMap = array.reduce<Record<string | number | symbol, T>>(
12
+ (acc, item) => {
13
+ const key = toKey ? toKey(item) : (item as string | number | symbol)
14
+ if (acc[key]) {
15
+ return acc
16
+ }
17
+ acc[key] = item
18
+ return acc
19
+ },
20
+ {},
21
+ )
22
+ return Object.values(valueMap)
23
+ }