Merged in fix/SW-2418-tracking-booking-cancellations (pull request #2500)
fix(SW-2418): add duration and price to booking cancellations tracking * fix(SW-2418): add duration and price to booking cancellations tracking * fix(SW-2418): move sessionId and siteVersion inside the pageInfo object Approved-by: Matilda Landström
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"use client"
|
||||
import { differenceInCalendarDays } from "date-fns"
|
||||
import { useWatch } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
@@ -45,7 +46,20 @@ export default function FinalConfirmation({
|
||||
onSuccess(data, variables) {
|
||||
for (const confirmationNumber of data) {
|
||||
if (confirmationNumber) {
|
||||
trackCancelStay(bookedRoom.hotelId, confirmationNumber)
|
||||
const room = rooms.find(
|
||||
(room) => room.confirmationNumber === confirmationNumber
|
||||
)
|
||||
const duration = differenceInCalendarDays(
|
||||
bookedRoom.checkOutDate,
|
||||
bookedRoom.checkInDate
|
||||
)
|
||||
const roomPrice = room?.roomPrice.perStay.local.price
|
||||
trackCancelStay(
|
||||
bookedRoom.hotelId,
|
||||
duration,
|
||||
confirmationNumber,
|
||||
roomPrice
|
||||
)
|
||||
}
|
||||
}
|
||||
const allCancellationsWentThrough = data.every((cancelled) => cancelled)
|
||||
|
||||
Reference in New Issue
Block a user