Skip to content

Allow OT migration to auto write to fides preferences api#6099

Merged
eastandwestwind merged 7 commits intomainfrom
LJ-722
May 2, 2025
Merged

Allow OT migration to auto write to fides preferences api#6099
eastandwestwind merged 7 commits intomainfrom
LJ-722

Conversation

@eastandwestwind
Copy link
Copy Markdown
Contributor

Closes https://ethyca.atlassian.net/browse/LJ-722

Description Of Changes

Allow OT migration to auto write to fides preferences api

Code Changes

  • Adds code to automatically write to consent prefs api when we have OT consent
  • Adds test assertions

Steps to Confirm

  1. In fides-js-demo, uncomment out the window.fides_overrides declaration. Add a new field, ot_fides_mapping that will hold your OT -> fides mappings.
    Example core data:
{
    C0001: ["essential"],
    C0002: ["analytics"],
    C0004: ["advertising", "marketing"],
  }

To prep this, you'll need to JSON.stringify, then URL-encode it.
Here's my resulting fides_overrides obj:

window.fides_overrides = {
          fides_embed: true,
          ot_fides_mapping: "%7B%22C0001%22%3A%5B%22essential%22%5D%2C%22C0002%22%3A%5B%22analytics%22%5D%2C%22C0004%22%3A%5B%22advertising%22%2C%22marketing%22%5D%7D"
        };
  1. Manually add the OT cookie to your browser. Below where you set the overrides, you'll need to set:
document.cookie =
             "OptanonConsent=isGpcEnabled=0&datestamp=Fri+Mar+07+2025+19%3A51%3A06+GMT%2B0100+(Central+European+Standard+Time)&version=202409.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&consentId=f9c105b8-48e3-401a-87e9-363ad1f77531&interactionCount=1&isAnonUser=1&landingPath=NotLandingPage&groups=C0003%3A1%2CC0002%3A1%2CC0004%3A1%2CC0005%3A0%2CC0001%3A1%2CC0009%3A0%2CV2STACK42%3A0&AwaitingReconsent=false";

Look at the groups param. Take that value and url-decode it. These groups map to either 0 (opted out) or 1 (opted in).
4. Based on our onetrust consent cookie and our mappings, we should see the essential / analytics / advertising / marketing notices opted-in by default, if they exist
5. We should see the fides_consent cookie written to the browser and consent vals should reflect the window.Fides.consent values. Note that the consent method in the cookie is "ot_migration"
6. We should see new entries in Consent Reporting in Admin UI for the "ot_migration" consent

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-plus-nightly ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 3:30pm
fides-privacy-center ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 3:30pm

Comment thread clients/fides-js/src/lib/consent-types.ts
Comment thread clients/fides-js/src/fides.ts
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate left a comment

Choose a reason for hiding this comment

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

Looks good and works in testing. Thanks for updating to make it more maintainable through better abstraction! reminder to add a CHANGELOG entry :)

@eastandwestwind eastandwestwind merged commit de79ae0 into main May 2, 2025
17 checks passed
@eastandwestwind eastandwestwind deleted the LJ-722 branch May 2, 2025 15:47
@cypress
Copy link
Copy Markdown

cypress Bot commented May 2, 2025

fides    Run #12892

Run Properties:  status check passed Passed #12892  •  git commit de79ae0500: Allow OT migration to auto write to fides preferences api (#6099)
Project fides
Branch Review main
Run status status check passed Passed #12892
Run duration 00m 56s
Commit git commit de79ae0500: Allow OT migration to auto write to fides preferences api (#6099)
Committer Catherine Smith
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5
View all changes introduced in this branch ↗︎

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