diff --git a/CHANGELOG.md b/CHANGELOG.md index 6149f587ea..c7ea8b7574 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ The types of changes are: - Redact cli, database, and redis configuration information from GET api/v1/config API request responses. [#4379](https://github.com/ethyca/fides/pull/4379) - Button ordering in fides.js UI [#4407](https://github.com/ethyca/fides/pull/4407) - Add different classnames to consent buttons for easier selection [#4411](https://github.com/ethyca/fides/pull/4411) +- Updates default consent preference to opt-out for TCF when fides_string exists [#4430](https://github.com/ethyca/fides/pull/4430) ### Fixed - Persist bulk system add filter modal state [#4412](https://github.com/ethyca/fides/pull/4412) diff --git a/clients/fides-js/src/lib/cookie.ts b/clients/fides-js/src/lib/cookie.ts index 72ac927c4b..7345640f29 100644 --- a/clients/fides-js/src/lib/cookie.ts +++ b/clients/fides-js/src/lib/cookie.ts @@ -311,13 +311,18 @@ export const buildTcfEntitiesFromCookie = ( const cookieConsent = cookie.tcf_consent[cookieKey] ?? {}; // @ts-ignore the array map should ensure we will get the right record type tcfEntities[experienceKey] = experience[experienceKey]?.map((item) => { + const defaultPreference = cookie.fides_string + ? ConsentMechanism.OPT_OUT + : item.default_preference; const preference = Object.hasOwn(cookieConsent, item.id) ? transformConsentToFidesUserPreference( Boolean(cookieConsent[item.id]), ConsentMechanism.OPT_IN ) - : // if experience contains a tcf entity not defined by tcfEntities, we override experience current pref with the default pref - item.default_preference; + : // If experience contains a tcf entity not defined by tcfEntities, this means: + // A) If fides_string exists, user has probably opted out. Since opt-outs are not tracked by TC string, in this case we assume opt-out. + // B) There is a new tcf entity that requires consent. In this case we would use the default on the experience. + defaultPreference; return { ...item, current_preference: preference }; }); }); diff --git a/clients/privacy-center/cypress/e2e/consent-banner-tcf.cy.ts b/clients/privacy-center/cypress/e2e/consent-banner-tcf.cy.ts index d8da84ef1e..e7cfebdad3 100644 --- a/clients/privacy-center/cypress/e2e/consent-banner-tcf.cy.ts +++ b/clients/privacy-center/cypress/e2e/consent-banner-tcf.cy.ts @@ -1634,14 +1634,14 @@ describe("Fides-js TCF", () => { }); cy.getByTestId(`toggle-${PURPOSE_9.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is false + // it should use false as the default cy.get("input").should("not.be.checked"); }); cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${PURPOSE_2.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true - cy.get("input").should("be.checked"); + // it should use false as the default + cy.get("input").should("not.be.checked"); }); // Features cy.get("#fides-tab-Features").click(); @@ -1650,7 +1650,7 @@ describe("Fides-js TCF", () => { }); // Vendors // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true + // it should use false as the default cy.get("#fides-tab-Vendors").click(); cy.getByTestId(`toggle-${VENDOR_1.name}`).within(() => { cy.get("input").should("not.be.checked"); @@ -1658,7 +1658,7 @@ describe("Fides-js TCF", () => { cy.get("#fides-panel-Vendors").within(() => { cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => { - cy.get("input").should("be.checked"); + cy.get("input").should("not.be.checked"); }); }); @@ -1729,14 +1729,14 @@ describe("Fides-js TCF", () => { }); cy.getByTestId(`toggle-${PURPOSE_9.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is false + // it should use false as the default cy.get("input").should("not.be.checked"); }); cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${PURPOSE_2.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true - cy.get("input").should("be.checked"); + // it should use false as the default + cy.get("input").should("not.be.checked"); }); // Features cy.get("#fides-tab-Features").click(); @@ -1745,7 +1745,7 @@ describe("Fides-js TCF", () => { }); // Vendors // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true + // it should use false as the default cy.get("#fides-tab-Vendors").click(); cy.getByTestId(`toggle-${VENDOR_1.name}`).within(() => { cy.get("input").should("not.be.checked"); @@ -1753,7 +1753,7 @@ describe("Fides-js TCF", () => { cy.get("#fides-panel-Vendors").within(() => { cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => { - cy.get("input").should("be.checked"); + cy.get("input").should("not.be.checked"); }); }); @@ -1865,14 +1865,14 @@ describe("Fides-js TCF", () => { }); cy.getByTestId(`toggle-${PURPOSE_9.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is false + // it should use false as the default cy.get("input").should("not.be.checked"); }); cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${PURPOSE_2.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true - cy.get("input").should("be.checked"); + // it should use false as the default + cy.get("input").should("not.be.checked"); }); // Features cy.get("#fides-tab-Features").click(); @@ -1881,7 +1881,7 @@ describe("Fides-js TCF", () => { }); // Vendors // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true + // it should use false as the default cy.get("#fides-tab-Vendors").click(); cy.getByTestId(`toggle-${VENDOR_1.name}`).within(() => { cy.get("input").should("not.be.checked"); @@ -1889,7 +1889,7 @@ describe("Fides-js TCF", () => { cy.get("#fides-panel-Vendors").within(() => { cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => { - cy.get("input").should("be.checked"); + cy.get("input").should("not.be.checked"); }); }); @@ -2047,14 +2047,14 @@ describe("Fides-js TCF", () => { }); cy.getByTestId(`toggle-${PURPOSE_9.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is false + // it should use false as the default cy.get("input").should("not.be.checked"); }); cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${PURPOSE_2.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true - cy.get("input").should("be.checked"); + // it should use false as the default + cy.get("input").should("not.be.checked"); }); // Features cy.get("#fides-tab-Features").click(); @@ -2070,9 +2070,9 @@ describe("Fides-js TCF", () => { cy.get("button").contains("Legitimate interest").click(); }); // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true + // it should use false as the default cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => { - cy.get("input").should("be.checked"); + cy.get("input").should("not.be.checked"); }); // verify CMP API @@ -2166,14 +2166,14 @@ describe("Fides-js TCF", () => { }); cy.getByTestId(`toggle-${PURPOSE_9.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is false + // it should use false as the default cy.get("input").should("not.be.checked"); }); cy.get("button").contains("Legitimate interest").click(); cy.getByTestId(`toggle-${PURPOSE_2.name}`).within(() => { // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true - cy.get("input").should("be.checked"); + // it should use false as the default + cy.get("input").should("not.be.checked"); }); // Features cy.get("#fides-tab-Features").click(); @@ -2182,7 +2182,7 @@ describe("Fides-js TCF", () => { }); // Vendors // this purpose is set to true in the experience, but since it was not defined in the fides_string, - // it should use the default preference set in the experience which is true + // it should use false as the default cy.get("#fides-tab-Vendors").click(); cy.getByTestId(`toggle-${VENDOR_1.name}`).within(() => { cy.get("input").should("not.be.checked"); @@ -2191,7 +2191,7 @@ describe("Fides-js TCF", () => { cy.get("button").contains("Legitimate interest").click(); }); cy.getByTestId(`toggle-${SYSTEM_1.name}`).within(() => { - cy.get("input").should("be.checked"); + cy.get("input").should("not.be.checked"); }); // verify CMP API