Merged in fix/tracking-fixes (pull request #1930)
Fix/tracking fixes * fix: remove hotelInfo and paymentInfo when user reloads page on confirmation page * fix: clean session storage item on unmount * fix: commented out hard navigation hook * fix: update price calculation on room ancillary in tracking * fix: update discount calculation * fix: add space between fns * fix: allow useSoftNavigation to fire pageview again on same pathname * fix: prevent bedSelection and breakfastSelection from tracking twice Approved-by: Hrishikesh Vaipurkar
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
@@ -17,6 +19,22 @@ export default function Tracking({
|
||||
}) {
|
||||
const lang = useLang()
|
||||
const bookingRooms = useBookingConfirmationStore((state) => state.rooms)
|
||||
|
||||
const [hasLoadedBookingConfirmation] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
return sessionStorage.getItem("hasLoadedBookingConfirmation")
|
||||
}
|
||||
return null
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
sessionStorage.setItem("hasLoadedBookingConfirmation", "true")
|
||||
|
||||
return () => {
|
||||
sessionStorage.removeItem("hasLoadedBookingConfirmation")
|
||||
}
|
||||
}, [])
|
||||
|
||||
if (!bookingRooms.every(Boolean)) {
|
||||
return null
|
||||
}
|
||||
@@ -34,8 +52,8 @@ export default function Tracking({
|
||||
return (
|
||||
<TrackingSDK
|
||||
pageData={pageTrackingData}
|
||||
hotelInfo={hotelsTrackingData}
|
||||
paymentInfo={paymentInfo}
|
||||
hotelInfo={hasLoadedBookingConfirmation ? undefined : hotelsTrackingData}
|
||||
paymentInfo={hasLoadedBookingConfirmation ? undefined : paymentInfo}
|
||||
ancillaries={ancillaries}
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user