Merged in feat/SW-1356-reward-night-booking-2- (pull request #1559)
feat: SW-1356 Reward night bookingflow * feat: SW-1356 Reward night bookingflow * feat: SW-1356 Removed extra param booking call * feat: SW-1356 Optimized as review comments * feat: SW-1356 Schema validation updates * feat: SW-1356 Fix after rebase * feat: SW-1356 Optimised price.redemptions check * feat: SW-1356 Updated Props naming Approved-by: Arvid Norlin
This commit is contained in:
@@ -7,11 +7,13 @@ import type {
|
||||
guestDetailsSchema,
|
||||
signedInDetailsSchema,
|
||||
} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
|
||||
import type { productTypePointsSchema } from "@/server/routers/hotels/schemas/productTypePrice"
|
||||
import type { Price } from "../price"
|
||||
|
||||
export type DetailsSchema = z.output<typeof guestDetailsSchema>
|
||||
export type MultiroomDetailsSchema = z.output<typeof multiroomDetailsSchema>
|
||||
export type SignedInDetailsSchema = z.output<typeof signedInDetailsSchema>
|
||||
export type ProductTypePointsSchema = z.output<typeof productTypePointsSchema>
|
||||
|
||||
export interface RoomPrice {
|
||||
perNight: Price
|
||||
@@ -29,4 +31,5 @@ export type JoinScandicFriendsCardProps = {
|
||||
export type RoomRate = {
|
||||
memberRate?: Product["member"]
|
||||
publicRate?: Product["public"]
|
||||
redemptionRate?: ProductTypePointsSchema
|
||||
}
|
||||
|
||||
@@ -1,10 +1,31 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
|
||||
interface TPrice {
|
||||
currency: string
|
||||
price: number
|
||||
regularPrice?: number
|
||||
additionalPrice?: number
|
||||
additionalPriceCurrency?: string
|
||||
}
|
||||
|
||||
export interface Price {
|
||||
requested: TPrice | undefined
|
||||
requested?: TPrice
|
||||
local: TPrice
|
||||
}
|
||||
|
||||
export const PointsPriceSchema = z
|
||||
.object({
|
||||
localPrice: z.object({
|
||||
currency: z.nativeEnum(CurrencyEnum),
|
||||
price: z.number(),
|
||||
additionalPrice: z.number().optional(),
|
||||
additionalPriceCurrency: z.nativeEnum(CurrencyEnum).optional(),
|
||||
}),
|
||||
})
|
||||
.transform((data) => ({
|
||||
local: {
|
||||
...data.localPrice,
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import type {
|
||||
ProductTypePoints,
|
||||
ProductTypePrices,
|
||||
} from "@/types/trpc/routers/hotel/availability"
|
||||
import type { ProductTypePrices } from "@/types/trpc/routers/hotel/availability"
|
||||
|
||||
export type PriceCardProps = {
|
||||
productTypePrices: ProductTypePrices
|
||||
isMemberPrice?: boolean
|
||||
}
|
||||
|
||||
export type PointsCardProps = {
|
||||
productTypePoints?: ProductTypePoints
|
||||
redemptionPrice?: number
|
||||
export type PointsRowProps = {
|
||||
pointsPerStay: number
|
||||
additionalPricePerStay?: number
|
||||
additionalPriceCurrency?: string
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ export type FlexibilityOptionProps = {
|
||||
roomType: RoomConfiguration["roomType"]
|
||||
roomTypeCode: RoomConfiguration["roomTypeCode"]
|
||||
title: string
|
||||
rateTitle?: string // This is for the rates via booking codes
|
||||
rateName?: string // Obtained in case of booking code and redemption rates
|
||||
}
|
||||
|
||||
export interface PriceListProps {
|
||||
publicPrice?: ProductPrice | Record<string, never>
|
||||
memberPrice?: ProductPrice | Record<string, never>
|
||||
petRoomPackage?: RoomPackage
|
||||
rateTitle?: string // This is for the rates via booking codes
|
||||
rateName?: string // Obtained in case of booking code and redemption rates
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import type {
|
||||
RoomConfiguration,
|
||||
} from "@/types/trpc/routers/hotel/roomAvailability"
|
||||
import type { ChildBedMapEnum } from "../../bookingWidget/enums"
|
||||
import type { ProductTypePointsSchema } from "../enterDetails/details"
|
||||
import type { RoomPackageCodeEnum } from "./roomFilter"
|
||||
|
||||
export interface Child {
|
||||
@@ -43,20 +44,14 @@ export type Rate = {
|
||||
roomTypeCode: RoomConfiguration["roomTypeCode"]
|
||||
} & (
|
||||
| {
|
||||
member?: undefined
|
||||
public?: undefined
|
||||
member?: NonNullable<Product["member"]>
|
||||
public?: NonNullable<Product["public"]>
|
||||
redemption?: never
|
||||
}
|
||||
| {
|
||||
member?: never
|
||||
public: NonNullable<Product["public"]>
|
||||
}
|
||||
| {
|
||||
member: NonNullable<Product["member"]>
|
||||
public?: never
|
||||
}
|
||||
| {
|
||||
member: NonNullable<Product["member"]>
|
||||
public: NonNullable<Product["public"]>
|
||||
redemption: NonNullable<ProductTypePointsSchema>
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ export interface RoomContextValue extends SelectedRoom {
|
||||
modifyRate: () => void
|
||||
selectFilter: (code: RoomPackageCodeEnum | undefined) => void
|
||||
selectRate: (rate: SelectedRate) => void
|
||||
selectRateRedemption: (
|
||||
rate: SelectedRate,
|
||||
selectedRateCode?: string
|
||||
) => void
|
||||
}
|
||||
isActiveRoom: boolean
|
||||
isMainRoom: boolean
|
||||
|
||||
@@ -4,5 +4,6 @@ export enum CurrencyEnum {
|
||||
NOK = "NOK",
|
||||
PLN = "PLN",
|
||||
SEK = "SEK",
|
||||
POINTS = "POINTS",
|
||||
Unknown = "Unknown",
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ interface Actions {
|
||||
modifyRate: (idx: number) => () => void
|
||||
selectFilter: (idx: number) => (code: RoomPackageCodeEnum | undefined) => void
|
||||
selectRate: (idx: number) => (rate: SelectedRate) => void
|
||||
selectRateRedemption: (
|
||||
idx: number
|
||||
) => (rate: SelectedRate, selectedRateCode?: string) => void
|
||||
}
|
||||
|
||||
export interface SelectedRate {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import {
|
||||
type getHotelsByHotelIdsAvailabilityInputSchema,
|
||||
type hotelsAvailabilityInputSchema,
|
||||
type roomsCombinedAvailabilityInputSchema,
|
||||
type selectedRoomAvailabilityInputSchema,
|
||||
} from "@/server/routers/hotels/input"
|
||||
|
||||
import type { z } from "zod"
|
||||
|
||||
import type {
|
||||
getHotelsByHotelIdsAvailabilityInputSchema,
|
||||
hotelsAvailabilityInputSchema,
|
||||
} from "@/server/routers/hotels/input"
|
||||
import type { hotelsAvailabilitySchema } from "@/server/routers/hotels/output"
|
||||
import type { productTypeSchema } from "@/server/routers/hotels/schemas/availability/productType"
|
||||
import type {
|
||||
@@ -18,6 +21,12 @@ export type HotelsAvailabilityInputSchema = z.output<
|
||||
export type HotelsByHotelIdsAvailabilityInputSchema = z.output<
|
||||
typeof getHotelsByHotelIdsAvailabilityInputSchema
|
||||
>
|
||||
export type RoomsCombinedAvailabilityInputSchema = z.output<
|
||||
typeof roomsCombinedAvailabilityInputSchema
|
||||
>
|
||||
export type SelectedRoomAvailabilitySchema = z.output<
|
||||
typeof selectedRoomAvailabilityInputSchema
|
||||
>
|
||||
export type ProductType = z.output<typeof productTypeSchema>
|
||||
export type ProductTypePrices = z.output<typeof productTypePriceSchema>
|
||||
export type ProductTypePoints = z.output<typeof productTypePointsSchema>
|
||||
|
||||
Reference in New Issue
Block a user