Newsletter opt-in: silent Sendy subscribe on join

Pre-checked "InstantAdPay newsletter" opt-in on the join screen (read by both the
email-code and password signup paths). On new-account creation only, the server
silently subscribes them to the Sendy "InstantAdPay Newsletter" list
(boolean=true, opt-out always wins). New sendy.js helper reads the API key from
SENDY_API_KEY env or DATA_DIR/sendy.key on the volume (same pattern as
sendgrid.key); subscribe is fire-and-forget and never blocks signup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-08 07:13:50 -05:00
parent 8ec6286ff7
commit 8d9f56f68a
4 changed files with 48 additions and 3 deletions
+2 -2
View File
@@ -1332,7 +1332,7 @@
IAP.status('Fresh code sent.', 'ok');
}));
$('mcVerifyBtn').addEventListener('click', busy($('mcVerifyBtn'), async () => {
const r = await api('/api/auth/email/verify', { email: $('mcEmail').value, code: $('mcCode').value });
const r = await api('/api/auth/email/verify', { email: $('mcEmail').value, code: $('mcCode').value, newsletter: !!($('nlOptin') && $('nlOptin').checked) });
IAP.status('You are in.', 'ok');
if (r.created && !(r.account && r.account.username)) await showOnboard(); // pick a username first
if (!(await showGauntlet())) await showLoginAd(); // welcome tour outranks the login ad
@@ -1360,7 +1360,7 @@
}
$('signupBtn').addEventListener('click', busy($('signupBtn'), async () => {
const r = await api('/api/signup', { email: $('suEmail').value, password: $('suPass').value });
const r = await api('/api/signup', { email: $('suEmail').value, password: $('suPass').value, newsletter: !!($('nlOptin') && $('nlOptin').checked) });
IAP.status('Welcome aboard. You are in.', 'ok');
if (!(r.account && r.account.username)) await showOnboard();
await render();
+5 -1
View File
@@ -18,6 +18,10 @@
<p class="lead" id="introLead" style="font-size:16px">Join free with your email. Your wallet only
comes out when you buy a package or switch on payouts, and it stays yours the whole time.</p>
</section>
<label id="nlOptinRow" style="display:flex;gap:9px;align-items:flex-start;margin:0 4px 16px;font-size:13px;color:var(--muted,#8ba69c);cursor:pointer">
<input type="checkbox" id="nlOptin" checked style="margin-top:2px;flex:0 0 auto">
<span>Keep me posted with the InstantAdPay newsletter (tips and updates). You can unsubscribe anytime.</span>
</label>
<div class="card" id="sponsorNote" style="border-color:var(--mint);text-align:center" hidden>
<p style="margin:0"><span class="muted small">You're joining the line of</span><br>
<b id="sponsorNoteName" style="font-size:19px;color:var(--mint)"></b></p>
@@ -687,7 +691,7 @@
</div>
<script src="/assets/common.js?v=20260908c"></script>
<script src="/assets/wallet.js?v=20260907q"></script>
<script src="/assets/my.js?v=20260908f"></script>
<script src="/assets/my.js?v=20260908g"></script>
<script src="/assets/chat.js?v=20260907l"></script>
</body>
</html>