Merged in feat/sw-3580-redemption-feature-flag (pull request #3045)

feat(SW-3580): Add feature toggle enableRedemption to BookingFlowConfig

* Add feature toggle enableRedemption to BookingFlowConfig

* Update error message


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-11-03 07:57:39 +00:00
parent b2398dba4a
commit 1eb70766b4
6 changed files with 22 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import type { BookingFlowVariant } from "./bookingFlowVariants"
export type BookingFlowConfig = {
bookingCodeEnabled: boolean
redemptionEnabled: boolean
enterDetailsMembershipIdInputLocation: "form" | "join-card"
variant: BookingFlowVariant
routes: {

View File

@@ -79,6 +79,8 @@ export default function RewardNight() {
}
}, [resetOnMultiroomError, ref])
if (!config.redemptionEnabled) return null
return (
<div ref={ref} onBlur={(e) => closeOnBlur(e.nativeEvent)}>
<Checkbox

View File

@@ -3,6 +3,7 @@ import { notFound } from "next/navigation"
import { Suspense } from "react"
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
import { BookingFlowConfig } from "../bookingFlowConfig/bookingFlowConfig"
import HotelHeader from "../components/EnterDetails/Header"
@@ -44,6 +45,14 @@ export async function EnterDetailsPage({
if (!booking) return notFound()
// This should never happen unless a user tampers with the URL
if (
!config.redemptionEnabled &&
booking.searchType === SEARCH_TYPE_REDEMPTION
) {
throw new Error("Redemptions are disabled")
}
if (selectRoomParams.has("activeRoomIndex")) {
selectRoomParams.delete("activeRoomIndex")
}