Merged in fix/SW-1353-multiroom-tracking (pull request #1870)

fix(SW-1353): enter details tracking fixes

* fix(SW-1353): tracking fixes

* refactor: move code

* fix: use hasPublicPrice

* fix: update calculation for roomPrice and totalPrice

* fix: only include bedtype if it is "preselected"


Approved-by: Michael Zetterberg
This commit is contained in:
Tobias Johansson
2025-04-29 06:29:57 +00:00
parent 52c99e8767
commit 70095043f8
4 changed files with 161 additions and 29 deletions

View File

@@ -146,17 +146,19 @@ export function getTracking(
.toLowerCase(),
//rateCodeType: , //TODO: Add when available in API. "regular, promotion, corporate etx",
region: hotel?.address.city,
revenueCurrencyCode: rooms.map((r) => r.currencyCode).join(","),
revenueCurrencyCode: [...new Set(rooms.map((r) => r.currencyCode))].join(
","
),
rewardNight: booking.roomPoints > 0 ? "yes" : "no",
rewardNightAvailability: booking.roomPoints > 0 ? "true" : "false",
points: booking.roomPoints > 0 ? booking.roomPoints : undefined,
roomPrice: rooms.map((r) => r.roomPrice).join(","),
roomPrice: rooms.reduce((total, room) => total + room.roomPrice, 0),
roomTypeCode: rooms.map((r) => r.roomTypeCode ?? "-").join(","),
searchType: "hotel",
specialRoomType: rooms
.map((room) => getSpecialRoomType(room.packages))
.join(","),
totalPrice: rooms.map((r) => r.totalPrice).join(","),
totalPrice: rooms.reduce((total, room) => total + room.totalPrice, 0),
lateArrivalGuarantee: booking.rateDefinition.mustBeGuaranteed
? "mandatory"
: isFlexBooking