diff --git a/apps/partner-sas/app/[lang]/layout.tsx b/apps/partner-sas/app/[lang]/layout.tsx
index 4f76be8e5..82bf6fae6 100644
--- a/apps/partner-sas/app/[lang]/layout.tsx
+++ b/apps/partner-sas/app/[lang]/layout.tsx
@@ -11,6 +11,10 @@ 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"
@@ -28,11 +32,12 @@ import { BookingFlowProviders } from "../../components/BookingFlowProviders"
import { Footer } from "../../components/Footer/Footer"
import { Header } from "../../components/Header/Header"
+import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
import type { Metadata } from "next"
export const metadata: Metadata = {
title: "SAS by Scandic Hotels",
- description: "This text should be updated.",
+ description: "TODO This text should be updated.",
}
type LangParams = {
@@ -45,8 +50,6 @@ type RootLayoutProps = {
bookingwidget: React.ReactNode
}
-const bookingFlowConfig = { bookingCodeEnabled: false } as const
-
export default async function RootLayout(props: RootLayoutProps) {
const params = await props.params
const lang = params.lang
@@ -56,6 +59,18 @@ export default async function RootLayout(props: RootLayoutProps) {
const parsedLanguage = setLang(lang)
const messages = await getMessages(parsedLanguage)
+ const bookingFlowConfig: BookingFlowConfig = {
+ bookingCodeEnabled: false,
+ routes: {
+ myStay: routeToScandicWeb(myStay),
+ bookingTermsAndConditions: routeToScandicWeb(
+ bookingTermsAndConditionsRoutes
+ ),
+ customerService: routeToScandicWeb(customerService),
+ privacyPolicy: routeToScandicWeb(privacyPolicyRoutes),
+ },
+ }
+
return (
@@ -112,3 +127,11 @@ export default async function RootLayout(props: RootLayoutProps) {
)
}
+
+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)
+}
diff --git a/apps/scandic-web/constants/bookingFlowConfig.ts b/apps/scandic-web/constants/bookingFlowConfig.ts
index e2fc18555..d534bda42 100644
--- a/apps/scandic-web/constants/bookingFlowConfig.ts
+++ b/apps/scandic-web/constants/bookingFlowConfig.ts
@@ -1 +1,16 @@
-export const bookingFlowConfig = { bookingCodeEnabled: true } as const
+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 type { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlowConfig"
+
+export const bookingFlowConfig: BookingFlowConfig = {
+ bookingCodeEnabled: true,
+ routes: {
+ myStay,
+ customerService,
+ bookingTermsAndConditions: bookingTermsAndConditionsRoutes,
+ privacyPolicy: privacyPolicyRoutes,
+ },
+}
diff --git a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx
index d80cf64dd..18ba31e1c 100644
--- a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx
+++ b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx
@@ -4,8 +4,16 @@ import { cache } from "react"
import { BookingFlowConfigContextProvider } from "./bookingFlowConfigContext"
+import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
+
export type BookingFlowConfig = {
bookingCodeEnabled: boolean
+ routes: {
+ myStay: LangRoute
+ bookingTermsAndConditions: LangRoute
+ customerService: LangRoute
+ privacyPolicy: LangRoute
+ }
}
const getRef = cache(() => ({
diff --git a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfigContext.tsx b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfigContext.tsx
index 1c4eb8ad6..437fcc64d 100644
--- a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfigContext.tsx
+++ b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfigContext.tsx
@@ -4,9 +4,7 @@ import { createContext, useContext } from "react"
import type { BookingFlowConfig } from "./bookingFlowConfig"
-type BookingFlowConfigContextData = {
- config: BookingFlowConfig
-}
+type BookingFlowConfigContextData = BookingFlowConfig
const BookingFlowConfigContext = createContext<
BookingFlowConfigContextData | undefined
@@ -32,7 +30,7 @@ export function BookingFlowConfigContextProvider({
config: BookingFlowConfig
}) {
return (
-
+
{children}
)
diff --git a/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx b/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx
index 88d709123..1c6bff65c 100644
--- a/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx
+++ b/packages/booking-flow/lib/components/BookingConfirmation/Header/Actions/ManageBooking.tsx
@@ -3,10 +3,10 @@
import { useEffect } from "react"
import { useIntl } from "react-intl"
-import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
+import { useBookingFlowConfig } from "../../../../bookingFlowConfig/bookingFlowConfigContext"
import useLang from "../../../../hooks/useLang"
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
@@ -18,6 +18,7 @@ type ManageBookingProps = Pick
export default function ManageBooking({ booking }: ManageBookingProps) {
const intl = useIntl()
const lang = useLang()
+ const { routes } = useBookingFlowConfig()
const { refId, confirmationNumber } = booking
const { email, firstName, lastName } = booking.guest
@@ -32,7 +33,7 @@ export default function ManageBooking({ booking }: ManageBookingProps) {
document.cookie = `bv=${JSON.stringify(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
}, [confirmationNumber, email, firstName, lastName])
- const myStayURL = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
+ const myStayURL = `${routes.myStay[lang]}?RefId=${encodeURIComponent(refId)}`
return (
export function Promos({ booking }: PromosProps) {
const intl = useIntl()
const lang = useLang()
+ const { routes } = useBookingFlowConfig()
+
const { refId, confirmationNumber, hotelId } = booking
const { email, firstName, lastName } = booking.guest
useEffect(() => {
@@ -31,7 +32,7 @@ export function Promos({ booking }: PromosProps) {
document.cookie = `bv=${JSON.stringify(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
}, [confirmationNumber, email, firstName, lastName])
- const myStayURL = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
+ const myStayURL = `${routes.myStay[lang]}?RefId=${encodeURIComponent(refId)}`
return (
@@ -28,7 +28,7 @@ export default function Voucher() {
export function VoucherSkeleton() {
const intl = useIntl()
- const { config } = useBookingFlowConfig()
+ const config = useBookingFlowConfig()
const vouchers = intl.formatMessage({
defaultMessage: "Code / Voucher",
diff --git a/packages/booking-flow/lib/components/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/index.tsx
index f74157848..304263801 100644
--- a/packages/booking-flow/lib/components/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/index.tsx
+++ b/packages/booking-flow/lib/components/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/index.tsx
@@ -2,12 +2,12 @@
import { useIntl } from "react-intl"
-import { customerService } from "@scandic-hotels/common/constants/routes/customerService"
import Body from "@scandic-hotels/design-system/Body"
import Link from "@scandic-hotels/design-system/Link"
import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
import Subtitle from "@scandic-hotels/design-system/Subtitle"
+import { useBookingFlowConfig } from "../../../../../bookingFlowConfig/bookingFlowConfigContext"
import useLang from "../../../../../hooks/useLang"
import styles from "./timeoutSpinner.module.css"
@@ -15,6 +15,7 @@ import styles from "./timeoutSpinner.module.css"
export default function TimeoutSpinner() {
const intl = useIntl()
const lang = useLang()
+ const { routes } = useBookingFlowConfig()
return (
@@ -33,7 +34,7 @@ export default function TimeoutSpinner() {
{
link: (text) => (
diff --git a/packages/booking-flow/lib/components/EnterDetails/Payment/TermsAndConditions/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Payment/TermsAndConditions/index.tsx
index bb88c4e35..3e4e1688b 100644
--- a/packages/booking-flow/lib/components/EnterDetails/Payment/TermsAndConditions/index.tsx
+++ b/packages/booking-flow/lib/components/EnterDetails/Payment/TermsAndConditions/index.tsx
@@ -1,12 +1,11 @@
import { useIntl } from "react-intl"
-import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes"
-import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes"
import Caption from "@scandic-hotels/design-system/Caption"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import Link from "@scandic-hotels/design-system/Link"
import { Typography } from "@scandic-hotels/design-system/Typography"
+import { useBookingFlowConfig } from "../../../../bookingFlowConfig/bookingFlowConfigContext"
import useLang from "../../../../hooks/useLang"
import { paymentError } from "../schema"
@@ -20,6 +19,7 @@ export default function TermsAndConditions({
}: TermsAndConditionsProps) {
const intl = useIntl()
const lang = useLang()
+ const { routes } = useBookingFlowConfig()
return (
<>
@@ -35,7 +35,7 @@ export default function TermsAndConditions({