Merged in chore/move-enter-details (pull request #2778)
Chore/move enter details Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import Image from "@scandic-hotels/design-system/Image"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Blocks from "@/components/Blocks"
|
||||
import SectionHeader from "@/components/Section/Header"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
|
||||
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Form from "@/components/Forms/Edit/Profile"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import Profile from "@/components/MyPages/Profile"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/booking"
|
||||
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
||||
import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/booking"
|
||||
import { HandleErrorCallback } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/HandleErrorCallback"
|
||||
import { HandleSuccessCallback } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback"
|
||||
import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
||||
import {
|
||||
bookingConfirmation,
|
||||
details,
|
||||
@@ -15,8 +17,6 @@ import { isValidSession } from "@scandic-hotels/trpc/utils/session"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import HandleErrorCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleErrorCallback"
|
||||
import HandleSuccessCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback"
|
||||
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AlternativeHotelsMapPage as AlternativeHotelsMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsMapPage"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
@@ -18,12 +17,6 @@ export default async function AlternativeHotelsMapPage(
|
||||
<AlternativeHotelsMapPagePrimitive
|
||||
lang={lang}
|
||||
searchParams={searchParams}
|
||||
renderTracking={(props) => (
|
||||
<TrackingSDK
|
||||
hotelInfo={props.hotelsTrackingData}
|
||||
pageData={props.pageTrackingData}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AlternativeHotelsPage as AlternativeHotelsPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsPage"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import {
|
||||
@@ -14,17 +13,7 @@ export default async function AlternativeHotelsPage(
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const lang = await getLang()
|
||||
|
||||
return (
|
||||
<AlternativeHotelsPagePrimitive
|
||||
lang={lang}
|
||||
searchParams={searchParams}
|
||||
renderTracking={(props) => (
|
||||
<TrackingSDK
|
||||
hotelInfo={props.hotelsTrackingData}
|
||||
pageData={props.pageTrackingData}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<AlternativeHotelsPagePrimitive lang={lang} searchParams={searchParams} />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
.container {
|
||||
display: grid;
|
||||
gap: var(--Spacing-x3) var(--Spacing-x9);
|
||||
}
|
||||
|
||||
.content {
|
||||
width: var(--max-width-page);
|
||||
margin: var(--Spacing-x3) auto 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Spacing-x4);
|
||||
}
|
||||
|
||||
.header {
|
||||
padding-bottom: var(--Spacing-x3);
|
||||
}
|
||||
|
||||
.summary {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1367px) {
|
||||
.container {
|
||||
grid-template-columns: 1fr 340px;
|
||||
grid-template-rows: auto 1fr;
|
||||
width: var(--max-width-page);
|
||||
margin: var(--Spacing-x5) auto 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
margin: var(--Spacing-x3) 0 0;
|
||||
}
|
||||
|
||||
.summary {
|
||||
position: static;
|
||||
display: grid;
|
||||
grid-column: 2/3;
|
||||
grid-row: 1/-1;
|
||||
z-index: unset;
|
||||
}
|
||||
}
|
||||
@@ -1,167 +1,12 @@
|
||||
import { cookies } from "next/headers"
|
||||
import { notFound } from "next/navigation"
|
||||
import { Suspense } from "react"
|
||||
|
||||
import FnFNotAllowedAlert from "@scandic-hotels/booking-flow/components/FnFNotAllowedAlert"
|
||||
import { parseDetailsSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
|
||||
|
||||
import {
|
||||
getBreakfastPackages,
|
||||
getHotel,
|
||||
getProfileSafely,
|
||||
getSelectedRoomsAvailabilityEnterDetails,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import HotelHeader from "@/components/HotelReservation/EnterDetails/Header"
|
||||
import Payment from "@/components/HotelReservation/EnterDetails/Payment"
|
||||
import Multiroom from "@/components/HotelReservation/EnterDetails/Room/Multiroom"
|
||||
import RoomOne from "@/components/HotelReservation/EnterDetails/Room/One"
|
||||
import DesktopSummary from "@/components/HotelReservation/EnterDetails/Summary/Desktop"
|
||||
import MobileSummary from "@/components/HotelReservation/EnterDetails/Summary/Mobile"
|
||||
import EnterDetailsTrackingWrapper from "@/components/HotelReservation/EnterDetails/Tracking"
|
||||
import RoomProvider from "@/providers/Details/RoomProvider"
|
||||
import EnterDetailsProvider from "@/providers/EnterDetailsProvider"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
import { EnterDetailsPage as EnterDetailsPagePrimitive } from "@scandic-hotels/booking-flow/pages/EnterDetailsPage"
|
||||
|
||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||
|
||||
export default async function DetailsPage(
|
||||
props: PageArgs<LangParams, NextSearchParams>
|
||||
) {
|
||||
const { lang } = await props.params
|
||||
const searchParams = await props.searchParams
|
||||
const params = await props.params
|
||||
|
||||
const { lang } = params
|
||||
|
||||
const selectRoomParams = new URLSearchParams(searchParams)
|
||||
|
||||
const booking = parseDetailsSearchParams(searchParams)
|
||||
|
||||
if (!booking) return notFound()
|
||||
|
||||
if (selectRoomParams.has("activeRoomIndex")) {
|
||||
selectRoomParams.delete("activeRoomIndex")
|
||||
}
|
||||
|
||||
if (
|
||||
booking.bookingCode &&
|
||||
FamilyAndFriendsCodes.includes(booking.bookingCode)
|
||||
) {
|
||||
const cookieStore = await cookies()
|
||||
const isInValidFNF = cookieStore.get("sc")?.value !== "1"
|
||||
|
||||
if (isInValidFNF) {
|
||||
return <FnFNotAllowedAlert />
|
||||
}
|
||||
}
|
||||
|
||||
const breakfastInput = {
|
||||
adults: 1,
|
||||
fromDate: booking.fromDate,
|
||||
hotelId: booking.hotelId,
|
||||
toDate: booking.toDate,
|
||||
}
|
||||
const hotelInput = {
|
||||
hotelId: booking.hotelId,
|
||||
// TODO: Remove this from input since it forces
|
||||
// waterfalls for no other reason than to
|
||||
// set merchantInformationData.alternatePaymentOptions
|
||||
// to an empty array
|
||||
isCardOnlyPayment: false,
|
||||
language: lang,
|
||||
}
|
||||
void getHotel(hotelInput)
|
||||
void getBreakfastPackages(breakfastInput)
|
||||
void getProfileSafely()
|
||||
|
||||
const rooms = await getSelectedRoomsAvailabilityEnterDetails({
|
||||
booking,
|
||||
lang,
|
||||
})
|
||||
|
||||
const hotelData = await getHotel(hotelInput)
|
||||
|
||||
if (!hotelData || !rooms.length) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const breakfastPackages = await getBreakfastPackages(breakfastInput)
|
||||
const user = await getProfileSafely()
|
||||
|
||||
const isCardOnlyPayment = rooms.some((room) => room.mustBeGuaranteed)
|
||||
const { hotel } = hotelData
|
||||
// TODO: Temp fix to avoid waterfall fetch and moving this
|
||||
// logic from the route here for now
|
||||
if (isCardOnlyPayment) {
|
||||
hotel.merchantInformationData.alternatePaymentOptions = []
|
||||
}
|
||||
|
||||
const firstRoom = rooms[0]
|
||||
const multirooms = rooms.slice(1)
|
||||
|
||||
const { rateDefinition, rateDefinitionMember } = firstRoom.roomRate
|
||||
if (user && rateDefinitionMember) {
|
||||
const rateCode = selectRoomParams.get("room[0].ratecode")
|
||||
if (rateDefinitionMember.rateCode !== rateCode) {
|
||||
booking.rooms[0].rateCode = rateDefinitionMember.rateCode
|
||||
selectRoomParams.set("room[0].ratecode", rateDefinitionMember.rateCode)
|
||||
booking.rooms[0].counterRateCode = rateDefinition.rateCode
|
||||
selectRoomParams.set("room[0].counterratecode", rateDefinition.rateCode)
|
||||
}
|
||||
}
|
||||
|
||||
// attribute data-footer-spacing used to add spacing
|
||||
// beneath footer to be able to show entire footer upon
|
||||
// scrolling down to the bottom of the page
|
||||
return (
|
||||
<main data-footer-spacing>
|
||||
<EnterDetailsProvider
|
||||
booking={booking}
|
||||
breakfastPackages={breakfastPackages}
|
||||
lang={lang}
|
||||
rooms={rooms}
|
||||
searchParamsStr={selectRoomParams.toString()}
|
||||
user={user}
|
||||
vat={hotel.vat}
|
||||
roomCategories={hotelData.roomCategories}
|
||||
>
|
||||
<HotelHeader hotelData={hotelData} />
|
||||
<div className={styles.container}>
|
||||
<div className={styles.content}>
|
||||
<RoomProvider idx={0} room={firstRoom}>
|
||||
<RoomOne user={user} />
|
||||
</RoomProvider>
|
||||
{multirooms.map((room, idx) => (
|
||||
// Need to start idx from 1 since first room is
|
||||
// rendered above
|
||||
<RoomProvider key={idx + 1} idx={idx + 1} room={room}>
|
||||
<Multiroom />
|
||||
</RoomProvider>
|
||||
))}
|
||||
<Suspense>
|
||||
<Payment
|
||||
otherPaymentOptions={
|
||||
hotel.merchantInformationData.alternatePaymentOptions
|
||||
}
|
||||
supportedCards={hotel.merchantInformationData.cards}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
<aside className={styles.summary}>
|
||||
<MobileSummary isUserLoggedIn={!!user} />
|
||||
<DesktopSummary isUserLoggedIn={!!user} />
|
||||
</aside>
|
||||
</div>
|
||||
<EnterDetailsTrackingWrapper
|
||||
booking={booking}
|
||||
hotel={hotel}
|
||||
isMember={!!user}
|
||||
lang={lang}
|
||||
rooms={rooms}
|
||||
/>
|
||||
</EnterDetailsProvider>
|
||||
</main>
|
||||
)
|
||||
return <EnterDetailsPagePrimitive lang={lang} searchParams={searchParams} />
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@scandic-hotels/common/tracking/types"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
} from "@scandic-hotels/tracking/types"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SelectHotelMapPage as SelectHotelMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelMapPage"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
@@ -15,16 +14,7 @@ export default async function SelectHotelMapPage(
|
||||
|
||||
return (
|
||||
<div className={styles.main}>
|
||||
<SelectHotelMapPagePrimitive
|
||||
lang={lang}
|
||||
searchParams={searchParams}
|
||||
renderTracking={(props) => (
|
||||
<TrackingSDK
|
||||
hotelInfo={props.hotelsTrackingData}
|
||||
pageData={props.pageTrackingData}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<SelectHotelMapPagePrimitive lang={lang} searchParams={searchParams} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SelectHotelPage as SelectHotelPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelPage"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||
@@ -11,16 +10,5 @@ export default async function SelectHotelPage(
|
||||
const searchParams = await props.searchParams
|
||||
const lang = await getLang()
|
||||
|
||||
return (
|
||||
<SelectHotelPagePrimitive
|
||||
lang={lang}
|
||||
searchParams={searchParams}
|
||||
renderTracking={(props) => (
|
||||
<TrackingSDK
|
||||
hotelInfo={props.hotelsTrackingData}
|
||||
pageData={props.pageTrackingData}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
return <SelectHotelPagePrimitive lang={lang} searchParams={searchParams} />
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SelectRatePage as SelectRatePagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectRatePage"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import {
|
||||
@@ -15,16 +14,5 @@ export default async function SelectRatePage(
|
||||
const searchParams = await props.searchParams
|
||||
const lang = await getLang()
|
||||
|
||||
return (
|
||||
<SelectRatePagePrimitive
|
||||
lang={lang}
|
||||
searchParams={searchParams}
|
||||
renderTracking={(props) => (
|
||||
<TrackingSDK
|
||||
hotelInfo={props.hotelsTrackingData}
|
||||
pageData={props.pageTrackingData}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
return <SelectRatePagePrimitive lang={lang} searchParams={searchParams} />
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@scandic-hotels/common/tracking/types"
|
||||
} from "@scandic-hotels/tracking/types"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
export default async function Tracking() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import Script from "next/script"
|
||||
import { SessionProvider } from "next-auth/react"
|
||||
|
||||
import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner"
|
||||
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler"
|
||||
@@ -19,7 +20,6 @@ import { BookingFlowProviders } from "@/components/BookingFlowProviders"
|
||||
import CookieBotConsent from "@/components/CookieBot"
|
||||
import Footer from "@/components/Footer"
|
||||
import Header from "@/components/Header"
|
||||
import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner"
|
||||
import { RACRouterProvider } from "@/components/RACRouterProvider"
|
||||
import RouteChange from "@/components/RouteChange"
|
||||
import SitewideAlert from "@/components/SitewideAlert"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import Script from "next/script"
|
||||
import { SessionProvider } from "next-auth/react"
|
||||
|
||||
import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner"
|
||||
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler"
|
||||
@@ -16,7 +17,6 @@ import TrpcProvider from "@/lib/trpc/Provider"
|
||||
|
||||
import { SessionRefresher } from "@/components/Auth/TokenRefresher"
|
||||
import CookieBotConsent from "@/components/CookieBot"
|
||||
import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner"
|
||||
import RouteChange from "@/components/RouteChange"
|
||||
import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript"
|
||||
import GTMScript from "@/components/TrackingSDK/GTMScript"
|
||||
|
||||
@@ -7,6 +7,7 @@ import "@scandic-hotels/design-system/style.css"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import Script from "next/script"
|
||||
|
||||
import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner"
|
||||
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler"
|
||||
@@ -15,7 +16,6 @@ import TrpcProvider from "@/lib/trpc/Provider"
|
||||
|
||||
import TokenRefresher from "@/components/Auth/TokenRefresher"
|
||||
import CookieBotConsent from "@/components/CookieBot"
|
||||
import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner"
|
||||
import RouteChange from "@/components/RouteChange"
|
||||
import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript"
|
||||
import GTMScript from "@/components/TrackingSDK/GTMScript"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@scandic-hotels/common/tracking/types"
|
||||
} from "@scandic-hotels/tracking/types"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
export default async function Tracking() {
|
||||
|
||||
Reference in New Issue
Block a user