Merged in feat/SW-2308-family-friends-booking-rest (pull request #1916)

feat: SW-2308 FnF code restriction added

* feat: SW-2308 FnF code restriction added

* feat: 2308 Optimized code


Approved-by: Niclas Edenvin
This commit is contained in:
Hrishikesh Vaipurkar
2025-05-02 14:22:05 +00:00
parent fb44990777
commit 53b630b6d8
10 changed files with 157 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
import stringify from "json-stable-stringify-without-jsonify"
import { cookies } from "next/headers"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { FamilyAndFriendsCodes } from "@/constants/booking"
import {
alternativeHotels,
alternativeHotelsMap,
@@ -21,6 +23,7 @@ import { getIntl } from "@/i18n"
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
import { convertObjToSearchParams } from "@/utils/url"
import FnFNotAllowedAlert from "../FnFNotAllowedAlert/FnFNotAllowedAlert"
import HotelCardListing from "../HotelCardListing"
import BookingCodeFilter from "./BookingCodeFilter"
import { getFiltersFromHotels, getHotels } from "./helpers"
@@ -67,6 +70,15 @@ export default async function SelectHotel({
if (!city) return notFound()
if (bookingCode && FamilyAndFriendsCodes.includes(bookingCode)) {
const cookieStore = cookies()
const isInValidFNF = cookieStore.get("sc")?.value !== "1"
if (isInValidFNF) {
return <FnFNotAllowedAlert />
}
}
const hotels = await getHotels(
selectHotelParams,
isAlternativeFor,