Skip to content

Commit

Permalink
My Jetpack: add support for a single product to provide multiple redi…
Browse files Browse the repository at this point in the history
…rect urls based on specific product features (#38661)

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

Upstream-Ref: Automattic/jetpack@39f14a9
  • Loading branch information
nateweller authored and matticbot committed Sep 3, 2024
1 parent 483802b commit e02abdd
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 138 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"automattic/jetpack-composer-plugin": "^2.0.3",
"automattic/jetpack-config": "^2.0.4",
"automattic/jetpack-connection": "^3.0.0-alpha",
"automattic/jetpack-my-jetpack": "^4.34.1-alpha",
"automattic/jetpack-my-jetpack": "^4.35.0-alpha",
"automattic/jetpack-search": "^0.45.1-alpha",
"automattic/jetpack-stats": "^0.13.1",
"automattic/jetpack-status": "^3.3.4",
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).

## [4.34.1-alpha] - unreleased
## [4.35.0-alpha] - unreleased

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

### Added
- My Jetpack: add support for feature-specific handling to product interstitials.

### Changed
- Jetpack AI product page: add fair usage link on over quota notice
- Updated package dependencies.
Expand Down Expand Up @@ -1695,7 +1698,7 @@ This is an alpha version! The changes listed here are not final.
### Added
- Created package

[4.34.1-alpha]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.34.0...4.34.1-alpha
[4.35.0-alpha]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.34.0...4.35.0-alpha
[4.34.0]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.33.1...4.34.0
[4.33.1]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.33.0...4.33.1
[4.33.0]: https://github.com/Automattic/jetpack-my-jetpack/compare/4.32.4...4.33.0
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' => '776e58f71c0f362757b3');
<?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' => 'f75bd961c426a7335866');
18 changes: 9 additions & 9 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 @@ -71,7 +71,7 @@
"link-template": "https://github.com/Automattic/jetpack-my-jetpack/compare/${old}...${new}"
},
"branch-alias": {
"dev-trunk": "4.34.x-dev"
"dev-trunk": "4.35.x-dev"
},
"version-constants": {
"::PACKAGE_VERSION": "src/class-initializer.php"
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 = '4.34.1-alpha';
const PACKAGE_VERSION = '4.35.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 @@ -150,35 +150,37 @@ public static function get_info() {
throw new \Exception( 'Product classes must declare the $slug attribute.' );
}
return array(
'slug' => static::$slug,
'plugin_slug' => static::$plugin_slug,
'name' => static::get_name(),
'title' => static::get_title(),
'description' => static::get_description(),
'long_description' => static::get_long_description(),
'tiers' => static::get_tiers(),
'features' => static::get_features(),
'features_by_tier' => static::get_features_by_tier(),
'disclaimers' => static::get_disclaimers(),
'status' => static::get_status(),
'pricing_for_ui' => static::get_pricing_for_ui(),
'is_bundle' => static::is_bundle_product(),
'is_plugin_active' => static::is_plugin_active(),
'is_upgradable' => static::is_upgradable(),
'is_upgradable_by_bundle' => static::is_upgradable_by_bundle(),
'supported_products' => static::get_supported_products(),
'wpcom_product_slug' => static::get_wpcom_product_slug(),
'requires_user_connection' => static::$requires_user_connection,
'has_any_plan_for_product' => static::has_any_plan_for_product(),
'has_free_plan_for_product' => static::has_free_plan_for_product(),
'has_paid_plan_for_product' => static::has_paid_plan_for_product(),
'has_free_offering' => static::$has_free_offering,
'manage_url' => static::get_manage_url(),
'purchase_url' => static::get_purchase_url(),
'post_activation_url' => static::get_post_activation_url(),
'standalone_plugin_info' => static::get_standalone_info(),
'class' => static::class,
'post_checkout_url' => static::get_post_checkout_url(),
'slug' => static::$slug,
'plugin_slug' => static::$plugin_slug,
'name' => static::get_name(),
'title' => static::get_title(),
'description' => static::get_description(),
'long_description' => static::get_long_description(),
'tiers' => static::get_tiers(),
'features' => static::get_features(),
'features_by_tier' => static::get_features_by_tier(),
'disclaimers' => static::get_disclaimers(),
'status' => static::get_status(),
'pricing_for_ui' => static::get_pricing_for_ui(),
'is_bundle' => static::is_bundle_product(),
'is_plugin_active' => static::is_plugin_active(),
'is_upgradable' => static::is_upgradable(),
'is_upgradable_by_bundle' => static::is_upgradable_by_bundle(),
'supported_products' => static::get_supported_products(),
'wpcom_product_slug' => static::get_wpcom_product_slug(),
'requires_user_connection' => static::$requires_user_connection,
'has_any_plan_for_product' => static::has_any_plan_for_product(),
'has_free_plan_for_product' => static::has_free_plan_for_product(),
'has_paid_plan_for_product' => static::has_paid_plan_for_product(),
'has_free_offering' => static::$has_free_offering,
'manage_url' => static::get_manage_url(),
'purchase_url' => static::get_purchase_url(),
'post_activation_url' => static::get_post_activation_url(),
'post_activation_urls_by_feature' => static::get_manage_urls_by_feature(),
'standalone_plugin_info' => static::get_standalone_info(),
'class' => static::class,
'post_checkout_url' => static::get_post_checkout_url(),
'post_checkout_urls_by_feature' => static::get_post_checkout_urls_by_feature(),
);
}

Expand Down Expand Up @@ -305,6 +307,15 @@ public static function get_purchase_url() {
*/
abstract public static function get_manage_url();

/**
* Get the URL where the user manages the product for each product feature
*
* @return ?array
*/
public static function get_manage_urls_by_feature() {
return null;
}

/**
* Get the URL the user is taken after activating the product
*
Expand All @@ -323,6 +334,15 @@ public static function get_post_checkout_url() {
return null;
}

/**
* Get the URL the user is taken after purchasing the product through the checkout for each product feature
*
* @return ?array
*/
public static function get_post_checkout_urls_by_feature() {
return null;
}

/**
* Get the WPCOM product slug used to make the purchase
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Protect extends Product {
const UPGRADED_TIER_SLUG = 'upgraded';
const UPGRADED_TIER_PRODUCT_SLUG = 'jetpack_scan';

const SCAN_FEATURE_SLUG = 'scan';
const FIREWALL_FEATURE_SLUG = 'firewall';

/**
* The product slug
*
Expand Down Expand Up @@ -309,6 +312,18 @@ public static function get_post_checkout_url() {
return self::get_manage_url();
}

/**
* Get the URL the user is taken after purchasing the product through the checkout for each product feature
*
* @return ?array
*/
public static function get_post_checkout_urls_by_feature() {
return array(
self::SCAN_FEATURE_SLUG => self::get_post_checkout_url(),
self::FIREWALL_FEATURE_SLUG => admin_url( 'admin.php?page=jetpack-protect#/firewall' ),
);
}

/**
* Get the URL where the user manages the product
*
Expand All @@ -318,6 +333,18 @@ public static function get_manage_url() {
return admin_url( 'admin.php?page=jetpack-protect' );
}

/**
* Get the URL where the user manages the product for each product feature
*
* @return ?array
*/
public static function get_manage_urls_by_feature() {
return array(
self::SCAN_FEATURE_SLUG => self::get_manage_url(),
self::FIREWALL_FEATURE_SLUG => admin_url( 'admin.php?page=jetpack-protect#/firewall' ),
);
}

/**
* Return product bundles list
* that supports 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.4",
"automattic/jetpack-status": "^3.3.4",
"automattic/jetpack-config": "^2.0.4",
"automattic/jetpack-my-jetpack": "^4.34.1-alpha",
"automattic/jetpack-my-jetpack": "^4.35.0-alpha",
"automattic/jetpack-sync": "^3.9.1-alpha"
},
"require-dev": {
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-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
'ver' => '4.34.1-alpha1725370896',
'ver' => '4.35.0-alpha1725380428',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down
Loading

0 comments on commit e02abdd

Please sign in to comment.