Skip to content

Commit

Permalink
Additional CSS: Update the upgrade nudge with the correct plan (#40107)
Browse files Browse the repository at this point in the history
* Additional CSS: Update the upgrade nudge with the correct plan

* Add translators comment and docblock.

* Use FQCN

* Fix broken test

* Fix tests

* Mock method for the Atomic test

* Fix test and linting.

* Update assert

* Update tests and fix linting.

* Linting.

* Disable deprecation for setMethods.

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

Upstream-Ref: Automattic/jetpack@bfe4286
  • Loading branch information
rcrdortiz authored and matticbot committed Nov 13, 2024
1 parent c71349d commit c940a99
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 94 deletions.
60 changes: 30 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/automattic/jetpack-masterbar/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).

## [0.9.10-alpha] - unreleased

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

### Fixed
- Update the upgrade nudge for Additional CSS with the correct plan names.

## [0.9.9] - 2024-11-11
### Changed
- Updated package dependencies. [#39999]
Expand Down Expand Up @@ -168,6 +175,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated package dependencies. [#37669]
- Updated package dependencies. [#37706]

[0.9.10-alpha]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.9...v0.9.10-alpha
[0.9.9]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.8...v0.9.9
[0.9.8]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.7...v0.9.8
[0.9.7]: https://github.com/Automattic/jetpack-masterbar/compare/v0.9.6...v0.9.7
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-masterbar/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Main {

const PACKAGE_VERSION = '0.9.9';
const PACKAGE_VERSION = '0.9.10-alpha';

/**
* Initializer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public function __construct( $domain ) {
* @param \WP_Customize_Manager $wp_customize_manager Core customize manager.
*/
public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
$nudge_url = $this->get_nudge_url();
$nudge_text = __( 'Purchase the Creator plan to<br> activate CSS customization', 'jetpack-masterbar' );
$plan = $this->get_plan_name();

$nudge_url = $this->get_nudge_url();
/* translators: %s is the plan name. */
$nudge_text = sprintf( __( 'Purchase the %s plan to<br> activate CSS customization', 'jetpack-masterbar' ), $plan );

$nudge = new CSS_Customizer_Nudge(
$nudge_url,
Expand All @@ -50,6 +53,15 @@ public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
$nudge->customize_register_nudge( $wp_customize_manager );
}

/**
* Get the plan name.
*
* @return mixed
*/
protected function get_plan_name() {
return \Automattic\Jetpack\Plans::get_plan( 'business_bundle' )->product_name_short;
}

/**
* Get the Nudge URL.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public function __construct( $domain ) {
* @param \WP_Customize_Manager $wp_customize_manager The core customize manager.
*/
public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
$nudge_url = $this->get_nudge_url();
$nudge_text = __( 'Purchase the Explorer plan to<br> activate CSS customization', 'jetpack-masterbar' );
$plan_name = $this->get_plan()->product_name_short;

$nudge_url = $this->get_nudge_url();
/* translators: %s is the plan name. */
$nudge_text = sprintf( __( 'Purchase the %s plan to<br> activate CSS customization', 'jetpack-masterbar' ), $plan_name );

$nudge = new CSS_Customizer_Nudge(
$nudge_url,
Expand All @@ -54,6 +57,17 @@ public function register_nudge( \WP_Customize_Manager $wp_customize_manager ) {
* @return string
*/
private function get_nudge_url() {
return '/checkout/' . $this->domain . '/premium';
return '/checkout/' . $this->domain . '/' . $this->get_plan()->path_slug;
}

/**
* Get the plan.
*
* @return mixed
*/
protected function get_plan() {
$plan_slug = class_exists( 'WPCOM_Feature_Flags' ) && \WPCOM_Feature_Flags::is_enabled( \WPCOM_Feature_Flags::GLOBAL_STYLES_ON_PERSONAL_PLAN ) ? 'personal-bundle' : 'value_bundle';

return \Automattic\Jetpack\Plans::get_plan( $plan_slug );
}
}
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-mu-wpcom/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"automattic/jetpack-calypsoify": "^0.1.9",
"automattic/jetpack-classic-theme-helper": "^0.6.7",
"automattic/jetpack-connection": "^5.1.7",
"automattic/jetpack-masterbar": "^0.9.9",
"automattic/jetpack-masterbar": "^0.9.10-alpha",
"automattic/jetpack-redirect": "^2.0.5",
"automattic/jetpack-stats-admin": "^0.22.6",
"automattic/jetpack-status": "^4.0.3",
Expand Down
Loading

0 comments on commit c940a99

Please sign in to comment.