Skip to content

Commit

Permalink
My Jetpack: Mark Jetpack AI as upgradable in interstitial page (#34215)
Browse files Browse the repository at this point in the history
* set jetpack ai product as upgradable if active

* add upgradeInInterstitial flag to product card

* changelog

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6936179850
  • Loading branch information
dhasilva authored and matticbot committed Nov 20, 2023
1 parent ca7ee2f commit 8c40d9b
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 91 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"automattic/jetpack-config": "^2.0.0",
"automattic/jetpack-connection": "^2.0.0",
"automattic/jetpack-identity-crisis": "^0.12.0",
"automattic/jetpack-my-jetpack": "^4.0.0",
"automattic/jetpack-my-jetpack": "^4.0.1-alpha",
"automattic/jetpack-search": "^0.40.0",
"automattic/jetpack-stats": "^0.7.0",
"automattic/jetpack-status": "^2.0.0",
Expand Down
8 changes: 8 additions & 0 deletions jetpack_vendor/automattic/jetpack-my-jetpack/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.0.1-alpha] - unreleased

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

### Added
- My Jetpack: Mark Jetpack AI as upgradable in interstitial page

## [4.0.0] - 2023-11-20
### Added
- Display an "Activity Log" menu item to connected users. [#34174]
Expand Down Expand Up @@ -1110,6 +1117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Created package

[4.0.1-alpha]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.0.0...4.0.1-alpha
[4.0.0]: https://github.com/Automattic/jetpack-my-jetpack/compare/3.12.2...4.0.0
[3.12.2]: https://github.com/Automattic/jetpack-my-jetpack/compare/3.12.1...3.12.2
[3.12.1]: https://github.com/Automattic/jetpack-my-jetpack/compare/3.12.0...3.12.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => 'd9c9430a7515ca0066f6');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-element', 'wp-i18n', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '500844c22e1f48374208');
8 changes: 4 additions & 4 deletions jetpack_vendor/automattic/jetpack-my-jetpack/build/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Initializer {
*
* @var string
*/
const PACKAGE_VERSION = '4.0.0';
const PACKAGE_VERSION = '4.0.1-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 @@ -75,11 +75,11 @@ public static function get_title() {
}

/**
* Get the next usage tier
* Get the current usage tier
*
* @return int
*/
public static function get_next_usage_tier() {
public static function get_current_usage_tier() {
$info = self::get_ai_assistant_feature();

// Bail early if it's not possible to fetch the feature data.
Expand All @@ -89,6 +89,17 @@ public static function get_next_usage_tier() {

$current_tier = isset( $info['current-tier']['value'] ) ? $info['current-tier']['value'] : null;

return $current_tier;
}

/**
* Get the next usage tier
*
* @return int
*/
public static function get_next_usage_tier() {
$current_tier = self::get_current_usage_tier();

if ( null === $current_tier ) {
return 1;
}
Expand Down Expand Up @@ -292,6 +303,23 @@ public static function has_required_plan() {
return false;
}

/**
* Checks whether the product can be upgraded to a different product.
*
* @return boolean
*/
public static function is_upgradable() {
$has_required_plan = self::has_required_plan();
$current_tier = self::get_current_usage_tier();

// Mark as not upgradable if user is on unlimited tier or does not have any plan.
if ( ! $has_required_plan || null === $current_tier || 1 === $current_tier ) {
return false;
}

return true;
}

/**
* Get the URL where the user manages the product
*
Expand Down
2 changes: 1 addition & 1 deletion jetpack_vendor/automattic/jetpack-search/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"automattic/jetpack-constants": "^2.0.0",
"automattic/jetpack-status": "^2.0.0",
"automattic/jetpack-config": "^2.0.0",
"automattic/jetpack-my-jetpack": "^4.0.0"
"automattic/jetpack-my-jetpack": "^4.0.1-alpha"
},
"require-dev": {
"automattic/jetpack-changelogger": "^4.0.0",
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-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
'ver' => '4.0.0',
'ver' => '4.0.1-alpha1700516891',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down
54 changes: 27 additions & 27 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": "38f1297c703d24a69d0f8af10c3a73069b5a39c6"
"reference": "84073c96be9a2685645ea9a3e88d7028bc103cda"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -60,7 +60,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-admin-ui",
"reference": "e063a7912bb94792f18c4961dcbf9effcbce805b"
"reference": "8e2c2658fae6d442d175184da75f3a90d060aad1"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -125,7 +125,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-assets",
"reference": "6273c462623608ab39c09bbb64a85f3cafaf4a74"
"reference": "5933eff822e909f8918b184292b893506b328153"
},
"require": {
"automattic/jetpack-constants": "^2.0.0",
Expand Down Expand Up @@ -194,7 +194,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-autoloader",
"reference": "f642b47b48b2d3bfcbfb078c7a9d4724f6ecc131"
"reference": "5b88162aa559d6deeb7959f291927300b4090341"
},
"require": {
"composer-plugin-api": "^1.1 || ^2.0",
Expand Down Expand Up @@ -260,7 +260,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-composer-plugin",
"reference": "05bcc67712a9604fa15a1873b163c622efb454fc"
"reference": "df060e480f35056a5e3f434504b3f97a958008df"
},
"require": {
"composer-plugin-api": "^2.1.0",
Expand Down Expand Up @@ -320,7 +320,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-config",
"reference": "2c227f6067939d4c275e81d02471625927afc8e5"
"reference": "bc919d6dd1a05ef1809184c7723fac1303c883a0"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -365,7 +365,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-connection",
"reference": "aa47754c063d5177c7b680749c954035cbced694"
"reference": "4bb0781f3fed8d569ab8a52da135f408fa09cee7"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.0",
Expand Down Expand Up @@ -444,7 +444,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-constants",
"reference": "b032230d4c0219b8ca4fa65df9ce4612e14417eb"
"reference": "e06d9aabeaa8042266d40be22b42cece9af3db7d"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -498,7 +498,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-device-detection",
"reference": "be6b63aa6337be5bf6759a901fcfadc3fc5404a4"
"reference": "4aee711245f403ef25f37087d5f183df7c450e9b"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -551,7 +551,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-identity-crisis",
"reference": "6dbd5a4f46eadc1708ce396bee10273f42bae45f"
"reference": "738e33dc6e22ffb5a56ad67ae6b49a01765bf777"
},
"require": {
"automattic/jetpack-assets": "^2.0.0",
Expand Down Expand Up @@ -630,7 +630,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-ip",
"reference": "9b066fd2d9e788ecbb7ad22a32d599fe579ae22e"
"reference": "d6b027c977cc91cc530b0a3ec67cd305d5810ec3"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -688,7 +688,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-jitm",
"reference": "2545ef2e44e05eed38a4703ffcfbc08bee55bd6a"
"reference": "74bbd5f6117fe2f9d81efab80d6791bfd5e649cd"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.0",
Expand Down Expand Up @@ -763,7 +763,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-licensing",
"reference": "dbaf146cf2aa8a27e7fb9b3d3048adc7d29943f1"
"reference": "5e140fef689fe2a4c3607cda3032cc259de0eb96"
},
"require": {
"automattic/jetpack-connection": "^2.0.0",
Expand Down Expand Up @@ -825,7 +825,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-logo",
"reference": "c136831288552c41701564cea986cb95cd5dedae"
"reference": "b37a7bda81a211207f4acaec8a90889c6b6dfc56"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -873,12 +873,12 @@
},
{
"name": "automattic/jetpack-my-jetpack",
"version": "4.0.0",
"version_normalized": "4.0.0.0",
"version": "4.0.1-alpha.1700516891",
"version_normalized": "4.0.1.0-alpha1700516891",
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-my-jetpack",
"reference": "8a49f827c19184c7e4a6e16dcf87037e59ae90e5"
"reference": "1fba04056c941b6471de43cc2e927c69d41945ea"
},
"require": {
"automattic/jetpack-admin-ui": "^0.3.0",
Expand Down Expand Up @@ -970,7 +970,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-password-checker",
"reference": "d139a0fc6e092ec756e579250f780870b0ba1230"
"reference": "2d7a38fa01b3cebabb1bcbf5b9d37a8cc7eca9f8"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1031,7 +1031,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plans",
"reference": "87d662fdb23853aaf390e3393b92e9ce533fac1c"
"reference": "bc560e89599e81fbcf88c291c5a9b9d3fb1b4f9f"
},
"require": {
"automattic/jetpack-connection": "^2.0.0",
Expand Down Expand Up @@ -1099,7 +1099,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-plugins-installer",
"reference": "37970ddcf9ce6a94d8e49ef9c0f205a5ba4ed41d"
"reference": "e0a31e11adf9963eda28cb6ff6db4f1f633b4d50"
},
"require": {
"automattic/jetpack-a8c-mc-stats": "^2.0.0",
Expand Down Expand Up @@ -1154,7 +1154,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-redirect",
"reference": "175afed333137ea120a087ab06e757bbe94be0c6"
"reference": "435acd15b25d370830d4f23aac5833e5fd8f81da"
},
"require": {
"automattic/jetpack-status": "^2.0.0",
Expand Down Expand Up @@ -1209,7 +1209,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-roles",
"reference": "3b719404dfee30bc638d5d33b12cbc77ca32a90d"
"reference": "abfd994de934214fbfbeb510fd9e908e7b2d1758"
},
"require": {
"php": ">=7.0"
Expand Down Expand Up @@ -1263,14 +1263,14 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-search",
"reference": "818ac172aa971262d64109c7f2a9eef97cc4abe9"
"reference": "e00b484a35183074ea7bb2e3efa2b5be668b3b06"
},
"require": {
"automattic/jetpack-assets": "^2.0.0",
"automattic/jetpack-config": "^2.0.0",
"automattic/jetpack-connection": "^2.0.0",
"automattic/jetpack-constants": "^2.0.0",
"automattic/jetpack-my-jetpack": "^4.0.0",
"automattic/jetpack-my-jetpack": "^4.0.1-alpha",
"automattic/jetpack-status": "^2.0.0",
"php": ">=7.0"
},
Expand Down Expand Up @@ -1350,7 +1350,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-stats",
"reference": "a860e71de21972dc14ff29b526967cf395a3ac6d"
"reference": "f5998237bc2372341441591090989129c1fc9625"
},
"require": {
"automattic/jetpack-assets": "^2.0.0",
Expand Down Expand Up @@ -1415,7 +1415,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-status",
"reference": "c5aa78c25bf449795db658b2236360e89d1d7be3"
"reference": "4f9f3ad8f5614ba1f8ac8871983aa4bb44431082"
},
"require": {
"automattic/jetpack-constants": "^2.0.0",
Expand Down Expand Up @@ -1471,7 +1471,7 @@
"dist": {
"type": "path",
"url": "/tmp/jetpack-build/Automattic/jetpack-sync",
"reference": "b9f2113ea95440201950ea2ea19fb73adeb10754"
"reference": "55d97456308b0feb4c871ce1a30e566bf78a924a"
},
"require": {
"automattic/jetpack-connection": "^2.0.0",
Expand Down
Loading

0 comments on commit 8c40d9b

Please sign in to comment.