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,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
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import type { packageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/packages"
|
||||
import type { z } from "zod"
|
||||
|
||||
type RoomPackage = z.output<typeof packageSchema>
|
||||
export type RoomPackageCodes = RoomPackage["code"]
|
||||
@@ -1,50 +0,0 @@
|
||||
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"
|
||||
import type {
|
||||
Product,
|
||||
RoomConfiguration,
|
||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||
|
||||
export interface Room {
|
||||
adults: number
|
||||
childrenInRoom?: Child[]
|
||||
bookingCode?: string | null
|
||||
counterRateCode?: string | null
|
||||
packages?: PackageEnum[] | null
|
||||
rateCode?: string | null
|
||||
roomTypeCode?: string | null
|
||||
}
|
||||
|
||||
export type SelectRateBooking = {
|
||||
bookingCode?: string
|
||||
city?: string
|
||||
fromDate: string
|
||||
hotelId: string
|
||||
rooms: Room[]
|
||||
searchType?: BookingSearchType
|
||||
toDate: string
|
||||
}
|
||||
|
||||
export type Rate = {
|
||||
features: RoomConfiguration["features"]
|
||||
packages: NonNullable<Packages>
|
||||
priceName?: string
|
||||
priceTerm?: string
|
||||
product: Product
|
||||
rate: RateEnum
|
||||
roomRates?: {
|
||||
rate: Rate
|
||||
roomIndex: number
|
||||
}[]
|
||||
roomType: RoomConfiguration["roomType"]
|
||||
roomTypeCode: RoomConfiguration["roomTypeCode"]
|
||||
}
|
||||
|
||||
export type RateCode = {
|
||||
publicRateCode: string
|
||||
roomTypeCode: string
|
||||
name: string
|
||||
paymentTerm: string
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { RatesState, SelectedRoom } from "@/types/stores/rates"
|
||||
|
||||
export interface RoomContextValue extends Omit<SelectedRoom, "actions"> {
|
||||
actions: SelectedRoom["actions"]
|
||||
isActiveRoom: boolean
|
||||
isFetchingAdditionalRate: boolean
|
||||
isMainRoom: boolean
|
||||
petRoomPackage: Package | undefined
|
||||
roomAvailability:
|
||||
| NonNullable<RatesState["roomsAvailability"]>[number]
|
||||
| undefined
|
||||
roomPackages: Package[]
|
||||
roomNr: number
|
||||
totalRooms: number
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
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"
|
||||
import type { Package, PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
import type {
|
||||
Product,
|
||||
RoomConfiguration,
|
||||
RoomsAvailability,
|
||||
} from "@scandic-hotels/trpc/types/roomAvailability"
|
||||
|
||||
import type {
|
||||
Rate,
|
||||
Room as RoomBooking,
|
||||
SelectRateBooking,
|
||||
} from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
|
||||
export interface AvailabilityError {
|
||||
details: string
|
||||
error: string
|
||||
}
|
||||
|
||||
interface Actions {
|
||||
appendRegularRates: (
|
||||
roomConfigurations: RoomConfiguration[] | undefined
|
||||
) => void
|
||||
closeSection: () => void
|
||||
modifyRate: () => void
|
||||
removeSelectedPackage: (code: PackageEnum) => void
|
||||
removeSelectedPackages: () => void
|
||||
selectFilter: (filter: BookingCodeFilterEnum) => void
|
||||
selectPackages: (codes: PackageEnum[]) => void
|
||||
selectRate: (rate: SelectedRate, isUserLoggedIn: boolean) => void
|
||||
updateRooms: (rooms: RoomConfiguration[] | undefined) => void
|
||||
}
|
||||
|
||||
export interface SelectedRate {
|
||||
features: RoomConfiguration["features"]
|
||||
product: Product
|
||||
roomType: RoomConfiguration["roomType"]
|
||||
roomTypeCode: RoomConfiguration["roomTypeCode"]
|
||||
}
|
||||
|
||||
export interface SelectedRoom {
|
||||
actions: Actions
|
||||
bookingRoom: RoomBooking
|
||||
isFetchingAdditionalRate: boolean
|
||||
isFetchingPackages: boolean
|
||||
rooms: RoomConfiguration[]
|
||||
selectedFilter: BookingCodeFilterEnum | undefined
|
||||
selectedPackages: Package[]
|
||||
selectedRate: SelectedRate | null
|
||||
}
|
||||
|
||||
interface DefaultFilterOptions {
|
||||
code: RoomPackageCodeEnum
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface RatesState {
|
||||
activeRoom: number
|
||||
booking: SelectRateBooking
|
||||
hotelType: string | undefined
|
||||
isRedemptionBooking: boolean
|
||||
packageOptions: DefaultFilterOptions[]
|
||||
rateSummary: Array<Rate | null>
|
||||
rooms: SelectedRoom[]
|
||||
roomCategories: Room[]
|
||||
roomConfigurations: RoomConfiguration[][]
|
||||
roomsPackages: Package[][]
|
||||
roomsAvailability: (RoomsAvailability | AvailabilityError)[] | undefined
|
||||
vat: number
|
||||
defaultCurrency: CurrencyEnum
|
||||
}
|
||||
|
||||
export interface InitialState
|
||||
extends Pick<
|
||||
RatesState,
|
||||
"booking" | "hotelType" | "roomCategories" | "roomsAvailability" | "vat"
|
||||
> {
|
||||
initialActiveRoom?: number
|
||||
pathname: string
|
||||
labels: {
|
||||
accessibilityRoom: string
|
||||
allergyRoom: string
|
||||
petRoom: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user