diff --git a/.env b/.env index 24a522ca..4d366e72 100644 --- a/.env +++ b/.env @@ -4,7 +4,8 @@ NEXT_PUBLIC_BASE_URL=https://klz-cables.com UMAMI_API_ENDPOINT=https://analytics.infra.mintel.me SENTRY_DSN=https://c10957d0182245b1a2a806ac2d34a197@errors.infra.mintel.me/1 LOG_LEVEL=info -NEXT_PUBLIC_FEEDBACK_ENABLED=true +NEXT_PUBLIC_FEEDBACK_ENABLED=false +NEXT_PUBLIC_RECORD_MODE_ENABLED=false # SMTP Configuration MAIL_HOST=smtp.eu.mailgun.org diff --git a/.env.example b/.env.example index 21aa6f64..c6e998e8 100644 --- a/.env.example +++ b/.env.example @@ -15,6 +15,7 @@ DIRECTUS_PORT=8055 # NEXT_PUBLIC_TARGET makes this information available to the frontend TARGET=development NEXT_PUBLIC_FEEDBACK_ENABLED=false +NEXT_PUBLIC_RECORD_MODE_ENABLED=true # ──────────────────────────────────────────────────────────────────────────── # Analytics (Umami) diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 0cfef71b..0deeafc5 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -51,7 +51,6 @@ export default async function LocaleLayout({ }) { const { locale } = await params; - // Ensure locale is a valid string, fallback to 'en' const supportedLocales = ['en', 'de']; const localeStr = (typeof locale === 'string' ? locale : '').trim(); const safeLocale = supportedLocales.includes(localeStr) ? localeStr : 'en'; @@ -66,12 +65,9 @@ export default async function LocaleLayout({ messages = {}; } - // Track pageview on the server with high-fidelity header context const { getServerAppServices } = await import('@/lib/services/create-services.server'); const serverServices = getServerAppServices(); - // We wrap this in a try-catch to allow static rendering during build - // headers() and cookies() force dynamic rendering in Next.js try { const { headers } = await import('next/headers'); const requestHeaders = await headers(); @@ -85,10 +81,8 @@ export default async function LocaleLayout({ }); } - // Track initial server-side pageview serverServices.analytics.trackPageview(); } catch { - // Falls back to noop or client-side only during static generation if (process.env.NODE_ENV !== 'production' || !process.env.CI) { console.warn( '[Layout] Static generation detected or headers unavailable, skipping server-side analytics context', @@ -96,38 +90,29 @@ export default async function LocaleLayout({ } } + // Read directly from process.env — bypasses all abstraction to guarantee correctness + const recordModeEnabled = process.env.NEXT_PUBLIC_RECORD_MODE_ENABLED === 'true'; + const feedbackEnabled = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true'; + return ( -