diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx index 3569244d8..6801f6b5b 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx @@ -55,7 +55,6 @@ export default async function StepPage({ // Deleting step to avoid double searchparams after rewrite selectRoomParams.delete("step") const booking = convertSearchParamsToObj(searchParams) - const { hotelId, rooms: [ @@ -153,8 +152,8 @@ export default async function StepPage({ } : undefined - const arrivalDate = new Date(searchParams.fromdate) - const departureDate = new Date(searchParams.todate) + const arrivalDate = new Date(fromDate) + const departureDate = new Date(toDate) const hotelAttributes = hotelData?.hotel const initialHotelsTrackingData: TrackingSDKHotelInfo = { diff --git a/app/[lang]/(live)/layout.tsx b/app/[lang]/(live)/layout.tsx index d1edd6010..335cacabb 100644 --- a/app/[lang]/(live)/layout.tsx +++ b/app/[lang]/(live)/layout.tsx @@ -2,10 +2,11 @@ import "@/app/globals.css" import "@scandic-hotels/design-system/style.css" import Script from "next/script" +import { SessionProvider } from "next-auth/react" import TrpcProvider from "@/lib/trpc/Provider" -import TokenRefresher from "@/components/Auth/TokenRefresher" +import { SessionRefresher } from "@/components/Auth/TokenRefresher" import CookieBotConsent from "@/components/CookieBot" import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import { ToastHandler } from "@/components/TempDesignSystem/Toasts" @@ -56,20 +57,22 @@ export default async function RootLayout({ `} - - - - {sitewidealert} - {header} - {bookingwidget} - {children} - {footer} - - - - - - + + + + + {sitewidealert} + {header} + {bookingwidget} + {children} + {footer} + + + + + + + ) diff --git a/components/Auth/TokenRefresher.tsx b/components/Auth/TokenRefresher.tsx index 4c382db06..f3f235df2 100644 --- a/components/Auth/TokenRefresher.tsx +++ b/components/Auth/TokenRefresher.tsx @@ -15,12 +15,12 @@ import { export default function TokenRefresher() { return ( - + ) } -function Refresher() { +export function SessionRefresher() { const session = useSession() const pathname = usePathname() const searchParams = useSearchParams() diff --git a/components/HotelReservation/BookingConfirmation/Receipt/index.tsx b/components/HotelReservation/BookingConfirmation/Receipt/index.tsx index 87879c9f5..b47993fd7 100644 --- a/components/HotelReservation/BookingConfirmation/Receipt/index.tsx +++ b/components/HotelReservation/BookingConfirmation/Receipt/index.tsx @@ -49,9 +49,6 @@ export default function Receipt({ {room.name} {booking.rateDefinition.isMemberRate ? (
- - {intl.formatMessage({ id: "N/A" })} - {formatPrice(intl, booking.roomPrice, booking.currencyCode)} diff --git a/components/HotelReservation/HotelCard/index.tsx b/components/HotelReservation/HotelCard/index.tsx index 3af9a8819..7062718d0 100644 --- a/components/HotelReservation/HotelCard/index.tsx +++ b/components/HotelReservation/HotelCard/index.tsx @@ -33,8 +33,9 @@ import type { Lang } from "@/constants/languages" function HotelCard({ hotel, - type = HotelCardListingTypeEnum.PageListing, + isUserLoggedIn, state = "default", + type = HotelCardListingTypeEnum.PageListing, }: HotelCardProps) { const params = useParams() const lang = params.lang as Lang @@ -160,7 +161,7 @@ function HotelCard({ ) : ( <> - {price.public && ( + {!isUserLoggedIn && price.public && ( )} {price.member && ( diff --git a/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx b/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx index 2f8000baa..12cce2039 100644 --- a/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx +++ b/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx @@ -1,3 +1,5 @@ +"use client" +import { useSession } from "next-auth/react" import { useIntl } from "react-intl" import { selectRate } from "@/constants/routes/hotelReservation" @@ -5,7 +7,6 @@ import { selectRate } from "@/constants/routes/hotelReservation" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import Button from "@/components/TempDesignSystem/Button" import Link from "@/components/TempDesignSystem/Link" -import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" @@ -31,6 +32,8 @@ export default function ListingHotelCardDialog({ setImageError, }: ListingHotelCardProps) { const intl = useIntl() + const { data: session } = useSession() + const isUserLoggedIn = !!session const { name, publicPrice, @@ -85,12 +88,14 @@ export default function ListingHotelCardDialog({ {intl.formatMessage({ id: "Per night from" })}
- {publicPrice && ( - - {publicPrice} {currency} - + {publicPrice && !isUserLoggedIn && ( + <> + + {publicPrice} {currency} + + {memberPrice && /} + )} - {publicPrice && memberPrice && /} {memberPrice && ( {intl.formatMessage( diff --git a/components/HotelReservation/HotelCardDialog/StandaloneHotelCardDialog/index.tsx b/components/HotelReservation/HotelCardDialog/StandaloneHotelCardDialog/index.tsx index a1d33785a..36cabfc12 100644 --- a/components/HotelReservation/HotelCardDialog/StandaloneHotelCardDialog/index.tsx +++ b/components/HotelReservation/HotelCardDialog/StandaloneHotelCardDialog/index.tsx @@ -1,3 +1,5 @@ +"use client" +import { useSession } from "next-auth/react" import { useIntl } from "react-intl" import { selectRate } from "@/constants/routes/hotelReservation" @@ -32,6 +34,8 @@ export default function StandaloneHotelCardDialog({ setImageError, }: StandaloneHotelCardProps) { const intl = useIntl() + const { data: session } = useSession() + const isUserLoggedIn = !!session const { name, publicPrice, @@ -86,7 +90,7 @@ export default function StandaloneHotelCardDialog({ {intl.formatMessage({ id: "From" })} - {publicPrice && ( + {publicPrice && !isUserLoggedIn && ( {intl.formatMessage( { id: "{price} {currency}" }, diff --git a/components/HotelReservation/HotelCardListing/index.tsx b/components/HotelReservation/HotelCardListing/index.tsx index 825299649..90b8d66b2 100644 --- a/components/HotelReservation/HotelCardListing/index.tsx +++ b/components/HotelReservation/HotelCardListing/index.tsx @@ -1,5 +1,6 @@ "use client" import { useSearchParams } from "next/navigation" +import { useSession } from "next-auth/react" import { useEffect, useMemo } from "react" import { useIntl } from "react-intl" @@ -26,6 +27,8 @@ export default function HotelCardListing({ hotelData, type = HotelCardListingTypeEnum.PageListing, }: HotelCardListingProps) { + const { data: session } = useSession() + const isUserLoggedIn = !!session const searchParams = useSearchParams() const activeFilters = useHotelFilterStore((state) => state.activeFilters) const setResultCount = useHotelFilterStore((state) => state.setResultCount) @@ -71,10 +74,11 @@ export default function HotelCardListing({ >
)) diff --git a/components/HotelReservation/SelectRate/RoomSelectionPanel/index.tsx b/components/HotelReservation/SelectRate/RoomSelectionPanel/index.tsx index 1b6053f0b..d7df8fb34 100644 --- a/components/HotelReservation/SelectRate/RoomSelectionPanel/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelectionPanel/index.tsx @@ -10,12 +10,12 @@ import type { FilterValues } from "@/types/components/hotelReservation/selectRat import type { RoomSelectionPanelProps } from "@/types/components/hotelReservation/selectRate/roomSelection" export function RoomSelectionPanel({ - roomCategories, availablePackages, - selectedPackages, - hotelType, defaultPackages, + hotelType, + roomCategories, roomListIndex, + selectedPackages, }: RoomSelectionPanelProps) { const searchParams = useSearchParams() const { getRooms } = useRoomFilteringStore() @@ -42,12 +42,12 @@ export function RoomSelectionPanel({ /> {rooms && ( )} diff --git a/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/PriceList/index.tsx b/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/PriceList/index.tsx index c0f3cf562..827a11264 100644 --- a/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/PriceList/index.tsx +++ b/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/PriceList/index.tsx @@ -14,6 +14,7 @@ import styles from "./priceList.module.css" import type { PriceListProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption" export default function PriceList({ + isUserLoggedIn, publicPrice = {}, memberPrice = {}, petRoomPackage, @@ -59,37 +60,41 @@ export default function PriceList({ return (
-
-
- - {intl.formatMessage({ id: "Standard price" })} - -
-
- {publicLocalPrice ? ( -
- - {totalPublicLocalPricePerNight} + {isUserLoggedIn ? null : ( +
+
+ + {intl.formatMessage({ id: "Standard price" })} + +
+
+ {publicLocalPrice ? ( +
+ + {totalPublicLocalPricePerNight} + + + {publicLocalPrice.currency} + + /{intl.formatMessage({ id: "night" })} + + +
+ ) : ( + + {intl.formatMessage({ id: "N/A" })} - - {publicLocalPrice.currency} - - /{intl.formatMessage({ id: "night" })} - - -
- ) : ( - - {intl.formatMessage({ id: "N/A" })} - - )} - -
+ )} + + + )}
@@ -126,14 +131,22 @@ export default function PriceList({
- {intl.formatMessage( - { id: "{publicPrice}/{memberPrice} {currency}" }, - { - publicPrice: totalPublicRequestedPricePerNight, - memberPrice: totalMemberRequestedPricePerNight, - currency: publicRequestedPrice.currency, - } - )} + {isUserLoggedIn + ? intl.formatMessage( + { id: "{memberPrice} {currency}" }, + { + memberPrice: totalMemberRequestedPricePerNight, + currency: publicRequestedPrice.currency, + } + ) + : intl.formatMessage( + { id: "{publicPrice}/{memberPrice} {currency}" }, + { + publicPrice: totalPublicRequestedPricePerNight, + memberPrice: totalMemberRequestedPricePerNight, + currency: publicRequestedPrice.currency, + } + )}
diff --git a/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/index.tsx b/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/index.tsx index 885aac959..9bdb188e6 100644 --- a/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/index.tsx +++ b/components/HotelReservation/SelectRate/RoomTypeList/FlexibilityOption/index.tsx @@ -16,13 +16,14 @@ import styles from "./flexibilityOption.module.css" import type { FlexibilityOptionProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption" export default function FlexibilityOption({ - product, - name, + handleSelect, + isSelected, + isUserLoggedIn, paymentTerm, priceInformation, petRoomPackage, - isSelected, - onSelect, + product, + title, }: FlexibilityOptionProps) { const intl = useIntl() @@ -32,7 +33,7 @@ export default function FlexibilityOption({
- {name} + {title} ({paymentTerm})
@@ -47,6 +48,10 @@ export default function FlexibilityOption({ const { public: publicPrice, member: memberPrice } = product.productType + function handleOnSelect() { + handleSelect(publicPrice.rateCode, title, paymentTerm) + } + return (