feat(SW-392): Added adobeSDK with page and hotel data
This commit is contained in:
@@ -9,6 +9,7 @@ import Breadcrumbs from "@/components/Breadcrumbs"
|
||||
import SidePeekProvider from "@/components/SidePeeks/SidePeekProvider"
|
||||
import Alert from "@/components/TempDesignSystem/Alert"
|
||||
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { getRestaurantHeading } from "@/utils/facilityCards"
|
||||
import { generateHotelSchema } from "@/utils/jsonSchemas"
|
||||
@@ -33,6 +34,7 @@ import {
|
||||
WellnessAndExerciseSidePeek,
|
||||
} from "./SidePeeks"
|
||||
import TabNavigation from "./TabNavigation"
|
||||
import { getTrackingHotelData, getTrackingPageData } from "./utils"
|
||||
|
||||
import styles from "./hotelPage.module.css"
|
||||
|
||||
@@ -113,6 +115,13 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
lng: location.longitude,
|
||||
}
|
||||
|
||||
const trackingPageData = getTrackingPageData(
|
||||
hotelPageData.system,
|
||||
hotelData.data.attributes,
|
||||
lang
|
||||
)
|
||||
const trackingHotelData = getTrackingHotelData(hotelData.data)
|
||||
|
||||
return (
|
||||
<div className={styles.pageContainer}>
|
||||
<script
|
||||
@@ -225,6 +234,12 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
<RoomSidePeek key={room.name} room={room} />
|
||||
))}
|
||||
</SidePeekProvider>
|
||||
<Suspense fallback={null}>
|
||||
<TrackingSDK
|
||||
pageData={trackingPageData}
|
||||
hotelInfo={trackingHotelData}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,44 @@
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKHotelInfo,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type { Hotel, HotelData } from "@/types/hotel"
|
||||
import type { HotelPage } from "@/types/trpc/routers/contentstack/hotelPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export function getRoomNameAsParam(roomName: string) {
|
||||
return roomName.replace(/[()]/g, "").replaceAll(" ", "-").toLowerCase()
|
||||
}
|
||||
|
||||
export function getTrackingPageData(
|
||||
pageData: HotelPage["hotel_page"]["system"],
|
||||
hotelData: Hotel,
|
||||
lang: Lang
|
||||
) {
|
||||
const country = hotelData.address.country
|
||||
const city = hotelData.address.city
|
||||
const hotelName = hotelData.name
|
||||
|
||||
const tracking: TrackingSDKPageData = {
|
||||
pageId: pageData.uid,
|
||||
domainLanguage: lang,
|
||||
publishDate: pageData.updated_at,
|
||||
createDate: pageData.created_at,
|
||||
channel: TrackingChannelEnum["hotels"],
|
||||
pageType: "hotelpage",
|
||||
pageName: `hotels|${country}|${city}|${hotelName}`,
|
||||
siteSections: `hotels|${country}|${city}|${hotelName}`,
|
||||
siteVersion: "new-web",
|
||||
}
|
||||
|
||||
return tracking
|
||||
}
|
||||
|
||||
export function getTrackingHotelData(hotelData: HotelData["data"]) {
|
||||
const tracking: TrackingSDKHotelInfo = {
|
||||
hotelID: hotelData.id,
|
||||
}
|
||||
|
||||
return tracking
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export default async function TrackingSDK({
|
||||
<RouterTransition
|
||||
pageData={pageData}
|
||||
userData={userTrackingData}
|
||||
//hotelInfo={hotelInfo}
|
||||
// hotelInfo={hotelInfo}
|
||||
//paymentInfo={paymentInfo}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@ export enum TrackingChannelEnum {
|
||||
"static-content-page" = "static-content-page",
|
||||
"hotelreservation" = "hotelreservation",
|
||||
"collection-page" = "collection-page",
|
||||
"hotels" = "hotels",
|
||||
}
|
||||
|
||||
export type TrackingChannel = keyof typeof TrackingChannelEnum
|
||||
|
||||
Reference in New Issue
Block a user