Merged in fix/sw-3495-booking-flow-links-to-web (pull request #2837)
fix: (SW-3495): Update booking-flow links in partner-sas * Update links to scandic web in booking-flow * Fix routeToScandicWeb util function Approved-by: Hrishikesh Vaipurkar
This commit is contained in:
@@ -11,6 +11,10 @@ import { SessionProvider } from "next-auth/react"
|
|||||||
import { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlowConfig"
|
import { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlowConfig"
|
||||||
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs"
|
||||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
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 { ToastHandler } from "@scandic-hotels/design-system/ToastHandler"
|
||||||
|
|
||||||
import AdobeSDKScript from "@/components/AdobeSDKScript"
|
import AdobeSDKScript from "@/components/AdobeSDKScript"
|
||||||
@@ -28,11 +32,12 @@ import { BookingFlowProviders } from "../../components/BookingFlowProviders"
|
|||||||
import { Footer } from "../../components/Footer/Footer"
|
import { Footer } from "../../components/Footer/Footer"
|
||||||
import { Header } from "../../components/Header/Header"
|
import { Header } from "../../components/Header/Header"
|
||||||
|
|
||||||
|
import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
|
||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "SAS by Scandic Hotels",
|
title: "SAS by Scandic Hotels",
|
||||||
description: "This text should be updated.",
|
description: "TODO This text should be updated.",
|
||||||
}
|
}
|
||||||
|
|
||||||
type LangParams = {
|
type LangParams = {
|
||||||
@@ -45,8 +50,6 @@ type RootLayoutProps = {
|
|||||||
bookingwidget: React.ReactNode
|
bookingwidget: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
const bookingFlowConfig = { bookingCodeEnabled: false } as const
|
|
||||||
|
|
||||||
export default async function RootLayout(props: RootLayoutProps) {
|
export default async function RootLayout(props: RootLayoutProps) {
|
||||||
const params = await props.params
|
const params = await props.params
|
||||||
const lang = params.lang
|
const lang = params.lang
|
||||||
@@ -56,6 +59,18 @@ export default async function RootLayout(props: RootLayoutProps) {
|
|||||||
const parsedLanguage = setLang(lang)
|
const parsedLanguage = setLang(lang)
|
||||||
const messages = await getMessages(parsedLanguage)
|
const messages = await getMessages(parsedLanguage)
|
||||||
|
|
||||||
|
const bookingFlowConfig: BookingFlowConfig = {
|
||||||
|
bookingCodeEnabled: false,
|
||||||
|
routes: {
|
||||||
|
myStay: routeToScandicWeb(myStay),
|
||||||
|
bookingTermsAndConditions: routeToScandicWeb(
|
||||||
|
bookingTermsAndConditionsRoutes
|
||||||
|
),
|
||||||
|
customerService: routeToScandicWeb(customerService),
|
||||||
|
privacyPolicy: routeToScandicWeb(privacyPolicyRoutes),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@@ -112,3 +127,11 @@ export default async function RootLayout(props: RootLayoutProps) {
|
|||||||
</html>
|
</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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,8 +4,16 @@ import { cache } from "react"
|
|||||||
|
|
||||||
import { BookingFlowConfigContextProvider } from "./bookingFlowConfigContext"
|
import { BookingFlowConfigContextProvider } from "./bookingFlowConfigContext"
|
||||||
|
|
||||||
|
import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute"
|
||||||
|
|
||||||
export type BookingFlowConfig = {
|
export type BookingFlowConfig = {
|
||||||
bookingCodeEnabled: boolean
|
bookingCodeEnabled: boolean
|
||||||
|
routes: {
|
||||||
|
myStay: LangRoute
|
||||||
|
bookingTermsAndConditions: LangRoute
|
||||||
|
customerService: LangRoute
|
||||||
|
privacyPolicy: LangRoute
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRef = cache(() => ({
|
const getRef = cache(() => ({
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import { createContext, useContext } from "react"
|
|||||||
|
|
||||||
import type { BookingFlowConfig } from "./bookingFlowConfig"
|
import type { BookingFlowConfig } from "./bookingFlowConfig"
|
||||||
|
|
||||||
type BookingFlowConfigContextData = {
|
type BookingFlowConfigContextData = BookingFlowConfig
|
||||||
config: BookingFlowConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
const BookingFlowConfigContext = createContext<
|
const BookingFlowConfigContext = createContext<
|
||||||
BookingFlowConfigContextData | undefined
|
BookingFlowConfigContextData | undefined
|
||||||
@@ -32,7 +30,7 @@ export function BookingFlowConfigContextProvider({
|
|||||||
config: BookingFlowConfig
|
config: BookingFlowConfig
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<BookingFlowConfigContext.Provider value={{ config }}>
|
<BookingFlowConfigContext.Provider value={config}>
|
||||||
{children}
|
{children}
|
||||||
</BookingFlowConfigContext.Provider>
|
</BookingFlowConfigContext.Provider>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
|
|
||||||
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
|
|
||||||
|
import { useBookingFlowConfig } from "../../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||||
import useLang from "../../../../hooks/useLang"
|
import useLang from "../../../../hooks/useLang"
|
||||||
|
|
||||||
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
|
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
|
||||||
@@ -18,6 +18,7 @@ type ManageBookingProps = Pick<BookingConfirmation, "booking">
|
|||||||
export default function ManageBooking({ booking }: ManageBookingProps) {
|
export default function ManageBooking({ booking }: ManageBookingProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const { routes } = useBookingFlowConfig()
|
||||||
|
|
||||||
const { refId, confirmationNumber } = booking
|
const { refId, confirmationNumber } = booking
|
||||||
const { email, firstName, lastName } = booking.guest
|
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`
|
document.cookie = `bv=${JSON.stringify(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
|
||||||
}, [confirmationNumber, email, firstName, lastName])
|
}, [confirmationNumber, email, firstName, lastName])
|
||||||
|
|
||||||
const myStayURL = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
const myStayURL = `${routes.myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonLink
|
<ButtonLink
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
|
import { useBookingFlowConfig } from "../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||||
|
|
||||||
import useLang from "../../../hooks/useLang"
|
import useLang from "../../../hooks/useLang"
|
||||||
import { Promo } from "./Promo"
|
import { Promo } from "./Promo"
|
||||||
|
|
||||||
@@ -18,6 +17,8 @@ type PromosProps = Pick<BookingConfirmation, "booking">
|
|||||||
export function Promos({ booking }: PromosProps) {
|
export function Promos({ booking }: PromosProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const { routes } = useBookingFlowConfig()
|
||||||
|
|
||||||
const { refId, confirmationNumber, hotelId } = booking
|
const { refId, confirmationNumber, hotelId } = booking
|
||||||
const { email, firstName, lastName } = booking.guest
|
const { email, firstName, lastName } = booking.guest
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -31,7 +32,7 @@ export function Promos({ booking }: PromosProps) {
|
|||||||
document.cookie = `bv=${JSON.stringify(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
|
document.cookie = `bv=${JSON.stringify(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict`
|
||||||
}, [confirmationNumber, email, firstName, lastName])
|
}, [confirmationNumber, email, firstName, lastName])
|
||||||
|
|
||||||
const myStayURL = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
const myStayURL = `${routes.myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
||||||
return (
|
return (
|
||||||
<div className={styles.promos}>
|
<div className={styles.promos}>
|
||||||
<Promo
|
<Promo
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import RewardNight from "../RewardNight"
|
|||||||
import styles from "./voucher.module.css"
|
import styles from "./voucher.module.css"
|
||||||
|
|
||||||
export default function Voucher() {
|
export default function Voucher() {
|
||||||
const { config } = useBookingFlowConfig()
|
const config = useBookingFlowConfig()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.optionsContainer}>
|
<div className={styles.optionsContainer}>
|
||||||
@@ -28,7 +28,7 @@ export default function Voucher() {
|
|||||||
|
|
||||||
export function VoucherSkeleton() {
|
export function VoucherSkeleton() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const { config } = useBookingFlowConfig()
|
const config = useBookingFlowConfig()
|
||||||
|
|
||||||
const vouchers = intl.formatMessage({
|
const vouchers = intl.formatMessage({
|
||||||
defaultMessage: "Code / Voucher",
|
defaultMessage: "Code / Voucher",
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { customerService } from "@scandic-hotels/common/constants/routes/customerService"
|
|
||||||
import Body from "@scandic-hotels/design-system/Body"
|
import Body from "@scandic-hotels/design-system/Body"
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
|
import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
|
||||||
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||||
|
|
||||||
|
import { useBookingFlowConfig } from "../../../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||||
import useLang from "../../../../../hooks/useLang"
|
import useLang from "../../../../../hooks/useLang"
|
||||||
|
|
||||||
import styles from "./timeoutSpinner.module.css"
|
import styles from "./timeoutSpinner.module.css"
|
||||||
@@ -15,6 +15,7 @@ import styles from "./timeoutSpinner.module.css"
|
|||||||
export default function TimeoutSpinner() {
|
export default function TimeoutSpinner() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const { routes } = useBookingFlowConfig()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
@@ -33,7 +34,7 @@ export default function TimeoutSpinner() {
|
|||||||
{
|
{
|
||||||
link: (text) => (
|
link: (text) => (
|
||||||
<Link
|
<Link
|
||||||
href={customerService[lang]}
|
href={routes.customerService[lang]}
|
||||||
textDecoration="underline"
|
textDecoration="underline"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { useIntl } from "react-intl"
|
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 Caption from "@scandic-hotels/design-system/Caption"
|
||||||
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
|
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
|
||||||
import Link from "@scandic-hotels/design-system/Link"
|
import Link from "@scandic-hotels/design-system/Link"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
|
import { useBookingFlowConfig } from "../../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||||
import useLang from "../../../../hooks/useLang"
|
import useLang from "../../../../hooks/useLang"
|
||||||
import { paymentError } from "../schema"
|
import { paymentError } from "../schema"
|
||||||
|
|
||||||
@@ -20,6 +19,7 @@ export default function TermsAndConditions({
|
|||||||
}: TermsAndConditionsProps) {
|
}: TermsAndConditionsProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
const { routes } = useBookingFlowConfig()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -35,7 +35,7 @@ export default function TermsAndConditions({
|
|||||||
<Link
|
<Link
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
textDecoration="underline"
|
textDecoration="underline"
|
||||||
href={bookingTermsAndConditionsRoutes[lang]}
|
href={routes.bookingTermsAndConditions[lang]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -47,7 +47,7 @@ export default function TermsAndConditions({
|
|||||||
<Link
|
<Link
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
textDecoration="underline"
|
textDecoration="underline"
|
||||||
href={privacyPolicyRoutes[lang]}
|
href={routes.privacyPolicy[lang]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -67,7 +67,7 @@ export default function TermsAndConditions({
|
|||||||
<Link
|
<Link
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
textDecoration="underline"
|
textDecoration="underline"
|
||||||
href={bookingTermsAndConditionsRoutes[lang]}
|
href={routes.bookingTermsAndConditions[lang]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -79,7 +79,7 @@ export default function TermsAndConditions({
|
|||||||
<Link
|
<Link
|
||||||
className={styles.link}
|
className={styles.link}
|
||||||
textDecoration="underline"
|
textDecoration="underline"
|
||||||
href={privacyPolicyRoutes[lang]}
|
href={routes.privacyPolicy[lang]}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
Reference in New Issue
Block a user