Skip to content

Survey-question-catalog datapoint and getSurveyQuestionCatalog selector - #14156

Open
ankitrox wants to merge 30 commits into
developfrom
enhancement/13736-add-datapoint
Open

ankitrox wants to merge 30 commits into
developfrom
enhancement/13736-add-datapoint

Conversation

@ankitrox

@ankitrox ankitrox commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Related issue(s):

Relevant technical choices

The survey question catalog follows the shape that the CTAs ended up with in #14124, not the shape the IB describes. The IB was written against the first version of #13429, where the CTAs were held as one list and resetCTAs() cleared it. After review, #14124 keyed the CTAs by publication ID and had GET:ctas name the publication it answered for. The same races apply to the catalog. The server answers for the saved publication, and a save can land while a request is in flight. So the catalog uses the same approach.

GET:survey-question-catalog takes the publication ID it returns from the saved settings, as Get_CTAs does. It does not parse it from the catalog's name, so the request and the response read the publication from one place.

getSurveyQuestionCatalog() returns undefined while the selected publication differs from the saved one, as getCTAs() does. The stored catalogs belong to the publication the server still answers for, not to one that is picked but not saved yet.

parse_response() skips any question or answer that is not a QuestionTemplate or an AnswerChoiceTemplate, the same way Get_CTAs skips anything that is not a Cta.

Deviations from IB

  • The catalog is keyed by publication ID. The IB asks for one list in state. The AC asks that, after the connected publication changes, the selector returns the newly connected publication's catalog. One list cannot guarantee this, because a response for the previous publication can arrive after the reset and overwrite it. Use connected publication for RRM datapoints #14124 made the same change for the CTAs after review.
  • GET:survey-question-catalog returns publicationID alongside questions. The IB has parse_response() return the list of questions alone. The questions do not name their publication, and an empty catalog has nothing to name it. The publication ID in the response is what makes the key reliable. This matches GET:ctas.
  • resetSurveyQuestionCatalog() does not clear the stored catalog. The IB asks for an action, following resetCTAs, that clears the list and the selector's stored error, and invalidates the resolution. In Use connected publication for RRM datapoints #14124, resetCTAs() no longer clears the list, because each publication's CTAs are stored under its own ID and cannot be mistaken for another's. The new action follows it: it clears the selector's stored error and invalidates the getSurveyQuestionCatalog resolution.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

nfmohit and others added 21 commits November 9, 2026 21:08

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the survey-question-catalog datastore slice and REST API datapoint for the Reader Revenue Manager module, gated behind the rrmSurveyCTA feature flag. On the client side, it implements the Redux-style store slice with actions, resolvers, and selectors to fetch, cache, and reset survey questions for a connected publication, along with corresponding Jest tests. On the server side, it registers the GET:survey-question-catalog datapoint, implementing the Get_Survey_Question_Catalog class to request and parse question templates from the WebContentPublisher API, backed by PHPUnit integration tests. There are no review comments on this pull request, and I have no additional feedback to provide as the implementation is clean, well-tested, and adheres to the project's style guidelines.

@ankitrox ankitrox changed the title Add survey-question-catalog datapoint and getSurveyQuestionCatalog se… Survey-question-catalog datapoint and getSurveyQuestionCatalog selector Nov 13, 2026
@nfmohit
nfmohit force-pushed the enhancement/#13429-use-connected-publication branch from ccb6ad5 to 582d952 Compare November 17, 2026 22:39
Base automatically changed from enhancement/#13429-use-connected-publication to develop November 18, 2026 16:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants