import { getUserTracking } from "@/lib/trpc/memoizedRequests"

import RouterTransition from "@/components/TrackingSDK/RouterTransition"

import {
  TrackingSDKHotelInfo,
  TrackingSDKPageData,
} from "@/types/components/tracking"

export const preloadUserTracking = () => {
  void getUserTracking()
}

export default async function TrackingSDK({
  pageData,
  hotelInfo,
}: {
  pageData: TrackingSDKPageData
  hotelInfo?: TrackingSDKHotelInfo
}) {
  const userTrackingData = await getUserTracking()

  return (
    <RouterTransition
      pageData={pageData}
      userData={userTrackingData}
      hotelInfo={hotelInfo}
    />
  )
}
