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

@@ -0,0 +1,53 @@
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { serverClient } from "@/lib/trpc"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { ClientComponent } from "../../../components/ClientComponent"
type SearchParams<S = {}> = {
searchParams: Promise<S & { [key: string]: string }>
}
export default async function Debug(props: SearchParams) {
const searchParams = await props.searchParams
const intl = await getIntl()
const lang = await getLang()
const caller = await serverClient()
const destinations = await caller.autocomplete.destinations({
lang,
includeTypes: ["hotels"],
query: "Göteborg",
})
const hotel = destinations.hits.hotels[0].name
const booking = parseBookingWidgetSearchParams(searchParams)
return (
<div style={{ padding: "20px" }}>
<Typography>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<p>from booking-flow package:</p>
</Typography>
<BookingWidget booking={booking} lang={lang} />
<hr />
<Typography variant="Title/Decorative/lg">
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<p>hello world with data: {hotel}</p>
</Typography>
<Typography>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<p>
translated:
{intl.formatMessage({ defaultMessage: "Map of the city" })}
</p>
</Typography>
<hr />
<ClientComponent />
</div>
)
}

View File

@@ -1,7 +1,9 @@
import "@scandic-hotels/design-system/style.css"
import "@scandic-hotels/design-system/fonts.css"
import "@scandic-hotels/design-system/style.css"
import "@/public/_static/css/design-system-new-deprecated.css"
import "../../globals.css"
import { BookingFlowTrackingProvider } from "@scandic-hotels/booking-flow/BookingFlowTrackingProvider"
import { Lang } from "@scandic-hotels/common/constants/language"
import { TrpcProvider } from "@scandic-hotels/trpc/Provider"
@@ -9,6 +11,8 @@ import { getMessages } from "@/i18n"
import ClientIntlProvider from "@/i18n/Provider"
import { setLang } from "@/i18n/serverContext"
import { trackBookingSearchClick } from "../utils/tracking"
import type { Metadata } from "next"
export const metadata: Metadata = {
@@ -35,21 +39,39 @@ export default async function RootLayout(props: RootLayoutProps) {
return (
<html lang="en">
<head>
{/* eslint-disable-next-line @next/next/no-css-tags */}
<link rel="stylesheet" href="/_static/css/core.css" />
{/* eslint-disable-next-line @next/next/no-css-tags */}
<link rel="stylesheet" href="/_static/css/scandic.css" />
</head>
<head>{/* TODO */}</head>
<body className="scandic">
<ClientIntlProvider
defaultLocale={Lang.en}
locale={params.lang}
messages={messages}
>
{/* TODO handle onError */}
<TrpcProvider>{children}</TrpcProvider>
</ClientIntlProvider>
<div className="root">
<ClientIntlProvider
defaultLocale={Lang.en}
locale={params.lang}
messages={messages}
>
{/* TODO handle onError */}
<TrpcProvider>
<BookingFlowTrackingProvider
trackingFunctions={{
trackBookingSearchClick,
}}
>
<header
style={{
height: 64,
backgroundColor: "dodgerblue",
color: "white",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<h1>SAS</h1>
</header>
<main>{children}</main>
</BookingFlowTrackingProvider>
</TrpcProvider>
</ClientIntlProvider>
</div>
</body>
</html>
)

View File

@@ -1,4 +0,0 @@
.page {
padding-left: 200px;
padding-top: 200px;
}

View File

@@ -1,44 +1,29 @@
import { Temp } from "@scandic-hotels/booking-flow/test-entry"
import { Lang } from "@scandic-hotels/common/constants/language"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { serverClient } from "@/lib/trpc"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"
import { ClientComponent } from "./ClientComponent"
import type { Lang } from "@scandic-hotels/common/constants/language"
import styles from "./page.module.css"
type SearchParams<S = {}> = {
searchParams: Promise<S & { [key: string]: string }>
}
export default async function Home() {
const intl = await getIntl()
const caller = await serverClient()
const destinations = await caller.autocomplete.destinations({
lang: Lang.en,
includeTypes: ["hotels"],
query: "Göteborg",
})
const hotel = destinations.hits.hotels[0].name
export default async function Home(props: SearchParams<{ lang: Lang }>) {
const searchParams = await props.searchParams
// TODO we need this import right now to ensure configureServerClient is called,
// but we should ensure it's called in a layout instead.
const _caller = await serverClient()
const lang = await getLang()
const booking = parseBookingWidgetSearchParams(searchParams)
return (
<div className={styles.page}>
<main>
<Typography variant="Title/Decorative/lg">
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<p>hello world with data: {hotel}</p>
</Typography>
<Typography>
<p>{intl.formatMessage({ defaultMessage: "Map of the city" })}</p>
</Typography>
<hr />
<ClientComponent />
<hr />
<Typography>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
<p>from booking-flow package:</p>
</Typography>
<Temp />
</main>
<div>
<BookingWidget booking={booking} lang={lang} />
</div>
)
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -0,0 +1,11 @@
"use client"
export function trackBookingSearchClick(
searchTerm: string,
searchType: "hotel" | "destination"
) {
console.log("TODO: Implement trackBookingSearchClick", {
searchTerm,
searchType,
})
}

View File

@@ -0,0 +1,24 @@
"use client"
import { type IntlConfig, IntlProvider } from "react-intl"
type ClientIntlProviderProps = React.PropsWithChildren<
Pick<IntlConfig, "defaultLocale" | "locale" | "messages">
>
export default function ClientIntlProvider({
children,
locale,
defaultLocale,
messages,
}: ClientIntlProviderProps) {
return (
<IntlProvider
locale={locale}
defaultLocale={defaultLocale}
messages={messages}
>
{children}
</IntlProvider>
)
}

View File

@@ -0,0 +1,107 @@
:root {
--current-max-width: 113.5rem;
--max-width: 94.5rem;
--max-width-content: min(calc(100dvw - var(--max-width-spacing)), 74.75rem);
--max-width-text-block: 49.5rem;
--current-mobile-site-header-height: 52.41px;
--max-width-navigation: 89.5rem;
--max-width-single-spacing: var(--Layout-Mobile-Margin-Margin-min);
--max-width-spacing: calc(var(--max-width-single-spacing) * 2);
--max-width-page: min(
calc(100dvw - var(--max-width-spacing)),
var(--max-width-navigation)
);
--sitewide-alert-height: 0px; /* Will be overridden when a sitewide alert is visible */
--main-menu-mobile-height: 75px;
--main-menu-desktop-height: 125px;
--booking-widget-mobile-height: 75px;
--booking-widget-tablet-height: 150px;
--booking-widget-desktop-height: 77px;
--hotel-page-map-desktop-width: 23.75rem;
/* Z-INDEX */
--header-z-index: 11;
--menu-overlay-z-index: 11;
--booking-widget-z-index: 10;
--booking-widget-open-z-index: 100;
--dialog-z-index: 9;
--back-to-top-button: 80;
--language-switcher-z-index: 85;
--sidepeek-z-index: 100;
--lightbox-z-index: 150;
--default-modal-overlay-z-index: 100;
--default-modal-z-index: 101;
--modal-box-shadow: 0px 4px 24px 0px rgba(38, 32, 30, 0.08);
--popup-box-shadow: 0 0 14px 6px rgba(0, 0, 0, 0.1);
@supports (interpolate-size: allow-keywords) {
interpolate-size: allow-keywords;
}
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
scroll-behavior: smooth;
}
body {
min-height: 100dvh;
overflow-x: hidden;
display: flex;
flex-direction: column;
color: var(--Text-Default);
}
body.overflow-hidden {
overflow: hidden;
}
.root {
isolation: isolate;
}
/* From Tailwind */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
ul {
padding-inline-start: 0;
margin-block-start: 0;
margin-block-end: 0;
}
@media screen and (min-width: 768px) {
:root {
--max-width-single-spacing: var(--Layout-Tablet-Margin-Margin-min);
}
body.overflow-hidden {
overflow: auto;
overflow-x: hidden;
}
}
@media screen and (min-width: 1367px) {
:root {
--max-width-single-spacing: var(--Layout-Desktop-Margin-Margin-min);
}
}

View File

@@ -12,6 +12,17 @@ const nextConfig: NextConfig = {
],
output: "standalone",
experimental: {
swcPlugins: [
[
"@swc/plugin-formatjs",
{
ast: true,
},
],
],
},
webpack: function (config: any) {
config.module.rules.push(
{
@@ -27,17 +38,6 @@ const nextConfig: NextConfig = {
return config
},
experimental: {
swcPlugins: [
[
"@swc/plugin-formatjs",
{
ast: true,
},
],
],
},
}
export default Sentry.withSentryConfig(nextConfig, {

View File

@@ -34,6 +34,7 @@
"@playwright/test": "^1.53.1",
"@scandic-hotels/common": "workspace:*",
"@scandic-hotels/typescript-config": "workspace:*",
"@swc/plugin-formatjs": "^3.2.2",
"@types/node": "^20",
"@types/react": "19.1.0",
"@types/react-dom": "19.1.0",

View File

@@ -28,25 +28,37 @@ export default defineConfig({
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:3001",
/* How long to wait for actions to complete. */
actionTimeout: 15 * 1000,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
trace: process.env.CI ? "on-first-retry" : "retain-on-failure",
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
use: {
...devices["Desktop Chrome"],
viewport: { width: 1400, height: 720 },
},
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
use: {
...devices["Desktop Firefox"],
viewport: { width: 1400, height: 720 },
},
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
use: {
...devices["Desktop Safari"],
viewport: { width: 1400, height: 720 },
},
},
/* Test against mobile viewports. */

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#57514E"><path d="m336-280 144-144 144 144 56-56-144-144 144-144-56-56-144 144-144-144-56 56 144 144-144 144 56 56ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>

After

Width:  |  Height:  |  Size: 507 B

View File

@@ -0,0 +1,206 @@
import { expect, type Page, test } from "@playwright/test"
import { serializeBookingSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
test("can make a search with city", async ({ page }) => {
await page.goto("/")
// Search for city
const combobox = page.getByRole("combobox", { name: /where to/i })
await combobox.click()
await combobox.fill("stockholm")
await page.getByRole("option", { name: /stockholm sweden/i }).click()
// Open datepicker
// If we had better accessibility for our datepicker this would be so much easier
const today = new Date()
const tomorrow = new Date(today)
tomorrow.setDate(today.getDate() + 1)
await page
.getByRole("button", {
name: `${formatDate(today)} - ${formatDate(tomorrow)}`,
})
.click()
// Select future dates
const twoDaysFromNow = new Date(today)
twoDaysFromNow.setDate(today.getDate() + 2)
await clickDatePickerDate(page, twoDaysFromNow)
const threeDaysFromNow = new Date(today)
threeDaysFromNow.setDate(today.getDate() + 3)
await clickDatePickerDate(page, threeDaysFromNow)
await page
.getByRole("button", {
name: /select dates/i,
})
.click()
// Select rooms and guests
// Once again, better accessibility would make this so much easier
await page.getByRole("button", { name: /1 room, 1 adult/i }).click()
const roomsDialog = page.getByRole("dialog")
const room1section = roomsDialog.getByText(/room 1/i).locator("..")
// Add 1 adult
await room1section
.locator("section")
.filter({ hasText: /adults/i })
.getByRole("button", { name: /add/i })
.click()
// Add 1 child aged 10
await room1section
.locator("section")
.filter({ hasText: /children/i })
.getByRole("button", { name: /add/i })
.click()
await room1section.getByRole("button", { name: /age/i }).click()
await page.getByRole("option", { name: /10/i }).click()
await page.getByRole("button", { name: /add room/i }).click()
const room2section = roomsDialog.getByText(/room 2/i).locator("..")
// Add 2 adults
await room2section
.locator("section")
.filter({ hasText: /adults/i })
.getByRole("button", { name: /add/i })
.click({ clickCount: 2 })
await roomsDialog.getByRole("button", { name: /done/i }).click()
await page.getByRole("button", { name: /search/i }).click()
// Assert that we navigated to the correct URL
const expectedSearchParams = serializeBookingSearchParams({
rooms: [
{
adults: 2,
childrenInRoom: [{ age: 10, bed: ChildBedMapEnum.IN_EXTRA_BED }],
},
{
adults: 3,
childrenInRoom: [],
},
],
fromDate: twoDaysFromNow.toISOString().split("T")[0],
toDate: threeDaysFromNow.toISOString().split("T")[0],
city: "STOCKHOLM",
})
await expect(page).toHaveURL(
`/en/hotelreservation/select-hotel?${expectedSearchParams}`
)
})
test("can make a search with hotel", async ({ page }) => {
await page.goto("/")
// Search for hotel
const combobox = page.getByRole("combobox", { name: /where to/i })
await combobox.click()
await combobox.fill("downtown camper")
await page.getByRole("option", { name: /downtown camper/i }).click()
// Open datepicker
// If we had better accessibility for our datepicker this would be so much easier
const today = new Date()
const tomorrow = new Date(today)
tomorrow.setDate(today.getDate() + 1)
await page
.getByRole("button", {
name: `${formatDate(today)} - ${formatDate(tomorrow)}`,
})
.click()
// Select future dates
const twoDaysFromNow = new Date(today)
twoDaysFromNow.setDate(today.getDate() + 2)
await clickDatePickerDate(page, twoDaysFromNow)
const threeDaysFromNow = new Date(today)
threeDaysFromNow.setDate(today.getDate() + 3)
await clickDatePickerDate(page, threeDaysFromNow)
await page
.getByRole("button", {
name: /select dates/i,
})
.click()
// Select rooms and guests
// Once again, better accessibility would make this so much easier
await page.getByRole("button", { name: /1 room, 1 adult/i }).click()
const roomsDialog = page.getByRole("dialog")
const room1section = roomsDialog.getByText(/room 1/i).locator("..")
// Add 1 adult
await room1section
.locator("section")
.filter({ hasText: /adults/i })
.getByRole("button", { name: /add/i })
.click()
// Add 1 child aged 10
await room1section
.locator("section")
.filter({ hasText: /children/i })
.getByRole("button", { name: /add/i })
.click()
await room1section.getByRole("button", { name: /age/i }).click()
await page.getByRole("option", { name: /10/i }).click()
await page.getByRole("button", { name: /add room/i }).click()
const room2section = roomsDialog.getByText(/room 2/i).locator("..")
// Add 2 adults
await room2section
.locator("section")
.filter({ hasText: /adults/i })
.getByRole("button", { name: /add/i })
.click({ clickCount: 2 })
await roomsDialog.getByRole("button", { name: /done/i }).click()
await page.getByRole("button", { name: /search/i }).click()
// Assert that we navigated to the correct URL
const expectedSearchParams = serializeBookingSearchParams({
rooms: [
{
adults: 2,
childrenInRoom: [{ age: 10, bed: ChildBedMapEnum.IN_EXTRA_BED }],
},
{
adults: 3,
childrenInRoom: [],
},
],
fromDate: twoDaysFromNow.toISOString().split("T")[0],
toDate: threeDaysFromNow.toISOString().split("T")[0],
hotelId: "879", // Downtown Camper
})
await expect(page).toHaveURL(
`/en/hotelreservation/select-rate?${expectedSearchParams}`
)
})
const formatDate = (date: Date) => {
const day = date.getDate()
const month = date.toLocaleDateString("en-US", { month: "short" })
const weekday = date.toLocaleDateString("en-US", { weekday: "short" })
return `${weekday}, ${day} ${month}`
}
const clickDatePickerDate = async (page: Page, date: Date) => {
const dateString = date.toISOString().split("T")[0] // YYYY-MM-DD format
await page.locator(`[data-day="${dateString}"]`).getByRole("button").click()
}

View File

@@ -1,7 +0,0 @@
import { expect, test } from "@playwright/test"
test("has text", async ({ page }) => {
await page.goto("/")
await expect(page.getByText(/hello world/i)).toBeVisible()
})

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"

View File

@@ -1,39 +0,0 @@
import { Suspense } from "react"
import {
getPageSettingsBookingCode,
isBookingWidgetHidden,
} from "@/lib/trpc/memoizedRequests"
import BookingWidgetClient, { BookingWidgetSkeleton } from "./Client"
import type { BookingWidgetProps } from "@/types/components/bookingWidget"
export async function BookingWidget(props: BookingWidgetProps) {
return (
<Suspense fallback={<BookingWidgetSkeleton />}>
<InternalBookingWidget {...props} />
</Suspense>
)
}
async function InternalBookingWidget({ type, booking }: BookingWidgetProps) {
const isHidden = await isBookingWidgetHidden()
if (isHidden) {
return null
}
let pageSettingsBookingCodePromise: Promise<string> | null = null
if (!booking.bookingCode) {
pageSettingsBookingCodePromise = getPageSettingsBookingCode()
}
return (
<BookingWidgetClient
type={type}
data={booking}
pageSettingsBookingCodePromise={pageSettingsBookingCodePromise}
/>
)
}

View File

@@ -4,12 +4,12 @@ import { useMap, useMapsLibrary } from "@vis.gl/react-google-maps"
import { useEffect, useMemo, useState } from "react"
import { useIntl } from "react-intl"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useDestinationDataStore } from "@/stores/destination-data"
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
import { debounce } from "@/utils/debounce"
import HotelListContent from "./Content"
import HotelListSkeleton from "./HotelListSkeleton"

View File

@@ -5,7 +5,8 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { z } from "zod"
import { Search } from "@/components/Forms/BookingWidget/FormContent/Search"
import { Search } from "@scandic-hotels/booking-flow/BookingWidget/BookingWidgetForm/FormContent/Search"
import { toast } from "@/components/TempDesignSystem/Toasts"
const destinationSearchFormSchema = z.object({

View File

@@ -11,6 +11,7 @@ import {
} from "react"
import { useIntl } from "react-intl"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
@@ -20,7 +21,6 @@ import { useDestinationPageHotelsMapStore } from "@/stores/destination-page-hote
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
import { useScrollToTop } from "@/hooks/useScrollToTop"
import { debounce } from "@/utils/debounce"
import DynamicMap from "./DynamicMap"
import MapContent from "./MapContent"

View File

@@ -2,12 +2,10 @@
import { useRef } from "react"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { StickyElementNameEnum } from "@/stores/sticky-position"
import useStickyPosition from "@/hooks/useStickyPosition"
import styles from "./sidebarContentWrapper.module.css"
interface SidebarContentWrapperProps extends React.PropsWithChildren {

View File

@@ -10,11 +10,11 @@ import {
} from "react"
import { useIntl } from "react-intl"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { Button } from "@scandic-hotels/design-system/Button"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import InteractiveMap from "@/components/Maps/InteractiveMap"
import { debounce } from "@/utils/debounce"
import Sidebar from "./Sidebar"

View File

@@ -2,9 +2,8 @@
import { type PropsWithChildren, useRef } from "react"
import { StickyElementNameEnum } from "@/stores/sticky-position"
import useStickyPosition from "@/hooks/useStickyPosition"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import styles from "./mapWithCard.module.css"

View File

@@ -1,11 +1,10 @@
import Link from "next/link"
import { selectRateWithParams } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { dt } from "@scandic-hotels/common/dt"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { selectRateWithParams } from "@/constants/routes/hotelReservation"
import ImageGallery from "@/components/ImageGallery"
import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { getIntl } from "@/i18n"

View File

@@ -11,13 +11,12 @@ import {
useState,
} from "react"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { StickyElementNameEnum } from "@/stores/sticky-position"
import useScrollShadows from "@/hooks/useScrollShadows"
import useScrollSpy from "@/hooks/useScrollSpy"
import useStickyPosition from "@/hooks/useStickyPosition"
import { trackHotelTabClick } from "@/utils/tracking"
import styles from "./tabNavigation.module.css"

View File

@@ -1,3 +1,4 @@
import { FloatingBookingWidget } from "@scandic-hotels/booking-flow/BookingWidget/FloatingBookingWidget"
import Title from "@scandic-hotels/design-system/Title"
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
@@ -5,13 +6,13 @@ import { getStartPage } from "@/lib/trpc/memoizedRequests"
import Blocks from "@/components/Blocks"
import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign"
import { FloatingBookingWidget } from "@/components/BookingWidget/FloatingBookingWidget"
import Image from "@/components/Image"
import TrackingSDK from "@/components/TrackingSDK"
import { getLang } from "@/i18n/serverContext"
import styles from "./startPage.module.css"
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
export default async function StartPage({
booking,
@@ -24,6 +25,7 @@ export default async function StartPage({
}
const { header, blocks } = content.startPage
const lang = await getLang()
return (
<div className={styles.background}>
@@ -32,7 +34,7 @@ export default async function StartPage({
<Title color="white" textAlign="center">
{header.heading}
</Title>
<FloatingBookingWidget booking={booking} />
<FloatingBookingWidget booking={booking} lang={lang} />
</div>
{header.hero_image ? (
<Image

View File

@@ -19,7 +19,13 @@ import { locales } from "../locales"
import styles from "./desktop.module.css"
import classNames from "react-day-picker/style.module.css"
import type { DatePickerSingleProps } from "@/types/components/datepicker"
type DatePickerSingleProps = {
close: () => void
startMonth?: Date
hideHeader?: boolean
selectedDate: Date
handleOnSelect: (selected: Date) => void
}
export default function DatePickerSingleDesktop({
close,

View File

@@ -15,7 +15,13 @@ import { locales } from "../locales"
import styles from "./mobile.module.css"
import classNames from "react-day-picker/style.module.css"
import type { DatePickerSingleProps } from "@/types/components/datepicker"
type DatePickerSingleProps = {
close: () => void
startMonth?: Date
hideHeader?: boolean
selectedDate: Date
handleOnSelect: (selected: Date) => void
}
export default function DatePickerSingleMobile({
close,

View File

@@ -2,12 +2,12 @@
import { useIntl } from "react-intl"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateFormat } from "@/constants/dateFormats"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import useLang from "@/hooks/useLang"

View File

@@ -2,16 +2,16 @@
import { useIntl } from "react-intl"
import {
changeOrCancelDateFormat,
longDateFormat,
} from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import Caption from "@scandic-hotels/design-system/Caption"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { CancellationRuleEnum } from "@/constants/booking"
import {
changeOrCancelDateFormat,
longDateFormat,
} from "@/constants/dateFormats"
import Image from "@/components/Image"
import useLang from "@/hooks/useLang"

View File

@@ -2,11 +2,12 @@
import { useEffect, useState } from "react"
import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import TrackingSDK from "@/components/TrackingSDK"
import useLang from "@/hooks/useLang"
import { useSearchHistory } from "@/hooks/useSearchHistory"
import { clearPaymentInfoSessionStorage } from "../../EnterDetails/Payment/helpers"
import { getTracking } from "./tracking"

View File

@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from "react"
import { useIntl } from "react-intl"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
@@ -12,7 +13,6 @@ import { useEnterDetailsStore } from "@/stores/enter-details"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang"
import useStickyPosition from "@/hooks/useStickyPosition"
import styles from "./bookingAlert.module.css"

View File

@@ -3,13 +3,14 @@
import { useRouter } from "next/navigation"
import { useEffect } from "react"
import { serializeBookingSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { PaymentCallbackStatusEnum } from "@/constants/booking"
import { detailsStorageName } from "@/stores/enter-details"
import LoadingSpinner from "@/components/LoadingSpinner"
import { trackPaymentEvent } from "@/utils/tracking"
import { trackEvent } from "@/utils/tracking/base"
import { serializeBookingSearchParams } from "@/utils/url"
import {
clearPaymentInfoSessionStorage,

View File

@@ -9,7 +9,8 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { bookingConfirmation,selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { logger } from "@scandic-hotels/common/logger"
import Body from "@scandic-hotels/design-system/Body"
import { Button } from "@scandic-hotels/design-system/Button"
@@ -22,7 +23,6 @@ import { BookingStatusEnum } from "@scandic-hotels/trpc/enums/bookingStatus"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { PAYMENT_METHOD_TITLES } from "@/constants/booking"
import { bookingConfirmation } from "@/constants/routes/hotelReservation"
import { env } from "@/env/client"
import { useEnterDetailsStore } from "@/stores/enter-details"
@@ -30,7 +30,6 @@ import PaymentOption from "@/components/HotelReservation/PaymentOption"
import { useAvailablePaymentOptions } from "@/hooks/booking/useAvailablePaymentOptions"
import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus"
import useLang from "@/hooks/useLang"
import useStickyPosition from "@/hooks/useStickyPosition"
import { formatPhoneNumber } from "@/utils/phone"
import { trackPaymentEvent } from "@/utils/tracking"
import { trackEvent } from "@/utils/tracking/base"

View File

@@ -2,7 +2,8 @@
import { usePathname } from "next/navigation"
import { useEffect } from "react"
import { hotelreservation } from "@/constants/routes/hotelReservation"
import { hotelreservation } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { detailsStorageName } from "@/stores/enter-details"
import useLang from "@/hooks/useLang"

View File

@@ -5,6 +5,7 @@ import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import Body from "@scandic-hotels/design-system/Body"
import { Divider } from "@scandic-hotels/design-system/Divider"
@@ -12,8 +13,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Subtitle from "@scandic-hotels/design-system/Subtitle"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateFormat } from "@/constants/dateFormats"
import BookingCodeChip from "@/components/BookingCodeChip"
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
import { isBookingCodeRate } from "@/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils"

View File

@@ -1,9 +1,10 @@
"use client"
import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory"
import { useEnterDetailsStore } from "@/stores/enter-details"
import TrackingSDK from "@/components/TrackingSDK"
import { useSearchHistory } from "@/hooks/useSearchHistory"
import { getTracking } from "./tracking"

View File

@@ -11,16 +11,16 @@ import { memo } from "react"
import { useIntl } from "react-intl"
import TripAdvisorChip from "@scandic-hotels/booking-flow/components/TripAdvisorChip"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import {
alternativeHotelsMap,
selectHotelMap,
selectRate,
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import Caption from "@scandic-hotels/design-system/Caption"
import { Divider } from "@scandic-hotels/design-system/Divider"
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import {
alternativeHotelsMap,
selectHotelMap,
} from "@/constants/routes/hotelReservation"
import { useHotelsMapStore } from "@/stores/hotels-map"
import BookingCodeChip from "@/components/BookingCodeChip"

View File

@@ -4,9 +4,12 @@ import { useSession } from "next-auth/react"
import { useEffect, useMemo, useRef } from "react"
import { useIntl } from "react-intl"
import {
BookingCodeFilterEnum,
useBookingCodeFilterStore,
} from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
import { useHotelFilterStore } from "@/stores/hotel-filters"
import { useHotelsMapStore } from "@/stores/hotels-map"
@@ -23,7 +26,6 @@ import {
type HotelCardListingProps,
HotelCardListingTypeEnum,
} from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
export default function HotelCardListing({
hotelData,

View File

@@ -7,13 +7,13 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { trpc } from "@scandic-hotels/trpc/client"
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
import { guaranteeCallback } from "@/constants/routes/hotelReservation"
import { env } from "@/env/client"
import {
AncillaryStepEnum,

View File

@@ -1,10 +1,9 @@
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { getNumberOfNights } from "@scandic-hotels/common/utils/dateFormatting"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { longDateWithYearFormat } from "@/constants/dateFormats"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"

View File

@@ -2,10 +2,10 @@
import { useFormContext, useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateWithYearFormat } from "@/constants/dateFormats"
import { useMyStayStore } from "@/stores/my-stay"
import Modal from "@/components/HotelReservation/MyStay/Modal"

View File

@@ -1,11 +1,11 @@
"use client"
import { useIntl } from "react-intl"
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { trpc } from "@scandic-hotels/trpc/client"
import { longDateWithYearFormat } from "@/constants/dateFormats"
import { useMyStayStore } from "@/stores/my-stay"
import Modal from "@/components/HotelReservation/MyStay/Modal"

View File

@@ -7,12 +7,11 @@ import {
import { useFormContext, useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateWithYearFormat } from "@/constants/dateFormats"
import DatePickerSingleDesktop from "@/components/DatePicker/Single/Desktop"
import DatePickerSingleMobile from "@/components/DatePicker/Single/Mobile"
import Modal from "@/components/HotelReservation/MyStay/Modal"

View File

@@ -4,11 +4,11 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { Divider } from "@scandic-hotels/design-system/Divider"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { guaranteeCallback } from "@/constants/routes/hotelReservation"
import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs"
import { env } from "@/env/client"
import { useMyStayStore } from "@/stores/my-stay"

View File

@@ -1,11 +1,11 @@
"use client"
import { useIntl } from "react-intl"
import { shortDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { shortDateFormat } from "@/constants/dateFormats"
import { useMyStayStore } from "@/stores/my-stay"
import useLang from "@/hooks/useLang"

View File

@@ -1,6 +1,7 @@
"use client"
import { useIntl } from "react-intl"
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { IconButton } from "@scandic-hotels/design-system/IconButton"
@@ -11,7 +12,6 @@ import { RateEnum } from "@scandic-hotels/trpc/enums/rate"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { CancellationRuleEnum } from "@/constants/booking"
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
import Image from "@/components/Image"

View File

@@ -1,8 +1,8 @@
import { useIntl } from "react-intl"
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
import { useMyStayStore } from "@/stores/my-stay"
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"

View File

@@ -2,11 +2,10 @@
import { Fragment } from "react"
import { useIntl } from "react-intl"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateFormat } from "@/constants/dateFormats"
import useLang from "@/hooks/useLang"
import BookingCodeRow from "./Row/BookingCode"

View File

@@ -13,17 +13,14 @@ import {
import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import { BookingCodeFilterEnum,useBookingCodeFilterStore } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
import { IconButton } from "@scandic-hotels/design-system/IconButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
import styles from "./bookingCodeFilter.module.css"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
export default function BookingCodeFilter() {
const intl = useIntl()
const [isOpen, setIsOpen] = useState(false)

View File

@@ -2,13 +2,12 @@
import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import {
alternativeHotelsMap,
selectHotelMap,
} from "@/constants/routes/hotelReservation"
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import Link from "@/components/TempDesignSystem/Link"
import useLang from "@/hooks/useLang"

View File

@@ -1,7 +1,6 @@
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { alternativeHotels } from "@/constants/routes/hotelReservation"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext"

View File

@@ -4,15 +4,19 @@ import { useCallback, useMemo, useRef, useState } from "react"
import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import {
BookingCodeFilterEnum,
useBookingCodeFilterStore,
} from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import {
alternativeHotels,
selectHotel,
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import {
alternativeHotels,
selectHotel,
} from "@/constants/routes/hotelReservation"
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
import { useHotelFilterStore } from "@/stores/hotel-filters"
import { useHotelsMapStore } from "@/stores/hotels-map"
@@ -21,7 +25,6 @@ import InteractiveMap from "@/components/Maps/InteractiveMap"
import Link from "@/components/TempDesignSystem/Link"
import useLang from "@/hooks/useLang"
import { useScrollToTop } from "@/hooks/useScrollToTop"
import { debounce } from "@/utils/debounce"
import BookingCodeFilter from "../../BookingCodeFilter"
import FilterAndSortModal from "../../Filters/FilterAndSortModal"
@@ -31,7 +34,6 @@ import { getVisibleHotels } from "./utils"
import styles from "./selectHotelMapContent.module.css"
import type { SelectHotelMapProps } from "@/types/components/hotelReservation/selectHotel/map"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers"
const SKELETON_LOAD_DELAY = 750

View File

@@ -2,13 +2,13 @@
import { cx } from "class-variance-authority"
import { useIntl } from "react-intl"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { IconButton } from "@scandic-hotels/design-system/IconButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { longDateFormat } from "@/constants/dateFormats"
import { useRatesStore } from "@/stores/select-rate"
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"

View File

@@ -3,6 +3,7 @@ import { Fragment } from "react"
import { Button as ButtonRAC } from "react-aria-components"
import { useIntl } from "react-intl"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import Body from "@scandic-hotels/design-system/Body"
import { Button } from "@scandic-hotels/design-system/Button"
@@ -12,7 +13,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Subtitle from "@scandic-hotels/design-system/Subtitle"
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
import { longDateFormat } from "@/constants/dateFormats"
import { useRatesStore } from "@/stores/select-rate"
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"

View File

@@ -1,6 +1,7 @@
import { useEffect } from "react"
import { useIntl } from "react-intl"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import Subtitle from "@scandic-hotels/design-system/Subtitle"
@@ -8,7 +9,6 @@ import Subtitle from "@scandic-hotels/design-system/Subtitle"
import { useRatesStore } from "@/stores/select-rate"
import { useRoomContext } from "@/contexts/SelectRate/Room"
import useStickyPosition from "@/hooks/useStickyPosition"
import SelectedRoomPanel from "./SelectedRoomPanel"
import { roomSelectionPanelVariants } from "./variants"

View File

@@ -1,10 +1,10 @@
"use client"
import { useIntl } from "react-intl"
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { alternativeHotels } from "@/constants/routes/hotelReservation"
import { useRatesStore } from "@/stores/select-rate"
import Alert from "@/components/TempDesignSystem/Alert"

View File

@@ -13,6 +13,7 @@ import {
import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
import { IconButton } from "@scandic-hotels/design-system/IconButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
@@ -27,8 +28,6 @@ import useLang from "@/hooks/useLang"
import styles from "./bookingCodeFilter.module.css"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
export default function BookingCodeFilter() {
const intl = useIntl()
const lang = useLang()

View File

@@ -2,6 +2,7 @@
import { useSession } from "next-auth/react"
import { useIntl } from "react-intl"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { Typography } from "@scandic-hotels/design-system/Typography"
@@ -14,8 +15,6 @@ import { getBreakfastMessage } from "./getBreakfastMessage"
import styles from "./breakfastMessage.module.css"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
export default function BreakfastMessage({
breakfastIncludedMember,
breakfastIncludedStandard,

View File

@@ -2,6 +2,7 @@
import { useSession } from "next-auth/react"
import { useIntl } from "react-intl"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
@@ -19,7 +20,6 @@ import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
interface CampaignProps extends SharedRateCardProps {
campaign: PriceProduct[]

View File

@@ -1,6 +1,7 @@
"use client"
import { useIntl } from "react-intl"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import PointsRateCard from "@scandic-hotels/design-system/PointsRateCard"
import { sumPackages } from "@/components/HotelReservation/utils"
@@ -10,7 +11,6 @@ import useRateTitles from "@/hooks/booking/useRateTitles"
import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
interface RedemptionsProps extends SharedRateCardProps {
redemptions: RedemptionProduct[]

View File

@@ -2,6 +2,7 @@
import { useSession } from "next-auth/react"
import { useIntl } from "react-intl"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard"
@@ -19,7 +20,6 @@ import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
interface Rate {
label: string

View File

@@ -2,6 +2,7 @@
import { useSession } from "next-auth/react"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
@@ -20,7 +21,6 @@ import Regular from "./Regular"
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
import type { RatesProps } from "@/types/components/hotelReservation/selectRate/rates"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
export default function Rates({
roomConfiguration: {

View File

@@ -3,6 +3,10 @@
import { notFound, useSearchParams } from "next/navigation"
import { useIntl } from "react-intl"
import {
parseSelectRateSearchParams,
searchParamsToRecord,
} from "@scandic-hotels/booking-flow/utils/url"
import { trpc } from "@scandic-hotels/trpc/client"
import { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
@@ -10,7 +14,6 @@ import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang"
import RatesProvider from "@/providers/RatesProvider"
import { parseSelectRateSearchParams, searchParamsToRecord } from "@/utils/url"
import RateSummary from "./RateSummary"
import Rooms from "./Rooms"

View File

@@ -3,11 +3,14 @@
import { useSearchParams } from "next/navigation"
import React from "react"
import {
parseSelectRateSearchParams,
searchParamsToRecord,
} from "@scandic-hotels/booking-flow/utils/url"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import TrackingSDK from "@/components/TrackingSDK"
import useLang from "@/hooks/useLang"
import { parseSelectRateSearchParams, searchParamsToRecord } from "@/utils/url"
import { getValidDates } from "../getValidDates"
import { getTracking } from "./tracking"

View File

@@ -2,7 +2,7 @@
import { useCallback, useEffect, useRef, useState } from "react"
import { debounce } from "@/utils/debounce"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import styles from "./mapModal.module.css"

View File

@@ -3,9 +3,9 @@
import { useEffect, useRef, useState } from "react"
import { useIntl } from "react-intl"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { debounce } from "@/utils/debounce"
import { getEmployeeInfo } from "@/utils/user"
import styles from "./digitalTeamMemberCard.module.css"

View File

@@ -1,5 +1,6 @@
import { useIntl } from "react-intl"
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import IconChip from "@scandic-hotels/design-system/IconChip"
import DiscountIcon from "@scandic-hotels/design-system/Icons/DiscountIcon"
@@ -7,8 +8,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"

View File

@@ -2,15 +2,14 @@
import { useCallback, useRef } from "react"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { trpc } from "@scandic-hotels/trpc/client"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { StickyElementNameEnum } from "@/stores/sticky-position"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang"
import useStickyPosition from "@/hooks/useStickyPosition"
import { debounce } from "@/utils/debounce"
import styles from "./sitewideAlert.module.css"

View File

@@ -2,10 +2,10 @@
import { useRef } from "react"
import { StickyElementNameEnum } from "@/stores/sticky-position"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import MeetingPackageWidget from "@/components/MeetingPackageWidget"
import useStickyPosition from "@/hooks/useStickyPosition"
import styles from "./stickyMeetingPackageWidget.module.css"

View File

@@ -13,11 +13,10 @@ import {
} from "react-aria-components"
import { useIntl } from "react-intl"
import { debounce } from "@scandic-hotels/common/utils/debounce"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { debounce } from "@/utils/debounce"
import { Arrow } from "../Popover/Arrow"
import { Breadcrumb } from "./Breadcrumb"
import { splitBreadcrumbs } from "./utils"

View File

@@ -7,7 +7,6 @@ import BedSingleIcon from "@scandic-hotels/design-system/Icons/BedSingleIcon"
import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIcon"
import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon"
import BedWallExtraIcon from "@scandic-hotels/design-system/Icons/BedWallExtraIcon"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import type { IconProps } from "@scandic-hotels/design-system/Icons"
@@ -19,7 +18,6 @@ import type { JSX } from "react"
export const FamilyAndFriendsCodes = ["D000029555", "D000029271", "D000029195"]
export const bookingSearchTypes = [SEARCH_TYPE_REDEMPTION] as const
export const SEARCHTYPE = "searchtype"
export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError"

View File

@@ -1,69 +0,0 @@
/**
* @typedef {import('@scandic-hotels/common/constants/language').Lang} Lang
*/
/**
* @param {Lang} lang
*/
export function hotelreservation(lang) {
return `/${lang}/hotelreservation`
}
/**
* @param {Lang} lang
*/
export function bookingConfirmation(lang) {
return `${hotelreservation(lang)}/booking-confirmation`
}
/**
* @param {Lang} lang
*/
export function details(lang) {
return `${hotelreservation(lang)}/details`
}
/**
* @param {Lang} lang
*/
export function selectHotel(lang) {
return `${hotelreservation(lang)}/select-hotel`
}
/**
* @param {Lang} lang
*/
export function selectHotelMap(lang) {
return `${hotelreservation(lang)}/select-hotel/map`
}
/**
* @param {Lang} lang
* @param {string} hotelId
* @param {string} fromdate
* @param {string} todate
*/
export function selectRateWithParams(lang, hotelId, fromdate, todate) {
return `${hotelreservation(lang)}/select-rate?room%5B0%5D.adults=1&fromdate=${fromdate}&todate=${todate}&hotel=${hotelId}`
}
/**
* @param {Lang} lang
*/
export function alternativeHotels(lang) {
return `${hotelreservation(lang)}/alternative-hotels`
}
/**
* @param {Lang} lang
*/
export function alternativeHotelsMap(lang) {
return `${hotelreservation(lang)}/alternative-hotels/map`
}
/**
* @param {Lang} lang
*/
export function guaranteeCallback(lang) {
return `${hotelreservation(lang)}/gla-payment-callback`
}

View File

@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
import { debounce } from "../utils/debounce"
import { debounce } from "@scandic-hotels/common/utils/debounce"
export default function useScrollSpy(
sectionIds: string[],

View File

@@ -2,7 +2,6 @@ import { redirect } from "next/navigation"
import { isDefined } from "@scandic-hotels/common/utils/isDefined"
// import { isDefined } from "@/server/utils"
import { getLang } from "@/i18n/serverContext"
import { cache } from "@/utils/cache"
@@ -290,37 +289,6 @@ export const getPageSettings = cache(async function getMemoizedPageSettings(
return caller.contentstack.pageSettings.get({ lang })
})
export const isBookingWidgetHidden = cache(
async function isMemoizedBookingWidgetHidden() {
const lang = await getLang()
const [pageSettingsResult, siteConfigResults] = await Promise.allSettled([
getPageSettings(lang),
getSiteConfig(lang),
])
const pageSettings =
pageSettingsResult.status === "fulfilled"
? pageSettingsResult.value
: null
const siteConfig =
siteConfigResults.status === "fulfilled" ? siteConfigResults.value : null
const hideFromPageSettings =
pageSettings?.page.settings.hide_booking_widget ?? false
const hideFromSiteConfig = siteConfig?.bookingWidgetDisabled ?? false
return hideFromPageSettings || hideFromSiteConfig
}
)
export const getPageSettingsBookingCode = cache(
async function getMemoizedPageSettingsBookingCode() {
const lang = await getLang()
const pageSettings = await getPageSettings(lang)
return pageSettings?.page.settings.booking_code ?? ""
}
)
export const getJobylonFeed = cache(async function getMemoizedJobylonFeed() {
const caller = await serverClient()
return caller.partner.jobylon.feed.get()

View File

@@ -19,15 +19,6 @@
"test:watch": "vitest",
"ci:build": "yarn lint && yarn test && yarn build",
"clean": "rm -rf .next",
"i18n:extract": "formatjs extract \"{actions,app,components,constants,contexts,env,hooks,i18n,lib,middlewares,netlify,providers,server,services,stores,utils}/**/*.{ts,tsx}\" --format i18n/tooling/formatter.mjs --out-file i18n/tooling/extracted.json",
"i18n:upload": "jiti i18n/tooling/upload.ts",
"i18n:download": "jiti i18n/tooling/download.ts",
"i18n:compile": "formatjs compile-folder --ast --format i18n/tooling/formatter.mjs i18n/tooling/translations-all i18n/dictionaries",
"i18n:push": "yarn i18n:extract && yarn i18n:upload",
"i18n:pull": "yarn i18n:download && yarn i18n:compile",
"i18n:sync": "yarn i18n:push && yarn i18n:pull",
"i18n:diff": "node i18n/tooling/diff.mjs",
"i18n:clean": "jiti i18n/tooling/clean.ts",
"check-types": "tsc --noEmit"
},
"dependencies": {

View File

@@ -12,6 +12,7 @@ import {
import { detailsStorageName } from "."
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
import type { Packages } from "@scandic-hotels/trpc/types/packages"
import type {
CorporateChequeProduct,
@@ -20,7 +21,6 @@ import type {
VoucherProduct,
} from "@scandic-hotels/trpc/types/roomAvailability"
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
import type { Price } from "@/types/components/hotelReservation/price"

View File

@@ -3,9 +3,10 @@ import { produce } from "immer"
import { useContext } from "react"
import { create, useStore } from "zustand"
import { getDefaultCountryFromLang } from "@/constants/languages"
import { dt } from "@scandic-hotels/common/dt"
import { getDefaultCountryFromLang } from "@/constants/languages"
import { DetailsContext } from "@/contexts/Details"
import {
@@ -16,6 +17,8 @@ import {
writeToSessionStorage,
} from "./helpers"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast"
import type { Price } from "@/types/components/hotelReservation/price"
import { StepEnum } from "@/types/enums/step"
@@ -25,7 +28,6 @@ import type {
RoomState,
} from "@/types/stores/enter-details"
import type { SafeUser } from "@/types/user"
import type { Lang } from "@/constants/routes/hotelReservation"
const defaultGuestState = {
countryCode: "",

View File

@@ -2,12 +2,13 @@ import { produce } from "immer"
import { useContext } from "react"
import { create, useStore } from "zustand"
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
import { serializeBookingSearchParams } from "@scandic-hotels/booking-flow/utils/url"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
import { RatesContext } from "@/contexts/Rates"
import { serializeBookingSearchParams } from "@/utils/url"
import {
findDefaultCurrency,
@@ -18,7 +19,6 @@ import {
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
import type { InitialState, RatesState } from "@/types/stores/rates"
export function createRatesStore({

View File

@@ -5,7 +5,7 @@ import { create } from "zustand"
import {
parseBookingWidgetSearchParams,
searchParamsToRecord,
} from "@/utils/url"
} from "@scandic-hotels/booking-flow/utils/url"
import { checkIsSameBooking } from "./enter-details/helpers"

View File

@@ -1,38 +0,0 @@
import type { Child } from "@scandic-hotels/trpc/types/child"
export type ChildBed = {
label: string
value: number
}
export type GuestsRoom = {
adults: number
childrenInRoom: Child[]
}
export type GuestsRoomPickerProps = {
index: number
}
export type SelectorProps = {
roomIndex: number
currentAdults: number
currentChildren: Child[]
childrenInAdultsBed: number
}
export type ChildInfoSelectorProps = {
child: Child
adults: number
index: number
roomIndex: number
childrenInAdultsBed: number
}
export interface CounterProps {
count: number
handleOnIncrease: () => void
handleOnDecrease: () => void
disableIncrease: boolean
disableDecrease: boolean
}

View File

@@ -1,42 +0,0 @@
import type { VariantProps } from "class-variance-authority"
import type { z } from "zod"
import type {
bookingCodeSchema,
bookingWidgetSchema,
} from "@/components/Forms/BookingWidget/schema"
import type { bookingWidgetVariants } from "@/components/Forms/BookingWidget/variants"
import type { BookingSearchType } from "../hotelReservation/booking"
import type { GuestsRoom } from "./guestsRoomsPicker"
export type BookingWidgetSchema = z.output<typeof bookingWidgetSchema>
export type BookingCodeSchema = z.output<typeof bookingCodeSchema>
export type BookingWidgetSearchData = {
city?: string
hotelId?: string
fromDate?: string
toDate?: string
rooms?: GuestsRoom[]
bookingCode?: string
searchType?: BookingSearchType
}
export type BookingWidgetType = VariantProps<
typeof bookingWidgetVariants
>["type"]
export interface BookingWidgetProps {
type?: BookingWidgetType
booking: BookingWidgetSearchData
}
export interface BookingWidgetClientProps {
type?: BookingWidgetType
data: BookingWidgetSearchData
pageSettingsBookingCodePromise: Promise<string> | null
}
export interface BookingWidgetToggleButtonProps {
openMobileSearch: () => void
}

View File

@@ -1,21 +0,0 @@
import type { DateRange } from "react-day-picker"
export interface DatePickerFormProps {
name?: string
}
interface DatePickerProps {
close: () => void
startMonth?: Date
hideHeader?: boolean
}
export interface DatePickerRangeProps extends DatePickerProps {
selectedRange: DateRange | undefined
handleOnSelect: (nextRange: DateRange | undefined, selectedDay: Date) => void
}
export interface DatePickerSingleProps extends DatePickerProps {
selectedDate: Date
handleOnSelect: (selected: Date) => void
}

View File

@@ -1,12 +0,0 @@
import type { BookingWidgetType } from "@/types/components/bookingWidget"
export interface BookingWidgetFormProps {
type?: BookingWidgetType
onClose: () => void
}
export interface BookingWidgetFormContentProps {
formId: string
onSubmit: () => void
isSearching: boolean
}

View File

@@ -1,3 +0,0 @@
import type { bookingSearchTypes } from "@/constants/booking"
export type BookingSearchType = (typeof bookingSearchTypes)[number]

View File

@@ -1,3 +1,4 @@
import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType"
import type { productTypePointsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice"
import type { Child } from "@scandic-hotels/trpc/types/child"
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
@@ -10,7 +11,6 @@ import type {
guestDetailsSchema,
signedInDetailsSchema,
} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
import type { BookingSearchType } from "../booking"
import type { Price } from "../price"
export type DetailsSchema = z.output<typeof guestDetailsSchema>

Some files were not shown because too many files have changed in this diff Show More