Merged in feat/SW-2113-allow-feature-combinations (pull request #1719)

Feat/SW-2113 allow feature combinations

* feat(SW-2113): Refactor features data to be fetched on filter room filter change

* feat(SW-2113): added loading state

* fix: now clear room selection when applying filter and room doesnt exists. And added room features to mobile summary

* fix

* fix: add package to price details

* feat(SW-2113): added buttons to room filter

* fix: active room

* fix: remove console log

* fix: added form and close handler to room package filter

* fix: add restriction so you cannot select pet room with allergy room and vice versa

* fix: fixes from review feedback

* fix

* fix: hide modify button if on nextcoming rooms if no selection is made, and adjust filter logic in togglePackage

* fix: forgot to use roomFeatureCodes from input..

* fix: naming


Approved-by: Simon.Emanuelsson
This commit is contained in:
Tobias Johansson
2025-04-07 11:36:34 +00:00
parent 8d34e1c8bb
commit e6ae6ff650
31 changed files with 725 additions and 359 deletions

View File

@@ -18,20 +18,21 @@ export interface SummaryProps {
isMember: boolean
}
export interface SummaryUIProps {
export interface EnterDetailsSummaryProps {
booking: SelectRateSearchParams
isMember: boolean
totalPrice: Price
toggleSummaryOpen: () => void
vat: number
}
export interface EnterDetailsSummaryProps extends SummaryUIProps {
rooms: RoomState[]
toggleSummaryOpen: () => void
}
export interface SelectRateSummaryProps extends SummaryUIProps {
rooms: {
export interface SelectRateSummaryProps {
booking: SelectRateSearchParams
isMember: boolean
totalPrice: Price
vat: number
rooms: Array<{
adults: number
childrenInRoom: Child[] | undefined
roomType: string
@@ -39,5 +40,7 @@ export interface SelectRateSummaryProps extends SummaryUIProps {
roomRate: RoomRate
rateDetails: string[] | undefined
cancellationText: string
}[]
packages?: Packages
} | null>
toggleSummaryOpen: () => void
}

View File

@@ -1,9 +1,13 @@
import type { RatesState, SelectedRoom } from "@/types/stores/rates"
export interface RoomContextValue extends Omit<SelectedRoom, "actions"> {
actions: Omit<SelectedRoom["actions"], "appendRegularRates">
actions: Omit<
SelectedRoom["actions"],
"appendRegularRates" | "addRoomFeatures"
>
isActiveRoom: boolean
isFetchingAdditionalRate: boolean
isFetchingRoomFeatures: boolean
isMainRoom: boolean
roomAvailability:
| NonNullable<RatesState["roomsAvailability"]>[number]

View File

@@ -25,10 +25,16 @@ export interface AvailabilityError {
interface Actions {
appendRegularRates: (roomConfigurations: RoomConfiguration[]) => void
addRoomFeatures: (
roomFeatures: {
roomTypeCode: RoomConfiguration["roomTypeCode"]
features: RoomConfiguration["features"]
}[]
) => void
closeSection: () => void
modifyRate: () => void
selectFilter: (filter: BookingCodeFilterEnum) => void
togglePackage: (code: RoomPackageCodeEnum) => void
togglePackages: (codes: RoomPackageCodeEnum[]) => void
selectRate: (rate: SelectedRate) => void
}
@@ -57,7 +63,7 @@ export interface RatesState {
packages: NonNullable<Packages>
pathname: string
petRoomPackage: NonNullable<Packages>[number] | undefined
rateSummary: Rate[]
rateSummary: Array<Rate | null>
rooms: SelectedRoom[]
roomCategories: Room[]
roomConfigurations: RoomConfiguration[][]