From 9bcb9e8232af568cfa199e91c2a0c1da4ea13217 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Fri, 28 Nov 2025 08:59:39 +0000 Subject: [PATCH] Merged in feat/book-623-bw-lang (pull request #3248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(BOOK-623): pass correct lang to booking widget and fix some more error logs * feat(BOOK-623): pass correct lang to booking widget and fix some more error logs Approved-by: Joakim Jäderberg --- .../@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx | 6 +++--- .../[lang]/(live)/@bookingwidget/hotelreservation/page.tsx | 5 ++--- apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx | 5 ++--- .../components/HotelReservation/MyStay/index.tsx | 2 +- apps/scandic-web/utils/getErrorMessage.ts | 4 ++++ 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx index 2326af0dc..9ffeface8 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx @@ -4,14 +4,14 @@ import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/uti import { bookingFlowConfig } from "@/constants/bookingFlowConfig" import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests" -import type { Lang } from "@scandic-hotels/common/constants/language" +import { getLang } from "@/i18n/serverContext" export default async function BookingWidgetHotelPage( props: PageProps<"/[lang]/hotel_page/[uid]"> ) { const searchParams = await props.searchParams - const params = await props.params - const lang = params.lang as Lang + + const lang = await getLang() const hotelPageData = await getHotelPage() const hotelData = await getHotel({ diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx index 9a88da9a3..2ff07a557 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/hotelreservation/page.tsx @@ -3,17 +3,16 @@ import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/uti import { bookingFlowConfig } from "@/constants/bookingFlowConfig" -import type { Lang } from "@scandic-hotels/common/constants/language" +import { getLang } from "@/i18n/serverContext" export default async function BookingWidgetPage( props: PageProps<"/[lang]/hotelreservation"> ) { const searchParams = await props.searchParams - const params = await props.params const booking = parseBookingWidgetSearchParams(searchParams) - const lang = params.lang as Lang + const lang = await getLang() return ( diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx index a38a2024f..789af880b 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx @@ -3,15 +3,14 @@ import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/uti import { bookingFlowConfig } from "@/constants/bookingFlowConfig" -import type { Lang } from "@scandic-hotels/common/constants/language" +import { getLang } from "@/i18n/serverContext" export default async function BookingWidgetPage(props: PageProps<"/[lang]">) { const searchParams = await props.searchParams - const params = await props.params const booking = parseBookingWidgetSearchParams(searchParams) - const lang = params.lang as Lang + const lang = await getLang() return ( diff --git a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx index 19d648cd3..f010f7581 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx @@ -84,7 +84,7 @@ async function MyStay(props: { if (isLoggedIn) { bookingConfirmation = await getBookingConfirmation(refId) } else if (bv) { - logger.info(`MyStay: bv`, bv) + logger.debug(`MyStay: bv`, bv) const { firstName, email, diff --git a/apps/scandic-web/utils/getErrorMessage.ts b/apps/scandic-web/utils/getErrorMessage.ts index 124439b55..010de0b38 100644 --- a/apps/scandic-web/utils/getErrorMessage.ts +++ b/apps/scandic-web/utils/getErrorMessage.ts @@ -185,6 +185,10 @@ export function getErrorMessage(intl: IntlShape, errorCode?: string) { defaultMessage: "Membership number can't be the same for two different rooms", }) + case undefined: + case null: + case "": + return errorCode default: logger.warn("Error code not supported:", errorCode) return errorCode