Merged in fix/sw-3551-rsc-bookingflowconfig (pull request #2988)
fix(SW-3551): Fix issue with BookingConfigProvider in RSC * wip move config to pages * Move config providing to pages
This commit is contained in:
@@ -8,13 +8,8 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import Script from "next/script"
|
||||
import { SessionProvider } from "next-auth/react"
|
||||
|
||||
import { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlowConfig"
|
||||
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes"
|
||||
import { customerService } from "@scandic-hotels/common/constants/routes/customerService"
|
||||
import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
|
||||
import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes"
|
||||
import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler"
|
||||
|
||||
import AdobeSDKScript from "@/components/AdobeSDKScript"
|
||||
@@ -34,8 +29,6 @@ import { Footer } from "../../components/Footer/Footer"
|
||||
import { Header } from "../../components/Header/Header"
|
||||
import { SocialLoginProvider } from "./(auth)/SocialLogin"
|
||||
|
||||
import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
|
||||
|
||||
type LangParams = {
|
||||
lang: Lang
|
||||
}
|
||||
@@ -55,20 +48,6 @@ export default async function RootLayout(props: RootLayoutProps) {
|
||||
const parsedLanguage = setLang(lang)
|
||||
const messages = await getMessages(parsedLanguage)
|
||||
|
||||
const bookingFlowConfig: BookingFlowConfig = {
|
||||
bookingCodeEnabled: false,
|
||||
enterDetailsMembershipIdInputLocation: "join-card",
|
||||
variant: "partner-sas",
|
||||
routes: {
|
||||
myStay: routeToScandicWeb(myStay),
|
||||
bookingTermsAndConditions: routeToScandicWeb(
|
||||
bookingTermsAndConditionsRoutes
|
||||
),
|
||||
customerService: routeToScandicWeb(customerService),
|
||||
privacyPolicy: routeToScandicWeb(privacyPolicyRoutes),
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<html lang={lang}>
|
||||
<head>
|
||||
@@ -93,19 +72,17 @@ export default async function RootLayout(props: RootLayoutProps) {
|
||||
<TrpcProvider>
|
||||
<SocialLoginProvider>
|
||||
<RACRouterProvider>
|
||||
<BookingFlowConfig config={bookingFlowConfig}>
|
||||
<BookingFlowProviders>
|
||||
<RouteChange />
|
||||
<SiteWideAlert />
|
||||
<Header />
|
||||
{props.bookingwidget}
|
||||
<main>{children}</main>
|
||||
<Footer />
|
||||
<ToastHandler />
|
||||
<CookieBotConsent />
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</BookingFlowProviders>
|
||||
</BookingFlowConfig>
|
||||
<BookingFlowProviders>
|
||||
<RouteChange />
|
||||
<SiteWideAlert />
|
||||
<Header />
|
||||
{props.bookingwidget}
|
||||
<main>{children}</main>
|
||||
<Footer />
|
||||
<ToastHandler />
|
||||
<CookieBotConsent />
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</BookingFlowProviders>
|
||||
</RACRouterProvider>
|
||||
</SocialLoginProvider>
|
||||
</TrpcProvider>
|
||||
@@ -127,11 +104,3 @@ export default async function RootLayout(props: RootLayoutProps) {
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
function routeToScandicWeb(route: LangRoute) {
|
||||
const url = `https://www.scandichotels.com`
|
||||
return Object.entries(route).reduce((acc, [key, value]) => {
|
||||
acc[key as Lang] = `${url}${value}`
|
||||
return acc
|
||||
}, {} as LangRoute)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user