Repository navigation
My Jetpack: Finish the onboarding setup wizard - #52775
adampickering wants to merge 45 commits into
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! |
Code Coverage SummaryCoverage changed in 11 files. Only the first 5 are listed here.
18 files are newly checked for coverage. Only the first 5 are listed here.
Full summary · PHP report · JS report Coverage check overridden by
Covered by non-unit tests
|
c2da611 to
ef3daea
Compare
c958251 to
f12d466
Compare
311806d to
b6a3123
Compare
kraftbj
left a comment
There was a problem hiding this comment.
This needs a rebase onto 52765's head before it can land. Trunk's @wordpress/ui 0.24 renamed LinkButton to ButtonLink, so the new uses in finish-step.tsx and wizard.tsx won't build once rebased. The wizard.tsx conflict is only that rename. The failing onboarding e2e test is already fixed on 52765.
Nothing inline blocks merging behind the flag, but I'd want the finish-screen and module-default ones sorted before the flag goes on anywhere. The smoke test mocks use-setup-modules entirely, so the real apply loop, its failure path and the loading state aren't covered. That's how the first few got through.
Minor: the two art files add about 270 KB to the onboarding bundle, which the flag-off screen also loads. Lazy-loading Wizard would keep that out.
Color it with the admin theme color, as the old spinner's arc was, since the loading view sits outside the wizard's ThemeProvider and the default foreground is too faint on the dark shell.
Skip setup is now a link to My Jetpack, handled like the wizard's own exits: a plain click records the skip and then navigates, a modified click opens the link elsewhere without recording anything, and repeat clicks are ignored while the skip is being recorded. The plain-click check moves to a shared helper so the wizard and the fallback use the same one.
Set output.chunkLoadTimeout to 15 seconds in the My Jetpack webpack config, replacing the custom withLoadLimit wrapper around the wizard's lazy import. A timed-out chunk rejects with a ChunkLoadError, which the existing rejection handler already turns into the setup fallback. The setting applies to every entry in this config.
… skip Also correct the chunk timeout comment: the window shows a spinner now, not a blank page.
…ayout The theme-colored arc fell under 3:1 on the dark loading screen, so draw it in white. The connected-user note was centered and oversized; lay it out like the connect form it stands in for.
|
Nice work, @adampickering… big step up from the single connect screen, and the finish screen telling people what changed is my favorite part. I tested 1. "Get started" turns on 15 features by surprise (before the flag goes on)One click, before the WordPress.com screen even loads, switches on Blaze, Jetpack AI, Podcast, Newsletter, Notes, WooCommerce Analytics (no WooCommerce installed) and more. The wizard only shows six of them, and someone who bails on WordPress.com keeps all of it. It's Jetpack's existing default-modules behavior, not new here, but it's what this wizard should fix. get-started-turns-on-features.mp4Fix: skip default activation on the wizard's registration (filter 2. The features step doesn't really recommend anything (before merge)
store-path.mp4Fix: drop the "Already on" note, and give each site type a line saying why its top pick is there ("Stores lose sales when they're down"), or turn that type's top picks on by default. The fix for #1 makes the heading and the summary true. 3. Copy promises paid features (before merge)
Fix: something like "Brute force protection and downtime alerts", and a free feature in the art. 4. No upsell (before the flag goes on)The wizard never mentions a paid feature, and Fix: one card on the finish screen, like "Want backups and malware scanning? Here's what Jetpack Security adds.", tracked against the plans page we're dropping. Follow-ups
Thanks for pushing this through! Let me know if you have any questions. |
The switch already shows whether a module runs, and the note read as a promise that this flow would change it. The locked switch keeps its note.
The start screen promised spam handling, which needs Akismet, and the Activity Log row promised rolling back, which needs Backup.
The line under the features heading was the same for every site type with only the noun changed. Each now gives the reason for its top picks.
Downtime Monitor alerts the owner when the site goes down; it does not keep it up, so the business line now says that.
|
Thanks, Devin. The pre-merge items are in:
@adampickering, the one piece I can't fix in code is the "Restoring backup" text in the step 2 art, since it's outlined paths from the Figma export. Could you re-export it with a free feature in its place? The rest is tracked separately:
|
Get started registers the site, and Jetpack switches its default modules on as part of that. A registration from the setup wizard now keeps only Blocks and the JSON API, and the return from WordPress.com does not turn the rest on.
…rding-steps # Conflicts: # projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/test/smoke.test.tsx
The top card showed a backup restoring, which needs a paid Backup plan, on a step that only offers free features. It now shows a newsletter sending, and the card no longer reads "Restoring back backup". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwPgcEBkaFXF2eFTDsykxd
jsdom writes a centred layer as translate(0px) rather than an empty transform, so the test failed in CI though the art was centred. The test now checks for either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwPgcEBkaFXF2eFTDsykxd
Every site needs SEO, and its core tools are free. The features step now lists it third for each site type, below the two each type's line names. A registration from the wizard keeps it on along with Blocks and the JSON API. Jetpack's SEO switches itself off beside another SEO plugin, so the row is left out when jetpack_seo_conflicting_plugin names one. Otherwise the switch would claim a change that never happens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwPgcEBkaFXF2eFTDsykxd
The start step's panel shows a bigger mark with the brand's three messages taking turns under it. They hold under pointer or focus and stop once a dot is picked. The features step offers Jetpack Social and AI in place of login protection and the activity log, which now stay on when the wizard registers the site. AI follows the gate Features puts on its switch, and a feature the host hides is left out. The switches match Features, and the art's flow loops again. The finish step lists only what setup switched on, plus anything that failed, and leads to Features. The rail opens on a Site Editor style back button, and the site-type art's chart no longer stretches past its card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwPgcEBkaFXF2eFTDsykxd
The limit on Jetpack's default modules only recognised the browser coming back from WordPress.com, which usually finishes the account connection server to server. It now reads the wizard's return address from the authorize data on both paths, decoded however many times it was encoded, and requires My Jetpack's onboarding step. No option is stored and there is no time window. The wizard's connection also keeps the SEO switch and site verification on with SEO Tools, since the SEO package holds SEO Tools off without its switch, plus notifications and the backup module, which visitors never see and the features step never offers. The rail's back button reads "Dashboard" on touch screens, which never show its tooltip, and the finish screen's second link uses the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HwPgcEBkaFXF2eFTDsykxd
|
Hey @kraftbj, I pushed another round since your last review. It has the design review changes (Social and AI on the feature list, the finish goes to Features, a Site Editor style back button) and a fix to the module limit. The limit only spotted the browser coming back from WordPress.com, so now it reads the wizard's return address from the authorize data, and it keeps the SEO switch, notifications and backup on. The description is up to date. Could you take another look when you get a chance? |
Fixes #
Proposed changes
This is now the whole onboarding wizard in one PR, so it can be tested and reviewed as final code. It builds on #52765 (merged) and folds in #52844 (the animation), #52842 (tracking), #53750 (lazy loading) and #53880 (the WordPress 7.0 fix), plus the design-system changes from @simison's review. Everything is behind the
my-jetpack-onboarding-wizardflag. With the flag off, the main change is a smaller onboarding bundle, plus the build changes listed under "With the flag off" below. The wizard only runs when the Jetpack plugin is active, since the features step switches Jetpack modules. Sites with only standalone plugins keep the single connect screen.The steps
Step 2, "What's this site for?" The answer reorders the feature list. "Something else" opens a free-text field.
Step 3, the feature list. Up to seven modules: Stats, Newsletter, Jetpack Social, SEO, AI, Forms, Downtime Monitor. Each switch starts at what the site already runs, so nothing changes unless the user moves one. A module the host forces shows a locked switch, and one the host hides from My Jetpack is left out. SEO is also left out beside another SEO plugin, and AI wherever Features hides its switch. Continue waits until the module list has loaded. They're Jetpack modules, not My Jetpack feature cards: the Protect card would install the standalone Protect plugin, Downtime Monitor has no card, and modules give all of them one control with names and descriptions from Jetpack itself. Brute Force Protection and Activity Log aren't rows. When the wizard connects the site, Jetpack keeps its other default modules off for the features step to offer. The ones that stay on are blocks, the JSON API, SEO with its switch and site verification, Brute Force Protection, Activity Log, notifications and the backup module. That holds when the wizard registers the site, and again when the account connection returns to the wizard. WordPress.com usually finishes that connection server to server, so the check reads the wizard's return address from the authorize data, which both paths carry.
Step 4, the finish. It reports what each switch actually did, read back from the requests. When a switch reports a failure, the wizard reads that module back from
/jetpack/v4/module/allbefore calling it "Not changed", waiting at most 10 seconds behind a switch still in flight. A module that failed gets "Some features need another look" and says so in its own row. "Nothing changed on your site" is only for a run that moved nothing and runs nothing; otherwise it's "You're all set", with a line saying what setup switched on or off. The list under it shows only what setup switched on, plus anything that failed, and is left out when nothing was switched on. "Go to Jetpack features" leads to My Jetpack's Features page.The panel. The start step draws the Jetpack mark in, with three brand messages taking turns under it. They hold under pointer or focus, stop once a dot is picked, and don't turn under reduced motion. A "publish everywhere" composition (
everywhere.tsx) sits beside the site question and builds in once. A "data in" one (data-in.tsx) sits beside the feature list, and its flow loops by design. That loop has no pause control, so it doesn't meet WCAG 2.2.2 yet. Reduced motion gets finished frames, and the finish step has no panel.A run survives a reload. The step, answers and switches are held in sessionStorage and read back through
clampStep(), so a corrupt value can't land on a step that doesn't exist. It never reopens the finish step, and goes back to the connect step if the user is no longer connected. Every control, the module switches included, waits while modules are being switched or the user is on the way out, so nothing settles twice and no switch is moved after its request has gone out.The full-window layout is the wizard's own. The takeover styles hang off a
jetpack-onboarding-wizardbody class the wizard sets while it's open, so the single connect screen (flag off, or the fallback below) keeps trunk's styles and scrolls.Built from the design system
The switches are the
@wordpress/uiSwitch, in the same colour as the switches on Features. The green buttons get their colour from aThemeProviderseeded#008710(--jp-green-50) instead of overriding@wordpress/uiinternals. The rail head copies the Site Editor's: a compact back button to the Dashboard beside the title. Touch screens never show its tooltip, so there the button also reads "Dashboard". The rail head, the finish screen and the connected notice lay out withStack, and the finish summary is aCardrendered as a list. Continue keeps one small override for its disabled state: the generated pair is 2.7:1, and it keeps the 4.2:1 one.Loading only when the flag is on
Every site loads the onboarding bundle, flag or not, and the wizard's art alone is about 270 KB, which @kraftbj caught. The wizard now loads with
React.lazyas its ownonboarding-wizard.jschunk, only when the flag is on. With the flag off, here's what the onboarding screen loads (production build, gzipped in brackets):onboarding.jsonboarding.jsnow carries the@wordpress/uiSpinnerandLinkthe loading screen and fallback use. With the flag on,onboarding-wizard.js(533,368 B, 149,571 gzipped) andonboarding-wizard.css(23,486 B) load after it. That chunk carries the wizard, its art,@wordpress/uiand the bundled@wordpress/theme, andonboarding.asset.phpno longer depends onwp-theme.public-path.tsis the first module of the onboarding entry and sets webpack's public path from a newwebpackPublicPathinitial-state value, the way Comments and Forms do, since webpack's'auto'guess breaks when another plugin combines scripts.chunkLoadTimeout: 15000in My Jetpack's webpack config gives up on the chunk after 15 seconds instead of webpack's 120, and the fallback takes over. That timeout covers the JavaScript request only: if the JavaScript arrives butonboarding-wizard.cssor the chunk's translations hang, the spinner stays up until the browser gives up on that request.With the flag off
The screen is the same, but the build isn't quite:
bundleWpUiDeps,chunkLoadTimeoutand thesplitChunkschange apply to every entry in My Jetpack's onboarding webpack config, soheader-controls.jsandasync-notification-bubble.jsbuild differently too, not justonboarding.js.onboarding.jsnow depends onwp-jp-i18n-loader, which it uses to load the lazy chunk's translations.wp-*script, so the risk is low.WordPress 7.0
The wizard imports
ThemeProviderfrom@wordpress/theme, which the default config takes from core'swp-themescript. On WordPress 7.0 that script exports onlyprivateApis, withThemeProviderlocked inside, so the wizard threw "Element type is invalid" and the page stayed blank. 7.1 added the public export. My Jetpack now bundles@wordpress/themewithbundleWpUiDeps: true, as Boost, Protect and the Jetpack plugin already do. The webpack-config README warns against that option for entries that unlock private APIs from an externalwp-*script, and none of My Jetpack's entries do. Since the wizard is lazy-loaded, the extra code ships in its chunk, not inonboarding.js. This was already on trunk from #52765, behind the flag, thanks to @LiamSarsfield for catching it.Related product discussion/links
Does this pull request change what data or activity we track or use?
Yes, while the
my-jetpack-onboarding-wizardflag is on. Every event carries the run'sflow_idand the step's slug on top of whatuseAnalyticsalready adds.jetpack_my_jetpack_onboarding_wizard_step_viewjetpack_my_jetpack_onboarding_clickflow: 'wizard'jetpack_my_jetpack_onboarding_connect_errorerror_codejetpack_my_jetpack_onboarding_wizard_site_type_selectsite_typejetpack_my_jetpack_onboarding_wizard_site_type_detaillength_bucketjetpack_my_jetpack_onboarding_wizard_module_togglemodule,enabledjetpack_my_jetpack_onboarding_wizard_step_completejetpack_my_jetpack_onboarding_wizard_apply_resultoffered,switched_on,switched_off(both by this run only),failedjetpack_my_jetpack_onboarding_wizard_completesite_typejetpack_my_jetpack_onboarding_wizard_skipstep_viewwith no latercompleteorskipfor the sameflow_id.calypso_jpc_authorize_successon WordPress.com, which already carriesfrom: my_jetpack_onboarding(CONNECTION_FROM.myJetpackOnboarding).connect_errorstays until CONNECT-502 has the connection package record registration failures itself.nonewhere storage is blocked.None of the events are registered yet. They'll be registered once they've fired from a flag-on test site.
It also changes site state: the offered modules are switched to match what the user left the switches at, through the same activation queue the rest of My Jetpack uses.
Testing instructions
Build My Jetpack (
jp build packages/my-jetpack) and turn the flag on in a mu-plugin:Open "Jetpack → My Jetpack" on a disconnected self-hosted site with the Jetpack plugin active, in a window at least 1280px wide, with the Network tab open, and connect.
onboarding-wizard.jsandonboarding-wizard.cssload right afteronboarding.js, from the samebuild/folder.window._tkqthrough the run: oneflow_id,stepas a slug, and for "Something else" alength_bucketbut never a word of what you typed.On WordPress 7.0 (
wp core download --version=7.0 --force, with Gutenberg inactive, since it replaceswp-theme), the wizard renders and the console has no errors. On trunk the page is blank.Flag off:
onboarding-wizardfiles load.Flag on with only a standalone plugin (Boost, Protect…) and no Jetpack plugin: you get the single screen, not the wizard.
Chunk failures, with the flag on and DevTools request blocking on
onboarding-wizard.js:ChunkLoadErrortimeout in the console.jp test js packages/my-jetpackcovers the steps, the saved run, the exits, the tracking, the module read-back and the chunk fallback.public-path.tshas no unit test, since it only does something when a browser loads the wizard's chunk, which the steps above check. That's why this PR has the "Covered by non-unit tests" label.