Skip to content

Launch Site Flow Standardization: Add WP Admin masterbar variations#47705

Open
zaguiini wants to merge 12 commits intotrunkfrom
datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point
Open

Launch Site Flow Standardization: Add WP Admin masterbar variations#47705
zaguiini wants to merge 12 commits intotrunkfrom
datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point

Conversation

@zaguiini
Copy link
Copy Markdown
Contributor

@zaguiini zaguiini commented Mar 20, 2026

Fixes DATSCI-1168

Proposed changes

This PR standardizes the "Launch site" flow for the WP Admin masterbar entry point, under a calypso_standardized_site_launch_gating ExPlat experiment.

Control (experiment not assigned): The existing behaviour — clicking "Launch site" in the masterbar redirects to wordpress.com/start/launch-site.

Treatment (ungated_site_launch variation): The launch is performed directly from WP Admin without a redirect:

  • For Simple sites: calls POST /sites/{blog_id}/launch directly via wpcom-proxy-request
  • For Atomic sites: calls a new local proxy endpoint POST /wpcom/v2/launch-site, which tunnels the request to WPCOM via the Jetpack connection
  • On success, shows the CelebrateLaunchModal in place

Shared infrastructure added for future use:

  • useLaunchSiteMutation hook extracted to common/hooks/ so the Reading Settings "Launch site" CTA can reuse it in a follow-up PR
  • CelebrateLaunchModal moved from wpcom-dashboard-widgets/celebrate-launch/ to common/ since it is now used in multiple entry points
  • JetpackScriptData.site.wpcom.blog_id populated on admin pages via a new jetpack_admin_js_script_data filter, so Simple sites have the blog ID available client-side

Other information

  • Generate changelog entries for this PR (using AI).

Related product discussion/links

DATSCI-1168

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Prerequisites: An unlaunched Simple or Atomic site, assigned to the ungated_site_launch variation of the calypso_standardized_site_launch_gating ExPlat experiment.

Simple site (treatment):

  1. Go to WP Admin on an unlaunched Simple site
  2. Confirm the "Launch site" button is visible in the masterbar
  3. Click "Launch site"
  4. Verify no redirect occurs — the site launches in place and the celebration modal appears
  5. Confirm the modal shows the correct domain, plan upsell, and "View site" link

Atomic site (treatment):

  1. Repeat the above steps on an unlaunched Atomic (WoA) site
  2. Verify the launch is proxied correctly through /wpcom/v2/launch-site and the celebration modal appears

Control (no experiment assignment):

  1. On an unlaunched site without the experiment variation
  2. Click "Launch site" — confirm it redirects to wordpress.com/start/launch-site as before

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point
bin/jetpack-downloader test jetpack-mu-wpcom-plugin datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Mar 20, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Mar 20, 2026

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/features/launch-button/index.php 0/70 (0.00%) 0.00% 17 💔
projects/packages/explat/src/class-rest-controller.php 0/62 (0.00%) 0.00% 5 💔
projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php 0/356 (0.00%) 0.00% 5 💔

1 file is newly checked for coverage.

File Coverage
projects/packages/jetpack-mu-wpcom/src/features/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-jetpack-launch-site.php 0/35 (0.00%) 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@zaguiini zaguiini force-pushed the datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point branch from 6842dac to 7ca320c Compare March 20, 2026 21:54
@zaguiini zaguiini changed the title Launch Site Flow Standardization: Add WP Admin variations Launch Site Flow Standardization: Add WP Admin masterbar variations Mar 21, 2026
*/
function wpcom_enqueue_launch_button_styles() {
if ( ! current_user_can( 'manage_options' ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is a context check, not a form submission.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were rendering the masterbar while loading the preview and that was assigning the user unintentionally. This snippet prevents loading the scripts twice.

zaguiini and others added 12 commits March 28, 2026 01:09
…P Admin masterbar

Adds the actual API call to the Launch site button for both Simple sites
(via wpcom-proxy-request) and Atomic sites (via a new /wpcom/v2/launch-site
proxy endpoint that tunnels through the Jetpack connection). Also populates
JetpackScriptData.site.wpcom.blog_id for Atomic so the Simple site path has
the correct blog ID available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_Site class declaration

Guard the class with class_exists() to prevent a fatal redeclaration conflict
when the same class is already loaded from WPCOM core's rest-api-plugins on Simple sites.
…aunch_Site

Rename WPCOM_REST_API_V2_Endpoint_Launch_Site to
WPCOM_REST_API_V2_Endpoint_Jetpack_Launch_Site to avoid a fatal conflict
with the identically named class in WPCOM core's rest-api-plugins.
…ton/index.php

Enqueue site data (siteUrl, siteDomain, sitePlan, hasCustomDomain) as an inline
script in the launch button enqueue hook, so CelebrateLaunchModal has the data
it needs regardless of whether the user is on the dashboard page.
…com/v2

- Switch from as_blog to as_user to allow user-level launch action
Moves the mutation logic out of LaunchButton into a reusable
useLaunchSiteMutation hook in common/hooks, so it can be shared
with the upcoming Reading Settings launch flow.
The modal is now used by both the masterbar launch button and the
dashboard widgets, so it belongs in common/ rather than scoped
to wpcom-dashboard-widgets.
@bogiii bogiii force-pushed the datsci-1168-standardize-site-launch-wp-admin-masterbar-entry-point branch from a199c66 to ae53c8e Compare March 28, 2026 00:11
@bogiii bogiii requested a review from a team March 28, 2026 00:12
@bogiii bogiii marked this pull request as ready for review March 28, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants