From f19d5fa0831edd550e67a74eca6d4d18f4d9edd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matilda=20Landstr=C3=B6m?= Date: Wed, 3 Dec 2025 08:41:33 +0000 Subject: [PATCH] Merged in fix/handle-unpublished-profiling-consent (pull request #3275) fix: handle unpublished profiling consent * fix: handle unpublished profiling consent Approved-by: Emma Zettervall Approved-by: Chuma Mcphoy (We Ahead) --- apps/scandic-web/.env.local.example | 1 - .../MyPages/ProfilingConsent/Banner/index.tsx | 2 +- .../contentstack/profilingConsent/output.ts | 1 + packages/trpc/lib/types/profilingConsent.ts | 17 +++++++++++------ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 981bcdb1c..69e92563e 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -39,7 +39,6 @@ GOOGLE_STATIC_MAP_ID="" GOOGLE_DYNAMIC_MAP_ID="" ENABLE_SURPRISES="true" -ENABLE_DTMC="true" SAS_POINT_TRANSFER_ENABLED="true" SAS_API_ENDPOINT="" diff --git a/apps/scandic-web/components/MyPages/ProfilingConsent/Banner/index.tsx b/apps/scandic-web/components/MyPages/ProfilingConsent/Banner/index.tsx index dc2c729e4..f6ffd1399 100644 --- a/apps/scandic-web/components/MyPages/ProfilingConsent/Banner/index.tsx +++ b/apps/scandic-web/components/MyPages/ProfilingConsent/Banner/index.tsx @@ -12,7 +12,7 @@ export async function ProfilingConsentBanner() { if (!user || userHasConsent(user?.profilingConsent)) return null const data = await getProfilingConsent() - if (!data) return null + if (!data?.profiling_consent) return null const { icon, banner } = data.profiling_consent diff --git a/packages/trpc/lib/routers/contentstack/profilingConsent/output.ts b/packages/trpc/lib/routers/contentstack/profilingConsent/output.ts index 0df9d30d6..14c850d66 100644 --- a/packages/trpc/lib/routers/contentstack/profilingConsent/output.ts +++ b/packages/trpc/lib/routers/contentstack/profilingConsent/output.ts @@ -40,6 +40,7 @@ export const profilingConsentSchema = z }) .transform((data) => { const profiling_consent = data.all_profiling_consent.items[0] + if (!profiling_consent) return null return { icon: profiling_consent.main_icon, banner: profiling_consent.profiling_consent_banner, diff --git a/packages/trpc/lib/types/profilingConsent.ts b/packages/trpc/lib/types/profilingConsent.ts index 8cfdf9ba9..57fc872d0 100644 --- a/packages/trpc/lib/types/profilingConsent.ts +++ b/packages/trpc/lib/types/profilingConsent.ts @@ -2,12 +2,17 @@ import type { z } from "zod" import type { profilingConsentSchema } from "../routers/contentstack/profilingConsent/output" -export interface GetProfilingConsentData - extends z.input {} +export interface GetProfilingConsentData extends z.input< + typeof profilingConsentSchema +> {} -export interface ProfilingConsent - extends z.output {} +export type ProfilingConsent = z.output +export type ProfilingConsentNonNull = NonNullable -export type ProfilingConsentBanner = NonNullable +export type ProfilingConsentBanner = NonNullable< + ProfilingConsentNonNull["banner"] +> -export type ProfilingConsentModal = NonNullable +export type ProfilingConsentModal = NonNullable< + ProfilingConsentNonNull["modal"] +>