Merged in feat/sw-3207-refactor-select-hotel-tracking (pull request #2587)

feat(SW-3207): Refactor select-hotel tracking

* Refactor select-hotel tracking


Approved-by: Bianca Widstam
This commit is contained in:
Anton Gunnarsson
2025-08-06 08:35:48 +00:00
parent 7fb082f712
commit 41efb3a7b3
9 changed files with 184 additions and 274 deletions

View File

@@ -11,7 +11,7 @@ import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
import { getHotelPins } from "../../HotelCardDialogListing/utils"
import { getFiltersFromHotels, getHotels } from "../helpers"
import { getTracking } from "./tracking"
import { getSelectHotelTracking } from "../tracking"
import SelectHotelMap from "."
import type { SelectHotelMapContainerProps } from "@/types/components/hotelReservation/selectHotel/map"
@@ -34,13 +34,9 @@ export async function SelectHotelMapContainer({
}
const {
adultsInRoom,
bookingCode,
childrenInRoom,
city,
cityIdentifier,
hotel: isAlternativeFor,
noOfRooms,
redemption,
} = searchDetails
@@ -53,7 +49,7 @@ export async function SelectHotelMapContainer({
toDate: booking.toDate,
rooms: booking.rooms,
isAlternativeFor,
bookingCode,
bookingCode: booking.bookingCode,
city,
redemption: !!redemption,
})
@@ -73,29 +69,31 @@ export async function SelectHotelMapContainer({
)
: false
const isBookingCodeRateAvailable = bookingCode
const isBookingCodeRateAvailable = booking.bookingCode
? hotels?.some((hotel) => hotel.availability.bookingCode)
: false
const { hotelsTrackingData, pageTrackingData } = getTracking(
const { hotelsTrackingData, pageTrackingData } = getSelectHotelTracking({
lang,
!!isAlternativeFor,
!!isAlternativeHotels,
pageId: isAlternativeFor ? "alternative-hotels" : "select-hotel",
pageName: isAlternativeHotels
? "hotelreservation|alternative-hotels|mapview"
: "hotelreservation|select-hotel|mapview",
siteSections: isAlternativeHotels
? "hotelreservation|altervative-hotels|mapview"
: "hotelreservation|select-hotel|mapview",
arrivalDate,
departureDate,
adultsInRoom,
childrenInRoom,
hotels.length,
booking.hotelId,
noOfRooms,
hotels?.[0]?.hotel.address.country,
hotels?.[0]?.hotel.address.city,
cityIdentifier,
bookingCode,
rooms: booking.rooms,
hotelsResult: hotels.length,
searchTerm: isAlternativeFor ? booking.hotelId : cityIdentifier,
country: hotels?.[0]?.hotel.address.country,
hotelCity: hotels?.[0]?.hotel.address.city,
bookingCode: booking.bookingCode,
isBookingCodeRateAvailable,
redemption,
isRedemptionAvailability
)
isRedemption: redemption,
isRedemptionAvailable: isRedemptionAvailability,
})
return (
<>
@@ -106,7 +104,7 @@ export async function SelectHotelMapContainer({
hotels={hotels}
filterList={filterList}
cityCoordinates={cityCoordinates}
bookingCode={bookingCode ?? ""}
bookingCode={booking.bookingCode}
isBookingCodeRateAvailable={isBookingCodeRateAvailable}
isAlternativeHotels={isAlternativeHotels}
/>