Merged in fix/SW-881-data-issues (pull request #913)
fix(SW-881) fixing data issues Approved-by: Niclas Edenvin
This commit is contained in:
@@ -41,7 +41,7 @@ export default function RateSummary({
|
||||
(feature) => feature.code === RoomPackageCodeEnum.PET_ROOM
|
||||
)
|
||||
|
||||
const petRoomPackage = packages.find(
|
||||
const petRoomPackage = packages?.find(
|
||||
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
||||
)
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export default function RoomCard({
|
||||
|
||||
const petRoomPackage =
|
||||
(selectedPackages.includes(RoomPackageCodeEnum.PET_ROOM) &&
|
||||
packages.find((pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM)) ||
|
||||
packages?.find((pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM)) ||
|
||||
undefined
|
||||
|
||||
const selectedRoom = roomCategories.find(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
import { useMemo, useState } from "react"
|
||||
import { useMemo } from "react"
|
||||
|
||||
import RateSummary from "./RateSummary"
|
||||
import RoomCard from "./RoomCard"
|
||||
@@ -9,7 +9,6 @@ import { getHotelReservationQueryParams } from "./utils"
|
||||
import styles from "./roomSelection.module.css"
|
||||
|
||||
import type { RoomSelectionProps } from "@/types/components/hotelReservation/selectRate/roomSelection"
|
||||
import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
|
||||
export default function RoomSelection({
|
||||
roomsAvailability,
|
||||
|
||||
@@ -855,7 +855,7 @@ export const breakfastPackagesSchema = z
|
||||
|
||||
export const packagesSchema = z.object({
|
||||
code: z.nativeEnum(RoomPackageCodeEnum),
|
||||
itemCode: z.string(),
|
||||
itemCode: z.string().optional(),
|
||||
description: z.string(),
|
||||
localPrice: packagePriceSchema,
|
||||
requestedPrice: packagePriceSchema,
|
||||
@@ -873,7 +873,7 @@ export const getRoomPackagesSchema = z
|
||||
data: z.object({
|
||||
attributes: z.object({
|
||||
hotelId: z.number(),
|
||||
packages: z.array(packagesSchema),
|
||||
packages: z.array(packagesSchema).optional().default([]),
|
||||
}),
|
||||
relationships: z
|
||||
.object({
|
||||
|
||||
@@ -5,6 +5,6 @@ import type { Rate } from "./selectRate"
|
||||
export interface RateSummaryProps {
|
||||
rateSummary: Rate
|
||||
isUserLoggedIn: boolean
|
||||
packages: RoomPackageData
|
||||
packages: RoomPackageData | undefined
|
||||
roomsAvailability: RoomsAvailability
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export type RoomCardProps = {
|
||||
rateDefinitions: RateDefinition[]
|
||||
roomCategories: RoomData[]
|
||||
selectedPackages: RoomPackageCodes[]
|
||||
packages: RoomPackageData
|
||||
packages: RoomPackageData | undefined
|
||||
handleSelectRate: (rate: Rate) => void
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,7 @@ export interface RoomFilterProps {
|
||||
filterOptions: RoomPackageData
|
||||
}
|
||||
|
||||
export interface RoomPackageData
|
||||
extends z.output<typeof getRoomPackagesSchema> {}
|
||||
|
||||
export type RoomPackageCodes = RoomPackageData[number]["code"]
|
||||
|
||||
export type RoomPackage = z.output<typeof packagesSchema>
|
||||
export interface RoomPackageData extends Array<RoomPackage> {}
|
||||
|
||||
export type RoomPackageCodes = RoomPackage["code"]
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface RoomSelectionProps {
|
||||
roomsAvailability: RoomsAvailability
|
||||
roomCategories: RoomData[]
|
||||
user: SafeUser
|
||||
packages: RoomPackageData
|
||||
packages: RoomPackageData | undefined
|
||||
selectedPackages: RoomPackageCodes[]
|
||||
setRateSummary: (rateSummary: Rate) => void
|
||||
rateSummary: Rate | null
|
||||
|
||||
Reference in New Issue
Block a user