From c069b7cd9d6c4d75a840d7104f8ac3ca001b541a Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Tue, 8 Apr 2025 12:03:04 +0000 Subject: [PATCH] Merged in fix/SW-2222-next-stay-url-handling (pull request #1756) fix(SW-2222): update next stay url to use PUBLIC_URL and adapt based on release flag * fix(SW-2222): update next stay url to use PUBLIC_URL and adapt based on release flag * refactor(SW-2222): change promoUrl variable to const Approved-by: Michael Zetterberg Approved-by: Christian Andolf --- .../components/HotelReservation/MyStay/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx index 649463675..925d36682 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx @@ -3,7 +3,6 @@ import { notFound } from "next/navigation" import { Typography } from "@scandic-hotels/design-system/Typography" -import { homeHrefs } from "@/constants/homeHrefs" import { env } from "@/env/server" import { dt } from "@/lib/dt" import { @@ -18,6 +17,7 @@ import { decrypt } from "@/server/routers/utils/encryption" import Image from "@/components/Image" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" +import { getCurrentWebUrl } from "@/utils/url" import AdditionalInfoForm from "../FindMyBooking/AdditionalInfoForm" import accessBooking, { @@ -86,6 +86,13 @@ export async function MyStay({ refId }: { refId: string }) { additionalData.gallery?.heroImages[0]?.imageSizes.large ?? hotel.galleryImages[0]?.imageSizes.large + const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" + const promoUrl = env.HIDE_FOR_NEXT_RELEASE + ? new URL(getCurrentWebUrl("/", lang)) + : new URL(`${baseUrl}/${lang}/`) + + promoUrl.searchParams.set("hotel", hotel.operaId) + return (
@@ -131,7 +138,7 @@ export async function MyStay({ refId }: { refId: string }) { id: "Get inspired and start dreaming beyond your next trip. Explore more Scandic destinations.", })} buttonText={intl.formatMessage({ id: "Explore Scandic hotels" })} - href={`${homeHrefs[env.NODE_ENV][lang]}?hotel=${hotel.operaId}`} + href={promoUrl.toString()} image={hotel.hotelContent.images} />