Merged in fix/LOY-222-find-my-booking-urls-for-prod (pull request #1817)

Fix(LOY-222): Find my booking url handling

* fix(LOY-222): adapt findMyBooking url based on HIDE_FOR_NEXT_RELEASE

* feat(LOY-222): add current web paths for findMyBooking in multiple languages

* refactor(LOY-222): better env and new url constructions

* refactor(LOY-222): decouple env var handling from getCurrentWebUrl

* fix(LOY-222): update findMyBooking URL construction to use baseUrl

* fix(LOY-222): simplify findMyBooking URL handling for new web urls

* fix(LOY-222): Update Finnish path for hotel reservation lookup

* refactor(LOY-222): rename PUBLIC_URL to NEXT_PUBLIC_PUBLIC_URL for consistency


Approved-by: Christian Andolf
Approved-by: Linus Flood
This commit is contained in:
Chuma Mcphoy (We Ahead)
2025-04-22 07:03:23 +00:00
parent ba2198b77f
commit 27aef3982e
13 changed files with 82 additions and 20 deletions

View File

@@ -4,9 +4,10 @@
import { usePathname } from "next/navigation"
import { useIntl } from "react-intl"
import { findMyBooking } from "@/constants/routes/findMyBooking"
import { findMyBookingCurrentWebPath } from "@/constants/routes/findMyBooking"
import { logout } from "@/constants/routes/handleAuth"
import { myPages } from "@/constants/routes/myPages"
import { env } from "@/env/client"
import useDropdownStore from "@/stores/main-menu"
import Image from "@/components/Image"
@@ -16,6 +17,7 @@ import SkeletonShimmer from "@/components/SkeletonShimmer"
import Link from "@/components/TempDesignSystem/Link"
import useLang from "@/hooks/useLang"
import { trackClick } from "@/utils/tracking"
import { getCurrentWebUrl } from "@/utils/url"
import BookingButton from "../BookingButton"
@@ -38,6 +40,7 @@ export function MainMenu({
const intl = useIntl()
const lang = useLang()
const pathname = usePathname()
const baseUrl = env.NEXT_PUBLIC_PUBLIC_URL || "https://www.scandichotels.com"
const isThreeStaticPagesPathnames = [
"/de/sponsoring",
@@ -157,7 +160,11 @@ export function MainMenu({
<li className={styles.mobileLinkRow}>
<Link
className={styles.mobileLinkButton}
href={findMyBooking[lang]}
href={getCurrentWebUrl({
path: findMyBookingCurrentWebPath[lang],
lang,
baseUrl,
})}
>
{intl.formatMessage({
defaultMessage: "Find booking",