Any change to the layouts require a PR into DCR, but the data could instead be managed from the existing newsletters tool and published on the newsletters api, allowing editorial to self-serve for changes - see https://github.com/guardian/newsletters-nx/pull/328
This PR has fronted provide the data on the page model to DCR so that DCR can use it instead of the hard coded version.
What does this change?
Adds a method to fetch newsletter layout data (Map of Edition id to newsletter layout )from the newsletters-api, and cache it using the existing NewsletterSignupAgent
Adds the an optional "layout" object to the DotcomNewslettersPageRenderingDataModel
When building the DotcomNewslettersPageRenderingDataModel for a request for the /email-newsletters page, the layout for the Edition of the request is included in the model.
The layout data used will be from https://newsletters.code.dev-guardianapis.com/api/layouts - (if there is no layout defined for the Edition you are viewing, DCR will fallback to its default layout including all live newsletters)
All deployment options
- [Deploy build 3229 of `dotcom:frontend-all` to CODE](https://riffraff.gutools.co.uk/deployment/deployAgain?project=dotcom%3Afrontend-all&build=3229&stage=CODE&updateStrategy=MostlyHarmless&action=deploy)
- [Deploy parts of build 3229 to CODE by previewing it first](https://riffraff.gutools.co.uk/preview/yaml?project=dotcom%3Afrontend-all&build=3229&stage=CODE&updateStrategy=MostlyHarmless)
- [What's on CODE right now?](https://riffraff.gutools.co.uk/deployment/history?projectName=dotcom%3Afrontend-all&stage=CODE)
What is the value of this and can you measure success?
The /emai-newsletters page currently uses hard-coded data in the DCR repo describing how the newsletters should be arranged for each Edition (UK, US, Aus, International).
Any change to the layouts require a PR into DCR, but the data could instead be managed from the existing newsletters tool and published on the newsletters api, allowing editorial to self-serve for changes - see https://github.com/guardian/newsletters-nx/pull/328
This PR has fronted provide the data on the page model to DCR so that DCR can use it instead of the hard coded version.
What does this change?
NewsletterSignupAgent
DotcomNewslettersPageRenderingDataModel
DotcomNewslettersPageRenderingDataModel
for a request for the /email-newsletters page, the layout for the Edition of the request is included in the model.Test
Run DCR (this branch - https://github.com/guardian/dotcom-rendering/pull/12795 ) and frontend locally and open http://localhost:3000/email-newsletters
The layout data used will be from https://newsletters.code.dev-guardianapis.com/api/layouts - (if there is no layout defined for the Edition you are viewing, DCR will fallback to its default layout including all live newsletters)
Checklist