Merged in feat/sw-2879-booking-widget-to-booking-flow-package (pull request #2532)

feat(SW-2879): Move BookingWidget to booking-flow package

* Fix lockfile

* Fix styling

* a tiny little booking widget test

* Tiny fixes

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Remove unused scripts

* lint:fix

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Tiny lint fixes

* update test

* Update Input in booking-flow

* Clean up comments etc

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Setup tracking context for booking-flow

* Add missing use client

* Fix temp tracking function

* Pass booking to booking-widget

* Remove comment

* Add use client to booking widget tracking provider

* Add use client to tracking functions

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Move debug page

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package

* Merge branch 'master' into feat/sw-2879-booking-widget-to-booking-flow-package


Approved-by: Bianca Widstam
This commit is contained in:
Anton Gunnarsson
2025-08-05 09:20:20 +00:00
parent 03c9244fdf
commit 1bd8fe6821
206 changed files with 1936 additions and 796 deletions

View File

@@ -1,5 +1,6 @@
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import StartPage from "@/components/ContentType/StartPage"
import { parseBookingWidgetSearchParams } from "@/utils/url"
import type { NextSearchParams, PageArgs } from "@/types/params"

View File

@@ -1,5 +1,9 @@
import { notFound } from "next/navigation"
import {
bookingConfirmation,
details,
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import { logger } from "@scandic-hotels/common/logger"
import { getServiceToken } from "@scandic-hotels/common/tokenManager"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
@@ -8,10 +12,6 @@ import { encrypt } from "@scandic-hotels/trpc/utils/encryption"
import { isValidSession } from "@scandic-hotels/trpc/utils/session"
import { PaymentCallbackStatusEnum } from "@/constants/booking"
import {
bookingConfirmation,
details,
} from "@/constants/routes/hotelReservation"
import { serverClient } from "@/lib/trpc/server"
import { auth } from "@/auth"

View File

@@ -1,10 +1,11 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
import { MapContainer } from "@/components/MapContainer"
import { parseSelectHotelSearchParams } from "@/utils/url"
import styles from "./page.module.css"

View File

@@ -3,8 +3,10 @@ import { cookies } from "next/headers"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { alternativeHotelsMap } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { FamilyAndFriendsCodes } from "@/constants/booking"
import { alternativeHotelsMap } from "@/constants/routes/hotelReservation"
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
import SelectHotel from "@/components/HotelReservation/SelectHotel"
@@ -13,7 +15,6 @@ import { getTracking } from "@/components/HotelReservation/SelectHotel/tracking"
import TrackingSDK from "@/components/TrackingSDK"
import { getIntl } from "@/i18n"
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
import { parseSelectHotelSearchParams } from "@/utils/url"
import {
type LangParams,

View File

@@ -2,6 +2,8 @@ import { cookies } from "next/headers"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { parseDetailsSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { FamilyAndFriendsCodes } from "@/constants/booking"
import {
getBreakfastPackages,
@@ -20,7 +22,6 @@ import EnterDetailsTrackingWrapper from "@/components/HotelReservation/EnterDeta
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
import RoomProvider from "@/providers/Details/RoomProvider"
import EnterDetailsProvider from "@/providers/EnterDetailsProvider"
import { parseDetailsSearchParams } from "@/utils/url"
import styles from "./page.module.css"

View File

@@ -2,10 +2,11 @@ import stringify from "json-stable-stringify-without-jsonify"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
import { MapContainer } from "@/components/MapContainer"
import { parseSelectHotelSearchParams } from "@/utils/url"
import styles from "./page.module.css"

View File

@@ -3,8 +3,10 @@ import { cookies } from "next/headers"
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { selectHotelMap } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { FamilyAndFriendsCodes } from "@/constants/booking"
import { selectHotelMap } from "@/constants/routes/hotelReservation"
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
import SelectHotel from "@/components/HotelReservation/SelectHotel"
@@ -12,7 +14,6 @@ import { getHotels } from "@/components/HotelReservation/SelectHotel/helpers"
import { getTracking } from "@/components/HotelReservation/SelectHotel/tracking"
import TrackingSDK from "@/components/TrackingSDK"
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
import { parseSelectHotelSearchParams } from "@/utils/url"
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"

View File

@@ -1,11 +1,11 @@
import { notFound } from "next/navigation"
import { parseSelectRateSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import { combineRegExps, rateTypeRegex } from "@/constants/booking"
import SelectRate from "@/components/HotelReservation/SelectRate"
import { parseSelectRateSearchParams } from "@/utils/url"
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"

View File

@@ -1,7 +1,9 @@
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests"
import { BookingWidget } from "@/components/BookingWidget"
import { parseBookingWidgetSearchParams } from "@/utils/url"
import { getLang } from "@/i18n/serverContext"
import type { NextSearchParams, PageArgs } from "@/types/params"
@@ -20,5 +22,7 @@ export default async function BookingWidgetDestinationCityPage(
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
return <BookingWidget booking={booking} />
const lang = await getLang()
return <BookingWidget booking={booking} lang={lang} />
}

View File

@@ -1,8 +1,9 @@
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
import { BookingWidget } from "@/components/BookingWidget"
import { getLang } from "@/i18n/serverContext"
import { parseBookingWidgetSearchParams } from "@/utils/url"
import type { NextSearchParams, PageArgs } from "@/types/params"
@@ -12,9 +13,10 @@ export default async function BookingWidgetHotelPage(
const searchParams = await props.searchParams
const hotelPageData = await getHotelPage()
const lang = await getLang()
const hotelData = await getHotel({
hotelId: hotelPageData?.hotel_page_id || "",
language: await getLang(),
language: lang,
isCardOnlyPayment: false,
})
@@ -34,5 +36,5 @@ export default async function BookingWidgetHotelPage(
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
return <BookingWidget booking={booking} />
return <BookingWidget booking={booking} lang={lang} />
}

View File

@@ -1,4 +1,4 @@
import { BookingWidgetSkeleton } from "@/components/BookingWidget/Client"
import { BookingWidgetSkeleton } from "@scandic-hotels/booking-flow/BookingWidget/Skeleton"
// This file is crucial for displaying a loading
// state immediately in the booking flow.

View File

@@ -1,5 +1,7 @@
import { BookingWidget } from "@/components/BookingWidget"
import { parseBookingWidgetSearchParams } from "@/utils/url"
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { getLang } from "@/i18n/serverContext"
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
@@ -10,5 +12,7 @@ export default async function BookingWidgetPage(
const booking = parseBookingWidgetSearchParams(searchParams)
return <BookingWidget booking={booking} />
const lang = await getLang()
return <BookingWidget booking={booking} lang={lang} />
}

View File

@@ -1,5 +1,7 @@
import { BookingWidget } from "@/components/BookingWidget"
import { parseBookingWidgetSearchParams } from "@/utils/url"
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { getLang } from "@/i18n/serverContext"
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
@@ -10,5 +12,7 @@ export default async function BookingWidgetPage(
const booking = parseBookingWidgetSearchParams(searchParams)
return <BookingWidget booking={booking} />
const lang = await getLang()
return <BookingWidget booking={booking} lang={lang} />
}

View File

@@ -7,6 +7,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
import Script from "next/script"
import { SessionProvider } from "next-auth/react"
import { BookingFlowTrackingProvider } from "@scandic-hotels/booking-flow/BookingFlowTrackingProvider"
import { Lang } from "@scandic-hotels/common/constants/language"
import TrpcProvider from "@/lib/trpc/Provider"
@@ -26,6 +27,7 @@ import { FontPreload } from "@/fonts/font-preloading"
import { getMessages } from "@/i18n"
import ClientIntlProvider from "@/i18n/Provider"
import { setLang } from "@/i18n/serverContext"
import { trackBookingSearchClick } from "@/utils/tracking/booking"
import type { LangParams, LayoutArgs } from "@/types/params"
@@ -65,17 +67,23 @@ export default async function RootLayout(
>
<TrpcProvider>
<RACRouterProvider>
<RouteChange />
<SitewideAlert />
<Header />
{bookingwidget}
{children}
<Footer />
<ToastHandler />
<SessionRefresher />
<StorageCleaner />
<CookieBotConsent />
<ReactQueryDevtools initialIsOpen={false} />
<BookingFlowTrackingProvider
trackingFunctions={{
trackBookingSearchClick,
}}
>
<RouteChange />
<SitewideAlert />
<Header />
{bookingwidget}
{children}
<Footer />
<ToastHandler />
<SessionRefresher />
<StorageCleaner />
<CookieBotConsent />
<ReactQueryDevtools initialIsOpen={false} />
</BookingFlowTrackingProvider>
</RACRouterProvider>
</TrpcProvider>
</ClientIntlProvider>

View File

@@ -1,13 +1,13 @@
import Link from "next/link"
import React, { Suspense } from "react"
import { hotelreservation } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { partnerSas } from "@scandic-hotels/common/constants/routes/myPages"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { hotelreservation } from "@/constants/routes/hotelReservation"
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
import Image from "@/components/Image"