feat(697): Made new fields optional
This commit is contained in:
@@ -78,8 +78,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
|
|||||||
? intl.formatMessage<React.ReactNode>(
|
? intl.formatMessage<React.ReactNode>(
|
||||||
{ id: "breakfast.price.free" },
|
{ id: "breakfast.price.free" },
|
||||||
{
|
{
|
||||||
amount: pkg.localPrice.price,
|
amount: pkg.localPrice?.price,
|
||||||
currency: pkg.localPrice.currency,
|
currency: pkg.localPrice?.currency,
|
||||||
free: (str) => <Highlight>{str}</Highlight>,
|
free: (str) => <Highlight>{str}</Highlight>,
|
||||||
strikethrough: (str) => <s>{str}</s>,
|
strikethrough: (str) => <s>{str}</s>,
|
||||||
}
|
}
|
||||||
@@ -87,8 +87,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
|
|||||||
: intl.formatMessage(
|
: intl.formatMessage(
|
||||||
{ id: "breakfast.price" },
|
{ id: "breakfast.price" },
|
||||||
{
|
{
|
||||||
amount: pkg.localPrice.price,
|
amount: pkg.localPrice?.price,
|
||||||
currency: pkg.localPrice.currency,
|
currency: pkg.localPrice?.currency,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,8 +150,8 @@ export default function Summary({
|
|||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id: "{amount} {currency}" },
|
{ id: "{amount} {currency}" },
|
||||||
{
|
{
|
||||||
amount: chosenBreakfast.localPrice.price,
|
amount: chosenBreakfast.localPrice?.price,
|
||||||
currency: chosenBreakfast.localPrice.currency,
|
currency: chosenBreakfast.localPrice?.currency,
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
</Caption>
|
</Caption>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { differenceInCalendarDays } from "date-fns"
|
import { differenceInCalendarDays } from "date-fns"
|
||||||
|
import { useSearchParams } from "next/navigation"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
@@ -27,8 +28,7 @@ export default function PriceList({
|
|||||||
const petRoomRequestedPrice = petRoomPackage?.requestedPrice
|
const petRoomRequestedPrice = petRoomPackage?.requestedPrice
|
||||||
|
|
||||||
const showRequestedPrice = publicRequestedPrice && memberRequestedPrice
|
const showRequestedPrice = publicRequestedPrice && memberRequestedPrice
|
||||||
|
const searchParams = useSearchParams()
|
||||||
const searchParams = new URLSearchParams(window.location.search)
|
|
||||||
const fromDate = searchParams.get("fromDate")
|
const fromDate = searchParams.get("fromDate")
|
||||||
const toDate = searchParams.get("toDate")
|
const toDate = searchParams.get("toDate")
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ export default function RateSummary({
|
|||||||
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
||||||
)
|
)
|
||||||
|
|
||||||
const petRoomPrice = petRoomPackage?.localPrice.totalPrice ?? null
|
const petRoomPrice = petRoomPackage?.localPrice?.totalPrice ?? null
|
||||||
const petRoomCurrency = petRoomPackage?.localPrice.currency ?? null
|
const petRoomCurrency = petRoomPackage?.localPrice?.currency ?? null
|
||||||
|
|
||||||
const checkInDate = new Date(roomsAvailability.checkInDate)
|
const checkInDate = new Date(roomsAvailability.checkInDate)
|
||||||
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
const checkOutDate = new Date(roomsAvailability.checkOutDate)
|
||||||
|
|||||||
@@ -774,11 +774,13 @@ export const apiLocationsSchema = z.object({
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
const breakfastPackagePriceSchema = z.object({
|
const breakfastPackagePriceSchema = z
|
||||||
|
.object({
|
||||||
currency: z.nativeEnum(CurrencyEnum),
|
currency: z.nativeEnum(CurrencyEnum),
|
||||||
price: z.string(),
|
price: z.string(),
|
||||||
totalPrice: z.string(),
|
totalPrice: z.string(),
|
||||||
})
|
})
|
||||||
|
.optional() // TODO: Remove optional when the API change has been deployed
|
||||||
|
|
||||||
export const breakfastPackageSchema = z.object({
|
export const breakfastPackageSchema = z.object({
|
||||||
code: z.string(),
|
code: z.string(),
|
||||||
|
|||||||
@@ -1095,8 +1095,11 @@ export const hotelQueryRouter = router({
|
|||||||
const freeBreakfastPackage = breakfastPackages.data.find(
|
const freeBreakfastPackage = breakfastPackages.data.find(
|
||||||
(pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST
|
(pkg) => pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST
|
||||||
)
|
)
|
||||||
if (freeBreakfastPackage) {
|
if (freeBreakfastPackage && freeBreakfastPackage.localPrice) {
|
||||||
if (originalBreakfastPackage) {
|
if (
|
||||||
|
originalBreakfastPackage &&
|
||||||
|
originalBreakfastPackage.localPrice
|
||||||
|
) {
|
||||||
freeBreakfastPackage.localPrice.price =
|
freeBreakfastPackage.localPrice.price =
|
||||||
originalBreakfastPackage.localPrice.price
|
originalBreakfastPackage.localPrice.price
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ export const getRoomPackagesInputSchema = z.object({
|
|||||||
packageCodes: z.array(z.string()).optional().default([]),
|
packageCodes: z.array(z.string()).optional().default([]),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const packagePriceSchema = z.object({
|
export const packagePriceSchema = z
|
||||||
|
.object({
|
||||||
currency: z.string(),
|
currency: z.string(),
|
||||||
price: z.string(),
|
price: z.string(),
|
||||||
totalPrice: z.string(),
|
totalPrice: z.string(),
|
||||||
})
|
})
|
||||||
|
.optional() // TODO: Remove optional when the API change has been deployed
|
||||||
|
|
||||||
export const packagesSchema = z.object({
|
export const packagesSchema = z.object({
|
||||||
code: z.nativeEnum(RoomPackageCodeEnum),
|
code: z.nativeEnum(RoomPackageCodeEnum),
|
||||||
|
|||||||
Reference in New Issue
Block a user