Merge master
This commit is contained in:
@@ -4,7 +4,7 @@ import type { CardProps } from "@/components/TempDesignSystem/Card/card"
|
||||
|
||||
export type FacilitiesProps = {
|
||||
facilities: Facility[]
|
||||
activitiesCard?: ActivityCard
|
||||
activitiesCard: ActivityCard | null
|
||||
}
|
||||
|
||||
export type FacilityImage = {
|
||||
|
||||
3
types/components/hotelPage/hotelPage.ts
Normal file
3
types/components/hotelPage/hotelPage.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface HotelPageProps {
|
||||
hotelId: string
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
import type { RoomData } from "@/types/hotel"
|
||||
|
||||
export interface RoomCardProps {
|
||||
hotelId: string
|
||||
room: RoomData
|
||||
}
|
||||
|
||||
export type RoomsProps = {
|
||||
hotelId: string
|
||||
rooms: RoomData[]
|
||||
}
|
||||
|
||||
5
types/components/hotelPage/sidepeek/room.ts
Normal file
5
types/components/hotelPage/sidepeek/room.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { RoomData } from "@/types/hotel"
|
||||
|
||||
export interface RoomSidePeekProps {
|
||||
room: RoomData
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import { RoomPackageCodeEnum } from "../selectRate/roomFilter"
|
||||
import { Child } from "../selectRate/selectRate"
|
||||
|
||||
import { Packages } from "@/types/requests/packages"
|
||||
import type { RoomPackageCodeEnum } from "../selectRate/roomFilter"
|
||||
import type { Child } from "../selectRate/selectRate"
|
||||
|
||||
interface Room {
|
||||
adults: number
|
||||
@@ -17,29 +15,3 @@ export interface BookingData {
|
||||
toDate: string
|
||||
rooms: Room[]
|
||||
}
|
||||
|
||||
type Price = {
|
||||
amount: number
|
||||
currency: string
|
||||
}
|
||||
|
||||
export type RoomsData = {
|
||||
roomType: string
|
||||
prices: {
|
||||
public: {
|
||||
local: Price
|
||||
euro: Price | undefined
|
||||
}
|
||||
member:
|
||||
| {
|
||||
local: Price
|
||||
euro: Price | undefined
|
||||
}
|
||||
| undefined
|
||||
}
|
||||
adults: number
|
||||
children?: Child[]
|
||||
rateDetails?: string[]
|
||||
cancellationText: string
|
||||
packages: Packages | null
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { guestDetailsSchema } from "@/components/HotelReservation/EnterDetails/Details/schema"
|
||||
import {
|
||||
guestDetailsSchema,
|
||||
signedInDetailsSchema,
|
||||
} from "@/components/HotelReservation/EnterDetails/Details/schema"
|
||||
|
||||
import type { SafeUser } from "@/types/user"
|
||||
|
||||
export type DetailsSchema = z.output<typeof guestDetailsSchema>
|
||||
export type SignedInDetailsSchema = z.output<typeof signedInDetailsSchema>
|
||||
|
||||
type MemberPrice = { price: number; currency: string }
|
||||
type MemberPrice = {
|
||||
currency: string
|
||||
price: number
|
||||
}
|
||||
|
||||
export interface DetailsProps {
|
||||
user: SafeUser
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { RouterOutput } from "@/lib/trpc/client"
|
||||
|
||||
type HotelDataGet = RouterOutput["hotel"]["hotelData"]["get"]
|
||||
|
||||
export interface HotelHeaderProps {
|
||||
hotelData: NonNullable<HotelDataGet>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export type PriceChangeDialogProps = {
|
||||
isOpen: boolean
|
||||
oldPrice: number
|
||||
newPrice: number
|
||||
currency: string
|
||||
onCancel: () => void
|
||||
onAccept: () => void
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
|
||||
export const StepStoreKeys: Record<StepEnum, "bedType" | "breakfast" | null> = {
|
||||
"select-bed": "bedType",
|
||||
breakfast: "breakfast",
|
||||
details: null,
|
||||
payment: null,
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
import type { RoomsData } from "./bookingData"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
|
||||
|
||||
export interface SummaryProps {
|
||||
showMemberPrice: boolean
|
||||
room: RoomsData
|
||||
export interface ClientSummaryProps
|
||||
extends Pick<
|
||||
RoomAvailability,
|
||||
"cancellationText" | "memberRate" | "rateDetails"
|
||||
>,
|
||||
Pick<RoomAvailability["selectedRoom"], "roomType"> {
|
||||
adults: number
|
||||
isMember: boolean
|
||||
kids: Child[] | undefined
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { PaymentMethodEnum } from "@/constants/booking"
|
||||
|
||||
import { CreditCard, SafeUser } from "@/types/user"
|
||||
|
||||
export interface SectionProps {
|
||||
@@ -30,9 +32,14 @@ export interface DetailsProps extends SectionProps {}
|
||||
export interface PaymentProps {
|
||||
user: SafeUser
|
||||
roomPrice: { publicPrice: number; memberPrice: number | undefined }
|
||||
otherPaymentOptions: string[]
|
||||
savedCreditCards: CreditCard[] | null
|
||||
otherPaymentOptions: PaymentMethodEnum[]
|
||||
mustBeGuaranteed: boolean
|
||||
supportedCards: PaymentMethodEnum[]
|
||||
}
|
||||
|
||||
export interface PaymentClientProps
|
||||
extends Omit<PaymentProps, "supportedCards"> {
|
||||
savedCreditCards: CreditCard[] | null
|
||||
}
|
||||
|
||||
export interface SectionPageProps {
|
||||
|
||||
39
types/components/hotelReservation/summary.ts
Normal file
39
types/components/hotelReservation/summary.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { RoomPackageCodeEnum } from "./selectRate/roomFilter"
|
||||
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { DetailsState, Price } from "@/types/stores/enter-details"
|
||||
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
|
||||
import type { BedTypeSchema } from "./enterDetails/bedType"
|
||||
import type { BreakfastPackage } from "./enterDetails/breakfast"
|
||||
import type { Child } from "./selectRate/selectRate"
|
||||
|
||||
export type RoomsData = Pick<DetailsState, "roomPrice"> &
|
||||
Pick<RoomAvailability, "cancellationText" | "rateDetails"> &
|
||||
Pick<RoomAvailability["selectedRoom"], "roomType"> & {
|
||||
adults: number
|
||||
children?: Child[]
|
||||
packages: Packages | null
|
||||
}
|
||||
|
||||
interface SharedSummaryProps {
|
||||
fromDate: string
|
||||
toDate: string
|
||||
}
|
||||
|
||||
export interface SummaryProps extends SharedSummaryProps {
|
||||
bedType: BedTypeSchema | undefined
|
||||
breakfast: BreakfastPackage | false | undefined
|
||||
showMemberPrice: boolean
|
||||
room: RoomsData
|
||||
toggleSummaryOpen?: () => void
|
||||
totalPrice: Price
|
||||
}
|
||||
|
||||
export interface SummaryPageProps extends SharedSummaryProps {
|
||||
adults: number
|
||||
hotelId: string
|
||||
kids: Child[] | undefined
|
||||
packageCodes: RoomPackageCodeEnum[] | undefined
|
||||
rateCode: string
|
||||
roomTypeCode: string
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export type ToggleSidePeekProps = {
|
||||
hotelId: string
|
||||
roomTypeCode: string
|
||||
roomTypeCode?: string
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Coordinates } from "./coordinates"
|
||||
|
||||
export type StaticMapProps = {
|
||||
city?: string
|
||||
country?: string
|
||||
coordinates?: Coordinates
|
||||
width: number
|
||||
height: number
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { createDetailsStore } from "@/stores/details"
|
||||
import { createDetailsStore } from "@/stores/enter-details"
|
||||
|
||||
export type DetailsStore = ReturnType<typeof createDetailsStore>
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createStepsStore } from "@/stores/steps"
|
||||
|
||||
export type StepsStore = ReturnType<typeof createStepsStore>
|
||||
@@ -1,3 +0,0 @@
|
||||
export interface DetailsProviderProps extends React.PropsWithChildren {
|
||||
isMember: boolean
|
||||
}
|
||||
18
types/providers/enter-details.ts
Normal file
18
types/providers/enter-details.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { BedTypeSelection } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import { BookingData } from "@/types/components/hotelReservation/enterDetails/bookingData"
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/enterDetails/breakfast"
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
import type { RoomAvailability } from "@/types/trpc/routers/hotel/availability"
|
||||
import type { SafeUser } from "@/types/user"
|
||||
import type { Packages } from "../requests/packages"
|
||||
|
||||
export interface DetailsProviderProps extends React.PropsWithChildren {
|
||||
booking: BookingData
|
||||
bedTypes: BedTypeSelection[]
|
||||
breakfastPackages: BreakfastPackage[] | null
|
||||
packages: Packages | null
|
||||
roomRate: Pick<RoomAvailability, "memberRate" | "publicRate">
|
||||
searchParamsStr: string
|
||||
step: StepEnum
|
||||
user: SafeUser
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import type { BedTypeSelection } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
import type { BreakfastPackage } from "../components/hotelReservation/enterDetails/breakfast"
|
||||
|
||||
export interface StepsProviderProps extends React.PropsWithChildren {
|
||||
bedTypes: BedTypeSelection[]
|
||||
breakfastPackages: BreakfastPackage[] | null
|
||||
isMember: boolean
|
||||
searchParams: string
|
||||
step: StepEnum
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import type { BookingData } from "@/types/components/hotelReservation/enterDetails/bookingData"
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/enterDetails/breakfast"
|
||||
import type { DetailsSchema } from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
|
||||
export interface DetailsState {
|
||||
actions: {
|
||||
setIsSubmittingDisabled: (isSubmittingDisabled: boolean) => void
|
||||
setTotalPrice: (totalPrice: TotalPrice) => void
|
||||
toggleSummaryOpen: () => void
|
||||
updateBedType: (data: BedTypeSchema) => void
|
||||
updateBreakfast: (data: BreakfastPackage | false) => void
|
||||
updateDetails: (data: DetailsSchema) => void
|
||||
}
|
||||
data: DetailsSchema & {
|
||||
bedType: BedTypeSchema | undefined
|
||||
breakfast: BreakfastPackage | false | undefined
|
||||
booking: BookingData
|
||||
}
|
||||
isSubmittingDisabled: boolean
|
||||
isSummaryOpen: boolean
|
||||
isValid: Record<StepEnum, boolean>
|
||||
totalPrice: TotalPrice
|
||||
}
|
||||
|
||||
export interface InitialState extends Partial<DetailsState> {
|
||||
booking: BookingData
|
||||
}
|
||||
|
||||
interface Price {
|
||||
currency: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface TotalPrice {
|
||||
euro: Price | undefined
|
||||
local: Price
|
||||
}
|
||||
63
types/stores/enter-details.ts
Normal file
63
types/stores/enter-details.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import type { BookingData } from "@/types/components/hotelReservation/enterDetails/bookingData"
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/enterDetails/breakfast"
|
||||
import type {
|
||||
DetailsSchema,
|
||||
SignedInDetailsSchema,
|
||||
} from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
import type { DetailsProviderProps } from "../providers/enter-details"
|
||||
import type { Packages } from "../requests/packages"
|
||||
|
||||
interface TPrice {
|
||||
currency: string
|
||||
price: number
|
||||
}
|
||||
|
||||
export interface Price {
|
||||
euro: TPrice | undefined
|
||||
local: TPrice
|
||||
}
|
||||
|
||||
export interface FormValues {
|
||||
bedType: BedTypeSchema | undefined
|
||||
booking: BookingData
|
||||
breakfast: BreakfastPackage | false | undefined
|
||||
guest: DetailsSchema | SignedInDetailsSchema
|
||||
}
|
||||
|
||||
export interface DetailsState {
|
||||
actions: {
|
||||
completeStep: () => void
|
||||
navigate: (step: StepEnum) => void
|
||||
setIsSubmittingDisabled: (isSubmittingDisabled: boolean) => void
|
||||
setStep: (step: StepEnum) => void
|
||||
setTotalPrice: (totalPrice: Price) => void
|
||||
toggleSummaryOpen: () => void
|
||||
updateBedType: (data: BedTypeSchema) => void
|
||||
updateBreakfast: (data: BreakfastPackage | false) => void
|
||||
updateDetails: (data: DetailsSchema) => void
|
||||
}
|
||||
bedType: BedTypeSchema | undefined
|
||||
booking: BookingData
|
||||
breakfast: BreakfastPackage | false | undefined
|
||||
currentStep: StepEnum
|
||||
formValues: FormValues
|
||||
guest: DetailsSchema
|
||||
isSubmittingDisabled: boolean
|
||||
isSummaryOpen: boolean
|
||||
isValid: Record<StepEnum, boolean>
|
||||
packages: Packages | null
|
||||
roomRate: DetailsProviderProps["roomRate"]
|
||||
roomPrice: Price
|
||||
steps: StepEnum[]
|
||||
totalPrice: Price
|
||||
}
|
||||
|
||||
export type InitialState = Pick<DetailsState, "booking" | "packages"> &
|
||||
Pick<DetailsProviderProps, "roomRate"> & {
|
||||
bedType?: BedTypeSchema
|
||||
breakfast?: false
|
||||
}
|
||||
|
||||
export type RoomRate = DetailsProviderProps["roomRate"]
|
||||
@@ -1,10 +0,0 @@
|
||||
import { StepEnum } from "@/types/enums/step"
|
||||
|
||||
export interface StepState {
|
||||
completeStep: () => void
|
||||
navigate: (step: StepEnum) => void
|
||||
setStep: (step: StepEnum) => void
|
||||
|
||||
currentStep: StepEnum
|
||||
steps: StepEnum[]
|
||||
}
|
||||
5
types/trpc/routers/hotel/availability.ts
Normal file
5
types/trpc/routers/hotel/availability.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { RouterOutput } from "@/lib/trpc/client"
|
||||
|
||||
export type RoomAvailability = NonNullable<
|
||||
RouterOutput["hotel"]["availability"]["room"]
|
||||
>
|
||||
Reference in New Issue
Block a user