feat(SW-865): link to booking without validation
This commit is contained in:
@@ -10,14 +10,8 @@ export default async function BookingConfirmationPage({
|
|||||||
searchParams,
|
searchParams,
|
||||||
}: PageArgs<LangParams, { confirmationNumber: string }>) {
|
}: PageArgs<LangParams, { confirmationNumber: string }>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
const bookingConfirmationPromise = getBookingConfirmation(
|
void getBookingConfirmation(searchParams.confirmationNumber)
|
||||||
searchParams.confirmationNumber
|
|
||||||
)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BookingConfirmation
|
<BookingConfirmation confirmationNumber={searchParams.confirmationNumber} />
|
||||||
bookingConfirmationPromise={bookingConfirmationPromise}
|
|
||||||
lang={params.lang}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import styles from "./search.module.css"
|
|||||||
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
||||||
import {
|
import {
|
||||||
ActionType,
|
ActionType,
|
||||||
SetStorageData,
|
type SetStorageData,
|
||||||
} from "@/types/components/form/bookingwidget"
|
} from "@/types/components/form/bookingwidget"
|
||||||
import type { SearchProps } from "@/types/components/search"
|
import type { SearchProps } from "@/types/components/search"
|
||||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { use, useRef } from "react"
|
import { useRef } from "react"
|
||||||
|
|
||||||
import Header from "@/components/HotelReservation/BookingConfirmation/Header"
|
import Header from "@/components/HotelReservation/BookingConfirmation/Header"
|
||||||
import HotelDetails from "@/components/HotelReservation/BookingConfirmation/HotelDetails"
|
import HotelDetails from "@/components/HotelReservation/BookingConfirmation/HotelDetails"
|
||||||
@@ -15,13 +15,11 @@ import styles from "./confirmation.module.css"
|
|||||||
import type { ConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
import type { ConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
||||||
|
|
||||||
export default function Confirmation({
|
export default function Confirmation({
|
||||||
bookingConfirmationPromise,
|
booking,
|
||||||
|
hotel,
|
||||||
|
room,
|
||||||
}: ConfirmationProps) {
|
}: ConfirmationProps) {
|
||||||
const bookingConfirmation = use(bookingConfirmationPromise)
|
|
||||||
const mainRef = useRef<HTMLElement | null>(null)
|
const mainRef = useRef<HTMLElement | null>(null)
|
||||||
|
|
||||||
const { booking, hotel, room } = bookingConfirmation
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className={styles.main} ref={mainRef}>
|
<main className={styles.main} ref={mainRef}>
|
||||||
<Header booking={booking} hotel={hotel} mainRef={mainRef} />
|
<Header booking={booking} hotel={hotel} mainRef={mainRef} />
|
||||||
|
|||||||
@@ -1,15 +1,40 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { myBooking } from "@/constants/myBooking"
|
||||||
|
import { env } from "@/env/client"
|
||||||
|
|
||||||
import { EditIcon } from "@/components/Icons"
|
import { EditIcon } from "@/components/Icons"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
|
import Link from "@/components/TempDesignSystem/Link"
|
||||||
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
export default function ManageBooking() {
|
import type { ManageBookingProps } from "@/types/components/hotelReservation/bookingConfirmation/actions/manageBooking"
|
||||||
|
|
||||||
|
export default function ManageBooking({
|
||||||
|
confirmationNumber,
|
||||||
|
lastName,
|
||||||
|
}: ManageBookingProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
const lang = useLang()
|
||||||
|
const myBookingUrl = myBooking[env.NEXT_PUBLIC_NODE_ENV][lang]
|
||||||
return (
|
return (
|
||||||
<Button intent="text" size="small" theme="base" variant="icon" wrapping>
|
<Button
|
||||||
<EditIcon />
|
asChild
|
||||||
{intl.formatMessage({ id: "Manage booking" })}
|
intent="text"
|
||||||
|
size="small"
|
||||||
|
theme="base"
|
||||||
|
variant="icon"
|
||||||
|
wrapping
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
color="none"
|
||||||
|
href={`${myBookingUrl}?bookingId=${confirmationNumber}&lastName=${lastName}`}
|
||||||
|
weight="bold"
|
||||||
|
>
|
||||||
|
<EditIcon />
|
||||||
|
{intl.formatMessage({ id: "Manage booking" })}
|
||||||
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ export default function Header({
|
|||||||
event={event}
|
event={event}
|
||||||
hotelName={hotel.name}
|
hotelName={hotel.name}
|
||||||
/>
|
/>
|
||||||
<ManageBooking />
|
<ManageBooking
|
||||||
|
confirmationNumber={booking.confirmationNumber}
|
||||||
|
lastName={booking.guest.lastName}
|
||||||
|
/>
|
||||||
<DownloadInvoice mainRef={mainRef} />
|
<DownloadInvoice mainRef={mainRef} />
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ import type { PromoProps } from "@/types/components/hotelReservation/bookingConf
|
|||||||
|
|
||||||
export default function Promo({ buttonText, href, text, title }: PromoProps) {
|
export default function Promo({ buttonText, href, text, title }: PromoProps) {
|
||||||
return (
|
return (
|
||||||
<article className={styles.promo}>
|
<Link className={styles.link} color="none" href={href}>
|
||||||
<Title color="white" level="h4">
|
<article className={styles.promo}>
|
||||||
{title}
|
<Title color="white" level="h4">
|
||||||
</Title>
|
{title}
|
||||||
<Body className={styles.text} color="white" textAlign="center">
|
</Title>
|
||||||
{text}
|
<Body className={styles.text} color="white" textAlign="center">
|
||||||
</Body>
|
{text}
|
||||||
<Button asChild intent="primary" size="small" theme="primaryStrong">
|
</Body>
|
||||||
<Link color="none" href={href}>
|
<Button asChild intent="primary" size="small" theme="primaryStrong">
|
||||||
{buttonText}
|
<div>{buttonText}</div>
|
||||||
</Link>
|
</Button>
|
||||||
</Button>
|
</article>
|
||||||
</article>
|
</Link>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
padding: var(--Spacing-x4) var(--Spacing-x3);
|
padding: var(--Spacing-x4) var(--Spacing-x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo:nth-of-type(1) {
|
.link:nth-of-type(1) .promo {
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
rgba(0, 0, 0, 0) 0%,
|
rgba(0, 0, 0, 0) 0%,
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
url("/_static/img/Scandic_Park_Party_Lipstick.jpg");
|
url("/_static/img/Scandic_Park_Party_Lipstick.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo:nth-of-type(2) {
|
.link:nth-of-type(2) .promo {
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(
|
||||||
180deg,
|
180deg,
|
||||||
rgba(0, 0, 0, 0) 0%,
|
rgba(0, 0, 0, 0) 0%,
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
|
|
||||||
|
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import TrackingSDK from "@/components/TrackingSDK"
|
import TrackingSDK from "@/components/TrackingSDK"
|
||||||
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import Confirmation from "./Confirmation"
|
import Confirmation from "./Confirmation"
|
||||||
|
|
||||||
@@ -14,12 +17,11 @@ import {
|
|||||||
import { CurrencyEnum } from "@/types/enums/currency"
|
import { CurrencyEnum } from "@/types/enums/currency"
|
||||||
|
|
||||||
export default async function BookingConfirmation({
|
export default async function BookingConfirmation({
|
||||||
bookingConfirmationPromise,
|
confirmationNumber,
|
||||||
lang,
|
|
||||||
}: BookingConfirmationProps) {
|
}: BookingConfirmationProps) {
|
||||||
const bookingConfirmation = await bookingConfirmationPromise
|
const lang = getLang()
|
||||||
|
const { booking, hotel, room } =
|
||||||
const { booking, hotel, room } = bookingConfirmation
|
await getBookingConfirmation(confirmationNumber)
|
||||||
|
|
||||||
const arrivalDate = new Date(booking.checkInDate)
|
const arrivalDate = new Date(booking.checkInDate)
|
||||||
const departureDate = new Date(booking.checkOutDate)
|
const departureDate = new Date(booking.checkOutDate)
|
||||||
@@ -69,7 +71,7 @@ export default async function BookingConfirmation({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Confirmation bookingConfirmationPromise={bookingConfirmationPromise} />
|
<Confirmation booking={booking} hotel={hotel} room={room} />
|
||||||
<Suspense fallback={null}>
|
<Suspense fallback={null}>
|
||||||
<TrackingSDK
|
<TrackingSDK
|
||||||
pageData={initialPageTrackingData}
|
pageData={initialPageTrackingData}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||||
|
|
||||||
|
export interface ManageBookingProps
|
||||||
|
extends Pick<BookingConfirmation["booking"], "confirmationNumber">,
|
||||||
|
Pick<BookingConfirmation["booking"]["guest"], "lastName"> {}
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
import type { Lang } from "@/constants/languages"
|
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||||
import type { RouterOutput } from "@/lib/trpc/client"
|
|
||||||
|
|
||||||
export interface BookingConfirmationProps {
|
export interface BookingConfirmationProps {
|
||||||
lang: Lang
|
confirmationNumber: string
|
||||||
bookingConfirmationPromise: Promise<RouterOutput["booking"]["confirmation"]>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConfirmationProps {
|
export interface ConfirmationProps extends BookingConfirmation {}
|
||||||
bookingConfirmationPromise: Promise<RouterOutput["booking"]["confirmation"]>
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
export interface PromosProps {
|
import { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||||
confirmationNumber: string | null
|
|
||||||
hotelId: string
|
export interface PromosProps
|
||||||
lastName: string | null
|
extends Pick<
|
||||||
}
|
BookingConfirmation["booking"],
|
||||||
|
"confirmationNumber" | "hotelId"
|
||||||
|
>,
|
||||||
|
Pick<BookingConfirmation["booking"]["guest"], "lastName"> {}
|
||||||
|
|||||||
Reference in New Issue
Block a user