Merged in fix/SW-2668-tracking-room-details-missing (pull request #2015)

fix(SW-2668): added search term and room details to tracking

* fix(SW-2668): added search term and room details to tracking

* fix: change to optional type


Approved-by: Christian Andolf
Approved-by: Matilda Landström
This commit is contained in:
Tobias Johansson
2025-05-08 14:13:51 +00:00
parent 8d864df5b3
commit 02b26e7965
7 changed files with 21 additions and 11 deletions

View File

@@ -31,11 +31,11 @@ export function getTracking(
booking: SelectHotelParams<SelectRateSearchParams>,
hotel: Hotel,
rooms: Room[],
city: string | undefined,
isMember: boolean,
lang: Lang,
storedRooms: RoomState[],
breakfastPackages: BreakfastPackages
breakfastPackages: BreakfastPackages,
searchTerm?: string
) {
const arrivalDate = new Date(booking.fromDate)
const departureDate = new Date(booking.toDate)
@@ -185,12 +185,14 @@ export function getTracking(
rewardNightAvailability:
booking.searchType === REDEMPTION ? "true" : "false",
roomPrice: calcTotalRoomPrice(storedRooms, isMember),
roomTypeCode: rooms.map((room) => room.roomTypeCode).join("|"),
roomTypeName: rooms.map((room) => room.roomType).join("|"),
totalPrice: calcTotalPrice(storedRooms, isMember),
points:
// @ts-expect-error - redemption object doesn't exist error
rooms.find((room) => "redemption" in room.roomRate)?.roomRate.redemption
.localPrice.pointsPerStay ?? "n/a",
searchTerm: city,
searchTerm,
searchType: "hotel",
specialRoomType: rooms
.map((room) => getSpecialRoomType(room.packages))