Simplify RRM JS CTA type registration
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 383
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 80
Description
## Feature Description
Adding a Reader Revenue Manager CTA type on the datastore currently means touching four compile-enforced maps in `assets/js/modules/reader-revenue-manager/datastore/cta-types/`:
- `CTA_TYPES`
- `CallToActionConfigByType`
- `CallToActionByType`
- `CTA_TYPE_HANDLERS`
That was an intentional choice for [#13006](https://github.com/google/site-kit-wp/issues/13006) / [#13208](https://github.com/google/site-kit-wp/pull/13208): missing one of those spots is a `tsc` error on that line. PHP already registers handlers in one list and keys them off `get_type()`.
With a second CTA type, keeping four maps in sync is more costly. This ticket simplifies that to a small number of/one registration point without changing create/list behavior.
See relevant discussions:
1. https://github.com/google/site-kit-wp/pull/13208#discussion_r3810194883
2. https://github.com/google/site-kit-wp/pull/13208#issuecomment-5344974178
3. https://github.com/google/site-kit-wp/pull/13208#pullrequestreview-5000780779
---------------
_Do not alter or remove anything below. The following sections will be managed by moderators only._
## Acceptance criteria
*
## Implementation Brief
* [ ]
### Test Coverage
*
## QA Brief
*
## Changelog entry
*
Contributor guide
Assessment
This issue has not been assessed yet.