From 0dc6cabbab85735e51f94ce3fcb31595e7c44b36 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:16:43 +0530 Subject: [PATCH 01/31] Refactor content policy handling in Reader Revenue Manager. Update to use new content policy state and policy info link as individual settings. --- includes/Modules/Reader_Revenue_Manager.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/includes/Modules/Reader_Revenue_Manager.php b/includes/Modules/Reader_Revenue_Manager.php index 9b3c69a9c27..315aee2decc 100644 --- a/includes/Modules/Reader_Revenue_Manager.php +++ b/includes/Modules/Reader_Revenue_Manager.php @@ -513,7 +513,8 @@ function ( $pub ) use ( $publication_id ) { $content_policy_status = $publication->getContentPolicyStatus(); if ( $content_policy_status ) { - $new_settings['contentPolicyStatus'] = (array) $content_policy_status->toSimpleObject(); + $new_settings['contentPolicyState'] = $content_policy_status->getContentPolicyState() ?? ''; + $new_settings['policyInfoLink'] = $content_policy_status->getPolicyInfoLink() ?? null; } if ( $new_onboarding_state !== $onboarding_state ) { @@ -927,16 +928,13 @@ public function get_debug_fields() { ); } - if ( isset( $settings['contentPolicyStatus'] ) ) { - $content_policy_status = (array) $settings['contentPolicyStatus']; - $content_policy_state = $content_policy_status['contentPolicyState'] ?? ''; + $content_policy_state = $settings['contentPolicyState'] ?? ''; - $debug_fields['reader_revenue_manager_content_policy_state'] = array( - 'label' => __( 'Reader Revenue Manager: Content policy state', 'google-site-kit' ), - 'value' => $content_policy_state, - 'debug' => $content_policy_state, - ); - } + $debug_fields['reader_revenue_manager_content_policy_state'] = array( + 'label' => __( 'Reader Revenue Manager: Content policy state', 'google-site-kit' ), + 'value' => $content_policy_state, + 'debug' => $content_policy_state, + ); return $debug_fields; } From 2f406c24ab89221b5271e97b67b691742b53996d Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:17:33 +0530 Subject: [PATCH 02/31] Update content policy settings in Reader Revenue Manager to use new state and info link formats. --- .../Modules/Reader_Revenue_Manager/Settings.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/Modules/Reader_Revenue_Manager/Settings.php b/includes/Modules/Reader_Revenue_Manager/Settings.php index 2361a0ed394..bdc07129c83 100644 --- a/includes/Modules/Reader_Revenue_Manager/Settings.php +++ b/includes/Modules/Reader_Revenue_Manager/Settings.php @@ -14,7 +14,6 @@ use Google\Site_Kit\Core\Storage\Setting_With_Owned_Keys_Interface; use Google\Site_Kit\Core\Storage\Setting_With_Owned_Keys_Trait; use Google\Site_Kit\Core\Storage\Setting_With_ViewOnly_Keys_Interface; -use Google\Site_Kit\Core\Util\BC_Functions; use Google\Site_Kit\Core\Util\Method_Proxy_Trait; /** @@ -70,7 +69,8 @@ public function get_owned_keys() { */ protected function get_default() { return array( - 'contentPolicyStatus' => (object) array(), + 'contentPolicyState' => '', + 'policyInfoLink' => null, 'ownerID' => 0, 'publicationID' => '', 'publicationOnboardingState' => '', @@ -183,11 +183,12 @@ protected function get_sanitize_callback() { } } - if ( isset( $option['contentPolicyStatus'] ) ) { - // If the `contentPolicyStatus` setting is not an associative array, set it to an empty object. - if ( ! ( is_array( $option['contentPolicyStatus'] ) && ! BC_Functions::array_is_list( $option['contentPolicyStatus'] ) ) ) { - $option['contentPolicyStatus'] = (object) array(); - } + if ( isset( $option['contentPolicyState'] ) && ! is_string( $option['contentPolicyState'] ) ) { + $option['contentPolicyState'] = ''; + } + + if ( isset( $option['policyInfoLink'] ) && ! is_string( $option['policyInfoLink'] ) && null !== $option['policyInfoLink'] ) { + $option['policyInfoLink'] = null; } return $option; From 4b05b52c4af1bf18ef8c09824cbab2118ddc26c8 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:19:33 +0530 Subject: [PATCH 03/31] Refactor tests in RRRM to align with updated content policy state and info link handling. --- .../Modules/Reader_Revenue_ManagerTest.php | 55 +++++-------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/tests/phpunit/integration/Modules/Reader_Revenue_ManagerTest.php b/tests/phpunit/integration/Modules/Reader_Revenue_ManagerTest.php index 0424828fc94..beff8284b98 100644 --- a/tests/phpunit/integration/Modules/Reader_Revenue_ManagerTest.php +++ b/tests/phpunit/integration/Modules/Reader_Revenue_ManagerTest.php @@ -376,12 +376,14 @@ function ( Request $request ) use ( $publication_id ) { 'Payment option should be updated after fetching publications.' ); $this->assertEquals( - array( - 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_ACTIVE', - 'policyInfoLink' => 'https://example.com/policy-info', - ), - $settings['contentPolicyStatus'], - 'Content policy status should be synchronized after fetching publications.' + 'CONTENT_POLICY_VIOLATION_ACTIVE', + $settings['contentPolicyState'], + 'Content policy state should be synchronized after fetching publications.' + ); + $this->assertEquals( + 'https://example.com/policy-info', + $settings['policyInfoLink'], + 'Policy info link should be synchronized after fetching publications.' ); } @@ -942,7 +944,7 @@ public function test_get_debug_fields() { public function test_get_debug_fields__content_policy_state() { $this->reader_revenue_manager->get_settings()->register(); - // Test that the content policy state debug field is included with default `contentPolicyStatus`. + // Test that the content policy state debug field is included with default value. $this->reader_revenue_manager->get_settings()->set( array( 'publicationID' => 'test-publication-id', @@ -959,16 +961,14 @@ public function test_get_debug_fields__content_policy_state() { $this->assertEquals( '', $debug_fields['reader_revenue_manager_content_policy_state']['value'], - 'Content policy state value should be empty when contentPolicyStatus is default.' + 'Content policy state value should be empty when contentPolicyState is default.' ); - // Test that the content policy state debug field has correct values when `contentPolicyStatus` contains `contentPolicyState`. + // Test that the content policy state debug field has correct values when `contentPolicyState` is set. $this->reader_revenue_manager->get_settings()->set( array( - 'publicationID' => 'test-publication-id', - 'contentPolicyStatus' => array( - 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', - ), + 'publicationID' => 'test-publication-id', + 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', ) ); @@ -976,7 +976,7 @@ public function test_get_debug_fields__content_policy_state() { $this->assertArrayHasKey( 'reader_revenue_manager_content_policy_state', $debug_fields, - 'Content policy state debug field should be included when contentPolicyStatus is set.' + 'Content policy state debug field should be included when contentPolicyState is set.' ); $this->assertEquals( @@ -996,33 +996,6 @@ public function test_get_debug_fields__content_policy_state() { $debug_fields['reader_revenue_manager_content_policy_state']['debug'], 'Content policy state field should have correct debug value' ); - - // Test that the content policy state field handles missing `contentPolicyState` property gracefully. - $this->reader_revenue_manager->get_settings()->set( - array( - 'publicationID' => 'test-publication-id', - 'contentPolicyStatus' => array(), - ) - ); - - $debug_fields = $this->reader_revenue_manager->get_debug_fields(); - $this->assertArrayHasKey( - 'reader_revenue_manager_content_policy_state', - $debug_fields, - 'Content policy state field should be included even when contentPolicyState is missing' - ); - - $this->assertEquals( - '', - $debug_fields['reader_revenue_manager_content_policy_state']['value'], - 'Content policy state field should have empty string when contentPolicyState is missing' - ); - - $this->assertEquals( - '', - $debug_fields['reader_revenue_manager_content_policy_state']['debug'], - 'Content policy state field debug should have empty string when contentPolicyState is missing' - ); } public function test_check_service_entity_access_no_access_unavailable_publication() { From a5c917ac90bbac66ff4843b509179e5bddff9ccc Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:20:18 +0530 Subject: [PATCH 04/31] Update SettingsTest to validate new contentPolicyState and policyInfoLink formats. --- .../Reader_Revenue_Manager/SettingsTest.php | 67 ++++++++++++------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php index b5ed27bb10f..356d1700507 100644 --- a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php +++ b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php @@ -56,7 +56,8 @@ public function test_get_default() { $this->assertEqualSetsWithIndex( array( - 'contentPolicyStatus' => (object) array(), + 'contentPolicyState' => '', + 'policyInfoLink' => null, 'ownerID' => 0, 'publicationID' => '', 'publicationOnboardingState' => '', @@ -129,35 +130,53 @@ public function data_revenue_manager_settings() { 'paymentOption with number' => array( 'paymentOption', 123, '' ), 'paymentOption with boolean' => array( 'paymentOption', true, '' ), - // Validate contentPolicyStatus. - 'contentPolicyStatus with populated object' => array( - 'contentPolicyStatus', - array( - 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', - ), - array( - 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', - ), + // Validate contentPolicyState. + 'contentPolicyState with valid string' => array( + 'contentPolicyState', + 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', + 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', ), - 'contentPolicyStatus with empty object' => array( - 'contentPolicyStatus', - (object) array(), - (object) array(), + 'contentPolicyState with empty string' => array( + 'contentPolicyState', + '', + '', ), - 'contentPolicyStatus with empty array' => array( - 'contentPolicyStatus', - array(), - (object) array(), + 'contentPolicyState with number' => array( + 'contentPolicyState', + 123, + '', + ), + 'contentPolicyState with boolean' => array( + 'contentPolicyState', + true, + '', ), - 'contentPolicyStatus with number' => array( - 'contentPolicyStatus', + + // Validate policyInfoLink. + 'policyInfoLink with valid string' => array( + 'policyInfoLink', + 'https://example.com/policy-info', + 'https://example.com/policy-info', + ), + 'policyInfoLink with empty string' => array( + 'policyInfoLink', + '', + '', + ), + 'policyInfoLink with number' => array( + 'policyInfoLink', 123, - (object) array(), + null, + ), + 'policyInfoLink with null' => array( + 'policyInfoLink', + null, + null, ), - 'contentPolicyStatus with boolean' => array( - 'contentPolicyStatus', + 'policyInfoLink with boolean' => array( + 'policyInfoLink', true, - (object) array(), + null, ), ); } From ed90c19b450766a1e375bc12f43152633e2ce09c Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:20:46 +0530 Subject: [PATCH 05/31] Update Synchronize_PublicationTest to assert new contentPolicyState and policyInfoLink values after synchronization. --- .../Synchronize_PublicationTest.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php index 7e01a7ef1d0..8e195ae45de 100644 --- a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php +++ b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php @@ -303,18 +303,21 @@ public function test_synchronize_content_policy_status() { $settings = $this->reader_revenue_manager->get_settings()->get(); $this->synchronize_publication->register(); - $this->assertEquals( (object) array(), $settings['contentPolicyStatus'], 'Content policy status should be empty before sync.' ); + $this->assertEquals( '', $settings['contentPolicyState'], 'Content policy state should be empty before sync.' ); + $this->assertNull( $settings['policyInfoLink'], 'Policy info link should be null before sync.' ); do_action( Synchronize_Publication::CRON_SYNCHRONIZE_PUBLICATION ); $settings = $this->reader_revenue_manager->get_settings()->get(); $this->assertEquals( - array( - 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_ACTIVE', - 'policyInfoLink' => 'https://example.com/policy-info', - ), - $settings['contentPolicyStatus'], - 'Content policy status should be updated after sync.' + 'CONTENT_POLICY_VIOLATION_ACTIVE', + $settings['contentPolicyState'], + 'Content policy state should be updated after sync.' + ); + $this->assertEquals( + 'https://example.com/policy-info', + $settings['policyInfoLink'], + 'Policy info link should be updated after sync.' ); } From 93c187511c20374c2d5255b695674189c5f60b6a Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:21:24 +0530 Subject: [PATCH 06/31] Add Migration_N_E_X_T class for Reader Revenue Manager content policy status migration. --- includes/Core/Util/Migration_N_E_X_T.php | 130 +++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 includes/Core/Util/Migration_N_E_X_T.php diff --git a/includes/Core/Util/Migration_N_E_X_T.php b/includes/Core/Util/Migration_N_E_X_T.php new file mode 100644 index 00000000000..362fdf2da1c --- /dev/null +++ b/includes/Core/Util/Migration_N_E_X_T.php @@ -0,0 +1,130 @@ +context = $context; + $this->options = $options ?: new Options( $context ); + $this->rrm_settings = new Reader_Revenue_Manager_Settings( $this->options ); + } + + /** + * Registers hooks. + * + * @since n.e.x.t + */ + public function register() { + add_action( 'admin_init', array( $this, 'migrate' ) ); + } + + /** + * Migrates the DB. + * + * @since n.e.x.t + */ + public function migrate() { + $db_version = $this->options->get( self::DB_VERSION_OPTION ); + + if ( ! $db_version || version_compare( $db_version, self::DB_VERSION, '<' ) ) { + $this->migrate_rrm_content_policy_status(); + + $this->options->set( self::DB_VERSION_OPTION, self::DB_VERSION ); + } + } + + /** + * Migrates the legacy nested `contentPolicyStatus` setting into + * flat `contentPolicyState` and `policyInfoLink` settings. + * + * @since n.e.x.t + */ + protected function migrate_rrm_content_policy_status() { + if ( ! $this->rrm_settings->has() ) { + return; + } + + $rrm_settings = $this->rrm_settings->get(); + + if ( ! is_array( $rrm_settings ) || empty( $rrm_settings ) ) { + return; + } + + if ( ! array_key_exists( 'contentPolicyStatus', $rrm_settings ) ) { + return; + } + + $content_policy_status = (array) $rrm_settings['contentPolicyStatus']; + + $rrm_settings['contentPolicyState'] = $content_policy_status['contentPolicyState'] ?? ''; + $rrm_settings['policyInfoLink'] = $content_policy_status['policyInfoLink'] ?? null; + + unset( $rrm_settings['contentPolicyStatus'] ); + + $this->rrm_settings->set( $rrm_settings ); + } +} From 956d10768f82227c8445e1dcf7eafb7fe39efecc Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:22:00 +0530 Subject: [PATCH 07/31] Add PHPUnit integration tests for Migration_N_E_X_T class, validating content policy status migration and database version updates. --- .../Core/Util/Migration_N_E_X_TTest.php | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php diff --git a/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php b/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php new file mode 100644 index 00000000000..6112d601f00 --- /dev/null +++ b/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php @@ -0,0 +1,150 @@ +context = new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ); + $this->options = new Options( $this->context ); + $this->rrm_settings = new Reader_Revenue_Manager_Settings( $this->options ); + + $this->rrm_settings->register(); + $this->delete_db_version(); + } + + public function get_new_migration_instance() { + return new Migration_N_E_X_T( + $this->context, + $this->options + ); + } + + public function test_register() { + $migration = $this->get_new_migration_instance(); + remove_all_actions( 'admin_init' ); + + $migration->register(); + + $this->assertTrue( has_action( 'admin_init' ), 'Migration should register admin_init action.' ); + } + + public function test_migrate_content_policy_status() { + $migration = $this->get_new_migration_instance(); + + $pre_migration_settings = array( + 'publicationID' => 'test-pub-id', + 'publicationOnboardingState' => 'ONBOARDING_COMPLETE', + 'contentPolicyStatus' => array( + 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', + 'policyInfoLink' => 'https://example.com/policy-info', + ), + ); + + $this->rrm_settings->set( $pre_migration_settings ); + + $migration->migrate(); + + $post_migration_settings = $this->rrm_settings->get(); + + $this->assertArrayNotHasKey( 'contentPolicyStatus', $post_migration_settings, 'Legacy contentPolicyStatus key should be removed after migration.' ); + $this->assertEquals( 'CONTENT_POLICY_VIOLATION_GRACE_PERIOD', $post_migration_settings['contentPolicyState'], 'contentPolicyState should be migrated from nested contentPolicyStatus.' ); + $this->assertEquals( 'https://example.com/policy-info', $post_migration_settings['policyInfoLink'], 'policyInfoLink should be migrated from nested contentPolicyStatus.' ); + $this->assertEquals( 'test-pub-id', $post_migration_settings['publicationID'], 'Other settings should be preserved after migration.' ); + } + + public function test_migrate_content_policy_status_with_empty_object() { + $migration = $this->get_new_migration_instance(); + + $pre_migration_settings = array( + 'publicationID' => 'test-pub-id', + 'publicationOnboardingState' => 'ONBOARDING_COMPLETE', + 'contentPolicyStatus' => array(), + ); + + $this->rrm_settings->set( $pre_migration_settings ); + + $migration->migrate(); + + $post_migration_settings = $this->rrm_settings->get(); + + $this->assertArrayNotHasKey( 'contentPolicyStatus', $post_migration_settings, 'Legacy contentPolicyStatus key should be removed after migration.' ); + $this->assertEquals( '', $post_migration_settings['contentPolicyState'], 'contentPolicyState should default to empty string when not present in legacy data.' ); + $this->assertNull( $post_migration_settings['policyInfoLink'], 'policyInfoLink should default to null when not present in legacy data.' ); + } + + public function test_migrate_skips_when_no_rrm_settings_exist() { + $migration = $this->get_new_migration_instance(); + + $migration->migrate(); + + $this->assertOptionNotExists( Reader_Revenue_Manager_Settings::OPTION ); + } + + public function test_migrate_skips_when_no_legacy_content_policy_status() { + $migration = $this->get_new_migration_instance(); + + $pre_migration_settings = array( + 'publicationID' => 'test-pub-id', + 'publicationOnboardingState' => 'ONBOARDING_COMPLETE', + 'contentPolicyState' => 'CONTENT_POLICY_VIOLATION_ENFORCEMENT', + 'policyInfoLink' => 'https://example.com/policy-info', + ); + + $this->rrm_settings->set( $pre_migration_settings ); + + $migration->migrate(); + + $post_migration_settings = $this->rrm_settings->get(); + + $this->assertEquals( 'CONTENT_POLICY_VIOLATION_ENFORCEMENT', $post_migration_settings['contentPolicyState'], 'contentPolicyState should remain unchanged when no legacy data exists.' ); + $this->assertEquals( 'https://example.com/policy-info', $post_migration_settings['policyInfoLink'], 'policyInfoLink should remain unchanged when no legacy data exists.' ); + } + + public function test_migrate_sets_db_version() { + $migration = $this->get_new_migration_instance(); + + $migration->migrate(); + + $this->assertEquals( Migration_N_E_X_T::DB_VERSION, $this->get_db_version(), 'DB version should be set after migration.' ); + } + + protected function get_db_version() { + return $this->options->get( Migration_N_E_X_T::DB_VERSION_OPTION ); + } + + protected function delete_db_version() { + $this->options->delete( Migration_N_E_X_T::DB_VERSION_OPTION ); + } +} From 2fa377bde578f3af7f24e029e388d11214e88816 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:22:22 +0530 Subject: [PATCH 08/31] Register RRM migration class. --- includes/Plugin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/Plugin.php b/includes/Plugin.php index 7784c944ea0..c53f22bb493 100644 --- a/includes/Plugin.php +++ b/includes/Plugin.php @@ -226,6 +226,7 @@ function () use ( $options, $activation_flag ) { ( new Core\Util\Migration_1_129_0( $this->context, $options ) )->register(); ( new Core\Util\Migration_1_150_0( $this->context, $options ) )->register(); ( new Core\Util\Migration_1_163_0( $this->context, $options ) )->register(); + ( new Core\Util\Migration_N_E_X_T( $this->context, $options ) )->register(); ( new Core\Dashboard_Sharing\Dashboard_Sharing( $this->context ) )->register(); ( new Core\Key_Metrics\Key_Metrics( $this->context, $user_options, $options ) )->register(); ( new Core\Prompts\Prompts( $this->context, $user_options ) )->register(); From 9e4d1e6fa0fcb29b0fc3b05ed9da997fa9f78858 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:37:17 +0530 Subject: [PATCH 09/31] Update setting slugs in Reader Revenue Manager to include 'contentPolicyState' and 'policyInfoLink'. --- assets/js/modules/reader-revenue-manager/datastore/base.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/base.js b/assets/js/modules/reader-revenue-manager/datastore/base.js index f96580c538f..60e4b5af524 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/base.js +++ b/assets/js/modules/reader-revenue-manager/datastore/base.js @@ -30,7 +30,8 @@ export default Modules.createModuleStore( MODULE_SLUG_READER_REVENUE_MANAGER, { validateCanSubmitChanges, ownedSettingsSlugs: [ 'publicationID' ], settingSlugs: [ - 'contentPolicyStatus', + 'contentPolicyState', + 'policyInfoLink', 'ownerID', 'publicationID', 'publicationOnboardingState', From c4d983386d3765edfaefaf39584738e3f575f161 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:37:55 +0530 Subject: [PATCH 10/31] Refactor content policy validation in RRM to use updated state and info link checks. --- .../datastore/settings.js | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/settings.js b/assets/js/modules/reader-revenue-manager/datastore/settings.js index c20193160c9..443459334cc 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/settings.js +++ b/assets/js/modules/reader-revenue-manager/datastore/settings.js @@ -20,7 +20,6 @@ * External dependencies */ import invariant from 'invariant'; -import { isPlainObject } from 'lodash'; /** * Internal dependencies @@ -59,8 +58,11 @@ export const INVARIANT_INVALID_PRODUCT_IDS = export const INVARIANT_INVALID_PAYMENT_OPTION = 'a valid payment option is required'; -export const INVARIANT_INVALID_CONTENT_POLICY_STATUS = - 'a valid content policy status object is required'; +export const INVARIANT_INVALID_CONTENT_POLICY_STATE = + 'a valid content policy state string is required'; + +export const INVARIANT_INVALID_POLICY_INFO_LINK = + 'a valid policy info link string is required'; export function validateCanSubmitChanges( select ) { const strictSelect = createStrictSelect( select ); @@ -126,13 +128,22 @@ export function validateCanSubmitChanges( select ) { INVARIANT_INVALID_PAYMENT_OPTION ); - const contentPolicyStatus = strictSelect( + const contentPolicyState = strictSelect( + MODULES_READER_REVENUE_MANAGER + ).getContentPolicyState(); + + invariant( + typeof contentPolicyState === 'string', + INVARIANT_INVALID_CONTENT_POLICY_STATE + ); + + const policyInfoLink = strictSelect( MODULES_READER_REVENUE_MANAGER - ).getContentPolicyStatus(); + ).getPolicyInfoLink(); invariant( - isPlainObject( contentPolicyStatus ), - INVARIANT_INVALID_CONTENT_POLICY_STATUS + typeof policyInfoLink === 'string' || policyInfoLink === null, + INVARIANT_INVALID_POLICY_INFO_LINK ); } From 0a458668dbe2faf1d5473ef6765952ad441529bb Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:39:24 +0530 Subject: [PATCH 11/31] Enhance content policy handling in RRM by separating contentPolicyState and policyInfoLink into distinct settings. Remove getContentPolicyState manual selector. --- .../datastore/publications.js | 49 ++++++------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/publications.js b/assets/js/modules/reader-revenue-manager/datastore/publications.js index 83696aae3ea..074902e627b 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/publications.js +++ b/assets/js/modules/reader-revenue-manager/datastore/publications.js @@ -72,9 +72,15 @@ const fetchGetPublicationsStore = createFetchStore( { paymentOption: getPaymentOption( publication.paymentOptions ), - contentPolicyStatus: publication.contentPolicyStatus, }; + if ( publication.contentPolicyStatus ) { + newSettings.contentPolicyState = + publication.contentPolicyStatus.contentPolicyState; + newSettings.policyInfoLink = + publication.contentPolicyStatus.policyInfoLink; + } + Object.assign( state.settings, newSettings ); if ( state.savedSettings ) { @@ -288,7 +294,9 @@ const baseActions = { }; if ( contentPolicyStatus ) { - settings.contentPolicyStatus = contentPolicyStatus; + settings.contentPolicyState = + contentPolicyStatus.contentPolicyState; + settings.policyInfoLink = contentPolicyStatus.policyInfoLink; } return registry @@ -374,37 +382,13 @@ const baseSelectors = { return selectedPublication.products.map( ( product ) => product.name ); } ), - /** - * Gets the content policy state from the content policy status. - * - * @since 1.171.0 - * - * @param {Object} state Data store's state. - * @return {(string|undefined)} The content policy state; `undefined` if not available. - */ - getContentPolicyState: createRegistrySelector( ( select ) => () => { - const settings = select( MODULES_READER_REVENUE_MANAGER ).getSettings(); - - if ( ! settings ) { - return undefined; - } - - const { contentPolicyStatus } = settings; - - if ( ! contentPolicyStatus ) { - return undefined; - } - - return contentPolicyStatus.contentPolicyState; - } ), - /** * Gets the policy info URL wrapped with the account chooser URL. * * @since 1.171.0 * * @param {Object} state Data store's state. - * @return {(string|null|undefined)} The policy info URL wrapped with the account chooser URL; `null` if `policyInfoLink` is `null`; `undefined` if not available. + * @return {(string|null|undefined)} The policy info URL wrapped with the account chooser URL; `null` if `policyInfoLink` is empty or `null`; `undefined` if not available. */ getPolicyInfoURL: createRegistrySelector( ( select ) => () => { const settings = select( MODULES_READER_REVENUE_MANAGER ).getSettings(); @@ -413,20 +397,17 @@ const baseSelectors = { return undefined; } - const { contentPolicyStatus } = settings; + const { policyInfoLink } = settings; - if ( contentPolicyStatus?.policyInfoLink === undefined ) { + if ( policyInfoLink === undefined ) { return undefined; } - if ( contentPolicyStatus.policyInfoLink === null ) { - // `policyInfoLink` is `null` when `contentPolicyState` is `CONTENT_POLICY_STATE_OK`. + if ( ! policyInfoLink ) { return null; } - return select( CORE_USER ).getAccountChooserURL( - contentPolicyStatus.policyInfoLink - ); + return select( CORE_USER ).getAccountChooserURL( policyInfoLink ); } ), }; From 5366be11122b9467c95418701590088fa6fb3fbd Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:40:03 +0530 Subject: [PATCH 12/31] Update tests in RRM to reflect changes in contentPolicyState and policyInfoLink validation, including new invariant error checks. --- .../datastore/settings.test.js | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/settings.test.js b/assets/js/modules/reader-revenue-manager/datastore/settings.test.js index e24b06b8e42..0e2086bac45 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/settings.test.js +++ b/assets/js/modules/reader-revenue-manager/datastore/settings.test.js @@ -23,8 +23,9 @@ import { setUsingCache } from 'googlesitekit-api'; import { createTestRegistry } from '../../../../../tests/js/utils'; import { MODULES_READER_REVENUE_MANAGER } from './constants'; import { - INVARIANT_INVALID_CONTENT_POLICY_STATUS, + INVARIANT_INVALID_CONTENT_POLICY_STATE, INVARIANT_INVALID_PAYMENT_OPTION, + INVARIANT_INVALID_POLICY_INFO_LINK, INVARIANT_INVALID_POST_TYPES, INVARIANT_INVALID_PRODUCT_ID, INVARIANT_INVALID_PRODUCT_IDS, @@ -45,6 +46,8 @@ describe( 'modules/reader-revenue-manager settings', () => { publicationID: 'ABCDEFGH', publicationOnboardingState: 'ONBOARDING_ACTION_REQUIRED', publicationOnboardingStateChanged: false, + contentPolicyState: '', + policyInfoLink: null, snippetMode: 'post_types', postTypes: [ 'post' ], productID: 'valid-id', @@ -246,10 +249,10 @@ describe( 'modules/reader-revenue-manager settings', () => { ); } ); - it( 'should throw invariant error for invalid content policy status', () => { + it( 'should throw invariant error for invalid content policy state', () => { const settings = { ...validSettings, - contentPolicyStatus: 'not-an-object', + contentPolicyState: 123, }; registry @@ -257,7 +260,23 @@ describe( 'modules/reader-revenue-manager settings', () => { .setSettings( settings ); expect( () => validateCanSubmitChanges( registry.select ) ).toThrow( - INVARIANT_INVALID_CONTENT_POLICY_STATUS + INVARIANT_INVALID_CONTENT_POLICY_STATE + ); + } ); + + it( 'should throw invariant error for invalid policy info link', () => { + const settings = { + ...validSettings, + contentPolicyState: '', + policyInfoLink: 123, + }; + + registry + .dispatch( MODULES_READER_REVENUE_MANAGER ) + .setSettings( settings ); + + expect( () => validateCanSubmitChanges( registry.select ) ).toThrow( + INVARIANT_INVALID_POLICY_INFO_LINK ); } ); } ); From 9243344a86e36a17483c69ae04ff9f1f90189ed2 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:41:50 +0530 Subject: [PATCH 13/31] Refactor tests in RRM to update assertions for contentPolicyState and policyInfoLink. --- .../datastore/publications.test.js | 54 ++++++++----------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/publications.test.js b/assets/js/modules/reader-revenue-manager/datastore/publications.test.js index 0299020a8a1..56d56f95c0e 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/publications.test.js +++ b/assets/js/modules/reader-revenue-manager/datastore/publications.test.js @@ -491,7 +491,7 @@ describe( 'modules/reader-revenue-manager publications', () => { ).toEqual( 'openaccess' ); } ); - it( 'should set `contentPolicyStatus` in state when provided', () => { + it( 'should set `contentPolicyState` and `policyInfoLink` in state when `contentPolicyStatus` is provided', () => { const contentPolicyStatus = { contentPolicyState: 'CONTENT_POLICY_VIOLATION_ACTIVE', policyInfoLink: 'https://example.com/policy-info', @@ -510,11 +510,12 @@ describe( 'modules/reader-revenue-manager publications', () => { .select( MODULES_READER_REVENUE_MANAGER ) .getSettings() ).toMatchObject( { - contentPolicyStatus, + contentPolicyState: 'CONTENT_POLICY_VIOLATION_ACTIVE', + policyInfoLink: 'https://example.com/policy-info', } ); } ); - it( 'should not set `contentPolicyStatus` when not provided', () => { + it( 'should not set `contentPolicyState` or `policyInfoLink` when `contentPolicyStatus` is not provided', () => { registry .dispatch( MODULES_READER_REVENUE_MANAGER ) .selectPublication( { @@ -526,7 +527,8 @@ describe( 'modules/reader-revenue-manager publications', () => { .select( MODULES_READER_REVENUE_MANAGER ) .getSettings(); - expect( settings ).not.toHaveProperty( 'contentPolicyStatus' ); + expect( settings ).not.toHaveProperty( 'contentPolicyState' ); + expect( settings ).not.toHaveProperty( 'policyInfoLink' ); } ); } ); } ); @@ -578,10 +580,12 @@ describe( 'modules/reader-revenue-manager publications', () => { ); expect( settings.productIDs ).toEqual( [ 'basic' ] ); expect( settings.paymentOption ).toEqual( 'subscriptions' ); - expect( settings.contentPolicyStatus ).toEqual( { - contentPolicyState: 'CONTENT_POLICY_STATE_OK', - policyInfoLink: `https://publishercenter.google.com/reader-revenue-manager/settings/policy?publication=${ publication.publicationId }`, - } ); + expect( settings.contentPolicyState ).toEqual( + 'CONTENT_POLICY_STATE_OK' + ); + expect( settings.policyInfoLink ).toEqual( + `https://publishercenter.google.com/reader-revenue-manager/settings/policy?publication=${ publication.publicationId }` + ); } ); it( 'should update savedSettings in state when publications are fetched', async () => { @@ -817,7 +821,7 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( contentPolicyState ).toBeUndefined(); } ); - it( 'should return `undefined` if `contentPolicyStatus` is not available', () => { + it( 'should return `undefined` if `contentPolicyState` is not in settings', () => { registry .dispatch( MODULES_READER_REVENUE_MANAGER ) .receiveGetSettings( { @@ -832,17 +836,13 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( contentPolicyState ).toBeUndefined(); } ); - it( 'should return the `contentPolicyState` property from `contentPolicyStatus`', () => { + it( 'should return the `contentPolicyState` setting value', () => { registry .dispatch( MODULES_READER_REVENUE_MANAGER ) .receiveGetSettings( { publicationID: 'publication-id', publicationOnboardingState: 'onboarding-state', - contentPolicyStatus: { - contentPolicyState: - 'CONTENT_POLICY_VIOLATION_ACTIVE', - policyInfoLink: 'https://example.com/policy-info', - }, + contentPolicyState: 'CONTENT_POLICY_VIOLATION_ACTIVE', } ); const contentPolicyState = registry @@ -866,7 +866,7 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( policyInfoURL ).toBeUndefined(); } ); - it( 'should return `undefined` if `contentPolicyStatus` is not available', () => { + it( 'should return `undefined` if `policyInfoLink` is not in settings', () => { registry .dispatch( MODULES_READER_REVENUE_MANAGER ) .receiveGetSettings( { @@ -881,23 +881,20 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( policyInfoURL ).toBeUndefined(); } ); - it( 'should return `undefined` if `policyInfoLink` is not available', () => { + it( 'should return `null` if `policyInfoLink` is empty', () => { registry .dispatch( MODULES_READER_REVENUE_MANAGER ) .receiveGetSettings( { publicationID: 'publication-id', publicationOnboardingState: 'onboarding-state', - contentPolicyStatus: { - contentPolicyState: - 'CONTENT_POLICY_VIOLATION_ACTIVE', - }, + policyInfoLink: '', } ); const policyInfoURL = registry .select( MODULES_READER_REVENUE_MANAGER ) .getPolicyInfoURL(); - expect( policyInfoURL ).toBeUndefined(); + expect( policyInfoURL ).toBeNull(); } ); it( 'should return `null` if `policyInfoLink` is `null`', () => { @@ -906,10 +903,7 @@ describe( 'modules/reader-revenue-manager publications', () => { .receiveGetSettings( { publicationID: 'publication-id', publicationOnboardingState: 'onboarding-state', - contentPolicyStatus: { - contentPolicyState: 'CONTENT_POLICY_STATE_OK', - policyInfoLink: null, - }, + policyInfoLink: null, } ); const policyInfoURL = registry @@ -919,7 +913,7 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( policyInfoURL ).toBeNull(); } ); - it( 'should return the `policyInfoLink` property from `contentPolicyStatus`, wrapped with account chooser URL', () => { + it( 'should return the `policyInfoLink` setting wrapped with account chooser URL', () => { const testEmail = 'test@example.com'; const testPolicyInfoLink = 'https://example.com/policy-info'; @@ -932,11 +926,7 @@ describe( 'modules/reader-revenue-manager publications', () => { .receiveGetSettings( { publicationID: 'publication-id', publicationOnboardingState: 'onboarding-state', - contentPolicyStatus: { - contentPolicyState: - 'CONTENT_POLICY_VIOLATION_ACTIVE', - policyInfoLink: testPolicyInfoLink, - }, + policyInfoLink: testPolicyInfoLink, } ); const policyInfoURL = registry From 526624ccd8bd5e4f8aa4667e4081473e90b91d1e Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:42:19 +0530 Subject: [PATCH 14/31] Remove unused contentPolicyStatus from SetupMain test in RRM. --- .../reader-revenue-manager/components/setup/SetupMain.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/modules/reader-revenue-manager/components/setup/SetupMain.test.js b/assets/js/modules/reader-revenue-manager/components/setup/SetupMain.test.js index c5ee162c535..f1bee31f5d7 100644 --- a/assets/js/modules/reader-revenue-manager/components/setup/SetupMain.test.js +++ b/assets/js/modules/reader-revenue-manager/components/setup/SetupMain.test.js @@ -63,7 +63,6 @@ describe( 'SetupMain', () => { .receiveGetSettings( { snippetMode: 'post_types', postTypes: [ 'post' ], - contentPolicyStatus: {}, } ); } ); From ed00b2553ec4eb00cf2dbad881df1dd4e250f6d9 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:42:38 +0530 Subject: [PATCH 15/31] Remove unused contentPolicyStatus from SetupForm test in RRM. --- .../reader-revenue-manager/components/setup/SetupForm.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/js/modules/reader-revenue-manager/components/setup/SetupForm.test.js b/assets/js/modules/reader-revenue-manager/components/setup/SetupForm.test.js index defa5bb23f6..480c5cd0c48 100644 --- a/assets/js/modules/reader-revenue-manager/components/setup/SetupForm.test.js +++ b/assets/js/modules/reader-revenue-manager/components/setup/SetupForm.test.js @@ -46,7 +46,6 @@ describe( 'SetupForm', () => { .receiveGetSettings( { snippetMode: 'post_types', postTypes: [ 'post' ], - contentPolicyStatus: {}, } ); } ); From 60b4621fbf4f6917523d867d8bb2c0b064636349 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:43:06 +0530 Subject: [PATCH 16/31] Refactor SettingsView stories in RRM to separate contentPolicyState and policyInfoLink into distinct settings. --- .../components/settings/SettingsView.stories.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/settings/SettingsView.stories.js b/assets/js/modules/reader-revenue-manager/components/settings/SettingsView.stories.js index bc6554819bd..eb1332644f9 100644 --- a/assets/js/modules/reader-revenue-manager/components/settings/SettingsView.stories.js +++ b/assets/js/modules/reader-revenue-manager/components/settings/SettingsView.stories.js @@ -172,11 +172,9 @@ export default { // Add content policy status if provided. if ( args?.contentPolicyState ) { - settings.contentPolicyStatus = { - contentPolicyState: args.contentPolicyState, - policyInfoLink: - 'https://publishercenter.google.com/policy', - }; + settings.contentPolicyState = args.contentPolicyState; + settings.policyInfoLink = + 'https://publishercenter.google.com/policy'; } registry From 2fab42be65999008e39ca6f121b47e10f6c0b00d Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:43:28 +0530 Subject: [PATCH 17/31] Refactor SettingsEdit stories in RRM to separate contentPolicyState and policyInfoLink into distinct settings. --- .../settings/SettingsEdit.stories.js | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/settings/SettingsEdit.stories.js b/assets/js/modules/reader-revenue-manager/components/settings/SettingsEdit.stories.js index 2c94c0fafc9..9564005dc9f 100644 --- a/assets/js/modules/reader-revenue-manager/components/settings/SettingsEdit.stories.js +++ b/assets/js/modules/reader-revenue-manager/components/settings/SettingsEdit.stories.js @@ -229,13 +229,11 @@ WithPolicyViolationPending.args = { .dispatch( MODULES_READER_REVENUE_MANAGER ) .setProductIDs( [ 'product-a', 'product-b', 'product-c' ] ); - registry - .dispatch( MODULES_READER_REVENUE_MANAGER ) - .setContentPolicyStatus( { - contentPolicyState: - CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_GRACE_PERIOD, - policyInfoLink: 'https://publishercenter.google.com/policy', - } ); + registry.dispatch( MODULES_READER_REVENUE_MANAGER ).setSettings( { + contentPolicyState: + CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_GRACE_PERIOD, + policyInfoLink: 'https://publishercenter.google.com/policy', + } ); }, }; @@ -253,13 +251,11 @@ WithPolicyViolationActive.args = { .dispatch( MODULES_READER_REVENUE_MANAGER ) .setProductIDs( [ 'product-a', 'product-b', 'product-c' ] ); - registry - .dispatch( MODULES_READER_REVENUE_MANAGER ) - .setContentPolicyStatus( { - contentPolicyState: - CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_ACTIVE, - policyInfoLink: 'https://publishercenter.google.com/policy', - } ); + registry.dispatch( MODULES_READER_REVENUE_MANAGER ).setSettings( { + contentPolicyState: + CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_ACTIVE, + policyInfoLink: 'https://publishercenter.google.com/policy', + } ); }, }; @@ -277,13 +273,11 @@ WithPolicyViolationExtreme.args = { .dispatch( MODULES_READER_REVENUE_MANAGER ) .setProductIDs( [ 'product-a', 'product-b', 'product-c' ] ); - registry - .dispatch( MODULES_READER_REVENUE_MANAGER ) - .setContentPolicyStatus( { - contentPolicyState: - CONTENT_POLICY_STATES.CONTENT_POLICY_ORGANIZATION_VIOLATION_ACTIVE_IMMEDIATE, - policyInfoLink: 'https://publishercenter.google.com/policy', - } ); + registry.dispatch( MODULES_READER_REVENUE_MANAGER ).setSettings( { + contentPolicyState: + CONTENT_POLICY_STATES.CONTENT_POLICY_ORGANIZATION_VIOLATION_ACTIVE_IMMEDIATE, + policyInfoLink: 'https://publishercenter.google.com/policy', + } ); }, }; From ac233f8ef82d98ee4d6ad237b93da3524497372c Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:43:56 +0530 Subject: [PATCH 18/31] Refactor RRMSetupSuccessSubtleNotification story to conditionally include contentPolicyState and policyInfoLink as an object. --- .../RRMSetupSuccessSubtleNotification/index.stories.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.stories.tsx b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.stories.tsx index ce83609e3a4..02cc940fbc4 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.stories.tsx +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.stories.tsx @@ -267,14 +267,14 @@ export default { publicationOnboardingState: parameters.publicationOnboardingState, productIDs: [ 'product-a', 'product-b' ], - contentPolicyStatus: parameters.contentPolicyState + ...( parameters.contentPolicyState ? { contentPolicyState: parameters.contentPolicyState, policyInfoLink: 'https://example.com/policy-info', } - : undefined, + : {} ), } ); args?.setupRegistry?.( registry ); From ed468ab2b4a54a4f31fc9c04a9173052f7637d8c Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:46:28 +0530 Subject: [PATCH 19/31] Refactor RRMSetupSuccessSubtleNotification tests to separate contentPolicyState and policyInfoLink, removing contentPolicyStatus object for clarity. --- .../index.test.tsx | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx index 43ee61aca0a..7d359cd1e54 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx @@ -507,10 +507,8 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: 'https://example.com/policy', - }, + contentPolicyState, + policyInfoLink: 'https://example.com/policy', } ); const { getByRole, getByText } = render( @@ -543,10 +541,8 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: 'https://example.com/policy', - }, + contentPolicyState, + policyInfoLink: 'https://example.com/policy', } ); await registry @@ -590,10 +586,8 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: 'https://example.com/policy', - }, + contentPolicyState, + policyInfoLink: 'https://example.com/policy', } ); await registry @@ -649,10 +643,8 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: 'https://example.com/policy', - }, + contentPolicyState, + policyInfoLink: 'https://example.com/policy', } ); const { getByRole } = render( @@ -693,10 +685,8 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: null, - }, + contentPolicyState, + policyInfoLink: null, } ); const { getByText, queryByRole, queryByText } = render( @@ -749,12 +739,12 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { undefined, ...Object.values( CONTENT_POLICY_STATES ), ] )( 'with contentPolicyState %s', ( contentPolicyState ) => { - const contentPolicyStatus = contentPolicyState + const contentPolicySettings = contentPolicyState ? { contentPolicyState, policyInfoLink: 'https://example.com/policy', } - : undefined; + : {}; const expectedLabelSuffix = contentPolicyState ? `:${ contentPolicyState }` @@ -780,7 +770,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'subscriptions', productID: 'basic', - contentPolicyStatus, + ...contentPolicySettings, } ); const { getByRole, waitForRegistry } = render( @@ -826,7 +816,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'noPayment', productID: 'basic', - contentPolicyStatus, + ...contentPolicySettings, } ); const { getByText, waitForRegistry } = render( @@ -881,7 +871,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { publicationOnboardingState: ONBOARDING_COMPLETE, paymentOption: 'noPayment', productID: 'advanced', - contentPolicyStatus, + ...contentPolicySettings, } ); const { getByText, waitForRegistry } = render( From 66763124389988436e592ad3fba27237d410e1cc Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:47:04 +0530 Subject: [PATCH 20/31] Refactor PolicyViolationNotification test separate contentPolicyState and policyInfoLink into distinct settings. --- .../PolicyViolationNotification/index.test.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.test.tsx b/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.test.tsx index 24814d7e14f..4548af6999a 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.test.tsx +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.test.tsx @@ -89,13 +89,11 @@ describe( 'PolicyViolationNotification', () => { .receiveGetSettings( { publicationOnboardingState: PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE, - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: - contentPolicyState === CONTENT_POLICY_STATE_OK - ? null - : POLICY_INFO_URL, - }, + contentPolicyState, + policyInfoLink: + contentPolicyState === CONTENT_POLICY_STATE_OK + ? null + : POLICY_INFO_URL, } ); } From 322105054f301dd3de5a3de2411f289892d8ecf7 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:48:20 +0530 Subject: [PATCH 21/31] Refactor PolicyViolationSettingsNotice test to separate contentPolicyState and policyInfoLink, removing the contentPolicyStatus object for improved clarity. --- .../common/PolicyViolationSettingsNotice.test.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.test.tsx b/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.test.tsx index 2c4eb7a4f89..d934082e317 100644 --- a/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.test.tsx +++ b/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.test.tsx @@ -63,13 +63,11 @@ describe( 'PolicyViolationSettingsNotice', () => { publicationID: 'ABCDEFGH', publicationOnboardingState: PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE, - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: - contentPolicyState === CONTENT_POLICY_STATE_OK - ? null - : POLICY_INFO_URL, - }, + contentPolicyState, + policyInfoLink: + contentPolicyState === CONTENT_POLICY_STATE_OK + ? null + : POLICY_INFO_URL, } ); } From 3457eb21a27518b78edbe0c0cde3d27fd338c488 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:49:14 +0530 Subject: [PATCH 22/31] Refactor ConnectedServices stories to separate contentPolicyState and policyInfoLink, removing the contentPolicyStatus object. --- .../components/settings/SettingsActiveModules.stories.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/assets/js/components/settings/SettingsActiveModules.stories.js b/assets/js/components/settings/SettingsActiveModules.stories.js index 2def2ae99fd..3bd0bc1e625 100644 --- a/assets/js/components/settings/SettingsActiveModules.stories.js +++ b/assets/js/components/settings/SettingsActiveModules.stories.js @@ -152,11 +152,9 @@ WithRRMActionNeeded.args = { .receiveGetSettings( { publicationID: 'test-publication-id', publicationOnboardingState: 'ONBOARDING_COMPLETE', - contentPolicyStatus: { - contentPolicyState: - CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_GRACE_PERIOD, - policyInfoLink: 'https://example.com/policy-info', - }, + contentPolicyState: + CONTENT_POLICY_STATES.CONTENT_POLICY_VIOLATION_GRACE_PERIOD, + policyInfoLink: 'https://example.com/policy-info', } ); }, }; From 800a9235d4e50b74c92890fac805a80cb477168e Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:49:36 +0530 Subject: [PATCH 23/31] Refactor PolicyViolation stories to separate contentPolicyState and policyInfoLink, removing the contentPolicyStatus object. --- .../dashboard/PolicyViolationNotification/index.stories.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.stories.tsx b/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.stories.tsx index 003c6c4ad9a..d3f26e002fd 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.stories.tsx +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/PolicyViolationNotification/index.stories.tsx @@ -138,10 +138,8 @@ export default { publicationID: '1234', publicationOnboardingState: PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE, - contentPolicyStatus: { - contentPolicyState: parameters.contentPolicyState, - policyInfoLink: POLICY_INFO_URL, - }, + contentPolicyState: parameters.contentPolicyState, + policyInfoLink: POLICY_INFO_URL, } ); } From 44332184de9651220f5feaa276bb620020cce4ec Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 16 Mar 2026 13:49:56 +0530 Subject: [PATCH 24/31] Refactor PolicyViolationSettingsNotice stories to separate contentPolicyState and policyInfoLink, removing the contentPolicyStatus object for improved clarity. --- .../common/PolicyViolationSettingsNotice.stories.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.stories.tsx b/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.stories.tsx index 8e5164ed1ee..b5885abbbc8 100644 --- a/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.stories.tsx +++ b/assets/js/modules/reader-revenue-manager/components/common/PolicyViolationSettingsNotice.stories.tsx @@ -62,10 +62,8 @@ function setupRegistry( registry: Registry, contentPolicyState: string ) { publicationID: '1234', publicationOnboardingState: PUBLICATION_ONBOARDING_STATES.ONBOARDING_COMPLETE, - contentPolicyStatus: { - contentPolicyState, - policyInfoLink: POLICY_INFO_URL, - }, + contentPolicyState, + policyInfoLink: POLICY_INFO_URL, } ); } From 68c026f804de8368169212a8b70cd50d6cbbd972 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:12:18 +0530 Subject: [PATCH 25/31] Refactor policyInfoLink default value to null in client side. --- .../datastore/publications.js | 2 +- .../datastore/publications.test.js | 16 ---------------- .../reader-revenue-manager/datastore/settings.js | 2 +- .../datastore/settings.test.js | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/publications.js b/assets/js/modules/reader-revenue-manager/datastore/publications.js index 074902e627b..f0c0f317510 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/publications.js +++ b/assets/js/modules/reader-revenue-manager/datastore/publications.js @@ -388,7 +388,7 @@ const baseSelectors = { * @since 1.171.0 * * @param {Object} state Data store's state. - * @return {(string|null|undefined)} The policy info URL wrapped with the account chooser URL; `null` if `policyInfoLink` is empty or `null`; `undefined` if not available. + * @return {(string|null|undefined)} The policy info URL wrapped with the account chooser URL; `null` if `policyInfoLink` is empty; `undefined` if not available. */ getPolicyInfoURL: createRegistrySelector( ( select ) => () => { const settings = select( MODULES_READER_REVENUE_MANAGER ).getSettings(); diff --git a/assets/js/modules/reader-revenue-manager/datastore/publications.test.js b/assets/js/modules/reader-revenue-manager/datastore/publications.test.js index 56d56f95c0e..82c7e5dee9c 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/publications.test.js +++ b/assets/js/modules/reader-revenue-manager/datastore/publications.test.js @@ -897,22 +897,6 @@ describe( 'modules/reader-revenue-manager publications', () => { expect( policyInfoURL ).toBeNull(); } ); - it( 'should return `null` if `policyInfoLink` is `null`', () => { - registry - .dispatch( MODULES_READER_REVENUE_MANAGER ) - .receiveGetSettings( { - publicationID: 'publication-id', - publicationOnboardingState: 'onboarding-state', - policyInfoLink: null, - } ); - - const policyInfoURL = registry - .select( MODULES_READER_REVENUE_MANAGER ) - .getPolicyInfoURL(); - - expect( policyInfoURL ).toBeNull(); - } ); - it( 'should return the `policyInfoLink` setting wrapped with account chooser URL', () => { const testEmail = 'test@example.com'; const testPolicyInfoLink = 'https://example.com/policy-info'; diff --git a/assets/js/modules/reader-revenue-manager/datastore/settings.js b/assets/js/modules/reader-revenue-manager/datastore/settings.js index 443459334cc..7ab3de08b4e 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/settings.js +++ b/assets/js/modules/reader-revenue-manager/datastore/settings.js @@ -142,7 +142,7 @@ export function validateCanSubmitChanges( select ) { ).getPolicyInfoLink(); invariant( - typeof policyInfoLink === 'string' || policyInfoLink === null, + typeof policyInfoLink === 'string', INVARIANT_INVALID_POLICY_INFO_LINK ); } diff --git a/assets/js/modules/reader-revenue-manager/datastore/settings.test.js b/assets/js/modules/reader-revenue-manager/datastore/settings.test.js index 0e2086bac45..4a1e755bd04 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/settings.test.js +++ b/assets/js/modules/reader-revenue-manager/datastore/settings.test.js @@ -47,7 +47,7 @@ describe( 'modules/reader-revenue-manager settings', () => { publicationOnboardingState: 'ONBOARDING_ACTION_REQUIRED', publicationOnboardingStateChanged: false, contentPolicyState: '', - policyInfoLink: null, + policyInfoLink: '', snippetMode: 'post_types', postTypes: [ 'post' ], productID: 'valid-id', From 72b98cadc34fa2ea0398709d0f840898ba84c0b3 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:12:46 +0530 Subject: [PATCH 26/31] Update policyInfoLink default value from null to an empty string in RRMSetupSuccessSubtleNotification tests. --- .../dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx index 7d359cd1e54..0d5ca44190a 100644 --- a/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx +++ b/assets/js/modules/reader-revenue-manager/components/dashboard/RRMSetupSuccessSubtleNotification/index.test.tsx @@ -686,7 +686,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => { paymentOption: 'subscriptions', productID: 'basic', contentPolicyState, - policyInfoLink: null, + policyInfoLink: '', } ); const { getByText, queryByRole, queryByText } = render( From 6198be52570f37641fc84263503901c9d75670b3 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:13:12 +0530 Subject: [PATCH 27/31] Update policyInfoLink default value from null to an empty string in Migration class. --- includes/Core/Util/Migration_N_E_X_T.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Core/Util/Migration_N_E_X_T.php b/includes/Core/Util/Migration_N_E_X_T.php index 362fdf2da1c..7e03648eb9f 100644 --- a/includes/Core/Util/Migration_N_E_X_T.php +++ b/includes/Core/Util/Migration_N_E_X_T.php @@ -121,7 +121,7 @@ protected function migrate_rrm_content_policy_status() { $content_policy_status = (array) $rrm_settings['contentPolicyStatus']; $rrm_settings['contentPolicyState'] = $content_policy_status['contentPolicyState'] ?? ''; - $rrm_settings['policyInfoLink'] = $content_policy_status['policyInfoLink'] ?? null; + $rrm_settings['policyInfoLink'] = $content_policy_status['policyInfoLink'] ?? ''; unset( $rrm_settings['contentPolicyStatus'] ); From acefe1d5229a5c1a219f3204b0e07b543bd3337d Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:13:37 +0530 Subject: [PATCH 28/31] Update policyInfoLink default value from null to an empty string in Reader_Revenue_Manager class. --- includes/Modules/Reader_Revenue_Manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Modules/Reader_Revenue_Manager.php b/includes/Modules/Reader_Revenue_Manager.php index 7b318683fc3..4a74438e5e7 100644 --- a/includes/Modules/Reader_Revenue_Manager.php +++ b/includes/Modules/Reader_Revenue_Manager.php @@ -518,7 +518,7 @@ function ( $pub ) use ( $publication_id ) { if ( $content_policy_status ) { $new_settings['contentPolicyState'] = $content_policy_status->getContentPolicyState() ?? ''; - $new_settings['policyInfoLink'] = $content_policy_status->getPolicyInfoLink() ?? null; + $new_settings['policyInfoLink'] = $content_policy_status->getPolicyInfoLink() ?? ''; } if ( $new_onboarding_state !== $onboarding_state ) { From 3beaacafdf7e7c8e9383b5f69c9fcd1ff9be193d Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:14:07 +0530 Subject: [PATCH 29/31] Update policyInfoLink default value from null to an empty string in RRM settings class. --- includes/Modules/Reader_Revenue_Manager/Settings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Modules/Reader_Revenue_Manager/Settings.php b/includes/Modules/Reader_Revenue_Manager/Settings.php index bdc07129c83..82ca8b55646 100644 --- a/includes/Modules/Reader_Revenue_Manager/Settings.php +++ b/includes/Modules/Reader_Revenue_Manager/Settings.php @@ -70,7 +70,7 @@ public function get_owned_keys() { protected function get_default() { return array( 'contentPolicyState' => '', - 'policyInfoLink' => null, + 'policyInfoLink' => '', 'ownerID' => 0, 'publicationID' => '', 'publicationOnboardingState' => '', @@ -187,8 +187,8 @@ protected function get_sanitize_callback() { $option['contentPolicyState'] = ''; } - if ( isset( $option['policyInfoLink'] ) && ! is_string( $option['policyInfoLink'] ) && null !== $option['policyInfoLink'] ) { - $option['policyInfoLink'] = null; + if ( isset( $option['policyInfoLink'] ) && ! is_string( $option['policyInfoLink'] ) ) { + $option['policyInfoLink'] = ''; } return $option; From 6d3cd6fc73c2a6fb58fdf2f7f7aac173a4be4f72 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Mon, 30 Mar 2026 19:14:39 +0530 Subject: [PATCH 30/31] Update policyInfoLink default value from null to an empty string in various test cases. --- .../integration/Core/Util/Migration_N_E_X_TTest.php | 2 +- .../Modules/Reader_Revenue_Manager/SettingsTest.php | 11 +++-------- .../Synchronize_PublicationTest.php | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php b/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php index 6112d601f00..639c020fd37 100644 --- a/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php +++ b/tests/phpunit/integration/Core/Util/Migration_N_E_X_TTest.php @@ -101,7 +101,7 @@ public function test_migrate_content_policy_status_with_empty_object() { $this->assertArrayNotHasKey( 'contentPolicyStatus', $post_migration_settings, 'Legacy contentPolicyStatus key should be removed after migration.' ); $this->assertEquals( '', $post_migration_settings['contentPolicyState'], 'contentPolicyState should default to empty string when not present in legacy data.' ); - $this->assertNull( $post_migration_settings['policyInfoLink'], 'policyInfoLink should default to null when not present in legacy data.' ); + $this->assertEquals( '', $post_migration_settings['policyInfoLink'], 'policyInfoLink should default to empty string when not present in legacy data.' ); } public function test_migrate_skips_when_no_rrm_settings_exist() { diff --git a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php index 356d1700507..00ec71b3379 100644 --- a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php +++ b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/SettingsTest.php @@ -57,7 +57,7 @@ public function test_get_default() { $this->assertEqualSetsWithIndex( array( 'contentPolicyState' => '', - 'policyInfoLink' => null, + 'policyInfoLink' => '', 'ownerID' => 0, 'publicationID' => '', 'publicationOnboardingState' => '', @@ -166,17 +166,12 @@ public function data_revenue_manager_settings() { 'policyInfoLink with number' => array( 'policyInfoLink', 123, - null, - ), - 'policyInfoLink with null' => array( - 'policyInfoLink', - null, - null, + '', ), 'policyInfoLink with boolean' => array( 'policyInfoLink', true, - null, + '', ), ); } diff --git a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php index 8e195ae45de..ef06dad7f3c 100644 --- a/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php +++ b/tests/phpunit/integration/Modules/Reader_Revenue_Manager/Synchronize_PublicationTest.php @@ -304,7 +304,7 @@ public function test_synchronize_content_policy_status() { $this->synchronize_publication->register(); $this->assertEquals( '', $settings['contentPolicyState'], 'Content policy state should be empty before sync.' ); - $this->assertNull( $settings['policyInfoLink'], 'Policy info link should be null before sync.' ); + $this->assertEquals( '', $settings['policyInfoLink'], 'Policy info link should be empty before sync.' ); do_action( Synchronize_Publication::CRON_SYNCHRONIZE_PUBLICATION ); From 0b6efc83e831d9a5c29e4abfb8ae9f39fef53176 Mon Sep 17 00:00:00 2001 From: Hussain Thajutheen Date: Tue, 7 Apr 2026 13:19:52 +0530 Subject: [PATCH 31/31] Update policyInfoLink handling to ensure it defaults to an empty string if undefined in publications.js. --- .../modules/reader-revenue-manager/datastore/publications.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/modules/reader-revenue-manager/datastore/publications.js b/assets/js/modules/reader-revenue-manager/datastore/publications.js index f0c0f317510..582db3616ca 100644 --- a/assets/js/modules/reader-revenue-manager/datastore/publications.js +++ b/assets/js/modules/reader-revenue-manager/datastore/publications.js @@ -78,7 +78,7 @@ const fetchGetPublicationsStore = createFetchStore( { newSettings.contentPolicyState = publication.contentPolicyStatus.contentPolicyState; newSettings.policyInfoLink = - publication.contentPolicyStatus.policyInfoLink; + publication.contentPolicyStatus.policyInfoLink || ''; } Object.assign( state.settings, newSettings ); @@ -296,7 +296,8 @@ const baseActions = { if ( contentPolicyStatus ) { settings.contentPolicyState = contentPolicyStatus.contentPolicyState; - settings.policyInfoLink = contentPolicyStatus.policyInfoLink; + settings.policyInfoLink = + contentPolicyStatus.policyInfoLink || ''; } return registry