Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the capability to update Call to Action (CTA) configurations within the Reader Revenue Manager module. It introduces the "updateCTA" datastore action, the "POST:cta" REST API datapoint ("Update_CTA"), and a unified "CTA_Type_Handlers" registry to handle type-specific configurations. The review feedback correctly identifies a critical issue where the new "ctasByID" state is expected by unit tests to be populated during "receiveGetPublicationCTAs", but the reducer has not been updated to do so, which will lead to test failures.
| type CreateCTARequest = PublicationParams & CreateCTAParams; | ||
| interface CTAsState { | ||
| ctas: Record< string, CTA[] | undefined >; | ||
| ctasByID: Record< string, Record< string, CTA | null > >; |
There was a problem hiding this comment.
The ctasByID state property is added to CTAsState and initialized in baseInitialState, but it is only populated in the fetchUpdateCTAStore reducer. However, the unit test should store the updated CTA by its ID, whether or not it was loaded in ctas.test.ts (lines 556-582) expects receiveGetPublicationCTAs to populate ctasByID with the loaded CTAs.
Since the fetchGetPublicationCTAsStore reducer does not populate ctasByID, this test will fail because getState().ctasByID[ params.publicationID ] will be undefined after calling receiveGetPublicationCTAs.
To resolve this, we should update the fetchGetPublicationCTAsStore reducer to populate ctasByID when CTAs are received, or ensure that the test is aligned with the actual implementation if the population is expected to be introduced in another PR (e.g., #13737).
📚 Storybook for a5a57c3: 📦 Build files for a5a57c3:
🖼️ VRT report for a5a57c3:
🎭 Playwright reports for a5a57c3: |
|
Size Change: 0 B Total Size: 3.58 MB ℹ️ View Unchanged
|
Summary
Related issue(s):
POST:ctadatapoint andupdateCTA()action for Reader Revenue Manager #13738Relevant technical choices
Publication_Params_Traitinstead of extendingConnected_Publication_Datapointfollowing changes in Use the connected publication for Reader Revenue Manager publication and CTA requests #13429.ctasByIDfollowing Add theGET:ctadatapoint andgetCTA()selector for Reader Revenue Manager #13737 exactly to avoid merge conflicts.PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist