Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0dc6cab
Refactor content policy handling in Reader Revenue Manager.
hussain-t Mar 16, 2026
2f406c2
Update content policy settings in Reader Revenue Manager to use new s…
hussain-t Mar 16, 2026
4b05b52
Refactor tests in RRRM to align with updated content policy state and…
hussain-t Mar 16, 2026
a5c917a
Update SettingsTest to validate new contentPolicyState and policyInfo…
hussain-t Mar 16, 2026
ed90c19
Update Synchronize_PublicationTest to assert new contentPolicyState a…
hussain-t Mar 16, 2026
93c1875
Add Migration_N_E_X_T class for Reader Revenue Manager content policy…
hussain-t Mar 16, 2026
956d107
Add PHPUnit integration tests for Migration_N_E_X_T class, validating…
hussain-t Mar 16, 2026
2fa377b
Register RRM migration class.
hussain-t Mar 16, 2026
9e4d1e6
Update setting slugs in Reader Revenue Manager to include 'contentPol…
hussain-t Mar 16, 2026
c4d9833
Refactor content policy validation in RRM to use updated state and in…
hussain-t Mar 16, 2026
0a45866
Enhance content policy handling in RRM by separating contentPolicySta…
hussain-t Mar 16, 2026
5366be1
Update tests in RRM to reflect changes in contentPolicyState and poli…
hussain-t Mar 16, 2026
9243344
Refactor tests in RRM to update assertions for contentPolicyState and…
hussain-t Mar 16, 2026
526624c
Remove unused contentPolicyStatus from SetupMain test in RRM.
hussain-t Mar 16, 2026
ed00b25
Remove unused contentPolicyStatus from SetupForm test in RRM.
hussain-t Mar 16, 2026
60b4621
Refactor SettingsView stories in RRM to separate contentPolicyState a…
hussain-t Mar 16, 2026
2fab42b
Refactor SettingsEdit stories in RRM to separate contentPolicyState a…
hussain-t Mar 16, 2026
ac233f8
Refactor RRMSetupSuccessSubtleNotification story to conditionally inc…
hussain-t Mar 16, 2026
ed468ab
Refactor RRMSetupSuccessSubtleNotification tests to separate contentP…
hussain-t Mar 16, 2026
6676312
Refactor PolicyViolationNotification test separate contentPolicyState…
hussain-t Mar 16, 2026
3221050
Refactor PolicyViolationSettingsNotice test to separate contentPolicy…
hussain-t Mar 16, 2026
3457eb2
Refactor ConnectedServices stories to separate contentPolicyState and…
hussain-t Mar 16, 2026
800a923
Refactor PolicyViolation stories to separate contentPolicyState and p…
hussain-t Mar 16, 2026
4433218
Refactor PolicyViolationSettingsNotice stories to separate contentPol…
hussain-t Mar 16, 2026
9d688d1
Merge branch 'develop' into bug/#12185-rrm-content-policy-status-type.
hussain-t Mar 17, 2026
6bafab5
Merge branch 'develop' into bug/#12185-rrm-content-policy-status-type.
hussain-t Mar 18, 2026
a5f2ce3
Merge branch 'develop' into bug/#12185-rrm-content-policy-status-type.
nfmohit Mar 24, 2026
dc3bd65
Merge branch 'develop' into bug/#12185-rrm-content-policy-status-type.
hussain-t Mar 30, 2026
68c026f
Refactor policyInfoLink default value to null in client side.
hussain-t Mar 30, 2026
72b98ca
Update policyInfoLink default value from null to an empty string in R…
hussain-t Mar 30, 2026
6198be5
Update policyInfoLink default value from null to an empty string in M…
hussain-t Mar 30, 2026
acefe1d
Update policyInfoLink default value from null to an empty string in R…
hussain-t Mar 30, 2026
3beaaca
Update policyInfoLink default value from null to an empty string in R…
hussain-t Mar 30, 2026
6d3cd6f
Update policyInfoLink default value from null to an empty string in v…
hussain-t Mar 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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',
} );
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 }`
Expand All @@ -780,7 +770,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => {
publicationOnboardingState: ONBOARDING_COMPLETE,
paymentOption: 'subscriptions',
productID: 'basic',
contentPolicyStatus,
...contentPolicySettings,
} );

const { getByRole, waitForRegistry } = render(
Expand Down Expand Up @@ -826,7 +816,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => {
publicationOnboardingState: ONBOARDING_COMPLETE,
paymentOption: 'noPayment',
productID: 'basic',
contentPolicyStatus,
...contentPolicySettings,
} );

const { getByText, waitForRegistry } = render(
Expand Down Expand Up @@ -881,7 +871,7 @@ describe( 'RRMSetupSuccessSubtleNotification', () => {
publicationOnboardingState: ONBOARDING_COMPLETE,
paymentOption: 'noPayment',
productID: 'advanced',
contentPolicyStatus,
...contentPolicySettings,
} );

const { getByText, waitForRegistry } = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
} );
},
};

Expand All @@ -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',
} );
},
};

Expand All @@ -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',
} );
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe( 'SetupForm', () => {
.receiveGetSettings( {
snippetMode: 'post_types',
postTypes: [ 'post' ],
contentPolicyStatus: {},
} );
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ describe( 'SetupMain', () => {
.receiveGetSettings( {
snippetMode: 'post_types',
postTypes: [ 'post' ],
contentPolicyStatus: {},
} );
} );

Expand Down
3 changes: 2 additions & 1 deletion assets/js/modules/reader-revenue-manager/datastore/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default Modules.createModuleStore( MODULE_SLUG_READER_REVENUE_MANAGER, {
validateCanSubmitChanges,
ownedSettingsSlugs: [ 'publicationID' ],
settingSlugs: [
'contentPolicyStatus',
'contentPolicyState',
'policyInfoLink',
'ownerID',
'publicationID',
'publicationOnboardingState',
Expand Down
49 changes: 15 additions & 34 deletions assets/js/modules/reader-revenue-manager/datastore/publications.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -288,7 +294,9 @@ const baseActions = {
};

if ( contentPolicyStatus ) {
settings.contentPolicyStatus = contentPolicyStatus;
settings.contentPolicyState =
contentPolicyStatus.contentPolicyState;
settings.policyInfoLink = contentPolicyStatus.policyInfoLink;
}

return registry
Expand Down Expand Up @@ -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();
Expand All @@ -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 );
} ),
};

Expand Down
Loading
Loading