Merged in chore/SW-3321-move-selectratecontext-to- (pull request #2729)
chore(SW-3321): Moved Select rate context to booking-flow package * chore(SW-3321): Moved Select rate context to booking-flow package * chore(SW-3321): Optimised code Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
|
import { SelectRateProvider } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { parseSelectRateSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
import { parseSelectRateSearchParams } from "@scandic-hotels/booking-flow/utils/url"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||||
@@ -8,7 +9,6 @@ import { combineRegExps, rateTypeRegex } from "@/constants/booking"
|
|||||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import SelectRate from "@/components/HotelReservation/SelectRate"
|
import SelectRate from "@/components/HotelReservation/SelectRate"
|
||||||
import { SelectRateProvider } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
import type { LangParams, NextSearchParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { createHash } from "crypto"
|
import { createHash } from "crypto"
|
||||||
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
||||||
|
|
||||||
|
import { invertedBedTypeMap } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
||||||
import {
|
import {
|
||||||
@@ -18,8 +19,6 @@ import { CancellationRuleEnum } from "@/constants/booking"
|
|||||||
import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers"
|
import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers"
|
||||||
import { getSpecialRoomType } from "@/utils/specialRoomType"
|
import { getSpecialRoomType } from "@/utils/specialRoomType"
|
||||||
|
|
||||||
import { invertedBedTypeMap } from "../../utils"
|
|
||||||
|
|
||||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
|
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
|
||||||
import type { RateDefinition } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { RateDefinition } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
|
import { filterOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||||
@@ -16,7 +17,6 @@ import SidePanel from "@/components/HotelReservation/SidePanel"
|
|||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"
|
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"
|
||||||
|
|
||||||
import { filterOverlappingDates } from "../utils"
|
|
||||||
import Confirmation from "./Confirmation"
|
import Confirmation from "./Confirmation"
|
||||||
import Tracking from "./Tracking"
|
import Tracking from "./Tracking"
|
||||||
import { mapRoomState } from "./utils"
|
import { mapRoomState } from "./utils"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
|
|
||||||
import type { RoomState } from "@/types/stores/enter-details"
|
import type { RoomState } from "@/types/stores/enter-details"
|
||||||
|
|
||||||
export function mapToPrice(rooms: RoomState[], isMember: boolean) {
|
export function mapToPrice(rooms: RoomState[], isMember: boolean) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
||||||
|
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import {
|
import {
|
||||||
TrackingChannelEnum,
|
TrackingChannelEnum,
|
||||||
@@ -12,7 +13,6 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
|||||||
import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages"
|
import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
import { getSpecialRoomType } from "@/utils/specialRoomType"
|
import { getSpecialRoomType } from "@/utils/specialRoomType"
|
||||||
|
|
||||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
|
|
||||||
import { sumPackages } from "../../utils"
|
|
||||||
|
|
||||||
import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
|
import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
import type { Room } from "@/types/stores/my-stay"
|
import type { Room } from "@/types/stores/my-stay"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import { calculateVat } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
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 { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { calculateVat } from "@/components/HotelReservation/utils"
|
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|
||||||
import styles from "./specification.module.css"
|
import styles from "./specification.module.css"
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
||||||
import { trpc } from "@scandic-hotels/trpc/client"
|
import { trpc } from "@scandic-hotels/trpc/client"
|
||||||
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import Confirmation from "./Confirmation"
|
import Confirmation from "./Confirmation"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { IconForFeatureCode } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
@@ -16,7 +17,6 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|||||||
|
|
||||||
import { CancellationRuleEnum } from "@/constants/booking"
|
import { CancellationRuleEnum } from "@/constants/booking"
|
||||||
|
|
||||||
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
import PriceType from "@/components/HotelReservation/MyStay/PriceType"
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
|
|
||||||
import styles from "./details.module.css"
|
import styles from "./details.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { IconForFeatureCode } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
|
|
||||||
|
|
||||||
import styles from "./packages.module.css"
|
import styles from "./packages.module.css"
|
||||||
|
|
||||||
export default function Packages() {
|
export default function Packages() {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
|
|
||||||
import { useMyStayStore } from "@/stores/my-stay"
|
import { useMyStayStore } from "@/stores/my-stay"
|
||||||
|
|
||||||
import { sumPackages } from "../../utils"
|
|
||||||
import PriceType from "../PriceType"
|
import PriceType from "../PriceType"
|
||||||
|
|
||||||
import type { PriceType as _PriceType } from "@/types/components/hotelReservation/myStay/myStay"
|
import type { PriceType as _PriceType } from "@/types/components/hotelReservation/myStay/myStay"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { cookies } from "next/headers"
|
import { cookies } from "next/headers"
|
||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
|
|
||||||
|
import { filterOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
|
import * as maskValue from "@scandic-hotels/common/utils/maskValue"
|
||||||
@@ -39,8 +40,6 @@ import { getIntl } from "@/i18n"
|
|||||||
import MyStayProvider from "@/providers/MyStay"
|
import MyStayProvider from "@/providers/MyStay"
|
||||||
import { isLoggedInUser } from "@/utils/isLoggedInUser"
|
import { isLoggedInUser } from "@/utils/isLoggedInUser"
|
||||||
|
|
||||||
import { filterOverlappingDates } from "../utils"
|
|
||||||
|
|
||||||
import styles from "./index.module.css"
|
import styles from "./index.module.css"
|
||||||
|
|
||||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { calculateVat } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
||||||
|
|
||||||
import { calculateVat } from "@/components/HotelReservation/utils"
|
|
||||||
|
|
||||||
import RegularRow from "./Regular"
|
import RegularRow from "./Regular"
|
||||||
|
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import { isBookingCodeRate } from "./utils"
|
|||||||
|
|
||||||
import styles from "./rateSummary.module.css"
|
import styles from "./rateSummary.module.css"
|
||||||
|
|
||||||
import type { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import type { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import type { SelectedRate } from "@/contexts/SelectRate/types"
|
import type { SelectedRate } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
|
|
||||||
export function DesktopSummary({
|
export function DesktopSummary({
|
||||||
input,
|
input,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { cx } from "class-variance-authority"
|
import { cx } from "class-variance-authority"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
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 { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
@@ -13,7 +14,6 @@ import { Typography } from "@scandic-hotels/design-system/Typography"
|
|||||||
|
|
||||||
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal"
|
||||||
import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop"
|
import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import Room from "../Room"
|
|||||||
|
|
||||||
import styles from "./summaryContent.module.css"
|
import styles from "./summaryContent.module.css"
|
||||||
|
|
||||||
import type { Price } from "@/contexts/SelectRate/getTotalPrice"
|
import type { Price } from "@scandic-hotels/booking-flow/contexts/SelectRate/getTotalPrice"
|
||||||
|
|
||||||
export type SelectRateSummaryProps = {
|
export type SelectRateSummaryProps = {
|
||||||
isMember: boolean
|
isMember: boolean
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { useEffect, useRef, useState } 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 { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
||||||
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 { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
||||||
|
|
||||||
import { isBookingCodeRate } from "../utils"
|
import { isBookingCodeRate } from "../utils"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
|
|
||||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
|
||||||
|
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
|
||||||
import type {
|
import type {
|
||||||
Rate,
|
Rate,
|
||||||
Room,
|
Room,
|
||||||
} from "@/types/components/hotelReservation/selectRate/selectRate"
|
} from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
|
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
|
|
||||||
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
|
|
||||||
export function mapRate(
|
export function mapRate(
|
||||||
room: Rate,
|
room: Rate,
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import type {
|
import type {
|
||||||
Rate,
|
Rate,
|
||||||
Room as SelectRateRoom,
|
Room as SelectRateRoom,
|
||||||
} from "@/types/components/hotelReservation/selectRate/selectRate"
|
} from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
|
|
||||||
import type { Room } from "@/components/HotelReservation/PriceDetailsModal/PriceDetailsTable"
|
import type { Room } from "@/components/HotelReservation/PriceDetailsModal/PriceDetailsTable"
|
||||||
|
|
||||||
export function mapToPrice(
|
export function mapToPrice(
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
import { useRouter, useSearchParams } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useState, useTransition } from "react"
|
import { useState, useTransition } from "react"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
|
||||||
import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary"
|
import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import { DesktopSummary } from "./DesktopSummary"
|
import { DesktopSummary } from "./DesktopSummary"
|
||||||
import { MobileSummary } from "./MobileSummary"
|
import { MobileSummary } from "./MobileSummary"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
import type { Rate } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
|
|
||||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type {
|
import type {
|
||||||
Product,
|
Product,
|
||||||
@@ -10,7 +10,6 @@ import type {
|
|||||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { Price } from "@/types/components/hotelReservation/price"
|
import type { Price } from "@/types/components/hotelReservation/price"
|
||||||
import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
||||||
|
|
||||||
export function calculateTotalPrice(
|
export function calculateTotalPrice(
|
||||||
selectedRateSummary: Rate[],
|
selectedRateSummary: Rate[],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
import { RateEnum } from "@scandic-hotels/common/constants/rate"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
@@ -12,7 +13,6 @@ import Image from "@scandic-hotels/design-system/Image"
|
|||||||
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"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
||||||
|
|
||||||
import styles from "./selectedRoomPanel.module.css"
|
import styles from "./selectedRoomPanel.module.css"
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
|
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"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import { SelectedRoomPanel } from "./SelectedRoomPanel"
|
import { SelectedRoomPanel } from "./SelectedRoomPanel"
|
||||||
import { roomSelectionPanelVariants } from "./variants"
|
import { roomSelectionPanelVariants } from "./variants"
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||||
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||||
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import styles from "./alert.module.css"
|
import styles from "./alert.module.css"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
} from "react-aria-components"
|
} from "react-aria-components"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
||||||
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
|
import { ChipButton } from "@scandic-hotels/design-system/ChipButton"
|
||||||
@@ -19,7 +20,6 @@ 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 { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { useBreakpoint } from "@/hooks/useBreakpoint"
|
import { useBreakpoint } from "@/hooks/useBreakpoint"
|
||||||
|
|
||||||
import styles from "./bookingCodeFilter.module.css"
|
import styles from "./bookingCodeFilter.module.css"
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeChip } from "@scandic-hotels/design-system/BookingCodeChip"
|
import { BookingCodeChip } from "@scandic-hotels/design-system/BookingCodeChip"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
export function RemoveBookingCodeButton() {
|
export function RemoveBookingCodeButton() {
|
||||||
const {
|
const {
|
||||||
input: { bookingCode },
|
input: { bookingCode },
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { Button as ButtonRAC } from "react-aria-components"
|
import { Button as ButtonRAC } from "react-aria-components"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
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 { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { useBreakpoint } from "@/hooks/useBreakpoint"
|
import { useBreakpoint } from "@/hooks/useBreakpoint"
|
||||||
|
|
||||||
import PetRoomMessage from "./Form/Checkboxes/PetRoomMessage"
|
import PetRoomMessage from "./Form/Checkboxes/PetRoomMessage"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
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 { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
||||||
|
|
||||||
import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary"
|
import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import { RemoveBookingCodeButton } from "./RemoveBookingCodeButton/RemoveBookingCodeButton"
|
import { RemoveBookingCodeButton } from "./RemoveBookingCodeButton/RemoveBookingCodeButton"
|
||||||
import { RoomPackageFilter } from "./RoomPackageFilter"
|
import { RoomPackageFilter } from "./RoomPackageFilter"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import RoomSize from "./RoomSize"
|
|||||||
|
|
||||||
import styles from "./details.module.css"
|
import styles from "./details.module.css"
|
||||||
|
|
||||||
import type { RoomInfo } from "@/contexts/SelectRate/types"
|
import type { RoomInfo } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
roomInfo: RoomInfo
|
roomInfo: RoomInfo
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
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"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { isValidClientSession } from "@/utils/clientSession"
|
import { isValidClientSession } from "@/utils/clientSession"
|
||||||
|
|
||||||
import { getBreakfastMessage } from "./getBreakfastMessage"
|
import { getBreakfastMessage } from "./getBreakfastMessage"
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
|
|
||||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sumPackages,
|
sumPackages,
|
||||||
sumPackagesRequestedPrice,
|
sumPackagesRequestedPrice,
|
||||||
} from "@/components/HotelReservation/utils"
|
} from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
|
||||||
|
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
||||||
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
|||||||
import type {
|
import type {
|
||||||
AvailabilityWithRoomInfo,
|
AvailabilityWithRoomInfo,
|
||||||
Package,
|
Package,
|
||||||
} from "@/contexts/SelectRate/types"
|
} from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
|
|
||||||
type CampaignProps = {
|
type CampaignProps = {
|
||||||
nights: number
|
nights: number
|
||||||
|
|||||||
@@ -2,21 +2,20 @@
|
|||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import CodeRateCard from "@scandic-hotels/design-system/CodeRateCard"
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sumPackages,
|
sumPackages,
|
||||||
sumPackagesRequestedPrice,
|
sumPackagesRequestedPrice,
|
||||||
} from "@/components/HotelReservation/utils"
|
} from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import CodeRateCard from "@scandic-hotels/design-system/CodeRateCard"
|
||||||
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
|
|
||||||
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
||||||
|
|
||||||
|
import type { Package } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
import type { CodeProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { CodeProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { Package } from "@/contexts/SelectRate/types"
|
|
||||||
|
|
||||||
type CodeProps = {
|
type CodeProps = {
|
||||||
nights: number
|
nights: number
|
||||||
roomTypeCode: string
|
roomTypeCode: string
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import PointsRateCard from "@scandic-hotels/design-system/PointsRateCard"
|
import PointsRateCard from "@scandic-hotels/design-system/PointsRateCard"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AvailabilityWithRoomInfo,
|
AvailabilityWithRoomInfo,
|
||||||
Package,
|
Package,
|
||||||
} from "@/contexts/SelectRate/types"
|
} from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
|
|
||||||
type RedemptionsProps = {
|
type RedemptionsProps = {
|
||||||
redemptions: AvailabilityWithRoomInfo["redemptions"]
|
redemptions: AvailabilityWithRoomInfo["redemptions"]
|
||||||
|
|||||||
@@ -2,24 +2,23 @@
|
|||||||
import { useSession } from "next-auth/react"
|
import { useSession } from "next-auth/react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
||||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
|
||||||
import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sumPackages,
|
sumPackages,
|
||||||
sumPackagesRequestedPrice,
|
sumPackagesRequestedPrice,
|
||||||
} from "@/components/HotelReservation/utils"
|
} from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
||||||
|
import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard"
|
||||||
|
|
||||||
import useRateTitles from "@/hooks/booking/useRateTitles"
|
import useRateTitles from "@/hooks/booking/useRateTitles"
|
||||||
import { isValidClientSession } from "@/utils/clientSession"
|
import { isValidClientSession } from "@/utils/clientSession"
|
||||||
|
|
||||||
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
||||||
|
|
||||||
|
import type { AvailabilityWithRoomInfo } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||||
|
|
||||||
import type { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types"
|
|
||||||
|
|
||||||
interface Rate {
|
interface Rate {
|
||||||
label: string
|
label: string
|
||||||
price: string
|
price: string
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
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 { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import { BreakfastMessage } from "./BreakfastMessage"
|
import { BreakfastMessage } from "./BreakfastMessage"
|
||||||
import Campaign from "./Campaign"
|
import Campaign from "./Campaign"
|
||||||
import Code from "./Code"
|
import Code from "./Code"
|
||||||
import Redemptions from "./Redemptions"
|
import Redemptions from "./Redemptions"
|
||||||
import { RegularRate } from "./Regular"
|
import { RegularRate } from "./Regular"
|
||||||
|
|
||||||
|
import type { AvailabilityWithRoomInfo } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||||
|
|
||||||
import type { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types"
|
|
||||||
|
|
||||||
export interface RatesProps {
|
export interface RatesProps {
|
||||||
roomConfiguration: AvailabilityWithRoomInfo
|
roomConfiguration: AvailabilityWithRoomInfo
|
||||||
roomIndex: number
|
roomIndex: number
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
|
import type { SelectedRate } from "@scandic-hotels/booking-flow/types/stores/rates"
|
||||||
import type {
|
import type {
|
||||||
CorporateChequeProduct,
|
CorporateChequeProduct,
|
||||||
PriceProduct,
|
PriceProduct,
|
||||||
VoucherProduct,
|
VoucherProduct,
|
||||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { SelectedRate } from "@/types/stores/rates"
|
|
||||||
|
|
||||||
export function isSelectedPriceProduct(
|
export function isSelectedPriceProduct(
|
||||||
product: PriceProduct,
|
product: PriceProduct,
|
||||||
selectedRate: SelectedRate | null,
|
selectedRate: SelectedRate | null,
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
import { memo } from "react"
|
import { memo } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
import { IconForFeatureCode } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import ImageGallery from "@scandic-hotels/design-system/ImageGallery"
|
import ImageGallery from "@scandic-hotels/design-system/ImageGallery"
|
||||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||||
import { getHotelRoom } from "@scandic-hotels/trpc/routers/booking/helpers"
|
import { getHotelRoom } from "@scandic-hotels/trpc/routers/booking/helpers"
|
||||||
|
|
||||||
import { IconForFeatureCode } from "@/components/HotelReservation/utils"
|
|
||||||
import RoomDetailsSidePeek from "@/components/SidePeeks/RoomDetailsSidePeek"
|
import RoomDetailsSidePeek from "@/components/SidePeeks/RoomDetailsSidePeek"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
||||||
|
|
||||||
import styles from "./image.module.css"
|
import styles from "./image.module.css"
|
||||||
|
|||||||
@@ -8,10 +8,9 @@ import RoomNotAvailable from "./RoomNotAvailable"
|
|||||||
|
|
||||||
import styles from "./roomListItem.module.css"
|
import styles from "./roomListItem.module.css"
|
||||||
|
|
||||||
|
import type { AvailabilityWithRoomInfo } from "@scandic-hotels/booking-flow/contexts/SelectRate/types"
|
||||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||||
|
|
||||||
import type { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types"
|
|
||||||
|
|
||||||
export type RoomListItemProps = {
|
export type RoomListItemProps = {
|
||||||
room: AvailabilityWithRoomInfo
|
room: AvailabilityWithRoomInfo
|
||||||
selectedPackages: Package[]
|
selectedPackages: Package[]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
|
||||||
import styles from "./rooms.module.css"
|
import styles from "./rooms.module.css"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
|
||||||
import { RoomListItem } from "./RoomListItem"
|
import { RoomListItem } from "./RoomListItem"
|
||||||
import { RoomsListSkeleton } from "./RoomsListSkeleton"
|
import { RoomsListSkeleton } from "./RoomsListSkeleton"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
|
|
||||||
import { MultiRoomWrapper } from "./MultiRoomWrapper"
|
import { MultiRoomWrapper } from "./MultiRoomWrapper"
|
||||||
import NoAvailabilityAlert from "./NoAvailabilityAlert"
|
import NoAvailabilityAlert from "./NoAvailabilityAlert"
|
||||||
|
|||||||
@@ -3,11 +3,10 @@
|
|||||||
import { TRPCClientError } from "@trpc/client"
|
import { TRPCClientError } from "@trpc/client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext"
|
||||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||||
|
|
||||||
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
|
|
||||||
|
|
||||||
import { RateSummary } from "./RateSummary"
|
import { RateSummary } from "./RateSummary"
|
||||||
import Rooms from "./Rooms"
|
import Rooms from "./Rooms"
|
||||||
import { RoomsContainerSkeleton } from "./RoomsContainerSkeleton"
|
import { RoomsContainerSkeleton } from "./RoomsContainerSkeleton"
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import {
|
|||||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
|
|
||||||
|
import type { Room } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||||
|
|
||||||
import type { Room } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
||||||
|
|
||||||
type ChildrenInRoom = (Child[] | null)[] | null
|
type ChildrenInRoom = (Child[] | null)[] | null
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { cookies } from "next/headers"
|
|||||||
|
|
||||||
import FnFNotAllowedAlert from "@scandic-hotels/booking-flow/components/FnFNotAllowedAlert"
|
import FnFNotAllowedAlert from "@scandic-hotels/booking-flow/components/FnFNotAllowedAlert"
|
||||||
import { HotelDetailsSidePeek } from "@scandic-hotels/booking-flow/components/HotelDetailsSidePeek"
|
import { HotelDetailsSidePeek } from "@scandic-hotels/booking-flow/components/HotelDetailsSidePeek"
|
||||||
|
import { hasOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
|
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { HotelInfoCard } from "@scandic-hotels/design-system/HotelInfoCard"
|
import { HotelInfoCard } from "@scandic-hotels/design-system/HotelInfoCard"
|
||||||
@@ -10,14 +11,12 @@ import { RoomsContainer } from "@/components/HotelReservation/SelectRate/RoomsCo
|
|||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
||||||
|
|
||||||
import { hasOverlappingDates } from "../utils"
|
|
||||||
import AvailabilityError from "./AvailabilityError"
|
import AvailabilityError from "./AvailabilityError"
|
||||||
import Tracking from "./Tracking"
|
import Tracking from "./Tracking"
|
||||||
|
|
||||||
|
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
import type { RouterOutput } from "@scandic-hotels/trpc/client"
|
import type { RouterOutput } from "@scandic-hotels/trpc/client"
|
||||||
|
|
||||||
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
||||||
|
|
||||||
export default async function SelectRatePage({
|
export default async function SelectRatePage({
|
||||||
booking,
|
booking,
|
||||||
hotelData,
|
hotelData,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
|
||||||
@@ -16,7 +17,6 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|||||||
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"
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
|
||||||
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "@/hooks/useLang"
|
||||||
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { RoomContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/Room"
|
||||||
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 { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs"
|
import { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs"
|
||||||
|
|
||||||
import { useRatesStore } from "@/stores/select-rate"
|
import { useRatesStore } from "@/stores/select-rate"
|
||||||
|
|
||||||
import { RoomContext } from "@/contexts/SelectRate/Room"
|
|
||||||
|
|
||||||
import type { RoomProviderProps } from "@/types/providers/select-rate/room"
|
import type { RoomProviderProps } from "@/types/providers/select-rate/room"
|
||||||
|
|
||||||
export default function RoomProvider({
|
export default function RoomProvider({
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import isEqual from "fast-deep-equal"
|
import isEqual from "fast-deep-equal"
|
||||||
import { parsePhoneNumberFromString } from "libphonenumber-js"
|
import { parsePhoneNumberFromString } from "libphonenumber-js"
|
||||||
|
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
|
||||||
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sumPackages,
|
sumPackages,
|
||||||
sumPackagesRequestedPrice,
|
sumPackagesRequestedPrice,
|
||||||
} from "@/components/HotelReservation/utils"
|
} from "@scandic-hotels/booking-flow/utils/SelectRate"
|
||||||
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
|
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
||||||
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
|
|
||||||
import { detailsStorageName } from "."
|
import { detailsStorageName } from "."
|
||||||
|
|
||||||
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
|
import type { BookingWidgetSearchData } from "@scandic-hotels/booking-flow/BookingWidget"
|
||||||
|
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type {
|
import type {
|
||||||
CorporateChequeProduct,
|
CorporateChequeProduct,
|
||||||
@@ -24,7 +24,6 @@ import type {
|
|||||||
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"
|
||||||
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
||||||
import type { PersistedState, RoomState } from "@/types/stores/enter-details"
|
import type { PersistedState, RoomState } from "@/types/stores/enter-details"
|
||||||
import type { SafeUser } from "@/types/user"
|
import type { SafeUser } from "@/types/user"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import type { AvailabilityError } from "@/types/stores/rates"
|
|
||||||
|
import type { AvailabilityError } from "@scandic-hotels/booking-flow/types/stores/rates"
|
||||||
import type {
|
import type {
|
||||||
Product,
|
Product,
|
||||||
RoomConfiguration,
|
RoomConfiguration,
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ import {
|
|||||||
findSelectedRate,
|
findSelectedRate,
|
||||||
} from "./helpers"
|
} from "./helpers"
|
||||||
|
|
||||||
|
import type {
|
||||||
|
InitialState,
|
||||||
|
RatesState,
|
||||||
|
} from "@scandic-hotels/booking-flow/types/stores/rates"
|
||||||
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 type { InitialState, RatesState } from "@/types/stores/rates"
|
|
||||||
|
|
||||||
export function createRatesStore({
|
export function createRatesStore({
|
||||||
booking,
|
booking,
|
||||||
hotelType,
|
hotelType,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
|
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
|
||||||
|
|
||||||
import type { SelectRateBooking } from "./selectRate"
|
|
||||||
|
|
||||||
export interface HotelInfoCardProps {
|
export interface HotelInfoCardProps {
|
||||||
booking: SelectRateBooking
|
booking: SelectRateBooking
|
||||||
hotel: Hotel
|
hotel: Hotel
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
@@ -9,7 +10,6 @@ import type {
|
|||||||
RoomRate,
|
RoomRate,
|
||||||
} from "./enterDetails/details"
|
} from "./enterDetails/details"
|
||||||
import type { Price } from "./price"
|
import type { Price } from "./price"
|
||||||
import type { SelectRateBooking } from "./selectRate/selectRate"
|
|
||||||
|
|
||||||
export type RoomsData = {
|
export type RoomsData = {
|
||||||
rateDetails: string[] | undefined
|
rateDetails: string[] | undefined
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
|
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
|
||||||
|
import type { AvailabilityError } from "@scandic-hotels/booking-flow/types/stores/rates"
|
||||||
import type { Room } from "@scandic-hotels/trpc/types/hotel"
|
import type { Room } from "@scandic-hotels/trpc/types/hotel"
|
||||||
import type { RoomsAvailability } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { RoomsAvailability } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type { SelectRateBooking } from "../components/hotelReservation/selectRate/selectRate"
|
|
||||||
import type { AvailabilityError } from "../stores/rates"
|
|
||||||
|
|
||||||
export interface RatesProviderProps extends React.PropsWithChildren {
|
export interface RatesProviderProps extends React.PropsWithChildren {
|
||||||
booking: SelectRateBooking
|
booking: SelectRateBooking
|
||||||
hotelType: string | undefined
|
hotelType: string | undefined
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { SelectedRoom } from "@/types/stores/rates"
|
import type { SelectedRoom } from "@scandic-hotels/booking-flow/types/stores/rates"
|
||||||
|
|
||||||
export interface RoomProviderProps extends React.PropsWithChildren {
|
export interface RoomProviderProps extends React.PropsWithChildren {
|
||||||
idx: number
|
idx: number
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ export function DebugButton() {
|
|||||||
zIndex: 1000,
|
zIndex: 1000,
|
||||||
}}
|
}}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
// eslint-disable-next-line formatjs/no-literal-string-in-jsx
|
|
||||||
>
|
>
|
||||||
|
{/* // eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
||||||
DEBUG
|
DEBUG
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createContext, useContext } from "react"
|
import { createContext, useContext } from "react"
|
||||||
|
|
||||||
import type { RoomContextValue } from "@/types/contexts/select-rate/room"
|
import type { RoomContextValue } from "../../types/contexts/selectRate/room"
|
||||||
|
|
||||||
export const RoomContext = createContext<RoomContextValue | null>(null)
|
export const RoomContext = createContext<RoomContextValue | null>(null)
|
||||||
|
|
||||||
@@ -11,12 +11,6 @@ import {
|
|||||||
} from "react"
|
} from "react"
|
||||||
import { type IntlShape, useIntl } from "react-intl"
|
import { type IntlShape, useIntl } from "react-intl"
|
||||||
|
|
||||||
import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
|
||||||
import {
|
|
||||||
parseSelectRateSearchParams,
|
|
||||||
searchParamsToRecord,
|
|
||||||
serializeBookingSearchParams,
|
|
||||||
} from "@scandic-hotels/booking-flow/utils/url"
|
|
||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import { dt } from "@scandic-hotels/common/dt"
|
import { dt } from "@scandic-hotels/common/dt"
|
||||||
import { logger } from "@scandic-hotels/common/logger"
|
import { logger } from "@scandic-hotels/common/logger"
|
||||||
@@ -25,9 +19,14 @@ 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 { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input"
|
import { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input"
|
||||||
|
|
||||||
import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn"
|
import { useIsLoggedIn } from "../../hooks/useIsLoggedIn"
|
||||||
import useLang from "@/hooks/useLang"
|
import useLang from "../../hooks/useLang"
|
||||||
|
import { BookingCodeFilterEnum } from "../../stores/bookingCode-filter"
|
||||||
|
import {
|
||||||
|
parseSelectRateSearchParams,
|
||||||
|
searchParamsToRecord,
|
||||||
|
serializeBookingSearchParams,
|
||||||
|
} from "../../utils/url"
|
||||||
import { clearRooms } from "./clearRooms"
|
import { clearRooms } from "./clearRooms"
|
||||||
import { DebugButton } from "./DebugButton"
|
import { DebugButton } from "./DebugButton"
|
||||||
import { findUnavailableSelectedRooms } from "./findUnavailableSelectedRooms"
|
import { findUnavailableSelectedRooms } from "./findUnavailableSelectedRooms"
|
||||||
@@ -38,7 +37,7 @@ import { isRateSelected as isRateSelected_Inner } from "./isRateSelected"
|
|||||||
|
|
||||||
import type { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
|
import type { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast"
|
||||||
|
|
||||||
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
|
import type { SelectRateBooking } from "../../types/components/selectRate/selectRate"
|
||||||
import type {
|
import type {
|
||||||
AvailabilityWithRoomInfo,
|
AvailabilityWithRoomInfo,
|
||||||
DefaultRoomPackage,
|
DefaultRoomPackage,
|
||||||
@@ -65,7 +64,7 @@ export function SelectRateProvider({
|
|||||||
const lang = useLang()
|
const lang = useLang()
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const updateBooking = useUpdateBooking()
|
const updateBooking = useUpdateBooking()
|
||||||
const isUserLoggedIn = useIsUserLoggedIn()
|
const isUserLoggedIn = useIsLoggedIn()
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
const [activeRoomIndex, setInternalActiveRoomIndex] = useQueryState<number>(
|
const [activeRoomIndex, setInternalActiveRoomIndex] = useQueryState<number>(
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
|
import type { SelectRateBooking } from "../../types/components/selectRate/selectRate"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes room data
|
* Removes room data
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
|
|
||||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
import { sumPackages } from "../../utils/SelectRate"
|
||||||
|
|
||||||
import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
import type {
|
import type { AvailabilityWithRoomInfo, Rate, RoomPackage } from "./types"
|
||||||
AvailabilityWithRoomInfo,
|
|
||||||
Rate,
|
|
||||||
RoomPackage,
|
|
||||||
} from "@/contexts/SelectRate/types"
|
|
||||||
|
|
||||||
type TPrice = {
|
type TPrice = {
|
||||||
additionalPrice?: number
|
additionalPrice?: number
|
||||||
@@ -2,12 +2,13 @@ import { type RouterOutput } from "@scandic-hotels/trpc/client"
|
|||||||
|
|
||||||
import { type Price } from "./getTotalPrice"
|
import { type Price } from "./getTotalPrice"
|
||||||
|
|
||||||
import type { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
|
||||||
import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
import type { RoomsAvailabilityOutputSchema } from "@scandic-hotels/trpc/types/availability"
|
import type { RoomsAvailabilityOutputSchema } from "@scandic-hotels/trpc/types/availability"
|
||||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type { RoomConfiguration } from "@scandic-hotels/trpc/types/roomAvailability"
|
import type { RoomConfiguration } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
|
import type { BookingCodeFilterEnum } from "../../stores/bookingCode-filter"
|
||||||
|
|
||||||
export type SelectRateContext = {
|
export type SelectRateContext = {
|
||||||
hotel: QueryData<RouterOutput["hotel"]["get"]>
|
hotel: QueryData<RouterOutput["hotel"]["get"]>
|
||||||
availability: QueryData<
|
availability: QueryData<
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType"
|
|
||||||
import type { RateEnum } from "@scandic-hotels/common/constants/rate"
|
import type { RateEnum } from "@scandic-hotels/common/constants/rate"
|
||||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||||
import type { PackageEnum, Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { PackageEnum, Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
@@ -7,6 +6,8 @@ import type {
|
|||||||
RoomConfiguration,
|
RoomConfiguration,
|
||||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
|
import type { BookingSearchType } from "../../../misc/searchType"
|
||||||
|
|
||||||
export interface Room {
|
export interface Room {
|
||||||
adults: number
|
adults: number
|
||||||
childrenInRoom?: Child[]
|
childrenInRoom?: Child[]
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||||
|
|
||||||
import type { RatesState, SelectedRoom } from "@/types/stores/rates"
|
import type { RatesState, SelectedRoom } from "../../stores/rates"
|
||||||
|
|
||||||
export interface RoomContextValue extends Omit<SelectedRoom, "actions"> {
|
export interface RoomContextValue extends SelectedRoom {
|
||||||
actions: SelectedRoom["actions"]
|
|
||||||
isActiveRoom: boolean
|
isActiveRoom: boolean
|
||||||
isFetchingAdditionalRate: boolean
|
isFetchingAdditionalRate: boolean
|
||||||
isMainRoom: boolean
|
isMainRoom: boolean
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import type { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter"
|
|
||||||
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||||
import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||||
import type { Room } from "@scandic-hotels/trpc/types/hotel"
|
import type { Room } from "@scandic-hotels/trpc/types/hotel"
|
||||||
@@ -9,11 +8,12 @@ import type {
|
|||||||
RoomsAvailability,
|
RoomsAvailability,
|
||||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||||
|
|
||||||
|
import type { BookingCodeFilterEnum } from "../../stores/bookingCode-filter"
|
||||||
import type {
|
import type {
|
||||||
Rate,
|
Rate,
|
||||||
Room as RoomBooking,
|
Room as RoomBooking,
|
||||||
SelectRateBooking,
|
SelectRateBooking,
|
||||||
} from "@/types/components/hotelReservation/selectRate/selectRate"
|
} from "../components/selectRate/selectRate"
|
||||||
|
|
||||||
export interface AvailabilityError {
|
export interface AvailabilityError {
|
||||||
details: string
|
details: string
|
||||||
@@ -10,7 +10,7 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
|||||||
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
|
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
|
||||||
import type { JSX } from "react"
|
import type { JSX } from "react"
|
||||||
|
|
||||||
import { type RoomPackageCodes } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
import type { RoomPackageCodes } from "../../types/components/selectRate/roomFilter"
|
||||||
|
|
||||||
interface IconForFeatureCodeProps {
|
interface IconForFeatureCodeProps {
|
||||||
featureCode: RoomPackageCodes
|
featureCode: RoomPackageCodes
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
import isEqual from "fast-deep-equal"
|
import isEqual from "fast-deep-equal"
|
||||||
|
|
||||||
import {
|
import { parseBookingWidgetSearchParams, searchParamsToRecord } from "./url"
|
||||||
parseBookingWidgetSearchParams,
|
|
||||||
searchParamsToRecord,
|
|
||||||
type SelectRateBooking,
|
|
||||||
} from "./url"
|
|
||||||
|
|
||||||
import type { BookingWidgetSearchData } from "../components/BookingWidget"
|
import type { BookingWidgetSearchData } from "../components/BookingWidget"
|
||||||
|
import type { SelectRateBooking } from "../types/components/selectRate/selectRate"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses and compares booking widget search parameters
|
* Parses and compares booking widget search parameters
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ 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"
|
||||||
|
|
||||||
import type { NextSearchParams } from "../types"
|
import type { NextSearchParams } from "../types"
|
||||||
|
import type { SelectRateBooking } from "../types/components/selectRate/selectRate"
|
||||||
|
|
||||||
type PartialRoom = { rooms?: Partial<Room>[] }
|
type PartialRoom = { rooms?: Partial<Room>[] }
|
||||||
|
|
||||||
@@ -267,15 +268,6 @@ export type SelectHotelBooking = {
|
|||||||
bookingCode?: string
|
bookingCode?: string
|
||||||
searchType?: BookingSearchType
|
searchType?: BookingSearchType
|
||||||
}
|
}
|
||||||
export type SelectRateBooking = {
|
|
||||||
bookingCode?: string
|
|
||||||
city?: string
|
|
||||||
fromDate: string
|
|
||||||
hotelId: string
|
|
||||||
rooms: Room[]
|
|
||||||
searchType?: BookingSearchType
|
|
||||||
toDate: string
|
|
||||||
}
|
|
||||||
export interface Room {
|
export interface Room {
|
||||||
adults: number
|
adults: number
|
||||||
childrenInRoom?: Child[]
|
childrenInRoom?: Child[]
|
||||||
|
|||||||
@@ -33,13 +33,20 @@
|
|||||||
"./components/SidePeekAccordions/CheckInCheckOutAccordionItem": "./lib/components/SidePeekAccordions/CheckInCheckOutAccordionItem.tsx",
|
"./components/SidePeekAccordions/CheckInCheckOutAccordionItem": "./lib/components/SidePeekAccordions/CheckInCheckOutAccordionItem.tsx",
|
||||||
"./components/SidePeekAccordions/ParkingAccordionItem": "./lib/components/SidePeekAccordions/ParkingAccordionItem.tsx",
|
"./components/SidePeekAccordions/ParkingAccordionItem": "./lib/components/SidePeekAccordions/ParkingAccordionItem.tsx",
|
||||||
"./components/TripAdvisorChip": "./lib/components/TripAdvisorChip/index.tsx",
|
"./components/TripAdvisorChip": "./lib/components/TripAdvisorChip/index.tsx",
|
||||||
|
"./contexts/SelectRate/getTotalPrice": "./lib/contexts/SelectRate/getTotalPrice.ts",
|
||||||
|
"./contexts/SelectRate/SelectRateContext": "./lib/contexts/SelectRate/SelectRateContext.tsx",
|
||||||
|
"./contexts/SelectRate/Room": "./lib/contexts/SelectRate/Room.ts",
|
||||||
|
"./contexts/SelectRate/types": "./lib/contexts/SelectRate/types.ts",
|
||||||
"./hooks/useSearchHistory": "./lib/hooks/useSearchHistory.ts",
|
"./hooks/useSearchHistory": "./lib/hooks/useSearchHistory.ts",
|
||||||
"./pages/*": "./lib/pages/*.tsx",
|
"./pages/*": "./lib/pages/*.tsx",
|
||||||
"./searchType": "./lib/misc/searchType.ts",
|
"./searchType": "./lib/misc/searchType.ts",
|
||||||
"./stores/bookingCode-filter": "./lib/stores/bookingCode-filter.ts",
|
"./stores/bookingCode-filter": "./lib/stores/bookingCode-filter.ts",
|
||||||
"./stores/hotels-map": "./lib/stores/hotels-map.ts",
|
"./stores/hotels-map": "./lib/stores/hotels-map.ts",
|
||||||
|
"./types/components/selectRate/selectRate": "./lib/types/components/selectRate/selectRate.ts",
|
||||||
|
"./types/stores/rates": "./lib/types/stores/rates.ts",
|
||||||
"./utils/isSameBooking": "./lib/utils/isSameBooking.ts",
|
"./utils/isSameBooking": "./lib/utils/isSameBooking.ts",
|
||||||
"./utils/url": "./lib/utils/url.ts"
|
"./utils/url": "./lib/utils/url.ts",
|
||||||
|
"./utils/SelectRate": "./lib/utils/SelectRate/index.tsx"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^5.0.1",
|
"@hookform/resolvers": "^5.0.1",
|
||||||
@@ -53,6 +60,7 @@
|
|||||||
"fast-deep-equal": "^3.1.0",
|
"fast-deep-equal": "^3.1.0",
|
||||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
||||||
"motion": "^12.10.0",
|
"motion": "^12.10.0",
|
||||||
|
"nuqs": "^2.4.3",
|
||||||
"react-aria-components": "^1.8.0",
|
"react-aria-components": "^1.8.0",
|
||||||
"react-day-picker": "^9.6.7",
|
"react-day-picker": "^9.6.7",
|
||||||
"react-hook-form": "^7.56.2",
|
"react-hook-form": "^7.56.2",
|
||||||
|
|||||||
@@ -6125,6 +6125,7 @@ __metadata:
|
|||||||
fast-deep-equal: "npm:^3.1.0"
|
fast-deep-equal: "npm:^3.1.0"
|
||||||
json-stable-stringify-without-jsonify: "npm:^1.0.1"
|
json-stable-stringify-without-jsonify: "npm:^1.0.1"
|
||||||
motion: "npm:^12.10.0"
|
motion: "npm:^12.10.0"
|
||||||
|
nuqs: "npm:^2.4.3"
|
||||||
react-aria-components: "npm:^1.8.0"
|
react-aria-components: "npm:^1.8.0"
|
||||||
react-day-picker: "npm:^9.6.7"
|
react-day-picker: "npm:^9.6.7"
|
||||||
react-hook-form: "npm:^7.56.2"
|
react-hook-form: "npm:^7.56.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user