bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

Render email preference center client side

Open alexgibson opened this issue 1 year ago • 1 comments

Description

In an effort to lighten the load on bedrock we'd like to move as much of the email preference centre rendering as possible to the client side, and also make it so the form interacts directly with basket using JS.

This might be a good candidate for something like Svelte or Handlebars to render the form.

Endpoint: https://basket.mozilla.org/news/user/ Docs: https://basket.readthedocs.io/newsletter_api.html#news-user

Example: https://basket.mozilla.org/news/user/4a3bd4e1-fc01-490d-98e3-0a7305ff6a33/


Success Criteria

  • [ ] Email preference centre is rendered using JS, with data fetched directly from basket using the above endpoint.
  • [ ] User can update their preferences, subscribe, unsubscribe (all existing functionality is retained)

alexgibson avatar Jul 19 '22 15:07 alexgibson

Issue worth flagging:

  • Depending on which newsletters someone has signed up to, there's a chance they might have subscribed to a private newsletter (e.g. VPN wait list). As such, when they try and update their preferences it would error because the client side code would not include the required API key.

Possible solutions:

  1. The preference centre continues to POST to bedrock. We only hit Basket to query data on page load and then render.
  2. We update basket to not require an API key when unsubscribing from a private newsletter. In theory, unsubscribing is all someone should be able to do from the preferences page.

alexgibson avatar Jul 20 '22 14:07 alexgibson

Depends on https://github.com/mozmeao/basket/issues/918

alexgibson avatar Oct 12 '22 15:10 alexgibson