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
This commit is contained in:
@@ -3,7 +3,6 @@ import { notFound } from "next/navigation"
|
|||||||
|
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { homeHrefs } from "@/constants/homeHrefs"
|
|
||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { dt } from "@/lib/dt"
|
import { dt } from "@/lib/dt"
|
||||||
import {
|
import {
|
||||||
@@ -18,6 +17,7 @@ import { decrypt } from "@/server/routers/utils/encryption"
|
|||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
import { getCurrentWebUrl } from "@/utils/url"
|
||||||
|
|
||||||
import AdditionalInfoForm from "../FindMyBooking/AdditionalInfoForm"
|
import AdditionalInfoForm from "../FindMyBooking/AdditionalInfoForm"
|
||||||
import accessBooking, {
|
import accessBooking, {
|
||||||
@@ -86,6 +86,13 @@ export async function MyStay({ refId }: { refId: string }) {
|
|||||||
additionalData.gallery?.heroImages[0]?.imageSizes.large ??
|
additionalData.gallery?.heroImages[0]?.imageSizes.large ??
|
||||||
hotel.galleryImages[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 (
|
return (
|
||||||
<main className={styles.main}>
|
<main className={styles.main}>
|
||||||
<div className={styles.imageContainer}>
|
<div className={styles.imageContainer}>
|
||||||
@@ -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.",
|
id: "Get inspired and start dreaming beyond your next trip. Explore more Scandic destinations.",
|
||||||
})}
|
})}
|
||||||
buttonText={intl.formatMessage({ id: "Explore Scandic hotels" })}
|
buttonText={intl.formatMessage({ id: "Explore Scandic hotels" })}
|
||||||
href={`${homeHrefs[env.NODE_ENV][lang]}?hotel=${hotel.operaId}`}
|
href={promoUrl.toString()}
|
||||||
image={hotel.hotelContent.images}
|
image={hotel.hotelContent.images}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user