feat: make sure correct data is sent to tracking

This commit is contained in:
Simon Emanuelsson
2025-05-14 16:01:49 +02:00
committed by Simon.Emanuelsson
parent 1a28bcdc4c
commit e082bf2e50
5 changed files with 24 additions and 27 deletions

View File

@@ -15,6 +15,7 @@ import {
type TrackingSDKPaymentInfo,
} from "@/types/components/tracking"
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
import { CurrencyEnum } from "@/types/enums/currency"
import { RateEnum } from "@/types/enums/rate"
import type { Room } from "@/types/stores/booking-confirmation"
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
@@ -38,13 +39,14 @@ function mapAncillaryPackage(
ancillaryPackage: BookingConfirmation["booking"]["packages"][number],
operaId: string
) {
const isPoints = ancillaryPackage.currency === CurrencyEnum.POINTS
return {
hotelid: operaId,
productCategory: "", // TODO: Add category
productId: ancillaryPackage.code,
productName: ancillaryPackage.description,
productPoints: ancillaryPackage.points,
productPrice: ancillaryPackage.totalPrice,
productPoints: isPoints ? ancillaryPackage.totalPrice : 0,
productPrice: isPoints ? 0 : ancillaryPackage.totalPrice,
productType:
ancillaryPackage.code === BreakfastPackageEnum.REGULAR_BREAKFAST
? "food"