@revolugo/common 7.11.2 → 7.12.0-alpha.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 +3 -2
- package/src/constants/index.ts +2 -0
- package/src/constants/insurance.ts +50 -0
- package/src/constants/legal.ts +8 -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 +5 -0
- package/src/schemas/payment-methods.ts +3 -6
- package/src/types/elements/event.ts +12 -0
- package/src/types/elements/hotel-room-offer-request.ts +1 -0
- package/src/types/elements/payment-method.ts +4 -4
- 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 +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolugo/common",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0-alpha.1",
|
|
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'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const MEETCH_INSURANCE_TYPE_NAME = 'Meetch Insurance'
|
|
2
|
+
export const MEETCH_INSURANCE_TYPE_SLUG = 'meetch-insurance'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Single source of truth for the Revolugo Flex (Meetch) cancellation window:
|
|
6
|
+
* hours before check-in until which a claim is eligible. Consumed both by the
|
|
7
|
+
* frontend (to derive coverage state) and by the backend Meetch contract
|
|
8
|
+
* (`MEETCH_FLEX_CONTRACT.cancellationUntilHoursBeforeDeparture`).
|
|
9
|
+
*/
|
|
10
|
+
export const MEETCH_FLEX_CANCELLATION_HOURS_BEFORE_CHECK_IN = 48
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Persisted lifecycle status of an insurance subscription/claim. Shared so the
|
|
14
|
+
* frontend can derive cancellation UI from the same values the backend emits;
|
|
15
|
+
* re-exported from `@revolugo/node/constants` for server-side consumers.
|
|
16
|
+
*/
|
|
17
|
+
export enum InsuranceStatus {
|
|
18
|
+
Active = 'active',
|
|
19
|
+
Archived = 'archived',
|
|
20
|
+
Claimed = 'claimed',
|
|
21
|
+
Incomplete = 'incomplete',
|
|
22
|
+
Open = 'open',
|
|
23
|
+
WaitingPayment = 'waiting_payment',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Insurance statuses for which a Meetch/Flex claim is considered "in progress":
|
|
28
|
+
* the claim has been opened or settled on the insurer side, so the booking
|
|
29
|
+
* manager swaps to the claim-status UI instead of offering the cancel CTA.
|
|
30
|
+
*/
|
|
31
|
+
export const MEETCH_CLAIM_IN_PROGRESS_STATUSES: InsuranceStatus[] = [
|
|
32
|
+
InsuranceStatus.Open,
|
|
33
|
+
InsuranceStatus.Claimed,
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* UI-level lifecycle state of a Meetch/Flex insured booking, used to pick which
|
|
38
|
+
* cancellation UI to render. Derived from {@link InsuranceStatus} plus the
|
|
39
|
+
* coverage window; `none` means the booking is not Flex-insured and the
|
|
40
|
+
* standard cancellation policy applies.
|
|
41
|
+
*/
|
|
42
|
+
export const MEETCH_INSURANCE_STATE = {
|
|
43
|
+
ClaimInProgress: 'claim-in-progress',
|
|
44
|
+
Expired: 'expired',
|
|
45
|
+
None: 'none',
|
|
46
|
+
Valid: 'valid',
|
|
47
|
+
} as const
|
|
48
|
+
|
|
49
|
+
export type MeetchInsuranceStateType =
|
|
50
|
+
(typeof MEETCH_INSURANCE_STATE)[keyof typeof MEETCH_INSURANCE_STATE]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const CGV_URL =
|
|
2
|
+
'https://revolugo.s3.amazonaws.com/legal/2026_05_06_CGV_indiv_Revolugo_EN_FR.docx.pdf'
|
|
3
|
+
|
|
4
|
+
export const MEETCH_CGU_URL =
|
|
5
|
+
'https://revolugo.refund.preprod.embedcover.com/en/cgu'
|
|
6
|
+
|
|
7
|
+
export const MEETCH_CLAIM_URL =
|
|
8
|
+
'https://revolugo.refund.preprod.embedcover.com/en/signin'
|
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 -= this.amount * 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
|
@@ -16,6 +16,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
16
16
|
bookOpen: 'ph:book-open',
|
|
17
17
|
bowlingBall: 'ph:bowling-ball',
|
|
18
18
|
building: 'ph:building',
|
|
19
|
+
buildingOffice: 'ph:building-office',
|
|
19
20
|
buildings: 'ph:buildings',
|
|
20
21
|
bus: 'ph:bus',
|
|
21
22
|
cake: 'ph:cake',
|
|
@@ -127,6 +128,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
127
128
|
minusCircle: 'ph:minus-circle',
|
|
128
129
|
money: 'ph:money',
|
|
129
130
|
monitor: 'ph:monitor',
|
|
131
|
+
moon: 'ph:moon',
|
|
130
132
|
mosque: 'ph:mosque',
|
|
131
133
|
msOffice365: 'custom:ms-office-365',
|
|
132
134
|
msOutlook: 'custom:ms-outlook',
|
|
@@ -149,11 +151,13 @@ export const ICONS_NAME = Object.freeze({
|
|
|
149
151
|
policeCar: 'ph:police-car',
|
|
150
152
|
praying: 'ph:hands-praying',
|
|
151
153
|
questionMark: 'ph:question-mark',
|
|
154
|
+
receipt: 'ph:receipt',
|
|
152
155
|
receiptFail: 'ph:receipt-x',
|
|
153
156
|
refresh: 'ph:arrows-counter-clockwise',
|
|
154
157
|
running: 'ph:person-simple-run',
|
|
155
158
|
scissors: 'ph:scissors',
|
|
156
159
|
shield: 'ph:shield',
|
|
160
|
+
shieldCheck: 'ph:shield-check',
|
|
157
161
|
shirt: 'ph:shirt-folded',
|
|
158
162
|
shoppingBag: 'ph:shopping-bag',
|
|
159
163
|
shoppingCart: 'ph:shopping-cart',
|
|
@@ -169,6 +173,7 @@ export const ICONS_NAME = Object.freeze({
|
|
|
169
173
|
storefront: 'ph:storefront',
|
|
170
174
|
student: 'ph:student',
|
|
171
175
|
subway: 'ph:subway',
|
|
176
|
+
sun: 'ph:sun',
|
|
172
177
|
swimmingPool: 'ph:swimming-pool',
|
|
173
178
|
synagogue: 'ph:synagogue',
|
|
174
179
|
taxi: 'ph:taxi',
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
BookingStatusEnum,
|
|
6
|
-
PayLaterStatusEnum,
|
|
7
|
-
PaymentMethodNameEnum,
|
|
8
|
-
} from '../types/index.ts'
|
|
4
|
+
import { PayLaterStatusEnum, PaymentMethodNameEnum } from '../types/index.ts'
|
|
9
5
|
import { isEqual } from '../utils/is-equal.ts'
|
|
10
6
|
|
|
11
7
|
const allowedPaymentMethodCombinations = [
|
|
@@ -110,7 +106,8 @@ export const PAYMENT_METHOD_RESPONSE_SCHEMA = z
|
|
|
110
106
|
export const PAYMENT_METHODS_RESPONSE_SCHEMA = z
|
|
111
107
|
.array(PAYMENT_METHOD_RESPONSE_SCHEMA)
|
|
112
108
|
.openapi('paymentMethodsApi', {
|
|
113
|
-
description:
|
|
109
|
+
description:
|
|
110
|
+
'List of preferred payment methods to be used along with their respective payload (when applicable) in order to fulfill the order',
|
|
114
111
|
})
|
|
115
112
|
.optional()
|
|
116
113
|
|
|
@@ -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}
|
|
@@ -135,6 +135,7 @@ export interface HotelRoomOfferRequestCreate {
|
|
|
135
135
|
eventMetadata?: HotelRoomOfferRequest['eventMetadata']
|
|
136
136
|
hotelId: HotelRoomOfferRequest['hotelId']
|
|
137
137
|
roomCount: HotelRoomOfferRequest['roomCount']
|
|
138
|
+
sourceMarket?: HotelRoomOfferRequest['sourceMarket']
|
|
138
139
|
}
|
|
139
140
|
export interface HotelRoomOfferRequestsCreatePayload {
|
|
140
141
|
hotelRoomOfferRequestCreateApi?: HotelRoomOfferRequestCreate
|
|
@@ -20,7 +20,7 @@ export type PaymentMethod =
|
|
|
20
20
|
| PaymentMethodPayLater
|
|
21
21
|
|
|
22
22
|
export interface BasePaymentMethodCreditCard extends BasePaymentMethod {
|
|
23
|
-
name:
|
|
23
|
+
name: PaymentMethodNameEnum.CreditCard
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface PaymentMethodCreditCard extends BasePaymentMethodCreditCard {
|
|
@@ -32,7 +32,7 @@ export interface PaymentMethodCreditCard extends BasePaymentMethodCreditCard {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface BasePaymentMethodCoupon extends BasePaymentMethod {
|
|
35
|
-
name:
|
|
35
|
+
name: PaymentMethodNameEnum.Coupon
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface PaymentMethodCoupon extends BasePaymentMethodCoupon {
|
|
@@ -43,7 +43,7 @@ export interface PaymentMethodCoupon extends BasePaymentMethodCoupon {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface BasePaymentMethodDepositAccount extends BasePaymentMethod {
|
|
46
|
-
name:
|
|
46
|
+
name: PaymentMethodNameEnum.DepositAccount
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface PaymentMethodDepositAccount extends BasePaymentMethodDepositAccount {
|
|
@@ -54,7 +54,7 @@ export interface PaymentMethodDepositAccount extends BasePaymentMethodDepositAcc
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface BasePaymentMethodPayLater extends BasePaymentMethod {
|
|
57
|
-
name:
|
|
57
|
+
name: PaymentMethodNameEnum.PayLater
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export interface PayloadPayLater {
|
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'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CurrencyCode, InsuranceStatus } from '../constants/index.ts'
|
|
2
|
+
|
|
3
|
+
export interface InsuranceSummary {
|
|
4
|
+
currency: CurrencyCode
|
|
5
|
+
meetchClaimUrl: string
|
|
6
|
+
meetchTermsUrl: string
|
|
7
|
+
price: number
|
|
8
|
+
taxIncludedPrice: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* View-model describing an in-progress Meetch/Flex insurance claim, surfaced in
|
|
13
|
+
* the booking manager cancel modal. Populated from booking-api claim data once
|
|
14
|
+
* that is exposed; while absent, the "claim in progress" state never renders.
|
|
15
|
+
*/
|
|
16
|
+
export interface MeetchClaimViewModel {
|
|
17
|
+
currency: CurrencyCode
|
|
18
|
+
email: string
|
|
19
|
+
reference: string
|
|
20
|
+
/** Expected refund amount in minor units, in {@link MeetchClaimViewModel.currency}. */
|
|
21
|
+
refundAmount: number
|
|
22
|
+
/** Persisted claim status; the UI maps it to a localized label + tag severity. */
|
|
23
|
+
status: InsuranceStatus
|
|
24
|
+
/** ISO datetime the claim was submitted — rendered as "Claim submitted {date}". */
|
|
25
|
+
submittedAt: string
|
|
26
|
+
}
|