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:
53
apps/partner-sas/app/[lang]/debug/page.tsx
Normal file
53
apps/partner-sas/app/[lang]/debug/page.tsx
Normal 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>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import "@scandic-hotels/design-system/style.css"
|
|
||||||
import "@scandic-hotels/design-system/fonts.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 "@/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 { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
import { TrpcProvider } from "@scandic-hotels/trpc/Provider"
|
import { TrpcProvider } from "@scandic-hotels/trpc/Provider"
|
||||||
|
|
||||||
@@ -9,6 +11,8 @@ import { getMessages } from "@/i18n"
|
|||||||
import ClientIntlProvider from "@/i18n/Provider"
|
import ClientIntlProvider from "@/i18n/Provider"
|
||||||
import { setLang } from "@/i18n/serverContext"
|
import { setLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
|
import { trackBookingSearchClick } from "../utils/tracking"
|
||||||
|
|
||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
@@ -35,21 +39,39 @@ export default async function RootLayout(props: RootLayoutProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>{/* TODO */}</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>
|
|
||||||
<body className="scandic">
|
<body className="scandic">
|
||||||
<ClientIntlProvider
|
<div className="root">
|
||||||
defaultLocale={Lang.en}
|
<ClientIntlProvider
|
||||||
locale={params.lang}
|
defaultLocale={Lang.en}
|
||||||
messages={messages}
|
locale={params.lang}
|
||||||
>
|
messages={messages}
|
||||||
{/* TODO handle onError */}
|
>
|
||||||
<TrpcProvider>{children}</TrpcProvider>
|
{/* TODO handle onError */}
|
||||||
</ClientIntlProvider>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
.page {
|
|
||||||
padding-left: 200px;
|
|
||||||
padding-top: 200px;
|
|
||||||
}
|
|
||||||
@@ -1,44 +1,29 @@
|
|||||||
import { Temp } from "@scandic-hotels/booking-flow/test-entry"
|
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
|
||||||
|
|
||||||
import { serverClient } from "@/lib/trpc"
|
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() {
|
export default async function Home(props: SearchParams<{ lang: Lang }>) {
|
||||||
const intl = await getIntl()
|
const searchParams = await props.searchParams
|
||||||
const caller = await serverClient()
|
|
||||||
const destinations = await caller.autocomplete.destinations({
|
// TODO we need this import right now to ensure configureServerClient is called,
|
||||||
lang: Lang.en,
|
// but we should ensure it's called in a layout instead.
|
||||||
includeTypes: ["hotels"],
|
const _caller = await serverClient()
|
||||||
query: "Göteborg",
|
const lang = await getLang()
|
||||||
})
|
|
||||||
const hotel = destinations.hits.hotels[0].name
|
const booking = parseBookingWidgetSearchParams(searchParams)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.page}>
|
<div>
|
||||||
<main>
|
<BookingWidget booking={booking} lang={lang} />
|
||||||
<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>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
apps/partner-sas/app/favicon.ico
Normal file
BIN
apps/partner-sas/app/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
11
apps/partner-sas/app/utils/tracking.ts
Normal file
11
apps/partner-sas/app/utils/tracking.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
export function trackBookingSearchClick(
|
||||||
|
searchTerm: string,
|
||||||
|
searchType: "hotel" | "destination"
|
||||||
|
) {
|
||||||
|
console.log("TODO: Implement trackBookingSearchClick", {
|
||||||
|
searchTerm,
|
||||||
|
searchType,
|
||||||
|
})
|
||||||
|
}
|
||||||
24
apps/partner-sas/components/IntlProvider.tsx
Normal file
24
apps/partner-sas/components/IntlProvider.tsx
Normal 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>
|
||||||
|
)
|
||||||
|
}
|
||||||
107
apps/partner-sas/globals.css
Normal file
107
apps/partner-sas/globals.css
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,17 @@ const nextConfig: NextConfig = {
|
|||||||
],
|
],
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
|
|
||||||
|
experimental: {
|
||||||
|
swcPlugins: [
|
||||||
|
[
|
||||||
|
"@swc/plugin-formatjs",
|
||||||
|
{
|
||||||
|
ast: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
webpack: function (config: any) {
|
webpack: function (config: any) {
|
||||||
config.module.rules.push(
|
config.module.rules.push(
|
||||||
{
|
{
|
||||||
@@ -27,17 +38,6 @@ const nextConfig: NextConfig = {
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
|
|
||||||
experimental: {
|
|
||||||
swcPlugins: [
|
|
||||||
[
|
|
||||||
"@swc/plugin-formatjs",
|
|
||||||
{
|
|
||||||
ast: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Sentry.withSentryConfig(nextConfig, {
|
export default Sentry.withSentryConfig(nextConfig, {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"@playwright/test": "^1.53.1",
|
"@playwright/test": "^1.53.1",
|
||||||
"@scandic-hotels/common": "workspace:*",
|
"@scandic-hotels/common": "workspace:*",
|
||||||
"@scandic-hotels/typescript-config": "workspace:*",
|
"@scandic-hotels/typescript-config": "workspace:*",
|
||||||
|
"@swc/plugin-formatjs": "^3.2.2",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "19.1.0",
|
"@types/react": "19.1.0",
|
||||||
"@types/react-dom": "19.1.0",
|
"@types/react-dom": "19.1.0",
|
||||||
|
|||||||
@@ -28,25 +28,37 @@ export default defineConfig({
|
|||||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
baseURL: "http://localhost:3001",
|
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 */
|
/* 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 */
|
/* Configure projects for major browsers */
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: "chromium",
|
name: "chromium",
|
||||||
use: { ...devices["Desktop Chrome"] },
|
use: {
|
||||||
|
...devices["Desktop Chrome"],
|
||||||
|
viewport: { width: 1400, height: 720 },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "firefox",
|
name: "firefox",
|
||||||
use: { ...devices["Desktop Firefox"] },
|
use: {
|
||||||
|
...devices["Desktop Firefox"],
|
||||||
|
viewport: { width: 1400, height: 720 },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "webkit",
|
name: "webkit",
|
||||||
use: { ...devices["Desktop Safari"] },
|
use: {
|
||||||
|
...devices["Desktop Safari"],
|
||||||
|
viewport: { width: 1400, height: 720 },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Test against mobile viewports. */
|
/* Test against mobile viewports. */
|
||||||
|
|||||||
1
apps/partner-sas/public/_static/icons/cancel.svg
Normal file
1
apps/partner-sas/public/_static/icons/cancel.svg
Normal 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 |
206
apps/partner-sas/tests/booking-widget.spec.ts
Normal file
206
apps/partner-sas/tests/booking-widget.spec.ts
Normal 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()
|
||||||
|
}
|
||||||
@@ -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()
|
|
||||||
})
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import StartPage from "@/components/ContentType/StartPage"
|
import StartPage from "@/components/ContentType/StartPage"
|
||||||
import { parseBookingWidgetSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import type { NextSearchParams, PageArgs } from "@/types/params"
|
import type { NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
|
import {
|
||||||
|
bookingConfirmation,
|
||||||
|
details,
|
||||||
|
} from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
import { getServiceToken } from "@scandic-hotels/common/tokenManager"
|
import { getServiceToken } from "@scandic-hotels/common/tokenManager"
|
||||||
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
|
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 { isValidSession } from "@scandic-hotels/trpc/utils/session"
|
||||||
|
|
||||||
import { PaymentCallbackStatusEnum } from "@/constants/booking"
|
import { PaymentCallbackStatusEnum } from "@/constants/booking"
|
||||||
import {
|
|
||||||
bookingConfirmation,
|
|
||||||
details,
|
|
||||||
} from "@/constants/routes/hotelReservation"
|
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
import { auth } from "@/auth"
|
import { auth } from "@/auth"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
|
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
|
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
|
||||||
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
|
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
|
||||||
import { MapContainer } from "@/components/MapContainer"
|
import { MapContainer } from "@/components/MapContainer"
|
||||||
import { parseSelectHotelSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { cookies } from "next/headers"
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
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 { FamilyAndFriendsCodes } from "@/constants/booking"
|
||||||
import { alternativeHotelsMap } from "@/constants/routes/hotelReservation"
|
|
||||||
|
|
||||||
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
||||||
import SelectHotel from "@/components/HotelReservation/SelectHotel"
|
import SelectHotel from "@/components/HotelReservation/SelectHotel"
|
||||||
@@ -13,7 +15,6 @@ import { getTracking } from "@/components/HotelReservation/SelectHotel/tracking"
|
|||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
||||||
import { parseSelectHotelSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type LangParams,
|
type LangParams,
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { cookies } from "next/headers"
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
|
import { parseDetailsSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import { FamilyAndFriendsCodes } from "@/constants/booking"
|
import { FamilyAndFriendsCodes } from "@/constants/booking"
|
||||||
import {
|
import {
|
||||||
getBreakfastPackages,
|
getBreakfastPackages,
|
||||||
@@ -20,7 +22,6 @@ import EnterDetailsTrackingWrapper from "@/components/HotelReservation/EnterDeta
|
|||||||
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
||||||
import RoomProvider from "@/providers/Details/RoomProvider"
|
import RoomProvider from "@/providers/Details/RoomProvider"
|
||||||
import EnterDetailsProvider from "@/providers/EnterDetailsProvider"
|
import EnterDetailsProvider from "@/providers/EnterDetailsProvider"
|
||||||
import { parseDetailsSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import stringify from "json-stable-stringify-without-jsonify"
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
|
import { parseSelectHotelSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
|
import { SelectHotelMapContainer } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainer"
|
||||||
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
|
import { SelectHotelMapContainerSkeleton } from "@/components/HotelReservation/SelectHotel/SelectHotelMap/SelectHotelMapContainerSkeleton"
|
||||||
import { MapContainer } from "@/components/MapContainer"
|
import { MapContainer } from "@/components/MapContainer"
|
||||||
import { parseSelectHotelSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { cookies } from "next/headers"
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { Suspense } from "react"
|
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 { FamilyAndFriendsCodes } from "@/constants/booking"
|
||||||
import { selectHotelMap } from "@/constants/routes/hotelReservation"
|
|
||||||
|
|
||||||
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
import FnFNotAllowedAlert from "@/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert"
|
||||||
import SelectHotel from "@/components/HotelReservation/SelectHotel"
|
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 { getTracking } from "@/components/HotelReservation/SelectHotel/tracking"
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
import { getHotelSearchDetails } from "@/utils/hotelSearchDetails"
|
||||||
import { parseSelectHotelSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { notFound } from "next/navigation"
|
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 { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||||
|
|
||||||
import { combineRegExps, rateTypeRegex } from "@/constants/booking"
|
import { combineRegExps, rateTypeRegex } from "@/constants/booking"
|
||||||
|
|
||||||
import SelectRate from "@/components/HotelReservation/SelectRate"
|
import SelectRate from "@/components/HotelReservation/SelectRate"
|
||||||
import { parseSelectRateSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
|||||||
@@ -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 { getDestinationCityPage } 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"
|
import type { NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
@@ -20,5 +22,7 @@ export default async function BookingWidgetDestinationCityPage(
|
|||||||
|
|
||||||
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
|
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
|
||||||
|
|
||||||
return <BookingWidget booking={booking} />
|
const lang = await getLang()
|
||||||
|
|
||||||
|
return <BookingWidget booking={booking} lang={lang} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import { BookingWidget } from "@/components/BookingWidget"
|
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
import { parseBookingWidgetSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import type { NextSearchParams, PageArgs } from "@/types/params"
|
import type { NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
@@ -12,9 +13,10 @@ export default async function BookingWidgetHotelPage(
|
|||||||
const searchParams = await props.searchParams
|
const searchParams = await props.searchParams
|
||||||
|
|
||||||
const hotelPageData = await getHotelPage()
|
const hotelPageData = await getHotelPage()
|
||||||
|
const lang = await getLang()
|
||||||
const hotelData = await getHotel({
|
const hotelData = await getHotel({
|
||||||
hotelId: hotelPageData?.hotel_page_id || "",
|
hotelId: hotelPageData?.hotel_page_id || "",
|
||||||
language: await getLang(),
|
language: lang,
|
||||||
isCardOnlyPayment: false,
|
isCardOnlyPayment: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -34,5 +36,5 @@ export default async function BookingWidgetHotelPage(
|
|||||||
|
|
||||||
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
|
const booking = parseBookingWidgetSearchParams(bookingWidgetSearchParams)
|
||||||
|
|
||||||
return <BookingWidget booking={booking} />
|
return <BookingWidget booking={booking} lang={lang} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
// This file is crucial for displaying a loading
|
||||||
// state immediately in the booking flow.
|
// state immediately in the booking flow.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { BookingWidget } from "@/components/BookingWidget"
|
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||||
import { parseBookingWidgetSearchParams } from "@/utils/url"
|
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
@@ -10,5 +12,7 @@ export default async function BookingWidgetPage(
|
|||||||
|
|
||||||
const booking = parseBookingWidgetSearchParams(searchParams)
|
const booking = parseBookingWidgetSearchParams(searchParams)
|
||||||
|
|
||||||
return <BookingWidget booking={booking} />
|
const lang = await getLang()
|
||||||
|
|
||||||
|
return <BookingWidget booking={booking} lang={lang} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { BookingWidget } from "@/components/BookingWidget"
|
import { BookingWidget } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||||
import { parseBookingWidgetSearchParams } from "@/utils/url"
|
import { parseBookingWidgetSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
@@ -10,5 +12,7 @@ export default async function BookingWidgetPage(
|
|||||||
|
|
||||||
const booking = parseBookingWidgetSearchParams(searchParams)
|
const booking = parseBookingWidgetSearchParams(searchParams)
|
||||||
|
|
||||||
return <BookingWidget booking={booking} />
|
const lang = await getLang()
|
||||||
|
|
||||||
|
return <BookingWidget booking={booking} lang={lang} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
|||||||
import Script from "next/script"
|
import Script from "next/script"
|
||||||
import { SessionProvider } from "next-auth/react"
|
import { SessionProvider } from "next-auth/react"
|
||||||
|
|
||||||
|
import { BookingFlowTrackingProvider } from "@scandic-hotels/booking-flow/BookingFlowTrackingProvider"
|
||||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
|
|
||||||
import TrpcProvider from "@/lib/trpc/Provider"
|
import TrpcProvider from "@/lib/trpc/Provider"
|
||||||
@@ -26,6 +27,7 @@ import { FontPreload } from "@/fonts/font-preloading"
|
|||||||
import { getMessages } from "@/i18n"
|
import { getMessages } from "@/i18n"
|
||||||
import ClientIntlProvider from "@/i18n/Provider"
|
import ClientIntlProvider from "@/i18n/Provider"
|
||||||
import { setLang } from "@/i18n/serverContext"
|
import { setLang } from "@/i18n/serverContext"
|
||||||
|
import { trackBookingSearchClick } from "@/utils/tracking/booking"
|
||||||
|
|
||||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||||
|
|
||||||
@@ -65,17 +67,23 @@ export default async function RootLayout(
|
|||||||
>
|
>
|
||||||
<TrpcProvider>
|
<TrpcProvider>
|
||||||
<RACRouterProvider>
|
<RACRouterProvider>
|
||||||
<RouteChange />
|
<BookingFlowTrackingProvider
|
||||||
<SitewideAlert />
|
trackingFunctions={{
|
||||||
<Header />
|
trackBookingSearchClick,
|
||||||
{bookingwidget}
|
}}
|
||||||
{children}
|
>
|
||||||
<Footer />
|
<RouteChange />
|
||||||
<ToastHandler />
|
<SitewideAlert />
|
||||||
<SessionRefresher />
|
<Header />
|
||||||
<StorageCleaner />
|
{bookingwidget}
|
||||||
<CookieBotConsent />
|
{children}
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
<Footer />
|
||||||
|
<ToastHandler />
|
||||||
|
<SessionRefresher />
|
||||||
|
<StorageCleaner />
|
||||||
|
<CookieBotConsent />
|
||||||
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
|
</BookingFlowTrackingProvider>
|
||||||
</RACRouterProvider>
|
</RACRouterProvider>
|
||||||
</TrpcProvider>
|
</TrpcProvider>
|
||||||
</ClientIntlProvider>
|
</ClientIntlProvider>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import React, { Suspense } from "react"
|
import React, { Suspense } from "react"
|
||||||
|
|
||||||
|
import { hotelreservation } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { partnerSas } from "@scandic-hotels/common/constants/routes/myPages"
|
import { partnerSas } from "@scandic-hotels/common/constants/routes/myPages"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
||||||
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
|
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { hotelreservation } from "@/constants/routes/hotelReservation"
|
|
||||||
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
|
|||||||
@@ -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}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -4,12 +4,12 @@ import { useMap, useMapsLibrary } from "@vis.gl/react-google-maps"
|
|||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { debounce } from "@scandic-hotels/common/utils/debounce"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { useDestinationDataStore } from "@/stores/destination-data"
|
import { useDestinationDataStore } from "@/stores/destination-data"
|
||||||
|
|
||||||
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
|
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import HotelListContent from "./Content"
|
import HotelListContent from "./Content"
|
||||||
import HotelListSkeleton from "./HotelListSkeleton"
|
import HotelListSkeleton from "./HotelListSkeleton"
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { FormProvider, useForm } from "react-hook-form"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
import { z } from "zod"
|
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"
|
import { toast } from "@/components/TempDesignSystem/Toasts"
|
||||||
|
|
||||||
const destinationSearchFormSchema = z.object({
|
const destinationSearchFormSchema = z.object({
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
} from "react"
|
} from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { debounce } from "@scandic-hotels/common/utils/debounce"
|
||||||
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
|
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
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 DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
|
||||||
import { useScrollToTop } from "@/hooks/useScrollToTop"
|
import { useScrollToTop } from "@/hooks/useScrollToTop"
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import DynamicMap from "./DynamicMap"
|
import DynamicMap from "./DynamicMap"
|
||||||
import MapContent from "./MapContent"
|
import MapContent from "./MapContent"
|
||||||
|
|||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
import { useRef } from "react"
|
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 { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { StickyElementNameEnum } from "@/stores/sticky-position"
|
|
||||||
|
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
|
|
||||||
import styles from "./sidebarContentWrapper.module.css"
|
import styles from "./sidebarContentWrapper.module.css"
|
||||||
|
|
||||||
interface SidebarContentWrapperProps extends React.PropsWithChildren {
|
interface SidebarContentWrapperProps extends React.PropsWithChildren {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import {
|
|||||||
} from "react"
|
} from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { debounce } from "@scandic-hotels/common/utils/debounce"
|
||||||
import { Button } from "@scandic-hotels/design-system/Button"
|
import { Button } from "@scandic-hotels/design-system/Button"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
|
|
||||||
import InteractiveMap from "@/components/Maps/InteractiveMap"
|
import InteractiveMap from "@/components/Maps/InteractiveMap"
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import Sidebar from "./Sidebar"
|
import Sidebar from "./Sidebar"
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
import { type PropsWithChildren, useRef } from "react"
|
import { type PropsWithChildren, 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 useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
|
|
||||||
import styles from "./mapWithCard.module.css"
|
import styles from "./mapWithCard.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
|
|
||||||
|
import { selectRateWithParams } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { selectRateWithParams } from "@/constants/routes/hotelReservation"
|
|
||||||
|
|
||||||
import ImageGallery from "@/components/ImageGallery"
|
import ImageGallery from "@/components/ImageGallery"
|
||||||
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|||||||
@@ -11,13 +11,12 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
} from "react"
|
} 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 { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { StickyElementNameEnum } from "@/stores/sticky-position"
|
|
||||||
|
|
||||||
import useScrollShadows from "@/hooks/useScrollShadows"
|
import useScrollShadows from "@/hooks/useScrollShadows"
|
||||||
import useScrollSpy from "@/hooks/useScrollSpy"
|
import useScrollSpy from "@/hooks/useScrollSpy"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
import { trackHotelTabClick } from "@/utils/tracking"
|
import { trackHotelTabClick } from "@/utils/tracking"
|
||||||
|
|
||||||
import styles from "./tabNavigation.module.css"
|
import styles from "./tabNavigation.module.css"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { FloatingBookingWidget } from "@scandic-hotels/booking-flow/BookingWidget/FloatingBookingWidget"
|
||||||
import Title from "@scandic-hotels/design-system/Title"
|
import Title from "@scandic-hotels/design-system/Title"
|
||||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||||
|
|
||||||
@@ -5,13 +6,13 @@ import { getStartPage } from "@/lib/trpc/memoizedRequests"
|
|||||||
|
|
||||||
import Blocks from "@/components/Blocks"
|
import Blocks from "@/components/Blocks"
|
||||||
import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign"
|
import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign"
|
||||||
import { FloatingBookingWidget } from "@/components/BookingWidget/FloatingBookingWidget"
|
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import styles from "./startPage.module.css"
|
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({
|
export default async function StartPage({
|
||||||
booking,
|
booking,
|
||||||
@@ -24,6 +25,7 @@ export default async function StartPage({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { header, blocks } = content.startPage
|
const { header, blocks } = content.startPage
|
||||||
|
const lang = await getLang()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.background}>
|
<div className={styles.background}>
|
||||||
@@ -32,7 +34,7 @@ export default async function StartPage({
|
|||||||
<Title color="white" textAlign="center">
|
<Title color="white" textAlign="center">
|
||||||
{header.heading}
|
{header.heading}
|
||||||
</Title>
|
</Title>
|
||||||
<FloatingBookingWidget booking={booking} />
|
<FloatingBookingWidget booking={booking} lang={lang} />
|
||||||
</div>
|
</div>
|
||||||
{header.hero_image ? (
|
{header.hero_image ? (
|
||||||
<Image
|
<Image
|
||||||
|
|||||||
@@ -19,7 +19,13 @@ import { locales } from "../locales"
|
|||||||
import styles from "./desktop.module.css"
|
import styles from "./desktop.module.css"
|
||||||
import classNames from "react-day-picker/style.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({
|
export default function DatePickerSingleDesktop({
|
||||||
close,
|
close,
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ import { locales } from "../locales"
|
|||||||
import styles from "./mobile.module.css"
|
import styles from "./mobile.module.css"
|
||||||
import classNames from "react-day-picker/style.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({
|
export default function DatePickerSingleMobile({
|
||||||
close,
|
close,
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateFormat } from "@/constants/dateFormats"
|
|
||||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||||
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import {
|
||||||
|
changeOrCancelDateFormat,
|
||||||
|
longDateFormat,
|
||||||
|
} from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import Caption from "@scandic-hotels/design-system/Caption"
|
import Caption from "@scandic-hotels/design-system/Caption"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { CancellationRuleEnum } from "@/constants/booking"
|
import { CancellationRuleEnum } from "@/constants/booking"
|
||||||
import {
|
|
||||||
changeOrCancelDateFormat,
|
|
||||||
longDateFormat,
|
|
||||||
} from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
|
|
||||||
|
import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory"
|
||||||
|
|
||||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||||
|
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import { useSearchHistory } from "@/hooks/useSearchHistory"
|
|
||||||
|
|
||||||
import { clearPaymentInfoSessionStorage } from "../../EnterDetails/Payment/helpers"
|
import { clearPaymentInfoSessionStorage } from "../../EnterDetails/Payment/helpers"
|
||||||
import { getTracking } from "./tracking"
|
import { getTracking } from "./tracking"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from "react"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
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 { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
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 Alert from "@/components/TempDesignSystem/Alert"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
|
|
||||||
import styles from "./bookingAlert.module.css"
|
import styles from "./bookingAlert.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,14 @@
|
|||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
|
|
||||||
|
import { serializeBookingSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import { PaymentCallbackStatusEnum } from "@/constants/booking"
|
import { PaymentCallbackStatusEnum } from "@/constants/booking"
|
||||||
import { detailsStorageName } from "@/stores/enter-details"
|
import { detailsStorageName } from "@/stores/enter-details"
|
||||||
|
|
||||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||||
import { trackPaymentEvent } from "@/utils/tracking"
|
import { trackPaymentEvent } from "@/utils/tracking"
|
||||||
import { trackEvent } from "@/utils/tracking/base"
|
import { trackEvent } from "@/utils/tracking/base"
|
||||||
import { serializeBookingSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
clearPaymentInfoSessionStorage,
|
clearPaymentInfoSessionStorage,
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import { FormProvider, useForm } from "react-hook-form"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
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 { logger } from "@scandic-hotels/common/logger"
|
||||||
import Body from "@scandic-hotels/design-system/Body"
|
import Body from "@scandic-hotels/design-system/Body"
|
||||||
import { Button } from "@scandic-hotels/design-system/Button"
|
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 { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { PAYMENT_METHOD_TITLES } from "@/constants/booking"
|
import { PAYMENT_METHOD_TITLES } from "@/constants/booking"
|
||||||
import { bookingConfirmation } from "@/constants/routes/hotelReservation"
|
|
||||||
import { env } from "@/env/client"
|
import { env } from "@/env/client"
|
||||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||||
|
|
||||||
@@ -30,7 +30,6 @@ import PaymentOption from "@/components/HotelReservation/PaymentOption"
|
|||||||
import { useAvailablePaymentOptions } from "@/hooks/booking/useAvailablePaymentOptions"
|
import { useAvailablePaymentOptions } from "@/hooks/booking/useAvailablePaymentOptions"
|
||||||
import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus"
|
import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
import { formatPhoneNumber } from "@/utils/phone"
|
import { formatPhoneNumber } from "@/utils/phone"
|
||||||
import { trackPaymentEvent } from "@/utils/tracking"
|
import { trackPaymentEvent } from "@/utils/tracking"
|
||||||
import { trackEvent } from "@/utils/tracking/base"
|
import { trackEvent } from "@/utils/tracking/base"
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
import { usePathname } from "next/navigation"
|
import { usePathname } from "next/navigation"
|
||||||
import { useEffect } from "react"
|
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 { detailsStorageName } from "@/stores/enter-details"
|
||||||
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useIntl } from "react-intl"
|
|||||||
import { useMediaQuery } from "usehooks-ts"
|
import { useMediaQuery } from "usehooks-ts"
|
||||||
|
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
|
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import Body from "@scandic-hotels/design-system/Body"
|
import Body from "@scandic-hotels/design-system/Body"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
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 Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import BookingCodeChip from "@/components/BookingCodeChip"
|
import BookingCodeChip from "@/components/BookingCodeChip"
|
||||||
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
||||||
import { isBookingCodeRate } from "@/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils"
|
import { isBookingCodeRate } from "@/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory"
|
||||||
|
|
||||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||||
|
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import { useSearchHistory } from "@/hooks/useSearchHistory"
|
|
||||||
|
|
||||||
import { getTracking } from "./tracking"
|
import { getTracking } from "./tracking"
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ import { memo } from "react"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import TripAdvisorChip from "@scandic-hotels/booking-flow/components/TripAdvisorChip"
|
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 Caption from "@scandic-hotels/design-system/Caption"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
|
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import {
|
|
||||||
alternativeHotelsMap,
|
|
||||||
selectHotelMap,
|
|
||||||
} from "@/constants/routes/hotelReservation"
|
|
||||||
import { useHotelsMapStore } from "@/stores/hotels-map"
|
import { useHotelsMapStore } from "@/stores/hotels-map"
|
||||||
|
|
||||||
import BookingCodeChip from "@/components/BookingCodeChip"
|
import BookingCodeChip from "@/components/BookingCodeChip"
|
||||||
|
|||||||
@@ -4,9 +4,12 @@ import { useSession } from "next-auth/react"
|
|||||||
import { useEffect, useMemo, useRef } from "react"
|
import { useEffect, useMemo, useRef } from "react"
|
||||||
import { useIntl } from "react-intl"
|
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 { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
|
||||||
|
|
||||||
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
|
|
||||||
import { useHotelFilterStore } from "@/stores/hotel-filters"
|
import { useHotelFilterStore } from "@/stores/hotel-filters"
|
||||||
import { useHotelsMapStore } from "@/stores/hotels-map"
|
import { useHotelsMapStore } from "@/stores/hotels-map"
|
||||||
|
|
||||||
@@ -23,7 +26,6 @@ import {
|
|||||||
type HotelCardListingProps,
|
type HotelCardListingProps,
|
||||||
HotelCardListingTypeEnum,
|
HotelCardListingTypeEnum,
|
||||||
} from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
} from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
export default function HotelCardListing({
|
export default function HotelCardListing({
|
||||||
hotelData,
|
hotelData,
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import { FormProvider, useForm } from "react-hook-form"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
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 { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { trpc } from "@scandic-hotels/trpc/client"
|
import { trpc } from "@scandic-hotels/trpc/client"
|
||||||
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
|
import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
|
||||||
|
|
||||||
import { guaranteeCallback } from "@/constants/routes/hotelReservation"
|
|
||||||
import { env } from "@/env/client"
|
import { env } from "@/env/client"
|
||||||
import {
|
import {
|
||||||
AncillaryStepEnum,
|
AncillaryStepEnum,
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { getNumberOfNights } from "@scandic-hotels/common/utils/dateFormatting"
|
import { getNumberOfNights } from "@scandic-hotels/common/utils/dateFormatting"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { longDateWithYearFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import { useFormContext, useWatch } from "react-hook-form"
|
import { useFormContext, useWatch } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateWithYearFormat } from "@/constants/dateFormats"
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { trpc } from "@scandic-hotels/trpc/client"
|
import { trpc } from "@scandic-hotels/trpc/client"
|
||||||
|
|
||||||
import { longDateWithYearFormat } from "@/constants/dateFormats"
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ import {
|
|||||||
import { useFormContext, useWatch } from "react-hook-form"
|
import { useFormContext, useWatch } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateWithYearFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import DatePickerSingleDesktop from "@/components/DatePicker/Single/Desktop"
|
import DatePickerSingleDesktop from "@/components/DatePicker/Single/Desktop"
|
||||||
import DatePickerSingleMobile from "@/components/DatePicker/Single/Mobile"
|
import DatePickerSingleMobile from "@/components/DatePicker/Single/Mobile"
|
||||||
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
import Modal from "@/components/HotelReservation/MyStay/Modal"
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { FormProvider, useForm } from "react-hook-form"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
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 { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
|
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { guaranteeCallback } from "@/constants/routes/hotelReservation"
|
|
||||||
import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs"
|
import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs"
|
||||||
import { env } from "@/env/client"
|
import { env } from "@/env/client"
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { shortDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { shortDateFormat } from "@/constants/dateFormats"
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
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 { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { CancellationRuleEnum } from "@/constants/booking"
|
import { CancellationRuleEnum } from "@/constants/booking"
|
||||||
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
|
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
|
|
||||||
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
import { Fragment } from "react"
|
import { Fragment } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import BookingCodeRow from "./Row/BookingCode"
|
import BookingCodeRow from "./Row/BookingCode"
|
||||||
|
|||||||
@@ -13,17 +13,14 @@ import {
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
import { useMediaQuery } from "usehooks-ts"
|
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 { ChipButton } from "@scandic-hotels/design-system/ChipButton"
|
||||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter"
|
|
||||||
|
|
||||||
import styles from "./bookingCodeFilter.module.css"
|
import styles from "./bookingCodeFilter.module.css"
|
||||||
|
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
export default function BookingCodeFilter() {
|
export default function BookingCodeFilter() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const [isOpen, setIsOpen] = useState(false)
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
|
|||||||
@@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
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 {
|
import {
|
||||||
alternativeHotelsMap,
|
alternativeHotelsMap,
|
||||||
selectHotelMap,
|
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 Link from "@/components/TempDesignSystem/Link"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
||||||
|
|
||||||
import { alternativeHotels } from "@/constants/routes/hotelReservation"
|
|
||||||
|
|
||||||
import Alert from "@/components/TempDesignSystem/Alert"
|
import Alert from "@/components/TempDesignSystem/Alert"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|||||||
@@ -4,15 +4,19 @@ import { useCallback, useMemo, useRef, useState } from "react"
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
import { useMediaQuery } from "usehooks-ts"
|
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 { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
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 { useHotelFilterStore } from "@/stores/hotel-filters"
|
||||||
import { useHotelsMapStore } from "@/stores/hotels-map"
|
import { useHotelsMapStore } from "@/stores/hotels-map"
|
||||||
|
|
||||||
@@ -21,7 +25,6 @@ import InteractiveMap from "@/components/Maps/InteractiveMap"
|
|||||||
import Link from "@/components/TempDesignSystem/Link"
|
import Link from "@/components/TempDesignSystem/Link"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import { useScrollToTop } from "@/hooks/useScrollToTop"
|
import { useScrollToTop } from "@/hooks/useScrollToTop"
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import BookingCodeFilter from "../../BookingCodeFilter"
|
import BookingCodeFilter from "../../BookingCodeFilter"
|
||||||
import FilterAndSortModal from "../../Filters/FilterAndSortModal"
|
import FilterAndSortModal from "../../Filters/FilterAndSortModal"
|
||||||
@@ -31,7 +34,6 @@ import { getVisibleHotels } from "./utils"
|
|||||||
import styles from "./selectHotelMapContent.module.css"
|
import styles from "./selectHotelMapContent.module.css"
|
||||||
|
|
||||||
import type { SelectHotelMapProps } from "@/types/components/hotelReservation/selectHotel/map"
|
import type { SelectHotelMapProps } from "@/types/components/hotelReservation/selectHotel/map"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers"
|
import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers"
|
||||||
|
|
||||||
const SKELETON_LOAD_DELAY = 750
|
const SKELETON_LOAD_DELAY = 750
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
import { cx } from "class-variance-authority"
|
import { cx } from "class-variance-authority"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { longDateFormat } from "@/constants/dateFormats"
|
|
||||||
import { useRatesStore } from "@/stores/select-rate"
|
import { useRatesStore } from "@/stores/select-rate"
|
||||||
|
|
||||||
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Fragment } from "react"
|
|||||||
import { Button as ButtonRAC } from "react-aria-components"
|
import { Button as ButtonRAC } from "react-aria-components"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import Body from "@scandic-hotels/design-system/Body"
|
import Body from "@scandic-hotels/design-system/Body"
|
||||||
import { Button } from "@scandic-hotels/design-system/Button"
|
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 Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||||
|
|
||||||
import { longDateFormat } from "@/constants/dateFormats"
|
|
||||||
import { useRatesStore } from "@/stores/select-rate"
|
import { useRatesStore } from "@/stores/select-rate"
|
||||||
|
|
||||||
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
|
||||||
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
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 { useRatesStore } from "@/stores/select-rate"
|
||||||
|
|
||||||
import { useRoomContext } from "@/contexts/SelectRate/Room"
|
import { useRoomContext } from "@/contexts/SelectRate/Room"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
|
|
||||||
import SelectedRoomPanel from "./SelectedRoomPanel"
|
import SelectedRoomPanel from "./SelectedRoomPanel"
|
||||||
import { roomSelectionPanelVariants } from "./variants"
|
import { roomSelectionPanelVariants } from "./variants"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
||||||
|
|
||||||
import { alternativeHotels } from "@/constants/routes/hotelReservation"
|
|
||||||
import { useRatesStore } from "@/stores/select-rate"
|
import { useRatesStore } from "@/stores/select-rate"
|
||||||
|
|
||||||
import Alert from "@/components/TempDesignSystem/Alert"
|
import Alert from "@/components/TempDesignSystem/Alert"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
import { useMediaQuery } from "usehooks-ts"
|
import { useMediaQuery } from "usehooks-ts"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
|
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
|
||||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
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 styles from "./bookingCodeFilter.module.css"
|
||||||
|
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
export default function BookingCodeFilter() {
|
export default function BookingCodeFilter() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
@@ -14,8 +15,6 @@ import { getBreakfastMessage } from "./getBreakfastMessage"
|
|||||||
|
|
||||||
import styles from "./breakfastMessage.module.css"
|
import styles from "./breakfastMessage.module.css"
|
||||||
|
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
export default function BreakfastMessage({
|
export default function BreakfastMessage({
|
||||||
breakfastIncludedMember,
|
breakfastIncludedMember,
|
||||||
breakfastIncludedStandard,
|
breakfastIncludedStandard,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
|
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
|
||||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
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 { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
interface CampaignProps extends SharedRateCardProps {
|
interface CampaignProps extends SharedRateCardProps {
|
||||||
campaign: PriceProduct[]
|
campaign: PriceProduct[]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import PointsRateCard from "@scandic-hotels/design-system/PointsRateCard"
|
import PointsRateCard from "@scandic-hotels/design-system/PointsRateCard"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
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 { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
interface RedemptionsProps extends SharedRateCardProps {
|
interface RedemptionsProps extends SharedRateCardProps {
|
||||||
redemptions: RedemptionProduct[]
|
redemptions: RedemptionProduct[]
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
||||||
import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard"
|
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 { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
interface Rate {
|
interface Rate {
|
||||||
label: string
|
label: string
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
|
|
||||||
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||||
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
|
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 { Product } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { RatesProps } from "@/types/components/hotelReservation/selectRate/rates"
|
import type { RatesProps } from "@/types/components/hotelReservation/selectRate/rates"
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
|
|
||||||
export default function Rates({
|
export default function Rates({
|
||||||
roomConfiguration: {
|
roomConfiguration: {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
import { notFound, useSearchParams } from "next/navigation"
|
import { notFound, useSearchParams } from "next/navigation"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import {
|
||||||
|
parseSelectRateSearchParams,
|
||||||
|
searchParamsToRecord,
|
||||||
|
} from "@scandic-hotels/booking-flow/utils/url"
|
||||||
import { trpc } from "@scandic-hotels/trpc/client"
|
import { trpc } from "@scandic-hotels/trpc/client"
|
||||||
import { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input"
|
import { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
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 Alert from "@/components/TempDesignSystem/Alert"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import RatesProvider from "@/providers/RatesProvider"
|
import RatesProvider from "@/providers/RatesProvider"
|
||||||
import { parseSelectRateSearchParams, searchParamsToRecord } from "@/utils/url"
|
|
||||||
|
|
||||||
import RateSummary from "./RateSummary"
|
import RateSummary from "./RateSummary"
|
||||||
import Rooms from "./Rooms"
|
import Rooms from "./Rooms"
|
||||||
|
|||||||
@@ -3,11 +3,14 @@
|
|||||||
import { useSearchParams } from "next/navigation"
|
import { useSearchParams } from "next/navigation"
|
||||||
import React from "react"
|
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 { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||||
|
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import { parseSelectRateSearchParams, searchParamsToRecord } from "@/utils/url"
|
|
||||||
|
|
||||||
import { getValidDates } from "../getValidDates"
|
import { getValidDates } from "../getValidDates"
|
||||||
import { getTracking } from "./tracking"
|
import { getTracking } from "./tracking"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useCallback, useEffect, useRef, useState } from "react"
|
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"
|
import styles from "./mapModal.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import { useEffect, useRef, useState } from "react"
|
import { useEffect, useRef, useState } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { debounce } from "@scandic-hotels/common/utils/debounce"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
import { getEmployeeInfo } from "@/utils/user"
|
import { getEmployeeInfo } from "@/utils/user"
|
||||||
|
|
||||||
import styles from "./digitalTeamMemberCard.module.css"
|
import styles from "./digitalTeamMemberCard.module.css"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import IconChip from "@scandic-hotels/design-system/IconChip"
|
import IconChip from "@scandic-hotels/design-system/IconChip"
|
||||||
import DiscountIcon from "@scandic-hotels/design-system/Icons/DiscountIcon"
|
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 { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { changeOrCancelDateFormat } from "@/constants/dateFormats"
|
|
||||||
|
|
||||||
import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
|
import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
|
||||||
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
||||||
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
import { useCallback, useRef } from "react"
|
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 { trpc } from "@scandic-hotels/trpc/client"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
||||||
|
|
||||||
import { StickyElementNameEnum } from "@/stores/sticky-position"
|
|
||||||
|
|
||||||
import Alert from "@/components/TempDesignSystem/Alert"
|
import Alert from "@/components/TempDesignSystem/Alert"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import styles from "./sitewideAlert.module.css"
|
import styles from "./sitewideAlert.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
import { useRef } from "react"
|
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 MeetingPackageWidget from "@/components/MeetingPackageWidget"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
|
||||||
|
|
||||||
import styles from "./stickyMeetingPackageWidget.module.css"
|
import styles from "./stickyMeetingPackageWidget.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,10 @@ import {
|
|||||||
} from "react-aria-components"
|
} from "react-aria-components"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { debounce } from "@scandic-hotels/common/utils/debounce"
|
||||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { debounce } from "@/utils/debounce"
|
|
||||||
|
|
||||||
import { Arrow } from "../Popover/Arrow"
|
import { Arrow } from "../Popover/Arrow"
|
||||||
import { Breadcrumb } from "./Breadcrumb"
|
import { Breadcrumb } from "./Breadcrumb"
|
||||||
import { splitBreadcrumbs } from "./utils"
|
import { splitBreadcrumbs } from "./utils"
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import BedSingleIcon from "@scandic-hotels/design-system/Icons/BedSingleIcon"
|
|||||||
import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIcon"
|
import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIcon"
|
||||||
import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon"
|
import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon"
|
||||||
import BedWallExtraIcon from "@scandic-hotels/design-system/Icons/BedWallExtraIcon"
|
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 { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
||||||
import type { IconProps } from "@scandic-hotels/design-system/Icons"
|
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 FamilyAndFriendsCodes = ["D000029555", "D000029271", "D000029195"]
|
||||||
|
|
||||||
export const bookingSearchTypes = [SEARCH_TYPE_REDEMPTION] as const
|
|
||||||
export const SEARCHTYPE = "searchtype"
|
export const SEARCHTYPE = "searchtype"
|
||||||
|
|
||||||
export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError"
|
export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError"
|
||||||
|
|||||||
@@ -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`
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
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(
|
export default function useScrollSpy(
|
||||||
sectionIds: string[],
|
sectionIds: string[],
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { redirect } from "next/navigation"
|
|||||||
|
|
||||||
import { isDefined } from "@scandic-hotels/common/utils/isDefined"
|
import { isDefined } from "@scandic-hotels/common/utils/isDefined"
|
||||||
|
|
||||||
// import { isDefined } from "@/server/utils"
|
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
import { cache } from "@/utils/cache"
|
import { cache } from "@/utils/cache"
|
||||||
|
|
||||||
@@ -290,37 +289,6 @@ export const getPageSettings = cache(async function getMemoizedPageSettings(
|
|||||||
return caller.contentstack.pageSettings.get({ lang })
|
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() {
|
export const getJobylonFeed = cache(async function getMemoizedJobylonFeed() {
|
||||||
const caller = await serverClient()
|
const caller = await serverClient()
|
||||||
return caller.partner.jobylon.feed.get()
|
return caller.partner.jobylon.feed.get()
|
||||||
|
|||||||
@@ -19,15 +19,6 @@
|
|||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"ci:build": "yarn lint && yarn test && yarn build",
|
"ci:build": "yarn lint && yarn test && yarn build",
|
||||||
"clean": "rm -rf .next",
|
"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"
|
"check-types": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
|
|
||||||
import { detailsStorageName } from "."
|
import { detailsStorageName } from "."
|
||||||
|
|
||||||
|
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type {
|
import type {
|
||||||
CorporateChequeProduct,
|
CorporateChequeProduct,
|
||||||
@@ -20,7 +21,6 @@ import type {
|
|||||||
VoucherProduct,
|
VoucherProduct,
|
||||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { BookingWidgetSearchData } from "@/types/components/bookingWidget"
|
|
||||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||||
import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
|
import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details"
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ import { produce } from "immer"
|
|||||||
import { useContext } from "react"
|
import { useContext } from "react"
|
||||||
import { create, useStore } from "zustand"
|
import { create, useStore } from "zustand"
|
||||||
|
|
||||||
import { getDefaultCountryFromLang } from "@/constants/languages"
|
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
|
|
||||||
|
import { getDefaultCountryFromLang } from "@/constants/languages"
|
||||||
|
|
||||||
import { DetailsContext } from "@/contexts/Details"
|
import { DetailsContext } from "@/contexts/Details"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +17,8 @@ import {
|
|||||||
writeToSessionStorage,
|
writeToSessionStorage,
|
||||||
} from "./helpers"
|
} from "./helpers"
|
||||||
|
|
||||||
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
|
|
||||||
import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast"
|
import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast"
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
import { StepEnum } from "@/types/enums/step"
|
import { StepEnum } from "@/types/enums/step"
|
||||||
@@ -25,7 +28,6 @@ import type {
|
|||||||
RoomState,
|
RoomState,
|
||||||
} from "@/types/stores/enter-details"
|
} from "@/types/stores/enter-details"
|
||||||
import type { SafeUser } from "@/types/user"
|
import type { SafeUser } from "@/types/user"
|
||||||
import type { Lang } from "@/constants/routes/hotelReservation"
|
|
||||||
|
|
||||||
const defaultGuestState = {
|
const defaultGuestState = {
|
||||||
countryCode: "",
|
countryCode: "",
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import { produce } from "immer"
|
|||||||
import { useContext } from "react"
|
import { useContext } from "react"
|
||||||
import { create, useStore } from "zustand"
|
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 { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
||||||
|
|
||||||
import { RatesContext } from "@/contexts/Rates"
|
import { RatesContext } from "@/contexts/Rates"
|
||||||
import { serializeBookingSearchParams } from "@/utils/url"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
findDefaultCurrency,
|
findDefaultCurrency,
|
||||||
@@ -18,7 +19,6 @@ import {
|
|||||||
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter"
|
|
||||||
import type { InitialState, RatesState } from "@/types/stores/rates"
|
import type { InitialState, RatesState } from "@/types/stores/rates"
|
||||||
|
|
||||||
export function createRatesStore({
|
export function createRatesStore({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { create } from "zustand"
|
|||||||
import {
|
import {
|
||||||
parseBookingWidgetSearchParams,
|
parseBookingWidgetSearchParams,
|
||||||
searchParamsToRecord,
|
searchParamsToRecord,
|
||||||
} from "@/utils/url"
|
} from "@scandic-hotels/booking-flow/utils/url"
|
||||||
|
|
||||||
import { checkIsSameBooking } from "./enter-details/helpers"
|
import { checkIsSameBooking } from "./enter-details/helpers"
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import type { bookingSearchTypes } from "@/constants/booking"
|
|
||||||
|
|
||||||
export type BookingSearchType = (typeof bookingSearchTypes)[number]
|
|
||||||
@@ -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 { productTypePointsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice"
|
||||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||||
@@ -10,7 +11,6 @@ import type {
|
|||||||
guestDetailsSchema,
|
guestDetailsSchema,
|
||||||
signedInDetailsSchema,
|
signedInDetailsSchema,
|
||||||
} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
|
} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
|
||||||
import type { BookingSearchType } from "../booking"
|
|
||||||
import type { Price } from "../price"
|
import type { Price } from "../price"
|
||||||
|
|
||||||
export type DetailsSchema = z.output<typeof guestDetailsSchema>
|
export type DetailsSchema = z.output<typeof guestDetailsSchema>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user