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:
@@ -10,6 +10,7 @@ import type { BookingFlowVariant } from "./bookingFlowVariants"
|
||||
|
||||
export type BookingFlowConfig = {
|
||||
bookingCodeEnabled: boolean
|
||||
redemptionEnabled: boolean
|
||||
enterDetailsMembershipIdInputLocation: "form" | "join-card"
|
||||
variant: BookingFlowVariant
|
||||
routes: {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user