Skip to content

Update data store configuration for RRM Policy Violations #12003

@nfmohit

Description

@nfmohit

Feature Description

The Reader Revenue Manager data store should be updated to faciliate the storage and retrieval of publication policy violation status.

  1. selectPublication action: This action should be updated to set the value of the new contentPolicyStatus module setting, which will emulate the contentPolicyStatus object of the publication.
  2. getContentPolicyState selector: This new selector should be added to return the value of the contentPolicyState property of the contentPolicyStatus module setting.
  3. getPolicyInfoURL selector: This new selector should be added to return the value of the policyInfoLink property of the contentPolicyStatus module setting.

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 contentPolicyStatus should be obtained from the publication data and stored in the contentPolicyStatus module setting.
  • A getContentPolicyState selector should be added to obtain the contentPolicyState property of the contentPolicyStatus module setting, if available.
  • A getPolicyInfoURL selector should be added to obtain the policyInfoLink property of the contentPolicyStatus module setting, if available.

Implementation Brief

In assets/js/modules/reader-revenue-manager/datastore/publications.js:

  • Update the selectPublication action to extract contentPolicyStatus from the publication object:
    • Add contentPolicyStatus to the destructured parameters in the generator function (after products).
    • Add contentPolicyStatus to the settings object 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 two new selectors to baseSelectors:
    • getContentPolicyState: A selector that returns the contentPolicyState property from the contentPolicyStatus module setting. This selector should:
      • Use createRegistrySelector to access the module settings.
      • Access the contentPolicyStatus setting via getSettings().
      • Return undefined if settings are not loaded or contentPolicyStatus is not available.
      • Return the contentPolicyState property value if available.
    • getPolicyInfoURL: A selector that returns the policyInfoLink property from the contentPolicyStatus module setting. This selector should:
      • Use createRegistrySelector to access the module settings and user store.
      • Access the contentPolicyStatus setting via getSettings().
      • Return undefined if settings are not loaded or contentPolicyStatus is not available.
      • Extract the policyInfoLink property value from contentPolicyStatus.
      • If policyInfoLink is available, pass it to the getAccountChooserURL selector to wrap it with account chooser.
      • Return the wrapped URL.

Test Coverage

In assets/js/modules/reader-revenue-manager/datastore/publications.test.js:

  • Update test cases for selectPublication action to include contentPolicyStatus object.
  • Add test cases for getContentPolicyState selector.
  • Add test cases for getPolicyInfoURL selector.

QA Brief

  • Set up Site Kit and enable the rrmPolicyViolations feature 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:
[
  {
    "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
    • 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
  • Repeat the above steps, with null for the policyInfoLink value in the response payload.
    • Call the getPolicyInfoURL() selector and verify that the return value is null.
  • Repeat the above steps, with no contentPolicyStatus value in the response payload.
    • Call the getContentPolicyState() selector and verify that the return value is undefined.
    • Call the getPolicyInfoURL() selector and verify that the return value is undefined.

Changelog entry

  • Add data store configuration for RRM policy violation status retrieval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module: RRMReader Revenue Manager module related issuesP0High priorityTeam MIssues for Squad 2Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions