Skip to content

feat: Add new privacy policy toast#23838

Merged
jonybur merged 50 commits intodevelopfrom
fix-2319
May 14, 2024
Merged

feat: Add new privacy policy toast#23838
jonybur merged 50 commits intodevelopfrom
fix-2319

Conversation

@jonybur
Copy link
Copy Markdown
Contributor

@jonybur jonybur commented Apr 3, 2024

Description

Changes:
Adds a new privacy policy banner that will show up after June 4, 2024.
If the user closes it manually, the privacy policy banner will not show up again.
If the user does not close the toast manually, the privacy policy banner will cease to show up after a day of being shown for the first time.
Changes the Survey banner so that we can display multiple banners at the same time without overlapping each other.

Considerations:

  • Make sure this doesn't show up during onboarding
  • This toast will show up even after years of the privacy policy being changed. We should set up a deadline for that or eventually revert this PR.
  • Check if copy is correct.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2319

Manual testing steps

  1. Go to the home page
  2. Check if there's a new privacy banner there (date should be edited in the code so that the privacy policy shows up earlier than May 6, 2024)
  3. When closing it, it shouldn't show up again
  4. If not closing it manually, the toast should not show up again after 1 day of being shown for the first time. This data is saved in localStorage so editing the timestamp there should be enough to test this feature out.

Screenshots/Recordings

Before

After

Screenshot 2024-04-22 at 15 51 53 Screenshot 2024-04-22 at 15 52 06 Screenshot 2024-04-22 at 15 52 20

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link
Copy Markdown
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

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

Added some guidance here. Nice start!

@jonybur jonybur added team-core-extension-ux Core Extension UX team needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. labels Apr 8, 2024
@jonybur jonybur marked this pull request as ready for review April 8, 2024 14:07
@jonybur jonybur requested a review from a team as a code owner April 8, 2024 14:07
@jonybur jonybur requested a review from darkwing April 8, 2024 14:08
@darkwing
Copy link
Copy Markdown
Contributor

darkwing commented Apr 8, 2024

Kicked CI because test failures look intermittent. This looks awesome!

Copy link
Copy Markdown
Member

@NidhiKJha NidhiKJha left a comment

Choose a reason for hiding this comment

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

Really great start! Left some nits.

&__survey-banner {
position: absolute;
&__overlay-banners {
z-index: 9999;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are we using this z-index?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I found that the current implementation was being shown under other elements in the DOM.

The toasts should always be on top of everything, so the best way to ensure this is with z-index, as there are currently other elements using z-index as well.

/>
)}
{showPrivacyPolicyToast && isPrivacyToastRecent && (
<BannerBase
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: Why are we using BannerBase and not Toast component here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The implementation mirrors the one of the Survey banner, I haven't seen the Toast component before, but I think I can change the implementation of both banners to use Toast

@NidhiKJha
Copy link
Copy Markdown
Member

To get CI tests to pass, you might need to update the error spec file and fixtures as you have added the state in the app-state directly. Use the command yarn build:test and once the build is generated. You need to run yarn test:e2e:single test/e2e/tests/errors.spec.js --browser chrome --update-snapshot

@jonybur jonybur requested a review from darkwing May 3, 2024 19:21
const isPrivacyToastNotShown = !newPrivacyPolicyToastShownDate;

return (
<ToastContainer>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest moving this function into its own component and then importing it. This approach offers several benefits: it makes the function easier to test on its own (unit testing), enables us to create a dedicated Storybook entry for it, and facilitates its reuse in future projects or components if needed, and reduce the size of the routes.component.js file

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [2b58957]
Page Load Metrics (1569 ± 657 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6913594199
domContentLoaded10331673
load56333015691369657
domInteractive10331673
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 450 Bytes (0.01%)
  • ui: 1.58 KiB (0.02%)
  • common: 1.25 KiB (0.02%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [23a6b09]
Page Load Metrics (1262 ± 729 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint721861033115
domContentLoaded95419136
load59473912621518729
domInteractive95419146
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 450 Bytes (0.01%)
  • ui: 1.58 KiB (0.02%)
  • common: 1.25 KiB (0.02%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [977936a]
Page Load Metrics (756 ± 576 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint55149902311
domContentLoaded76816136
load4433517561201576
domInteractive76816136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 450 Bytes (0.01%)
  • ui: 1.58 KiB (0.02%)
  • common: 1.25 KiB (0.02%)

@codecov
Copy link
Copy Markdown

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 50.60241% with 41 lines in your changes are missing coverage. Please review.

Project coverage is 67.42%. Comparing base (cfcbd1e) to head (977936a).

Files Patch % Lines
ui/pages/routes/routes.component.js 51.85% 26 Missing ⚠️
app/scripts/metamask-controller.js 0.00% 5 Missing ⚠️
ui/store/actions.ts 33.33% 4 Missing ⚠️
app/scripts/controllers/app-state.js 0.00% 3 Missing ⚠️
ui/pages/routes/routes.container.js 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23838      +/-   ##
===========================================
- Coverage    67.48%   67.42%   -0.05%     
===========================================
  Files         1288     1289       +1     
  Lines        50153    50236      +83     
  Branches     13023    13023              
===========================================
+ Hits         33842    33871      +29     
- Misses       16311    16365      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@darkwing
Copy link
Copy Markdown
Contributor

@jonybur I can confirm I no longer see the strange behavior of the toast not going away. 👍

@jonybur jonybur merged commit 99b9480 into develop May 14, 2024
@jonybur jonybur deleted the fix-2319 branch May 14, 2024 14:37
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2024
@metamaskbot metamaskbot added release-11.16.0 Issue or pull request that will be included in release 11.16.0 and removed release-11.18.0 labels May 22, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Missing release label release-11.16.0 on PR. Adding release label release-11.16.0 on PR and removing other release labels(release-11.18.0), as PR was cherry-picked in branch 11.16.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-privacy needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. release-11.16.0 Issue or pull request that will be included in release 11.16.0 team-core-extension-ux Core Extension UX team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants