Merge branch 'master' into feature/tracking

This commit is contained in:
Linus Flood
2024-11-21 07:53:58 +01:00
213 changed files with 3486 additions and 1990 deletions

View File

@@ -4,7 +4,7 @@ import type { Location, Locations } from "@/types/trpc/routers/hotel/locations"
export interface BookingWidgetFormProps {
locations: Locations
type?: BookingWidgetType
setIsOpen: (isOpen: boolean) => void
onClose: () => void
}
export interface BookingWidgetFormContentProps {

View File

@@ -0,0 +1,5 @@
import type { Hotel } from "@/types/hotel"
export type FacilityProps = {
data: Hotel["healthFacilities"][number]
}

View File

@@ -0,0 +1,6 @@
import type { Hotel } from "@/types/hotel"
export type WellnessAndExerciseSidePeekProps = {
healthFacilities: Hotel["healthFacilities"]
buttonUrl?: string
}

View File

@@ -25,9 +25,10 @@ type Price = {
export type RoomsData = {
roomType: string
localPrice: Price
euroPrice: Price
euroPrice: Price | undefined
adults: number
children?: Child[]
rateDetails?: string[]
cancellationText: string
packages: Packages | null
}

View File

@@ -17,5 +17,5 @@ export interface BreakfastPackage
extends z.output<typeof breakfastPackageSchema> {}
export interface BreakfastProps {
packages: BreakfastPackages | null
packages: BreakfastPackages
}

View File

@@ -6,6 +6,14 @@ import type { SafeUser } from "@/types/user"
export type DetailsSchema = z.output<typeof guestDetailsSchema>
type MemberPrice = { price: number; currency: string }
export interface DetailsProps {
user: SafeUser
memberPrice?: MemberPrice
}
export type JoinScandicFriendsCardProps = {
name: string
memberPrice?: MemberPrice
}

View File

@@ -1,9 +1,4 @@
export enum StepEnum {
selectBed = "select-bed",
breakfast = "breakfast",
details = "details",
payment = "payment",
}
import { StepEnum } from "@/types/enums/step"
export const StepStoreKeys: Record<StepEnum, "bedType" | "breakfast" | null> = {
"select-bed": "bedType",

View File

@@ -1,3 +0,0 @@
import { StepEnum } from "./step"
export type EnterDetailsProviderProps = { step: StepEnum; isMember: boolean }

View File

@@ -0,0 +1,6 @@
import type { RoomsData } from "./bookingData"
export interface SummaryProps {
showMemberPrice: boolean
room: RoomsData
}

View File

@@ -4,7 +4,5 @@ export type AvailabilityInput = {
roomStayEndDate: string
adults: number
children?: string
promotionCode?: string
reservationProfileType?: string
attachedProfileId?: string
bookingCode?: string
}

View File

@@ -0,0 +1,5 @@
import { CategorizedFilters } from "./hotelFilters"
export type FilterAndSortModalProps = {
filters: CategorizedFilters
}

View File

@@ -0,0 +1,6 @@
export type FilterCheckboxProps = {
name: string
id: string
isSelected: boolean
onChange: (filterId: string) => void
}

View File

@@ -1,5 +1,6 @@
import type { HotelsAvailabilityPrices } from "@/server/routers/hotels/output"
import type { ProductType } from "@/server/routers/hotels/output"
export type HotelPriceListProps = {
price: HotelsAvailabilityPrices
price: ProductType
hotelId: string
}

View File

@@ -1,4 +1,4 @@
import { HotelsAvailabilityPrices } from "@/server/routers/hotels/output"
import { ProductType } from "@/server/routers/hotels/output"
import { Hotel } from "@/types/hotel"
@@ -16,5 +16,5 @@ export type HotelCardListingProps = {
export type HotelData = {
hotelData: Hotel
price: HotelsAvailabilityPrices
price: ProductType
}

View File

@@ -6,6 +6,7 @@ export type CategorizedFilters = {
}
export type HotelFiltersProps = {
filters: CategorizedFilters
className?: string
}
export type Filter = {
@@ -15,3 +16,7 @@ export type Filter = {
sortOrder: number
filter?: string
}
export type HotelFilterModalProps = {
filters: CategorizedFilters
}

View File

@@ -9,3 +9,7 @@ export type SortItem = {
label: string
value: string
}
export type HotelSorterProps = {
discreet?: boolean
}

View File

@@ -6,7 +6,7 @@ import {
} from "@/server/routers/hotels/schemas/image"
import { HotelData } from "./hotelCardListingProps"
import { Filter } from "./hotelFilters"
import { CategorizedFilters, Filter } from "./hotelFilters"
import type { Coordinates } from "@/types/components/maps/coordinates"
@@ -21,6 +21,7 @@ export interface SelectHotelMapProps {
hotelPins: HotelPin[]
mapId: string
hotels: HotelData[]
filterList: CategorizedFilters
}
type ImageSizes = z.infer<typeof imageSizesSchema>
@@ -29,8 +30,8 @@ type ImageMetaData = z.infer<typeof imageMetaDataSchema>
export type HotelPin = {
name: string
coordinates: Coordinates
publicPrice: string | null
memberPrice: string | null
publicPrice: number | null
memberPrice: number | null
currency: string | null
images: {
imageSizes: ImageSizes

View File

@@ -1,5 +1,6 @@
import { ProductTypePrices } from "@/server/routers/hotels/output"
export type PriceCardProps = {
currency: string
memberAmount?: string | undefined
regularAmount?: string | undefined
productTypePrices: ProductTypePrices
isMemberPrice?: boolean
}

View File

@@ -1,5 +0,0 @@
import type { PopoverProps } from "react-aria-components"
export interface PricePopoverProps extends Omit<PopoverProps, "children"> {
children: React.ReactNode
}

View File

@@ -1,19 +1,22 @@
import { z } from "zod"
import {
getRoomPackagesSchema,
packagesSchema,
} from "@/server/routers/hotels/output"
import { packagesSchema } from "@/server/routers/hotels/output"
export enum RoomPackageCodeEnum {
PET_ROOM = "PETR",
ALLERGY_ROOM = "ALLG",
ACCESSIBILITY_ROOM = "ACCE",
}
export interface DefaultFilterOptions {
code: RoomPackageCodeEnum
description: string
itemCode: string | undefined
}
export interface RoomFilterProps {
numberOfRooms: number
onFilter: (filter: Record<string, boolean | undefined>) => void
filterOptions: RoomPackageData
filterOptions: DefaultFilterOptions[]
}
export type RoomPackage = z.output<typeof packagesSchema>

View File

@@ -8,7 +8,7 @@ export interface RoomSelectionProps {
roomsAvailability: RoomsAvailability
roomCategories: RoomData[]
user: SafeUser
packages: RoomPackageData | undefined
availablePackages: RoomPackageData | undefined
selectedPackages: RoomPackageCodes[]
setRateSummary: (rateSummary: Rate) => void
rateSummary: Rate | null
@@ -18,5 +18,5 @@ export interface SelectRateProps {
roomsAvailability: RoomsAvailability
roomCategories: RoomData[]
user: SafeUser
packages: RoomPackageData
availablePackages: RoomPackageData
}

View File

@@ -28,7 +28,7 @@ export interface BreakfastSelectionProps extends SectionProps {
export interface DetailsProps extends SectionProps {}
export interface PaymentProps {
roomPrice: number
roomPrice: { publicPrice: number; memberPrice: number | undefined }
otherPaymentOptions: string[]
savedCreditCards: CreditCard[] | null
mustBeGuaranteed: boolean

View File

@@ -1,4 +1,4 @@
import { StepEnum } from "../enterDetails/step"
import { StepEnum } from "@/types/enums/step"
export interface SectionAccordionProps {
header: string

View File

@@ -2,14 +2,11 @@ import { poiVariants } from "@/components/Maps/Markers/Poi/variants"
import type { VariantProps } from "class-variance-authority"
import {
PointOfInterestCategoryNameEnum,
PointOfInterestGroupEnum,
} from "@/types/hotel"
import type { PointOfInterestGroupEnum } from "@/types/hotel"
export interface PoiMarkerProps extends VariantProps<typeof poiVariants> {
group: PointOfInterestGroupEnum
categoryName?: PointOfInterestCategoryNameEnum
categoryName?: string
size?: number
className?: string
}

View File

@@ -130,3 +130,4 @@ export type TrackingPosition =
| "hamburger menu"
| "join scandic friends sidebar"
| "sign up verification"
| "enter details"

View File

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

3
types/contexts/steps.ts Normal file
View File

@@ -0,0 +1,3 @@
import { createStepsStore } from "@/stores/steps"
export type StepsStore = ReturnType<typeof createStepsStore>

View File

@@ -1,5 +1,4 @@
export enum BreakfastPackageEnum {
FREE_MEMBER_BREAKFAST = "BRF0",
REGULAR_BREAKFAST = "BRF1",
NO_BREAKFAST = "NO_BREAKFAST",
}

6
types/enums/step.ts Normal file
View File

@@ -0,0 +1,6 @@
export enum StepEnum {
selectBed = "select-bed",
breakfast = "breakfast",
details = "details",
payment = "payment",
}

View File

@@ -26,26 +26,6 @@ export type GalleryImage = z.infer<typeof imageSchema>
export type PointOfInterest = z.output<typeof pointOfInterestSchema>
export enum PointOfInterestCategoryNameEnum {
AIRPORT = "Airport",
AMUSEMENT_PARK = "Amusement park",
BUS_TERMINAL = "Bus terminal",
FAIR = "Fair",
HOSPITAL = "Hospital",
HOTEL = "Hotel",
MARKETING_CITY = "Marketing city",
MUSEUM = "Museum",
NEARBY_COMPANIES = "Nearby companies",
PARKING_GARAGE = "Parking / Garage",
RESTAURANT = "Restaurant",
SHOPPING = "Shopping",
SPORTS = "Sports",
THEATRE = "Theatre",
TOURIST = "Tourist",
TRANSPORTATIONS = "Transportations",
ZOO = "Zoo",
}
export enum PointOfInterestGroupEnum {
PUBLIC_TRANSPORT = "Public transport",
ATTRACTIONS = "Attractions",

View File

@@ -0,0 +1,3 @@
export interface DetailsProviderProps extends React.PropsWithChildren {
isMember: boolean
}

11
types/providers/steps.ts Normal file
View File

@@ -0,0 +1,11 @@
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
}

40
types/stores/details.ts Normal file
View File

@@ -0,0 +1,40 @@
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
updateValidity: (property: StepEnum, isValid: boolean) => 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
price: number
}
export interface TotalPrice {
euro: Price | undefined
local: Price
}

10
types/stores/steps.ts Normal file
View File

@@ -0,0 +1,10 @@
import { StepEnum } from "@/types/enums/step"
export interface StepState {
completeStep: () => void
navigate: (step: StepEnum) => void
setStep: (step: StepEnum) => void
currentStep: StepEnum
steps: StepEnum[]
}

1
types/window.d.ts vendored
View File

@@ -13,4 +13,5 @@ interface Window {
}
}
Cookiebot: { changed: boolean; consented: boolean }
ApplePaySession: (() => void) | undefined
}