Skip to content

Commit

Permalink
prevent fides init with unsupported component types
Browse files Browse the repository at this point in the history
  • Loading branch information
eastandwestwind committed Mar 14, 2024
1 parent 9d56521 commit ce28d12
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions clients/admin-ui/src/features/privacy-experience/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ const Preview = ({
baseConfig.options.fidesLocale = values.translations[0].language;
}
baseConfig.options.preventDismissal = !values.dismissable;
if (window.Fides && values.privacy_notice_ids?.length) {
if (
window.Fides &&
values.privacy_notice_ids?.length &&
values.component !== ComponentType.PRIVACY_CENTER &&
values.component !== ComponentType.TCF_OVERLAY
) {
window.Fides.init(baseConfig);
}
}, [values, translation, baseConfig, allPrivacyNotices]);
Expand Down Expand Up @@ -264,7 +269,12 @@ const Preview = ({
id="fides-js-base"
src={fidesJsScript}
onReady={() => {
window.Fides?.init(baseConfig);
if (
values.component !== ComponentType.TCF_OVERLAY &&
values.component !== ComponentType.PRIVACY_CENTER
) {
window.Fides?.init(baseConfig);
}
}}
/>
<div id="preview-container" />
Expand Down

0 comments on commit ce28d12

Please sign in to comment.