Merged in chore/move-enter-details (pull request #2778)

Chore/move enter details

Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-09-11 07:16:24 +00:00
parent 15711cb3a4
commit 7dee6d5083
238 changed files with 1656 additions and 1602 deletions

View File

@@ -1,6 +0,0 @@
import type { z } from "zod"
import type { breakfastFormSchema } from "@/components/HotelReservation/EnterDetails/Breakfast/schema"
export interface BreakfastFormSchema
extends z.output<typeof breakfastFormSchema> {}

View File

@@ -1,14 +1,3 @@
import type { z } from "zod"
import type { bedTypeFormSchema } from "@/components/HotelReservation/EnterDetails/BedType/schema"
export interface BedTypeFormSchema extends z.output<typeof bedTypeFormSchema> {}
export type BedTypeSchema = {
description: string
type: string
roomTypeCode: string
}
export type BedTypeInfoProps = {
hasMultipleBedTypes: boolean
}

View File

@@ -1,38 +1,15 @@
import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType"
import type { productTypePointsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice"
import type { Child } from "@scandic-hotels/trpc/types/child"
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
import type { z } from "zod"
import type { SafeUser } from "@/types/user"
import type { getMultiroomDetailsSchema } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema"
import type {
guestDetailsSchema,
signedInDetailsSchema,
} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema"
import type { Price } from "../price"
export type DetailsSchema = z.output<typeof guestDetailsSchema>
export type MultiroomDetailsSchema = z.output<
ReturnType<typeof getMultiroomDetailsSchema>
>
export type SignedInDetailsSchema = z.output<typeof signedInDetailsSchema>
export type ProductTypePointsSchema = z.output<typeof productTypePointsSchema>
export interface RoomPrice {
perNight: Price
perStay: Price
}
export interface DetailsProps {
user: SafeUser
}
export type JoinScandicFriendsCardProps = {
name?: string
}
export type RoomRate = Product
export type DetailsBooking = {

View File

@@ -1,5 +0,0 @@
import type { HotelData } from "@scandic-hotels/trpc/types/hotel"
export interface HotelHeaderProps {
hotelData: HotelData & { url: string | null }
}

View File

@@ -1,23 +0,0 @@
import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
export interface PaymentProps {
otherPaymentOptions: PaymentMethodEnum[]
supportedCards: PaymentMethodEnum[]
}
export interface PaymentClientProps
extends Omit<PaymentProps, "supportedCards"> {
savedCreditCards: CreditCard[] | null
isUserLoggedIn: boolean
}
export type PriceChangeData = Array<{
roomPrice: number
totalPrice: number
packagePrice?: number
} | null>
export interface TermsAndConditionsProps {
isFlexBookingTerms: boolean
}

View File

@@ -1,9 +0,0 @@
import type { StepEnum } from "@/types/enums/step"
export interface SectionProps {
header: string
label: string
additionalInfo?: string | null
step: StepEnum
disabled?: boolean
}

View File

@@ -1,14 +1,8 @@
import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate"
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import type { Child } from "@scandic-hotels/trpc/types/child"
import type { Packages } from "@scandic-hotels/trpc/types/packages"
import type { RoomState } from "@/types/stores/enter-details"
import type {
DetailsBooking,
RoomPrice,
RoomRate,
} from "./enterDetails/details"
import type { RoomPrice, RoomRate } from "./enterDetails/details"
import type { Price } from "./price"
export type RoomsData = {
@@ -21,20 +15,6 @@ export type RoomsData = {
packages: Packages | null
}
export interface SummaryProps {
isUserLoggedIn: boolean
}
export interface EnterDetailsSummaryProps {
booking: DetailsBooking
isUserLoggedIn: boolean
totalPrice: Price
vat: number
rooms: RoomState[]
toggleSummaryOpen: () => void
defaultCurrency: CurrencyEnum
}
export interface SelectRateSummaryProps {
booking: SelectRateBooking
isMember: boolean

View File

@@ -1,10 +0,0 @@
import type { RoomState } from "@/types/stores/enter-details"
export interface RoomContextValue {
actions: RoomState["actions"]
isComplete: RoomState["isComplete"]
idx: number
room: RoomState["room"]
roomNr: number
steps: RoomState["steps"]
}

View File

@@ -1,3 +0,0 @@
import type { createDetailsStore } from "@/stores/enter-details"
export type DetailsStore = ReturnType<typeof createDetailsStore>

View File

@@ -1,5 +0,0 @@
export enum StepEnum {
selectBed = 0,
breakfast = 1,
details = 2,
}

View File

@@ -1,6 +0,0 @@
import type { Room } from "@scandic-hotels/trpc/types/room"
export interface RoomProviderProps extends React.PropsWithChildren {
idx: number
room: Room
}

View File

@@ -5,14 +5,3 @@ import type { Room } from "@scandic-hotels/trpc/types/room"
import type { SafeUser } from "@/types/user"
import type { DetailsBooking } from "../components/hotelReservation/enterDetails/details"
export interface DetailsProviderProps extends React.PropsWithChildren {
booking: DetailsBooking
breakfastPackages: BreakfastPackages
lang: Lang
rooms: Room[]
searchParamsStr: string
user: SafeUser
vat: number
roomCategories: RoomCategories
}

View File

@@ -1,111 +0,0 @@
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import type { BreakfastPackages } from "@scandic-hotels/trpc/routers/hotels/output"
import type { BreakfastPackage } from "@scandic-hotels/trpc/routers/hotels/schemas/packages"
import type { BedTypeSelection } from "@scandic-hotels/trpc/types/bedTypeSelection"
import type { Child } from "@scandic-hotels/trpc/types/child"
import type { RoomCategories } from "@scandic-hotels/trpc/types/hotel"
import type { Packages } from "@scandic-hotels/trpc/types/packages"
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
import type {
DetailsBooking,
DetailsSchema,
MultiroomDetailsSchema,
RoomPrice,
RoomRate,
SignedInDetailsSchema,
} from "@/types/components/hotelReservation/enterDetails/details"
import type { StepEnum } from "@/types/enums/step"
import type { CrossValidationData } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema"
import type { Price } from "../components/hotelReservation/price"
export interface InitialRoomData {
// used when there is only one bedtype to preselect it
bedType?: BedTypeSchema
bedTypes: BedTypeSelection[]
breakfastIncluded: boolean
cancellationText: string
cancellationRule?: string
isAvailable: boolean
isFlexRate: boolean
mustBeGuaranteed: boolean
memberMustBeGuaranteed?: boolean
rateDetails: string[] | undefined
memberRateDetails?: string[]
rateTitle?: string
roomFeatures: Packages | null
roomRate: RoomRate
roomType: string
roomTypeCode: string
}
export type RoomStep = {
step: StepEnum
isValid: boolean
}
export interface Room extends InitialRoomData {
adults: number
bedType: BedTypeSchema | undefined
breakfast: BreakfastPackage | false | undefined
childrenInRoom: Child[] | undefined
guest: DetailsSchema | MultiroomDetailsSchema | SignedInDetailsSchema
roomPrice: RoomPrice
specialRequest: {
comment: string
}
}
export interface RoomState {
actions: {
setIncomplete: () => void
updateBedType: (data: BedTypeSchema) => void
updateBreakfast: (data: BreakfastPackage | false) => void
updateJoin: (join: boolean) => void
updatePriceForMembershipNo: (membershipNo: string, isValid: boolean) => void
updateDetails: (data: DetailsSchema) => void
updatePartialGuestData: (data: CrossValidationData) => void
}
isComplete: boolean
room: Room
steps: {
[StepEnum.selectBed]: RoomStep
[StepEnum.breakfast]?: RoomStep
[StepEnum.details]: RoomStep
}
}
export type InitialState = {
booking: DetailsBooking
rooms: InitialRoomData[]
vat: number
roomCategories: RoomCategories
}
export interface DetailsState {
actions: {
setIsSubmitting: (isSubmitting: boolean) => void
toggleSummaryOpen: () => void
updateSeachParamString: (searchParamString: string) => void
addPreSubmitCallback: (name: string, callback: () => void) => void
}
availableBeds: Record<string, number>
booking: DetailsBooking
breakfastPackages: BreakfastPackages
canProceedToPayment: boolean
isSubmitting: boolean
isSummaryOpen: boolean
lastRoom: number
rooms: RoomState[]
searchParamString: string
totalPrice: Price
vat: number
roomCategories: RoomCategories
defaultCurrency: CurrencyEnum
preSubmitCallbacks: Record<string, () => void>
}
export type PersistedState = {
booking: DetailsBooking
rooms: RoomState[]
}

View File

@@ -1,3 +1,4 @@
import type { BedTypeSchema } from "@scandic-hotels/booking-flow/stores/enter-details/types"
import type { BreakfastPackage } from "@scandic-hotels/trpc/routers/hotels/schemas/packages"
import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation"
import type { Child } from "@scandic-hotels/trpc/types/child"
@@ -9,7 +10,6 @@ import type {
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
import type { IntlShape } from "react-intl"
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
import type { RoomPrice } from "@/types/components/hotelReservation/enterDetails/details"
import type { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
import type { Packages } from "@/types/components/myPages/myStay/ancillaries"