From b7cc7662ce58e915f897088fcd388f5cbc1dcacf Mon Sep 17 00:00:00 2001 From: Jason Gill Date: Thu, 26 Sep 2024 11:16:34 -0600 Subject: [PATCH] Include overrides when loading full experience (#5333) --- CHANGELOG.md | 1 + clients/fides-js/src/components/tcf/TcfOverlay.tsx | 3 ++- clients/fides-js/src/components/types.ts | 2 ++ clients/fides-js/src/lib/initOverlay.ts | 2 ++ clients/fides-js/src/lib/initialize.ts | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f0bf029e..d3c6b24d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The types of changes are: - Fix issue with fides-js where the experience was incorrectly initialized as an empty object which appeared valid, when `undefined` was expected [#5309](https://github.com/ethyca/fides/pull/5309) - Fix issue where newly added languages in Admin-UI were not being rendered in the preview [#5316](https://github.com/ethyca/fides/pull/5316) - Fix bug where consent automation accordion shows for integrations that don't support consent automation [#5330](https://github.com/ethyca/fides/pull/5330) +- Fix issue where custom overrides (title, description, privacy policy url, etc.) were not being applied to the full TCF overlay [#5333](https://github.com/ethyca/fides/pull/5333) ### Added diff --git a/clients/fides-js/src/components/tcf/TcfOverlay.tsx b/clients/fides-js/src/components/tcf/TcfOverlay.tsx index 521a7c47c2..bb00db1980 100644 --- a/clients/fides-js/src/components/tcf/TcfOverlay.tsx +++ b/clients/fides-js/src/components/tcf/TcfOverlay.tsx @@ -56,6 +56,7 @@ export const TcfOverlay = ({ cookie, savedConsent, propertyId, + translationOverrides, }: TcfOverlayProps) => { const { i18n, @@ -144,7 +145,7 @@ export const TcfOverlay = ({ const fullExperience: PrivacyExperience = { ...result, ...userPrefs }; setExperience(fullExperience); - loadMessagesFromExperience(i18n, fullExperience); + loadMessagesFromExperience(i18n, fullExperience, translationOverrides); if (!userlocale || bestLocale === defaultLocale) { // English (default) GVL translations are part of the full experience, so we load them here. loadGVLMessagesFromExperience(i18n, fullExperience); diff --git a/clients/fides-js/src/components/types.ts b/clients/fides-js/src/components/types.ts index cc2e35f09b..1bffa1808b 100644 --- a/clients/fides-js/src/components/types.ts +++ b/clients/fides-js/src/components/types.ts @@ -1,5 +1,6 @@ import type { FidesCookie, + FidesExperienceTranslationOverrides, FidesInitOptions, NoticeConsent, PrivacyExperience, @@ -21,4 +22,5 @@ export interface OverlayProps { fidesRegionString: string; savedConsent: NoticeConsent; propertyId?: string; + translationOverrides?: Partial; } diff --git a/clients/fides-js/src/lib/initOverlay.ts b/clients/fides-js/src/lib/initOverlay.ts index ff46324f5d..7a7159dcae 100644 --- a/clients/fides-js/src/lib/initOverlay.ts +++ b/clients/fides-js/src/lib/initOverlay.ts @@ -29,6 +29,7 @@ export const initOverlay = async ({ savedConsent, renderOverlay, propertyId, + translationOverrides, }: OverlayProps & { renderOverlay: (props: OverlayProps, parent: ContainerNode) => void; }): Promise => { @@ -152,6 +153,7 @@ export const initOverlay = async ({ cookie, savedConsent, propertyId, + translationOverrides, }, parentElem, ); diff --git a/clients/fides-js/src/lib/initialize.ts b/clients/fides-js/src/lib/initialize.ts index cdcc9c3ed9..26456b9390 100644 --- a/clients/fides-js/src/lib/initialize.ts +++ b/clients/fides-js/src/lib/initialize.ts @@ -459,6 +459,7 @@ export const initialize = async ({ savedConsent: fides.saved_consent, renderOverlay, propertyId, + translationOverrides: overrides?.experienceTranslationOverrides, }).catch((e) => { debugLog(options.debug, e); });