diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx index 020a26595..5769c8b86 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx @@ -1,5 +1,6 @@ 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 { logger } from "@scandic-hotels/common/logger" 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 SelectRate from "@/components/HotelReservation/SelectRate" -import { SelectRateProvider } from "@/contexts/SelectRate/SelectRateContext" import type { LangParams, NextSearchParams, PageArgs } from "@/types/params" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts index 8b92890cc..a18560648 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts @@ -1,6 +1,7 @@ import { createHash } from "crypto" 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 { RateEnum } from "@scandic-hotels/common/constants/rate" import { @@ -18,8 +19,6 @@ import { CancellationRuleEnum } from "@/constants/booking" import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers" import { getSpecialRoomType } from "@/utils/specialRoomType" -import { invertedBedTypeMap } from "../../utils" - import type { Lang } from "@scandic-hotels/common/constants/language" import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation" import type { RateDefinition } from "@scandic-hotels/trpc/types/roomAvailability" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx index dc9bf0a58..a6b0e32cc 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx @@ -1,5 +1,6 @@ import { notFound } from "next/navigation" +import { filterOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { dt } from "@scandic-hotels/common/dt" import { Alert } from "@scandic-hotels/design-system/Alert" @@ -16,7 +17,6 @@ import SidePanel from "@/components/HotelReservation/SidePanel" import { getIntl } from "@/i18n" import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider" -import { filterOverlappingDates } from "../utils" import Confirmation from "./Confirmation" import Tracking from "./Tracking" import { mapRoomState } from "./utils" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/mapToPrice.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/mapToPrice.ts index b4f50cf70..420ac2195 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/mapToPrice.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/mapToPrice.ts @@ -1,7 +1,6 @@ +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { logger } from "@scandic-hotels/common/logger" -import { sumPackages } from "@/components/HotelReservation/utils" - import type { RoomState } from "@/types/stores/enter-details" export function mapToPrice(rooms: RoomState[], isMember: boolean) { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts index 1c9b833bf..3f2962daf 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts @@ -1,5 +1,6 @@ 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 { TrackingChannelEnum, @@ -12,7 +13,6 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" -import { sumPackages } from "@/components/HotelReservation/utils" import { getSpecialRoomType } from "@/utils/specialRoomType" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts index c98f2e4cb..e9c2b75bd 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts @@ -1,8 +1,7 @@ +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { dt } from "@scandic-hotels/common/dt" -import { sumPackages } from "../../utils" - import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay" import type { Price } from "@/types/components/hotelReservation/price" import type { Room } from "@/types/stores/my-stay" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx index e7345e7ab..987d51efc 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx @@ -1,9 +1,9 @@ +import { calculateVat } from "@scandic-hotels/booking-flow/utils/SelectRate" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" -import { calculateVat } from "@/components/HotelReservation/utils" import { getIntl } from "@/i18n" import styles from "./specification.module.css" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx index 665b0e748..dcb5a0280 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx @@ -2,13 +2,13 @@ import { useState } from "react" import { useIntl } from "react-intl" +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { trpc } from "@scandic-hotels/trpc/client" import { useMyStayStore } from "@/stores/my-stay" -import { sumPackages } from "@/components/HotelReservation/utils" import useLang from "@/hooks/useLang" import Confirmation from "./Confirmation" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx index 415ffe0ad..8488a6103 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx @@ -1,6 +1,7 @@ "use client" import { useIntl } from "react-intl" +import { IconForFeatureCode } from "@scandic-hotels/booking-flow/utils/SelectRate" import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { RateEnum } from "@scandic-hotels/common/constants/rate" 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 { IconForFeatureCode } from "@/components/HotelReservation/utils" import useRateTitles from "@/hooks/booking/useRateTitles" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/BookingInformation/PriceDetails/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/BookingInformation/PriceDetails/index.tsx index bb9a11536..7f3f415bb 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/BookingInformation/PriceDetails/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/BookingInformation/PriceDetails/index.tsx @@ -1,12 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { Typography } from "@scandic-hotels/design-system/Typography" import { useMyStayStore } from "@/stores/my-stay" import PriceType from "@/components/HotelReservation/MyStay/PriceType" -import { sumPackages } from "@/components/HotelReservation/utils" import styles from "./details.module.css" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx index c833bed8b..ade9060df 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx @@ -1,11 +1,10 @@ "use client" +import { IconForFeatureCode } from "@scandic-hotels/booking-flow/utils/SelectRate" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { useMyStayStore } from "@/stores/my-stay" -import { IconForFeatureCode } from "@/components/HotelReservation/utils" - import styles from "./packages.module.css" export default function Packages() { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/TotalPrice.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/TotalPrice.tsx index 157519f49..111801834 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/TotalPrice.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/TotalPrice.tsx @@ -1,7 +1,8 @@ "use client" +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" + import { useMyStayStore } from "@/stores/my-stay" -import { sumPackages } from "../../utils" import PriceType from "../PriceType" import type { PriceType as _PriceType } from "@/types/components/hotelReservation/myStay/myStay" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx index afc30a975..b727d1b67 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx @@ -1,6 +1,7 @@ import { cookies } from "next/headers" import { notFound } from "next/navigation" +import { filterOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate" import { dt } from "@scandic-hotels/common/dt" import { logger } from "@scandic-hotels/common/logger" import * as maskValue from "@scandic-hotels/common/utils/maskValue" @@ -39,8 +40,6 @@ import { getIntl } from "@/i18n" import MyStayProvider from "@/providers/MyStay" import { isLoggedInUser } from "@/utils/isLoggedInUser" -import { filterOverlappingDates } from "../utils" - import styles from "./index.module.css" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx index 7eb556400..b279cd733 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx @@ -1,11 +1,10 @@ "use client" import { useIntl } from "react-intl" +import { calculateVat } from "@scandic-hotels/booking-flow/utils/SelectRate" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" -import { calculateVat } from "@/components/HotelReservation/utils" - import RegularRow from "./Regular" import type { Price } from "@/types/components/hotelReservation/price" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx index 6aaef4b33..7a818656d 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/DesktopSummary.tsx @@ -15,8 +15,8 @@ import { isBookingCodeRate } from "./utils" import styles from "./rateSummary.module.css" -import type { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" -import type { SelectedRate } from "@/contexts/SelectRate/types" +import type { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" +import type { SelectedRate } from "@scandic-hotels/booking-flow/contexts/SelectRate/types" export function DesktopSummary({ input, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx index 6ff39693b..15e1f530d 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx @@ -2,6 +2,7 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats" 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 SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import useRateTitles from "@/hooks/booking/useRateTitles" import useLang from "@/hooks/useLang" @@ -22,7 +22,7 @@ import Room from "../Room" 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 = { isMember: boolean diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx index d0ab3845c..80c637470 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx @@ -4,12 +4,12 @@ import { useEffect, useRef, useState } from "react" import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn" import { isBookingCodeRate } from "../utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts index b6db0177b..8318ff882 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts @@ -1,12 +1,12 @@ 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 { Rate, 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( room: Rate, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapToPrice.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapToPrice.ts index 18591f0c4..3af057e8b 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapToPrice.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapToPrice.ts @@ -1,7 +1,8 @@ import type { Rate, 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" export function mapToPrice( diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx index 94854269f..53b90c2aa 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx @@ -3,8 +3,9 @@ import { useRouter, useSearchParams } from "next/navigation" import { useState, useTransition } from "react" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" + import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { DesktopSummary } from "./DesktopSummary" import { MobileSummary } from "./MobileSummary" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/utils.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/utils.ts index d98fd76c0..675066d3a 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/utils.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/utils.ts @@ -1,8 +1,8 @@ +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" 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 { Product, @@ -10,7 +10,6 @@ import type { } from "@scandic-hotels/trpc/types/roomAvailability" import type { Price } from "@/types/components/hotelReservation/price" -import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate" export function calculateTotalPrice( selectedRateSummary: Rate[], diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/SelectedRoomPanel/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/SelectedRoomPanel/index.tsx index 6e32002cc..704ed9b7b 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/SelectedRoomPanel/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/SelectedRoomPanel/index.tsx @@ -1,6 +1,7 @@ "use client" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { RateEnum } from "@scandic-hotels/common/constants/rate" 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 Subtitle from "@scandic-hotels/design-system/Subtitle" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn" import styles from "./selectedRoomPanel.module.css" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/index.tsx index 3a8dcc446..4254111e2 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/MultiRoomWrapper/index.tsx @@ -1,13 +1,12 @@ import { useEffect } from "react" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Subtitle from "@scandic-hotels/design-system/Subtitle" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" - import { SelectedRoomPanel } from "./SelectedRoomPanel" import { roomSelectionPanelVariants } from "./variants" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx index 0bbba04b7..eb5f1fcca 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx @@ -1,12 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation" import { Alert } from "@scandic-hotels/design-system/Alert" import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import useLang from "@/hooks/useLang" import styles from "./alert.module.css" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx index f94d0e923..fb14a7840 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx @@ -12,6 +12,7 @@ import { } from "react-aria-components" 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 { RateTypeEnum } from "@scandic-hotels/common/constants/rateType" 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 { Typography } from "@scandic-hotels/design-system/Typography" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useBreakpoint } from "@/hooks/useBreakpoint" import styles from "./bookingCodeFilter.module.css" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RemoveBookingCodeButton/RemoveBookingCodeButton.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RemoveBookingCodeButton/RemoveBookingCodeButton.tsx index 03f4b269e..7fb162ef6 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RemoveBookingCodeButton/RemoveBookingCodeButton.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RemoveBookingCodeButton/RemoveBookingCodeButton.tsx @@ -1,7 +1,6 @@ +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { BookingCodeChip } from "@scandic-hotels/design-system/BookingCodeChip" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" - export function RemoveBookingCodeButton() { const { input: { bookingCode }, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/index.tsx index e1cbeaec1..56a51f6ba 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/index.tsx @@ -1,11 +1,11 @@ "use client" 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 { Typography } from "@scandic-hotels/design-system/Typography" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useBreakpoint } from "@/hooks/useBreakpoint" import PetRoomMessage from "./Form/Checkboxes/PetRoomMessage" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx index 18de31947..479a954bf 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx @@ -1,12 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { ErrorBoundary } from "@/components/ErrorBoundary/ErrorBoundary" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { RemoveBookingCodeButton } from "./RemoveBookingCodeButton/RemoveBookingCodeButton" import { RoomPackageFilter } from "./RoomPackageFilter" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Details/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Details/index.tsx index ecccd4ca8..ae1766c41 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Details/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Details/index.tsx @@ -7,7 +7,7 @@ import RoomSize from "./RoomSize" 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 = { roomInfo: RoomInfo diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/index.tsx index db027d0d8..160da236c 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/index.tsx @@ -2,11 +2,11 @@ import { useSession } from "next-auth/react" 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 { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { isValidClientSession } from "@/utils/clientSession" import { getBreakfastMessage } from "./getBreakfastMessage" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx index eddf407aa..ad63fdf43 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx @@ -1,15 +1,15 @@ "use client" 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 CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard" -import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard" - import { sumPackages, sumPackagesRequestedPrice, -} from "@/components/HotelReservation/utils" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" +} from "@scandic-hotels/booking-flow/utils/SelectRate" +import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard" +import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard" + import useRateTitles from "@/hooks/booking/useRateTitles" import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn" @@ -18,7 +18,7 @@ import { calculatePricePerNightPriceProduct } from "./totalPricePerNight" import type { AvailabilityWithRoomInfo, Package, -} from "@/contexts/SelectRate/types" +} from "@scandic-hotels/booking-flow/contexts/SelectRate/types" type CampaignProps = { nights: number diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx index 5919467db..d26eb0687 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx @@ -2,21 +2,20 @@ import { useIntl } from "react-intl" -import CodeRateCard from "@scandic-hotels/design-system/CodeRateCard" - +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { sumPackages, sumPackagesRequestedPrice, -} from "@/components/HotelReservation/utils" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" +} from "@scandic-hotels/booking-flow/utils/SelectRate" +import CodeRateCard from "@scandic-hotels/design-system/CodeRateCard" + import useRateTitles from "@/hooks/booking/useRateTitles" 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 { Package } from "@/contexts/SelectRate/types" - type CodeProps = { nights: number roomTypeCode: string diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx index 4b8ae4b5b..72a6d932c 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx @@ -1,17 +1,17 @@ "use client" 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 { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" 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 type { AvailabilityWithRoomInfo, Package, -} from "@/contexts/SelectRate/types" +} from "@scandic-hotels/booking-flow/contexts/SelectRate/types" type RedemptionsProps = { redemptions: AvailabilityWithRoomInfo["redemptions"] diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx index 0766435e9..6b45f285e 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx @@ -2,24 +2,23 @@ import { useSession } from "next-auth/react" 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 NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard" -import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard" - import { sumPackages, sumPackagesRequestedPrice, -} from "@/components/HotelReservation/utils" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" +} from "@scandic-hotels/booking-flow/utils/SelectRate" +import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard" +import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard" + import useRateTitles from "@/hooks/booking/useRateTitles" import { isValidClientSession } from "@/utils/clientSession" 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 { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types" - interface Rate { label: string price: string diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx index 95a2dfd53..907d73413 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx @@ -1,20 +1,18 @@ "use client" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { BookingCodeFilterEnum } from "@scandic-hotels/booking-flow/stores/bookingCode-filter" import { Divider } from "@scandic-hotels/design-system/Divider" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" - import { BreakfastMessage } from "./BreakfastMessage" import Campaign from "./Campaign" import Code from "./Code" import Redemptions from "./Redemptions" 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 { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types" - export interface RatesProps { roomConfiguration: AvailabilityWithRoomInfo roomIndex: number diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts index 759ff1ee2..7a42ab34e 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts @@ -1,11 +1,10 @@ +import type { SelectedRate } from "@scandic-hotels/booking-flow/types/stores/rates" import type { CorporateChequeProduct, PriceProduct, VoucherProduct, } from "@scandic-hotels/trpc/types/roomAvailability" -import type { SelectedRate } from "@/types/stores/rates" - export function isSelectedPriceProduct( product: PriceProduct, selectedRate: SelectedRate | null, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/RoomImage/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/RoomImage/index.tsx index 9f963bb99..05be00088 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/RoomImage/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/RoomImage/index.tsx @@ -2,13 +2,13 @@ import { memo } from "react" 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 { Typography } from "@scandic-hotels/design-system/Typography" import { getHotelRoom } from "@scandic-hotels/trpc/routers/booking/helpers" -import { IconForFeatureCode } from "@/components/HotelReservation/utils" import RoomDetailsSidePeek from "@/components/SidePeeks/RoomDetailsSidePeek" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" import styles from "./image.module.css" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx index 64726dd25..3930ebf54 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx @@ -8,10 +8,9 @@ import RoomNotAvailable from "./RoomNotAvailable" 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 { AvailabilityWithRoomInfo } from "@/contexts/SelectRate/types" - export type RoomListItemProps = { room: AvailabilityWithRoomInfo selectedPackages: Package[] diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx index e3b3df8b7..c1952dbf8 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/ScrollToList.tsx @@ -1,7 +1,7 @@ "use client" 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" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/index.tsx index 174c5b3a2..e0cd1156d 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/index.tsx @@ -1,5 +1,5 @@ "use client" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { RoomListItem } from "./RoomListItem" import { RoomsListSkeleton } from "./RoomsListSkeleton" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx index 95aa2049f..95ed02463 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx @@ -1,6 +1,6 @@ "use client" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { MultiRoomWrapper } from "./MultiRoomWrapper" import NoAvailabilityAlert from "./NoAvailabilityAlert" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx index 3d4abfa79..7b64522a6 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx @@ -3,11 +3,10 @@ import { TRPCClientError } from "@trpc/client" import { useIntl } from "react-intl" +import { useSelectRateContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/SelectRateContext" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { Alert } from "@scandic-hotels/design-system/Alert" -import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" - import { RateSummary } from "./RateSummary" import Rooms from "./Rooms" import { RoomsContainerSkeleton } from "./RoomsContainerSkeleton" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts index 928cc7a79..4d1b58dd2 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts @@ -8,10 +8,10 @@ import { import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" 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 { Child } from "@scandic-hotels/trpc/types/child" -import type { Room } from "@/types/components/hotelReservation/selectRate/selectRate" type ChildrenInRoom = (Child[] | null)[] | null diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx index dc9fd434e..329b23297 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/index.tsx @@ -2,6 +2,7 @@ import { cookies } from "next/headers" import FnFNotAllowedAlert from "@scandic-hotels/booking-flow/components/FnFNotAllowedAlert" 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 { dt } from "@scandic-hotels/common/dt" import { HotelInfoCard } from "@scandic-hotels/design-system/HotelInfoCard" @@ -10,14 +11,12 @@ import { RoomsContainer } from "@/components/HotelReservation/SelectRate/RoomsCo import { getIntl } from "@/i18n" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { hasOverlappingDates } from "../utils" import AvailabilityError from "./AvailabilityError" 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 { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" - export default async function SelectRatePage({ booking, hotelData, diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index 5e396a675..e430d10f3 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -1,5 +1,6 @@ import { useIntl } from "react-intl" +import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" 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 PriceType from "@/components/HotelReservation/MyStay/PriceType" import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils" -import { sumPackages } from "@/components/HotelReservation/utils" import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import useLang from "@/hooks/useLang" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" diff --git a/apps/scandic-web/providers/SelectRate/RoomProvider.tsx b/apps/scandic-web/providers/SelectRate/RoomProvider.tsx index 72a63c997..f3d85aafe 100644 --- a/apps/scandic-web/providers/SelectRate/RoomProvider.tsx +++ b/apps/scandic-web/providers/SelectRate/RoomProvider.tsx @@ -1,13 +1,12 @@ "use client" +import { RoomContext } from "@scandic-hotels/booking-flow/contexts/SelectRate/Room" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs" import { useRatesStore } from "@/stores/select-rate" -import { RoomContext } from "@/contexts/SelectRate/Room" - import type { RoomProviderProps } from "@/types/providers/select-rate/room" export default function RoomProvider({ diff --git a/apps/scandic-web/stores/enter-details/helpers.ts b/apps/scandic-web/stores/enter-details/helpers.ts index 873e69712..c70b144c8 100644 --- a/apps/scandic-web/stores/enter-details/helpers.ts +++ b/apps/scandic-web/stores/enter-details/helpers.ts @@ -1,18 +1,18 @@ import isEqual from "fast-deep-equal" 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 { sumPackages, 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 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 { CorporateChequeProduct, @@ -24,7 +24,6 @@ import type { import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details" import type { Price } from "@/types/components/hotelReservation/price" -import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" import type { PersistedState, RoomState } from "@/types/stores/enter-details" import type { SafeUser } from "@/types/user" diff --git a/apps/scandic-web/stores/select-rate/helpers.ts b/apps/scandic-web/stores/select-rate/helpers.ts index 429facffc..1ddc582ea 100644 --- a/apps/scandic-web/stores/select-rate/helpers.ts +++ b/apps/scandic-web/stores/select-rate/helpers.ts @@ -1,5 +1,6 @@ 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 { Product, RoomConfiguration, diff --git a/apps/scandic-web/stores/select-rate/index.ts b/apps/scandic-web/stores/select-rate/index.ts index cbd17331b..8f3c003b1 100644 --- a/apps/scandic-web/stores/select-rate/index.ts +++ b/apps/scandic-web/stores/select-rate/index.ts @@ -16,11 +16,13 @@ import { findSelectedRate, } 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 { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability" -import type { InitialState, RatesState } from "@/types/stores/rates" - export function createRatesStore({ booking, hotelType, diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts index dc822cda9..d4f708527 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts @@ -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 { SelectRateBooking } from "./selectRate" - export interface HotelInfoCardProps { booking: SelectRateBooking hotel: Hotel diff --git a/apps/scandic-web/types/components/hotelReservation/summary.ts b/apps/scandic-web/types/components/hotelReservation/summary.ts index b438b3f10..85232c6f1 100644 --- a/apps/scandic-web/types/components/hotelReservation/summary.ts +++ b/apps/scandic-web/types/components/hotelReservation/summary.ts @@ -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 { Child } from "@scandic-hotels/trpc/types/child" import type { Packages } from "@scandic-hotels/trpc/types/packages" @@ -9,7 +10,6 @@ import type { RoomRate, } from "./enterDetails/details" import type { Price } from "./price" -import type { SelectRateBooking } from "./selectRate/selectRate" export type RoomsData = { rateDetails: string[] | undefined diff --git a/apps/scandic-web/types/providers/rates.ts b/apps/scandic-web/types/providers/rates.ts index 0932bfa0b..6e9a27e46 100644 --- a/apps/scandic-web/types/providers/rates.ts +++ b/apps/scandic-web/types/providers/rates.ts @@ -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 { 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 { booking: SelectRateBooking hotelType: string | undefined diff --git a/apps/scandic-web/types/providers/select-rate/room.ts b/apps/scandic-web/types/providers/select-rate/room.ts index 112280c02..32e8ebf91 100644 --- a/apps/scandic-web/types/providers/select-rate/room.ts +++ b/apps/scandic-web/types/providers/select-rate/room.ts @@ -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 { idx: number diff --git a/apps/scandic-web/contexts/SelectRate/DebugButton.tsx b/packages/booking-flow/lib/contexts/SelectRate/DebugButton.tsx similarity index 95% rename from apps/scandic-web/contexts/SelectRate/DebugButton.tsx rename to packages/booking-flow/lib/contexts/SelectRate/DebugButton.tsx index 9da8dd0b6..c75721e70 100644 --- a/apps/scandic-web/contexts/SelectRate/DebugButton.tsx +++ b/packages/booking-flow/lib/contexts/SelectRate/DebugButton.tsx @@ -32,8 +32,8 @@ export function DebugButton() { zIndex: 1000, }} onClick={handleClick} - // eslint-disable-next-line formatjs/no-literal-string-in-jsx > + {/* // eslint-disable-next-line formatjs/no-literal-string-in-jsx */} DEBUG ) diff --git a/apps/scandic-web/contexts/SelectRate/Room.ts b/packages/booking-flow/lib/contexts/SelectRate/Room.ts similarity index 79% rename from apps/scandic-web/contexts/SelectRate/Room.ts rename to packages/booking-flow/lib/contexts/SelectRate/Room.ts index f7b99c9eb..336f6b629 100644 --- a/apps/scandic-web/contexts/SelectRate/Room.ts +++ b/packages/booking-flow/lib/contexts/SelectRate/Room.ts @@ -1,6 +1,6 @@ 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(null) diff --git a/apps/scandic-web/contexts/SelectRate/SelectRateContext.tsx b/packages/booking-flow/lib/contexts/SelectRate/SelectRateContext.tsx similarity index 97% rename from apps/scandic-web/contexts/SelectRate/SelectRateContext.tsx rename to packages/booking-flow/lib/contexts/SelectRate/SelectRateContext.tsx index 242635028..dee8470fd 100644 --- a/apps/scandic-web/contexts/SelectRate/SelectRateContext.tsx +++ b/packages/booking-flow/lib/contexts/SelectRate/SelectRateContext.tsx @@ -11,12 +11,6 @@ import { } from "react" 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 { dt } from "@scandic-hotels/common/dt" 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 { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input" -import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn" -import useLang from "@/hooks/useLang" - +import { useIsLoggedIn } from "../../hooks/useIsLoggedIn" +import useLang from "../../hooks/useLang" +import { BookingCodeFilterEnum } from "../../stores/bookingCode-filter" +import { + parseSelectRateSearchParams, + searchParamsToRecord, + serializeBookingSearchParams, +} from "../../utils/url" import { clearRooms } from "./clearRooms" import { DebugButton } from "./DebugButton" 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 { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" +import type { SelectRateBooking } from "../../types/components/selectRate/selectRate" import type { AvailabilityWithRoomInfo, DefaultRoomPackage, @@ -65,7 +64,7 @@ export function SelectRateProvider({ const lang = useLang() const searchParams = useSearchParams() const updateBooking = useUpdateBooking() - const isUserLoggedIn = useIsUserLoggedIn() + const isUserLoggedIn = useIsLoggedIn() const intl = useIntl() const [activeRoomIndex, setInternalActiveRoomIndex] = useQueryState( diff --git a/apps/scandic-web/contexts/SelectRate/clearRooms.ts b/packages/booking-flow/lib/contexts/SelectRate/clearRooms.ts similarity index 89% rename from apps/scandic-web/contexts/SelectRate/clearRooms.ts rename to packages/booking-flow/lib/contexts/SelectRate/clearRooms.ts index fc7e4aee3..689934153 100644 --- a/apps/scandic-web/contexts/SelectRate/clearRooms.ts +++ b/packages/booking-flow/lib/contexts/SelectRate/clearRooms.ts @@ -1,4 +1,4 @@ -import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" +import type { SelectRateBooking } from "../../types/components/selectRate/selectRate" /** * Removes room data diff --git a/apps/scandic-web/contexts/SelectRate/findUnavailableSelectedRooms.ts b/packages/booking-flow/lib/contexts/SelectRate/findUnavailableSelectedRooms.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/findUnavailableSelectedRooms.ts rename to packages/booking-flow/lib/contexts/SelectRate/findUnavailableSelectedRooms.ts diff --git a/apps/scandic-web/contexts/SelectRate/getSelectedPackages.test.ts b/packages/booking-flow/lib/contexts/SelectRate/getSelectedPackages.test.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/getSelectedPackages.test.ts rename to packages/booking-flow/lib/contexts/SelectRate/getSelectedPackages.test.ts diff --git a/apps/scandic-web/contexts/SelectRate/getSelectedPackages.ts b/packages/booking-flow/lib/contexts/SelectRate/getSelectedPackages.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/getSelectedPackages.ts rename to packages/booking-flow/lib/contexts/SelectRate/getSelectedPackages.ts diff --git a/apps/scandic-web/contexts/SelectRate/getTotalPrice.test.ts b/packages/booking-flow/lib/contexts/SelectRate/getTotalPrice.test.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/getTotalPrice.test.ts rename to packages/booking-flow/lib/contexts/SelectRate/getTotalPrice.test.ts diff --git a/apps/scandic-web/contexts/SelectRate/getTotalPrice.ts b/packages/booking-flow/lib/contexts/SelectRate/getTotalPrice.ts similarity index 97% rename from apps/scandic-web/contexts/SelectRate/getTotalPrice.ts rename to packages/booking-flow/lib/contexts/SelectRate/getTotalPrice.ts index b3318730a..be4c96009 100644 --- a/apps/scandic-web/contexts/SelectRate/getTotalPrice.ts +++ b/packages/booking-flow/lib/contexts/SelectRate/getTotalPrice.ts @@ -1,14 +1,10 @@ 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 { - AvailabilityWithRoomInfo, - Rate, - RoomPackage, -} from "@/contexts/SelectRate/types" +import type { AvailabilityWithRoomInfo, Rate, RoomPackage } from "./types" type TPrice = { additionalPrice?: number diff --git a/apps/scandic-web/contexts/SelectRate/includeRoomInfo.test.ts b/packages/booking-flow/lib/contexts/SelectRate/includeRoomInfo.test.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/includeRoomInfo.test.ts rename to packages/booking-flow/lib/contexts/SelectRate/includeRoomInfo.test.ts diff --git a/apps/scandic-web/contexts/SelectRate/includeRoomInfo.ts b/packages/booking-flow/lib/contexts/SelectRate/includeRoomInfo.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/includeRoomInfo.ts rename to packages/booking-flow/lib/contexts/SelectRate/includeRoomInfo.ts diff --git a/apps/scandic-web/contexts/SelectRate/isRateSelected.test.ts b/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/isRateSelected.test.ts rename to packages/booking-flow/lib/contexts/SelectRate/isRateSelected.test.ts diff --git a/apps/scandic-web/contexts/SelectRate/isRateSelected.ts b/packages/booking-flow/lib/contexts/SelectRate/isRateSelected.ts similarity index 100% rename from apps/scandic-web/contexts/SelectRate/isRateSelected.ts rename to packages/booking-flow/lib/contexts/SelectRate/isRateSelected.ts diff --git a/apps/scandic-web/contexts/SelectRate/types.ts b/packages/booking-flow/lib/contexts/SelectRate/types.ts similarity index 97% rename from apps/scandic-web/contexts/SelectRate/types.ts rename to packages/booking-flow/lib/contexts/SelectRate/types.ts index 89fc01f60..fef11225e 100644 --- a/apps/scandic-web/contexts/SelectRate/types.ts +++ b/packages/booking-flow/lib/contexts/SelectRate/types.ts @@ -2,12 +2,13 @@ import { type RouterOutput } from "@scandic-hotels/trpc/client" 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 { RoomsAvailabilityOutputSchema } from "@scandic-hotels/trpc/types/availability" import type { PackageEnum } from "@scandic-hotels/trpc/types/packages" import type { RoomConfiguration } from "@scandic-hotels/trpc/types/roomAvailability" +import type { BookingCodeFilterEnum } from "../../stores/bookingCode-filter" + export type SelectRateContext = { hotel: QueryData availability: QueryData< diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts b/packages/booking-flow/lib/types/components/selectRate/roomFilter.ts similarity index 100% rename from apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts rename to packages/booking-flow/lib/types/components/selectRate/roomFilter.ts diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts b/packages/booking-flow/lib/types/components/selectRate/selectRate.ts similarity index 93% rename from apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts rename to packages/booking-flow/lib/types/components/selectRate/selectRate.ts index d4b993634..9d9ae1e38 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts +++ b/packages/booking-flow/lib/types/components/selectRate/selectRate.ts @@ -1,4 +1,3 @@ -import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType" import type { RateEnum } from "@scandic-hotels/common/constants/rate" import type { Child } from "@scandic-hotels/trpc/types/child" import type { PackageEnum, Packages } from "@scandic-hotels/trpc/types/packages" @@ -7,6 +6,8 @@ import type { RoomConfiguration, } from "@scandic-hotels/trpc/types/roomAvailability" +import type { BookingSearchType } from "../../../misc/searchType" + export interface Room { adults: number childrenInRoom?: Child[] diff --git a/apps/scandic-web/types/contexts/select-rate/room.ts b/packages/booking-flow/lib/types/contexts/selectRate/room.ts similarity index 66% rename from apps/scandic-web/types/contexts/select-rate/room.ts rename to packages/booking-flow/lib/types/contexts/selectRate/room.ts index bd0767c05..d69a2bf8e 100644 --- a/apps/scandic-web/types/contexts/select-rate/room.ts +++ b/packages/booking-flow/lib/types/contexts/selectRate/room.ts @@ -1,9 +1,8 @@ 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 { - actions: SelectedRoom["actions"] +export interface RoomContextValue extends SelectedRoom { isActiveRoom: boolean isFetchingAdditionalRate: boolean isMainRoom: boolean diff --git a/apps/scandic-web/types/stores/rates.ts b/packages/booking-flow/lib/types/stores/rates.ts similarity index 93% rename from apps/scandic-web/types/stores/rates.ts rename to packages/booking-flow/lib/types/stores/rates.ts index 86c7897b4..32b37199c 100644 --- a/apps/scandic-web/types/stores/rates.ts +++ b/packages/booking-flow/lib/types/stores/rates.ts @@ -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 { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import type { Room } from "@scandic-hotels/trpc/types/hotel" @@ -9,11 +8,12 @@ import type { RoomsAvailability, } from "@scandic-hotels/trpc/types/roomAvailability" +import type { BookingCodeFilterEnum } from "../../stores/bookingCode-filter" import type { Rate, Room as RoomBooking, SelectRateBooking, -} from "@/types/components/hotelReservation/selectRate/selectRate" +} from "../components/selectRate/selectRate" export interface AvailabilityError { details: string diff --git a/apps/scandic-web/components/HotelReservation/utils/index.test.ts b/packages/booking-flow/lib/utils/SelectRate/index.test.ts similarity index 100% rename from apps/scandic-web/components/HotelReservation/utils/index.test.ts rename to packages/booking-flow/lib/utils/SelectRate/index.test.ts diff --git a/apps/scandic-web/components/HotelReservation/utils/index.tsx b/packages/booking-flow/lib/utils/SelectRate/index.tsx similarity index 97% rename from apps/scandic-web/components/HotelReservation/utils/index.tsx rename to packages/booking-flow/lib/utils/SelectRate/index.tsx index d6531ac55..79f055c97 100644 --- a/apps/scandic-web/components/HotelReservation/utils/index.tsx +++ b/packages/booking-flow/lib/utils/SelectRate/index.tsx @@ -10,7 +10,7 @@ import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import type { Package, Packages } from "@scandic-hotels/trpc/types/packages" import type { JSX } from "react" -import { type RoomPackageCodes } from "@/types/components/hotelReservation/selectRate/roomFilter" +import type { RoomPackageCodes } from "../../types/components/selectRate/roomFilter" interface IconForFeatureCodeProps { featureCode: RoomPackageCodes diff --git a/packages/booking-flow/lib/utils/isSameBooking.ts b/packages/booking-flow/lib/utils/isSameBooking.ts index 60cdbd810..d4810f68b 100644 --- a/packages/booking-flow/lib/utils/isSameBooking.ts +++ b/packages/booking-flow/lib/utils/isSameBooking.ts @@ -1,12 +1,9 @@ import isEqual from "fast-deep-equal" -import { - parseBookingWidgetSearchParams, - searchParamsToRecord, - type SelectRateBooking, -} from "./url" +import { parseBookingWidgetSearchParams, searchParamsToRecord } from "./url" import type { BookingWidgetSearchData } from "../components/BookingWidget" +import type { SelectRateBooking } from "../types/components/selectRate/selectRate" /** * Parses and compares booking widget search parameters diff --git a/packages/booking-flow/lib/utils/url.ts b/packages/booking-flow/lib/utils/url.ts index ce42ae284..a6916a938 100644 --- a/packages/booking-flow/lib/utils/url.ts +++ b/packages/booking-flow/lib/utils/url.ts @@ -12,6 +12,7 @@ import type { Child } from "@scandic-hotels/trpc/types/child" import type { PackageEnum } from "@scandic-hotels/trpc/types/packages" import type { NextSearchParams } from "../types" +import type { SelectRateBooking } from "../types/components/selectRate/selectRate" type PartialRoom = { rooms?: Partial[] } @@ -267,15 +268,6 @@ export type SelectHotelBooking = { bookingCode?: string searchType?: BookingSearchType } -export type SelectRateBooking = { - bookingCode?: string - city?: string - fromDate: string - hotelId: string - rooms: Room[] - searchType?: BookingSearchType - toDate: string -} export interface Room { adults: number childrenInRoom?: Child[] diff --git a/packages/booking-flow/package.json b/packages/booking-flow/package.json index bfbd6c0ce..851165af2 100644 --- a/packages/booking-flow/package.json +++ b/packages/booking-flow/package.json @@ -33,13 +33,20 @@ "./components/SidePeekAccordions/CheckInCheckOutAccordionItem": "./lib/components/SidePeekAccordions/CheckInCheckOutAccordionItem.tsx", "./components/SidePeekAccordions/ParkingAccordionItem": "./lib/components/SidePeekAccordions/ParkingAccordionItem.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", "./pages/*": "./lib/pages/*.tsx", "./searchType": "./lib/misc/searchType.ts", "./stores/bookingCode-filter": "./lib/stores/bookingCode-filter.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/url": "./lib/utils/url.ts" + "./utils/url": "./lib/utils/url.ts", + "./utils/SelectRate": "./lib/utils/SelectRate/index.tsx" }, "dependencies": { "@hookform/resolvers": "^5.0.1", @@ -53,6 +60,7 @@ "fast-deep-equal": "^3.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "motion": "^12.10.0", + "nuqs": "^2.4.3", "react-aria-components": "^1.8.0", "react-day-picker": "^9.6.7", "react-hook-form": "^7.56.2", diff --git a/yarn.lock b/yarn.lock index e09c3e83e..1aa84853e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6125,6 +6125,7 @@ __metadata: fast-deep-equal: "npm:^3.1.0" json-stable-stringify-without-jsonify: "npm:^1.0.1" motion: "npm:^12.10.0" + nuqs: "npm:^2.4.3" react-aria-components: "npm:^1.8.0" react-day-picker: "npm:^9.6.7" react-hook-form: "npm:^7.56.2"