134 lines
3.6 KiB
TypeScript
134 lines
3.6 KiB
TypeScript
import { MembershipLevel } from "@/constants/membershipLevels"
|
|
|
|
import type { Lang } from "@/constants/languages"
|
|
|
|
export enum TrackingChannelEnum {
|
|
"scandic-friends" = "scandic-friends",
|
|
"static-content-page" = "static-content-page",
|
|
"hotelreservation" = "hotelreservation",
|
|
"collection-page" = "collection-page",
|
|
}
|
|
|
|
export type TrackingChannel = keyof typeof TrackingChannelEnum
|
|
|
|
export type TrackingSDKPageData = {
|
|
pageId: string
|
|
createdDate?: string
|
|
publishedDate?: string
|
|
domainLanguage: Lang
|
|
pageType: string
|
|
channel: TrackingChannel
|
|
siteVersion: "new-web"
|
|
pageName: string
|
|
domain?: string
|
|
siteSections: string
|
|
pageLoadTime?: number // Page load time in seconds
|
|
}
|
|
|
|
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
|
|
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?: string // flex, save, change
|
|
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"
|
|
}
|
|
|
|
export type TrackingSDKProps = {
|
|
pageData: TrackingSDKPageData
|
|
userData: TrackingSDKUserData
|
|
hotelInfo?: TrackingSDKHotelInfo
|
|
}
|
|
|
|
export type TrackingSDKData = TrackingSDKPageData & {
|
|
pathName: 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"
|
|
| "sign up verification"
|
|
| "enter details"
|