-
Notifications
You must be signed in to change notification settings - Fork 328
Closed
Labels
Module: RRMReader Revenue Manager module related issuesReader Revenue Manager module related issuesP0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: EnhancementImprovement of an existing featureImprovement of an existing feature
Description
Feature Description
The Reader Revenue Manager data store should be updated to faciliate the storage and retrieval of publication policy violation status.
selectPublicationaction: This action should be updated to set the value of the newcontentPolicyStatusmodule setting, which will emulate thecontentPolicyStatusobject of the publication.getContentPolicyStateselector: This new selector should be added to return the value of thecontentPolicyStateproperty of thecontentPolicyStatusmodule setting.getPolicyInfoURLselector: This new selector should be added to return the value of thepolicyInfoLinkproperty of thecontentPolicyStatusmodule setting.
- Read more in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When a publication is selected in Reader Revenue Manager (within setup or settings), the value of
contentPolicyStatusshould be obtained from the publication data and stored in thecontentPolicyStatusmodule setting. - A
getContentPolicyStateselector should be added to obtain thecontentPolicyStateproperty of thecontentPolicyStatusmodule setting, if available. - A
getPolicyInfoURLselector should be added to obtain thepolicyInfoLinkproperty of thecontentPolicyStatusmodule setting, if available.
Implementation Brief
In assets/js/modules/reader-revenue-manager/datastore/publications.js:
- Update the
selectPublicationaction to extractcontentPolicyStatusfrom the publication object:- Add
contentPolicyStatusto the destructured parameters in the generator function (afterproducts). - Add
contentPolicyStatusto thesettingsobject if it is present in the publication object. - Ensure the value is set as-is (as an object) to match the structure from the API response.
- Add
- Add two new selectors to
baseSelectors:-
getContentPolicyState: A selector that returns thecontentPolicyStateproperty from thecontentPolicyStatusmodule setting. This selector should:- Use
createRegistrySelectorto access the module settings. - Access the
contentPolicyStatussetting viagetSettings(). - Return
undefinedif settings are not loaded orcontentPolicyStatusis not available. - Return the
contentPolicyStateproperty value if available.
- Use
-
getPolicyInfoURL: A selector that returns thepolicyInfoLinkproperty from thecontentPolicyStatusmodule setting. This selector should:- Use
createRegistrySelectorto access the module settings and user store. - Access the
contentPolicyStatussetting viagetSettings(). - Return
undefinedif settings are not loaded orcontentPolicyStatusis not available. - Extract the
policyInfoLinkproperty value fromcontentPolicyStatus. - If
policyInfoLinkis available, pass it to thegetAccountChooserURLselector to wrap it with account chooser. - Return the wrapped URL.
- Use
-
Test Coverage
In assets/js/modules/reader-revenue-manager/datastore/publications.test.js:
- Update test cases for
selectPublicationaction to includecontentPolicyStatusobject. - Add test cases for
getContentPolicyStateselector. - Add test cases for
getPolicyInfoURLselector.
QA Brief
- Set up Site Kit and enable the
rrmPolicyViolationsfeature flag. - Navigate to Settings > Connect More Services.
- Click on Set up Reader Revenue Manager to begin the RRM setup process.
- While on the Connect Service screen, configure the Tweak Chrome extension with the following settings and refresh the page:
- URL:
.*/wp-json/google-site-kit/v1/modules/reader-revenue-manager/data/publications.*(enable use of regular expressions) - HTTP Method:
GET - Status code:
200 - Response payload:
- URL:
[
{
"displayName": "Test Publication",
"onboardingState": "ONBOARDING_COMPLETE",
"publicationId": "testPublication",
"verifiedDomains": ["example.com"],
"paymentOptions": {
"contributions": true,
"noPayment": null,
"subscriptions": null,
"thankStickers": null
},
"contentPolicyStatus": {
"contentPolicyState": "CONTENT_POLICY_VIOLATION_ACTIVE",
"policyInfoLink": "https://example.com/policy-info"
}
}
]- Call the following selectors in the devtools console and verify their return values:
- Selector:
googlesitekit.data.select('modules/reader-revenue-manager').getContentPolicyState()- Expected value:
CONTENT_POLICY_VIOLATION_ACTIVE
- Expected value:
- Selector:
googlesitekit.data.select('modules/reader-revenue-manager').getPolicyInfoURL()- Expected value:
https://accounts.google.com/accountchooser?continue=https%3A%2F%2Fexample.com%2Fpolicy-info%3Futm_source%3Dsitekit&Email=<YOUR EMAIL NAME>%40<YOUR EMAIL DOMAIN>&utm_source=sitekit
- Expected value:
- Selector:
- Repeat the above steps, with
nullfor thepolicyInfoLinkvalue in the response payload.- Call the
getPolicyInfoURL()selector and verify that the return value isnull.
- Call the
- Repeat the above steps, with no
contentPolicyStatusvalue in the response payload.- Call the
getContentPolicyState()selector and verify that the return value isundefined. - Call the
getPolicyInfoURL()selector and verify that the return value isundefined.
- Call the
Changelog entry
- Add data store configuration for RRM policy violation status retrieval.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Module: RRMReader Revenue Manager module related issuesReader Revenue Manager module related issuesP0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: EnhancementImprovement of an existing featureImprovement of an existing feature