Skip to content

Conversation

@gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Nov 13, 2025

Ticket ENG-1889

Description Of Changes

Add support for GPC-adaptive text templates in privacy experiences, allowing different text to be displayed based on whether Global Privacy Control (GPC) is detected.

Code Changes

  • Added gpc-utils.ts with conditional text processing logic using template markers (__GPC_START__, __GPC_END__, __NO_GPC_START__, __NO_GPC_END__)
  • Updated ConsentBanner.tsx and Overlay.tsx to process GPC conditionals in banner and modal text
  • Added GPC preview toggle in Admin UI experience editor to test different GPC states
  • Renamed "GPC conditional" button option to "GPC adaptive" for clarity
  • Added comprehensive unit tests for GPC text processing
  • Added Cypress E2E test for GPC toggle functionality

Steps to Confirm

  1. In Admin UI, create or edit a privacy experience (Banner and modal or TCF overlay)
  2. Edit experience text to include GPC template markers (e.g., "We value your privacy. __GPC_START__Your GPC signal has been detected.__GPC_END__")
  3. Use the GPC preview toggle to verify text adapts correctly when GPC is enabled/disabled

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
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • 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:

@vercel
Copy link

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Nov 17, 2025 8:06pm
fides-privacy-center Ignored Ignored Nov 17, 2025 8:06pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 13, 2025

Greptile Overview

Greptile Summary

This PR implements GPC-adaptive text templates in privacy experiences, allowing different text to be displayed based on whether Global Privacy Control is detected. The implementation is clean and well-tested, with comprehensive unit tests and E2E coverage.

Key Changes:

  • Added gpc-utils.ts module with processGpcConditionals() function to handle template markers (__GPC_START__, __GPC_END__, __NO_GPC_START__, __NO_GPC_END__)
  • Integrated GPC conditional processing into ConsentBanner.tsx and Overlay.tsx components
  • Added GPC preview toggle in Admin UI to test different GPC states without changing browser settings
  • Renamed terminology from "GPC conditional" to "GPC adaptive" for clarity
  • Comprehensive test coverage including edge cases and multiline text scenarios

Implementation Quality:

  • The regex-based text processing is efficient and handles edge cases well (empty strings, multiline text, adjacent blocks, HTML preservation)
  • The preview toggle correctly syncs with URL query parameters and respects browser-level GPC settings
  • The getConsentContext() integration ensures consistent GPC detection across the application
  • All components follow existing patterns and maintain consistency with the codebase

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-architected with clean separation of concerns, comprehensive test coverage (both unit and E2E), and follows existing codebase patterns. The regex-based text processing is sound, edge cases are properly handled, and the preview functionality integrates seamlessly with the existing consent context system. No security vulnerabilities, logic errors, or performance concerns were identified.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
clients/fides-js/src/lib/gpc-utils.ts 5/5 New utility module for processing GPC conditional text markers with proper error handling and edge cases covered
clients/fides-js/tests/lib/gpc-utils.test.ts 5/5 Comprehensive test coverage for GPC text processing including edge cases, multiline text, and HTML preservation
clients/fides-js/src/components/ConsentBanner.tsx 5/5 Integrated GPC conditional processing for banner title and description text
clients/fides-js/src/components/Overlay.tsx 5/5 Integrated GPC conditional processing for modal title and description text using consent context
clients/admin-ui/src/features/privacy-experience/ConfigurePrivacyExperience.tsx 5/5 Added GPC preview toggle switch with browser GPC detection and URL query parameter synchronization

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

10 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@gilluminate gilluminate force-pushed the gill/ENG-1889/gpc-template-support branch 3 times, most recently from 751159e to 2ba2fa9 Compare November 14, 2025 19:33
@gilluminate gilluminate force-pushed the gill/ENG-1889/gpc-template-support branch from 2ba2fa9 to 330c823 Compare November 17, 2025 19:25
@gilluminate gilluminate force-pushed the gill/ENG-1889/gpc-template-support branch from 9586096 to e2d52da Compare November 17, 2025 19:40
@gilluminate gilluminate requested a review from jpople November 17, 2025 19:41
Copy link
Contributor

@jpople jpople 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 the fix on the whitespace issue. Working as expected for me now!

@gilluminate gilluminate added this pull request to the merge queue Nov 17, 2025
Merged via the queue into main with commit 70121b3 Nov 17, 2025
47 checks passed
@gilluminate gilluminate deleted the gill/ENG-1889/gpc-template-support branch November 17, 2025 20:38
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.

3 participants