From 1eb70766b488de6711a8b87bb08ad48a7c9f5f54 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Mon, 3 Nov 2025 07:57:39 +0000 Subject: [PATCH] Merged in feat/sw-3580-redemption-feature-flag (pull request #3045) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(SW-3580): Add feature toggle enableRedemption to BookingFlowConfig * Add feature toggle enableRedemption to BookingFlowConfig * Update error message Approved-by: Joakim Jäderberg --- apps/partner-sas/constants/bookingFlowConfig.ts | 3 +++ apps/partner-sas/env/server.ts | 6 ++++++ apps/scandic-web/constants/bookingFlowConfig.ts | 1 + .../lib/bookingFlowConfig/bookingFlowConfig.tsx | 1 + .../BookingWidgetForm/FormContent/RewardNight/index.tsx | 2 ++ packages/booking-flow/lib/pages/EnterDetailsPage.tsx | 9 +++++++++ 6 files changed, 22 insertions(+) diff --git a/apps/partner-sas/constants/bookingFlowConfig.ts b/apps/partner-sas/constants/bookingFlowConfig.ts index fb21881cd..8ddb2f6b7 100644 --- a/apps/partner-sas/constants/bookingFlowConfig.ts +++ b/apps/partner-sas/constants/bookingFlowConfig.ts @@ -4,12 +4,15 @@ import { membershipTermsAndConditions } from "@scandic-hotels/common/constants/r import { myStay } from "@scandic-hotels/common/constants/routes/myStay" import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes" +import { env } from "@/env/server" + import type { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlowConfig" import type { Lang } from "@scandic-hotels/common/constants/language" import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const bookingFlowConfig: BookingFlowConfig = { bookingCodeEnabled: false, + redemptionEnabled: env.REDEMPTION_ENABLED === true, enterDetailsMembershipIdInputLocation: "join-card", variant: "partner-sas", routes: { diff --git a/apps/partner-sas/env/server.ts b/apps/partner-sas/env/server.ts index 110736035..2dd490b4d 100644 --- a/apps/partner-sas/env/server.ts +++ b/apps/partner-sas/env/server.ts @@ -30,6 +30,11 @@ export const env = createEnv({ IRON_SESSION_SECRET: z.string().min(32), CURITY_ISSUER_USER: z.string(), CURITY_CLIENT_SECRET_USER: z.string(), + REDEMPTION_ENABLED: z + .string() + .refine((s) => s === "true" || s === "false") + .transform((s) => s === "true") + .default("false"), }, emptyStringAsUndefined: true, runtimeEnv: { @@ -44,5 +49,6 @@ export const env = createEnv({ SAS_AUTH_ENDPOINT: process.env.SAS_AUTH_ENDPOINT, SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, SENTRY_SERVER_SAMPLERATE: process.env.SENTRY_SERVER_SAMPLERATE, + REDEMPTION_ENABLED: process.env.REDEMPTION_ENABLED, }, }) diff --git a/apps/scandic-web/constants/bookingFlowConfig.ts b/apps/scandic-web/constants/bookingFlowConfig.ts index 16330ca7d..54b20da58 100644 --- a/apps/scandic-web/constants/bookingFlowConfig.ts +++ b/apps/scandic-web/constants/bookingFlowConfig.ts @@ -8,6 +8,7 @@ import type { BookingFlowConfig } from "@scandic-hotels/booking-flow/BookingFlow export const bookingFlowConfig: BookingFlowConfig = { bookingCodeEnabled: true, + redemptionEnabled: true, enterDetailsMembershipIdInputLocation: "form", variant: "scandic", routes: { diff --git a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx index 848e0514d..a56b60fae 100644 --- a/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx +++ b/packages/booking-flow/lib/bookingFlowConfig/bookingFlowConfig.tsx @@ -10,6 +10,7 @@ import type { BookingFlowVariant } from "./bookingFlowVariants" export type BookingFlowConfig = { bookingCodeEnabled: boolean + redemptionEnabled: boolean enterDetailsMembershipIdInputLocation: "form" | "join-card" variant: BookingFlowVariant routes: { diff --git a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/RewardNight/index.tsx b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/RewardNight/index.tsx index 25d1b2cd3..364ca6c11 100644 --- a/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/RewardNight/index.tsx +++ b/packages/booking-flow/lib/components/BookingWidget/BookingWidgetForm/FormContent/RewardNight/index.tsx @@ -79,6 +79,8 @@ export default function RewardNight() { } }, [resetOnMultiroomError, ref]) + if (!config.redemptionEnabled) return null + return (
closeOnBlur(e.nativeEvent)}>