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 f460a41 commit 1b76b4c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 68 deletions.
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/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
),
'jetpack-jitm' => array(
'path' => 'jetpack_vendor/automattic/jetpack-jitm',
'ver' => '4.1.0',
'ver' => '4.1.1-alpha1740401939',
),
'jetpack-masterbar' => array(
'path' => 'jetpack_vendor/automattic/jetpack-masterbar',
Expand Down
66 changes: 33 additions & 33 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-a8c-mc-stats",
"reference": "95f6ae760ce068053fbbf32ecc6f823130e3168a"
"reference": "a9ed30ec609b4cfc89df4228074ee21326ec8159"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -137,7 +137,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "0bdf7ce74d68d201c8abe9581a27a89133ff2336"
"reference": "3b26758caa6aa25303c6a4e500426ddb99c68073"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -199,7 +199,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "25cf40e15d73f4f0b9b849ebb870e5f4f84cc895"
"reference": "dcbc55c7490cdef3f24a3f0d637240a2f1350625"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -271,7 +271,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-blaze",
"reference": "59c91ab2c961bd419a4b3466afe1ffe59fbf63bf"
"reference": "3633b191af0b0b851bf778f88ffa7fda33590d0a"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -349,7 +349,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-blocks",
"reference": "c934a798fb023a1143ff521f29715f733641477b"
"reference": "d52675636103361a501330efcff15841c2ac83ca"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -408,7 +408,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-calypsoify",
"reference": "314884f8415e90da8b2495d25debaee9509052bd"
"reference": "6133edcf35b9ce2cbc7796eb34500b1c39d3a4e2"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -476,7 +476,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-classic-theme-helper",
"reference": "3c9e1e72767cd74a48d1297be4fe5198b5727156"
"reference": "212f9302f620ee50dea17cc883dc8249d888e600"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -543,7 +543,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-compat",
"reference": "48f492fd9fbd03bf55ec1ae2db41fcfbd756fdb1"
"reference": "3c149b2eb2e7da8b2fdc1fa4d296c1099ab6b668"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -583,7 +583,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "f49545c6c8f804bd005a3b92cc108b648323898f"
"reference": "07e2c9c5d27b0b41d363b0ed0897bf2055a4972a"
},
"require": {
"composer-plugin-api": "^2.2",
Expand Down Expand Up @@ -646,7 +646,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "d069575e62ad2cbbf9c29d1864e9992176f2386f"
"reference": "3f9c05e489c03804780fd406def84512a1d87010"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -721,7 +721,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "7d701872105e3ea1d731ff5c6477d32bcd218bd4"
"reference": "a360c1915dfa55295501bb3c87956a8c7eab57ca"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -808,7 +808,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "8c5986087239fcf0d918b9ea6efb9555980df04b"
"reference": "afbae0fe5f9a5ae68b66918fcae2fb34051de545"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -865,7 +865,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "9eef7ac545663f5be783b0661d8bd2b16789fe45"
"reference": "40d2fe30799448a8f164fc0fe4f35a66356541dd"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -921,7 +921,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-google-analytics",
"reference": "2560bf83135f8e0861aa493602a35ee697b3c5c6"
"reference": "c14c3c393db5d5e30b5ab02abf9f8165f8c0af90"
},
"require": {
"automattic/jetpack-status": "^5.0.4-alpha",
Expand Down Expand Up @@ -989,7 +989,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "8bca8638a026b0a04c418aaef84757c213d00867"
"reference": "b404c7bc48abdda48f5a8c5893867dea01a4b9e3"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1045,12 +1045,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": "2ed579ac2259761c911d08fbeae6eddb0e727f1f"
"reference": "c271bba24a71c631cc8884426b4343401cea279d"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^3.0.0",
Expand Down Expand Up @@ -1128,7 +1128,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "85f0365c3407116939e78790180e5644ce801f69"
"reference": "728dbb8edfba1c766408105d096a3c6d50ab4f1c"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1184,15 +1184,15 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-masterbar",
"reference": "dff09b489a00962505bdc46b9187c843fd85d9be"
"reference": "87ba3960cb618684813c81bef89362c141f8f44d"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
"automattic/jetpack-blaze": "^0.25.10",
"automattic/jetpack-compat": "^4.0.0",
"automattic/jetpack-connection": "^6.6.0-alpha",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-jitm": "^4.1.0",
"automattic/jetpack-jitm": "^4.1.1-alpha",
"automattic/jetpack-logo": "^3.0.0",
"automattic/jetpack-plans": "^0.5.2",
"automattic/jetpack-status": "^5.0.4-alpha",
Expand Down Expand Up @@ -1268,7 +1268,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-mu-wpcom",
"reference": "c2b03883c6200ef72c62f525b65cfb815da63e69"
"reference": "5f389f89ee20dbfdbbcdd28dcb8bc2b347de51ef"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -1353,7 +1353,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "a5f25ca75f1542a7153b18aecb072ee5a746e602"
"reference": "1c0307101a03a62d72f9faec6e9efe4683a14f0e"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1411,7 +1411,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "9385870592121fb59abbc3eb8ea644267b7ea502"
"reference": "576f6f816f9b830377f74b39e1bc01279dc869a5"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1476,7 +1476,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-post-list",
"reference": "6f41d908dbc6da285ad34ade7b66fb9006540f6d"
"reference": "b9b185f8224e3debfe3ab0a4c6c5c6776c0d4dac"
},
"require": {
"automattic/jetpack-assets": "^4.0.8-alpha",
Expand Down Expand Up @@ -1544,7 +1544,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "e1dcd12887e3870fadcb7876ecacb7ef07297850"
"reference": "9111a2e60a124652e355f6a7c21d3b467b309081"
},
"require": {
"automattic/jetpack-status": "^5.0.4-alpha",
Expand Down Expand Up @@ -1602,7 +1602,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "5c32e5192abb4c9cb2c63f6069cfe95cdaf6246c"
"reference": "19357ae4731207d60cc64ee6b3be92c66301b46e"
},
"require": {
"php": ">=7.2"
Expand Down Expand Up @@ -1659,7 +1659,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "b78d9fcc11c9273fc03c4445ca9cda0163eee228"
"reference": "44ba7c39bae5a7d2ffab502dae60a19d3c674ed5"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1723,12 +1723,12 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats-admin",
"reference": "276ff1759e9d558c5ff33aa0ad769a99ac8be704"
"reference": "0352f1bc880ac6d66549e9cc4629ddb4b9e5b429"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
"automattic/jetpack-constants": "^3.0.1",
"automattic/jetpack-jitm": "^4.1.0",
"automattic/jetpack-jitm": "^4.1.1-alpha",
"automattic/jetpack-plans": "^0.5.2",
"automattic/jetpack-stats": "^0.15.1",
"automattic/jetpack-status": "^5.0.4-alpha",
Expand Down Expand Up @@ -1793,7 +1793,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "5712da4a8670659f064e2e28cdc9f326e864937b"
"reference": "6b8ae7ac55c912c9327c67fa123132e7ef61240b"
},
"require": {
"automattic/jetpack-constants": "^3.0.1",
Expand Down Expand Up @@ -1860,7 +1860,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "2f0d7860ae9bb370b7f5935abd079f9953dff6ee"
"reference": "5717a08367fce69076f14ec28f3107a897476c6a"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down Expand Up @@ -1935,7 +1935,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/scheduled-updates",
"reference": "7191714f9bc7feaefdc0356b581b665af6b0499e"
"reference": "5656573d53b62f0091856abd2691e69814eae6dc"
},
"require": {
"automattic/jetpack-connection": "^6.6.0-alpha",
Expand Down
Loading

0 comments on commit 1b76b4c

Please sign in to comment.