refactor: url management in hotel reservation flow

This commit is contained in:
Christel Westerberg
2025-01-13 14:26:38 +01:00
parent 23ff0970e9
commit b2935114e3
48 changed files with 407 additions and 418 deletions

View File

@@ -8,15 +8,13 @@ import { arrayMerge } from "@/utils/merge"
import { detailsStorageName } from "."
import type { BookingData } from "@/types/components/hotelReservation/enterDetails/bookingData"
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
import { CurrencyEnum } from "@/types/enums/currency"
import type { StepEnum } from "@/types/enums/step"
import type {
DetailsState,
PersistedState,
PersistedStatePart,
Price,
RoomPrice,
RoomRate,
} from "@/types/stores/enter-details"
import type { SafeUser } from "@/types/user"
@@ -55,7 +53,10 @@ export function navigate(step: StepEnum, searchParams: string) {
window.history.pushState({ step }, "", `${step}?${searchParams}`)
}
export function checkIsSameRoom(prev: BookingData, next: BookingData) {
export function checkIsSameRoom(
prev: SelectRateSearchParams,
next: SelectRateSearchParams
) {
const { rooms: prevRooms, ...prevBooking } = prev
const prevRoomsWithoutRateCodes = prevRooms.map(

View File

@@ -29,7 +29,7 @@ jest.mock("@/lib/api", () => ({
}))
const booking = {
hotel: "123",
hotelId: "123",
fromDate: "2100-01-01",
toDate: "2100-01-02",
rooms: [