Feature/select rate vertical data flow * add fix from SW-2666 * use translations for room packages * move types to it's own file * Merge branch 'master' of bitbucket.org:scandic-swap/web into feature/select-rate-vertical-data-flow * merge * feature/select-rate: double rate for campaing rates * revert NODE_ENV check in Cookiebot script * revert testing values * fix(SW-3171): fix all filter selected in price details * fix(SW-3166): multiroom anchoring when changing filter * fix(SW-3172): check hotelType, show correct breakfast message * Merge branch 'feature/select-rate-vertical-data-flow' of bitbucket.org:scandic-swap/web into feature/select-rate-vertical-data-flow * fix: show special needs icons for subsequent roomTypes SW-3167 * fix: Display strike through text when logged in SW-3168 * fix: Reinstate the scrollToView behaviour when selecting a rate SW-3169 * merge * . * PR fixes * fix: don't return notFound() * . * always include defaults for room packages * merge * merge * merge * Remove floating h1 for new select-rate Approved-by: Anton Gunnarsson
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { z } from "zod"
|
|
|
|
import { RoomPackageCodeEnum } from "../../../../enums/roomFilter"
|
|
import { AvailabilityEnum } from "../../../../enums/selectHotel"
|
|
import {
|
|
corporateChequeProduct,
|
|
priceProduct,
|
|
productSchema,
|
|
redemptionProduct,
|
|
voucherProduct,
|
|
} from "./product"
|
|
|
|
export const roomConfigurationSchema = z.object({
|
|
breakfastIncludedInAllRatesMember: z.boolean().default(false),
|
|
breakfastIncludedInAllRates: z.boolean().default(false),
|
|
features: z
|
|
.array(
|
|
z.object({
|
|
inventory: z.number(),
|
|
code: z.enum([
|
|
RoomPackageCodeEnum.PET_ROOM,
|
|
RoomPackageCodeEnum.ALLERGY_ROOM,
|
|
RoomPackageCodeEnum.ACCESSIBILITY_ROOM,
|
|
]),
|
|
})
|
|
)
|
|
.default([]),
|
|
products: z.array(productSchema).default([]),
|
|
roomsLeft: z.number(),
|
|
roomType: z.string(),
|
|
roomTypeCode: z.string(),
|
|
status: z
|
|
.nativeEnum(AvailabilityEnum)
|
|
.nullish()
|
|
.default(AvailabilityEnum.NotAvailable),
|
|
|
|
// Red
|
|
campaign: z
|
|
.array(priceProduct)
|
|
.optional()
|
|
.transform((val) => (val ? val.filter(Boolean) : [])),
|
|
// Blue
|
|
code: z
|
|
.array(z.union([corporateChequeProduct, priceProduct, voucherProduct]))
|
|
.optional()
|
|
.transform((val) => (val ? val.filter(Boolean) : [])),
|
|
// Beige
|
|
regular: z
|
|
.array(priceProduct)
|
|
.optional()
|
|
.transform((val) => (val ? val.filter(Boolean) : [])),
|
|
// Burgundy
|
|
redemptions: z
|
|
.array(redemptionProduct)
|
|
.optional()
|
|
.transform((val) => (val ? val.filter(Boolean) : [])),
|
|
})
|
|
|
|
export type RoomConfiguration = z.infer<typeof roomConfigurationSchema>
|