diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx index 70aef0ada..3a24df0b1 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx @@ -1,7 +1,9 @@ import "./enterDetailsLayout.css" +import { differenceInCalendarDays, format, isWeekend } from "date-fns" import { notFound } from "next/navigation" +import { Lang } from "@/constants/languages" import { getBreakfastPackages, getCreditCardsSafely, @@ -21,10 +23,16 @@ import { generateChildrenString, getQueryParamsForEnterDetails, } from "@/components/HotelReservation/SelectRate/RoomSelection/utils" +import TrackingSDK from "@/components/TrackingSDK" import { getIntl } from "@/i18n" import { StepEnum } from "@/types/components/hotelReservation/enterDetails/step" import { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate" +import { + TrackingChannelEnum, + TrackingSDKHotelInfo, + TrackingSDKPageData, +} from "@/types/components/tracking" import type { LangParams, PageArgs } from "@/types/params" function isValidStep(step: string): step is StepEnum { @@ -112,8 +120,37 @@ export default async function StepPage({ ? roomAvailability.memberRate?.localPrice.pricePerStay : roomAvailability.publicRate!.localPrice.pricePerStay + const arrivalDate = new Date(searchParams.fromDate) + const departureDate = new Date(searchParams.toDate) + const hotelAttributes = hotelData?.data.attributes + + const pageTrackingData: TrackingSDKPageData = { + pageId: "select-rate", + domainLanguage: params.lang as Lang, + channel: TrackingChannelEnum["hotelreservation"], + pageName: "hotelreservation|select-rate", + siteSections: "hotelreservation|select-rate", + pageType: "bookingroomsandratespage", + } + + const hotelsTrackingData: TrackingSDKHotelInfo = { + searchTerm: searchParams.city, + arrivalDate: format(arrivalDate, "yyyy-MM-dd"), + departureDate: format(departureDate, "yyyy-MM-dd"), + noOfAdults: adults, + noOfChildren: children?.length, + //childBedPreference // "adults|adults|extra|adults" + noOfRooms: 1, // // TODO: Handle multiple rooms + duration: differenceInCalendarDays(departureDate, arrivalDate), + leadTime: differenceInCalendarDays(arrivalDate, new Date()), + searchType: "hotel", + bookingTypeofDay: isWeekend(arrivalDate) ? "weekend" : "weekday", + country: hotelAttributes?.address.country, + region: hotelAttributes?.address.city, + } + return ( -
+ <> -
+ + ) }