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

@@ -2,8 +2,6 @@ import { z } from "zod"
import { Lang } from "@/constants/languages"
import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator"
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
import { Country } from "@/types/enums/country"
@@ -48,6 +46,9 @@ export const roomsCombinedAvailabilityInputSchema = z.object({
roomStayEndDate: z.string(),
roomStayStartDate: z.string(),
redemption: z.boolean().optional().default(false),
roomFeatureCodesArray: z
.array(z.array(z.nativeEnum(RoomPackageCodeEnum)).nullable())
.optional(),
})
export const selectedRoomAvailabilityInputSchema = z.object({
@@ -167,16 +168,17 @@ export const roomFeaturesInputSchema = z.object({
hotelId: z.string(),
startDate: z.string(),
endDate: z.string(),
adultsCount: z.array(z.number()),
childArray: z
adults: z.number(),
childrenInRoom: z
.array(
nullableArrayObjectValidator(
z.object({
age: z.number(),
bed: z.nativeEnum(ChildBedMapEnum),
})
)
z.object({
age: z.number(),
bed: z.nativeEnum(ChildBedMapEnum),
})
)
.nullable(),
roomFeatureCode: z.array(z.nativeEnum(RoomPackageCodeEnum)).optional(),
.optional(),
roomFeatureCodes: z.array(z.nativeEnum(RoomPackageCodeEnum)).optional(),
roomIndex: z.number().optional(),
})
export type RoomFeaturesInput = z.input<typeof roomFeaturesInputSchema>