add newsletter and email campaigns

Subscribers with double opt-in confirmation, campaign composer with
draft/scheduled/sent lifecycle, admin dashboard with overview stats,
CSV export, and shop signup form wired into page builder blocks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-28 23:25:28 +00:00
parent 8f989d892d
commit ad2e6d1e6d
32 changed files with 2497 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
defmodule BerrypodWeb.UnsubscribeController do
use BerrypodWeb, :controller
alias Berrypod.Orders
alias Berrypod.{Newsletter, Orders}
# Unsubscribe links should be long-lived — use 2 years
@max_age 2 * 365 * 24 * 3600
@@ -10,6 +10,7 @@ defmodule BerrypodWeb.UnsubscribeController do
case Phoenix.Token.verify(BerrypodWeb.Endpoint, "email-unsub", token, max_age: @max_age) do
{:ok, email} ->
Orders.add_suppression(email, "unsubscribed")
Newsletter.unsubscribe(email)
conn
|> put_status(200)
@@ -24,7 +25,7 @@ defmodule BerrypodWeb.UnsubscribeController do
</head>
<body>
<h1 style="font-size:1.25rem;margin-bottom:0.75rem">You've been unsubscribed</h1>
<p style="color:#555">We've removed #{email} from our marketing list. You won't receive any more cart recovery emails from us.</p>
<p style="color:#555">We've removed #{email} from our marketing emails. You won't hear from us again.</p>
</body>
</html>
""")