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:
Hrishikesh Vaipurkar
2025-09-02 07:40:01 +00:00
parent 1804f7b7cd
commit 0a4bf40a15
77 changed files with 127 additions and 148 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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"

View File

@@ -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,

View File

@@ -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(

View File

@@ -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"

View File

@@ -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[],