Merged in feat/SW-1719-strikethrough-rates (pull request #2266)

Feat/SW-1719 strikethrough rates

* feat(SW-1719): Strikethrough rate if logged in on regular rate cards

* feat(SW-1719): Strikethrough rate if logged in on rate summary

* feat(SW-1719): Strikethrough rate if logged in on mobile rate summary

* feat(SW-1719): Strikethrough rate if logged in on enter details

* feat(SW-1719): Strikethrough rate support for multiple rooms

* feat(SW-1719): booking receipt fixes on confirmation page

* feat(SW-1719): improve initial total price calculation

* feat: harmonize enter details total price to use one and the same function


Approved-by: Michael Zetterberg
This commit is contained in:
Simon.Emanuelsson
2025-06-13 12:01:16 +00:00
committed by Michael Zetterberg
parent e1ede52014
commit 85acd3453d
52 changed files with 2403 additions and 1380 deletions

View File

@@ -5,9 +5,9 @@ import { useEffect, useRef, useState } from "react"
import { dt } from "@/lib/dt"
import { createDetailsStore } from "@/stores/enter-details"
import {
calcTotalPrice,
checkIsSameBooking as checkIsSameBooking,
clearSessionStorage,
getTotalPrice,
readFromSessionStorage,
writeToSessionStorage,
} from "@/stores/enter-details/helpers"
@@ -18,7 +18,6 @@ import LoadingSpinner from "@/components/LoadingSpinner"
import { DetailsContext } from "@/contexts/Details"
import type { DetailsStore } from "@/types/contexts/enter-details"
import { CurrencyEnum } from "@/types/enums/currency"
import { StepEnum } from "@/types/enums/step"
import type { DetailsProviderProps } from "@/types/providers/enter-details"
import type { InitialState, RoomState } from "@/types/stores/enter-details"
@@ -174,25 +173,8 @@ export default function EnterDetailsProvider({
const nights = dt(booking.toDate).diff(booking.fromDate, "days")
// We only extract the first room for its currency,
// the value is the same for the rest of the rooms
const product = filteredOutMissingRooms[0].room.roomRate
let currency = CurrencyEnum.Unknown
if ("corporateCheque" in product) {
currency = CurrencyEnum.CC
} else if ("redemption" in product) {
currency = CurrencyEnum.POINTS
} else if ("voucher" in product) {
currency = CurrencyEnum.Voucher
} else if ("public" in product && product.public) {
currency = product.public.localPrice.currency
} else if ("member" in product && product.member) {
currency = product.member.localPrice.currency
}
const totalPrice = calcTotalPrice(
filteredOutMissingRooms,
currency,
const totalPrice = getTotalPrice(
filteredOutMissingRooms.map((r) => r.room),
!!user,
nights
)