From b6b43c331882b7ce0b16bc4731a15175448ccc82 Mon Sep 17 00:00:00 2001 From: Rajiv Sahal Date: Fri, 23 Jan 2026 14:32:50 +0530 Subject: [PATCH] fix: BookerEmbed breaking (#27143) --- apps/web/modules/bookings/components/Booker.tsx | 4 +++- .../bookings/Booker/utils/isFeatureEnabledForVisitor.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/modules/bookings/components/Booker.tsx b/apps/web/modules/bookings/components/Booker.tsx index 2ba1e1dd83..6030309f0b 100644 --- a/apps/web/modules/bookings/components/Booker.tsx +++ b/apps/web/modules/bookings/components/Booker.tsx @@ -217,8 +217,10 @@ const BookerComponent = ({ ); // Cloudflare Turnstile Captcha + // Note: process.env may be undefined in embed contexts, so we safely check it + const isE2E = typeof process !== "undefined" && process.env?.NEXT_PUBLIC_IS_E2E; const shouldRenderCaptcha = !!( - !process.env.NEXT_PUBLIC_IS_E2E && + !isE2E && renderCaptcha && CLOUDFLARE_SITE_ID && CLOUDFLARE_USE_TURNSTILE_IN_BOOKER === "1" && diff --git a/packages/features/bookings/Booker/utils/isFeatureEnabledForVisitor.ts b/packages/features/bookings/Booker/utils/isFeatureEnabledForVisitor.ts index d7b576668d..79adcce099 100644 --- a/packages/features/bookings/Booker/utils/isFeatureEnabledForVisitor.ts +++ b/packages/features/bookings/Booker/utils/isFeatureEnabledForVisitor.ts @@ -3,9 +3,9 @@ import { getCookie } from "@calcom/lib/cookie"; /** * NOTE: Feature can be easily rolled back by setting percentage to 0 */ -export const isVisitorWithinPercentage = ({ percentage }: { percentage: number }) => { +export const isVisitorWithinPercentage = ({ percentage }: { percentage: number }): boolean => { // E2E tests must test all features regardless of their rollout percentage - if (process.env.NEXT_PUBLIC_IS_E2E) { + if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_IS_E2E) { return true; }