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"

View File

@@ -236,7 +236,6 @@ function getAddedAncillaries(
const combinedBreakfastPackageAsAncillary: PackageSchema = {
code: BreakfastPackageEnum.ANCILLARY_REGULAR_BREAKFAST,
unitPrice: 0,
points: 0,
currency: addedBreakfastPackages[0].currency,
type: addedBreakfastPackages[0].type,
description: addedBreakfastPackages[0].description,

View File

@@ -125,7 +125,6 @@ export function Ancillaries({
currency: breakfastPackageAdults.localPrice.currency,
total: breakfastPackageAdults.localPrice.totalPrice,
},
// TODO: Change this to the correct URL, whatever that is
imageUrl:
"https://images.scandichotels.com/publishedmedia/inyre69evkpzgtygjnvp/Breakfast_-_Scandic_Sweden_-_Free_to_use.jpg",
requiresDeliveryTime: false,
@@ -146,12 +145,8 @@ export function Ancillaries({
])
const allAncillaries = useMemo(() => {
if (!ancillaries?.length) {
return []
}
const withBreakfastPopular = addBreakfastPackage(
ancillaries,
ancillaries ?? [],
breakfastAncillary,
"Popular"
)
@@ -164,7 +159,7 @@ export function Ancillaries({
return filtered
}, [ancillaries, breakfastAncillary, user])
if (!ancillaries?.length) {
if (!allAncillaries.length) {
return null
}