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

Mobile Native POC support work #5541

Merged
merged 16 commits into from
Dec 3, 2024
Merged

Mobile Native POC support work #5541

merged 16 commits into from
Dec 3, 2024

Conversation

gilluminate
Copy link
Contributor

@gilluminate gilluminate commented Nov 25, 2024

Closes HJ-259

Description Of Changes

Includes prep-work needed to be done in Fides before the native POC can work as intended

  • New option override fides_consent_override which will automatically set the user’s consent preference.
  • New script consent method to distinguish between manual and automated consent.
  • Update Cookie House sample app to be mobile friendly
  • Other minor house-keeping with Cookie House to keep it up to date with React and Next versions.

Steps to Confirm

  1. Visit Cookie House on a mobile sized screen and ensure it looks decent
  2. Visit the Cookie House in a location where a banner would normally appear with a query param that tells it to reject all notices: http://localhost:3000/?geolocation=EEA&fides_consent_override=reject
  3. Ensure that a) the banner never showed and b) the cookie was sent in such a way that it mimics as if the user had clicked the "Reject All" button on the banner.
  4. Clear the cookies and visit the Cookie House again with a query param that tells it to accept all notices: http://localhost:3000/?geolocation=EEA&fides_consent_override=accept
  5. Ensure that a) the banner never showed and b) the cookie was sent in such a way that it mimics as if the user had clicked the "Accept All" button on the banner.

BEFORE:
cookiehouse-plus-rc fides-staging ethyca com_(iPhone SE)

AFTER:
localhost_3000_(iPhone SE)

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
  • Followup issues:
    • Followup issues created (include link)
    • 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

Copy link

vercel bot commented Nov 25, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Dec 3, 2024 6:18pm

Copy link

cypress bot commented Nov 25, 2024

fides    Run #11249

Run Properties:  status check passed Passed #11249  •  git commit f9208df1c9 ℹ️: Merge 3ac980db916b7dbfde342ef8d10ca307419e8f97 into a601fbeeaece3ce7fe6c48a577ac...
Project fides
Branch Review refs/pull/5541/merge
Run status status check passed Passed #11249
Run duration 00m 49s
Commit git commit f9208df1c9 ℹ️: Merge 3ac980db916b7dbfde342ef8d10ca307419e8f97 into a601fbeeaece3ce7fe6c48a577ac...
Committer Jason Gill
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 4
View all changes introduced in this branch ↗︎

@gilluminate gilluminate force-pushed the gill/HJ-259/poc-prep-work branch 4 times, most recently from 426c328 to 3af1ba8 Compare November 26, 2024 17:56
@gilluminate gilluminate force-pushed the gill/HJ-259/poc-prep-work branch 2 times, most recently from 8d650fb to 7e5a316 Compare November 27, 2024 00:07
@gilluminate gilluminate force-pushed the gill/HJ-259/poc-prep-work branch from 7e5a316 to 860925f Compare November 27, 2024 18:24
Comment on lines -240 to -242
onSave: () => {
setBannerIsOpen(false);
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

onSave was just superfluous and confusing so I removed it in favor of onClose everywhere.

Comment on lines +192 to +203
fidesDebugger(
`GPP: CMP status and configuration for ${geolocation?.location}`,
{
cmpStatus: cmpApi.getCmpStatus(),
cmpDisplayStatus: cmpApi.getCmpDisplayStatus(),
signalStatus: cmpApi.getSignalStatus(),
supportedAPIs: cmpApi.getSupportedAPIs(),
applicableSections: cmpApi.getApplicableSections(),
gppString: cmpApi.getGppString(),
parsedSections: cmpApi.getObject(),
},
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

a minor wish-list item I'm sneaking in to this PR :)

@@ -89,6 +89,221 @@
"geolocation": {
"location": "eea",
"country": "eea"
},
"gvl": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

automated preference saving was throwing an error because this was missing from the minimal experience mocks

<Component {...pageProps} />
);
const App = ({ Component, pageProps }: AppProps) => {
const AnyComponent = Component as any;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

weird solution to a weird Typescript problem with NextJS types.

@@ -229,6 +229,47 @@ const NoticeOverlay: FunctionComponent<OverlayProps> = ({
],
);

const handleAcceptAll = useCallback(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bumped these up to parent to take advantage of them at this level for the automated preference

Copy link
Contributor

@eastandwestwind eastandwestwind 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 so far @gilluminate ! Nice work implementing for not only notice-based but also TCF version as well.

renderFirstButton={() => (
<Button
buttonType={ButtonType.SECONDARY}
label={i18n.t("exp.save_button_label")}
onClick={() => onSave(ConsentMethod.SAVE, draftIds!)}
onClick={() => onSave(ConsentMethod.SAVE, draftIds)}
Copy link
Contributor

Choose a reason for hiding this comment

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

what did the ! actually do before?

Copy link
Contributor Author

@gilluminate gilluminate Dec 3, 2024

Choose a reason for hiding this comment

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

Its purpose is to tell the Typescript validator to ignore the fact that it might be null/undefined whereas (in this case) the onSave method expects it to have a value. Usually reserved for something where the developer is 100% sure that value will be set by the time it hits this chunk of code, I find it's usually abused and prone to unexpected bugs so I prefer cleaning it up wherever possible. In this case I set the value explicitly on line 174, giving the useState a default.

clients/fides-js/src/fides-tcf.ts Outdated Show resolved Hide resolved
clients/fides-js/src/fides.ts Outdated Show resolved Hide resolved
@gilluminate gilluminate marked this pull request as ready for review December 3, 2024 16:53
@gilluminate gilluminate merged commit 8723d84 into main Dec 3, 2024
43 checks passed
@gilluminate gilluminate deleted the gill/HJ-259/poc-prep-work branch December 3, 2024 21:35
Copy link

cypress bot commented Dec 3, 2024

fides    Run #11250

Run Properties:  status check passed Passed #11250  •  git commit 8723d8468f: Mobile Native POC support work (#5541)
Project fides
Branch Review main
Run status status check passed Passed #11250
Run duration 00m 55s
Commit git commit 8723d8468f: Mobile Native POC support work (#5541)
Committer Jason Gill
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 4
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