From 5e55b60807e99df5104fba65f661ee8f37faf77c Mon Sep 17 00:00:00 2001 From: Christian Andolf Date: Mon, 7 Apr 2025 14:26:13 +0200 Subject: [PATCH] fix: add new feature flag for surprises --- apps/scandic-web/.env.local.example | 3 ++- apps/scandic-web/.env.test | 1 + apps/scandic-web/components/MyPages/Surprises/index.tsx | 2 +- apps/scandic-web/env/server.ts | 8 ++++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 722d38bc1..4a2278a48 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -57,6 +57,7 @@ NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE="false" ENABLE_BOOKING_FLOW="false" ENABLE_BOOKING_WIDGET="false" ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH="false" +ENABLE_SURPRISES="true" SHOW_SITE_WIDE_ALERT="false" SHOW_SIGNUP_FLOW="true" @@ -68,4 +69,4 @@ SAS_POINT_TRANSFER_ENABLED="true" SAS_API_ENDPOINT="" SAS_AUTH_ENDPOINT="" SAS_OCP_APIM="" -SAS_AUTH_CLIENTID="" \ No newline at end of file +SAS_AUTH_CLIENTID="" diff --git a/apps/scandic-web/.env.test b/apps/scandic-web/.env.test index 701ac3ae2..aecfa89f9 100644 --- a/apps/scandic-web/.env.test +++ b/apps/scandic-web/.env.test @@ -49,6 +49,7 @@ TZ=UTC ENABLE_BOOKING_FLOW="false" ENABLE_BOOKING_WIDGET="false" ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH="false" +ENABLE_SURPRISES="true" SHOW_SITE_WIDE_ALERT="false" NEXT_PUBLIC_SENTRY_ENVIRONMENT="test" diff --git a/apps/scandic-web/components/MyPages/Surprises/index.tsx b/apps/scandic-web/components/MyPages/Surprises/index.tsx index 466cdff87..a8c28b16b 100644 --- a/apps/scandic-web/components/MyPages/Surprises/index.tsx +++ b/apps/scandic-web/components/MyPages/Surprises/index.tsx @@ -4,7 +4,7 @@ import { serverClient } from "@/lib/trpc/server" import SurprisesClient from "./Client" export default async function Surprises() { - if (env.HIDE_FOR_NEXT_RELEASE) { + if (!env.ENABLE_SURPRISES) { return null } diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index 9cef31d3b..b82d34fd9 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -134,6 +134,13 @@ export const env = createEnv({ // transform to boolean .transform((s) => s === "true") .default("true"), + ENABLE_SURPRISES: z + .string() + // only allow "true" or "false" + .refine((s) => s === "true" || s === "false") + // transform to boolean + .transform((s) => s === "true") + .default("false"), SHOW_SITE_WIDE_ALERT: z .string() // only allow "true" or "false" @@ -266,6 +273,7 @@ export const env = createEnv({ ENABLE_BOOKING_WIDGET: process.env.ENABLE_BOOKING_WIDGET, ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH: process.env.ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH, + ENABLE_SURPRISES: process.env.ENABLE_SURPRISES, SHOW_SITE_WIDE_ALERT: process.env.SHOW_SITE_WIDE_ALERT, SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, SENTRY_SERVER_SAMPLERATE: process.env.SENTRY_SERVER_SAMPLERATE,