@revolugo/common 7.11.2 → 7.12.0-rc.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 +3 -2
- package/src/constants/index.ts +2 -0
- package/src/constants/insurance.ts +2 -0
- package/src/constants/legal.ts +5 -0
- package/src/currencies/utils.ts +6 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/nuxt-i18n-detect-browser-language.ts +6 -0
- package/src/i18n/nuxt-i18n-locales.ts +70 -0
- package/src/icons/index.ts +4 -0
- package/src/types/elements/event.ts +12 -0
- package/src/types/event.ts +2 -0
- package/src/types/hotel-contract.ts +1 -0
- package/src/types/index.ts +1 -0
- package/src/types/insurance.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0-rc.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Revolugo common",
|
|
6
6
|
"author": "Revolugo",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"./constants": "./src/constants/index.ts",
|
|
16
16
|
"./currencies": "./src/currencies/index.ts",
|
|
17
17
|
"./http": "./src/http/index.ts",
|
|
18
|
+
"./i18n": "./src/i18n/index.ts",
|
|
18
19
|
"./icons": "./src/icons/index.ts",
|
|
19
20
|
"./map": "./src/map/index.ts",
|
|
20
21
|
"./models": "./src/models/index.ts",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@asteasolutions/zod-to-openapi": "8.5.0",
|
|
27
28
|
"change-case": "5.4.4",
|
|
28
|
-
"dayjs": "1.11.
|
|
29
|
+
"dayjs": "1.11.21",
|
|
29
30
|
"ky": "2.0.2",
|
|
30
31
|
"slugify": "1.6.9",
|
|
31
32
|
"type-fest": "5.6.0",
|
package/src/constants/index.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './environment.ts'
|
|
|
5
5
|
export * from './hotel-offers.ts'
|
|
6
6
|
export * from './hotel-room-offer.ts'
|
|
7
7
|
export * from './hotel.ts'
|
|
8
|
+
export * from './insurance.ts'
|
|
9
|
+
export * from './legal.ts'
|
|
8
10
|
export * from './locales.ts'
|
|
9
11
|
export * from './measurement.ts'
|
|
10
12
|
export * from './poller.ts'
|
package/src/currencies/utils.ts
CHANGED
|
@@ -192,6 +192,12 @@ export class MoneyCalculator {
|
|
|
192
192
|
return this
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
public removeMarkup(percentage: number): this {
|
|
196
|
+
this.amount *= 1 - percentage
|
|
197
|
+
|
|
198
|
+
return this
|
|
199
|
+
}
|
|
200
|
+
|
|
195
201
|
public round(): this {
|
|
196
202
|
this.amount = Math.round(this.amount)
|
|
197
203
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { LANG_TO_LOCALE, LOCALES, Lang } from '../constants/locales.ts'
|
|
2
|
+
|
|
3
|
+
/** Matches `@nuxtjs/i18n` `LocaleObject<string>` (index signature required for Nuxt config assignability). */
|
|
4
|
+
export interface NuxtI18nLocaleConfig {
|
|
5
|
+
[key: string]: unknown
|
|
6
|
+
code: string
|
|
7
|
+
files?: string[]
|
|
8
|
+
language: string
|
|
9
|
+
name: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Options for {@link nuxtI18nLocales}. */
|
|
13
|
+
export interface NuxtI18nLocalesOptions {
|
|
14
|
+
/** App-specific messages in `i18n/locales/{code}.json`. */
|
|
15
|
+
appLocaleFiles?: boolean
|
|
16
|
+
languages?: Lang[]
|
|
17
|
+
/**
|
|
18
|
+
* Also register BCP47 locale codes (`en-US`, `fr-FR`, …) as route prefixes,
|
|
19
|
+
* before each lang code (`en`, `fr`, …), for legacy URLs.
|
|
20
|
+
*/
|
|
21
|
+
regionalLocales?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function nuxtI18nLocales(
|
|
25
|
+
options: NuxtI18nLocalesOptions = {},
|
|
26
|
+
): NuxtI18nLocaleConfig[] {
|
|
27
|
+
const {
|
|
28
|
+
appLocaleFiles = false,
|
|
29
|
+
languages = Object.values(Lang),
|
|
30
|
+
regionalLocales = false,
|
|
31
|
+
} = options
|
|
32
|
+
|
|
33
|
+
const langLocales = languages.map(lang => {
|
|
34
|
+
const meta = Object.values(LOCALES).find(entry => entry.locale === lang)
|
|
35
|
+
if (!meta) {
|
|
36
|
+
throw new Error(`No locale metadata for language "${lang}"`)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const files: string[] = []
|
|
40
|
+
if (appLocaleFiles) {
|
|
41
|
+
files.push(`${lang}.json`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
code: lang as string,
|
|
46
|
+
...(files.length > 0 ? { files } : {}),
|
|
47
|
+
language: LANG_TO_LOCALE[lang] as string,
|
|
48
|
+
name: meta.name,
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
if (!regionalLocales) {
|
|
53
|
+
return langLocales
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return langLocales.flatMap(langLocale => {
|
|
57
|
+
const lang = langLocale.code as Lang
|
|
58
|
+
const regionalCode = LANG_TO_LOCALE[lang] as string
|
|
59
|
+
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
code: regionalCode,
|
|
63
|
+
...(langLocale.files ? { files: [...langLocale.files] } : {}),
|
|
64
|
+
language: regionalCode,
|
|
65
|
+
name: LOCALES[LANG_TO_LOCALE[lang]].name,
|
|
66
|
+
},
|
|
67
|
+
langLocale,
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
}
|
package/src/icons/index.ts
CHANGED
|
@@ -127,6 +127,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
127
127
|
minusCircle: 'ph:minus-circle',
|
|
128
128
|
money: 'ph:money',
|
|
129
129
|
monitor: 'ph:monitor',
|
|
130
|
+
moon: 'ph:moon',
|
|
130
131
|
mosque: 'ph:mosque',
|
|
131
132
|
msOffice365: 'custom:ms-office-365',
|
|
132
133
|
msOutlook: 'custom:ms-outlook',
|
|
@@ -149,11 +150,13 @@ export const ICONS_NAME = Object.freeze({
|
|
|
149
150
|
policeCar: 'ph:police-car',
|
|
150
151
|
praying: 'ph:hands-praying',
|
|
151
152
|
questionMark: 'ph:question-mark',
|
|
153
|
+
receipt: 'ph:receipt',
|
|
152
154
|
receiptFail: 'ph:receipt-x',
|
|
153
155
|
refresh: 'ph:arrows-counter-clockwise',
|
|
154
156
|
running: 'ph:person-simple-run',
|
|
155
157
|
scissors: 'ph:scissors',
|
|
156
158
|
shield: 'ph:shield',
|
|
159
|
+
shieldCheck: 'ph:shield-check',
|
|
157
160
|
shirt: 'ph:shirt-folded',
|
|
158
161
|
shoppingBag: 'ph:shopping-bag',
|
|
159
162
|
shoppingCart: 'ph:shopping-cart',
|
|
@@ -169,6 +172,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
169
172
|
storefront: 'ph:storefront',
|
|
170
173
|
student: 'ph:student',
|
|
171
174
|
subway: 'ph:subway',
|
|
175
|
+
sun: 'ph:sun',
|
|
172
176
|
swimmingPool: 'ph:swimming-pool',
|
|
173
177
|
synagogue: 'ph:synagogue',
|
|
174
178
|
taxi: 'ph:taxi',
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export interface Event {
|
|
2
|
+
/**
|
|
3
|
+
* Latitude of the event venue
|
|
4
|
+
* @type {number}
|
|
5
|
+
* @memberof EventApi
|
|
6
|
+
*/
|
|
7
|
+
latitude?: number | null
|
|
8
|
+
/**
|
|
9
|
+
* Longitude of the event venue
|
|
10
|
+
* @type {number}
|
|
11
|
+
* @memberof EventApi
|
|
12
|
+
*/
|
|
13
|
+
longitude?: number | null
|
|
2
14
|
/**
|
|
3
15
|
* Unique name of the event
|
|
4
16
|
* @type {string}
|
package/src/types/event.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface IHotelContract {
|
|
|
7
7
|
forcedTotalComissionsAmount: number
|
|
8
8
|
forcedTotalPurchasedAmount: number
|
|
9
9
|
forcedTotalVatComissionsAmount: number
|
|
10
|
+
hotelContractTaaps?: { taapId: string }[] | null
|
|
10
11
|
hotelId: string
|
|
11
12
|
hotelRoomStocks?: IHotelRoomStock[]
|
|
12
13
|
name: string
|
package/src/types/index.ts
CHANGED
|
@@ -19,5 +19,6 @@ export type * from './event.ts'
|
|
|
19
19
|
export type * from './geo-coordinates.ts'
|
|
20
20
|
export type * from './hotel-contract.ts'
|
|
21
21
|
export type * from './hotel-room-stock.ts'
|
|
22
|
+
export type * from './insurance.ts'
|
|
22
23
|
export type * from './money-object.ts'
|
|
23
24
|
export type * from './paginated-queries.ts'
|