Launch Site Flow Standardization: Add WP Admin masterbar variations#47705
Launch Site Flow Standardization: Add WP Admin masterbar variations#47705
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 3 files.
1 file is newly checked for coverage.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
6842dac to
7ca320c
Compare
| */ | ||
| 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. |
There was a problem hiding this comment.
We were rendering the masterbar while loading the preview and that was assigning the user unintentionally. This snippet prevents loading the scripts twice.
projects/packages/jetpack-mu-wpcom/src/features/launch-button/launch-button.js
Outdated
Show resolved
Hide resolved
…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.
a199c66 to
ae53c8e
Compare
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_gatingExPlat experiment.Control (experiment not assigned): The existing behaviour — clicking "Launch site" in the masterbar redirects to
wordpress.com/start/launch-site.Treatment (
ungated_site_launchvariation): The launch is performed directly from WP Admin without a redirect:POST /sites/{blog_id}/launchdirectly viawpcom-proxy-requestPOST /wpcom/v2/launch-site, which tunnels the request to WPCOM via the Jetpack connectionCelebrateLaunchModalin placeShared infrastructure added for future use:
useLaunchSiteMutationhook extracted tocommon/hooks/so the Reading Settings "Launch site" CTA can reuse it in a follow-up PRCelebrateLaunchModalmoved fromwpcom-dashboard-widgets/celebrate-launch/tocommon/since it is now used in multiple entry pointsJetpackScriptData.site.wpcom.blog_idpopulated on admin pages via a newjetpack_admin_js_script_datafilter, so Simple sites have the blog ID available client-sideOther information
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_launchvariation of thecalypso_standardized_site_launch_gatingExPlat experiment.Simple site (treatment):
Atomic site (treatment):
/wpcom/v2/launch-siteand the celebration modal appearsControl (no experiment assignment):
wordpress.com/start/launch-siteas before