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

privacy-center: Introduce fides-consent script package #1756

Merged
merged 5 commits into from
Nov 16, 2022

Conversation

ssangervasi
Copy link
Contributor

@ssangervasi ssangervasi commented Nov 12, 2022

Closes #1395

Code Changes

  • Adds fides-consent.js, exposing the our cookie parsing logic in a browser script.
  • E2E tests the consent set->get flow using a standalone page.
  • The privacy center uses the same code from the module for its cookie logic.

Steps to Confirm

  • Build and test the script
    • npm install and npm run cy:start should put everything in place automatically
  • Try it in dev

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation Updated:
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md

Description Of Changes

Actually writing the script was easy, but figuring out a good build + test flow was quite interesting. I used rollup, just like we have in fidesui. Next.js wouldn't let me use <script> tag with a static asset, so for testing I created a static HTML page that is simply served as-is. This is probably better for isolation anyway.

@ssangervasi ssangervasi force-pushed the ssangervasi/fides-1395/consent-cookie-scripts branch 3 times, most recently from ecc1618 to 832d4ca Compare November 12, 2022 03:41
@ssangervasi ssangervasi force-pushed the ssangervasi/privacy-center-cypress branch from d6a8a2b to c641d47 Compare November 14, 2022 19:56
@ssangervasi ssangervasi force-pushed the ssangervasi/fides-1395/consent-cookie-scripts branch from 832d4ca to 145e29c Compare November 14, 2022 19:57
Base automatically changed from ssangervasi/privacy-center-cypress to main November 14, 2022 20:32
@ssangervasi ssangervasi force-pushed the ssangervasi/fides-1395/consent-cookie-scripts branch 7 times, most recently from 518f182 to 12895be Compare November 15, 2022 01:40
@ssangervasi ssangervasi marked this pull request as ready for review November 15, 2022 01:49
@ssangervasi ssangervasi force-pushed the ssangervasi/fides-1395/consent-cookie-scripts branch 2 times, most recently from 18c6fad to 405a0ff Compare November 15, 2022 18:58
Copy link
Contributor

@LKCSmith LKCSmith left a comment

Choose a reason for hiding this comment

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

I think the code looks good, but I get a 404 page doesn't exist when trying to access http://localhost:3000/fides-consent-demo.html -- does a flag need to be active?

@ssangervasi
Copy link
Contributor Author

I think the code looks good, but I get a 404 page doesn't exist when trying to access http://localhost:3000/fides-consent-demo.html -- does a flag need to be active?

@LKCSmith - Running npm run dev from the privacy-center directory works for me. And npm run cy:start hosts a built version.

This change introduces a "packages" directory under the Privacy Center, which
will house code that is built to work with the PC's consent options outside
of the PC itself. The first such packages is the "tracking pixel script" which
is a small script exposes the users consent choices through a window global.
This config cannot be supported by the browser script.
@ssangervasi ssangervasi force-pushed the ssangervasi/fides-1395/consent-cookie-scripts branch from 405a0ff to c98ada9 Compare November 16, 2022 23:24
@ssangervasi ssangervasi merged commit 9882ff1 into main Nov 16, 2022
@ssangervasi ssangervasi deleted the ssangervasi/fides-1395/consent-cookie-scripts branch November 16, 2022 23:45
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.

Expose Fides Consent Cookie for Browser Integrations - Client side Javascript
2 participants