diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Confirmation/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Confirmation/index.tsx index 88b99038c..fc68de76e 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Confirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Confirmation/index.tsx @@ -1,4 +1,5 @@ "use client" + import { useRef } from "react" import Header from "@/components/HotelReservation/BookingConfirmation/Header" @@ -11,13 +12,12 @@ export default function Confirmation({ booking, hotel, children, - refId, }: React.PropsWithChildren) { const mainRef = useRef(null) return (
-
+
{children}
) diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx index 28a81406d..b8766c386 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx @@ -1,15 +1,36 @@ "use client" + +import { useEffect } from "react" import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { myStay } from "@/constants/routes/myStay" + import Button from "@/components/TempDesignSystem/Button" import Link from "@/components/TempDesignSystem/Link" +import useLang from "@/hooks/useLang" import type { ManageBookingProps } from "@/types/components/hotelReservation/bookingConfirmation/actions/manageBooking" -export default function ManageBooking({ bookingUrl }: ManageBookingProps) { +export default function ManageBooking({ booking }: ManageBookingProps) { const intl = useIntl() + const lang = useLang() + + const { refId, confirmationNumber } = booking + const { email, firstName, lastName } = booking.guest + useEffect(() => { + // Setting the `bv` cookie allows direct access to My stay without prompting for more information. + const value = new URLSearchParams({ + email, + firstName, + lastName, + confirmationNumber, + }).toString() + document.cookie = `bv=${encodeURIComponent(value)}; Path=/; Max-Age=600; Secure; SameSite=Strict` + }, [confirmationNumber, email, firstName, lastName]) + + const myStayURL = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}` return (