My Jetpack: migrate product interstitial modal Buttons to @wordpress/ui#49111
My Jetpack: migrate product interstitial modal Buttons to @wordpress/ui#49111CGastrell wants to merge 1 commit into
Conversation
Migrates two remaining @automattic/jetpack-components Button consumers in
projects/packages/my-jetpack/_inc/components/product-interstitial-modal/:
- product-interstitial-modal-cta.tsx: Upgrade CTA Button migrated to
@wordpress/ui Button with variant="solid". When an href is provided,
renders an anchor via the render={<a />} + nativeButton={false} pattern
established in PR #48489. isLoading -> loading. The styles['action-button']
className was a no-op (no .action-button rule in the SCSS module) and has
been dropped.
- product-interstitial-my-jetpack.tsx: inline AI fair-usage-policy 'Learn
more about it here' Button (variant="link") migrated to @wordpress/ui
Link with openInNewTab, following the L1b sweep recipe in PR #49109.
Refs #48160.
|
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! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
Fixes #48160
Proposed changes
Migrates the remaining two
@automattic/jetpack-componentsButton consumers underprojects/packages/my-jetpack/_inc/components/product-interstitial-modal/to@wordpress/ui, completing the modal directory sweep started in #49109.product-interstitial-modal-cta.tsx@automattic/jetpack-componentsButton,variant="primary",isLoading, optionalhref+isExternalLink@wordpress/uiButton,variant="solid",loading, anchor-rendered whenhrefis present (render={<a />}+nativeButton={false})product-interstitial-my-jetpack.tsx@automattic/jetpack-componentsButton,variant="link",weight="regular",size="small",target="_blank"@wordpress/uiLink,openInNewTabProp mapping — Button → @wordpress/ui Button (anchor render)
variant="primary"variant="solid"isLoadingloadingdisableddisabledonClickonClickhref(optional)render={<a href={href} />}+nativeButton={false}isExternalLinktarget="_blank"+rel="noopener noreferrer"onto the rendered<a>isExternalLinkis trueclassName={ styles['action-button'] }.action-buttonrule —styles['action-button']resolved toundefined, so the className was already a no-opBecause the CTA's
hrefprop is optional (and the only in-tree caller —product-interstitial-my-jetpack.tsx's<ProductInterstitialModalCta slug={ slug } />— never passes one), the new implementation renders a native button whenhrefis absent and an anchor when it's provided. Runtime behaviour for the actual caller is unchanged: a native<button>driven by theuseProductCheckoutWorkflowonClickhandler.Prop mapping — Button (variant=link) → @wordpress/ui Link
hrefhreftarget="_blank"openInNewTab@wordpress/uiLink omitstargetfrom its<a>prop surface and exposesopenInNewTabinstead, which setstarget="_blank"and the visual external-link indicatorvariant="link"weight="regular"size="small"Same recipe as the six call sites migrated by #49109.
Related product discussion/links
render={<a/>}+nativeButton={false}): My Jetpack: migrate interstitial Buttons to @wordpress/ui #48489 (merged)variant="link"→ @wordpress/ui Link sweep across My Jetpack, including the secondary "Learn more" Button in this same modal directory: My Jetpack: migrate link-variant Buttons to @wordpress/ui Link #49109Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm jetpack build packages/my-jetpack./wp-admin/admin.php?page=my-jetpack).loadingstate whileuseProductCheckoutWorkflowruns.disabledstate still cascades while the product detail is loading.Automated gates run locally
pnpm jetpack build packages/my-jetpack— passpnpm jetpack test js packages/my-jetpack— passVisual verification note
I attempted to capture before/after screenshots on the local
jetpack_devdocker, but the My Jetpack admin page rejected access (Sorry, you are not allowed to access this page) on a non-Jetpack-connected install, and theProductInterstitialModalCtacomponent is not exercised by the existing storybook story inproduct-interstitial-modal/stories/. I deliberately did not modify connection state onjetpack_dev. Reviewers with a connected install can verify directly; the migration follows two already-validated precedents (#48489, #49109) operating on the same modal directory.Designer-review triggers from
design.mdSurfaced for the reviewer (not blocking):
Mitigation: this is a like-for-like component migration to the canonical WPDS primitive. The visual treatment is the WPDS
solidvariant, the documented analogue of the legacyprimaryvariant; no brand-color overrides or structural-only SCSS was introduced.