Skip to content

Commit

Permalink
My Jetpack: add feature as possible recommendations (#40639)
Browse files Browse the repository at this point in the history
* My Jetpack: add feature as possible module recommendation

* Add config for feature modules

* Refactor module product class

* Add basic structure for feature recommendations card

* Add actions for each status

* changelog

* Add return type for activate_plugin method

* Cover free offerings in recommendations cards

* Fix types

* Refactor getPrimaryAction

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

Upstream-Ref: Automattic/jetpack@c9e3921
  • Loading branch information
IanRamosC authored and matticbot committed Jan 1, 2025
1 parent 311be0a commit 4f042c5
Show file tree
Hide file tree
Showing 16 changed files with 134 additions and 126 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"automattic/jetpack-connection": "^6.2.2-alpha",
"automattic/jetpack-device-detection": "^3.0.0",
"automattic/jetpack-image-cdn": "^0.7.2",
"automattic/jetpack-my-jetpack": "^5.2.1-alpha",
"automattic/jetpack-my-jetpack": "^5.3.0-alpha",
"automattic/jetpack-plugin-deactivation": "^0.3.1-alpha",
"automattic/jetpack-schema": "^0.2.0",
"automattic/jetpack-status": "^5.0.1",
Expand Down
7 changes: 5 additions & 2 deletions jetpack_vendor/automattic/jetpack-my-jetpack/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +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).

## [5.2.1-alpha] - unreleased
## [5.3.0-alpha] - unreleased

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

### Added
- My Jetpack: introduce feature cards for recommendations in My Jetpack.

### Changed
- Updated package dependencies.

Expand Down Expand Up @@ -1893,7 +1896,7 @@ This is an alpha version! The changes listed here are not final.
### Added
- Created package

[5.2.1-alpha]: https://github.com/Automattic/jetpack-my-jetpack/compare/5.2.0...5.2.1-alpha
[5.3.0-alpha]: https://github.com/Automattic/jetpack-my-jetpack/compare/5.2.0...5.3.0-alpha
[5.2.0]: https://github.com/Automattic/jetpack-my-jetpack/compare/5.1.2...5.2.0
[5.1.2]: https://github.com/Automattic/jetpack-my-jetpack/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/Automattic/jetpack-my-jetpack/compare/5.1.0...5.1.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'f627135fb9fedb39428c');
<?php return array('dependencies' => array('jetpack-connection', 'jetpack-script-data', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '515155f988242bd0bf86');
10 changes: 5 additions & 5 deletions jetpack_vendor/automattic/jetpack-my-jetpack/build/index.js

Large diffs are not rendered by default.

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 @@ -72,7 +72,7 @@
"link-template": "https://github.com/Automattic/jetpack-my-jetpack/compare/${old}...${new}"
},
"branch-alias": {
"dev-trunk": "5.2.x-dev"
"dev-trunk": "5.3.x-dev"
},
"version-constants": {
"::PACKAGE_VERSION": "src/class-initializer.php"
Expand Down
12 changes: 8 additions & 4 deletions jetpack_vendor/automattic/jetpack-my-jetpack/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ type JetpackModule =
| 'extras'
| 'ai'
| 'jetpack-ai'
| 'protect'
| 'scan'
| 'search'
| 'social'
| 'security'
| 'protect'
| 'videopress'
| 'stats'
| 'videopress'
| 'security'
| 'growth'
| 'complete';
| 'complete'
| 'site-accelerator'
| 'newsletter'
| 'related-posts';

type ThreatItem = {
// Protect API properties (free plan)
Expand Down Expand Up @@ -174,6 +177,7 @@ interface Window {
has_paid_plan_for_product: boolean;
features_by_tier: Array< string >;
is_bundle: boolean;
is_feature: boolean;
is_plugin_active: boolean;
is_upgradable: boolean;
is_upgradable_by_bundle: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Initializer {
*
* @var string
*/
const PACKAGE_VERSION = '5.2.1-alpha';
const PACKAGE_VERSION = '5.3.0-alpha';

/**
* HTML container ID for the IDC screen on My Jetpack page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ abstract class Module_Product extends Product {
*/
public static $module_name = null;

/**
* Whether this module is a Jetpack feature
*
* @var boolean
*/
public static $is_feature = false;

/**
* Get the plugin slug - ovewrite it ans return Jetpack's
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static function get_manage_url() {
*
* @return null|WP_Error Null on success, WP_Error on invalid file.
*/
public static function activate_plugin() {
public static function activate_plugin(): ?WP_Error {
$plugin_filename = static::get_installed_plugin_filename( self::JETPACK_PLUGIN_SLUG );

if ( $plugin_filename ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ abstract class Product {
*/
const EXPIRATION_CUTOFF_TIME = '+2 months';

/**
* Whether this module is a Jetpack feature
*
* @var boolean
*/
public static $is_feature = false;

/**
* Whether this product requires a site connection
*
Expand Down Expand Up @@ -182,6 +189,7 @@ public static function get_info() {
'is_plugin_active' => static::is_plugin_active(),
'is_upgradable' => static::is_upgradable(),
'is_upgradable_by_bundle' => static::is_upgradable_by_bundle(),
'is_feature' => static::$is_feature,
'supported_products' => static::get_supported_products(),
'wpcom_product_slug' => static::get_wpcom_product_slug(),
'requires_user_connection' => static::$requires_user_connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static function get_manage_url() {
*
* @return null|WP_Error Null on success, WP_Error on invalid file.
*/
public static function activate_plugin() {
public static function activate_plugin(): ?WP_Error {
$plugin_filename = static::get_installed_plugin_filename( self::JETPACK_PLUGIN_SLUG );

if ( $plugin_filename ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static function get_manage_url() {
*
* @return null|WP_Error Null on success, WP_Error on invalid file.
*/
public static function activate_plugin() {
public static function activate_plugin(): ?WP_Error {
$plugin_filename = static::get_installed_plugin_filename( self::JETPACK_PLUGIN_SLUG );

if ( $plugin_filename ) {
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 @@ -50,7 +50,7 @@
),
'jetpack-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
'ver' => '5.2.1-alpha1735700830',
'ver' => '5.3.0-alpha1735746447',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down
Loading

0 comments on commit 4f042c5

Please sign in to comment.