@revolugo/common 7.11.2-alpha.25 → 7.11.2-alpha.26

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": "7.11.2-alpha.25",
3
+ "version": "7.11.2-alpha.26",
4
4
  "private": false,
5
5
  "description": "Revolugo common",
6
6
  "author": "Revolugo",
@@ -1,2 +1,40 @@
1
1
  export const MEETCH_INSURANCE_TYPE_NAME = 'Meetch Insurance'
2
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
+ * UI-level lifecycle state of a Meetch/Flex insured booking, used to pick which
28
+ * cancellation UI to render. Derived from {@link InsuranceStatus} plus the
29
+ * coverage window; `none` means the booking is not Flex-insured and the
30
+ * standard cancellation policy applies.
31
+ */
32
+ export const MEETCH_INSURANCE_STATE = {
33
+ ClaimInProgress: 'claim-in-progress',
34
+ Expired: 'expired',
35
+ None: 'none',
36
+ Valid: 'valid',
37
+ } as const
38
+
39
+ export type MeetchInsuranceStateType =
40
+ (typeof MEETCH_INSURANCE_STATE)[keyof typeof MEETCH_INSURANCE_STATE]
@@ -3,3 +3,6 @@ export const CGV_URL =
3
3
 
4
4
  export const MEETCH_CGU_URL =
5
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'
@@ -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',
@@ -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: `List of preferred payment methods to be used along with their respective payload (when applicable) in order to fulfill the booking.\n\n⚠️ This field is only returned when **booking.status = ${BookingStatusEnum.Created}**`,
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
 
@@ -20,7 +20,7 @@ export type PaymentMethod =
20
20
  | PaymentMethodPayLater
21
21
 
22
22
  export interface BasePaymentMethodCreditCard extends BasePaymentMethod {
23
- name: 'CREDIT_CARD'
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: 'COUPON'
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: 'DEPOSIT_ACCOUNT'
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: 'PAY_LATER'
57
+ name: PaymentMethodNameEnum.PayLater
58
58
  }
59
59
 
60
60
  export interface PayloadPayLater {
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '../constants/index.ts'
1
+ import type { CurrencyCode, InsuranceStatus } from '../constants/index.ts'
2
2
 
3
3
  export interface InsuranceSummary {
4
4
  currency: CurrencyCode
@@ -7,3 +7,20 @@ export interface InsuranceSummary {
7
7
  price: number
8
8
  taxIncludedPrice: number
9
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
+ }