From fef9071c2ffc14f34302aac92aaa8893f0dff3ad Mon Sep 17 00:00:00 2001 From: vraja-pro Date: Fri, 20 Oct 2023 16:14:32 +0200 Subject: [PATCH 1/6] fix introduction modal background --- css/src/introductions.css | 4 ++++ packages/js/src/ai-generator/initialize.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/css/src/introductions.css b/css/src/introductions.css index a047f9f9d91..2a702524f83 100644 --- a/css/src/introductions.css +++ b/css/src/introductions.css @@ -6,4 +6,8 @@ focus:yst-outline-none focus:yst-ring-offset-0; } + .yst-introduction-modal-panel { + background: rgb(237,210,225); + background: linear-gradient(180deg, rgba(237,210,225,1) 10%, rgb(255, 255, 255) 60%); + } } diff --git a/packages/js/src/ai-generator/initialize.js b/packages/js/src/ai-generator/initialize.js index 974645e9661..e048379933e 100644 --- a/packages/js/src/ai-generator/initialize.js +++ b/packages/js/src/ai-generator/initialize.js @@ -32,7 +32,7 @@ const AiGeneratorUpsell = ( { fieldId } ) => { { __( "Use AI", "wordpress-seo" ) } - + From 8705ee9f7735022f956d26be0662f80414eb5a17 Mon Sep 17 00:00:00 2001 From: vraja-pro Date: Fri, 20 Oct 2023 16:14:53 +0200 Subject: [PATCH 2/6] fix letter spacing --- .../components/ai-generate-titles-and-descriptions-upsell.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js index f6a7c74b349..f2ac9aaea0b 100644 --- a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js +++ b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js @@ -27,7 +27,7 @@ export const AiGenerateTitlesAndDescriptionsUpsell = ( { learnMoreLink, upsellLi Beta
- + { sprintf( /* translators: %1$s expands to Yoast SEO Premium. */ __( "New to %1$s", "wordpress-seo" ), From 808d65be88c58937f365b52a15fd9f3444b9229e Mon Sep 17 00:00:00 2001 From: vraja-pro Date: Fri, 20 Oct 2023 16:15:13 +0200 Subject: [PATCH 3/6] fix copy of upsell button --- .../ai-generate-titles-and-descriptions-upsell.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js index f2ac9aaea0b..9b557d1159b 100644 --- a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js +++ b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js @@ -76,7 +76,11 @@ export const AiGenerateTitlesAndDescriptionsUpsell = ( { learnMoreLink, upsellLi ref={ initialFocus } > - { __( "Unlock with Premium", "wordpress-seo" ) } + { sprintf( + /* translators: %1$s expands to Yoast SEO Premium. */ + __( "Unlock with %1$s", "wordpress-seo" ), + "Yoast SEO Premium" + ) } { /* translators: Hidden accessibility text. */ From 9c368a66903973ab6ef44d1a99a0da07739c7a55 Mon Sep 17 00:00:00 2001 From: Vraja Das Date: Fri, 20 Oct 2023 16:44:48 +0200 Subject: [PATCH 4/6] fix new line styling --- css/src/introductions.css | 4 ++++ .../components/ai-generate-titles-and-descriptions-upsell.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/css/src/introductions.css b/css/src/introductions.css index 2a702524f83..41a4e6e71db 100644 --- a/css/src/introductions.css +++ b/css/src/introductions.css @@ -10,4 +10,8 @@ background: rgb(237,210,225); background: linear-gradient(180deg, rgba(237,210,225,1) 10%, rgb(255, 255, 255) 60%); } + .yst-introduction-modal-uppercase{ + letter-spacing: 0.8px; + @apply yst-uppercase yst-text-slate-500; + } } diff --git a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js index 9b557d1159b..6d8be224bf4 100644 --- a/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js +++ b/packages/js/src/shared-admin/components/ai-generate-titles-and-descriptions-upsell.js @@ -27,7 +27,7 @@ export const AiGenerateTitlesAndDescriptionsUpsell = ( { learnMoreLink, upsellLi Beta
- + { sprintf( /* translators: %1$s expands to Yoast SEO Premium. */ __( "New to %1$s", "wordpress-seo" ), From ebaf17ec16b6e0cde3d49d05983f305252e1b386 Mon Sep 17 00:00:00 2001 From: vraja-pro Date: Mon, 23 Oct 2023 15:53:12 +0200 Subject: [PATCH 5/6] fix css --- css/src/introductions.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/css/src/introductions.css b/css/src/introductions.css index 41a4e6e71db..aa72b205234 100644 --- a/css/src/introductions.css +++ b/css/src/introductions.css @@ -7,8 +7,7 @@ focus:yst-ring-offset-0; } .yst-introduction-modal-panel { - background: rgb(237,210,225); - background: linear-gradient(180deg, rgba(237,210,225,1) 10%, rgb(255, 255, 255) 60%); + background-image: linear-gradient(180deg, rgba(166, 30, 105, 0.25) 10%, rgba(255, 255, 255, 0.25) 50%); } .yst-introduction-modal-uppercase{ letter-spacing: 0.8px; From 49e3e543a42a4a72a6ef2e6f8347c39a1062c78b Mon Sep 17 00:00:00 2001 From: vraja-pro Date: Mon, 23 Oct 2023 17:18:12 +0200 Subject: [PATCH 6/6] add introduction modal style to user profile page --- .../user-profiles-additions-ui.php | 43 ++++++++++++- .../user-profiles-additions-ui-test.php | 61 ++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/src/user-profiles-additions/user-interface/user-profiles-additions-ui.php b/src/user-profiles-additions/user-interface/user-profiles-additions-ui.php index e58d64ca8e8..4c9c9789ea9 100644 --- a/src/user-profiles-additions/user-interface/user-profiles-additions-ui.php +++ b/src/user-profiles-additions/user-interface/user-profiles-additions-ui.php @@ -2,6 +2,8 @@ namespace Yoast\WP\SEO\User_Profiles_Additions\User_Interface; +use WPSEO_Admin_Asset_Manager; +use Yoast\WP\SEO\Helpers\Product_Helper; use Yoast\WP\SEO\Conditionals\User_Profile_Conditional; use Yoast\WP\SEO\Integrations\Integration_Interface; @@ -10,6 +12,34 @@ */ class User_Profiles_Additions_Ui implements Integration_Interface { + /** + * Holds the Product_Helper. + * + * @var Product_Helper + */ + private $product_helper; + + /** + * Holds the WPSEO_Admin_Asset_Manager. + * + * @var WPSEO_Admin_Asset_Manager + */ + private $asset_manager; + + /** + * Constructs Academy_Integration. + * + * @param WPSEO_Admin_Asset_Manager $asset_manager The WPSEO_Admin_Asset_Manager. + * @param Product_Helper $product_helper The Product_Helper. + */ + public function __construct( + WPSEO_Admin_Asset_Manager $asset_manager, + Product_Helper $product_helper + ) { + $this->asset_manager = $asset_manager; + $this->product_helper = $product_helper; + } + /** * Returns the conditionals based in which this loadable should be active. * @@ -31,13 +61,24 @@ public function register_hooks() { \add_action( 'edit_user_profile', [ $this, 'add_hook_to_user_profile' ] ); } + /** + * Enqueues the assets needed for this integration. + * + * @return void + */ + public function enqueue_assets() { + if ( $this->product_helper->is_premium() ) { + $this->asset_manager->enqueue_style( 'introductions' ); + } + } + /** * Add the inputs needed for SEO values to the User Profile page. * * @param WP_User $user User instance to output for. */ public function add_hook_to_user_profile( $user ) { - + $this->enqueue_assets(); echo '
'; /** diff --git a/tests/unit/user-profiles-additions/user-interface/user-profiles-additions-ui-test.php b/tests/unit/user-profiles-additions/user-interface/user-profiles-additions-ui-test.php index 8f200078a33..41358e6c81b 100644 --- a/tests/unit/user-profiles-additions/user-interface/user-profiles-additions-ui-test.php +++ b/tests/unit/user-profiles-additions/user-interface/user-profiles-additions-ui-test.php @@ -4,6 +4,8 @@ use Brain\Monkey; use Mockery; +use WPSEO_Admin_Asset_Manager; +use Yoast\WP\SEO\Helpers\Product_Helper; use Yoast\WP\SEO\Conditionals\User_Profile_Conditional; use Yoast\WP\SEO\Tests\Unit\TestCase; use Yoast\WP\SEO\User_Profiles_Additions\User_Interface\User_Profiles_Additions_Ui; @@ -18,6 +20,20 @@ */ class User_Profiles_Additions_Ui_Test extends TestCase { + /** + * The mocked asset manager. + * + * @var Mockery\MockInterface|WPSEO_Admin_Asset_Manager + */ + protected $asset_manager; + + /** + * The mocked asset product helper. + * + * @var Mockery\MockInterface|Product_Helper + */ + protected $product_helper; + /** * The User_Profiles_Additions_Ui. * @@ -30,8 +46,26 @@ class User_Profiles_Additions_Ui_Test extends TestCase { */ protected function set_up() { parent::set_up(); + $this->asset_manager = Mockery::mock( 'WPSEO_Admin_Asset_Manager' ); + $this->product_helper = Mockery::mock( 'Yoast\WP\SEO\Helpers\Product_Helper' ); + + $this->instance = new User_Profiles_Additions_Ui( $this->asset_manager, $this->product_helper ); + } - $this->instance = new User_Profiles_Additions_Ui(); + /** + * Test construct method. + * + * @covers ::__construct + */ + public function test_construct() { + $this->assertInstanceOf( + WPSEO_Admin_Asset_Manager::class, + $this->getPropertyValue( $this->instance, 'asset_manager' ) + ); + $this->assertInstanceOf( + Product_Helper::class, + $this->getPropertyValue( $this->instance, 'product_helper' ) + ); } /** @@ -46,6 +80,26 @@ public function test_get_conditionals() { ); } + /** + * Test enqueue_assets method. + * + * @covers ::enqueue_assets + */ + public function test_enqueue_assets() { + + $this->product_helper + ->expects( 'is_premium' ) + ->once() + ->andReturn( true ); + + $this->asset_manager + ->expects( 'enqueue_style' ) + ->with( 'introductions' ) + ->once(); + + $this->instance->enqueue_assets(); + } + /** * Tests the registration of the hooks. * @@ -67,6 +121,11 @@ public function test_add_hook_to_user_profile() { $user = Mockery::mock( \WP_User::class ); + $this->product_helper + ->expects( 'is_premium' ) + ->once() + ->andReturn( false ); + Monkey\Actions\expectDone( 'wpseo_user_profile_additions' ) ->once() ->with( $user );