@@ -160,7 +171,11 @@ export default function SelectHotelContent({
filters={filterList}
setShowSkeleton={setShowSkeleton}
/>
- {bookingCode ? : null}
+ {bookingCode &&
+ isBookingCodeRateAvailable &&
+ isRegularRateAvailable ? (
+
+ ) : null}
{showSkeleton ? (
diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx
index 9c315f6e2..3ed9f2e8d 100644
--- a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/index.tsx
@@ -14,6 +14,7 @@ export default function SelectHotelMap({
filterList,
cityCoordinates,
bookingCode,
+ isBookingCodeRateAvailable,
}: SelectHotelMapProps) {
return (
@@ -24,6 +25,7 @@ export default function SelectHotelMap({
hotels={hotels}
filterList={filterList}
bookingCode={bookingCode}
+ isBookingCodeRateAvailable={isBookingCodeRateAvailable}
/>
)
diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts
index e955bd77f..83f61cb46 100644
--- a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts
+++ b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts
@@ -22,7 +22,9 @@ export function getTracking(
noOfRooms: number,
country: string | undefined,
hotelCity: string | undefined,
- paramCity: string | undefined
+ paramCity: string | undefined,
+ bookingCode?: string,
+ isBookingCodeRateAvailable?: boolean
) {
const pageTrackingData: TrackingSDKPageData = {
channel: TrackingChannelEnum["hotelreservation"],
@@ -44,6 +46,8 @@ export function getTracking(
.join("|"),
arrivalDate: format(arrivalDate, "yyyy-MM-dd"),
availableResults: hotelsResult,
+ bookingCode: bookingCode ? bookingCode : "n/a",
+ bookingCodeAvailability: isBookingCodeRateAvailable ? "true" : "false",
bookingTypeofDay: isWeekend(arrivalDate) ? "weekend" : "weekday",
childBedPreference: childrenInRoom
?.map((c) => c?.map((k) => ChildBedMapEnum[k.bed]).join(",") ?? "-")
diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
index 578ba9d7e..42d172ddd 100644
--- a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
@@ -119,6 +119,28 @@ export default async function SelectHotel({
const isAllUnavailable = !hotels.length
+ const suspenseKey = stringify(searchParams)
+
+ const isFullPriceHotelAvailable = bookingCode
+ ? hotels?.some(
+ (hotel) =>
+ hotel.availability.productType?.public?.rateType ===
+ RateTypeEnum.Regular ||
+ hotel.availability.productType?.member?.rateType ===
+ RateTypeEnum.Regular
+ )
+ : false
+
+ const isBookingCodeRateAvailable = bookingCode
+ ? hotels?.some(
+ (hotel) =>
+ hotel.availability.productType?.public?.rateType !==
+ RateTypeEnum.Regular ||
+ hotel.availability.productType?.member?.rateType !==
+ RateTypeEnum.Regular
+ )
+ : false
+
const { hotelsTrackingData, pageTrackingData } = getTracking(
params.lang,
!!isAlternativeFor,
@@ -126,35 +148,16 @@ export default async function SelectHotel({
departureDate,
adultsInRoom,
childrenInRoom,
- hotels.length,
+ hotels?.length ?? 0,
selectHotelParams.hotelId,
noOfRooms,
hotels?.[0]?.hotel.address.country,
hotels?.[0]?.hotel.address.city,
- selectHotelParams.city
+ selectHotelParams.city,
+ bookingCode,
+ isBookingCodeRateAvailable ? "true" : "false"
)
- const suspenseKey = stringify(searchParams)
-
- let isFullPriceHotelAvailable
- let isBookingCodeRateAvaliable
- if (bookingCode) {
- isFullPriceHotelAvailable = hotels?.find(
- (hotel) =>
- hotel.availability.productType?.public?.rateType ===
- RateTypeEnum.Regular ||
- hotel.availability.productType?.member?.rateType ===
- RateTypeEnum.Regular
- )
- isBookingCodeRateAvaliable = hotels?.find(
- (hotel) =>
- hotel.availability.productType?.public?.rateType !==
- RateTypeEnum.Regular ||
- hotel.availability.productType?.member?.rateType !==
- RateTypeEnum.Regular
- )
- }
-
// Special rates (corporate cheque, voucher and reward nights) will not have regular rate hotels availability
const isSpecialRate = hotels?.some(
(hotel) =>
@@ -189,7 +192,7 @@ export default async function SelectHotel({