Skip to content

Newsletter signup banner, modal and branded Mailcoach pages - #490

Merged
simonhamp merged 1 commit into
mainfrom
newsletter-signup-banner
Sep 1, 2026
Merged

Newsletter signup banner, modal and branded Mailcoach pages#490
simonhamp merged 1 commit into
mainfrom
newsletter-signup-banner

Conversation

@simonhamp

Copy link
Copy Markdown
Member

We're not getting enough newsletter signups. This turns the site banner into a 10% off offer for subscribing, and keeps the whole signup flow on nativephp.com instead of handing people off to Mailcoach's default pages.

What changed

Bannerx-newsletter-banner takes the site banner slot: "Celebrate SuperNative! Join the newsletter. Get 10% off everything". Clicking it opens the signup modal rather than navigating away.

Modalx-newsletter-modal is mounted once in the layout and opened from anywhere by dispatching an open-newsletter-modal window event, so the banner, the footer card and the unsubscribed page all trigger the same thing. It posts straight to the Mailcoach list with the pet honeypot submitted empty, and carries redirect_after_subscription_pending / _subscribed / _already_subscribed pointing at our own pages.

Footer card — now a button opening the same modal instead of linking off-site to /newsletter, with copy leading on the discount code.

Four branded pages, built from a shared x-newsletter-status component and noindexed, since they're flow endpoints rather than content:

Mailcoach setting URL
Confirm subscription /newsletter/confirm
Someone subscribed /newsletter/subscribed
Email was already subscribed /newsletter/already-subscribed
Someone unsubscribed /newsletter/unsubscribed

Configservices.mailcoach.newsletter_subscribe_url and services.mailcoach.honeypot_field, both env-overridable, defaulting to the live list and pet.

Before this ships

Those four URLs need pasting into the list's redirect settings in Mailcoach. The modal covers the immediate post-submit hop itself, but the "subscribed" and "unsubscribed" redirects fire from links inside emails, so only the list settings can drive them.

Notes

  • The SuperNative banner is what this replaces. It stays in the repo alongside the seven other retired banner components, so swapping back is a one-line change. Its test now covers the component in isolation and asserts it's no longer mounted — mirroring what TheVibesBannerTest did when SuperNative displaced The Vibes. No test was removed.
  • Stripe: cart checkout already sets allow_promotion_codes, so a promo code from Mailcoach will redeem — except when a per-price coupon already applies, where the code path unsets it (CartController.php:575). Discounted-price customers won't be able to stack the newsletter code.
  • layout.blade.php carries two incidental Prettier normalisations (class order on font-poppins, self-closing spacing on x-impersonate::banner) from formatting the file.

Testing

11 tests in NewsletterSignupTest covering the banner, the modal's Mailcoach form and all four pages, plus the rewritten SupernativeBannerTest. Also ran the 58 tests across every suite that touches the homepage, layout or footer — all green. Pint and Prettier clean.

Verified the banner and modal render in a browser, and that all four pages return 200 with the right content. I also probed the Mailcoach endpoint with an empty email to confirm it accepts a token-less cross-origin POST (302, not 419) — that creates nothing and sends no mail. A real end-to-end signup hasn't been run against the production list, so the double opt-in email and code delivery are worth one live submission once the redirect URLs are saved in Mailcoach.

🤖 Generated with Claude Code

The site banner slot now carries a 10% off offer for joining the
newsletter, and clicking it opens a signup modal instead of navigating
away. The footer newsletter card opens the same modal rather than
linking off-site.

The modal posts straight to the Mailcoach list with the `pet` honeypot
submitted empty, and sends Mailcoach back to four of our own pages so
the whole signup flow stays on-brand:

- /newsletter/confirm
- /newsletter/subscribed
- /newsletter/already-subscribed
- /newsletter/unsubscribed

Those URLs still need pasting into the list's redirect settings in
Mailcoach — the subscribed and unsubscribed hops are driven from links
inside emails, so only the list settings can point them here.

The SuperNative banner it replaces stays in the repo alongside the other
retired banners; its test now covers the component in isolation and
asserts it is no longer mounted, mirroring TheVibesBannerTest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@simonhamp
simonhamp marked this pull request as ready for review September 1, 2026 12:12
@simonhamp
simonhamp merged commit 0043394 into main Sep 1, 2026
3 checks passed
@simonhamp
simonhamp deleted the newsletter-signup-banner branch September 1, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant