Merged in feature/select-rate-vertical-data-flow (pull request #2535)

Feature/select rate vertical data flow

* add fix from SW-2666

* use translations for room packages

* move types to it's own file

* Merge branch 'master' of bitbucket.org:scandic-swap/web into feature/select-rate-vertical-data-flow

* merge

* feature/select-rate: double rate for campaing rates

* revert NODE_ENV check in Cookiebot script

* revert testing values

* fix(SW-3171): fix all filter selected in price details

* fix(SW-3166): multiroom anchoring when changing filter

* fix(SW-3172): check hotelType, show correct breakfast message

* Merge branch 'feature/select-rate-vertical-data-flow' of bitbucket.org:scandic-swap/web into feature/select-rate-vertical-data-flow

* fix: show special needs icons for subsequent roomTypes SW-3167

* fix: Display strike through text when logged in SW-3168

* fix: Reinstate the scrollToView behaviour when selecting a rate SW-3169

* merge

* .

* PR fixes

* fix: don't return notFound()

* .

* always include defaults for room packages

* merge

* merge

* merge

* Remove floating h1 for new select-rate


Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-08-13 12:45:40 +00:00
parent 706f2d8dfe
commit 68cd061c6d
126 changed files with 8751 additions and 315 deletions

View File

@@ -9,7 +9,10 @@ import { FormProvider, useForm } from "react-hook-form"
import { useIntl } from "react-intl"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import { bookingConfirmation,selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import {
bookingConfirmation,
selectRate,
} from "@scandic-hotels/common/constants/routes/hotelReservation"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { logger } from "@scandic-hotels/common/logger"
import Body from "@scandic-hotels/design-system/Body"

View File

@@ -33,7 +33,7 @@ export default function SelectedRoom() {
function changeRoom() {
const searchParams = new URLSearchParams(searchParamsStr)
searchParams.set("modifyRateIndex", `${idx}`)
searchParams.set("activeRoomIndex", `${idx}`)
startTransition(() => {
router.push(`${selectRate(lang)}?${searchParams.toString()}`)
})

View File

@@ -1,218 +0,0 @@
// import { describe, expect, test } from "@jest/globals"
// import { act, cleanup, render, screen, within } from "@testing-library/react"
// import { type IntlConfig, IntlProvider } from "react-intl"
// import { Lang } from "@scandic-hotels/common/constants/language"
// import {
// bedType,
// booking,
// breakfastPackage,
// guestDetailsMember,
// guestDetailsNonMember,
// roomPrice,
// roomRate,
// } from "@/__mocks__/hotelReservation"
// import { initIntl } from "@/i18n"
// import SummaryUI from "./UI"
// import type { PropsWithChildren } from "react"
// import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
// import { StepEnum } from "@/types/enums/step"
// import type { RoomState } from "@/types/stores/enter-details"
// jest.mock("@/lib/api", () => ({
// fetchRetry: jest.fn((fn) => fn),
// }))
// function createWrapper(intlConfig: IntlConfig) {
// return function Wrapper({ children }: PropsWithChildren) {
// return (
// <IntlProvider
// messages={intlConfig.messages}
// locale={intlConfig.locale}
// defaultLocale={intlConfig.defaultLocale}
// >
// {children}
// </IntlProvider>
// )
// }
// }
// const rooms: RoomState[] = [
// {
// currentStep: StepEnum.selectBed,
// isComplete: false,
// room: {
// adults: 2,
// bedType: {
// description: bedType.queen.description,
// roomTypeCode: bedType.queen.value,
// },
// bedTypes: [],
// breakfast: breakfastPackage,
// breakfastIncluded: false,
// cancellationRule: "",
// cancellationText: "Non-refundable",
// childrenInRoom: [{ bed: ChildBedMapEnum.IN_EXTRA_BED, age: 5 }],
// guest: guestDetailsNonMember,
// rateDetails: [],
// roomFeatures: [],
// roomPrice: roomPrice,
// roomRate: roomRate,
// roomType: "Standard",
// roomTypeCode: "QS",
// isAvailable: true,
// mustBeGuaranteed: false,
// isFlexRate: false,
// specialRequest: {
// comment: "",
// },
// },
// steps: {
// [StepEnum.selectBed]: {
// step: StepEnum.selectBed,
// isValid: false,
// },
// [StepEnum.breakfast]: {
// step: StepEnum.breakfast,
// isValid: false,
// },
// [StepEnum.details]: {
// step: StepEnum.details,
// isValid: false,
// },
// },
// },
// {
// currentStep: StepEnum.selectBed,
// isComplete: false,
// room: {
// adults: 1,
// bedType: {
// description: bedType.king.description,
// roomTypeCode: bedType.king.value,
// },
// bedTypes: [],
// breakfast: undefined,
// breakfastIncluded: false,
// cancellationText: "Non-refundable",
// childrenInRoom: [],
// guest: guestDetailsMember,
// rateDetails: [],
// roomFeatures: [],
// roomPrice: roomPrice,
// roomRate: roomRate,
// roomType: "Standard",
// roomTypeCode: "QS",
// isAvailable: true,
// mustBeGuaranteed: false,
// isFlexRate: false,
// specialRequest: {
// comment: "",
// },
// },
// steps: {
// [StepEnum.selectBed]: {
// step: StepEnum.selectBed,
// isValid: false,
// },
// [StepEnum.breakfast]: {
// step: StepEnum.breakfast,
// isValid: false,
// },
// [StepEnum.details]: {
// step: StepEnum.details,
// isValid: false,
// },
// },
// },
// ]
// describe("EnterDetails Summary", () => {
// afterEach(() => {
// cleanup()
// })
// test("render with single room correctly", async () => {
// const intl = await initIntl(Lang.en)
// await act(async () => {
// render(
// <SummaryUI
// booking={booking}
// rooms={rooms.slice(0, 1)}
// isMember={false}
// totalPrice={{
// requested: {
// currency: "EUR",
// price: 133,
// },
// local: {
// currency: "SEK",
// price: 1500,
// },
// }}
// vat={12}
// toggleSummaryOpen={jest.fn()}
// />,
// {
// wrapper: createWrapper(intl),
// }
// )
// })
// screen.getByText("2 adults, 1 child")
// screen.getByText("Standard")
// screen.getByText("1,525 SEK")
// screen.getByText(bedType.queen.description)
// screen.getByText("Breakfast buffet")
// screen.getByText("1,500 SEK")
// screen.getByTestId("signup-promo-desktop")
// })
// test("render with multiple rooms correctly", async () => {
// const intl = await initIntl(Lang.en)
// await act(async () => {
// render(
// <SummaryUI
// booking={booking}
// rooms={rooms}
// isMember={false}
// totalPrice={{
// requested: {
// currency: "EUR",
// price: 133,
// },
// local: {
// currency: "SEK",
// price: 1500,
// },
// }}
// vat={12}
// toggleSummaryOpen={jest.fn()}
// />,
// {
// wrapper: createWrapper(intl),
// }
// )
// })
// const room1 = within(screen.getByTestId("summary-room-1"))
// room1.getByText("Standard")
// room1.getByText("2 adults, 1 child")
// room1.getByText(bedType.queen.description)
// room1.getByText("Breakfast buffet")
// const room2 = within(screen.getByTestId("summary-room-2"))
// room2.getByText("Standard")
// room2.getByText("1 adult")
// const room2Breakfast = room2.queryByText("Breakfast buffet")
// expect(room2Breakfast).not.toBeInTheDocument()
// room2.getByText(bedType.king.description)
// })
// })