Merged in fix/SW-2553-sidepeeks (pull request #1919)

Fix/SW-2553 sidepeeks

* fix(SW-2553): apply sidepeek display logic

* chore: move convertToChildType and getPriceType utils

* fix: apply PR requested changes

* fix(SW-2553): fix roomNumber for multiroom

* fix(SW-2553): fix sidepeek for my-stay page


Approved-by: Michael Zetterberg
Approved-by: Bianca Widstam
Approved-by: Matilda Landström
This commit is contained in:
Arvid Norlin
2025-05-02 15:10:34 +00:00
committed by Bianca Widstam
parent f5f9aba2e5
commit 0c7836fa59
33 changed files with 881 additions and 510 deletions

View File

@@ -1,20 +0,0 @@
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
const bedTypeToMapEnum: Record<string, ChildBedMapEnum> = {
Crib: ChildBedMapEnum.IN_CRIB,
ExtraBed: ChildBedMapEnum.IN_EXTRA_BED,
ParentsBed: ChildBedMapEnum.IN_ADULTS_BED,
Unknown: ChildBedMapEnum.UNKNOWN,
}
export function convertToChildType(
childrenAges: number[],
childBedPreferences: BookingConfirmation["booking"]["childBedPreferences"]
): Child[] {
return childBedPreferences.map((preference, index) => ({
age: childrenAges[index],
bed: bedTypeToMapEnum[preference.bedType] ?? ChildBedMapEnum.UNKNOWN,
}))
}

View File

@@ -1,12 +0,0 @@
import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
export function getPriceType(
cheques: number,
points: number,
vouchers: number
): PriceTypeEnum {
if (points > 0) return PriceTypeEnum.points
if (vouchers > 0) return PriceTypeEnum.voucher
if (cheques > 0) return PriceTypeEnum.cheque
return PriceTypeEnum.money
}

View File

@@ -1,9 +1,10 @@
import { BookingStatusEnum, CancellationRuleEnum } from "@/constants/booking"
import { dt } from "@/lib/dt"
import { convertToChildType } from "@/components/HotelReservation/utils/convertToChildType"
import { getPriceType } from "@/components/HotelReservation/utils/getPriceType"
import { formatChildBedPreferences } from "../utils"
import { convertToChildType } from "./convertToChildType"
import { getPriceType } from "./getPriceType"
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"