Merged in fix/BOOK-459-tracking-search (pull request #2984)

fix(BOOK-459): update searchTerm to city or hotelname

* fix(BOOK-459): update searchTerm to city or hotelname


Approved-by: Erik Tiekstra
This commit is contained in:
Bianca Widstam
2025-10-22 14:34:59 +00:00
parent acdc3dcec1
commit 76c353058b
17 changed files with 40 additions and 35 deletions

View File

@@ -7,6 +7,7 @@ import { useIntl } from "react-intl"
import { useSessionId } from "@scandic-hotels/common/hooks/useSessionId"
import { toast } from "@scandic-hotels/design-system/Toast"
import { trackNoAvailability } from "@scandic-hotels/tracking/NoAvailabilityTracking"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
import useLang from "../../hooks/useLang"
@@ -16,9 +17,13 @@ import type { SelectRateBooking } from "../../types/components/selectRate/select
type AvailabilityErrorProps = {
booking: SelectRateBooking
hotelName: string
}
export default function AvailabilityError({ booking }: AvailabilityErrorProps) {
export default function AvailabilityError({
booking,
hotelName,
}: AvailabilityErrorProps) {
const intl = useIntl()
const pathname = usePathname()
const searchParams = useSearchParams()
@@ -53,13 +58,14 @@ export default function AvailabilityError({ booking }: AvailabilityErrorProps) {
trackNoAvailability({
specialRoomType,
searchTerm: hotelId,
searchTerm: hotelName,
lang,
fromDate,
toDate,
noOfRooms: rooms.length,
searchType,
searchType: "hotel",
hotelId,
rewardNight: searchType === SEARCH_TYPE_REDEMPTION ? "yes" : "no",
bookingCode,
pageId: "select-rate",
pageName: "hotelreservation|select-rate",
@@ -70,11 +76,12 @@ export default function AvailabilityError({ booking }: AvailabilityErrorProps) {
})
}, [
rooms,
hotelId,
hotelName,
lang,
fromDate,
toDate,
searchType,
hotelId,
bookingCode,
sessionId,
])

View File

@@ -26,7 +26,7 @@ export function SelectRateTracking({ hotelData, booking }: TrackingProps) {
const { fromDate, toDate } = getValidDates(booking.fromDate, booking.toDate)
const { rooms, searchType, bookingCode, city: paramCity } = booking
const { rooms, searchType, bookingCode } = booking
const arrivalDate = fromDate.toDate()
const departureDate = toDate.toDate()
@@ -47,7 +47,6 @@ export function SelectRateTracking({ hotelData, booking }: TrackingProps) {
hotelName: hotelData.hotel.name,
country: hotelData.hotel.address.country,
hotelCity: hotelData.hotel.address.city,
paramCity,
bookingCode,
isRedemption: searchType === SEARCH_TYPE_REDEMPTION,
specialRoomType,

View File

@@ -24,7 +24,6 @@ type SelectRateTrackingInput = {
hotelName: string
country: string | undefined
hotelCity: string | undefined
paramCity: string | undefined
bookingCode?: string
isRedemption?: boolean
specialRoomType?: string
@@ -39,7 +38,6 @@ export function getSelectRateTracking({
hotelName,
country,
hotelCity,
paramCity,
bookingCode,
isRedemption = false,
specialRoomType,
@@ -80,7 +78,7 @@ export function getSelectRateTracking({
noOfChildren: childrenInRoom?.map((kids) => kids?.length ?? 0).join(","),
noOfRooms: rooms?.length ?? 0,
region: hotelCity,
searchTerm: paramCity ?? hotelName,
searchTerm: hotelName,
searchType: "hotel",
bookingCode: bookingCode ?? "n/a",
rewardNight: isRedemption ? "yes" : "no",

View File

@@ -87,7 +87,7 @@ export async function SelectRate({
/>
)}
<AvailabilityError booking={booking} />
<AvailabilityError booking={booking} hotelName={hotelData.hotel.name} />
</>
)
}