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

PROD-1983 Privacy Center custom paths for properties #4907

Conversation

lucanovera
Copy link
Contributor

@lucanovera lucanovera commented May 22, 2024

Description Of Changes

Update the privacy center to accept the new custom paths for properties. ie. myprivacycenter.com/mynewproperty. If a custom path was used, it will call the new "get property by path" plus endpoint and display the privacy center. It will also load the privacy center config & stylesheet from that specific property.

Code Changes

  • Added CUSTOM_PROPERTIES env variable (default to true) that enables this feature
  • Added new folder [customPropertyPath] to pages, that matches custom path routes
  • Check for [customPropertyPath], if it exists call the new plus endpoint to get property by path
  • If a property was found by path, save that property to the redux state and load custom config and stylesheet from that property
  • Added new BE models needed for the feature

Steps to reproduce

  • Create a property
  • Use the PUT /api/v1/plus/property/{property_id} api endpoint to update that property with the new fields with stylesheet, privacy_center_config and paths (it's not available in the ui at the moment)
  • Navigate to privacycenter using one of the paths you added to the property
  • You should see the privacy center home page loaded if it detected the correct property. The config and stylesheet should be loaded from the property fields.

Screenshots

Regular home path loads config and css as usual
Captura de pantalla 2024-05-22 a la(s) 3 58 27 p  m

New custom path loads config and css from the property itself. In this case I change it so that the texts say the word purple and the custom stylesheet overrides the body text color's to be purple as well.
Captura de pantalla 2024-05-22 a la(s) 3 58 18 p  m

Pre-Merge Checklist

Copy link

vercel bot commented May 22, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 4:39pm

@lucanovera lucanovera force-pushed the PROD-1983-Update-Privacy-Center-to-lookup-config-and-style-by-property branch from 08a204d to b68e21a Compare May 22, 2024 14:30
Copy link

cypress bot commented May 22, 2024

Passing run #7932 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge fe63d28 into 82ad1ff...
Project: fides Commit: de141eff3d ℹ️
Status: Passed Duration: 00:33 💡
Started: May 24, 2024 2:45 PM Ended: May 24, 2024 2:45 PM

Review all test suite changes for PR #4907 ↗︎

@lucanovera lucanovera changed the title WIP: PROD-1983 Privacy Center custom paths for properties PROD-1983 Privacy Center custom paths for properties May 22, 2024
Copy link
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.

Looking good overall, just one update requested to reduce complexity

Comment on lines +20 to +23
if (process.env.NODE_ENV === "development") {
// eslint-disable-next-line no-console
console.log("Loading Privacy Center property into Redux store...");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth creating a debugLog util for privacy center like fides-js has. Not necessary before merge, just a suggestion for future reference.

clients/privacy-center/app/server-environment.ts Outdated Show resolved Hide resolved
clients/privacy-center/pages/api/fides-js.ts Outdated Show resolved Hide resolved
…Privacy-Center-to-lookup-config-and-style-by-property
Copy link
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.

Thanks for updating! Looks good.

@lucanovera lucanovera merged commit 463ea2e into main May 24, 2024
12 checks passed
@lucanovera lucanovera deleted the PROD-1983-Update-Privacy-Center-to-lookup-config-and-style-by-property branch May 24, 2024 16:47
lucanovera added a commit that referenced this pull request May 24, 2024
@cypress cypress bot mentioned this pull request May 24, 2024
31 tasks
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