Files
web/types/components/tracking.ts
Chuma Mcphoy (We Ahead) 7fac673fbc Merged in feat/LOY-116-remove-cta-from-signup-verify-page (pull request #1335)
refactor(LOY-116): consolidate signup auth & remove SignUpVerification component

* refactor(LOY-116): simplify signup authentication and remove SignUpVerification component

- Remove SignUpVerification component and its related files
- Move authentication checks to page-level components
- Consolidate signup flow authentication logic
- Remove unused signup verification link variant

* refactor(LOY-116): remove "sign up verification" from TrackingPosition type


Approved-by: Christian Andolf
2025-02-13 15:28:39 +00:00

191 lines
4.9 KiB
TypeScript

import type { Lang } from "@/constants/languages"
import type { MembershipLevel } from "@/constants/membershipLevels"
export enum TrackingChannelEnum {
"scandic-friends" = "scandic-friends",
"static-content-page" = "static-content-page",
"hotelreservation" = "hotelreservation",
"collection-page" = "collection-page",
"destination-overview-page" = "destination-overview-page",
"destination-page" = "destination-page",
"hotels" = "hotels",
"start-page" = "start-page",
}
export type TrackingChannel = keyof typeof TrackingChannelEnum
export type TrackingSDKPageData = {
pageId: string
createDate?: string
publishDate?: string
domainLanguage: Lang
pageType: string
channel: TrackingChannel
siteVersion: "new-web"
pageName: string
domain?: string
siteSections: string
pageLoadTime?: number // Page load time in seconds
sessionId?: string | null
}
export enum LoginTypeEnum {
email = "email",
"membership number" = "membership number",
"email link" = "email link",
}
export type LoginType = keyof typeof LoginTypeEnum
export type TrackingSDKUserData = {
loginStatus: "logged in" | "Non-logged in"
loginType?: LoginType
memberId?: string
membershipNumber?: string
memberLevel?: MembershipLevel
noOfNightsStayed?: number
totalPointsAvailableToSpend?: number
loginAction?: "login success"
}
export type TrackingSDKHotelInfo = {
hotelID?: string
arrivalDate?: string
departureDate?: string
noOfAdults?: number
noOfChildren?: number
ageOfChildren?: string // "10", "2,5,10"
//rewardNight?: boolean
//bookingCode?: string
//bookingCodeAvailability?: boolean
leadTime?: number // Number of days from booking date until arrivalDate
noOfRooms?: number
//bonuscheque?: boolean
childBedPreference?: string
duration?: number // Number of nights to stay
availableResults?: number // Number of hotels to choose from after a city search
bookingTypeofDay?: "weekend" | "weekday"
searchTerm?: string
roomPrice?: number
rateCode?: string
rateCodeCancellationRule?: string
rateCodeName?: string // Scandic Friends - full flex inkl. frukost
rateCodeType?: string // regular, promotion etc
revenueCurrencyCode?: string // SEK, DKK, NOK, EUR
roomTypeCode?: string
roomTypePosition?: number // Which position the room had in the list of available rooms
roomTypeName?: string
bedType?: string
bedTypePosition?: number // Which position the bed type had in the list of available bed types
breakfastOption?: string // "no breakfast" or "breakfast buffet"
bnr?: string // Booking number
analyticsrateCode?: "flex" | "change" | "save" | string
specialRoomType?: string // allergy room, pet-friendly, accesibillity room
//modifyValues?: string // <price:<value>,roomtype:value>,bed:<value,<breakfast:value>
country?: string // Country of the hotel
region?: string // Region of the hotel
discount?: number
totalPrice?: number
lowestRoomPrice?: number
searchType?: "destination" | "hotel"
ancillaries?: Ancillary[]
}
export type Ancillary = {
productId: string
productUnits?: number
hotelid?: string
productPoints: number
productPrice: number
productType: string
productName: string
productCategory: string
}
export type TrackingSDKPaymentInfo = {
edccCurrencyFrom?: string
edccCurrencyTo?: string
isedcc?: string
isSavedCard?: boolean
isCreditCard?: boolean
paymentStatus?: "confirmed"
paymentType?: string
}
export type TrackingSDKProps = {
pageData: TrackingSDKPageData
userData: TrackingSDKUserData
hotelInfo?: TrackingSDKHotelInfo
paymentInfo?: TrackingSDKPaymentInfo
}
export type TrackingSDKData = TrackingSDKPageData & {
pathName: string
}
type BasePaymentEvent = {
event: string
hotelId: string | undefined
method?: string
isSavedCreditCard?: boolean
smsEnable?: boolean
status: "attempt" | "cancelled" | "failed"
}
export type PaymentAttemptStartEvent = BasePaymentEvent
export type PaymentCancelEvent = BasePaymentEvent
export type PaymentFailEvent = BasePaymentEvent & {
errorMessage?: string
}
export type PaymentEvent =
| PaymentAttemptStartEvent
| PaymentCancelEvent
| PaymentFailEvent
export type LowestRoomPriceEvent = {
hotelId: string | null
arrivalDate: string | null
departureDate: string | null
lowestPrice: number
currency?: string
}
// Old tracking setup types:
// TODO: Remove this when we delete "current site"
export type TrackingProps = {
pageData: {
pageId: string
createdDate: string
publishedDate: string
englishUrl?: string
lang: Lang
}
}
export type TrackingData = {
lang: Lang
englishUrl?: string
pathName: string
queryString: string
pageId: string
publishedDate: string
createdDate: string
}
export type SiteSectionObject = {
sitesection1: string
sitesection2: string
sitesection3: string
sitesection4: string
sitesection5: string
sitesection6: string
}
export type TrackingPosition =
| "top menu"
| "hamburger menu"
| "join scandic friends sidebar"
| "enter details"