From cd86cc66737c1283395aff2590e112b9e5436c44 Mon Sep 17 00:00:00 2001 From: Jasper Kang Date: Tue, 15 Oct 2024 14:37:41 +1300 Subject: [PATCH] JITM: Remove JITM from Jetpack Stats dashboard (Preparation to use embedded JITM) (#39714) * expose functiont to render JITM and jitm env for stats * changelog * fix typo * rever formatting * pass jitm pass to stats admin * ver and minify * ver and minify * ensure it has an option to return early * revert unnecessary chagnes * use cache buster as jitm version * add comments * revert changes * revert changes * Delete projects/packages/jitm/changelog/update-integration-jitm-in-stats --- .../changelog/update-integration-jitm-in-stats | 4 ++++ projects/packages/stats-admin/src/class-main.php | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 projects/packages/stats-admin/changelog/update-integration-jitm-in-stats diff --git a/projects/packages/stats-admin/changelog/update-integration-jitm-in-stats b/projects/packages/stats-admin/changelog/update-integration-jitm-in-stats new file mode 100644 index 0000000000000..d9779842c1cc7 --- /dev/null +++ b/projects/packages/stats-admin/changelog/update-integration-jitm-in-stats @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +JITM: expose function to render message diff --git a/projects/packages/stats-admin/src/class-main.php b/projects/packages/stats-admin/src/class-main.php index 596b1d0608b15..66b53734e7b71 100644 --- a/projects/packages/stats-admin/src/class-main.php +++ b/projects/packages/stats-admin/src/class-main.php @@ -52,6 +52,19 @@ public static function init() { */ private function __construct() { add_action( 'rest_api_init', array( new REST_Controller(), 'register_rest_routes' ) ); + // Disable JITM assets on the Stats page. + // JITM is handled separately by Stats: https://github.com/Automattic/wp-calypso/pull/95273. + add_filter( + 'jetpack_display_jitms_on_screen', + function ( $show, $screen_id ) { + if ( 'jetpack_page_stats' === $screen_id ) { + return false; + } + return $show; + }, + 10, + 2 + ); } /**