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

@@ -1,6 +1,7 @@
import { trackEvent } from "./base"
import type { SelectedAncillary } from "@/types/components/myPages/myStay/ancillaries"
import { CurrencyEnum } from "@/types/enums/currency"
import type { PackageSchema } from "@/types/trpc/routers/booking/confirmation"
import type { CreditCard } from "@/types/user"
@@ -167,14 +168,15 @@ export function trackRemoveAncillary(
hotelId: string,
deliveryTime?: string
) {
const isPoints = ancillary.currency === CurrencyEnum.POINTS
trackEvent({
event: "removeAncillary",
ancillaries: [
{
hotelId,
productId: ancillary.code,
productPrice: ancillary.totalPrice,
productPoints: ancillary.points,
productPrice: isPoints ? 0 : ancillary.totalPrice,
productPoints: isPoints ? ancillary.totalPrice : 0,
productUnits: ancillary.totalUnit,
productType: ancillary.type,
productDeliveryTime: deliveryTime,