diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd08d9459f7c..79edc9497aed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4329,76 +4329,6 @@ importers: projects/packages/stats-admin: {} - projects/packages/subscribers-dashboard: - dependencies: - '@automattic/babel-plugin-replace-textdomain': - specifier: workspace:* - version: link:../../js-packages/babel-plugin-replace-textdomain - '@wordpress/data': - specifier: 10.44.0 - version: 10.44.0(react@18.3.1) - '@wordpress/dataviews': - specifier: 14.1.0 - version: 14.1.0(react@18.3.1) - '@wordpress/element': - specifier: 6.44.0 - version: 6.44.0 - '@wordpress/i18n': - specifier: 6.17.0 - version: 6.17.0 - '@wordpress/url': - specifier: 4.44.0 - version: 4.44.0 - devDependencies: - '@automattic/jetpack-webpack-config': - specifier: workspace:* - version: link:../../js-packages/webpack-config - '@babel/core': - specifier: 7.29.0 - version: 7.29.0 - '@babel/preset-env': - specifier: 7.29.2 - version: 7.29.2(@babel/core@7.29.0) - '@testing-library/dom': - specifier: 10.4.1 - version: 10.4.1 - '@testing-library/jest-dom': - specifier: 6.9.1 - version: 6.9.1 - '@testing-library/react': - specifier: 16.3.2 - version: 16.3.2(@testing-library/dom@10.4.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/jest': - specifier: 30.0.0 - version: 30.0.0 - '@typescript/native-preview': - specifier: 7.0.0-dev.20260225.1 - version: 7.0.0-dev.20260225.1 - concurrently: - specifier: 9.2.1 - version: 9.2.1 - jest: - specifier: 30.3.0 - version: 30.3.0 - react: - specifier: 18.3.1 - version: 18.3.1 - react-dom: - specifier: 18.3.1 - version: 18.3.1(react@18.3.1) - sass-embedded: - specifier: 1.97.3 - version: 1.97.3 - sass-loader: - specifier: 16.0.5 - version: 16.0.5(sass-embedded@1.97.3)(webpack@5.105.2) - webpack: - specifier: 5.105.2 - version: 5.105.2(webpack-cli@6.0.1) - webpack-cli: - specifier: 6.0.1 - version: 6.0.1(webpack@5.105.2) - projects/packages/transport-helper: {} projects/packages/videopress: diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-newsletter-modernization-retire-subscribers-menu b/projects/packages/jetpack-mu-wpcom/changelog/update-newsletter-modernization-retire-subscribers-menu new file mode 100644 index 000000000000..36fa9521b82e --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-newsletter-modernization-retire-subscribers-menu @@ -0,0 +1,3 @@ +Significance: patch +Type: changed +Comment: Drop the standalone "Jetpack > Subscribers" submenu and the Calypso shortcut; the Newsletter page now owns the Subscribers tab. diff --git a/projects/packages/jetpack-mu-wpcom/composer.json b/projects/packages/jetpack-mu-wpcom/composer.json index 6da6a23e1ef0..3a38b2c21390 100644 --- a/projects/packages/jetpack-mu-wpcom/composer.json +++ b/projects/packages/jetpack-mu-wpcom/composer.json @@ -22,7 +22,6 @@ "automattic/jetpack-rtc": "@dev", "automattic/jetpack-stats-admin": "@dev", "automattic/jetpack-status": "@dev", - "automattic/jetpack-subscribers-dashboard": "@dev", "automattic/scheduled-updates": "@dev", "scssphp/scssphp": "2.1.0", "symfony/filesystem": "^6.0.0", diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-menu/wpcom-admin-menu.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-menu/wpcom-admin-menu.php index 38aad8eab7da..e7c5ad9159da 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-menu/wpcom-admin-menu.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-menu/wpcom-admin-menu.php @@ -11,7 +11,6 @@ use Automattic\Jetpack\Newsletter\Settings as Newsletter_Settings; use Automattic\Jetpack\Podcast\Admin_Page as Podcast_Admin_Page; use Automattic\Jetpack\Redirect; -use Automattic\Jetpack\Subscribers_Dashboard\Dashboard as Subscribers_Dashboard; require_once __DIR__ . '/../../common/wpcom-callout.php'; @@ -386,21 +385,11 @@ function () { null // @phan-suppress-current-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539. ); - // Jetpack > Subscribers. - if ( ! apply_filters( 'jetpack_wp_admin_subscriber_management_enabled', false ) ) { - wpcom_hide_submenu_page( 'jetpack', esc_url( Redirect::get_url( 'jetpack-menu-jetpack-manage-subscribers', array( 'site' => $blog_id ) ) ) ); - add_submenu_page( - 'jetpack', - __( 'Subscribers', 'jetpack-mu-wpcom' ), - __( 'Subscribers', 'jetpack-mu-wpcom' ), - 'manage_options', - 'https://wordpress.com/subscribers/' . $domain, - null // @phan-suppress-current-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539. - ); - } else { - $subscribers_dashboard = new Subscribers_Dashboard(); - $subscribers_dashboard->add_wp_admin_submenu(); - } + // "Jetpack > Subscribers" / standalone "Subscribers" wp-admin pages were + // retired alongside the Newsletter modernization umbrella (#48530); the + // Newsletter page now owns the Subscribers tab. Keep the Calypso link + // hidden in case some other layer adds it back. + wpcom_hide_submenu_page( 'jetpack', esc_url( Redirect::get_url( 'jetpack-menu-jetpack-manage-subscribers', array( 'site' => $blog_id ) ) ) ); // When the `jetpack_podcast_untangle` filter is on, register the new // "Jetpack > Podcast" in-admin page from the jetpack-podcast package. @@ -464,7 +453,6 @@ function () { 'forms', 'earn', 'search', - 'subscribers', 'newsletter', 'jetpack-podcast', 'podcasting', diff --git a/projects/packages/masterbar/changelog/update-drop-subscribers-dashboard-dep b/projects/packages/masterbar/changelog/update-drop-subscribers-dashboard-dep new file mode 100644 index 000000000000..ec38fa31449a --- /dev/null +++ b/projects/packages/masterbar/changelog/update-drop-subscribers-dashboard-dep @@ -0,0 +1,3 @@ +Significance: patch +Type: removed +Comment: Drop the unused `automattic/jetpack-subscribers-dashboard` composer dep. diff --git a/projects/packages/masterbar/composer.json b/projects/packages/masterbar/composer.json index 968e89e09ba2..e129b167ed1d 100644 --- a/projects/packages/masterbar/composer.json +++ b/projects/packages/masterbar/composer.json @@ -13,8 +13,7 @@ "automattic/jetpack-jitm": "@dev", "automattic/jetpack-logo": "@dev", "automattic/jetpack-plans": "@dev", - "automattic/jetpack-status": "@dev", - "automattic/jetpack-subscribers-dashboard": "@dev" + "automattic/jetpack-status": "@dev" }, "require-dev": { "brain/monkey": "^2.6.2", diff --git a/projects/packages/newsletter/_inc/components/newsletter-page.tsx b/projects/packages/newsletter/_inc/components/newsletter-page.tsx index d456d16112bd..16f11763e3dd 100644 --- a/projects/packages/newsletter/_inc/components/newsletter-page.tsx +++ b/projects/packages/newsletter/_inc/components/newsletter-page.tsx @@ -1,4 +1,6 @@ +import analytics from '@automattic/jetpack-analytics'; import JetpackLogo from '@automattic/jetpack-components/jetpack-logo'; +import { getSiteType } from '@automattic/jetpack-script-data'; import { Page } from '@wordpress/admin-ui'; import { useCallback } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; @@ -77,6 +79,12 @@ export default function NewsletterPage( { if ( next !== 'subscribers' && next !== 'settings' ) { return; } + if ( next !== activeTab ) { + analytics.tracks.recordEvent( 'jetpack_newsletter_tab_view', { + site_type: getSiteType(), + tab: next, + } ); + } navigate( { search: { tab: next === 'settings' ? 'settings' : undefined, @@ -85,7 +93,7 @@ export default function NewsletterPage( { }, } as unknown as Parameters< typeof navigate >[ 0 ] ); }, - [ navigate ] + [ activeTab, navigate ] ); const contentClass = contentHasPadding diff --git a/projects/packages/newsletter/changelog/add-wp-build-flip-flag b/projects/packages/newsletter/changelog/add-wp-build-flip-flag new file mode 100644 index 000000000000..32309d895b10 --- /dev/null +++ b/projects/packages/newsletter/changelog/add-wp-build-flip-flag @@ -0,0 +1,3 @@ +Significance: minor +Type: changed +Comment: The Newsletter admin page now ships the unified Subscribers/Settings chassis by default; opt out with `add_filter( 'rsm_jetpack_ui_modernization_newsletter', '__return_false' );`. diff --git a/projects/packages/newsletter/src/class-settings.php b/projects/packages/newsletter/src/class-settings.php index bc78d8a5118d..6520d647456c 100644 --- a/projects/packages/newsletter/src/class-settings.php +++ b/projects/packages/newsletter/src/class-settings.php @@ -284,9 +284,14 @@ public function load_admin_scripts() { // This callback is registered via `admin_enqueue_scripts` from `admin_init`, // which itself fires on `load-{$page_suffix}` in `add_wp_admin_menu()` — so it // only fires on the Newsletter admin page; no need to re-check the page here. + // The Tracks transport is required on both surfaces — `analytics.initialize` + // only queues events into `window._tkq`; without `jp-tracks` loaded, no + // pixel.gif requests fire and the queue grows forever. + wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true ); + if ( self::is_modernized() ) { - // wp-build manages its own enqueue pipeline. The legacy newsletter - // script, JetpackScriptData, and Tracks are intentionally skipped + // wp-build manages the rest of its enqueue pipeline. The legacy + // newsletter script and JetpackScriptData are intentionally skipped // for the wp-build dashboard. return; } @@ -302,9 +307,6 @@ public function load_admin_scripts() { 'dependencies' => array( 'jetpack-script-data' ), ) ); - - // Enqueue the Tracks script for analytics. - wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true ); } /** @@ -472,10 +474,15 @@ public static function alias_screen_id_for_wp_build( $screen ) { /** * Returns true when the wp-build modernization filter is enabled. * + * Default `true` since PR 6 of the Newsletter modernization rollout + * (umbrella #48530): every Jetpack site now lands on the unified + * Subscribers/Settings chassis. Sites that need the legacy AdminPage + * surface back can opt out with `add_filter( self::MODERNIZATION_FILTER, '__return_false' );`. + * * @return bool */ private static function is_modernized() { - return (bool) apply_filters( self::MODERNIZATION_FILTER, false ); + return (bool) apply_filters( self::MODERNIZATION_FILTER, true ); } /** diff --git a/projects/packages/subscribers-dashboard/.babelrc b/projects/packages/subscribers-dashboard/.babelrc deleted file mode 100644 index cf088480ee9f..000000000000 --- a/projects/packages/subscribers-dashboard/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { - "targets": { - "node": "current" - } - }] - ] -} diff --git a/projects/packages/subscribers-dashboard/.gitattributes b/projects/packages/subscribers-dashboard/.gitattributes deleted file mode 100644 index afdd8495427b..000000000000 --- a/projects/packages/subscribers-dashboard/.gitattributes +++ /dev/null @@ -1,20 +0,0 @@ -# Files not needed to be distributed in the package. -.gitattributes export-ignore -.github/ export-ignore -package.json export-ignore - -# Files to include in the mirror repo, but excluded via gitignore -# Remember to end all directories with `/**` to properly tag every file. -# /src/js/example.min.js production-include -/build/** production-include - - -# Files to exclude from the mirror repo, but included in the monorepo. -# Remember to end all directories with `/**` to properly tag every file. -.gitignore production-exclude -changelog/** production-exclude -.phpcs.dir.xml production-exclude -tests/** production-exclude -_inc/*.scss production-exclude -_inc/*.jsx production-exclude -_inc/*.tsx production-exclude diff --git a/projects/packages/subscribers-dashboard/.gitignore b/projects/packages/subscribers-dashboard/.gitignore deleted file mode 100644 index 77b928272c4a..000000000000 --- a/projects/packages/subscribers-dashboard/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -vendor/ -node_modules/ -build/ -.cache/ -wordpress diff --git a/projects/packages/subscribers-dashboard/.phan/config.php b/projects/packages/subscribers-dashboard/.phan/config.php deleted file mode 100644 index a04dc8a20fcf..000000000000 --- a/projects/packages/subscribers-dashboard/.phan/config.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/projects/packages/subscribers-dashboard/CHANGELOG.md b/projects/packages/subscribers-dashboard/CHANGELOG.md deleted file mode 100644 index ce03deaaad9d..000000000000 --- a/projects/packages/subscribers-dashboard/CHANGELOG.md +++ /dev/null @@ -1,266 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## 0.5.5 - 2026-05-04 -### Changed -- Internal: No longer require automattic/jetpack-changelogger as a per-project dev dependency. [#48225] - -## 0.5.4 - 2026-04-20 -### Changed -- Update package dependencies. [#48106] [#48141] - -## 0.5.3 - 2026-04-15 -### Changed -- Update package dependencies. [#47907] - -## 0.5.2 - 2026-04-09 -### Changed -- Update package dependencies. [#47890] [#47998] - -## 0.5.1 - 2026-04-06 -### Changed -- Internal updates. - -## 0.5.0 - 2026-03-30 -### Changed -- Update DataViews dependency. [#46973] -- Update package dependencies. [#47799] - -## 0.4.23 - 2026-03-23 -### Changed -- Update package dependencies. [#47684] - -## 0.4.22 - 2026-03-16 -### Changed -- Update dependencies. [#47472] - -## 0.4.21 - 2026-03-09 -### Changed -- Switch to Native TypeScript compiler based on Go. [#47375] -- Update package dependencies. [#47496] - -## 0.4.20 - 2026-02-26 -### Changed -- Update package dependencies. [#47300] - -## 0.4.19 - 2026-02-23 -### Changed -- Update package dependencies. [#47173] - -## 0.4.18 - 2026-02-16 -### Changed -- Update package dependencies. [#47099] - -## 0.4.17 - 2026-02-10 -### Changed -- Update package dependencies. [#47002] - -## 0.4.16 - 2026-02-02 -### Changed -- Update package dependencies. [#46430] [#46853] [#46854] - -## 0.4.15 - 2026-01-26 -### Changed -- Update dependencies. [#46383] - -## 0.4.14 - 2026-01-19 -### Changed -- Update package dependencies. [#46552] [#46647] - -## 0.4.13 - 2026-01-09 -### Changed -- Update package dependencies. [#46456] - -## 0.4.12 - 2025-12-22 -### Changed -- Update dependencies. [#46381] - -## 0.4.11 - 2025-12-15 -### Changed -- Update dependencies. [#46271] - -## 0.4.10 - 2025-12-08 -### Changed -- Update package dependencies. [#45914] - -## 0.4.9 - 2025-12-01 -### Changed -- Update package dependencies. [#46143] - -## 0.4.8 - 2025-11-24 -### Changed -- Internal updates. - -## 0.4.7 - 2025-11-17 -### Changed -- Update package dependencies. [#45915] [#45958] - -## 0.4.6 - 2025-11-10 -### Changed -- Update package dependencies. [#45735] [#45756] - -## 0.4.5 - 2025-11-03 -### Changed -- Update package dependencies. [#45652] - -## 0.4.4 - 2025-10-27 -### Changed -- Update package dependencies. [#45551] - -## 0.4.3 - 2025-10-10 -### Changed -- Update package dependencies. [#45428] - -## 0.4.2 - 2025-10-06 -### Changed -- Update package dependencies. [#45334] - -## 0.4.1 - 2025-09-22 -### Changed -- Update dependencies. [#44940] - -## 0.4.0 - 2025-09-19 -### Changed -- Update @wordpress/dataviews package from v7 to v9. [#45213] -- Update package dependencies. [#45173] [#45229] - -## 0.3.0 - 2025-09-08 -### Changed -- Update @wordpress/dataviews package v5.0.0 → v7.0.0 [#45012] -- Update package dependencies. [#45027] [#45097] - -## 0.2.5 - 2025-09-01 -### Changed -- Remove unused JavaScript dependencies. [#44813] - -### Fixed -- Restore dependency removed in #44813. [#44968] - -## 0.2.4 - 2025-08-25 -### Changed -- Update dependencies. [#44934] - -## 0.2.3 - 2025-08-18 -### Added -- Add `typecheck` script to ensure that TypeScript files are type-checked. [#44795] - -## 0.2.2 - 2025-08-14 -### Changed -- Update package dependencies. [#44701] - -## 0.2.1 - 2025-08-11 -### Changed -- Update dependencies. [#44673] -- Update package dependencies. [#44677] - -## 0.2.0 - 2025-08-04 -### Changed -- Update @wordpress/dataviews to 5.0.0. [#44376] -- Update dependencies. [#44551] - -## 0.1.24 - 2025-07-28 -### Changed -- Update dependencies. [#44432] - -## 0.1.23 - 2025-07-21 -### Changed -- Update package dependencies. [#44356] - -## 0.1.22 - 2025-07-14 -### Changed -- Update package dependencies. [#44217] [#44219] - -## 0.1.21 - 2025-07-07 -### Changed -- Update dependencies. [#44161] -- Update package dependencies. [#44148] [#44151] - -## 0.1.20 - 2025-06-30 -### Changed -- Update dependencies. [#43971] - -## 0.1.19 - 2025-06-24 -### Changed -- Update dependencies. [#43971] - -## 0.1.18 - 2025-06-23 -### Changed -- Update package dependencies. [#44020] - -## 0.1.17 - 2025-06-16 -### Changed -- Update dependencies. [#43878] -- Update package dependencies. [#43892] [#43951] - -## 0.1.16 - 2025-06-09 -### Changed -- Internal updates. - -## 0.1.15 - 2025-06-05 -### Changed -- Update package dependencies. [#43766] - -## 0.1.14 - 2025-06-03 -### Changed -- Update package dependencies. [#43718] [#43734] - -## 0.1.13 - 2025-06-02 -### Changed -- Update package dependencies. [#43711] [#43712] - -## 0.1.12 - 2025-05-26 -### Changed -- Update dependencies. [#43569] [#43578] - -## 0.1.11 - 2025-05-19 -### Changed -- Update package dependencies. [#43398] - -## 0.1.10 - 2025-05-12 -### Changed -- Stable release management: Do not ship source files. [#43310] -- Update package dependencies. [#43400] - -## 0.1.9 - 2025-05-05 -### Changed -- Update package dependencies. [#43326] [#43355] [#43356] - -## 0.1.8 - 2025-04-28 -### Fixed -- My Jetpack: Fix TypeScript type checking and the corresponding errors. [#43205] - -## 0.1.7 - 2025-04-14 -### Changed -- Update dependencies. [#43001] - -## 0.1.6 - 2025-04-07 -### Changed -- Linting: First pass of style coding standards. [#42734] - -## 0.1.5 - 2025-04-04 -### Changed -- Update package dependencies. [#42806] - -## 0.1.4 - 2025-04-02 -### Changed -- Update package dependencies. [#42762] [#42809] - -## 0.1.3 - 2025-03-31 -### Changed -- Update dependencies. [#42678] - -## 0.1.2 - 2025-03-24 -### Changed -- Update dependencies. [#42564] - -## 0.1.1 - 2025-03-18 -### Changed -- Update package dependencies. [#42506] [#42509] [#42511] - -## 0.1.0 - 2025-03-17 -### Added -- Initialize package. [#42066] diff --git a/projects/packages/subscribers-dashboard/_inc/admin.jsx b/projects/packages/subscribers-dashboard/_inc/admin.jsx deleted file mode 100644 index 208ebcb8affb..000000000000 --- a/projects/packages/subscribers-dashboard/_inc/admin.jsx +++ /dev/null @@ -1,24 +0,0 @@ -/** - * External dependencies - */ -import { createRoot } from '@wordpress/element'; -import { __ } from '@wordpress/i18n'; - -import './style.module.scss'; - -export const JetpackSubscribers = () => { - return { __( 'Hello world!', 'jetpack-subscribers-dashboard' ) }; -}; - -/** - * The initial renderer function. - */ -async function render() { - const container = document.getElementById( 'jetpack-subscribers-dashboard' ); - if ( null === container ) { - return; - } - createRoot( container ).render( ); -} - -render(); diff --git a/projects/packages/subscribers-dashboard/_inc/style.module.scss b/projects/packages/subscribers-dashboard/_inc/style.module.scss deleted file mode 100644 index d6e8c5214512..000000000000 --- a/projects/packages/subscribers-dashboard/_inc/style.module.scss +++ /dev/null @@ -1,6 +0,0 @@ -:global { - - #jetpack-subscribers { - display: block; - } -} diff --git a/projects/packages/subscribers-dashboard/_inc/test/admin.tsx b/projects/packages/subscribers-dashboard/_inc/test/admin.tsx deleted file mode 100644 index 8996c19eb615..000000000000 --- a/projects/packages/subscribers-dashboard/_inc/test/admin.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import '@testing-library/jest-dom'; -import { render, screen } from '@testing-library/react'; -import { JetpackSubscribers } from '../admin'; - -describe( 'JetpackSubscribers', () => { - describe( 'Renders as expected', () => { - const setup = () => { - return render( ); - }; - it( 'renders hello world', () => { - setup(); - expect( screen.getByText( 'Hello world!' ) ).toBeInTheDocument(); - } ); - } ); -} ); diff --git a/projects/packages/subscribers-dashboard/changelog/.gitkeep b/projects/packages/subscribers-dashboard/changelog/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/projects/packages/subscribers-dashboard/composer.json b/projects/packages/subscribers-dashboard/composer.json deleted file mode 100644 index 94aba0f6b8a5..000000000000 --- a/projects/packages/subscribers-dashboard/composer.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "automattic/jetpack-subscribers-dashboard", - "description": "Subscribers dashboard", - "type": "jetpack-library", - "license": "GPL-2.0-or-later", - "require": { - "php": ">=7.2", - "automattic/jetpack-connection": "@dev", - "automattic/jetpack-constants": "@dev", - "automattic/jetpack-plans": "@dev", - "automattic/jetpack-stats": "@dev", - "automattic/jetpack-status": "@dev", - "automattic/jetpack-jitm": "@dev" - }, - "require-dev": { - "yoast/phpunit-polyfills": "^4.0.0", - "automattic/jetpack-test-environment": "@dev", - "automattic/phpunit-select-config": "@dev" - }, - "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "scripts": { - "phpunit": [ - "phpunit-select-config phpunit.#.xml.dist --colors=always" - ], - "test-coverage": "pnpm concurrently --names php,js 'php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"$COVERAGE_DIR/php.cov\"' 'pnpm:test-coverage'", - "test-php": [ - "@composer phpunit" - ], - "test-js": [ - "pnpm run test" - ], - "test-js-watch": [ - "Composer\\Config::disableProcessTimeout", - "pnpm run test --watch" - ], - "build-development": [ - "pnpm run build" - ], - "build-production": [ - "NODE_ENV=production pnpm run build" - ], - "watch": [ - "Composer\\Config::disableProcessTimeout", - "pnpm run watch" - ] - }, - "repositories": [ - { - "type": "path", - "url": "../../packages/*", - "options": { - "monorepo": true - } - } - ], - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "autotagger": true, - "mirror-repo": "Automattic/jetpack-subscribers-dashboard", - "branch-alias": { - "dev-trunk": "0.5.x-dev" - }, - "textdomain": "jetpack-subscribers-dashboard", - "version-constants": { - "::VERSION": "src/class-dashboard.php" - } - }, - "config": { - "allow-plugins": { - "roots/wordpress-core-installer": true - } - } -} diff --git a/projects/packages/subscribers-dashboard/package.json b/projects/packages/subscribers-dashboard/package.json deleted file mode 100644 index de802261c936..000000000000 --- a/projects/packages/subscribers-dashboard/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@automattic/jetpack-subscribers-dashboard", - "version": "0.5.5", - "private": true, - "description": "WP Admin page to manage subscribers", - "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/subscribers-dashboard/#readme", - "bugs": { - "url": "https://github.com/Automattic/jetpack/labels/[Package] Subscribers Dashboard" - }, - "repository": { - "type": "git", - "url": "https://github.com/Automattic/jetpack.git", - "directory": "projects/packages/subscribers-dashboard" - }, - "license": "GPL-2.0-or-later", - "author": "Automattic", - "sideEffects": [ - "*.css", - "*.scss" - ], - "exports": { - "./components/*": "./_inc/components/*" - }, - "scripts": { - "build": "pnpm run clean && pnpm run build-client", - "build-client": "pnpm webpack --config webpack.config.js", - "build-js": "webpack --config webpack.config.js", - "build-production": "pnpm run clean && pnpm run build-production-js && pnpm run validate", - "build-production-js": "NODE_ENV=production BABEL_ENV=production pnpm run build-js", - "clean": "rm -rf build/", - "test": "jest --config=tests/jest.config.js", - "test-coverage": "pnpm run test --coverage", - "typecheck": "tsgo --noEmit", - "validate": "pnpm exec validate-es build/", - "watch": "pnpm run build && pnpm webpack watch" - }, - "dependencies": { - "@automattic/babel-plugin-replace-textdomain": "workspace:*", - "@wordpress/data": "10.44.0", - "@wordpress/dataviews": "14.1.0", - "@wordpress/element": "6.44.0", - "@wordpress/i18n": "6.17.0", - "@wordpress/url": "4.44.0" - }, - "devDependencies": { - "@automattic/jetpack-webpack-config": "workspace:*", - "@babel/core": "7.29.0", - "@babel/preset-env": "7.29.2", - "@testing-library/dom": "10.4.1", - "@testing-library/jest-dom": "6.9.1", - "@testing-library/react": "16.3.2", - "@types/jest": "30.0.0", - "@typescript/native-preview": "7.0.0-dev.20260225.1", - "concurrently": "9.2.1", - "jest": "30.3.0", - "react": "18.3.1", - "react-dom": "18.3.1", - "sass-embedded": "1.97.3", - "sass-loader": "16.0.5", - "webpack": "5.105.2", - "webpack-cli": "6.0.1" - } -} diff --git a/projects/packages/subscribers-dashboard/phpunit.11.xml.dist b/projects/packages/subscribers-dashboard/phpunit.11.xml.dist deleted file mode 100644 index f7418373829b..000000000000 --- a/projects/packages/subscribers-dashboard/phpunit.11.xml.dist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - tests/php - - - - - - - - src - - - - - diff --git a/projects/packages/subscribers-dashboard/phpunit.12.xml.dist b/projects/packages/subscribers-dashboard/phpunit.12.xml.dist deleted file mode 120000 index 9fdb7a2c745c..000000000000 --- a/projects/packages/subscribers-dashboard/phpunit.12.xml.dist +++ /dev/null @@ -1 +0,0 @@ -phpunit.11.xml.dist \ No newline at end of file diff --git a/projects/packages/subscribers-dashboard/phpunit.8.xml.dist b/projects/packages/subscribers-dashboard/phpunit.8.xml.dist deleted file mode 120000 index 707bde67863c..000000000000 --- a/projects/packages/subscribers-dashboard/phpunit.8.xml.dist +++ /dev/null @@ -1 +0,0 @@ -phpunit.9.xml.dist \ No newline at end of file diff --git a/projects/packages/subscribers-dashboard/phpunit.9.xml.dist b/projects/packages/subscribers-dashboard/phpunit.9.xml.dist deleted file mode 100644 index 3965963c485e..000000000000 --- a/projects/packages/subscribers-dashboard/phpunit.9.xml.dist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - tests/php - - - diff --git a/projects/packages/subscribers-dashboard/src/class-dashboard.php b/projects/packages/subscribers-dashboard/src/class-dashboard.php deleted file mode 100644 index 62236c88d149..000000000000 --- a/projects/packages/subscribers-dashboard/src/class-dashboard.php +++ /dev/null @@ -1,120 +0,0 @@ -init_hooks(); - } - } - - /** - * Initialize the hooks. - */ - public function init_hooks() { - self::$initialized = true; - // Jetpack uses 998 and 'Admin_Menu' uses 1000. - add_action( 'admin_menu', array( $this, 'add_wp_admin_submenu' ), $this->menu_priority ); - } - - /** - * The page to be added to submenu - */ - public function add_wp_admin_submenu() { - if ( ! apply_filters( 'jetpack_wp_admin_subscriber_management_enabled', false ) || self::$menu_added ) { - return; - } - - $page_suffix = null; - if ( ( new Host() )->is_wpcom_platform() ) { - $page_suffix = add_submenu_page( 'users.php', __( 'Subscribers', 'jetpack-subscribers-dashboard' ), __( 'Subscribers', 'jetpack-subscribers-dashboard' ), 'manage_options', 'subscribers', array( $this, 'render' ) ); - } else { - $page_suffix = Admin_Menu::add_menu( - __( 'Subscribers', 'jetpack-subscribers-dashboard' ), - _x( 'Subscribers', 'product name shown in menu', 'jetpack-subscribers-dashboard' ), - 'manage_options', - 'subscribers', - array( $this, 'render' ) - ); - } - - if ( $page_suffix ) { - add_action( 'load-' . $page_suffix, array( $this, 'admin_init' ) ); - self::$menu_added = true; - } - } - - /** - * Override render funtion - */ - public function render() { - echo '
'; - } - - /** - * Initialize the admin resources. - */ - public function admin_init() { - add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_scripts' ) ); - } - - /** - * Load the admin scripts. - */ - public function load_admin_scripts() { - Assets::register_script( - 'jetpack-subscribers-dashboard', - '../build/index.js', - __FILE__, - array( - 'in_footer' => true, - 'textdomain' => 'jetpack-subscribers-dashboard', - 'enqueue' => true, - ) - ); - Assets::enqueue_script( 'jetpack-script-data' ); - } -} diff --git a/projects/packages/subscribers-dashboard/tests/.phpcs.dir.xml b/projects/packages/subscribers-dashboard/tests/.phpcs.dir.xml deleted file mode 100644 index 46951fe77b37..000000000000 --- a/projects/packages/subscribers-dashboard/tests/.phpcs.dir.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/projects/packages/subscribers-dashboard/tests/jest.config.js b/projects/packages/subscribers-dashboard/tests/jest.config.js deleted file mode 100644 index 4953c2759d3e..000000000000 --- a/projects/packages/subscribers-dashboard/tests/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const path = require( 'path' ); -const baseConfig = require( 'jetpack-js-tools/jest/config.base.js' ); - -module.exports = { - ...baseConfig, - rootDir: path.join( __dirname, '..' ), - setupFilesAfterEnv: [ ...baseConfig.setupFilesAfterEnv, '/tests/jest.setup.js' ], - collectCoverageFrom: [ - '/_inc/**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}', - ...baseConfig.collectCoverageFrom, - ], -}; diff --git a/projects/packages/subscribers-dashboard/tests/jest.setup.js b/projects/packages/subscribers-dashboard/tests/jest.setup.js deleted file mode 100644 index 0e9e51d005e9..000000000000 --- a/projects/packages/subscribers-dashboard/tests/jest.setup.js +++ /dev/null @@ -1,9 +0,0 @@ -window.JP_CONNECTION_INITIAL_STATE = { - userConnectionData: { - currentUser: { - wpcomUser: { Id: 99999, login: 'bobsacramento', display_name: 'Bob Sacrmaneto' }, - }, - }, -}; -window.myJetpackInitialState = {}; -window.myJetpackRest = {}; diff --git a/projects/packages/subscribers-dashboard/tests/php/Subscribers_Dashboard_Test.php b/projects/packages/subscribers-dashboard/tests/php/Subscribers_Dashboard_Test.php deleted file mode 100644 index 26c5f64bd315..000000000000 --- a/projects/packages/subscribers-dashboard/tests/php/Subscribers_Dashboard_Test.php +++ /dev/null @@ -1,56 +0,0 @@ -init_hooks(); - $this->assertSame( 999, has_action( 'admin_menu', array( $subscriber_dashboard, 'add_wp_admin_submenu' ) ) ); - } - - public function test_add_wp_admin_submenu() { - $subscriber_dashboard = new Dashboard(); - $subscriber_dashboard->add_wp_admin_submenu(); - $this->assertSame( 10, has_action( 'load-jetpack_page_subscribers', array( $subscriber_dashboard, 'admin_init' ) ) ); - } - - public function test_admin_init() { - $subscriber_dashboard = new Dashboard(); - $subscriber_dashboard->admin_init(); - $this->assertSame( 10, has_action( 'admin_enqueue_scripts', array( $subscriber_dashboard, 'load_admin_scripts' ) ) ); - } -} diff --git a/projects/packages/subscribers-dashboard/tests/php/bootstrap.php b/projects/packages/subscribers-dashboard/tests/php/bootstrap.php deleted file mode 100644 index 4e842dc78029..000000000000 --- a/projects/packages/subscribers-dashboard/tests/php/bootstrap.php +++ /dev/null @@ -1,16 +0,0 @@ -=7.2" }, "require-dev": { @@ -3452,84 +3451,6 @@ "relative": true } }, - { - "name": "automattic/jetpack-subscribers-dashboard", - "version": "dev-trunk", - "dist": { - "type": "path", - "url": "../../packages/subscribers-dashboard", - "reference": "66832602601278e0202880bef8da1a396d34fa45" - }, - "require": { - "automattic/jetpack-connection": "@dev", - "automattic/jetpack-constants": "@dev", - "automattic/jetpack-jitm": "@dev", - "automattic/jetpack-plans": "@dev", - "automattic/jetpack-stats": "@dev", - "automattic/jetpack-status": "@dev", - "php": ">=7.2" - }, - "require-dev": { - "automattic/jetpack-test-environment": "@dev", - "automattic/phpunit-select-config": "@dev", - "yoast/phpunit-polyfills": "^4.0.0" - }, - "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." - }, - "type": "jetpack-library", - "extra": { - "autotagger": true, - "mirror-repo": "Automattic/jetpack-subscribers-dashboard", - "branch-alias": { - "dev-trunk": "0.5.x-dev" - }, - "textdomain": "jetpack-subscribers-dashboard", - "version-constants": { - "::VERSION": "src/class-dashboard.php" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "scripts": { - "phpunit": [ - "phpunit-select-config phpunit.#.xml.dist --colors=always" - ], - "test-coverage": [ - "pnpm concurrently --names php,js 'php -dpcov.directory=. ./vendor/bin/phpunit-select-config phpunit.#.xml.dist --coverage-php \"$COVERAGE_DIR/php.cov\"' 'pnpm:test-coverage'" - ], - "test-php": [ - "@composer phpunit" - ], - "test-js": [ - "pnpm run test" - ], - "test-js-watch": [ - "Composer\\Config::disableProcessTimeout", - "pnpm run test --watch" - ], - "build-development": [ - "pnpm run build" - ], - "build-production": [ - "NODE_ENV=production pnpm run build" - ], - "watch": [ - "Composer\\Config::disableProcessTimeout", - "pnpm run watch" - ] - }, - "license": [ - "GPL-2.0-or-later" - ], - "description": "Subscribers dashboard", - "transport-options": { - "relative": true - } - }, { "name": "automattic/jetpack-sync", "version": "dev-trunk", @@ -5935,7 +5856,6 @@ "automattic/jetpack-stats": 20, "automattic/jetpack-stats-admin": 20, "automattic/jetpack-status": 20, - "automattic/jetpack-subscribers-dashboard": 20, "automattic/jetpack-sync": 20, "automattic/jetpack-videopress": 20, "automattic/jetpack-waf": 20, diff --git a/projects/plugins/jetpack/modules/subscriptions.php b/projects/plugins/jetpack/modules/subscriptions.php index 79425d2616eb..a8446e208f01 100644 --- a/projects/plugins/jetpack/modules/subscriptions.php +++ b/projects/plugins/jetpack/modules/subscriptions.php @@ -15,14 +15,8 @@ // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. -use Automattic\Jetpack\Admin_UI\Admin_Menu; -use Automattic\Jetpack\Connection\Manager as Connection_Manager; use Automattic\Jetpack\Connection\XMLRPC_Async_Call; use Automattic\Jetpack\Newsletter\Settings as Newsletter_Settings; -use Automattic\Jetpack\Redirect; -use Automattic\Jetpack\Status; -use Automattic\Jetpack\Status\Host; -use Automattic\Jetpack\Subscribers_Dashboard\Dashboard as Subscribers_Dashboard; if ( ! defined( 'ABSPATH' ) ) { exit( 0 ); @@ -144,9 +138,6 @@ public function __construct() { add_action( 'init', array( $this, 'register_post_meta' ), 20 ); add_action( 'transition_post_status', array( $this, 'maybe_set_first_published_status' ), 10, 3 ); - // Add Subscribers menu to Jetpack navigation. - add_action( 'jetpack_admin_menu', array( $this, 'add_subscribers_menu' ) ); - // Customize the configuration URL to lead to the Subscriptions settings. add_filter( 'jetpack_module_configuration_url_subscriptions', @@ -157,8 +148,6 @@ function () { // Track categories created through the category editor page add_action( 'wp_ajax_add-tag', array( $this, 'track_newsletter_category_creation' ), 1 ); - $subscribers_dashboard = new Subscribers_Dashboard(); - $subscribers_dashboard::init(); $newsletter_settings = new Newsletter_Settings(); $newsletter_settings::init(); @@ -1020,64 +1009,6 @@ public function register_post_meta() { register_meta( 'post', '_jetpack_post_was_ever_published', $jetpack_post_was_ever_published ); } - /** - * Create a Subscribers menu displayed on self-hosted sites. - * - * - It is not displayed on WordPress.com sites. - * - It directs you to Calypso to the existing Subscribers page. - * - * @return void - */ - public function add_subscribers_menu() { - /** - * Enables the new in development subscribers in wp-admin dashboard. - * - * @since 9.5.0 - * - * @param bool If the new dashboard is enabled. Default false. - */ - if ( apply_filters( 'jetpack_wp_admin_subscriber_management_enabled', false ) ) { - return; - } - - /* - * Do not display any menu on WoA and WordPress.com Simple sites (unless Classic wp-admin is enabled). - * They already get a menu item under Users via nav-unification. - */ - if ( ( new Host() )->is_wpcom_platform() && get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) { - return; - } - - $status = new Status(); - - /* - * Do not display if we're in Offline mode, - * or if the user is not connected. - */ - if ( - $status->is_offline_mode() - || ! ( new Connection_Manager( 'jetpack' ) )->is_user_connected() - ) { - return; - } - - $blog_id = Connection_Manager::get_site_id( true ); - - $link = Redirect::get_url( - 'jetpack-menu-jetpack-manage-subscribers', - array( 'site' => $blog_id ? $blog_id : $status->get_site_suffix() ) - ); - - Admin_Menu::add_menu( - __( 'Subscribers', 'jetpack' ), - __( 'Subscribers', 'jetpack' ) . ' ', - 'manage_options', - esc_url( $link ), - null, - 15 - ); - } - /** * Record tracks event if categories is created when user enters * the edit category page through the newsletter settings page. diff --git a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Subscribers_List_Test.php b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Subscribers_List_Test.php index 152f287cfbce..e9a2abeaa3a8 100644 --- a/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Subscribers_List_Test.php +++ b/projects/plugins/jetpack/tests/php/core-api/wpcom-endpoints/WPCOM_REST_API_V2_Endpoint_Subscribers_List_Test.php @@ -111,6 +111,7 @@ public function mock_jetpack_options() { */ public function test_routes_not_registered_when_modernization_disabled() { remove_filter( 'rsm_jetpack_ui_modernization_newsletter', '__return_true' ); + add_filter( 'rsm_jetpack_ui_modernization_newsletter', '__return_false' ); $GLOBALS['wp_rest_server'] = new Spy_REST_Server(); // @phan-suppress-next-line PhanNoopNew -- instantiated for the constructor's add_action side effect. new WPCOM_REST_API_V2_Endpoint_Subscribers_List(); @@ -122,6 +123,8 @@ public function test_routes_not_registered_when_modernization_disabled() { $this->assertSame( 404, $response->get_status() ); $this->assertSame( 'rest_no_route', $response->get_data()['code'] ); + + remove_filter( 'rsm_jetpack_ui_modernization_newsletter', '__return_false' ); } /**