feat(SW-2879): Move BookingWidget to booking-flow package * Fix lockfile * Fix styling * a tiny little booking widget test * Tiny fixes * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Remove unused scripts * lint:fix * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Tiny lint fixes * update test * Update Input in booking-flow * Clean up comments etc * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Setup tracking context for booking-flow * Add missing use client * Fix temp tracking function * Pass booking to booking-widget * Remove comment * Add use client to booking widget tracking provider * Add use client to tracking functions * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Move debug page * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package * Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package Approved-by: Bianca Widstam
78 lines
1.7 KiB
TypeScript
78 lines
1.7 KiB
TypeScript
"use client"
|
|
|
|
import { trackEvent } from "./base"
|
|
|
|
import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast"
|
|
import type { LowestRoomPriceEvent } from "@/types/components/tracking"
|
|
|
|
export function trackLowestRoomPrice(event: LowestRoomPriceEvent) {
|
|
trackEvent({
|
|
event: "lowestRoomPrice",
|
|
hotelInfo: {
|
|
hotelId: event.hotelId,
|
|
arrivalDate: event.arrivalDate,
|
|
departureDate: event.departureDate,
|
|
},
|
|
viewItemInfo: {
|
|
lowestPrice: event.lowestPrice,
|
|
currency: event.currency,
|
|
},
|
|
})
|
|
}
|
|
|
|
// Tracking for sections of booking flow enter-details page
|
|
export function trackBedSelection(bedType: string) {
|
|
trackEvent({
|
|
event: "bedSelection",
|
|
selection: {
|
|
name: "bed options selection click",
|
|
bedType: bedType,
|
|
},
|
|
})
|
|
}
|
|
|
|
export function trackBreakfastSelection({
|
|
breakfastPackage,
|
|
hotelId,
|
|
units,
|
|
}: {
|
|
breakfastPackage: BreakfastPackages[number]
|
|
hotelId: string
|
|
units: number
|
|
}) {
|
|
trackEvent({
|
|
event: "breakfastSelection",
|
|
selection: {
|
|
name: "breakfast options selection click",
|
|
},
|
|
...(units > 0 && {
|
|
ancillaries: [
|
|
{
|
|
hotelId,
|
|
productCategory: "",
|
|
productId: breakfastPackage.code,
|
|
productUnits: units,
|
|
productPrice: breakfastPackage.localPrice.price * units,
|
|
productPoints: 0,
|
|
productType: "food",
|
|
productName: breakfastPackage.packageType,
|
|
},
|
|
],
|
|
}),
|
|
})
|
|
}
|
|
|
|
export function trackBookingSearchClick(
|
|
searchTerm: string,
|
|
searchType: string
|
|
) {
|
|
trackEvent({
|
|
event: "hotelSearchButtonClick",
|
|
hotelInfo: {
|
|
searchTerm,
|
|
searchType,
|
|
action: "Hotel search",
|
|
},
|
|
})
|
|
}
|