Merged in chore/SW-3395-move-bookingconfirmationprovider (pull request #2757)

chore(SW-3395): Moved BookingConfirmationProvider to booking-flow package

* chore(SW-3395): Moved BookingConfirmationProvider to booking-flow package


Approved-by: Anton Gunnarsson
This commit is contained in:
Hrishikesh Vaipurkar
2025-09-04 08:14:50 +00:00
parent 7e585b2d9a
commit 8e00769c64
19 changed files with 24 additions and 31 deletions

View File

@@ -2,12 +2,11 @@
import { useIntl } from "react-intl"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import Body from "@scandic-hotels/design-system/Body"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
import Subtitle from "@scandic-hotels/design-system/Subtitle"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import styles from "./paymentDetails.module.css"
export default function PaymentDetails() {

View File

@@ -1,10 +1,9 @@
"use client"
import PriceDetailsModal from "@scandic-hotels/booking-flow/components/PriceDetailsModal"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { dt } from "@scandic-hotels/common/dt"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import { mapToPrice } from "./mapToPrice"
import type { Price } from "@/types/components/hotelReservation/price"

View File

@@ -7,10 +7,9 @@ import {
packageSchema,
} from "@scandic-hotels/trpc/routers/hotels/schemas/packages"
import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation"
import type { Package } from "@scandic-hotels/trpc/types/packages"
import type { Room } from "@/types/stores/booking-confirmation"
export function mapToPrice(rooms: (Room | null)[], nights: number) {
return rooms
.filter((room): room is Room => !!room)

View File

@@ -3,6 +3,7 @@
import { cx } from "class-variance-authority"
import { useIntl } from "react-intl"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import { Button } from "@scandic-hotels/design-system/Button"
import { Divider } from "@scandic-hotels/design-system/Divider"
@@ -12,7 +13,6 @@ import { Typography } from "@scandic-hotels/design-system/Typography"
import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum"
import { CancellationRuleEnum } from "@/constants/booking"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription"

View File

@@ -3,13 +3,12 @@
import { cx } from "class-variance-authority"
import { useIntl } from "react-intl"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import { BookingCodeChip } from "@scandic-hotels/design-system/BookingCodeChip"
import { Divider } from "@scandic-hotels/design-system/Divider"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import PriceDetails from "../../PriceDetails"
import styles from "./totalPrice.module.css"

View File

@@ -2,14 +2,13 @@
import { useIntl } from "react-intl"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats"
import { dt } from "@scandic-hotels/common/dt"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import useLang from "@/hooks/useLang"
import Room from "./Room"

View File

@@ -3,12 +3,11 @@
import { useEffect } from "react"
import { useIntl } from "react-intl"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import { trpc } from "@scandic-hotels/trpc/client"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import useLang from "@/hooks/useLang"
import { mapRoomState } from "../../utils"

View File

@@ -3,6 +3,7 @@
import { useIntl } from "react-intl"
import { RoomDetailsSidePeek } from "@scandic-hotels/booking-flow/components/RoomDetailsSidePeek"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import {
changeOrCancelDateFormat,
longDateFormat,
@@ -15,7 +16,6 @@ import { Typography } from "@scandic-hotels/design-system/Typography"
import { getHotelRoom } from "@scandic-hotels/trpc/routers/booking/helpers"
import { CancellationRuleEnum } from "@/constants/booking"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import useLang from "@/hooks/useLang"

View File

@@ -3,8 +3,7 @@
import { useEffect, useState } from "react"
import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory"
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation"
import TrackingSDK from "@/components/TrackingSDK"
import useLang from "@/hooks/useLang"
@@ -12,10 +11,9 @@ import useLang from "@/hooks/useLang"
import { clearPaymentInfoSessionStorage } from "../../EnterDetails/Payment/helpers"
import { getTracking } from "./tracking"
import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation"
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
import type { Room } from "@/types/stores/booking-confirmation"
export default function Tracking({
bookingConfirmation,
refId,

View File

@@ -19,12 +19,11 @@ import { CancellationRuleEnum } from "@/constants/booking"
import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers"
import { getSpecialRoomType } from "@/utils/specialRoomType"
import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation"
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"
import type { Room } from "@/types/stores/booking-confirmation"
function getRate(cancellationRule: RateDefinition["cancellationRule"] | null) {
switch (cancellationRule) {
case "CancellableBefore6PM":

View File

@@ -1,5 +1,6 @@
import { notFound } from "next/navigation"
import BookingConfirmationProvider from "@scandic-hotels/booking-flow/providers/BookingConfirmationProvider"
import { filterOverlappingDates } from "@scandic-hotels/booking-flow/utils/SelectRate"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { dt } from "@scandic-hotels/common/dt"
@@ -15,7 +16,6 @@ import Receipt from "@/components/HotelReservation/BookingConfirmation/Receipt"
import Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms"
import SidePanel from "@/components/HotelReservation/SidePanel"
import { getIntl } from "@/i18n"
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"
import Confirmation from "./Confirmation"
import Tracking from "./Tracking"

View File

@@ -1,4 +1,4 @@
import type { Room } from "@/types/stores/booking-confirmation"
import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation"
export interface BookingConfirmationReceiptRoomProps {
room: Room

View File

@@ -1,6 +1,6 @@
import { createContext } from "react"
import type { BookingConfirmationStore } from "@/types/contexts/booking-confirmation"
import type { BookingConfirmationStore } from "../types/contexts/booking-confirmation"
export const BookingConfirmationContext =
createContext<BookingConfirmationStore | null>(null)

View File

@@ -6,12 +6,11 @@ import { useIntl } from "react-intl"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import { createBookingConfirmationStore } from "@/stores/booking-confirmation"
import { BookingConfirmationContext } from "../contexts/BookingConfirmation"
import { createBookingConfirmationStore } from "../stores/booking-confirmation"
import { BookingConfirmationContext } from "@/contexts/BookingConfirmation"
import type { BookingConfirmationStore } from "@/types/contexts/booking-confirmation"
import type { BookingConfirmationProviderProps } from "@/types/providers/booking-confirmation"
import type { BookingConfirmationStore } from "../types/contexts/booking-confirmation"
import type { BookingConfirmationProviderProps } from "../types/providers/booking-confirmation"
export default function BookingConfirmationProvider({
bookingCode,

View File

@@ -1,12 +1,12 @@
import { useContext } from "react"
import { create, useStore } from "zustand"
import { BookingConfirmationContext } from "@/contexts/BookingConfirmation"
import { BookingConfirmationContext } from "../../contexts/BookingConfirmation"
import type {
BookingConfirmationState,
InitialState,
} from "@/types/stores/booking-confirmation"
} from "../../types/stores/booking-confirmation"
export function createBookingConfirmationStore(initialState: InitialState) {
return create<BookingConfirmationState>()((set) => ({

View File

@@ -1,4 +1,4 @@
import type { createBookingConfirmationStore } from "@/stores/booking-confirmation"
import type { createBookingConfirmationStore } from "../../stores/booking-confirmation"
export type BookingConfirmationStore = ReturnType<
typeof createBookingConfirmationStore

View File

@@ -45,11 +45,14 @@
"./contexts/SelectRate/types": "./lib/contexts/SelectRate/types.ts",
"./hooks/useSearchHistory": "./lib/hooks/useSearchHistory.ts",
"./pages/*": "./lib/pages/*.tsx",
"./providers/BookingConfirmationProvider": "./lib/providers/BookingConfirmationProvider.tsx",
"./searchType": "./lib/misc/searchType.ts",
"./stores/bookingCode-filter": "./lib/stores/bookingCode-filter.ts",
"./stores/hotels-map": "./lib/stores/hotels-map.ts",
"./stores/booking-confirmation": "./lib/stores/booking-confirmation/index.ts",
"./types/components/selectRate/selectRate": "./lib/types/components/selectRate/selectRate.ts",
"./types/stores/rates": "./lib/types/stores/rates.ts",
"./types/stores/booking-confirmation": "./lib/types/stores/booking-confirmation.ts",
"./utils/isSameBooking": "./lib/utils/isSameBooking.ts",
"./utils/url": "./lib/utils/url.ts",
"./utils/SelectRate": "./lib/utils/SelectRate/index.tsx",