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:
@@ -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(() => ({
|
||||
|
||||
@@ -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 (
|
||||
<BookingFlowConfigContext.Provider value={{ config }}>
|
||||
<BookingFlowConfigContext.Provider value={config}>
|
||||
{children}
|
||||
</BookingFlowConfigContext.Provider>
|
||||
)
|
||||
|
||||
@@ -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<BookingConfirmation, "booking">
|
||||
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 (
|
||||
<ButtonLink
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
import { useEffect } from "react"
|
||||
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 { Promo } from "./Promo"
|
||||
|
||||
@@ -18,6 +17,8 @@ type PromosProps = Pick<BookingConfirmation, "booking">
|
||||
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 (
|
||||
<div className={styles.promos}>
|
||||
<Promo
|
||||
|
||||
@@ -12,7 +12,7 @@ import RewardNight from "../RewardNight"
|
||||
import styles from "./voucher.module.css"
|
||||
|
||||
export default function Voucher() {
|
||||
const { config } = useBookingFlowConfig()
|
||||
const config = useBookingFlowConfig()
|
||||
|
||||
return (
|
||||
<div className={styles.optionsContainer}>
|
||||
@@ -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",
|
||||
|
||||
@@ -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 (
|
||||
<div className={styles.container}>
|
||||
@@ -33,7 +34,7 @@ export default function TimeoutSpinner() {
|
||||
{
|
||||
link: (text) => (
|
||||
<Link
|
||||
href={customerService[lang]}
|
||||
href={routes.customerService[lang]}
|
||||
textDecoration="underline"
|
||||
target="_blank"
|
||||
>
|
||||
|
||||
@@ -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({
|
||||
<Link
|
||||
className={styles.link}
|
||||
textDecoration="underline"
|
||||
href={bookingTermsAndConditionsRoutes[lang]}
|
||||
href={routes.bookingTermsAndConditions[lang]}
|
||||
target="_blank"
|
||||
weight="bold"
|
||||
size="small"
|
||||
@@ -47,7 +47,7 @@ export default function TermsAndConditions({
|
||||
<Link
|
||||
className={styles.link}
|
||||
textDecoration="underline"
|
||||
href={privacyPolicyRoutes[lang]}
|
||||
href={routes.privacyPolicy[lang]}
|
||||
target="_blank"
|
||||
weight="bold"
|
||||
size="small"
|
||||
@@ -67,7 +67,7 @@ export default function TermsAndConditions({
|
||||
<Link
|
||||
className={styles.link}
|
||||
textDecoration="underline"
|
||||
href={bookingTermsAndConditionsRoutes[lang]}
|
||||
href={routes.bookingTermsAndConditions[lang]}
|
||||
target="_blank"
|
||||
weight="bold"
|
||||
size="small"
|
||||
@@ -79,7 +79,7 @@ export default function TermsAndConditions({
|
||||
<Link
|
||||
className={styles.link}
|
||||
textDecoration="underline"
|
||||
href={privacyPolicyRoutes[lang]}
|
||||
href={routes.privacyPolicy[lang]}
|
||||
target="_blank"
|
||||
weight="bold"
|
||||
size="small"
|
||||
|
||||
Reference in New Issue
Block a user