Components: migrate Tier 1 jetpack-components to @wordpress/components & @wordpress/icons#48378
Conversation
|
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. |
dc2b2bb to
ab628d1
Compare
…s & icons Retires 8 @automattic/jetpack-components usages with drop-in WP design system equivalents. Tier 1 = "easy wins" with no API mismatch. - Alert (3 sites) → @wordpress/components Notice - packages/my-jetpack/.../product-detail-card - packages/publicize/.../services/custom-inputs - packages/publicize/.../services/service-status - CheckmarkIcon → @wordpress/icons check (MJ product-detail-card) - StarIcon → @wordpress/icons starFilled (MJ product-detail-card) - SearchIcon → @wordpress/icons search (VideoPress search input — was a misuse of the Jetpack Search PRODUCT icon as a generic magnifier) - NumberControl → @wordpress/components.__experimentalNumberControl (External Media Google Photos filter; the jetpack wrapper was already passing through to the same WP component) - ButtonProps type re-export → local mirror of the consumed prop subset (MJ action-button/types.ts, decoupling from jetpack-components) Out of scope, bumped to a later tier: Dialog and Popover are misnamed in jetpack-components (layout wrappers, not modals/popovers); H3 and Title wrap <Text> and are tied to the larger Text migration. Tracking: #48160 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ab628d1 to
9c793ed
Compare
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
| import { useProductCheckoutWorkflow } from '@automattic/jetpack-connection'; | ||
| import { getCurrencyObject } from '@automattic/number-formatters'; | ||
| import { ExternalLink } from '@wordpress/components'; | ||
| import { ExternalLink, Notice } from '@wordpress/components'; |
There was a problem hiding this comment.
Why not Notice from @wordpress/ui instead?
…s & icons (Automattic#48378) Retires 8 @automattic/jetpack-components usages with drop-in WP design system equivalents. Tier 1 = "easy wins" with no API mismatch. - Alert (3 sites) → @wordpress/components Notice - packages/my-jetpack/.../product-detail-card - packages/publicize/.../services/custom-inputs - packages/publicize/.../services/service-status - CheckmarkIcon → @wordpress/icons check (MJ product-detail-card) - StarIcon → @wordpress/icons starFilled (MJ product-detail-card) - SearchIcon → @wordpress/icons search (VideoPress search input — was a misuse of the Jetpack Search PRODUCT icon as a generic magnifier) - NumberControl → @wordpress/components.__experimentalNumberControl (External Media Google Photos filter; the jetpack wrapper was already passing through to the same WP component) - ButtonProps type re-export → local mirror of the consumed prop subset (MJ action-button/types.ts, decoupling from jetpack-components) Out of scope, bumped to a later tier: Dialog and Popover are misnamed in jetpack-components (layout wrappers, not modals/popovers); H3 and Title wrap <Text> and are tied to the larger Text migration. Tracking: Automattic#48160 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: dognose24 <6869813+dognose24@users.noreply.github.com>
Tracks #48160 — first "easy wins" slice of the
@automattic/jetpack-components→@wordpress/ui/@wordpress/componentsmigration.Proposed changes
Retires 5 named-import sites of
@automattic/jetpack-componentsacross 4 files in 3 packages, with WP design system equivalents. No user-facing visual changes for any state these consumers were already rendering on trunk — see "Visual impact" below.packages/my-jetpack/_inc/components/product-detail-card/index.jsxAlert→Noticefrom@wordpress/components(level="warning"becomesstatus="warning");StarIcon→Icon icon={starFilled}from@wordpress/icons.packages/publicize/_inc/components/services/custom-inputs.tsxAlert→Notice(Bluesky reconnect prompt).packages/publicize/_inc/components/services/service-status.tsxAlert→Notice(broken-connection / re-auth status).packages/videopress/src/client/admin/components/input/index.tsxSearchIcon→Icon icon={search}from@wordpress/icons. Note:SearchIconfromjetpack-componentsis the Jetpack Search product icon; this consumer was using it as a generic magnifying glass, which is a misuse. The product icon export stays in place for legitimate uses.Out of scope, deliberately
A few "obvious" Tier 1 candidates were inspected and bumped:
DialogandPopover— names are misleading; injetpack-componentsthey're layout wrappers (sectioned panel, icon+body+action card respectively), not WP-style modal/popover primitives. Not drop-in replacements.H3andTitle— both wrap<Text>, which is itself in the migration backlog. Migrating these withoutTextis churn.CheckmarkIcon— looked like a one-line swap, but the Jetpack version is a green-circle-with-white-check while@wordpress/iconscheckis a monochrome stroke. PR My Jetpack: use ui-icon instead of CheckmarkIcon #48165 already attempted a global replacement and ran into design backlash without consensus. Holding allCheckmarkIconswaps until that lands.NumberControl— promoted to intentional keeper. The Jetpack wrapper isn't a thin shim: it handleseslint-disable @wordpress/no-unsafe-wp-apisfor the__experimentalNumberControlimport AND provides aTextControlfallback when the experimental component isn't available. Worth keeping until WP ships a non-experimental NumberControl.ButtonPropstype re-export — kept importing fromjetpack-components. The original PR tried a local mirror, butButtonitself is still in the migration backlog so decoupling its types now is premature.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Visual impact
TL;DR — minor, edge-case-only. Most call sites are conditional and/or visually identical between old and new components. The only meaningful visual differences:
Alert→NoticeAlerthas an inline warning icon at the start of the text. WPNoticehas no inline icon but a thicker colored left-border accent.StarIcon→Icon icon={starFilled}SearchIcon→Icon icon={search}Where to actually look
The components migrated here render in conditional / edge-case states that aren't visible on a fresh install. Use these URLs and conditions to spot the changes:
ProductDetailCardrendered via the legacyProductInterstitialpath)/wp-admin/admin.php?page=my-jetpack#/add-security(or/add-extras,/add-scan,/add-growth,/add-complete)Alert/Noticeonly appears whencantInstallPluginis true (status === 'plugin_absent'ANDfileSystemWriteAccess === 'no'). The "Popular upgrade" star pill appears at the top whenever the product is a bundle upsell. Most product slugs use a newerPricingInterstitialinstead, which doesn't render this card.reconnectingAccount?.service_name === 'bluesky')./wp-admin/admin.php?page=jetpack-videopressTesting instructions
Easiest visual check (no special site state needed):
/wp-admin/admin.php?page=jetpack-videopressand confirm the search input renders with a leading magnifying glass icon (rendered identically pre/post —@wordpress/iconssearch).To trigger the
cantInstallPluginNotice onProductDetailCard(the only non-trivial visual diff):WP_AUTO_UPDATE_COREconstraints), visit/wp-admin/admin.php?page=my-jetpack#/add-security.Alert) is gone, replaced by the WPNoticeleft-border style.Bluesky reconnect flow (Publicize Notice):
No-state confirmation:
pnpm jetpack build packages/my-jetpack,pnpm jetpack build packages/publicize,pnpm jetpack build packages/videopress— all build clean.grep -rE "from '@automattic/jetpack-components'" projects/packages/videopressno longer showsSearchIcon;packages/my-jetpackno longer showsStarIcon;packages/publicizeno longer showsAlert.Changelog
patch / changedentry: "Components: migrate Tier 1 jetpack-components to @wordpress/components and @wordpress/icons (no user-facing change)." Seechangelog/migrate-tier1-jp-componentsin each affected package. (External Media gets a no-op changelog since the NumberControl change was reverted; its entry can be deleted on next push if it stays unchanged.)🤖 Generated with Claude Code