Skip to content

Commit

Permalink
Merge 593b7c8 into 306202e
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate authored Nov 8, 2024
2 parents 306202e + 593b7c8 commit 52d6a24
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The types of changes are:

## [Unreleased](https://github.com/ethyca/fidesplus/compare/2.49.0...main)

### Added
- Added support for GPP national string to be used alongside state-by-state using a new approach option [#5480](https://github.com/ethyca/fides/pull/5480)


## [2.49.0](https://github.com/ethyca/fidesplus/compare/2.48.2...2.49.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ const GppConfiguration = () => {
tooltip:
"When state-by-state is selected, Fides will only present consent to consumers and save their preferences if they are located in a state that is supported by the GPP. The consent options presented to consumers will vary depending on the regulations in each state.",
},
{
label: "Enable US National and State-by-State notices",
value: GPPUSApproach.ALL,
tooltip:
"When enabled, Fides can be configured to serve the National and U.S. state notices. This mode is intended to provide consent coverage to U.S. states with new privacy laws where GPP support lags behind the effective date of state laws.",
},
]}
/>
</Section>
Expand Down
1 change: 1 addition & 0 deletions clients/admin-ui/src/pages/settings/consent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ const ConsentConfigPage: NextPage = () => {
disabled={!dirty || !isValid}
loading={isSubmitting}
data-testid="save-btn"
className="self-start"
>
Save
</Button>
Expand Down
1 change: 1 addition & 0 deletions clients/admin-ui/src/types/api/models/GPPUSApproach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
export enum GPPUSApproach {
NATIONAL = "national",
STATE = "state",
ALL = "all",
}
112 changes: 112 additions & 0 deletions clients/fides-js/__tests__/lib/gpp/us-notices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,4 +681,116 @@ describe("setGppOptOutsFromCookieAndExperience", () => {
expect(cmpApi.getSection("usnatv1")).toBe(null);
expect(cmpApi.getSection("usnyv1")).toBe(null);
});

it("can use US gpp fields when gpp is set to all", () => {
const cmpApi = new CmpApi(1, 1);
const cookie = mockFidesCookie({
consent: {
data_sales_and_sharing: false,
targeted_advertising: false,
sensitive_personal_data_sharing: false,
known_child_sensitive_data_consents: false,
personal_data_consents: false,
},
});
const notices = [
DATA_SALES_SHARING_NOTICE,
TARGETED_ADVERTISING_NOTICE,
SENSITIVE_PERSONAL_SHARING_NOTICE,
KNOWN_CHILD_SENSITIVE_NOTICE,
PERSONAL_DATA_NOTICE,
];
const experience = mockPrivacyExperience({
region: "us_mt", // Set to a non-supported state
privacy_notices: notices,
gpp_settings: {
enabled: true,
us_approach: GPPUSApproach.ALL, // Set to all
mspa_covered_transactions: true,
mspa_opt_out_option_mode: true,
mspa_service_provider_mode: false,
enable_tcfeu_string: true,
},
});
setGppOptOutsFromCookieAndExperience({
cmpApi,
cookie,
experience,
});
const section = cmpApi.getSection("usnatv1");
expect(section).toEqual({
Version: 1,
SharingNotice: 0,
SaleOptOutNotice: 0,
SharingOptOutNotice: 0,
TargetedAdvertisingOptOutNotice: 0,
SensitiveDataProcessingOptOutNotice: 0,
SensitiveDataLimitUseNotice: 0,
SaleOptOut: 1,
SharingOptOut: 1,
TargetedAdvertisingOptOut: 1,
SensitiveDataProcessing: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
KnownChildSensitiveDataConsents: [1, 1],
PersonalDataConsents: 1,
MspaCoveredTransaction: 1,
MspaOptOutOptionMode: 1,
MspaServiceProviderMode: 2,
GpcSegmentType: 1,
Gpc: false,
});
expect(cmpApi.getGppString()).toEqual("DBABLA~BAAVVVVVVWA.QA");
});

it("can use state gpp fields when gpp is set to all", () => {
const cmpApi = new CmpApi(1, 1);
const cookie = mockFidesCookie({
consent: {
data_sales_and_sharing: false,
targeted_advertising: false,
sensitive_personal_data_sharing: false,
known_child_sensitive_data_consents: false,
personal_data_consents: false,
},
});
const notices = [
DATA_SALES_SHARING_NOTICE,
TARGETED_ADVERTISING_NOTICE,
SENSITIVE_PERSONAL_SHARING_NOTICE,
KNOWN_CHILD_SENSITIVE_NOTICE,
PERSONAL_DATA_NOTICE,
];
const experience = mockPrivacyExperience({
region: "us_ut", // Set to a supported state
privacy_notices: notices,
gpp_settings: {
enabled: true,
us_approach: GPPUSApproach.ALL, // Set to all
mspa_covered_transactions: true,
mspa_opt_out_option_mode: true,
mspa_service_provider_mode: false,
enable_tcfeu_string: true,
},
});
setGppOptOutsFromCookieAndExperience({
cmpApi,
cookie,
experience,
});
const section = cmpApi.getSection("usutv1");
expect(section).toEqual({
Version: 1,
SharingNotice: 0,
SaleOptOutNotice: 0,
TargetedAdvertisingOptOutNotice: 0,
SensitiveDataProcessingOptOutNotice: 0,
SaleOptOut: 0,
TargetedAdvertisingOptOut: 0,
SensitiveDataProcessing: [0, 0, 0, 0, 0, 0, 0, 0],
KnownChildSensitiveDataConsents: 0,
MspaCoveredTransaction: 1,
MspaOptOutOptionMode: 1,
MspaServiceProviderMode: 2,
});
expect(cmpApi.getGppString()).toEqual("DBABFg~BAAAAAWA");
});
});
13 changes: 11 additions & 2 deletions clients/fides-js/src/fides-ext-gpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,19 @@ const getSupportedApis = () => {
if (window.Fides.options.tcfEnabled && gppSettings.enable_tcfeu_string) {
supportedApis.push(`${TcfEuV2.ID}:${TcfEuV2.NAME}`);
}
if (gppSettings.us_approach === GPPUSApproach.NATIONAL) {
fidesDebugger("GPP settings", gppSettings);
if (
gppSettings.us_approach === GPPUSApproach.NATIONAL ||
gppSettings.us_approach === GPPUSApproach.ALL
) {
fidesDebugger("setting US National");
supportedApis.push(`${UsNatV1.ID}:${UsNatV1.NAME}`);
}
if (gppSettings.us_approach === GPPUSApproach.STATE) {
if (
gppSettings.us_approach === GPPUSApproach.STATE ||
gppSettings.us_approach === GPPUSApproach.ALL
) {
fidesDebugger("setting US State");
// TODO: include the states based off of locations/regulations.
// For now, hard code all of them. https://ethyca.atlassian.net/browse/PROD-1595
[UsCaV1, UsCoV1, UsCtV1, UsUtV1, UsVaV1].forEach((state) => {
Expand Down
1 change: 1 addition & 0 deletions clients/fides-js/src/lib/gpp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type GppFunction = (
export enum GPPUSApproach {
NATIONAL = "national",
STATE = "state",
ALL = "all",
}

export type GPPSettings = {
Expand Down
20 changes: 16 additions & 4 deletions clients/fides-js/src/lib/gpp/us-notices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,17 @@ export const setGppNoticesProvidedFromExperience = ({
gpp_settings: gppSettings,
} = experience;
const usApproach = gppSettings?.us_approach;
const gppRegion = deriveGppFieldRegion({
let gppRegion = deriveGppFieldRegion({
experienceRegion,
usApproach,
});
const gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];
let gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];

if (!gppSection && usApproach === GPPUSApproach.ALL) {
// if we're using the "all" approach, and the user's state isn't supported yet, we should default to national.
gppRegion = US_NATIONAL_REGION;
gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];
}

if (
!gppSection ||
Expand Down Expand Up @@ -142,11 +148,17 @@ export const setGppOptOutsFromCookieAndExperience = ({
gpp_settings: gppSettings,
} = experience;
const usApproach = gppSettings?.us_approach;
const gppRegion = deriveGppFieldRegion({
let gppRegion = deriveGppFieldRegion({
experienceRegion,
usApproach,
});
const gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];
let gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];

if (!gppSection && usApproach === GPPUSApproach.ALL) {
// if we're using the all approach, and the current state isn't supported, we should default to national
gppRegion = US_NATIONAL_REGION;
gppSection = FIDES_REGION_TO_GPP_SECTION[gppRegion];
}

if (
!gppSection ||
Expand Down
1 change: 1 addition & 0 deletions clients/privacy-center/types/api/models/GPPUSApproach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
export enum GPPUSApproach {
NATIONAL = "national",
STATE = "state",
ALL = "all",
}

0 comments on commit 52d6a24

Please sign in to comment.