feat: add multiroom tracking to booking flow
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"use client"
|
||||
|
||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import { getTracking } from "./tracking"
|
||||
|
||||
import type { Room } from "@/types/stores/booking-confirmation"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
export default function Tracking({
|
||||
bookingConfirmation,
|
||||
}: {
|
||||
bookingConfirmation: BookingConfirmation
|
||||
}) {
|
||||
const lang = useLang()
|
||||
const bookingRooms = useBookingConfirmationStore((state) => state.rooms)
|
||||
if (!bookingRooms.every(Boolean)) {
|
||||
return null
|
||||
}
|
||||
|
||||
const rooms = bookingRooms.filter((room): room is Room => !!room)
|
||||
|
||||
const { hotelsTrackingData, pageTrackingData, paymentInfo } = getTracking(
|
||||
lang,
|
||||
bookingConfirmation.booking,
|
||||
bookingConfirmation.hotel,
|
||||
rooms
|
||||
)
|
||||
|
||||
return (
|
||||
<TrackingSDK
|
||||
pageData={pageTrackingData}
|
||||
hotelInfo={hotelsTrackingData}
|
||||
paymentInfo={paymentInfo}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user