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:
@@ -0,0 +1,6 @@
|
||||
.fnfMain {
|
||||
max-width: var(--max-width-page);
|
||||
margin: auto;
|
||||
min-height: 30dvh;
|
||||
padding: var(--Spacing-x5) 0;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import Alert from "@/components/TempDesignSystem/Alert"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./FnFNotAllowedAlert.module.css"
|
||||
|
||||
import { AlertTypeEnum } from "@/types/enums/alert"
|
||||
|
||||
export default async function FnFNotAllowedAlert() {
|
||||
const intl = await getIntl()
|
||||
|
||||
return (
|
||||
<div className={styles.fnfMain}>
|
||||
<Alert
|
||||
type={AlertTypeEnum.Warning}
|
||||
text={intl.formatMessage({
|
||||
defaultMessage:
|
||||
"The Friends & Family rate can only be booked via FUSE.",
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import stringify from "json-stable-stringify-without-jsonify"
|
||||
import { cookies } from "next/headers"
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { FamilyAndFriendsCodes, REDEMPTION } from "@/constants/booking"
|
||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import HotelInfoCard from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
||||
@@ -13,6 +14,7 @@ import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
||||
import { convertSearchParamsToObj } from "@/utils/url"
|
||||
|
||||
import AvailabilityError from "./AvailabilityError"
|
||||
import FnFNotAllowedAlert from "../FnFNotAllowedAlert/FnFNotAllowedAlert"
|
||||
import { getValidDates } from "./getValidDates"
|
||||
import { getTracking } from "./tracking"
|
||||
|
||||
@@ -73,17 +75,26 @@ export default async function SelectRatePage({
|
||||
|
||||
const booking = convertSearchParamsToObj<SelectRateSearchParams>(searchParams)
|
||||
|
||||
let isInValidFNF = false
|
||||
if (bookingCode && FamilyAndFriendsCodes.includes(bookingCode)) {
|
||||
const cookieStore = cookies()
|
||||
isInValidFNF = cookieStore.get("sc")?.value !== "1"
|
||||
}
|
||||
const suspenseKey = stringify(searchParams)
|
||||
return (
|
||||
<>
|
||||
<HotelInfoCard hotel={hotelData.hotel} />
|
||||
|
||||
<RoomsContainer
|
||||
booking={booking}
|
||||
hotelType={hotelData.hotel.hotelType}
|
||||
roomCategories={hotelData.roomCategories}
|
||||
vat={hotelData.hotel.vat}
|
||||
/>
|
||||
{isInValidFNF ? (
|
||||
<FnFNotAllowedAlert />
|
||||
) : (
|
||||
<RoomsContainer
|
||||
booking={booking}
|
||||
hotelType={hotelData.hotel.hotelType}
|
||||
roomCategories={hotelData.roomCategories}
|
||||
vat={hotelData.hotel.vat}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Suspense key={`${suspenseKey}-tracking`} fallback={null}>
|
||||
<TrackingSDK
|
||||
|
||||
Reference in New Issue
Block a user