Skip to content

Conversation

@maureenlholland
Copy link
Collaborator

@maureenlholland maureenlholland commented Oct 7, 2025

If this changeset needs to go into the FXC codebase, please add the WMO and FXC label.

One-line summary

Update multi-newsletter email forms to use Foundation only. Update Foundation newsletter action URL to separate system.

for more context, see https://docs.google.com/document/d/10bScfykHIXp8XLWV87nuME9GfWNDS02bQnxM6PiBEco/ [Moz only]

Significant changes and points to review

Developer on Foundation side was kind enough to update the accept request content type to application/x-www-form-urlencoded

This works with no JS
Protocol JS was copied and tweaked to suit AWS response structure and allow a longer timeout

Once things are confirmed from Foundation side, there should be a follow-up task to remove switch and any non-Foundation email forms

Related: newsletter pref center copy change #16764

Issue / Bugzilla link

https://mozilla-hub.atlassian.net/browse/WT-241

Testing

@codecov
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.68%. Comparing base (edd4973) to head (0bb61b6).
⚠️ Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16785      +/-   ##
==========================================
- Coverage   79.68%   79.68%   -0.01%     
==========================================
  Files         159      159              
  Lines        8522     8525       +3     
==========================================
+ Hits         6791     6793       +2     
- Misses       1731     1732       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maureenlholland maureenlholland force-pushed the update-newsletter-subscription branch from b20b18f to bee77ff Compare October 8, 2025 16:56
}

if (response) {
if (response.status !== undefined) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

change for response structure

'application/x-www-form-urlencoded'
);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.timeout = 10000; // increased AWS timeout
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

change for slower AWS requests (this might be due to local testing? hopefully prod will be faster)

Copy link
Collaborator Author

@maureenlholland maureenlholland Oct 21, 2025

Choose a reason for hiding this comment

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

According to Foundation: "the calls when the lambda is warm should be way quicker (~1s)"
Will still add a loader as suggested

UPDATE: we have a "spinner_color" param on newsletter macro but I don't think it does anything anymore. Spinner was removed in https://github.com/mozilla/bedrock/pull/9178/files#diff-89b12c56d1788e07ed2d017d8cef8ece3284d529932739e52c2a25839917d557L107

We may get a new production URL before launch, but this is the only
one available for now
@maureenlholland maureenlholland marked this pull request as ready for review October 8, 2025 17:09
@maureenlholland maureenlholland requested review from a team as code owners October 8, 2025 17:09
@stephaniehobson stephaniehobson added Needs Review Awaiting code review Frontend HTML, CSS, JS... client side stuff labels Oct 15, 2025
@maureenlholland maureenlholland added the P1 First level priority - Must have label Oct 20, 2025
error = form.querySelector('.error-terms');
break;
default:
error = form.querySelector('.error-try-again-later');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add Sentry call here? We don't have same visibility into AWS request responses as we did to Basket

@stephaniehobson stephaniehobson self-assigned this Oct 20, 2025
Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

It took so long I thought it wasn't working. I think we need some kind of progress indicator.

Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

Could you please also fork and update the newsletter unit tests? https://github.com/mozilla/protocol/blob/main/tests/unit/newsletter.js

maureenlholland and others added 9 commits October 21, 2025 10:59
Co-authored-by: Stephanie Hobson <[email protected]>
This should be cleaned up and backported to main Protocol component
- Adds loading SVG (based on existing loading icon)
- Toggles display of loader to match form field disabled logic
# Foundation newsletters are handled through Campaign Monitor
FOUNDATION_URL = config(
"FOUNDATION_URL",
default="https://kmq73rfvbh.execute-api.us-east-2.amazonaws.com" if DEV else "https://abdri3ttkb.execute-api.us-east-2.amazonaws.com",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wasn't sure how to test Prod Mode + switch (the switch is OFF in prod)

I ended up removing the switch conditionals in footer-newsletter and helpers and running Prod Mode to confirm the correct URL was applied

Copy link
Contributor

Choose a reason for hiding this comment

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

You can log to django-admin locally and set the switch if you config a CMS super user like step 4 here: https://mozmeao.github.io/platform-docs/cms/?h=wagtail_admin_email#non-sso-authentication (maybe with other accounts too but that's what I have done).

Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. Looking good! One small #a11y change and you're good to merge.

R+ wc

# Foundation newsletters are handled through Campaign Monitor
FOUNDATION_URL = config(
"FOUNDATION_URL",
default="https://kmq73rfvbh.execute-api.us-east-2.amazonaws.com" if DEV else "https://abdri3ttkb.execute-api.us-east-2.amazonaws.com",
Copy link
Contributor

Choose a reason for hiding this comment

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

You can log to django-admin locally and set the switch if you config a CMS super user like step 4 here: https://mozmeao.github.io/platform-docs/cms/?h=wagtail_admin_email#non-sso-authentication (maybe with other accounts too but that's what I have done).

@maureenlholland maureenlholland removed the Needs Review Awaiting code review label Oct 22, 2025
@maureenlholland maureenlholland force-pushed the update-newsletter-subscription branch from ef212f5 to 0bb61b6 Compare October 22, 2025 10:12
@maureenlholland maureenlholland merged commit bb1f709 into mozilla:main Oct 22, 2025
5 checks passed
@maureenlholland maureenlholland deleted the update-newsletter-subscription branch October 22, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend HTML, CSS, JS... client side stuff P1 First level priority - Must have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants