Repository navigation
Licensing: migrate the activation screen to @wordpress/ui - #50348
Conversation
Migrate the license activation screen (ActivationScreen) to the WordPress Design System: - Activate button -> @wordpress/ui Button (variant="solid", built-in loading state instead of an embedded Spinner). - License key inputs -> @wordpress/ui InputControl / SelectControl. - "Do you need help? Contact us." -> @wordpress/ui Text (body-md) + Link, fixing the previously too-small copy, plus text-wrap: pretty on the subtext. - Wrap the screen in a @wordpress/ui Card.Root (border + radius), dropping the custom drop-shadow. - Tighten the input-to-button gap and stop stretching the button to the bottom of the column (flex-start). - Retarget validation border styling off @wordpress/components internal classes; trim the custom button SCSS in favour of the DS defaults. - Update tests for the new components.
|
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: 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. |
Code Coverage SummaryCoverage changed in 5 files.
|
LiamSarsfield
left a comment
There was a problem hiding this comment.
Nice migration, the SelectControl string/item-object mapping came out clean, and the manual-entry fallback is handled well. Since the whole point is landing on @wordpress/ui, I read the visual shifts (no field error-border, flatter card) as intentional: @wordpress/ui hasn't shipped a field validation state yet (it's a TODO in the Field types) and Card.Root is flat by design, so matching that is the consistent call. A couple of small cleanups in that spirit:
-
The error/success border rules in activation-screen-controls/style.scss are dead now. They recolor an
inputthat @wordpress/ui givesborder: none, so nothing paints. Worth deleting them (and the -with-error/-with-success class plumbing if it's unused now) so the next person doesn't assume field-level error styling exists. The red "Unable to validate" message still carries the feedback, which is the DS-consistent pattern anyway. -
activation-screen/style.scss has a comment saying the file adds the elevation, but nothing does and Card.Root is flat. Worth fixing the comment so it matches, or dropping a shadow back if you'd rather keep the depth.
-
Tiny one: the new
margin-top: 8pxshould bemargin-block-startto stay RTL-safe. -
Optional: since you added
loadingto the Button,disabled={ ! license || isActivating }would keep it non-interactive during activation. Right nowloadingonly draws the spinner, becausedisabledis always defined and the DS'sdisabled ?? loadingnever falls through.
The core change itself LGTM though so these can be fast follows if need be.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Primary CTA uses a @wordpress/ui Button with onClick navigation (native button; a LinkButton follow-up is flagged for when it ships), and the companion link uses a native @wordpress/ui Link. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ping Use a sentinel value for the 'add a license key manually' option so the SelectControl trigger reads that option (not the empty-value placeholder) while the manual text input is shown, and clear the stored license on that pick. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The @wordpress/ui Button stays clickable in its loading state; gate it on isActivating so a submission can't be re-triggered mid-request. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rol doesn't reflow Without a fixed column width, a long selected license value widens the controls column (skewing the split). Give each column flex:1 + min-width:0 so the value truncates via the trigger's built-in ellipsis instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Route license changes (select pick or manual input) through a handler that also clears licenseError, so a stale 'invalid key' notice doesn't linger after the user picks or types a different key. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the raw heading/paragraph and flex containers with @wordpress/ui primitives: the h1 and intro copy become Text, and the column layout becomes nested Stacks (outer space-between; a logo+heading group; a main-content group), dropping the per-element margins/paddings in favour of Stack gap. Keeps the validation border and the Button as-is; bumps the field labels from xs to md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- The validation-border rules targeted the <input>, but the @wordpress/ui input has border:none (the border sits on the .input-layout wrapper), so they never rendered — drop them. - Card.Root already supplies the panel background, so the controls no longer need their own; drop the base-styles @use, the min-height, and the button margin. - The error notice styles are unnecessary now that Notice + browser defaults render the message and lists cleanly — delete the stylesheet and its import. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wordpress/ui Link with openInNewTab already sets rel appropriately, and modern browsers imply noopener for target=_blank — matching the ExternalLink change in Gutenberg (WordPress/gutenberg#79743). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fix the license-error assertion for the new @wordpress/ui Notice, cover the disabled-while-activating button, and add an ActivationScreenError suite for the generic, not-same-owner (ordered steps), and already-active (success) variants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Hey @enejb 👋 — since our two PRs (#50343 and this one) overlapped heavily, we've folded the parts of our work that weren't in your scope on top of your branch, as 10 discrete, individually-removable commits. Nothing here touches your form-controls migration, What we added (each is its own commit)
Before / after(before = this branch's base; after = with our commits) A few things to flag for your call
|
LiamSarsfield
left a comment
There was a problem hiding this comment.
Nice cleanup here. Dropping all that bespoke CSS and moving the error states onto Notice makes this much easier to follow.
One thing I think we need to sort before merge: pulling in SelectControl brings @wordpress/ui into the main admin bundle, which drags @wordpress/theme and @wordpress/private-apis in as externalized script handles (wp-theme / wp-private-apis). Those aren't registered on the Jetpack admin path on WP 6.9/7.0, so the dashboard script can fail to load there. The AI-admin build already hit this and sets both to external: false in its DependencyExtractionPlugin. The main admin build in tools/webpack.config.js needs the same requestMap. Build it, check the generated admin.asset.php, then smoke-test the activation screen on 6.9.
Two smaller ones I'd do while you're in here:
- The support links lost
rel="noopener noreferrer". @wordpress/ui's Link sets target=_blank and no rel, so it's gone now rather than redundant. Cheap to add back. - The success CTAs went from real
<a href>to buttons that set window.location.href, so cmd/middle-click and copy-link stop working on every success visit. A real anchor (or Link styled as the CTA) brings them back. Watch out that Button with render={} still comes out as role=button, so that alone won't restore link semantics.
One more: the description still calls out the red validation border, text-wrap, and the button placement change, but none of those are at the current head. Worth syncing the description and UAT so reviewers test what's actually shipping.
Everything else I saw is minor (changelog prefix, a couple of physical CSS props) and not worth holding this up.
|
Nice catch there @LiamSarsfield , I thought I've handled the wp-theme polyfill on a previous PR, but this is a different build. I'll double check that and reinstate the |
The licensing activation screen pulls @wordpress/ui into the main Jetpack admin bundle, which drags @wordpress/theme and @wordpress/private-apis in as externalized script handles (wp-theme / wp-private-apis). Those handles are not registered on the main Jetpack admin path — WP <= 7.0 has no core wp-theme, and this page does not load the wp-build-polyfills shim — so the dashboard script fails to enqueue there. Add the same DependencyExtractionPlugin requestMap the AI admin build already uses so both packages are bundled inline instead of externalized. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reverses the earlier drop: the @wordpress/ui Link does not add rel when openInNewTab is set (it only sets target=_blank), so these new-tab links were left without noreferrer. Modern browsers imply noopener for target=_blank, but noreferrer is not implied, so restore rel="noopener noreferrer" explicitly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
LiamSarsfield
left a comment
There was a problem hiding this comment.
This is looking great after the latest push. The admin bundle fix does the job (built it locally, admin.asset.php comes out clean, no wp-theme/wp-private-apis), and the rel restore on the error links looks spot on. Thanks for turning it around so fast.
Just a few bits before it's good to merge:
Changelog will fail CI. changelog/fix-licensing-admin-bundle-wp-theme-external uses Type: fixed, but the Jetpack plugin only accepts major/enhancement/compat/bugfix/other, so changelogger validate errors out. bugfix (or compat) sorts it. Two more while you're in those files: the migration entry is filed as other, which keeps a visible redesign out of the user-facing changelog, so enhancement reads truer; and the separate rel entry documents a fix that never shipped (the links already had rel on trunk), so fold it into the migration entry or drop it.
Looks like one rel slipped through. activation-screen-success-info/product-link/index.jsx opens in a new tab (openInNewTab) with no rel, the same gap you closed on the error links. One line finishes it.
Stale error can linger. In activation-screen/index.jsx, the availableLicenses effect calls setLicense directly, which skips onLicenseChange, the only path that clears licenseError. So if the list refetches while an error is showing, you can land on a new key with the old key's error still under it. Route that through the clearing path (or clear it in the effect) and it's closed.
On the success CTAs becoming buttons: saw your note about moving to LinkButton later, no rush. If you want link behavior back before then, Button nativeButton={false} render={<a href={url} />} gets you there, but happy to leave it for the follow-up.
Nothing else blocking from me, the rest is just polish. Really nice work on this one.
|
Thanks for the changes @CGastrell I've put another round of a review here |
- The Jetpack plugin only accepts major/enhancement/compat/bugfix/other, so the admin-bundle entry's invalid 'fixed' type would fail changelogger; use 'bugfix'. - File the activation-screen migration as 'enhancement' rather than 'other' so the visible redesign lands in the user-facing changelog. - Drop the error-links 'rel' entry: the links already had rel on trunk, so the net change is zero and it documented a fix that never shipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Jetpack plugin only accepts major/enhancement/compat/bugfix/other, so the admin-bundle entry's invalid 'fixed' type would fail changelogger validate; use 'bugfix'. Also file the activation-screen migration as 'enhancement' rather than 'other' so the visible redesign lands in the user-facing changelog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The product-link CTA opens in a new tab (openInNewTab) but the @wordpress/ui Link never sets rel, so it lacked noopener/noreferrer — the same gap that was closed on the error links. One attribute finishes it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The availableLicenses effect calls setLicense directly, bypassing onLicenseChange — the only path that clears licenseError. So a refetch while an error is showing could land on a new key with the previous key's error still under it. Clear the error in the effect too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@CGastrell LGTM! The changelog types are sorted and the One thing the last error-clear commit brought in. In A couple of tiny ones if you're already in there:
Nothing else blocking from me, the rest is polish. Nice work getting this over the line 🚀 |
The availableLicenses effect cleared licenseError whenever that array changed reference. React Query hands back a new array on any refetch (refetchOnReconnect is on by default), so a background refetch touching an unrelated license could wipe a valid error off the current key. Track the last selected key in a ref and only re-select + clear when the first available key actually changes. Add a test covering the same-key refetch path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The success CTA renders with only a spinner during the plugins fetch, leaving screen readers an unnamed button. Add an aria-label. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The my-jetpack shim notes say WP < 7.0; align the admin-build comment so it's clear when the inline bundling can be dropped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| // Match the AI admin build: @wordpress/ui (pulled in via the licensing | ||
| // activation screen) drags in @wordpress/theme and @wordpress/private-apis. | ||
| // They are not registered as WP script handles on the main Jetpack admin | ||
| // path (WP < 7.0 has no core wp-theme, and this page does not load the | ||
| // wp-build-polyfills shim), so bundle them instead of externalizing to | ||
| // avoid the whole dashboard script failing to enqueue. |
There was a problem hiding this comment.
This comment seems really odd for the generic Jetpack modules webpack config? Talks about "this page" and unnamed "dashboard". etc.


















Proposed changes
Migrate the Jetpack license activation screen (
ActivationScreenin the@automattic/jetpack-licensingpackage) to the WordPress Design System (@wordpress/ui). This screen is shared by two entry points and both get the update:admin.php?page=jetpack#/license/activationadmin.php?page=my-jetpack#/add-licenseChanges:
@wordpress/uiButton(variant="solid"), using its built‑inloadingstate instead of an embeddedSpinner.@wordpress/uiInputControl/SelectControl.@wordpress/uiText(body-md) +Link, fixing the previously too‑small copy.Addedtext-wrap: prettyto the subtext to avoid a single‑word orphan.@wordpress/uiCard.Root(border + radius) and drop the custom drop‑shadow.and stop stretching the button to the bottom of the column (.flex-start)Retarget the validation‑border styling offtrim the custom button SCSS in favour of the Design System defaults. (The field‑level validation border was dead CSS — it recoloured an@wordpress/componentsinternal classes,inputthat@wordpress/uigivesborder: none— so it was removed; error feedback is carried by theNotice.)Because both entry points render the same
ActivationScreen, the two screens now render an identical card.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
wp-admin/admin.php?page=jetpack#/license/activationand confirm:@wordpress/uisolid button, is disabled with an empty field, and shows the built‑in loading state on submit.the red validation border andthe error message.wp-admin/admin.php?page=my-jetpack#/add-licenseand confirm the card is identical to the one above (same button, spacing, card border, no drop‑shadow).Before / After
Captured on a live Jurassic Ninja site.
Jetpack —
page=jetpack#/license/activationMy Jetpack —
page=my-jetpack#/add-license