Merged in feat/BOOK-131-tracking-no-availability (pull request #2886)
feat(BOOK-131): add no availability tracking * feat(BOOK-131): add no availability tracking * feat(BOOK-131): add no availability tracking * feat(BOOK-131): extract noAvailability function * feat(BOOK-131): fix every render problem * feat(BOOK-131): noavailability handle return in function Approved-by: Erik Tiekstra Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -4,6 +4,7 @@ import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
|
||||
import { NoAvailabilityTracking } from "@scandic-hotels/tracking/NoAvailabilityTracking"
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
|
||||
import { AlternativeHotelsPageTitle } from "../components/AlternativeHotelsPageTitle"
|
||||
@@ -110,6 +111,10 @@ export async function AlternativeHotelsPage({
|
||||
|
||||
const suspenseKey = stringify(searchParams)
|
||||
|
||||
const shouldTrackNoAvailability = !!(
|
||||
hotels.every((hotel) => hotel.availability.status !== "Available") ||
|
||||
(booking.bookingCode && hotels.length > 0 && !isBookingCodeRateAvailable)
|
||||
)
|
||||
return (
|
||||
<>
|
||||
<SelectHotel
|
||||
@@ -128,6 +133,12 @@ export async function AlternativeHotelsPage({
|
||||
hotelInfo={hotelsTrackingData}
|
||||
pageData={pageTrackingData}
|
||||
/>
|
||||
<NoAvailabilityTracking
|
||||
lang={lang}
|
||||
hotelsTrackingData={hotelsTrackingData}
|
||||
pageTrackingData={pageTrackingData}
|
||||
shouldTrackNoAvailability={shouldTrackNoAvailability}
|
||||
/>
|
||||
</Suspense>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
|
||||
import { NoAvailabilityTracking } from "@scandic-hotels/tracking/NoAvailabilityTracking"
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
|
||||
import FnFNotAllowedAlert from "../components/FnFNotAllowedAlert"
|
||||
@@ -85,7 +86,7 @@ export async function SelectHotelPage({
|
||||
arrivalDate,
|
||||
departureDate,
|
||||
hotelsResult: hotels?.length ?? 0,
|
||||
searchTerm: booking.hotelId,
|
||||
searchTerm: city.name,
|
||||
country: hotels?.[0]?.hotel.address.country,
|
||||
hotelCity: hotels?.[0]?.hotel.address.city,
|
||||
bookingCode: booking.bookingCode,
|
||||
@@ -96,6 +97,11 @@ export async function SelectHotelPage({
|
||||
|
||||
const suspenseKey = stringify(searchParams)
|
||||
|
||||
const shouldTrackNoAvailability = !!(
|
||||
hotels.every((hotel) => hotel.availability.status !== "Available") ||
|
||||
(booking.bookingCode && hotels.length > 0 && !isBookingCodeRateAvailable)
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<SelectHotel
|
||||
@@ -111,6 +117,12 @@ export async function SelectHotelPage({
|
||||
hotelInfo={hotelsTrackingData}
|
||||
pageData={pageTrackingData}
|
||||
/>
|
||||
<NoAvailabilityTracking
|
||||
lang={lang}
|
||||
hotelsTrackingData={hotelsTrackingData}
|
||||
pageTrackingData={pageTrackingData}
|
||||
shouldTrackNoAvailability={shouldTrackNoAvailability}
|
||||
/>
|
||||
</Suspense>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import { SelectRate } from "../components/SelectRate"
|
||||
import { getValidDates } from "../components/SelectRate/getValidDates"
|
||||
import { getSelectRateTracking } from "../components/SelectRate/Tracking/tracking"
|
||||
import { SelectRateTracking } from "../components/SelectRate/Tracking/SelectRateTracking"
|
||||
import { SelectRateProvider } from "../contexts/SelectRate/SelectRateContext"
|
||||
import { getHotel } from "../trpc/memoizedRequests"
|
||||
import { parseSelectRateSearchParams } from "../utils/url"
|
||||
@@ -72,33 +70,12 @@ export async function SelectRatePage({
|
||||
notFound()
|
||||
}
|
||||
|
||||
const { fromDate, toDate } = getValidDates(booking.fromDate, booking.toDate)
|
||||
|
||||
const { rooms, searchType, bookingCode, city: paramCity } = booking
|
||||
|
||||
const arrivalDate = fromDate.toDate()
|
||||
const departureDate = toDate.toDate()
|
||||
|
||||
const { hotelsTrackingData, pageTrackingData } = getSelectRateTracking({
|
||||
lang,
|
||||
arrivalDate,
|
||||
departureDate,
|
||||
hotelId: hotelData.hotel.id,
|
||||
hotelName: hotelData.hotel.name,
|
||||
country: hotelData.hotel.address.country,
|
||||
hotelCity: hotelData.hotel.address.city,
|
||||
paramCity,
|
||||
bookingCode,
|
||||
isRedemption: searchType === SEARCH_TYPE_REDEMPTION,
|
||||
rooms,
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
<SelectRateProvider hotelData={hotelData}>
|
||||
<SelectRate hotelData={hotelData} booking={booking} />
|
||||
<SelectRateTracking hotelData={hotelData} booking={booking} />
|
||||
</SelectRateProvider>
|
||||
<TrackingSDK hotelInfo={hotelsTrackingData} pageData={pageTrackingData} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user