feat(growth): one-click pack buy links in the credit alert emails (GROWTH_50 #7) - #110
Merged
Conversation
…OWTH_50 #7) Low-credit + credits-depleted emails now carry working one-click buy links: every pack card is itself a GET deep-link to the pre-selected pricing page (/pricing?pack=starter|pro|business — the PR #100 preselect surface; page only highlights/scrolls, checkout never auto-fires per the council rule), the CTA button is moved above the fold, and both emails gain a plaintext alternative so the buy link works in text-only clients. Pack copy is now rendered FROM lib/creditPacks.RECOMMENDABLE_PACKS instead of hardcoded strings, and the render functions are exported for render tests (renderVerificationEmail pattern). Subjects and the AuditLog once-per-cycle dedup wiring in utils/credits.ts are unchanged. Tests: new credit-email-buylinks.test.mjs (28 checks: per-pack links in html+text, prominent CTA, no checkout/subscribe API URL in any email, pricing.html ?pack= allowlist drift guard, wrapper text pass-through, alert wiring pins); intent-funnel email pin updated to the new helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
GROWTH_50 item #7 (council-cleared, Brad GO 2026-07-31): prominent, working one-click buy links in BOTH credit emails — the low-credit alert (
sendLowCreditAlert) and the out-of-credits alert (sendCreditsDepletedAlert).How
https://archtools.dev/pricing?pack=<starter|pro|business>(verified against thepricing.htmlpreselect allowlist at lines 346–348 — exactly those three ids). The page only highlights + scrolls; checkout never auto-fires from a GET (council rule, already pinned byintent-funnel.test.mjs).textthrough.lib/creditPacks.RECOMMENDABLE_PACKSinstead of hardcoded credit/price strings (same catalog the 402 funnel uses; sizes pinned by the intent-funnel drift guard). No pricing amounts changed —scripts/check-price-drift.mjsuntouched and passing.renderLowCreditAlert/renderCreditsDepletedAlert) following the existingrenderVerificationEmail"exported for render tests" pattern. Subjects, styling (layout()+.stat/.btnclasses), and the AuditLog once-per-cycle dedup inutils/credits.tsare all unchanged.Tests
api/tests/credit-email-buylinks.test.mjs(28 checks, mirrorsreactivation-render.test.mjs): per-pack links present in html and text of both emails; prominent CTA href; no/v1/billing/checkout/subscribeAPI URL ever appears in an email (auto-fire guard); every linked pack id is in thepricing.html?pack=allowlist + has a buy button (drift guard); agent id truncation; wrapper text pass-through and alert wiring source pins. Added to thenpm testchain.intent-funnel.test.mjsemail pin updated to the newpackHrefhelper (was a literal-string count that the refactor made stale).Verification (all run locally in the worktree)
npx prisma generate && npx tsc --noEmit→ clean (exit 0)node tests/credit-email-buylinks.test.mjs→ 28/28 ✓node tests/intent-funnel.test.mjs,tests/credit-alert-dedup.test.mjs,tests/reactivation-render.test.mjs→ all passnode api/tests/integration.test.js(13/13) +node api/tests/pages.test.js(31/31) — the CI suitesnode scripts/check-price-drift.mjs→ OKNo dist/node_modules churn committed (4 source/test files only).
🤖 Generated with Claude Code
Note
Low Risk
Transactional email content and growth funnel links only; no billing API or credit-deduction logic changes, with tests enforcing no checkout URLs in email bodies.
Overview
Low-credit and credits-depleted emails now drive users to purchase with clickable pack deep-links (
/pricing?pack=<id>) built fromRECOMMENDABLE_PACKS, instead of static pack copy and a single generic pricing link.Each recommendable pack is a one-click link in HTML (pack cards are
<a>tags) and in a new plaintext body for both alerts; send wrappers passtextthrough tosendEmail. Render logic is split into exportedrenderLowCreditAlert/renderCreditsDepletedAlert(same pattern as verification email tests). The depleted email still promotes x402; layout, subjects, andutils/credits.tsalert dedup wiring are unchanged.Tests: new
credit-email-buylinks.test.mjs(links, catalog drift, no checkout API URLs in email, wiring pins) added tonpm test;intent-funnel.test.mjspins thepackHrefhelper instead of counting literal starter URLs.Reviewed by Cursor Bugbot for commit c295ffd. Configure here.