Repository navigation
My Jetpack: Render notices with the WordPress design system Notice - #52290
Conversation
Swaps the hand-rolled Notice (@automattic/jetpack-components) for @wordpress/ui's Notice in GlobalNotice, SeoOptInCard, and the Jetpack AI product page's usage-limit notice. Level/intent, the close button override, and the Tracks view-event mount effect are unchanged. Also drops a handful of dead SCSS selectors that targeted @wordpress/components' old Notice markup, which the @automattic/jetpack-components Notice already in place never rendered.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Videopress plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Stats Data plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
GlobalNotice's own SCSS still set background-color/font-size/line-height on the card, unlayered so it always beat @wordpress/ui's @layer wp-ui rules. That forced a plain white card with mismatched text sizing instead of the tinted WPDS card the other two migrated notices already show. Drop the overrides (and the now-pointless <=600px padding-top), and switch .message's margin-right to the logical margin-inline-end. Also correct the changelog significance from minor to patch (a restyle, no new capability) and reword a test comment that overclaimed rerender coverage of a remount.
Code Coverage SummaryCoverage changed in 41 files. Only the first 5 are listed here.
|
Fixes JETPACK-2616
Proposed changes
Swaps the hand-rolled
Noticecomponent (@automattic/jetpack-components) for the@wordpress/uiNotice(Root/Title/Description/Actions/CloseIcon) in the three My Jetpack surfaces that use it:GlobalNoticeinmy-jetpack-screen/index.jsx— the dashboard's shared notice banner, driven byuse-notification-watcher's hooks (backup failure, Protect threats, expiring plans, plugins needing activation, connection errors, bad install, deprecated features).SeoOptInCard— the SEO dashboard opt-in promo, shown on eligible self-hosted Jetpack-plugin sites.Behaviour kept as-is:
level/intentmapping is one-to-one (error, warning, info, success).GlobalNotice's Tracks view-event mount effect is untouched — same deps array, no remount.hideCloseButton/onCloseoverrides from watchers still show the close button and callonClose.actions={ tierPlansEnabled ? [...] : {} }object-vs-array case on the AI page) render the same.Also removed a handful of dead SCSS selectors in
my-jetpack-screen/styles.module.scss(:global(.components-notice__content),:global(.components-notice__dismiss),:global(.components-notice__action), and an.icon-wrapperselector). These target@wordpress/components' oldNoticemarkup — the@automattic/jetpack-componentsNoticealready in place before this PR never rendered those classes, so the rules were already inert. Verified by readingprojects/js-packages/components/components/notice/index.tsx's own (CSS-module-scoped) class names before removing them.:global(.is-link)stays — it targets the action buttons' own WPButtonclasses, unrelated to whichNoticewraps them.Visual differences (unavoidable with the design-system Notice)
Noticeis a full bordered, rounded card with a tinted background matching the intent, replacing the old flat white card with a colored stripe.These match the same trade-offs made in #52160 (Protect) and #52015 (Jetpack plugin), which migrated to the same component. All three migrated My Jetpack surfaces (
GlobalNotice,SeoOptInCard, the AI product page) now render the same tinted, bordered WPDS card —GlobalNotice's oldmy-jetpack-screen/styles.module.scssrules forbackground-color,font-size, andline-heighton.notice > divwere unlayered and beat@layer wp-ui, which forced it back to a plain white card with mismatched text sizing; those overrides are removed here. The only remaining difference betweenGlobalNoticeand the other two is itsActionButton-styled action row, which keeps its own.cta/.is-linkstyling.The
Root/Title/Description/Actions/CloseIconcomposition is written out at each of the three call sites rather than behind a new shared wrapper (the pattern #52160 and #52015 both use for their own single call site) — the task scope for this change asked to keep the diff to the three existing files, with no new wrapper component or abstraction. A follow-up could extract one if a fourth call site shows up.Changelog
packages/my-jetpackgets its own entry (always required for aprojects/change).plugins/jetpackgets an entry — it's the only plugin that bundles the SEO package, so it's the only one that can reachSeoOptInCard; it also reachesGlobalNoticeand the AI product page.plugins/{boost,protect,search,social,videopress,backup,stats}each get an entry: My Jetpack is the shared dashboard hub every one of these bundles (Initializer::init()oninit), soGlobalNotice(visible whenever any of its trigger conditions fire — e.g. a connection error, which isn't gated to a specific product) and the Jetpack AI product page (reachable via My Jetpack's own product catalog/upsell routing, not gated behind a specific plugin) are both directly user-facing for each of them.plugins/starter-pluginis skipped per the AGENTS.md exception for scaffolding templates nobody installs.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. The
jetpack_myjetpack_global_notice_viewTracks event still fires once per noticeid, from the same mount effect with the same dependency array.Testing instructions
All steps below were run against a local Docker instance with a DB cloned from a connected
jetpack_dev, atadmin.php?page=my-jetpack.Prerequisite: a localhost Docker site reports Jetpack Offline Mode (the
localhostURL heuristic), which makesMy_Jetpack::should_initialize()skip menu registration entirely and the page 403s. Force it off for local testing with an mu-plugin:add_filter( 'jetpack_offline_mode', '__return_false' );.Automated:
pnpm jetpack test js packages/my-jetpack— 25 suites / 201 tests pass, including a newglobal-notice.test.jsxcovering the view-event-fires-once behavior, the default hidden close button, and the watcher-overridden close button callingonClose.pnpm typecheck(inpackages/my-jetpack) — clean.eslint/stylelinton every touched file — clean.Manual, each state forced via routes/an init script (no data written to the site):
POST wp-json/my-jetpack/v1/red-bubble-notificationsrequest and fulfill it with abackup_failurealert, open My Jetpack. Confirm the "Oops! We couldn't back up your site" notice renders with its two actions, and that clicking the close (Dismiss) button dismisses it.window.myJetpackInitialState.seoOptIn.showCard = truebefore the app boots, open My Jetpack. Confirm "A fresh way to manage your SEO" renders with no close button.my-jetpack/v1/site/productsresponse sojetpack-ai.ai-assistant-featurereportsis-over-limit: trueon the free tier, open#/jetpack-ai. Confirm "You've used all your free requests" renders with an "Upgrade now" button and a close button.Also checked the backup failure notice at a 600px-wide viewport: text wraps normally, no overflow or clipping, and the action buttons stack cleanly under the wrapped copy.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HwoMPDxu6uEciqTGWdKJ3r