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

Enhancement/9887 Refactor Consent Mode Setup Widget #9986

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from

Conversation

jimmymadon
Copy link
Collaborator

Summary

Addresses issue:

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

Copy link

github-actions bot commented Jan 7, 2025

Build files for a5f00fe are ready:

Copy link

github-actions bot commented Jan 7, 2025

Size Change: +4.71 kB (+0.24%)

Total Size: 1.99 MB

Filename Size Change
./dist/assets/css/googlesitekit-admin-css-********************.min.css 62.2 kB -21 B (-0.03%)
./dist/assets/js/37-********************.js 893 B +1 B (+0.11%)
./dist/assets/js/googlesitekit-activation-********************.js 23.9 kB +10 B (+0.04%)
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 54 kB -19 B (-0.04%)
./dist/assets/js/googlesitekit-api-********************.js 10.1 kB -1 B (-0.01%)
./dist/assets/js/googlesitekit-components-gm2-********************.js 6.18 kB +7 B (+0.11%)
./dist/assets/js/googlesitekit-data-********************.js 2.38 kB -2 B (-0.08%)
./dist/assets/js/googlesitekit-datastore-forms-********************.js 8.95 kB +2 B (+0.02%)
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.09 kB +2 B (+0.1%)
./dist/assets/js/googlesitekit-datastore-site-********************.js 20.2 kB +5 B (+0.02%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 10 kB -1 B (-0.01%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 28.2 kB +5 B (+0.02%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 82.4 kB +122 B (+0.15%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 162 kB -4.13 kB (-2.49%)
./dist/assets/js/googlesitekit-metric-selection-********************.js 51.8 kB -7 B (-0.01%)
./dist/assets/js/googlesitekit-modules-********************.js 22.4 kB -1 B (0%)
./dist/assets/js/googlesitekit-modules-ads-********************.js 45.3 kB +9.56 kB (+26.77%) 🚨
./dist/assets/js/googlesitekit-modules-adsense-********************.js 119 kB -61 B (-0.05%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 192 kB -97 B (-0.05%)
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 22.5 kB +4 B (+0.02%)
./dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 40.3 kB +16 B (+0.04%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 69.3 kB +20 B (+0.03%)
./dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 31.5 kB -87 B (-0.28%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.1 kB -23 B (-0.07%)
./dist/assets/js/googlesitekit-notifications-********************.js 38.2 kB +75 B (+0.2%)
./dist/assets/js/googlesitekit-settings-********************.js 128 kB -175 B (-0.14%)
./dist/assets/js/googlesitekit-splash-********************.js 68.6 kB +22 B (+0.03%)
./dist/assets/js/googlesitekit-user-input-********************.js 43.7 kB -14 B (-0.03%)
./dist/assets/js/googlesitekit-vendor-********************.js 325 kB -343 B (-0.11%)
./dist/assets/js/googlesitekit-widgets-********************.js 104 kB -139 B (-0.13%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 63.1 kB -20 B (-0.03%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.8 kB
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 846 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.48 kB
./dist/assets/js/33-********************.js 2.76 kB
./dist/assets/js/34-********************.js 2.25 kB
./dist/assets/js/35-********************.js 3.64 kB
./dist/assets/js/36-********************.js 936 B
./dist/assets/js/38-********************.js 1.61 kB
./dist/assets/js/39-********************.js 1.57 kB
./dist/assets/js/40-********************.js 1.61 kB
./dist/assets/js/41-********************.js 1.59 kB
./dist/assets/js/42-********************.js 1.83 kB
./dist/assets/js/43-********************.js 3.12 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 901 B
./dist/assets/js/googlesitekit-adminbar-********************.js 34.8 kB
./dist/assets/js/googlesitekit-components-gm3-********************.js 10.1 kB
./dist/assets/js/googlesitekit-consent-mode-********************.js 25.6 kB
./dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 646 B
./dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 624 B
./dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 630 B
./dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 712 B
./dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 675 B
./dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 634 B
./dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 657 B
./dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 633 B
./dist/assets/js/googlesitekit-i18n-********************.js 3.93 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 377 B
./dist/assets/js/googlesitekit-reader-revenue-manager-block-editor-********************.js 477 B
./dist/assets/js/runtime-********************.js 1.4 kB

compressed-size-action

Copy link
Collaborator

@aaemnnosttv aaemnnosttv left a comment

Choose a reason for hiding this comment

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

Thanks @jimmymadon ! A few things to consider or address here, let me know if you have any questions. Great to see the main dashboard being cleaned up!

Comment on lines 122 to 124
// The getSetupErrorMessage selector relies on the resolution
// of the getSiteInfo() resolver.
await resolveSelect( CORE_SITE ).getConsentModeSettings();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment doesn't make sense here. Copy/paste mistake?

@@ -64,6 +64,7 @@ Default.decorators = [
},
];
Default.scenario = {
// eslint-disable-next-line sitekit/no-storybook-scenario-label
Copy link
Collaborator

Choose a reason for hiding this comment

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

This shouldn't be necessary since no changes were made to the file 🤔

We should really avoid adding these ignores here and where needed, update the Story or scenario to comply with our convention instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So for some reason, when I merged develop into my branch and tried to commit the merge, I was forced to do this otherwise the github hooks wouldn't let me commit. Since this issue has gone above estimate already, I didn't want to spend too much time on sorting these out and wanted to create another issue to do this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought skipping the pre-commit hooks would cause issues in the CI checks. But I think this is fine. Have reverted them all.

Comment on lines 83 to 86
gaTrackingEventArgs: PropTypes.shape( {
category: PropTypes.string,
label: PropTypes.string,
value: PropTypes.string,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be okay for now, so long as these are passed as positional args to trackEvent but I'd like to move to a more modern application where we call it as a wrapper for gtag such as trackEvent(eventName, args) => gtag('event', eventName, args). The difference being that in that paradigm, category would be event_category (the name of the dimension, same with label`. See

event_category: category,
event_label: label,
value,

This is something I've been meaning to open an issue to do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This definitely would make things more obvious.

{ learnMoreLink }
</p>
</div>
{ errorText && <ErrorText message={ errorText } /> }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feels like this component is starting to do a bit too much maybe.

Copy link
Collaborator Author

@jimmymadon jimmymadon Jan 24, 2025

Choose a reason for hiding this comment

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

I did consider creating a separate component but didn't because the <ErrorText> component already encapsulates the rendering of the error component which we forward a very simple message to for now. And adding it to adds errorText support for all layouts rather than adding a new component/prop to every layout that might require it.

Comment on lines +35 to +36
<div className="googlesitekit-widget-context">
<Grid className="googlesitekit-widget-area">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks quite hackish – why are doing this especially just for a single notification?

Edit: I see now that this is done in other notification components as well, which I don't understand. We shouldn't emulating this in new notifications, but maybe it's only intended to be temporary? If not, let's plan on refactoring this out in a future issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This started off when we "copy-pasted" the first setup CTA (I think Audience Segmentation or Consent Mode) and this has been copy-pasted since in all Setup Banners that are "separate" like widgets and not "attached" to the Navigation bar like our other Banner Notifications. We made a conscious decision not to spend too much time on restyling everything as this was part of a future phase and not in scope for this epic.

This will definitely all be restyled in BNR Phase 3 - I will be adding these notes to the Design Doc and future issues.

@media (min-width: $width-tablet + px) {
padding: $grid-gap-desktop;
}
.googlesitekit-setup-cta-banner__svg-wrapper--consent-mode-setup-cta-widget {
Copy link
Collaborator

Choose a reason for hiding this comment

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

-- should indicate a variant or state. Do we really need a special variant just for consent mode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All the SVGs within notifications are really "non-standard" as they are "borderless" in different areas and resizing them is a pain. This is something I want to raise with Sigal when defining the new notifications. So each of the SVGs have some different styles to make them "work". We'd be better off having standard "side-kick" like images which are fixed in size/proportion like the other older SVGs we use in our notifications.

<a
aria-label="Learn more about consent mode (opens in a new tab)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Part of the aria-label is lost here. Is this expected?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did think it wasn't worth passing more props here again and to just use the default standard label that Link generates. The extra "about consent mode" doesn't really add much value here. But I've added this now as it might help in the future too for more custom aria labels.

Comment on lines -265 to -270
{ ! viewOnlyDashboard && (
<Fragment>
<ConsentModeSetupCTAWidget />
</Fragment>
) }

Copy link
Collaborator

Choose a reason for hiding this comment

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

😍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup - I had the same amount of pleasure in getting rid of this finally! And we've done the same with ErrorNotifications as well.

@@ -115,6 +115,7 @@ function Template() {

export const DefaultTypeScale = Template.bind( {} );
DefaultTypeScale.scenario = {
// eslint-disable-next-line sitekit/no-storybook-scenario-label
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove these added ignores

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