Merged in fix/refactor-booking-flow-search-params (pull request #2148)
Fix: refactor booking flow search params * wip: apply codemod and upgrade swc plugin * wip: design-system to react 19, fix issues from async (search)params * Prepare new parse function for booking flow search params * Prepare serialize function for booking flow search params * Improve handling of comma separated arrays * Slightly refactor for readability * Next abstracts URLSearchParams so handle the abstraction instead * Refactor booking widget to use new search params parsing * Rename search param functions * Refactor select-hotel to use new search param parser * Use new search params parser in select-rate and details * Fix hotelId type * Avoid passing down search params into BookingWidget components * More updates to use new types instead of SearchParams<T> * Remove types SelectHotelSearchParams and AlternativeSelectHotelSearchParams * Fix parseBookingWidgetSearchParams return type * Add error handling to booking search param parsers * Fix modifyRateIndex handling in details page * Clean up * Refactor booking widget search param serializing to util function * Move start page booking widget search param parsing to page * Use new search param serializer in HandleErrorCallback * Delete convertSearchParamsToObj & convertObjToSearchParams Approved-by: Michael Zetterberg
This commit is contained in:
@@ -9,7 +9,7 @@ import { detailsStorageName } from "@/stores/enter-details"
|
||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||
import { trackPaymentEvent } from "@/utils/tracking"
|
||||
import { trackEvent } from "@/utils/tracking/base"
|
||||
import { convertObjToSearchParams } from "@/utils/url"
|
||||
import { serializeBookingSearchParams } from "@/utils/url"
|
||||
|
||||
import { clearGlaSessionStorage, readGlaFromSessionStorage } from "./helpers"
|
||||
|
||||
@@ -33,9 +33,11 @@ export default function HandleErrorCallback({
|
||||
|
||||
if (bookingData) {
|
||||
const detailsStorage: PersistedState = JSON.parse(bookingData)
|
||||
const searchParams = convertObjToSearchParams(
|
||||
const searchParams = serializeBookingSearchParams(
|
||||
detailsStorage.booking,
|
||||
searchObject
|
||||
{
|
||||
initialSearchParams: searchObject,
|
||||
}
|
||||
)
|
||||
|
||||
const glaSessionData = readGlaFromSessionStorage()
|
||||
|
||||
@@ -7,14 +7,13 @@ import { useSearchHistory } from "@/hooks/useSearchHistory"
|
||||
|
||||
import { getTracking } from "./tracking"
|
||||
|
||||
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { DetailsBooking } from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import type { Hotel } from "@/types/hotel"
|
||||
import type { Room } from "@/types/providers/details/room"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { SelectHotelParams } from "@/utils/url"
|
||||
|
||||
interface TrackingWrapperProps {
|
||||
booking: SelectHotelParams<SelectRateSearchParams>
|
||||
booking: DetailsBooking
|
||||
hotel: Hotel
|
||||
rooms: Room[]
|
||||
isMember: boolean
|
||||
|
||||
@@ -7,8 +7,8 @@ import { getSpecialRoomType } from "@/utils/specialRoomType"
|
||||
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast"
|
||||
import type { DetailsBooking } from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKAncillaries,
|
||||
@@ -25,10 +25,9 @@ import type {
|
||||
Product,
|
||||
} from "@/types/trpc/routers/hotel/roomAvailability"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { SelectHotelParams } from "@/utils/url"
|
||||
|
||||
export function getTracking(
|
||||
booking: SelectHotelParams<SelectRateSearchParams>,
|
||||
booking: DetailsBooking,
|
||||
hotel: Hotel,
|
||||
rooms: Room[],
|
||||
isMember: boolean,
|
||||
|
||||
Reference in New Issue
Block a user