Skip to content

Commit

Permalink
Update approved screens for JITMs to a const (#41748)
Browse files Browse the repository at this point in the history
* Refactor approved screens to const

* changelog

* Use appropriate terms

Hat tip @scruffian

Co-authored-by: Ben Dwyer <[email protected]>

* Remove WPCom constant as not currently required

* Remove whitespace change

---------

Co-authored-by: Ben Dwyer <[email protected]>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/13498607248

Upstream-Ref: Automattic/jetpack@28f62b9
  • Loading branch information
getdave authored and matticbot committed Feb 24, 2025
1 parent 7f89780 commit 43bc765
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 70 deletions.
8 changes: 8 additions & 0 deletions jetpack_vendor/automattic/jetpack-jitm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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).

## [4.1.1-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Changed
- Refactor approved screens in preparation for https://github.com/Automattic/jetpack/pull/41252

## [4.1.0] - 2025-02-17
### Changed
- Update Ajax calls to utililse @wordpress/api-fetch in preparation for https://github.com/Automattic/jetpack/pull/41252. [#41745]
Expand Down Expand Up @@ -832,6 +839,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Update Jetpack to use new JITM package

[4.1.1-alpha]: https://github.com/Automattic/jetpack-jitm/compare/v4.1.0...v4.1.1-alpha
[4.1.0]: https://github.com/Automattic/jetpack-jitm/compare/v4.0.7...v4.1.0
[4.0.7]: https://github.com/Automattic/jetpack-jitm/compare/v4.0.6...v4.0.7
[4.0.6]: https://github.com/Automattic/jetpack-jitm/compare/v4.0.5...v4.0.6
Expand Down
21 changes: 18 additions & 3 deletions jetpack_vendor/automattic/jetpack-jitm/src/class-jitm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@
*/
class JITM {

const PACKAGE_VERSION = '4.1.0';
const PACKAGE_VERSION = '4.1.1-alpha';

/**
* List of screen IDs where JITMs are allowed to display.
*
* @var string[]
*/
const APPROVED_SCREEN_IDS = array(
'jetpack',
'woo',
'shop',
'product',
);

/**
* The configuration method that is called from the jetpack-config package.
Expand Down Expand Up @@ -156,7 +168,10 @@ public function is_a8c_admin_page() {
return (
$current_screen
&& $current_screen->id
&& (bool) preg_match( '/jetpack|woo|shop|product/', $current_screen->id )
&& (bool) preg_match(
'/' . implode( '|', self::APPROVED_SCREEN_IDS ) . '/',
$current_screen->id
)
);
}

Expand Down Expand Up @@ -226,7 +241,7 @@ public function ajax_message() {
return;
}

// Only add this to Jetpack or Woo admin pages.
// Only add this to specifically allowed pages.
if ( ! $this->is_a8c_admin_page() ) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-my-jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"automattic/jetpack-boost-speed-score": "^0.4.1",
"automattic/jetpack-connection": "^6.6.0-alpha",
"automattic/jetpack-explat": "^0.2.7",
"automattic/jetpack-jitm": "^4.1.0",
"automattic/jetpack-jitm": "^4.1.1-alpha",
"automattic/jetpack-licensing": "^3.0.4",
"automattic/jetpack-plugins-installer": "^0.5.0",
"automattic/jetpack-redirect": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
),
'jetpack-jitm' => array(
'path' => 'jetpack_vendor/automattic/jetpack-jitm',
'ver' => '4.1.0',
'ver' => '4.1.1-alpha1740401939',
),
'jetpack-licensing' => array(
'path' => 'jetpack_vendor/automattic/jetpack-licensing',
Expand Down
62 changes: 31 additions & 31 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "ae6056d947a4c937164990dbc39c0a17d87a5705"
"reference": "894faed323c6c62ec25dbf74d527c01497ac29fa"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -63,7 +63,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "08ad75b0a1de232074320a29c0f82d888263cd89"
"reference": "a50d4663ca05c1f4d7874ade487de37a14ad19de"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -125,7 +125,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "309953c54241052227b08e70b9fdcbfb0e86461f"
"reference": "71a128cfb60be6a042daf5b966b1e8f28ea01c1c"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -197,7 +197,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "ddf30f6a32873dd2a73c5acff69fc5bb6b8222b2"
"reference": "99efef0e1b0bd6fd5961e3985138ecb021bb24fc"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -268,7 +268,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-core",
"reference": "763351c36f2114821129bb61a34c9b0082b76ada"
"reference": "6f2733ea8b73800bc11be4ec98429a50505421a1"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -326,7 +326,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-boost-speed-score",
"reference": "54be39788d2ecea192c18164d2ed323704c8969a"
"reference": "eae66fa15778db76f17cb892341c6ce176f9f042"
},
"require": {
"automattic/jetpack-boost-core": "^0.3.5",
Expand Down Expand Up @@ -393,7 +393,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "f3dadd4fc72ae902c68a2dee17cd29e23ef820df"
"reference": "265edb49851932f4e5c1fc946e666cf724919e33"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -456,7 +456,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "77dcec1525358c60100874681d94c9dd4535f496"
"reference": "490aae7d01c635d9af2118f30e2acf35fee0b74a"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -531,7 +531,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "227ea086a2f97cf2da2656325bac4506ac8d251f"
"reference": "1bba1081e46efabed6362debbc5479d5aa88a3a2"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -618,7 +618,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "30476b6c7abac3a25dd3e44ccb9e74dd7b63755d"
"reference": "ab0fab38f190dca170354a435e42b63b62935d62"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -675,7 +675,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "76c87426149e23dd7aa4a6de569a899193c3528e"
"reference": "fdfe45617cac873718f18f69b669f368a06bb5d3"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -731,7 +731,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-explat",
"reference": "41bd8c38a89ee58e88e8590b3eea38b0d9e8a243"
"reference": "4cfdd51d4f30eefd45c0cb1ee6f8adfb926bba56"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -809,7 +809,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "7ded7dfc7e5a8a2b29057c9b866d79c5fb0111ee"
"reference": "b6c343a170fe6a04aff8ff6f70fcaafc1ee34599"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -865,12 +865,12 @@
},
{
"name": "automattic/jetpack-jitm",
"version": "4.1.0",
"version_normalized": "4.1.0.0",
"version": "4.1.1-alpha.1740401939",
"version_normalized": "4.1.1.0-alpha1740401939",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "4c7f5a8ea6778b3a26d94d1ba98ead9247a9f51f"
"reference": "d52dbd4d63467f3f98c6c09deb2f765e4b6dc413"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -948,7 +948,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "06988b56e97446b0ac656c857864d8d35e4ef6f1"
"reference": "eb84f209875057f327b00342d7e68e29ba28cbb6"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "04633fe71e4bda59f033ab7c6848006e8289a9c6"
"reference": "ca57d3112ea58fd61a9f0c5223efc16689f856eb"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1063,7 +1063,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "c161a8acf931235aafdb7828ee0f5f654b702069"
"reference": "87a8dc2ea4af5be1a2fb72f2a64b34f6d51f44c0"
},
"require": {
"automattic/jetpack-admin-ui": "^0.5.2",
Expand All @@ -1072,7 +1072,7 @@
"automattic/jetpack-connection": "^6.6.0-alpha",
"automattic/jetpack-constants": "^3.0.1",
"automattic/jetpack-explat": "^0.2.7",
"automattic/jetpack-jitm": "^4.1.0",
"automattic/jetpack-jitm": "^4.1.1-alpha",
"automattic/jetpack-licensing": "^3.0.4",
"automattic/jetpack-plans": "^0.5.2",
"automattic/jetpack-plugins-installer": "^0.5.0",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "84826858dc16d3c0b267e05dceb3fd646dd671cd"
"reference": "8023d858501ee966a995b6fc0efc2548f890da6a"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1220,7 +1220,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "a4e48fca0e7265e6ebcb212f3690c430f9fcadf2"
"reference": "fedc2730a8f7a3e13ad439297abff970f88d91b3"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1285,7 +1285,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "ef1ed86706e5911049369e572ab756b428f1cd01"
"reference": "ebf05e204303ef53e295d3bd20c6fa95187f9189"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -1344,7 +1344,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-post-list",
"reference": "ea8879db549865ef2576b38eceb39528566f102c"
"reference": "088ab7d1848c1e23e49a9c9e68a068b47406ca8b"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -1412,7 +1412,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-models",
"reference": "9484048ef6e7c24ded6574bad2b64a08aa18f927"
"reference": "415ceb723838c3420b9988f43476235ec835a691"
},
"require": {
"automattic/jetpack-redirect": "^3.0.1",
Expand Down Expand Up @@ -1480,7 +1480,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-protect-status",
"reference": "d3b26a10c06eb265c570c03ef898b1cee44586b6"
"reference": "85b7c4fc015da130db91137646ba565b27ae8bfc"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1552,7 +1552,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-publicize",
"reference": "7f8c97e212a72415d63e28a9494960824ff420f7"
"reference": "ffee2022bf11c476888100568fda11cbadfe5212"
},
"require": {
"automattic/jetpack-admin-ui": "^0.5.2",
Expand Down Expand Up @@ -1632,7 +1632,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "2ce5052dcbd815c7735bfdba18c25a3666ba6d19"
"reference": "feb17e9ca39ca65febcb27f46c3440eec010911e"
},
"require": {
"automattic/jetpack-status": "^5.0.4-alpha",
Expand Down Expand Up @@ -1690,7 +1690,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "6456862767e0ac4592931a296ee8ae5f2118596a"
"reference": "eae67c5fb2922ddb0732b2fff4d5674218ea9da1"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1747,7 +1747,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "f51220049a8be38674830a1abd6df0a85512899f"
"reference": "1a0f89bef90f0bf21b83a61cf24408151ad4bce1"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -1814,7 +1814,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "9a99f711bd57aecd768e5dec9a4886b90f8982d1"
"reference": "5f16c6f40dd7bd9aec06c2717fe7b32ac2d6c075"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down
Loading

0 comments on commit 43bc765

Please sign in to comment.