Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate vendor legal basis #4216

Conversation

allisonking
Copy link
Contributor

@allisonking allisonking commented Oct 3, 2023

Closes #4209
Partially addresses #4210

Description Of Changes

Whew ok this is kind of a big one! The backend API had significant changes in order to add legal basis as another dimension. Purposes, Vendors, and Systems all have this new dimension. Whereas before, our experience object looked like

{
  ...
  tcf_purposes: [...],
  tcf_vendors: [...],
  tcf_systems: [...],
}

it now looks like

{
  ...
  tcf_consent_purposes: [...],
  tcf_legitimate_interests_purposes: [...],
  tcf_consent_vendors: [...],
  tcf_legitimate_interests_vendors: [...],
  tcf_consent_systems: [...],
  tcf_legitimate_interests_systems: [...],
  
  tcf_vendor_relationships: [...],
  tcf_system_relationships: [...]
}

In other words, we have a lot more fields to work with! the *relationships fields are to deal with fields that the vendor/system fields have in common, in order not to repeat too much in the payload. More context about that here.

At the same time, the FE had gone ahead and implemented double vendor toggles, saving only to the TC string. Now that the backend can save it, we can get rid of some tech debt code 💥

Code Changes

  • Update TS types in both admin-ui and fides-js
  • Add EEA to human readable regions
  • Delete various files we don't need anymore (CookieTable (never used) and LegalBasisDropdown (no longer needed))
  • Refactor vendors/systems throughout to handle legal basis coming from the backend
  • Lots of refactoring to make purposes also handle a legal basis dimension
  • Update cypress tests (this is a big diff because the payload data changed so much)

Steps to Confirm

  • Set up your TCF environment
  • Add various purposes of either purpose or legitimate interest types. Add them to different vendors
  • Load the privacy center and visit /fides-js-demo.html?geolocation=fi-18. You should see the prefetched experience in the HTML. this should have all the new fields
  • Make sure everything still works
  • The one thing that won't work is you won't be able to change Legitimate Interest Purposes individually yet (opting in or out of all will work). We need to add the second toggle to that tab to do so, but I split that out into a separate ticket

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Issue Requirements are Met
  • Update CHANGELOG.md

@allisonking allisonking changed the base branch from main to fidesplus_1128_legal_basis_dimension October 3, 2023 17:31
@cypress
Copy link

cypress bot commented Oct 3, 2023

Passing run #4509 ↗︎

0 4 0 0 Flakiness 0

Details:

Merge a8db91c into 7fece59...
Project: fides Commit: 67ca0712f8 ℹ️
Status: Passed Duration: 01:12 💡
Started: Oct 6, 2023 8:56 PM Ended: Oct 6, 2023 8:57 PM

Review all test suite changes for PR #4216 ↗︎

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (4aae6e0) 87.70% compared to head (eb4051c) 87.70%.
Report is 1 commits behind head on fidesplus_1128_legal_basis_dimension.

Additional details and impacted files
@@                          Coverage Diff                          @@
##           fidesplus_1128_legal_basis_dimension    #4216   +/-   ##
=====================================================================
  Coverage                                 87.70%   87.70%           
=====================================================================
  Files                                       333      333           
  Lines                                     20814    20819    +5     
  Branches                                   2697     2698    +1     
=====================================================================
+ Hits                                      18254    18259    +5     
  Misses                                     2095     2095           
  Partials                                    465      465           

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tcf_special_features: experienceSpecialFeatures = [],
} = experience;

const uniquePurposeIds = useMemo(() => {
Copy link
Contributor Author

@allisonking allisonking Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we now have two fields: tcf_consent_purposes and tcf_legitimate_interests_purposes which can overlap! this means, if we only want one instance of a purpose, we need to dedupe. Stacks don't care if a purpose is consent or legint, so we combine them for this file.

} = experience;

const vendorsAndSystems = [...(vendors || []), ...(systems || [])];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the bulk of the tech debt I removed 🧹

};
}) => (
<div>
<PurposeBlock
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we are only rendering consent purposes—legint will follow in #4210

vendors,
LegalBasisForProcessingEnum.LEGITIMATE_INTERESTS
).length;
const consent = consentSystems.length + consentVendors.length;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

counting also got much easier with the backend update 👍

@@ -5,6 +5,16 @@ import type {
UserConsentPreference,
} from "../consent-types";

export enum LegalBasisForProcessingEnum {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are mostly all copied from the updated admin-ui types. I rearranged them a bit in the file to make more intuitive sense (hopefully)

return (
hasApplicablePurposes?.length || hasApplicableSpecialPurposes?.length
);
const transformVendorDataToVendorRecords = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is one of the larger changes in this PR. basically the vendor tab wants both vendors and systems together. on top of that, it also wants it combined across legal basis. this function returns a type that makes that easy

@allisonking allisonking marked this pull request as ready for review October 4, 2023 22:27
Copy link
Contributor

@eastandwestwind eastandwestwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for walking through this one with me on screenshare @allisonking !

[vendor],
LegalBasisForProcessingEnum.LEGITIMATE_INTERESTS
).length === 1;
experience.gvl?.dataCategories;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎆

@allisonking
Copy link
Contributor Author

Updated a bunch of types after PR review changes to 8933d7d

@allisonking allisonking merged commit e03bca0 into fidesplus_1128_legal_basis_dimension Oct 6, 2023
7 checks passed
@allisonking allisonking deleted the aking/4209/integrate-vendor-legal-basis branch October 6, 2023 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants