-
Notifications
You must be signed in to change notification settings - Fork 84
Read automated consent sources synchronously before FidesInitialized fires #7222
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
base: main
Are you sure you want to change the base?
Read automated consent sources synchronously before FidesInitialized fires #7222
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
01d35fb to
11cb907
Compare
…d saveAutomatedPreferencesToApi
Minimal TCF experience combines consent and legitimate interest purposes in tcf_purpose_names. Full experience separates them into tcf_purpose_consents and tcf_purpose_legitimate_interests. Code only used consent array from full experience, causing banner to show different counts depending on load timing.
11cb907 to
06440ce
Compare
Greptile SummaryThis PR successfully refactors the automated consent flow to read all sources (GPC, migrated consent, notice consent strings) synchronously before the Key improvements:
Priority handling is correct:
The implementation maintains separation of concerns, follows existing patterns, and includes good test coverage. Confidence Score: 5/5
Important Files Changed
|
Ticket ENG-2135
Description Of Changes
Read all automated consent sources (GPC, migrated consent from third-party providers, and notice consent strings) synchronously during initialization before the
FidesInitializedevent fires. This ensures that when Fides broadcasts that consent is ready to be read, all automated consent has been fully evaluated and applied.Key changes:
getAutomatedConsentContext()to read all automated consent sources synchronously at the start of initializationcalculateAutomatedConsent()as a pure function that computes consent from the automated contextFidesInitializedfiresCode Changes
consent-context.tsgetAutomatedConsentContext()to gather GPC, migrated consent, and notice consent strings earlycalculateAutomatedConsent) and API persistence (saveAutomatedPreferencesToApi) inautomated-consent.tsinitialize.tsto calculate and apply automated consent before updating cookie/experience and firing eventsbuildConsentPreferencesArray()utility inshared-consent-utils.tsto reduce duplicationfides.ts,fides-headless.ts,fides-tcf.ts) to use the new automated consent flowFidesInitializedfiresSteps to Confirm
Create an experience with the following Notices:
By default, when loading the demo page, the Consent JSON should look like:
Test GPC Automated Consent (Chrome/Non-GPC browsers)
?globalPrivacyControl=truequery parameter)window.Fides.consentcontains the GPC opt-out values (false) as soon asFidesInitializedfiresPATCHto/privacy-preferencewithmethod: "gpc"preference: "opt_out"for GPC-flagged noticesmethod: "accept"for the manual interactionTest Notice Consent String (fidesString)
fides_stringcookie with notice consent encoded (e.g.,",,,eyJhbmFseXRpY3MiOjEsImRhdGFfc2FsZXNfYW5kX3NoYXJpbmciOjEsIm1hcmtldGluZyI6MX0=")window.Fides.consentand the browser cookie contain the decoded consent valuesPATCHto/privacy-preferencewithmethod: "script"Test Migrated Consent (OneTrust → Fides)
otFidesMappingto map OneTrust groups to Fides noticeswindow.Fides.consentcontains the migrated OneTrust valuesfalse(eg. essential)PATCHwith the migrated consent method (e.g.,"onetrust")Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works