Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: unify Loops templates and verify lifecycle drafts
Richie McIlroy5419356408e4
diff --git a/bun.lock b/bun.lockindex 0d461421a..231b7fa87 100644--- a/bun.lock+++ b/bun.lock@@ -12,6 +12,7 @@"mysql2": "^3.15.2","react": "19.2.0","react-dom": "19.2.0",+ "sharp": "0.35.3","tsdown": "^0.15.6","turbo": "^2.3.4","typescript": "^5.8.3",@@ -660,9 +661,9 @@},"trustedDependencies": ["@parcel/watcher",- "esbuild",- "node-av","sharp",+ "node-av",+ "esbuild","cbor-extract","@swc/core","unrs-resolver",@@ -1339,7 +1340,7 @@"@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.2" }, "os": "linux", "cpu": "x64" }, "sha512-6O1NPKcDVj9QEdg7Hx549EX8U0rp6yXQERqru6yRN7fGBn32UvIRJUlWnk+8xDCiG76hXVBbX82NZ/ZKr0euIg=="],- "@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="],+ "@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],"@img/sharp-webcontainers-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.3" }, "cpu": "none" }, "sha512-2rnq7bX3NzeR2T4YWgz8qiG4h3TSdMe+vN1iQXpJleSJ3SM5zQ8Fy2SyyXAWlbxpEZ2Y+Z4u1BePgJEYbSy80Q=="],@@ -5949,10 +5950,6 @@"@iconify/utils/local-pkg": ["[email protected]", "", { "dependencies": { "mlly": "1.8.2", "pkg-types": "2.3.1", "quansync": "0.2.11" } }, "sha512-++gUqRDEvcnN6Zhqrr+y/CkVEHhlrR96vZn3nZZPYzMcBUyBtTKzB9NadClFIsIVSsu+3i9tfk/erqy9kAmt7Q=="],- "@img/sharp-freebsd-wasm32/@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],-- "@img/sharp-webcontainers-wasm32/@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" } }, "sha512-cZ0XkcYGpHZkqW6iCkqTcmUC0CD9DhD5d/qeZlZkfRBn6GnHniZXLUo5+9xw8Iv76YE6LQFN9YNBlKREcCG76w=="],-"@internationalized/date/@swc/helpers": ["@swc/[email protected]", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],"@internationalized/number/@swc/helpers": ["@swc/[email protected]", "", { "dependencies": { "tslib": "2.8.1" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],@@ -8373,6 +8370,8 @@"wrangler/sharp/@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="],+ "wrangler/sharp/@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="],+"wrangler/sharp/@img/sharp-win32-ia32": ["@img/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="],"wrangler/sharp/@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="],@@ -8459,6 +8458,8 @@"@cloudflare/vitest-pool-workers/wrangler/sharp/@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="],+ "@cloudflare/vitest-pool-workers/wrangler/sharp/@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "1.11.1" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="],+"@cloudflare/vitest-pool-workers/wrangler/sharp/@img/sharp-win32-ia32": ["@img/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="],"@cloudflare/vitest-pool-workers/wrangler/sharp/@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="],diff --git a/emails/AGENTS.md b/emails/AGENTS.mdindex 69645cbb7..57b21350b 100644--- a/emails/AGENTS.md+++ b/emails/AGENTS.md@@ -1,10 +1,11 @@# Working on Cap emails-- Start with `README.md` and `CATALOG.md`. Use the catalogue to identify the email, flow, audience and actual send source before editing.+- Start with `README.md`, `CATALOG.md` and `VOICE.md`. Use the catalogue to identify the email, flow, audience and actual send source before editing.- Keep marketing content in `marketing/`, branding and sender defaults in `brand.ts`, customer-specific prose in `customer-copy.ts`, and ordering/delays in `flows.ts`. Do not add another copy of these definitions under `scripts/`.- Keep email IDs and existing flow step keys stable. Declare variables and provide appropriate fallbacks. Preserve opt-outs, teammate exclusions, customer segmentation and imported-contact holds.-- Reconcile dashboard edits into source before updating Loops drafts. Use the current content revision for API updates. Version shared branding before changing resources used by live emails.-- Regenerate `CATALOG.md` using `bun run emails:catalog`; never edit it by hand. Run `bun run emails:check`, scoped Biome, and relevant tests. After a remote draft update, run `bun run emails:check-loops` and inspect the rendered email.+- Delivery uses custom MJML from `mjml.ts`. Generate archives with `bun run emails:export --output /absolute/path`, then upload the intended archive through Code in the Loops draft editor. The Loops API cannot read or update MJML emails; do not convert them back to native format to bypass this limitation. Reconcile intentional dashboard edits into source first.+- Regenerate `CATALOG.md` using `bun run emails:catalog`; never edit it by hand. Run `bun run emails:check`, scoped Biome, and relevant tests. After a remote draft update, run `bun run emails:check-loops --structure-only` and review every changed email in the browser, including metadata, variable fallbacks, loaded images and footer. API structure checks cannot establish MJML content parity.+- Keep the canonical Cap icon and vector wordmark together; never recreate the lettering with a font. Use `capGreeting` with `Hey,` as the complete fallback; never concatenate a space with an optional first name. Preserve the single address/unsubscribe footer without an opt-in explanation.- Keep Resend application templates and sending behavior in their current locations; update `application.ts` when introducing or removing a send path. Listing a template does not establish that its handler is reachable or deployed.- These commands do not authorize sending, publishing, activating flows, enrolling contacts or deploying production schema. Follow the user's current scope.- Store only nonsecret resource IDs here. Keep credentials, contact exports and suppression registries outside Git.diff --git a/emails/CATALOG.md b/emails/CATALOG.mdindex 35a6e9dcf..3f29748ad 100644--- a/emails/CATALOG.md+++ b/emails/CATALOG.md@@ -44,10 +44,10 @@ flowchart TD| Day | Subject and source | Send condition || --- | --- | --- |-| 0 | [Your first Cap can be a small one](../emails/marketing/free-welcome.ts) | Journey guards |-| 2 | [Try a 30-second recording](../emails/marketing/free-record.ts) | `capHasVideo=false` |-| 5 | [Give your next Cap a little context](../emails/marketing/free-share.ts) | `capHasSharedVideo=false` |-| 9 | [Choose the Cap setup that fits your work](../emails/marketing/free-plans.ts) | Journey guards |+| 0 | [Welcome to Cap](../emails/marketing/free-welcome.ts) | Journey guards |+| 2 | [A quick way to try Cap](../emails/marketing/free-record.ts) | `capHasVideo=false` |+| 5 | [Send your next explanation as a Cap](../emails/marketing/free-share.ts) | `capHasSharedVideo=false` |+| 9 | [Using Cap for work?](../emails/marketing/free-plans.ts) | Journey guards |### Customer onboarding@@ -69,7 +69,7 @@ flowchart TD| Day | Subject and source | Send condition || --- | --- | --- || 0 | [Thanks for choosing {contact.capPlanName}](../emails/marketing/customer-welcome.ts) | Journey guards |-| 3 | [One explanation you can reuse](../emails/marketing/customer-workflow.ts) | Journey guards |+| 3 | [One less thing to explain twice](../emails/marketing/customer-workflow.ts) | Journey guards || 7 | [How is Cap working for you?](../emails/marketing/customer-feedback.ts) | Journey guards |### Teammate onboarding@@ -89,7 +89,7 @@ flowchart TD| Day | Subject and source | Send condition || --- | --- | --- |-| 0 | [Getting started with your team in Cap](../emails/marketing/teammate-welcome.ts) | Journey guards |+| 0 | [Welcome to your team in Cap](../emails/marketing/teammate-welcome.ts) | Journey guards || 3 | [Make your next handoff easier](../emails/marketing/teammate-handoff.ts) | Journey guards |### Former customer follow-up@@ -108,7 +108,7 @@ flowchart TD| Day | Subject and source | Send condition || --- | --- | --- |-| 14 | [What could we have done better?](../emails/marketing/former-feedback.ts) | Journey guards |+| 14 | [Could I ask about your time with Cap?](../emails/marketing/former-feedback.ts) | Journey guards |## Campaign templates@@ -116,25 +116,25 @@ Campaigns are manually scheduled product updates, with no automatic enrollment.| Campaign | Audience | Subject and source | Loops ID || --- | --- | --- | --- |-| Customer product update template | customer | [What is new in Cap](../emails/marketing/customer-update.ts) | `cmtvpmfxc01ls0j0nnlffombv` |+| Customer product update template | customer | [Keeping up with Cap](../emails/marketing/customer-update.ts) | `cmtvpmfxc01ls0j0nnlffombv` || Noncustomer product update template | free | [Take another look at Cap](../emails/marketing/free-update.ts) | `cmtvpmjej01kr0j18cxoz2n0y` |## Branding and personalization-Shared theme, header, signature, sender and fallbacks: [emails/brand.ts](../emails/brand.ts).+Shared design, logo, signature, footer, sender and fallbacks: [emails/brand.ts](../emails/brand.ts). Custom MJML delivery is generated by [emails/mjml.ts](../emails/mjml.ts).-Sender: Richie from Cap; local part `richie` on the Loops sending domain. Reply-to: [email protected]. Theme: Cap lifecycle v1.+Sender: Richie from Cap; local part `richie` on the Loops sending domain. Reply-to: [email protected].-Shared components: Cap lifecycle header v1; Cap lifecycle signature v1.+The shared header uses the canonical Cap icon and vector wordmark, with white backing for contrast on dark backgrounds. The complete greeting is `capGreeting`, with `Hey,` as its fallback. One compact footer contains the company, address and unsubscribe link.Customer welcome variations come from [customer-copy.ts](customer-copy.ts); eligibility is resolved from account and license state in the profile sync.| Plan | Welcome variation || --- | --- |-| Cap Pro | Your Cap Pro plan includes cloud sharing and collaboration, plus the desktop commercial license. Open your dashboard to find your organization and manage your setup. |-| Cap Self-hosted | Your self-hosted license supports your own Cap deployment. Use the setup details supplied with your purchase, and reply if you need help. |-| Cap Desktop | Your desktop license covers commercial use of Cap's recorder and editor. Activate it in the desktop app using the license details from your purchase email. |-| Cap | If you need help with your Cap account or access, reply to this email. |+| Cap Pro | With Cap Pro, you can share recordings with a link and work on them with your team. Your plan also includes the desktop commercial license, so you can use Cap for client work too. |+| Cap Self-hosted | For your self-hosted setup, start with the instructions supplied with your purchase. If you get stuck anywhere, reply with what you're seeing and I'll help you sort it. |+| Cap Desktop | Your desktop license lets you use Cap's recorder and editor for commercial work. You can activate it in the app with the license details from your purchase email. |+| Cap | If you need a hand getting set up, just reply and I'll help you sort it. |## Marketing email copy@@ -144,93 +144,93 @@ The excerpts below show content, not an email-client render. Branding and requirHelp an independent free user make their first recording.-**Subject:** Your first Cap can be a small one+**Subject:** Welcome to Cap-**Preview:** Pick one thing you would usually explain in a message.+**Preview:** Richie here. Great to have you with us :)-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/free-welcome.ts](../emails/marketing/free-welcome.ts)-Hi {contact.firstName},+{contact.capGreeting}-Thanks for trying Cap. A good first recording is something small: a quick explanation, a bug you spotted, or feedback on a piece of work.+Richie here, founder of Cap. Thanks for giving it a go :)-Pick one thing you would normally type out, and record it instead. Use Instant Mode for a shareable link, or Studio Mode when you want to edit before exporting.+The easiest way to start is to record something you'd normally type out. A quick explanation or a bit of feedback is plenty.-Download Cap+Use Instant Mode when you want a shareable link, or Studio Mode to edit your recording and export it locally.-If you get stuck, reply to this email. We can help.+Download Cap here.++If you have any questions, just reply to this email. I'd love to help.### free-recordOffer recording help when no cloud video is known.-**Subject:** Try a 30-second recording+**Subject:** A quick way to try Cap-**Preview:** A simple way to get comfortable with Cap.+**Preview:** You don't need a script or a perfect take.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/free-record.ts](../emails/marketing/free-record.ts)-Hi {contact.firstName},--Here is an easy way to try Cap: open something you are working on and explain one small part of it out loud.+{contact.capGreeting}-Choose your screen or a single window, check your microphone, and record for about 30 seconds. No script needed.+If you're still finding your feet with Cap, try this: open something on your screen and spend 30 seconds explaining it out loud.-If you prefer to keep the recording on your device, use Studio Mode and export it locally.+No script or perfect take needed. In Studio Mode, you can trim it afterwards and keep the recording on your own device.-Open the downloads page+Need the app? You can download Cap here.-Already recording locally? You are all set. Local recordings do not necessarily appear in your cloud library.+If something's stopping you from recording, reply and let me know what happened. I'll help you sort it.### free-shareOffer sharing guidance when no shared cloud video is known.-**Subject:** Give your next Cap a little context+**Subject:** Send your next explanation as a Cap-**Preview:** Help the person watching know what to look for.+**Preview:** A short recording and one sentence are enough.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/free-share.ts](../emails/marketing/free-share.ts)-Hi {contact.firstName},+{contact.capGreeting}-A recording works best when the person watching knows why you sent it.+Next time you're typing a long explanation, try showing it in Cap instead.-Give your Cap a clear title, then send the link with one sentence about what you need: feedback, a decision, or just a quick look.+Record the bit that's hard to explain, then send the link with a sentence about what you need. Something like: “Here's the bug I mentioned. Can you see the same thing?”-For a bug report, show what you expected and what happened. For feedback, point to the specific part you want to discuss.+It doesn't have to be polished to be useful.-Open your library+Open your Cap library.### free-plansExplain current plan options to eligible independent noncustomers.-**Subject:** Choose the Cap setup that fits your work+**Subject:** Using Cap for work?-**Preview:** A desktop license and Cap Pro solve different needs.+**Preview:** Here's how the Desktop License and Cap Pro compare.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/free-plans.ts](../emails/marketing/free-plans.ts)-Hi {contact.firstName},+{contact.capGreeting}-If the free version covers what you need, keep using it.+If you're thinking about using Cap for work, there are two options.-If you use Cap for work, a Desktop License covers commercial use of the desktop recorder and editor. Cap Pro adds the cloud sharing and collaboration features, and includes the desktop commercial license.+A Desktop License covers commercial use of the recorder and editor. It's a good fit if you mainly edit and export videos yourself.-The plans page has the current features and prices, so you can choose based on how you actually use Cap.+Cap Pro adds cloud sharing and collaboration, and includes the desktop commercial license. That's the one to look at if you're sharing recordings with clients or your team.-Compare Cap plans+Compare the plans here.-Unsure which one fits? Reply with how you use Cap and we will point you in the right direction.+Not sure which you need? Reply with what you're using Cap for and I'll point you in the right direction.### customer-welcome@@ -238,45 +238,41 @@ Welcome a paying customer with copy matching their paid plan.**Subject:** Thanks for choosing {contact.capPlanName}-**Preview:** A few useful things to do first.+**Preview:** Thanks for backing what we're building.-**Variables:** `contact.capCustomerWelcome` (fallback: Your paid access is ready. If you need help getting started, reply to this email.); `contact.capPlanName` (fallback: Cap); `contact.firstName` (fallback: there)+**Variables:** `contact.capCustomerWelcome` (fallback: If you need a hand getting set up, just reply and I'll help you sort it.); `contact.capPlanName` (fallback: Cap); `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/customer-welcome.ts](../emails/marketing/customer-welcome.ts)-Hi {contact.firstName},+{contact.capGreeting}-Thank you for supporting Cap.+Richie here, founder of Cap. Thanks so much for supporting what we're building. It means a lot.{contact.capCustomerWelcome}-Start with one recording you need to make this week. A walkthrough, a customer explanation, or feedback for a colleague is plenty.--Get Cap--If anything about your setup or access looks wrong, reply and we will help you sort it out.+What are you planning to use Cap for? Just reply and let me know. I'd love to hear.### customer-workflowHelp a customer build a repeatable recording habit.-**Subject:** One explanation you can reuse+**Subject:** One less thing to explain twice-**Preview:** Turn a recurring question into a short recording.+**Preview:** A recording you can keep coming back to.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/customer-workflow.ts](../emails/marketing/customer-workflow.ts)-Hi {contact.firstName},+{contact.capGreeting}-One of the most useful things to record is an answer you keep giving.+A quick idea for your next recording: pick a question you keep answering and record the walkthrough once.-Pick a recurring question, record a short walkthrough, and give it a title you will recognize later. Trim the beginning and end if you need to, then export or share it in the way that suits your work.+It could be how to set something up, where to find a setting, or how you want a piece of work done. Give it a title you'll recognise later, then save or share it wherever you normally answer that question.-The next time the question comes up, you already have the answer ready.+The next time someone asks, you've already got it ready.-If you have a workflow you would like Cap to make easier, reply and tell us about it.+Anything making that harder than it should be? Reply and tell me.### customer-feedback@@ -284,45 +280,43 @@ Ask a customer what is useful and what needs improvement.**Subject:** How is Cap working for you?-**Preview:** Tell us what is useful and what gets in the way.+**Preview:** I'd love to hear what's working and what isn't.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/customer-feedback.ts](../emails/marketing/customer-feedback.ts)-Hi {contact.firstName},+{contact.capGreeting}-How has Cap been working for you?+How are you getting on with Cap?-I would love to know what you have been using it for, and whether anything has been confusing or frustrating.+I'd love to know if there's anything you wish worked differently, or something that's getting in your way.-Just reply to this email. Specific examples help us decide what to improve next.+Just reply here. I read every reply, and hearing how people actually use Cap helps me decide what we should work on next.-Thanks again for supporting what we are building.+Thanks again for backing us :)### teammate-welcomeHelp an invited teammate find their workspace without promoting upgrades.-**Subject:** Getting started with your team in Cap+**Subject:** Welcome to your team in Cap-**Preview:** Find your workspace and make your first handoff easier.+**Preview:** Here's where to find your team's recordings.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/teammate-welcome.ts](../emails/marketing/teammate-welcome.ts)-Hi {contact.firstName},--Welcome to your team in Cap.+{contact.capGreeting}-Open your dashboard and make sure the right organization is selected. That is where you will find the recordings your team shares with you.+Richie here, founder of Cap. Great to have you with us :)-If something is missing, check with the person who invited you. They can confirm your workspace and access.+Open your dashboard and select your team's organisation. You'll find the recordings they've shared with you there.-Open your workspace+If you can't see the right organisation, check with the person who invited you. They can confirm which email address they used and your access.-You can also reply here if you need help getting set up.+You can also reply here if you need a hand.### teammate-handoff@@ -330,85 +324,83 @@ Help a teammate share useful context with their organization.**Subject:** Make your next handoff easier-**Preview:** A short recording can give your teammate the context they need.+**Preview:** Show your teammate the bit that's hard to put into words.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/teammate-handoff.ts](../emails/marketing/teammate-handoff.ts)-Hi {contact.firstName},--For your next handoff, try recording the bit that is difficult to explain in writing.+{contact.capGreeting}-Show the work, explain what changed, and say what you need from the person watching. A clear title and a short note beside the link make it easier to pick up later.+Next time you hand something over to a teammate, try recording the part that's tricky to explain in a message.-When sharing, check that the recording is available to the right people in your organization.+Show what changed and what you need them to look at. Even a short recording can save a lot of back and forth.-Open your workspace+Open your team workspace. Before sending a recording, check its sharing settings so the right people can watch it.-If the team workflow feels awkward anywhere, reply and let us know.+If anything about sharing with your team feels awkward, reply and let me know.### former-feedbackAsk an eligible former cloud customer for feedback after paid access ends.-**Subject:** What could we have done better?+**Subject:** Could I ask about your time with Cap?-**Preview:** A quick question about your experience with Cap.+**Preview:** I'd appreciate your honest feedback.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/former-feedback.ts](../emails/marketing/former-feedback.ts)-Hi {contact.firstName},+{contact.capGreeting}-Now that your paid access has ended, I wanted to ask what could have made Cap more useful for you.+Could I ask what made you decide to stop using your paid Cap plan?-Was there something missing, something that did not work properly, or did you just not need it anymore?+Was something missing, did something not work properly, or did you just not need it anymore?-Reply if you have a moment. Honest feedback helps us make better decisions.+If you've got a moment to reply, I'd really appreciate it. And if there was a problem I can help with, I'd like to try.-Thanks for giving Cap a try.+Thanks for giving Cap a go.### customer-update-Reusable product update for customers.+Evergreen changelog invitation for customers; review before each campaign.-**Subject:** What is new in Cap+**Subject:** Keeping up with Cap-**Preview:** See the latest improvements in the changelog.+**Preview:** The changes we've shipped, all in one place.-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/customer-update.ts](../emails/marketing/customer-update.ts)-Hi {contact.firstName},+{contact.capGreeting}-We have been working on improvements to Cap. You can find the latest changes and fixes in the changelog.+Just a quick one from me. If you're wondering what's changed in Cap, we keep the features and fixes together in our changelog.-Read the changelog+Here's what we've shipped.-If something would make Cap more useful for you, reply and tell us.+Is there something you're still waiting for us to build or fix? Reply and let me know. Hearing what's missing is just as useful as hearing what's working.### free-update-Reusable product update for eligible independent noncustomers.+Evergreen reactivation invitation for eligible independent noncustomers; review before each campaign.**Subject:** Take another look at Cap-**Preview:** Catch up on the latest changes.+**Preview:** Was something missing when you tried it?-**Variables:** `contact.firstName` (fallback: there)+**Variables:** `contact.capGreeting` (fallback: Hey,)**Edit:** [emails/marketing/free-update.ts](../emails/marketing/free-update.ts)-Hi {contact.firstName},+{contact.capGreeting}-If you have not tried Cap recently, the changelog is a good place to see what has changed.+If it's been a while since you tried Cap, I'd love for you to take another look.-Download the latest version when you have a recording to make. You can start small and see whether it fits how you work.+You can see what's changed here. Next time you need to explain something on screen, give it a go.-See what is new+If something put you off last time, just reply and tell me. I'd like to know, especially if it was something we could have done better.## Application emailsdiff --git a/emails/QA.md b/emails/QA.mdnew file mode 100644index 000000000..3c132ee07--- /dev/null+++ b/emails/QA.md@@ -0,0 +1,50 @@+# Loops migration verification — 11 September 2026++All four production workflows and both campaign templates remain drafts. No actual customer received a test email. The four temporary QA workflows are paused, and all 36 owned QA contacts from the two test runs are held and globally unsubscribed.++## What was exercised++The controlled test used the real `classifyProfile` and `contactUpdate` logic with synthetic fixtures, wrote those properties to Loops, and received real workflow emails in owned Cap inbox aliases. Each QA flow required an exact recipient allowlist and a separate QA trigger property; production lifecycle stages stayed idle. Timers were compressed to two minutes, with the production audience guards and milestone branches retained.++| Scenario | Received | Result |+| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------------------------------------- |+| Independent free user | 4 | Welcome, recording, sharing and plan guidance |+| Customer | 3 | Customer sequence only |+| Teammate | 2 | Workspace help only; no promotions |+| Former customer | 1 | Feedback request |+| Recording and sharing milestones already complete | 2 | Both reminders skipped; welcome and plan guidance retained |+| Purchase after welcome | 1 | Later free-user promotions stopped |+| Invitation after welcome | 1 | Later free-user promotions stopped |+| Global unsubscribe after welcome | 1 | Later messages stopped |+| Mailing-list unsubscribe after welcome | 1 | Later messages stopped |+| Held, denied consent, list opt-out, unknown audience, customer in free flow, teammate in free flow, disabled lifecycle, ineligible onboarding, unknown consent | 0 across all 9 cases | No enrollment emails |++Exactly 16 workflow emails arrived. Trigger replay during the journey and after completion did not produce extra mail. A later mailbox reconciliation still found exactly 16. Transitions happened before the next timer elapsed. This proves the tested Loops behavior when fresh properties reach Loops, not the latency or reliability of a production scheduler that has not been deployed.++An initial allowlist configuration prevented all sends. It was corrected to apply once at entry; the downstream production audience guards remained active. The initial run's contacts were held before the successful run. All test workflows were paused afterward and every QA contact was independently read back with lifecycle flags false, both stages idle and global subscription false.++## Copy and rendering++All 12 messages were reviewed against the private Bento sequence/broadcast archive and rewritten around one useful action. The [voice guide](VOICE.md) records each email's purpose. Prices, promotions and unsupported activity claims were removed. This is an editorial conversion hypothesis; no measured conversion lift is claimed.++The final drafts were uploaded as generated custom MJML and reviewed in the actual Loops editor for copy, links, subject, preview, sender, reply address, fallback values and one compact footer. Loops' native opt-in explanation is absent. A native line-height mistake was fixed: LMX interprets line height as a percentage, so `26` collapsed the footer; custom delivery now uses explicit 26px body and 19px footer line heights.++The final header exports the actual Cap component's vector paths, including its original wordmark, to a 486×160 PNG. It is displayed at 120px wide with its natural aspect ratio. The image's left edge and body copy start at 28px in the 600px email. The PNG is fully opaque with white backing so the original dark lettering remains legible against dark backgrounds. The final received email's logo bytes matched the local PNG by SHA-256. There is no replacement font or separate text approximation. Cross-client automatic dark-mode transformations and every mobile email client have not been exhaustively tested.++Controlled previews to `[email protected]` verified an absent name renders `Hey,`, a supplied name renders `Hey Richie,`, and the customer plan name and plan-specific prose appear correctly. The inbox preview text is retained. The final logo preview is separate from the earlier icon-only and temporary text-wordmark previews; use the newest preview when reviewing the design.++All 16 workflow messages and the inspected final-layout previews arrived in Gmail's inbox with SPF, DKIM and DMARC passing, plus one-click unsubscribe headers. Category placement varied. Authentication and these observed deliveries do not guarantee future inbox placement or eliminate spam complaints.++## Local regression checks++The profile replay used the archived 10 September snapshot at a fixed date: 64,288 source profiles, zero audience or consent changes, every profile held, and no customer or teammate made promotion-eligible. Greeting output was checked for every profile. This was a historical regression replay, not a fresh production reconciliation.++The local suite checks consent precedence, suppression preservation, customer and teammate classification, milestones, enrollment holds, missing/blank names, source variables, fallback contracts, footer uniqueness, preserved links and unsupported template blocks. Scoped TypeScript and formatting checks cover the touched scripts. The read-only Loops verifier checks graph structure and confirms all 12 emails use custom format. Custom MJML content cannot be fetched through the beta API; browser review is required, and the default full-content check fails explicitly rather than claiming parity.++## Remaining gate before switching++The deployed Cap signup/purchase/invite/opt-out path through an enrollment dispatcher and into an inbox has not been proven. The reviewed schema is not deployed, new explicit consent capture/enrollment and retry/deduplication dispatch need implementation, and the current sync intentionally keeps contacts held. Freshness expiry and scheduler monitoring are also required: an old `capVerifiedAt` value does not automatically prevent a Loops send.++Follow the [cutover runbook](../scripts/loops/README.md#before-any-activation). Test that deployed path using owned inboxes, including outages and retries, before requesting production activation. Keep imported history held, preserve all opt-outs, reconcile fresh Bento changes, check Resend overlap and disable duplicate Bento automation only during the approved cutover.++Private contact data, message bodies, action logs, API verification and import receipts remain outside Git. The [delivery receipt](delivery-receipt.json) records reviewed local archive hashes and draft identifiers; it is historical evidence, not live drift detection.diff --git a/emails/README.md b/emails/README.mdindex d518db8c5..699cecd87 100644--- a/emails/README.md+++ b/emails/README.md@@ -1,26 +1,27 @@# Cap email library-Start with the [email catalogue and flow maps](CATALOG.md). It contains all four Loops journeys, two campaign templates, every marketing email's copy, customer variations, and the existing Resend application email inventory. The catalogue is generated from the same definitions used by the migration tooling.+Start with the [catalogue and flow maps](CATALOG.md), [copy guidance](VOICE.md), and [QA results](QA.md). The catalogue includes four Loops journeys, two campaign templates, all 12 marketing emails, customer variations, and the existing Resend application email inventory.## Where to make changes-| Change | Source |-| --------------------------------------------------------------------- | ------------------------------------ |-| See all flows, timing and email copy | [CATALOG.md](CATALOG.md) |-| Colours, typography, buttons, header, signature, sender and fallbacks | [brand.ts](brand.ts) |-| Subject, preview, body and purpose of one marketing email | [marketing/](marketing/) |-| Flow order, relative delays and milestone branches | [flows.ts](flows.ts) |-| Campaign definitions and targeting | [campaigns.ts](campaigns.ts) |-| Shared audience filter rules and contact property names | [audiences.ts](audiences.ts) |-| Paid-plan names and customer welcome variations | [customer-copy.ts](customer-copy.ts) |-| Existing application email purposes, triggers and send locations | [application.ts](application.ts) |-| Nonsecret Loops resource and node IDs | [resources.json](resources.json) |+| Change | Source |+| --------------------------------------------------------------- | ---------------------------------------------- |+| Copy, subject, preview and purpose | [marketing/](marketing/) |+| Logo, colours, spacing, signature, footer, sender and fallbacks | [brand.ts](brand.ts) |+| Shared delivery layout | [mjml.ts](mjml.ts) |+| Flow ordering, delays and milestone branches | [flows.ts](flows.ts) |+| Campaign targeting | [campaigns.ts](campaigns.ts) |+| Audience guards and contact properties | [audiences.ts](audiences.ts) |+| Paid-plan welcome variations | [customer-copy.ts](customer-copy.ts) |+| Application email purposes and send locations | [application.ts](application.ts) |+| Registered Loops resource IDs | [resources.json](resources.json) |+| Last reviewed upload hashes | [delivery-receipt.json](delivery-receipt.json) |-Marketing copy belongs here. `scripts/loops/program.ts` is a compatibility export, not another source to edit. Each marketing file holds its subject, preview, purpose, declared variables and LMX body. Paragraphs are separate strings joined without changing the resulting email. Shared branding is composed around each body by `emailContent()`.+Each marketing file uses a small shared content vocabulary: Paragraph, Link, Strong, Em and Br. The MJML renderer combines that copy with the shared design. Unsupported new blocks fail export instead of silently disappearing. `scripts/loops/program.ts` is a compatibility export, not another copy source.-Application emails keep their existing React Email templates under `packages/database/emails/`. This index links to those sources; it does not duplicate their templates or change their provider. Loops audience filters and marketing branding do not automatically apply to Resend sends.+The header uses the actual Cap vector artwork from `packages/ui/src/components/icons/Logo.tsx`. `bun run emails:logo` renders its original paths to the checked-in PNG with white backing. This preserves the wordmark and keeps its dark lettering visible on dark backgrounds. Do not rebuild the wordmark with a font or substitute the icon alone. The image and body share the same left edge.-## Edit and inspect locally+## Edit and uploadFrom the repository root:@@ -28,41 +29,37 @@ From the repository root:bun run emails:catalogbun run emails:checkbun test scripts/emails scripts/loops/profile.test.ts+bun run emails:export --output /absolute/path/to/reviewed-exports```-`emails:catalog` rebuilds the readable catalogue and Mermaid diagrams. `emails:check` is offline: it checks catalogue freshness, duplicate/missing email files, declared variables and fallbacks, shared branding use, delays, and the application template/send-source inventory. It does not replace Loops' LMX compiler, Guardian or a rendered preview.+The export creates one ZIP and MJML file per email, plus a manifest containing subjects, preview text, sender fields, fallbacks and hashes. Every ZIP contains `index.mjml` and its logo. All copy and design changes start here in source; the generated catalogue is never edited by hand.-Flow delays are relative to the previous step. The catalogue computes cumulative day numbers automatically. A skipped milestone reminder rejoins the flow and still observes the subsequent delay. The first-recording Resend email is also listed so future changes can account for overlap.+In the intended Loops draft, choose **Code → Upload another email → Select**, select its ZIP, and upload. A native email uses **Code → Select** for its first conversion. Review the actual subject, preview text, sender, reply address and every variable fallback against the manifest. Uploading the body does not update these metadata fields automatically. Wait for the logo to load, inspect all copy and links, confirm one footer, and verify the email remains a draft.-## Compare with Loops+Keep `capGreeting` as a complete salutation with `Hey,` as its fallback. Profile sync supplies `Hey Richie,` only when a nonblank name is known. Previously imported contacts need an approved profile refresh before their new greeting property is populated; until then the fallback applies. Changes to `customer-copy.ts` also require a profile refresh and do not instantly change stored Loops properties.-Provide `LOOPS_API_KEY` in the process environment, then run:+## Verification boundaries++With `LOOPS_API_KEY` supplied through the environment:```sh-bun run emails:check-loops+bun run emails:check-loops --structure-only```-This command only reads Loops. It checks the expected team, registered resource IDs, draft status, workflow graph, downstream audience guards, branch reconnections, delays, campaign audiences, configured theme styles, shared components, message content, sender fields, fallbacks and Guardian results. It reports a failure when local and remote content differ. Live status is not embedded in the generated catalogue.--Dashboard edits must be reconciled into the local source before updating a managed draft. Read the current email and its `contentRevisionId`, compare it with the proposed local content, and preserve intentional dashboard changes. Updates must include `expectedRevisionId` so an intervening edit causes a conflict. The older provisioner uses a resumable migration receipt and is not a two-way editor or a replacement for this comparison.--Use the official Loops API/LMX skills for draft changes. Review the local diff, update only the intended drafts, run the read-only check again, and inspect the Loops render. Do not send a test or preview email as part of local validation. Sending and workflow activation remain separate actions.--## Branding changes+This read-only command checks the team, mailing list, draft statuses, workflow graphs, downstream audience guards, branch reconnections, delays, campaign targeting and custom email format. Loops' beta API returns HTTP 409 for reading or updating custom MJML emails, so their contents and Guardian results require browser review. Running without `--structure-only` deliberately fails when content cannot be verified; it never treats an unreadable email as a content match.-All marketing messages inherit one theme and shared header/signature components. Keep brand styling in `brand.ts`; individual messages should contain content and layout, not copied colours, fonts or logos.+The historical upload receipt records the local export hashes reviewed in the browser. It is not live drift detection. Reconcile intentional dashboard edits into source before uploading replacements. Do not switch back to native format to bypass the API limitation: native footers reintroduce the automatic opt-in explanation. The legacy provisioner refuses `--apply` while custom MJML delivery is configured.-Shared Loops theme/component updates can affect every email using them. Create a new named branding version for a redesign, attach it to reviewed drafts, then verify the rendered result. The provisioner refuses to silently reuse a same-named theme/component whose content differs. Retain the previous version while any live email uses it.+Local commands and read-only checks never send or enroll contacts. Preview sends require the user's sending scope; this migration's QA used only owned Cap inboxes. Production activation remains a separate cutover action.-Changing `customer-copy.ts` changes the copy produced by profile sync; it does not instantly rewrite contact properties already stored in Loops. Review and refresh the intended profiles separately.+## Adding emails and flows-## Add an email or flow+1. Add `marketing/<stable-id>.ts` implementing `EmailDefinition`. Declare every variable and a suitable shared fallback.+2. Register the email in `flows.ts` or `campaigns.ts`. Preserve existing IDs and step keys because resource receipts refer to them.+3. Regenerate the catalogue. Check consent, customer and teammate exclusions, downstream guards, milestone behavior and re-entry rules.+4. Create the intended draft graph through the supported migration tooling, then upload the generated custom email and record its resource IDs. The existing provisioner is guarded against overwriting the custom programme; extending graphs needs a scoped implementation.+5. Run the local and graph checks, inspect each changed render, then commit definitions and generated catalogue together.-1. Add one `marketing/<stable-id>.ts` file implementing `EmailDefinition`; use the same ID as its filename.-2. Declare every contact variable used in the subject, preview and body. Add an appropriate shared fallback and contact property contract when needed. Current journeys use contact-property triggers; event variables need an explicit event-trigger design first.-3. Register it in `flows.ts` or `campaigns.ts`. Keep existing step keys stable because migration receipts identify nodes by these keys.-4. Regenerate and review the catalogue. For a new flow, verify consent, customers, teammate exclusions, downstream guards and re-entry behavior.-5. Create or update the intended Loops draft using the migration/API tooling and record verified resource/node IDs in `resources.json`. Workflow graph editing currently uses the migration beta integration; content checks do not grant activation permission.-6. Run local and remote checks, inspect the render, and commit the source and regenerated catalogue together.+Resend application templates stay under `packages/database/emails/`; the inventory links to them without duplicating their content. Their sending behavior and layout are unchanged. Loops marketing guards do not control Resend, and the first-recording email needs an overlap check before lifecycle activation.-Never add exports, subscriber records, consent hashes or credentials to this directory. The [migration runbook](../scripts/loops/README.md) owns imports, consent seeding, live sync and cutover requirements. No local library command enrolls contacts or sends emails.+Keep credentials, contacts, suppression hashes and exports outside Git. The [migration runbook](../scripts/loops/README.md) owns imports, suppression seeding, production integration and cutover.diff --git a/emails/VOICE.md b/emails/VOICE.mdnew file mode 100644index 000000000..9f0988a1e--- /dev/null+++ b/emails/VOICE.md@@ -0,0 +1,46 @@+# Writing emails from Richie++Use this alongside the [catalogue](CATALOG.md). The reference is Richie's actual Bento mail: the welcome sequence (36459), Studio Mode explanation (47417), tips (47847), team introduction (47848), founder story (31811), and recent product/security updates (75230, 75463, 76365). The private archive contains six sequence templates and 66 broadcasts. Do not put subscriber exports or personalised unsubscribe links in this repository.++## Voice++Start with the complete `capGreeting` property: “Hey Richie,” when a nonblank name is known, otherwise “Hey,”. Keep “Hey,” as the Loops fallback too. Introduce Richie in a welcome email; later emails can get straight to the point. Use contractions, ordinary words and British spelling. Write “reply and let me know”, not “your feedback helps us make better decisions”. An occasional `:)` fits the originals; using one in every email does not.++Use first person for something Richie is asking or offering, and “we” for work the Cap team has done. Keep promises realistic. Do not invent a personal anecdote, say Richie noticed someone's activity, or imply a manually written one-to-one message. Replies go to `[email protected]`.++Give each email one reason to exist and one main action. Usually 60–120 words is enough. A question that invites a reply can be the entire action. Keep advice specific: what to record, where to find the workspace, or which paid plan covers the recipient's need. Read the result aloud and cut anything that could appear in any software company's email.++Do not automatically carry forward historical prices, discounts, countdowns, launch dates, team size, platform support or compliance claims. Verify them against the current product and approved offer. No fake `Re:`, invented urgency or claims of guaranteed results. Local recordings are not visible to this sync, so “you haven't recorded yet” is not a supported claim.++## Design++`brand.ts` owns the sender, canonical Cap logo artwork, “Cheers, Richie” signature, footer, background, 16px body type, line height, paragraph spacing and link colour. `mjml.ts` renders these into every upload. Keep bodies as simple paragraphs; an individual email should not duplicate the design. The logo PNG is exported from the canonical Cap component, including its exact vector wordmark. Its white backing preserves contrast on dark backgrounds without substituting a different font. Keep it at its natural aspect ratio, with no extra left inset.++Use one descriptive text link when a click is needed. Feedback emails can have no link. Keep the essential message readable with images blocked. Custom MJML contains exactly one company/address/unsubscribe footer, without the automatic opt-in explanation. Use `{unsubscribe_link}` so Loops supplies the actual link. Body line height is 26px and footer line height is 19px; native LMX uses percentages, not pixels. Check the actual render after upload and wait for images to load.++## Review of the current programme++| Email | Main action | Editorial decision |+| ------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |+| Free welcome | Download and make a first recording | Personal introduction, two recording modes, no upgrade pitch. |+| Free recording help | Try a short recording | Conditional advice, no claim that local recording activity is known. |+| Free sharing help | Share a useful explanation | One concrete bug-report example and library link. |+| Free plan guidance | Compare paid plans | Explain Desktop versus Pro by use case; no stale price or coupon. |+| Customer welcome | Reply with intended use | Thank the customer, use the actual plan variation, remove a desktop download link that did not fit self-hosted customers. |+| Customer workflow | Record an answer once | Practical habit that works with local exports or cloud sharing. |+| Customer feedback | Reply with a problem or request | One short question, no survey or upgrade diversion. |+| Teammate welcome | Find the right organisation | Practical access help; no promotion. |+| Teammate handoff | Share context with the team | One task and an access check; no promotion. |+| Former customer feedback | Explain why they left | Offer help without a coupon, pressure or automatic re-enrolment. |+| Customer campaign | Read the changelog or reply | Honest evergreen invitation; no invented announcement. |+| Free-user campaign | Reconsider Cap for a real task | Ask what put them off; no claim that a specific missing feature is fixed. |++The two campaign drafts are reusable evergreen starting points. A feature announcement should replace the subject, preview and body with the specific verified feature and how to use it. Review targeting and content for every campaign; do not repeatedly send the same generic update to the whole imported list.++## Conversion and learning++The sequence first helps the recipient get value, then explains the paid option where appropriate. Customers receive usage and feedback emails. Teammates receive workspace help. Unknown identities receive nothing. Recording/sharing reminders are skipped when the corresponding known cloud milestone is complete.++Measure first recording and first share after onboarding, paid conversion after plan guidance, useful replies, and retained usage for customers. Compare eligible delivered recipients over a defined window; report unsubscribes, complaints and bounces alongside conversions. Open rate alone is not a reliable conversion measure, and historical Bento opens/clicks do not establish which copy causes purchases.++Start with this baseline and change one meaningful variable at a time once there is enough traffic: the plan email's subject, the main action, or timing. Keep audience and consent rules identical across variants. Purchase attribution and these conversion reports still need to be connected to the live enrollment service before claiming a measured uplift.diff --git a/emails/assets/cap-logo.png b/emails/assets/cap-logo.pngnew file mode 100644index 000000000..0dc5b4f09Binary files /dev/null and b/emails/assets/cap-logo.png differdiff --git a/emails/audiences.ts b/emails/audiences.tsindex 2d89a52e7..12381da93 100644--- a/emails/audiences.ts+++ b/emails/audiences.ts@@ -1,4 +1,5 @@export const contactProperties = {+ capGreeting: "string",capAudience: "string",capOrigin: "string",capConsent: "string",diff --git a/emails/brand.ts b/emails/brand.tsindex 129a6f28c..1f322732f 100644--- a/emails/brand.ts+++ b/emails/brand.ts@@ -1,4 +1,23 @@-export const brandingVersion = 1;+export const brandingVersion = 6;++export const deliveryFormat: "mjml" | "lmx" = "mjml";++export const bodyLineHeightPercent = 160;++export const logo = {+ src: "https://images.vialoops.com/cmtvpmjen01ks0j18ebmp77uk/img/cmtwz64ty00qx0j0poxsc4u7x.png",+ file: "emails/assets/cap-logo.png",+ width: 120,+ borderRadius: 0,+};++export const signature = ["Cheers,", "Richie"];++export const footer = {+ company: "Cap Software, Inc.",+ address: "1111B S Governors Ave, Dover, DE 19904, United States",+ unsubscribeLabel: "Unsubscribe",+};export const theme = {name: `Cap lifecycle v${brandingVersion}`,@@ -11,11 +30,11 @@ export const theme = {bodyFontCategory: "sans-serif",textBaseColor: "#252525",textBaseFontSize: 16,- textBaseLineHeight: 26,+ textBaseLineHeight: bodyLineHeightPercent,textLinkColor: "#3159d6",heading1Color: "#171717",heading1FontSize: 26,- heading1LineHeight: 34,+ heading1LineHeight: 130,heading2FontSize: 21,buttonBodyColor: "#3159d6",buttonTextColor: "#ffffff",@@ -29,11 +48,11 @@ export const theme = {export const components = [{name: `Cap lifecycle header v${brandingVersion}`,- lmx: '<Paragraph fontSize="20" paddingBottom="24"><Strong><Link href="https://cap.so">Cap</Link></Strong></Paragraph>',+ lmx: `<Image src="${logo.src}" alt="Cap" width="${logo.width}" borderRadius="${logo.borderRadius}" paddingBottom="24" />`,},{name: `Cap lifecycle signature v${brandingVersion}`,- lmx: '<Paragraph paddingTop="16">Richie<Br />Founder, Cap</Paragraph>',+ lmx: `<Paragraph lineHeight="${bodyLineHeightPercent}" paddingTop="8">${signature.join("<Br />")}</Paragraph>`,},];@@ -45,14 +64,16 @@ export const sender = {};export const contactFallbacks = {- firstName: "there",+ capGreeting: "Hey,",capPlanName: "Cap",capCustomerWelcome:- "Your paid access is ready. If you need help getting started, reply to this email.",+ "If you need a hand getting set up, just reply and I'll help you sort it.",};export type BrandIds = { theme: string; header: string; signature: string };+export const paragraphSpacing = 16;+export const emailContent = (message: { subject: string; previewText: string; body: string },ids: BrandIds,@@ -60,6 +81,6 @@ export const emailContent = (subject: message.subject,previewText: message.previewText,...sender,- lmx: `<Style themeId="${ids.theme}" />\n<Component componentId="${ids.header}" />\n${message.body}\n<Component componentId="${ids.signature}" />`,+ lmx: `<Style themeId="${ids.theme}" />\n<Component componentId="${ids.header}" />\n${message.body.replaceAll("<Paragraph>", `<Paragraph lineHeight="${bodyLineHeightPercent}" paddingBottom="${paragraphSpacing}">`)}\n<Component componentId="${ids.signature}" />`,contactPropertiesFallbacks: contactFallbacks,});diff --git a/emails/customer-copy.ts b/emails/customer-copy.tsindex 23a5eb25b..80332d12c 100644--- a/emails/customer-copy.ts+++ b/emails/customer-copy.ts@@ -2,21 +2,21 @@ export const customerCopy = {pro: {plan: "Cap Pro",welcome:- "Your Cap Pro plan includes cloud sharing and collaboration, plus the desktop commercial license. Open your dashboard to find your organization and manage your setup.",+ "With Cap Pro, you can share recordings with a link and work on them with your team. Your plan also includes the desktop commercial license, so you can use Cap for client work too.",},selfhosted: {plan: "Cap Self-hosted",welcome:- "Your self-hosted license supports your own Cap deployment. Use the setup details supplied with your purchase, and reply if you need help.",+ "For your self-hosted setup, start with the instructions supplied with your purchase. If you get stuck anywhere, reply with what you're seeing and I'll help you sort it.",},desktop: {plan: "Cap Desktop",welcome:- "Your desktop license covers commercial use of Cap's recorder and editor. Activate it in the desktop app using the license details from your purchase email.",+ "Your desktop license lets you use Cap's recorder and editor for commercial work. You can activate it in the app with the license details from your purchase email.",},other: {plan: "Cap",welcome:- "If you need help with your Cap account or access, reply to this email.",+ "If you need a hand getting set up, just reply and I'll help you sort it.",},};diff --git a/emails/delivery-receipt.json b/emails/delivery-receipt.jsonnew file mode 100644index 000000000..e0c4e0ae3--- /dev/null+++ b/emails/delivery-receipt.json@@ -0,0 +1,149 @@+{+ "recordedAt": "2026-09-11T13:14:46.625Z",+ "format": "mjml",+ "scope": "Browser-reviewed draft uploads; historical record, not live drift detection",+ "logoSource": "packages/ui/src/components/icons/Logo.tsx",+ "reviewed": {+ "draft": true,+ "canonicalLogo": true,+ "singleFooter": true,+ "greetingFallback": true,+ "metadata": true+ },+ "emails": [+ {+ "id": "free-welcome",+ "sha256": "2c655d03647af236d1cf4a45a60073121ee027e6799ed473069dd04d0a450813",+ "containerId": "cmtvpih6201fp0jznodf8fpwz",+ "nodeId": "n4",+ "subject": "Welcome to Cap",+ "previewText": "Richie here. Great to have you with us :)",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "free-record",+ "sha256": "00372d4d5a911b3433f958c3e163ef90bb0653f6e2b483172b60ed87da6a6e79",+ "containerId": "cmtvpih6201fp0jznodf8fpwz",+ "nodeId": "n9",+ "subject": "A quick way to try Cap",+ "previewText": "You don't need a script or a perfect take.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "free-share",+ "sha256": "974a3ae5f158f66aaed3451f29964cc348b19bc0c56a86f3a7c755412cf3bf1e",+ "containerId": "cmtvpih6201fp0jznodf8fpwz",+ "nodeId": "n14",+ "subject": "Send your next explanation as a Cap",+ "previewText": "A short recording and one sentence are enough.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "free-plans",+ "sha256": "ce4635d7a6fad264ec0405c25525a999291e498bc8a93d898a81e92db696e2fb",+ "containerId": "cmtvpih6201fp0jznodf8fpwz",+ "nodeId": "n16",+ "subject": "Using Cap for work?",+ "previewText": "Here's how the Desktop License and Cap Pro compare.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "customer-welcome",+ "sha256": "91481e642ffb79d6d413b68a6232ec60616b203bd03813035f04e308302ab780",+ "containerId": "cmtvpilm601f40jzwx3474cko",+ "nodeId": "n4",+ "subject": "Thanks for choosing {capPlanName}",+ "previewText": "Thanks for backing what we're building.",+ "fallbacks": {+ "capCustomerWelcome": "If you need a hand getting set up, just reply and I'll help you sort it.",+ "capPlanName": "Cap",+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "customer-workflow",+ "sha256": "e335467f93d9377de9bb83050ffb7294567a1cbcf9062ba0319b7ed3c861e1e5",+ "containerId": "cmtvpilm601f40jzwx3474cko",+ "nodeId": "n6",+ "subject": "One less thing to explain twice",+ "previewText": "A recording you can keep coming back to.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "customer-feedback",+ "sha256": "d3d6bec25066bb422d92400e220d23a4626b9dffae8f442abefb6c36e5c819b4",+ "containerId": "cmtvpilm601f40jzwx3474cko",+ "nodeId": "n8",+ "subject": "How is Cap working for you?",+ "previewText": "I'd love to hear what's working and what isn't.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "teammate-welcome",+ "sha256": "39cf59dde6b58b7512122143c3a0571e0a79e837fdbd84c3211a52326acb2ae2",+ "containerId": "cmtvpm0ag01it0j37w02o6wav",+ "nodeId": "n4",+ "subject": "Welcome to your team in Cap",+ "previewText": "Here's where to find your team's recordings.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "teammate-handoff",+ "sha256": "fe1e7a5ae897734a26c7fd5821205a077ff358ebf74c43e44322a721a2201f14",+ "containerId": "cmtvpm0ag01it0j37w02o6wav",+ "nodeId": "n6",+ "subject": "Make your next handoff easier",+ "previewText": "Show your teammate the bit that's hard to put into words.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "former-feedback",+ "sha256": "1d896cd1e5e1be97de072aaf831d307ad01d616483712bb8aeef483c0409ad17",+ "containerId": "cmtvpm8zm01ii0j01cz7d15qr",+ "nodeId": "n5",+ "subject": "Could I ask about your time with Cap?",+ "previewText": "I'd appreciate your honest feedback.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "customer-update",+ "sha256": "505f8049580c9162834db0506cbd9002ab4589046f00ff5032aa522fc344ec13",+ "containerId": "cmtvpmfxc01ls0j0nnlffombv",+ "nodeId": null,+ "subject": "Keeping up with Cap",+ "previewText": "The changes we've shipped, all in one place.",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ },+ {+ "id": "free-update",+ "sha256": "556e8bcc3465918c1a9ca57f88fa38baeda7abfaa4edeb73e2ca689322ff1840",+ "containerId": "cmtvpmjej01kr0j18cxoz2n0y",+ "nodeId": null,+ "subject": "Take another look at Cap",+ "previewText": "Was something missing when you tried it?",+ "fallbacks": {+ "capGreeting": "Hey,"+ }+ }+ ]+}diff --git a/emails/marketing/customer-feedback.ts b/emails/marketing/customer-feedback.tsindex 84f124d04..849f56d17 100644--- a/emails/marketing/customer-feedback.ts+++ b/emails/marketing/customer-feedback.ts@@ -5,13 +5,13 @@ export const customerFeedback = {key: "feedback",purpose: "Ask a customer what is useful and what needs improvement.",subject: "How is Cap working for you?",- previewText: "Tell us what is useful and what gets in the way.",- variables: ["firstName"],+ previewText: "I'd love to hear what's working and what isn't.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>How has Cap been working for you?</Paragraph>",- "<Paragraph>I would love to know what you have been using it for, and whether anything has been confusing or frustrating.</Paragraph>",- "<Paragraph>Just reply to this email. Specific examples help us decide what to improve next.</Paragraph>",- "<Paragraph>Thanks again for supporting what we are building.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>How are you getting on with Cap?</Paragraph>",+ "<Paragraph>I'd love to know if there's anything you wish worked differently, or something that's getting in your way.</Paragraph>",+ "<Paragraph>Just reply here. I read every reply, and hearing how people actually use Cap helps me decide what we should work on next.</Paragraph>",+ "<Paragraph>Thanks again for backing us :)</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/customer-update.ts b/emails/marketing/customer-update.tsindex 8738fa176..b6858c485 100644--- a/emails/marketing/customer-update.ts+++ b/emails/marketing/customer-update.ts@@ -3,14 +3,15 @@ import type { EmailDefinition } from "../types";export const customerUpdate = {id: "customer-update",key: "customer-update",- purpose: "Reusable product update for customers.",- subject: "What is new in Cap",- previewText: "See the latest improvements in the changelog.",- variables: ["firstName"],+ purpose:+ "Evergreen changelog invitation for customers; review before each campaign.",+ subject: "Keeping up with Cap",+ previewText: "The changes we've shipped, all in one place.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>We have been working on improvements to Cap. You can find the latest changes and fixes in the changelog.</Paragraph>",- '<Button href="https://cap.so/changelog" align="left" paddingTop="16" paddingBottom="16">Read the changelog</Button>',- "<Paragraph>If something would make Cap more useful for you, reply and tell us.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Just a quick one from me. If you're wondering what's changed in Cap, we keep the features and fixes together in our changelog.</Paragraph>",+ "<Paragraph><Link href=\"https://cap.so/changelog\">Here's what we've shipped</Link>.</Paragraph>",+ "<Paragraph>Is there something you're still waiting for us to build or fix? Reply and let me know. Hearing what's missing is just as useful as hearing what's working.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/customer-welcome.ts b/emails/marketing/customer-welcome.tsindex 2bfe98ee7..0e94bae92 100644--- a/emails/marketing/customer-welcome.ts+++ b/emails/marketing/customer-welcome.ts@@ -5,14 +5,12 @@ export const customerWelcome = {key: "welcome",purpose: "Welcome a paying customer with copy matching their paid plan.",subject: "Thanks for choosing {contact.capPlanName}",- previewText: "A few useful things to do first.",- variables: ["capCustomerWelcome", "capPlanName", "firstName"],+ previewText: "Thanks for backing what we're building.",+ variables: ["capCustomerWelcome", "capPlanName", "capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>Thank you for supporting Cap.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Richie here, founder of Cap. Thanks so much for supporting what we're building. It means a lot.</Paragraph>","<Paragraph>{contact.capCustomerWelcome}</Paragraph>",- "<Paragraph>Start with one recording you need to make this week. A walkthrough, a customer explanation, or feedback for a colleague is plenty.</Paragraph>",- '<Button href="https://cap.so/download" align="left" paddingTop="16" paddingBottom="16">Get Cap</Button>',- "<Paragraph>If anything about your setup or access looks wrong, reply and we will help you sort it out.</Paragraph>",+ "<Paragraph>What are you planning to use Cap for? Just reply and let me know. I'd love to hear.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/customer-workflow.ts b/emails/marketing/customer-workflow.tsindex f6be2aaae..b67f5d688 100644--- a/emails/marketing/customer-workflow.ts+++ b/emails/marketing/customer-workflow.ts@@ -4,14 +4,14 @@ export const customerWorkflow = {id: "customer-workflow",key: "workflow",purpose: "Help a customer build a repeatable recording habit.",- subject: "One explanation you can reuse",- previewText: "Turn a recurring question into a short recording.",- variables: ["firstName"],+ subject: "One less thing to explain twice",+ previewText: "A recording you can keep coming back to.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>One of the most useful things to record is an answer you keep giving.</Paragraph>",- "<Paragraph>Pick a recurring question, record a short walkthrough, and give it a title you will recognize later. Trim the beginning and end if you need to, then export or share it in the way that suits your work.</Paragraph>",- "<Paragraph>The next time the question comes up, you already have the answer ready.</Paragraph>",- "<Paragraph>If you have a workflow you would like Cap to make easier, reply and tell us about it.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>A quick idea for your next recording: pick a question you keep answering and record the walkthrough once.</Paragraph>",+ "<Paragraph>It could be how to set something up, where to find a setting, or how you want a piece of work done. Give it a title you'll recognise later, then save or share it wherever you normally answer that question.</Paragraph>",+ "<Paragraph>The next time someone asks, you've already got it ready.</Paragraph>",+ "<Paragraph>Anything making that harder than it should be? Reply and tell me.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/former-feedback.ts b/emails/marketing/former-feedback.tsindex f4c3f77ae..c562ce310 100644--- a/emails/marketing/former-feedback.ts+++ b/emails/marketing/former-feedback.ts@@ -5,14 +5,14 @@ export const formerFeedback = {key: "feedback",purpose:"Ask an eligible former cloud customer for feedback after paid access ends.",- subject: "What could we have done better?",- previewText: "A quick question about your experience with Cap.",- variables: ["firstName"],+ subject: "Could I ask about your time with Cap?",+ previewText: "I'd appreciate your honest feedback.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>Now that your paid access has ended, I wanted to ask what could have made Cap more useful for you.</Paragraph>",- "<Paragraph>Was there something missing, something that did not work properly, or did you just not need it anymore?</Paragraph>",- "<Paragraph>Reply if you have a moment. Honest feedback helps us make better decisions.</Paragraph>",- "<Paragraph>Thanks for giving Cap a try.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Could I ask what made you decide to stop using your paid Cap plan?</Paragraph>",+ "<Paragraph>Was something missing, did something not work properly, or did you just not need it anymore?</Paragraph>",+ "<Paragraph>If you've got a moment to reply, I'd really appreciate it. And if there was a problem I can help with, I'd like to try.</Paragraph>",+ "<Paragraph>Thanks for giving Cap a go.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/free-plans.ts b/emails/marketing/free-plans.tsindex d9d3dd903..ae5d65397 100644--- a/emails/marketing/free-plans.ts+++ b/emails/marketing/free-plans.ts@@ -4,15 +4,15 @@ export const freePlans = {id: "free-plans",key: "plans",purpose: "Explain current plan options to eligible independent noncustomers.",- subject: "Choose the Cap setup that fits your work",- previewText: "A desktop license and Cap Pro solve different needs.",- variables: ["firstName"],+ subject: "Using Cap for work?",+ previewText: "Here's how the Desktop License and Cap Pro compare.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>If the free version covers what you need, keep using it.</Paragraph>",- "<Paragraph>If you use Cap for work, a <Strong>Desktop License</Strong> covers commercial use of the desktop recorder and editor. <Strong>Cap Pro</Strong> adds the cloud sharing and collaboration features, and includes the desktop commercial license.</Paragraph>",- "<Paragraph>The plans page has the current features and prices, so you can choose based on how you actually use Cap.</Paragraph>",- '<Button href="https://cap.so/pricing" align="left" paddingTop="16" paddingBottom="16">Compare Cap plans</Button>',- "<Paragraph>Unsure which one fits? Reply with how you use Cap and we will point you in the right direction.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>If you're thinking about using Cap for work, there are two options.</Paragraph>",+ "<Paragraph>A <Strong>Desktop License</Strong> covers commercial use of the recorder and editor. It's a good fit if you mainly edit and export videos yourself.</Paragraph>",+ "<Paragraph><Strong>Cap Pro</Strong> adds cloud sharing and collaboration, and includes the desktop commercial license. That's the one to look at if you're sharing recordings with clients or your team.</Paragraph>",+ '<Paragraph><Link href="https://cap.so/pricing">Compare the plans here</Link>.</Paragraph>',+ "<Paragraph>Not sure which you need? Reply with what you're using Cap for and I'll point you in the right direction.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/free-record.ts b/emails/marketing/free-record.tsindex 381d60e4c..746a61030 100644--- a/emails/marketing/free-record.ts+++ b/emails/marketing/free-record.ts@@ -4,15 +4,14 @@ export const freeRecord = {id: "free-record",key: "record",purpose: "Offer recording help when no cloud video is known.",- subject: "Try a 30-second recording",- previewText: "A simple way to get comfortable with Cap.",- variables: ["firstName"],+ subject: "A quick way to try Cap",+ previewText: "You don't need a script or a perfect take.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>Here is an easy way to try Cap: open something you are working on and explain one small part of it out loud.</Paragraph>",- "<Paragraph>Choose your screen or a single window, check your microphone, and record for about 30 seconds. No script needed.</Paragraph>",- "<Paragraph>If you prefer to keep the recording on your device, use Studio Mode and export it locally.</Paragraph>",- '<Button href="https://cap.so/download" align="left" paddingTop="16" paddingBottom="16">Open the downloads page</Button>',- "<Paragraph>Already recording locally? You are all set. Local recordings do not necessarily appear in your cloud library.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>If you're still finding your feet with Cap, try this: open something on your screen and spend 30 seconds explaining it out loud.</Paragraph>",+ "<Paragraph>No script or perfect take needed. In Studio Mode, you can trim it afterwards and keep the recording on your own device.</Paragraph>",+ '<Paragraph>Need the app? <Link href="https://cap.so/download">You can download Cap here</Link>.</Paragraph>',+ "<Paragraph>If something's stopping you from recording, reply and let me know what happened. I'll help you sort it.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/free-share.ts b/emails/marketing/free-share.tsindex bfd856038..eacca173f 100644--- a/emails/marketing/free-share.ts+++ b/emails/marketing/free-share.ts@@ -4,14 +4,14 @@ export const freeShare = {id: "free-share",key: "share",purpose: "Offer sharing guidance when no shared cloud video is known.",- subject: "Give your next Cap a little context",- previewText: "Help the person watching know what to look for.",- variables: ["firstName"],+ subject: "Send your next explanation as a Cap",+ previewText: "A short recording and one sentence are enough.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>A recording works best when the person watching knows why you sent it.</Paragraph>",- "<Paragraph>Give your Cap a clear title, then send the link with one sentence about what you need: feedback, a decision, or just a quick look.</Paragraph>",- "<Paragraph>For a bug report, show what you expected and what happened. For feedback, point to the specific part you want to discuss.</Paragraph>",- '<Button href="https://cap.so/dashboard" align="left" paddingTop="16" paddingBottom="16">Open your library</Button>',+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Next time you're typing a long explanation, try showing it in Cap instead.</Paragraph>",+ "<Paragraph>Record the bit that's hard to explain, then send the link with a sentence about what you need. Something like: “Here's the bug I mentioned. Can you see the same thing?”</Paragraph>",+ "<Paragraph>It doesn't have to be polished to be useful.</Paragraph>",+ '<Paragraph><Link href="https://cap.so/dashboard">Open your Cap library</Link>.</Paragraph>',].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/free-update.ts b/emails/marketing/free-update.tsindex 29afdc3d3..0edad2316 100644--- a/emails/marketing/free-update.ts+++ b/emails/marketing/free-update.ts@@ -3,14 +3,15 @@ import type { EmailDefinition } from "../types";export const freeUpdate = {id: "free-update",key: "free-update",- purpose: "Reusable product update for eligible independent noncustomers.",+ purpose:+ "Evergreen reactivation invitation for eligible independent noncustomers; review before each campaign.",subject: "Take another look at Cap",- previewText: "Catch up on the latest changes.",- variables: ["firstName"],+ previewText: "Was something missing when you tried it?",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>If you have not tried Cap recently, the changelog is a good place to see what has changed.</Paragraph>",- "<Paragraph>Download the latest version when you have a recording to make. You can start small and see whether it fits how you work.</Paragraph>",- '<Button href="https://cap.so/changelog" align="left" paddingTop="16" paddingBottom="16">See what is new</Button>',+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>If it's been a while since you tried Cap, I'd love for you to take another look.</Paragraph>",+ '<Paragraph><Link href="https://cap.so/changelog">You can see what\'s changed here</Link>. Next time you need to explain something on screen, give it a go.</Paragraph>',+ "<Paragraph>If something put you off last time, just reply and tell me. I'd like to know, especially if it was something we could have done better.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/free-welcome.ts b/emails/marketing/free-welcome.tsindex d7549f291..61851acd6 100644--- a/emails/marketing/free-welcome.ts+++ b/emails/marketing/free-welcome.ts@@ -4,14 +4,15 @@ export const freeWelcome = {id: "free-welcome",key: "welcome",purpose: "Help an independent free user make their first recording.",- subject: "Your first Cap can be a small one",- previewText: "Pick one thing you would usually explain in a message.",- variables: ["firstName"],+ subject: "Welcome to Cap",+ previewText: "Richie here. Great to have you with us :)",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>Thanks for trying Cap. A good first recording is something small: a quick explanation, a bug you spotted, or feedback on a piece of work.</Paragraph>",- "<Paragraph><Strong>Pick one thing you would normally type out, and record it instead.</Strong> Use Instant Mode for a shareable link, or Studio Mode when you want to edit before exporting.</Paragraph>",- '<Button href="https://cap.so/download" align="left" paddingTop="16" paddingBottom="16">Download Cap</Button>',- "<Paragraph>If you get stuck, reply to this email. We can help.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Richie here, founder of Cap. Thanks for giving it a go :)</Paragraph>",+ "<Paragraph>The easiest way to start is to record something you'd normally type out. A quick explanation or a bit of feedback is plenty.</Paragraph>",+ "<Paragraph>Use Instant Mode when you want a shareable link, or Studio Mode to edit your recording and export it locally.</Paragraph>",+ '<Paragraph><Link href="https://cap.so/download">Download Cap here</Link>.</Paragraph>',+ "<Paragraph>If you have any questions, just reply to this email. I'd love to help.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/teammate-handoff.ts b/emails/marketing/teammate-handoff.tsindex fbc8ee1a1..84db66af6 100644--- a/emails/marketing/teammate-handoff.ts+++ b/emails/marketing/teammate-handoff.ts@@ -5,15 +5,13 @@ export const teammateHandoff = {key: "handoff",purpose: "Help a teammate share useful context with their organization.",subject: "Make your next handoff easier",- previewText:- "A short recording can give your teammate the context they need.",- variables: ["firstName"],+ previewText: "Show your teammate the bit that's hard to put into words.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>For your next handoff, try recording the bit that is difficult to explain in writing.</Paragraph>",- "<Paragraph>Show the work, explain what changed, and say what you need from the person watching. A clear title and a short note beside the link make it easier to pick up later.</Paragraph>",- "<Paragraph>When sharing, check that the recording is available to the right people in your organization.</Paragraph>",- '<Button href="https://cap.so/dashboard" align="left" paddingTop="16" paddingBottom="16">Open your workspace</Button>',- "<Paragraph>If the team workflow feels awkward anywhere, reply and let us know.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Next time you hand something over to a teammate, try recording the part that's tricky to explain in a message.</Paragraph>",+ "<Paragraph>Show what changed and what you need them to look at. Even a short recording can save a lot of back and forth.</Paragraph>",+ '<Paragraph><Link href="https://cap.so/dashboard">Open your team workspace</Link>. Before sending a recording, check its sharing settings so the right people can watch it.</Paragraph>',+ "<Paragraph>If anything about sharing with your team feels awkward, reply and let me know.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/marketing/teammate-welcome.ts b/emails/marketing/teammate-welcome.tsindex 6da95b199..c8091b76f 100644--- a/emails/marketing/teammate-welcome.ts+++ b/emails/marketing/teammate-welcome.ts@@ -5,15 +5,14 @@ export const teammateWelcome = {key: "welcome",purpose:"Help an invited teammate find their workspace without promoting upgrades.",- subject: "Getting started with your team in Cap",- previewText: "Find your workspace and make your first handoff easier.",- variables: ["firstName"],+ subject: "Welcome to your team in Cap",+ previewText: "Here's where to find your team's recordings.",+ variables: ["capGreeting"],body: [- "<Paragraph>Hi {contact.firstName},</Paragraph>",- "<Paragraph>Welcome to your team in Cap.</Paragraph>",- "<Paragraph>Open your dashboard and make sure the right organization is selected. That is where you will find the recordings your team shares with you.</Paragraph>",- "<Paragraph>If something is missing, check with the person who invited you. They can confirm your workspace and access.</Paragraph>",- '<Button href="https://cap.so/dashboard" align="left" paddingTop="16" paddingBottom="16">Open your workspace</Button>',- "<Paragraph>You can also reply here if you need help getting set up.</Paragraph>",+ "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>Richie here, founder of Cap. Great to have you with us :)</Paragraph>",+ "<Paragraph><Link href=\"https://cap.so/dashboard\">Open your dashboard</Link> and select your team's organisation. You'll find the recordings they've shared with you there.</Paragraph>",+ "<Paragraph>If you can't see the right organisation, check with the person who invited you. They can confirm which email address they used and your access.</Paragraph>",+ "<Paragraph>You can also reply here if you need a hand.</Paragraph>",].join(""),} satisfies EmailDefinition;diff --git a/emails/mjml.ts b/emails/mjml.tsnew file mode 100644index 000000000..d5158224d--- /dev/null+++ b/emails/mjml.ts@@ -0,0 +1,63 @@+import {+ bodyLineHeightPercent,+ footer,+ logo,+ paragraphSpacing,+ signature,+ theme,+} from "./brand";+import type { EmailDefinition } from "./types";++const escape = (value: string) =>+ value+ .replaceAll("&", "&")+ .replaceAll("<", "<")+ .replaceAll(">", ">")+ .replaceAll('"', """);++export const mjmlVariables = (value: string) =>+ value.replace(/\{contact\.(\w+)\}/g, "{$1}");++const renderBody = (body: string) => {+ for (const [, tag] of body.matchAll(/<\/?([A-Za-z][\w]*)\b/g)) {+ if (!["Paragraph", "Link", "Strong", "Em", "Br"].includes(tag))+ throw new Error(`Unsupported marketing content tag: ${tag}`);+ }+ return mjmlVariables(+ body+ .replaceAll("<Paragraph>", "<mj-text>")+ .replaceAll("</Paragraph>", "</mj-text>\n")+ .replaceAll(+ "<Link ",+ `<a style="color:${theme.styles.textLinkColor};text-decoration:underline" `,+ )+ .replaceAll("</Link>", "</a>")+ .replaceAll("<Strong>", "<strong>")+ .replaceAll("</Strong>", "</strong>")+ .replaceAll("<Em>", "<em>")+ .replaceAll("</Em>", "</em>")+ .replaceAll("<Br />", "<br />"),+ );+};++export const renderMjml = (email: EmailDefinition) => `<mjml lang="en">+ <mj-head>+ <mj-title>${escape(mjmlVariables(email.subject))}</mj-title>+ <mj-preview>${escape(mjmlVariables(email.previewText))}</mj-preview>+ <mj-attributes>+ <mj-all font-family="Helvetica, Arial, sans-serif" />+ <mj-text font-size="${theme.styles.textBaseFontSize}px" line-height="${Math.round((theme.styles.textBaseFontSize * bodyLineHeightPercent) / 100)}px" color="${theme.styles.textBaseColor}" padding="0 0 ${paragraphSpacing}px" />+ </mj-attributes>+ </mj-head>+ <mj-body width="600px" background-color="${theme.styles.backgroundColor}">+ <mj-section background-color="${theme.styles.bodyColor}" padding="${theme.styles.bodyYPadding}px ${theme.styles.bodyXPadding}px">+ <mj-column>+ <mj-image src="img/cap-logo.png" alt="Cap" width="${logo.width}px" align="left" padding="0 0 24px" />+ ${renderBody(email.body)}+ <mj-text padding="8px 0 0">${signature.map(escape).join("<br />")}</mj-text>+ <mj-text font-size="12px" line-height="19px" color="#6b7280" padding="24px 0 0">${escape(footer.company)}<br />${escape(footer.address)}<br /><a href="{unsubscribe_link}" style="color:#6b7280;text-decoration:underline">${escape(footer.unsubscribeLabel)}</a></mj-text>+ </mj-column>+ </mj-section>+ </mj-body>+</mjml>+`;diff --git a/emails/resources.json b/emails/resources.jsonindex 4369903cd..971e9e613 100644--- a/emails/resources.json+++ b/emails/resources.json@@ -2,7 +2,7 @@"version": "cap-lifecycle-v1","teamName": "Cap Software, Inc.","resources": {- "theme": "cmtvpigqa01cy0jzmygof5f31",+ "theme": "cmtwxic0t0p030j03i4w01h9t","Cap lifecycle header v1": "cmtvpigup01e80j0xjmwxqzxu","Cap lifecycle signature v1": "cmtvpih0q01da0j20hgcd7ygv","free": "cmtvpih6201fp0jznodf8fpwz",@@ -13,7 +13,17 @@"customer-update": "cmtvpmfxc01ls0j0nnlffombv","segment:free-update": "cmtvpmit001kb0j1v86w1bx2w","free-update": "cmtvpmjej01kr0j18cxoz2n0y",- "mailingList": "cmtvqgqjj027l0j10fbgb2uvy"+ "mailingList": "cmtvqgqjj027l0j10fbgb2uvy",+ "Cap lifecycle header v2": "cmtwvpzle14zq0iydhsxuvn7j",+ "Cap lifecycle signature v2": "cmtwvvcxf14yz0jzwk5rv3zsy",+ "Cap lifecycle header v3": "cmtwwcneg16710j1dkycroiiq",+ "Cap lifecycle signature v3": "cmtwwco1c15vb0iyd13663y8e",+ "Cap lifecycle header v4": "cmtwwvlli00ao0jzwvjb03ixz",+ "Cap lifecycle signature v4": "cmtwwvm6316gh0jzwdvr0bsgo",+ "Cap lifecycle header v5": "cmtwx1d1q0oys0jyw6yq91naz",+ "Cap lifecycle signature v5": "cmtwx4qyk0odg0j03ibll1cad",+ "Cap lifecycle header v6": "cmtwxickf0d570jzvtpz1dyyh",+ "Cap lifecycle signature v6": "cmtwxid5g17tp0jyc2mu1hgwj"},"operations": {"free:guard": "n3",diff --git a/package.json b/package.jsonindex 840e4df14..dfdcd079f 100644--- a/package.json+++ b/package.json@@ -4,6 +4,8 @@"emails:catalog": "bun scripts/emails/manage.ts","emails:check": "bun scripts/emails/manage.ts --check","emails:check-loops": "bun scripts/loops/verify.ts",+ "emails:export": "bun scripts/emails/export-mjml.ts",+ "emails:logo": "bun scripts/emails/export-logo.ts","build": "dotenv -e .env -- turbo run build","build:web": "turbo run build:web","build:web:docker": "bun run --filter=@cap/web build:docker",@@ -61,11 +63,12 @@"@effect/language-service": "^0.44.0","dotenv-cli": "latest","mysql2": "^3.15.2",+ "react": "19.2.0",+ "react-dom": "19.2.0",+ "sharp": "0.35.3","tsdown": "^0.15.6","turbo": "^2.3.4",- "typescript": "^5.8.3",- "react": "19.2.0",- "react-dom": "19.2.0"+ "typescript": "^5.8.3"},"packageManager": "[email protected]","name": "cap",diff --git a/scripts/emails/catalog.test.ts b/scripts/emails/catalog.test.tsindex 9172a20a3..f7155cd4c 100644--- a/scripts/emails/catalog.test.ts+++ b/scripts/emails/catalog.test.ts@@ -7,6 +7,7 @@ import {renderCatalog,validateCatalog,validateEmail,+ validateTheme,} from "./catalog";import { assertEmailContent, normalizeLmx } from "./content";@@ -14,6 +15,15 @@ describe("email library", () => {test("every template and known application send source is registered", async () => {expect(await validateCatalog()).toEqual([]);});+ test("line heights reject pixel values that collapse the Loops footer", () => {+ expect(validateTheme({ textBaseLineHeight: 26 })).toEqual([+ "textBaseLineHeight must be a percentage from 100 to 300",+ ]);+ expect(+ validateTheme({ textBaseLineHeight: 160, heading1LineHeight: 130 }),+ ).toEqual([]);+ expect(validateTheme({ textBaseLineHeight: Number.NaN })).toHaveLength(1);+ });test("variables in subjects require a declared contract and fallback", () => {expect(validateEmail({ ...freeWelcome, subject: "Hello {contact.company}" }),@@ -78,15 +88,17 @@ describe("Loops content comparison", () => {for (const lmx of [`${content.lmx}<Paragraph>Unexpected promotion</Paragraph>`,content.lmx.replace("https://cap.so/download", "https://example.com"),- content.lmx.replace("<Paragraph>", '<Paragraph textColor="#ff0000">'),+ content.lmx.replace("<Paragraph ", '<Paragraph textColor="#ff0000" '),content.lmx.replace('<Component componentId="header" />','<Component componentId="header"><Paragraph>Changed header</Paragraph></Component>',),- ])+ ]) {+ expect(lmx).not.toBe(content.lmx);expect(() =>assertEmailContent({ ...content, lmx }, freeWelcome, ids),).toThrow();+ }});test("detects changed sender metadata and fallbacks", () => {expect(() =>diff --git a/scripts/emails/catalog.ts b/scripts/emails/catalog.tsindex 569b7af47..6e67247bf 100644--- a/scripts/emails/catalog.ts+++ b/scripts/emails/catalog.ts@@ -31,7 +31,7 @@ export const validateEmail = (email: EmailDefinition) => {"Use shared branding; do not embed Style or Component in email bodies",);if (- /\b(?:bgColor|textColor|fontSize|fontFamily|borderRadius)\s*=/.test(+ /\b(?:bgColor|textColor|fontSize|fontFamily|borderRadius|lineHeight)\s*=/.test(email.body,))@@ -71,6 +71,18 @@ export const flowSteps = (journey: Journey) => {return { ...message, day };});};++export const validateTheme = (styles: Record<string, unknown>) =>+ Object.entries(styles)+ .filter(+ ([key, value]) =>+ /lineheight$/i.test(key) &&+ (typeof value !== "number" ||+ !Number.isFinite(value) ||+ value < 100 ||+ value > 300),+ )+ .map(([key]) => `${key} must be a percentage from 100 to 300`);const workflowFilter = (journey: Journey) => ({...audienceFilter(journey.audience, journey.promotional),conditions: [@@ -84,6 +96,11 @@ export const validateCatalog = async () => {const errors = marketingEmails.flatMap((email) =>validateEmail(email).map((error) => `${email.id}: ${error}`),);+ errors.push(...validateTheme(theme.styles));+ for (const component of components) {+ for (const [, value] of component.lmx.matchAll(/\blineHeight="([^"]*)"/g))+ errors.push(...validateTheme({ lineHeight: Number(value) }));+ }const allIds = [...marketingEmails, ...applicationEmails].map((email) => email.id,);@@ -254,11 +271,11 @@ export const renderCatalog = () => {"","## Branding and personalization","",- `Shared theme, header, signature, sender and fallbacks: ${sourceLink("emails/brand.ts")}.`,+ `Shared design, logo, signature, footer, sender and fallbacks: ${sourceLink("emails/brand.ts")}. Custom MJML delivery is generated by ${sourceLink("emails/mjml.ts")}.`,"",- `Sender: ${sender.fromName}; local part \`${sender.fromEmail}\` on the Loops sending domain. Reply-to: ${sender.replyToEmail}. Theme: ${theme.name}.`,+ `Sender: ${sender.fromName}; local part \`${sender.fromEmail}\` on the Loops sending domain. Reply-to: ${sender.replyToEmail}.`,"",- `Shared components: ${components.map((component) => component.name).join("; ")}.`,+ "The shared header uses the canonical Cap icon and vector wordmark, with white backing for contrast on dark backgrounds. The complete greeting is `capGreeting`, with `Hey,` as its fallback. One compact footer contains the company, address and unsubscribe link.","","Customer welcome variations come from [customer-copy.ts](customer-copy.ts); eligibility is resolved from account and license state in the profile sync.","",diff --git a/scripts/emails/export-logo.ts b/scripts/emails/export-logo.tsnew file mode 100644index 000000000..24334196a--- /dev/null+++ b/scripts/emails/export-logo.ts@@ -0,0 +1,26 @@+import { writeFile } from "node:fs/promises";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import sharp from "sharp";+import { logo } from "../../emails/brand";+import { Logo } from "../../packages/ui/src/components/icons/Logo";++const markup = renderToStaticMarkup(+ createElement(Logo, { viewBoxDimensions: "4 4 97.21 32" }),+);+const svg = markup.match(/<svg[\s\S]*<\/svg>/)?.[0];+if (!svg) throw new Error("Cap logo did not render an SVG");+const backed = svg+ .replace("<svg ", '<svg width="486" height="160" ')+ .replace(+ /<path/,+ '<rect x="4" y="4" width="97.21" height="32" fill="#ffffff" /><path',+ );+await writeFile(+ new URL(`../../${logo.file}`, import.meta.url),+ await sharp(Buffer.from(backed))+ .flatten({ background: "#ffffff" })+ .png()+ .toBuffer(),+);+console.log(`Rendered the canonical Cap logo to ${logo.file}`);diff --git a/scripts/emails/export-mjml.ts b/scripts/emails/export-mjml.tsnew file mode 100644index 000000000..36bce0b1b--- /dev/null+++ b/scripts/emails/export-mjml.ts@@ -0,0 +1,61 @@+import { execFileSync } from "node:child_process";+import { createHash } from "node:crypto";+import {+ copyFile,+ mkdir,+ mkdtemp,+ readFile,+ rm,+ writeFile,+} from "node:fs/promises";+import { tmpdir } from "node:os";+import { join, resolve } from "node:path";+import { parseArgs } from "node:util";+import { contactFallbacks, logo, sender } from "../../emails/brand";+import { mjmlVariables, renderMjml } from "../../emails/mjml";+import { marketingEmails, root, validateCatalog } from "./catalog";++const { values } = parseArgs({ options: { output: { type: "string" } } });+if (!values.output) throw new Error("Pass --output with the export directory");+const errors = await validateCatalog();+if (errors.length) throw new Error(errors.join("\n"));+const output = resolve(values.output);+await mkdir(output, { recursive: true });+const asset = await readFile(new URL(logo.file, root));+const manifest = [];+for (const email of marketingEmails) {+ const temporary = await mkdtemp(join(tmpdir(), "cap-email-"));+ try {+ await mkdir(join(temporary, "img"));+ const mjml = renderMjml(email);+ await writeFile(join(temporary, "index.mjml"), mjml);+ await writeFile(join(temporary, "img/cap-logo.png"), asset);+ const archive = join(temporary, `${email.id}.zip`);+ execFileSync("zip", ["-q", "-r", archive, "index.mjml", "img"], {+ cwd: temporary,+ });+ await copyFile(archive, join(output, `${email.id}.zip`));+ await writeFile(join(output, `${email.id}.mjml`), mjml);+ manifest.push({+ id: email.id,+ file: `${email.id}.zip`,+ sha256: createHash("sha256").update(mjml).update(asset).digest("hex"),+ subject: mjmlVariables(email.subject),+ previewText: mjmlVariables(email.previewText),+ ...sender,+ emailFormat: "mjml",+ fallbacks: Object.fromEntries(+ email.variables.map((key) => [key, contactFallbacks[key]]),+ ),+ });+ } finally {+ await rm(temporary, { recursive: true, force: true });+ }+}+await writeFile(+ join(output, "manifest.json"),+ `${JSON.stringify(manifest, null, 2)}\n`,+);+console.log(+ `Exported ${manifest.length} email archives and manifest to ${output}`,+);diff --git a/scripts/emails/mjml.test.ts b/scripts/emails/mjml.test.tsnew file mode 100644index 000000000..de082aff5--- /dev/null+++ b/scripts/emails/mjml.test.ts@@ -0,0 +1,39 @@+import { describe, expect, test } from "bun:test";+import { contactFallbacks, footer, logo } from "../../emails/brand";+import { freeWelcome } from "../../emails/marketing/free-welcome";+import { renderMjml } from "../../emails/mjml";+import { marketingEmails } from "./catalog";++describe("marketing delivery templates", () => {+ test("every email retains its links and has one concise unsubscribe footer", () => {+ for (const email of marketingEmails) {+ const mjml = renderMjml(email);+ expect(mjml.match(/href="\{unsubscribe_link\}"/g)).toHaveLength(1);+ expect(mjml).toContain(footer.address);+ expect(mjml).not.toContain("You are receiving");+ expect(mjml).not.toContain("{contact.");+ expect(mjml).not.toContain("Hey {firstName},");+ expect(mjml).toContain("<mj-preview>");+ for (const [, href] of email.body.matchAll(/href="([^"]+)"/g))+ expect(mjml).toContain(`href="${href}"`);+ }+ });+ test("greeting fallback contains the complete salutation", () => {+ expect(contactFallbacks.capGreeting).toBe("Hey,");+ expect(renderMjml(freeWelcome)).toContain(+ "<mj-text>{capGreeting}</mj-text>",+ );+ });+ test("logo and text share the same zero left padding", () => {+ const mjml = renderMjml(freeWelcome);+ expect(mjml).toContain(`width="${logo.width}px" align="left"`);+ expect(mjml).toContain('src="img/cap-logo.png" alt="Cap"');+ expect(mjml).toContain('padding="0 0 24px"');+ expect(mjml).toContain('padding="0 0 16px"');+ });+ test("unsupported new content blocks fail instead of silently disappearing", () => {+ expect(() =>+ renderMjml({ ...freeWelcome, body: "<Columns>Unsupported</Columns>" }),+ ).toThrow("Unsupported marketing content tag");+ });+});diff --git a/scripts/loops/README.md b/scripts/loops/README.mdindex 6b445a9c4..d997c87f8 100644--- a/scripts/loops/README.md+++ b/scripts/loops/README.md@@ -1,6 +1,6 @@# Cap lifecycle email migration-Marketing source and shared branding now live in [emails/](../../emails/README.md). Start with the [email catalogue and flow maps](../../emails/CATALOG.md); regenerate it with `bun run emails:catalog`. Run `bun run emails:check` for local checks and `bun run emails:check-loops` for read-only comparison with the registered Loops drafts.+Marketing source and shared branding now live in [emails/](../../emails/README.md). Start with the [email catalogue and flow maps](../../emails/CATALOG.md); regenerate it with `bun run emails:catalog`. Run `bun run emails:check` for local checks and `bun run emails:check-loops --structure-only` for read-only graph checks. Custom MJML content requires browser review; see the email library instructions.This prepares Cap's Bento audience and replacement Loops journeys. Provisioning creates drafts only. Importing and syncing keep `capLifecycleEnabled=false`, `capOnboardingEligible=false`, and `capLifecycleStage=idle`. No script activates workflows, sends messages, or replays historical events.@@ -36,8 +36,7 @@ Run from the repository root with Bun 1.4. Supply `LOOPS_API_KEY` through the pr```shbun scripts/loops/provision.ts --team 'Cap Software, Inc.' --dry-run-bun scripts/loops/provision.ts --team 'Cap Software, Inc.' --state "$LOOPS_PRIVATE_DIR/provision-state.json" --mailing-list "$LOOPS_MAILING_LIST_ID" --apply-bun scripts/loops/verify.ts --team 'Cap Software, Inc.' --state "$LOOPS_PRIVATE_DIR/provision-state.json" --mailing-list "$LOOPS_MAILING_LIST_ID"+bun scripts/loops/verify.ts --team 'Cap Software, Inc.' --state "$LOOPS_PRIVATE_DIR/provision-state.json" --mailing-list "$LOOPS_MAILING_LIST_ID" --structure-onlybun scripts/loops/prepare.ts --sources "$LOOPS_PRIVATE_DIR" --output "$LOOPS_PRIVATE_DIR/import"bun scripts/loops/import.ts --team 'Cap Software, Inc.' --contacts "$LOOPS_PRIVATE_DIR/import/contacts.json" --receipt "$LOOPS_PRIVATE_DIR/import/receipt.jsonl" --mailing-list "$LOOPS_MAILING_LIST_ID"```@@ -48,7 +47,7 @@ The source directory must contain arrays in `bento-contacts.json`, `cap-users.jsThe native Loops CSV importer can be used for the reviewed positive file. Check every column mapping, select the migration mailing list, and leave **Trigger workflows** off. Loops matches user ID before email; resolve destination identity conflicts first. Export the destination afterward and reconcile all intended addresses, opt-outs, audience fields, and enrollment holds. Native CSV imports and API receipts are separate records.-Provisioning uses revision checks and a private receipt to resume partially created resources. Run `verify.ts` after every provisioning pass: it independently reads the actual graph, downstream filters, branch reconnections, timing, message text/links, fallback, campaign segments, mailing lists, draft states, and Guardian results. Investigate verification failures before editing a managed draft manually or reusing its receipt.+The legacy native provisioner uses revision checks and a private receipt, but now refuses `--apply` because managed emails use custom MJML. Generate uploads with `emails:export` and review them in the browser. `verify.ts --structure-only` checks graphs, downstream filters, reconnections, timing, segments, mailing lists, draft status and custom format. The beta API cannot read MJML content or verify its Guardian results. Never treat a structure check as content parity.## Repository rollout@@ -74,13 +73,23 @@ Review the dry run before adding `--apply`. Use a single runner and bounded batc## Before any activation+### Optional sender profile picture++For Richie's existing photo on `[email protected]`, Loops recommends adding `mail.cap.so` as a **user alias domain** in Google Workspace: Admin console → Account → Domains → Manage domains → Add a domain → User alias domain. Verify ownership using the supplied DNS record. The alias inherits the primary `[email protected]` account and its profile photo without a new paid seat. This affects aliases for all primary-domain users, so inspect the existing domain configuration first. Preserve Loops' sending, bounce and authentication records; do not replace DNS records while following a generic Gmail setup wizard.++Avatar display is client-specific and can take time to update. Test a newly sent owned-inbox preview after setup. See [Loops' sending-avatar guide](https://loops.so/docs/deliverability/adding-a-sending-avatar). No Google Workspace domain or DNS changes were made during draft preparation.++### Production cutover+Activation is deliberately outside this migration's approved scope. These gates remain necessary:-1. Review actual draft copy and audiences, resolve the sending-domain DMARC warning, and configure rotated credentials in the intended environment.+1. Review the final custom drafts and audiences, and configure rotated credentials in the intended environment. September 11 controlled deliveries passed SPF, DKIM and DMARC with inherited `p=quarantine`; the earlier DMARC warning is no longer an observed blocker. Recheck sending-domain status at cutover.2. Deploy the reviewed schema/code, seed the complete suppression registry, and prove the held sync with real free, paid, licensed, invited, SSO, unsubscribed, deleted, and changed-email cases.3. Implement and verify explicit new-consent capture, lifecycle enrollment for new eligible contacts, bounded retries, duplicate prevention, and an observed sync schedule. This branch does not infer marketing consent from account creation.4. Add a freshness mechanism and monitoring before live sends. Downstream filters use the last synced fields; `capVerifiedAt` is evidence, not a native expiry guarantee. Prove purchase/invite/opt-out transitions remove contacts before later promotional steps. Do not enable the current held sync alongside active enrollment because it deliberately returns contacts to idle.-5. Reconcile a fresh Bento delta at cutover. Confirm no campaign/flow is queued to send twice, then disable old Bento marketing automations only as part of the approved cutover. Preserve source history and opt-outs before retiring Bento.+5. Reconcile a fresh Bento delta at cutover, including all opt-outs and changed entitlements. Confirm no campaign/flow is queued to send twice, check overlap with Resend recording emails, then disable old Bento marketing automations only as part of the approved cutover. Preserve source history and suppression evidence.+6. Test the deployed Cap signup/purchase/invite/opt-out path through Loops to an owned inbox, including a sync outage and retries. The completed synthetic profile-to-Loops tests do not replace this production integration check.+7. After explicit activation approval, enable one small cohort of newly consenting eligible contacts, monitor deliveries, complaints, opt-outs and duplicate suppression, then expand. Do not bulk enroll imported history. Rollback stops new enrollment and pauses Loops before considering re-enabling Bento; never run both senders for the same journey. Retire Bento and rotate remaining credentials after reconciliation.## Validation@@ -93,3 +102,5 @@ bun run tsc -b apps/web```Unit tests cover consent conflicts, conservative customer classification, teammate suppression, imported enrollment holds, identity preservation, and stable sync fingerprints. They do not prove production email delivery or a live cutover.++See [QA results and remaining limitations](../../emails/QA.md) for the controlled live Loops tests and the separate production integration gate.diff --git a/scripts/loops/profile.test.ts b/scripts/loops/profile.test.tsindex 7001332c8..d1302476a 100644--- a/scripts/loops/profile.test.ts+++ b/scripts/loops/profile.test.ts@@ -57,6 +57,18 @@ const remote = (): RemoteContact => ({mailingLists: { tips: true },});+test("greetings include a name only when a nonblank name is known", () => {+ const fixture = input();+ assert.equal(classifyProfile(fixture).capGreeting, "Hey Taylor,");+ fixture.source.first_name = " Sam ";+ assert.equal(classifyProfile(fixture).capGreeting, "Hey Sam,");+ fixture.user = undefined;+ for (const firstName of [undefined, "", " ", "null", "NULL"]) {+ fixture.source.first_name = firstName;+ assert.equal(classifyProfile(fixture).capGreeting, "Hey,");+ }+});+test("an explicit source opt-out always wins over a positive custom flag", () => {assert.equal(sourceConsent({diff --git a/scripts/loops/profile.ts b/scripts/loops/profile.tsindex 10e6f6adb..54c287566 100644--- a/scripts/loops/profile.ts+++ b/scripts/loops/profile.ts@@ -142,13 +142,15 @@ export function classifyProfile(input: ProfileInput) {? "desktop": "other"];+ const firstName =+ [source.first_name, source.firstname, user?.name?.trim().split(/\s+/)[0]]+ .map((value) => value?.trim())+ .find((value) => value && value.toLowerCase() !== "null") ?? "";return {email: normalizeEmail(source.email),userId: user?.id ?? `bento:${emailHash(source.email)}`,- firstName:- [source.first_name, source.firstname, user?.name?.trim().split(/\s+/)[0]]- .map((value) => value?.trim())- .find((value) => value && value !== "null") ?? "",+ firstName,+ capGreeting: firstName ? `Hey ${firstName},` : "Hey,",lastName:[source.last_name, source.lastname, user?.lastName].map((value) => value?.trim())diff --git a/scripts/loops/provision.ts b/scripts/loops/provision.tsindex 7554ca56a..3efde604a 100644--- a/scripts/loops/provision.ts+++ b/scripts/loops/provision.ts@@ -2,7 +2,7 @@ import assert from "node:assert/strict";import { createHash } from "node:crypto";import { readFile, writeFile } from "node:fs/promises";import { parseArgs } from "node:util";-import { emailContent } from "../../emails/brand";+import { deliveryFormat, emailContent } from "../../emails/brand";import { normalizeLmx } from "../emails/content";import { LoopsApi, LoopsApiError } from "./api";import {@@ -35,6 +35,7 @@ type Email = {contentRevisionId: string | null;subject: string;lmx: string;+ contactPropertiesFallbacks?: Record<string, string>;};type Receipt = {teamName: string;@@ -61,6 +62,10 @@ if (!values.team)throw new Error("Pass --team with the expected Loops team name");if (values.apply && !values.state)throw new Error("--apply requires a private --state file");+if (values.apply && deliveryFormat === "mjml")+ throw new Error(+ "Managed emails use custom MJML. Run emails:export and upload reviewed archives in the Loops editor; the API cannot edit this format.",+ );const api = new LoopsApi(process.env.LOOPS_API_KEY ?? "");const identity = await api.request<{ success: boolean; teamName: string }>(@@ -220,6 +225,17 @@ try {{expectedRevisionId: current.contentRevisionId,...definition,+ contactPropertiesFallbacks: {+ ...Object.fromEntries(+ Object.keys(current.contactPropertiesFallbacks ?? {})+ .filter(+ (key) =>+ !Object.hasOwn(definition.contactPropertiesFallbacks, key),+ )+ .map((key) => [key, null]),+ ),+ ...definition.contactPropertiesFallbacks,+ },},);if (result.warnings?.length)diff --git a/scripts/loops/verify.ts b/scripts/loops/verify.tsindex 9bb266e1f..2b368707b 100644--- a/scripts/loops/verify.ts+++ b/scripts/loops/verify.ts@@ -2,10 +2,10 @@ import assert from "node:assert/strict";import { readFile } from "node:fs/promises";import { fileURLToPath } from "node:url";import { parseArgs } from "node:util";-import { components, theme } from "../../emails/brand";+import { components, deliveryFormat, theme } from "../../emails/brand";import registry from "../../emails/resources.json";import { assertEmailContent, normalizeLmx } from "../emails/content";-import { LoopsApi } from "./api";+import { LoopsApi, LoopsApiError } from "./api";import {audienceFilter,campaignTemplates,@@ -51,6 +51,7 @@ const { values } = parseArgs({},team: { type: "string", default: registry.teamName },"mailing-list": { type: "string", default: registry.resources.mailingList },+ "structure-only": { type: "boolean", default: false },},});assert(values.state && values.team && values["mailing-list"]);@@ -74,35 +75,60 @@ assert(brandIds.theme && brandIds.header && brandIds.signature,"Brand IDs missing from resources.json",);-const remoteTheme = await api.request<{- name: string;- styles: Record<string, unknown>;-}>(`themes/${brandIds.theme}`);-assert.equal(remoteTheme.name, theme.name);-for (const [key, value] of Object.entries(theme.styles))- assert.deepEqual(- remoteTheme.styles[key],- value,- `Shared theme differs: ${key}`,- );-for (const component of components) {- const remote = await api.request<{ name: string; lmx: string }>(- `components/${receipt.resources[component.name]}`,- );- assert.equal(remote.name, component.name);- assert.equal(- normalizeLmx(remote.lmx),- normalizeLmx(component.lmx),- `Shared component differs: ${component.name}`,- );+if (deliveryFormat === "lmx") {+ const remoteTheme = await api.request<{+ name: string;+ styles: Record<string, unknown>;+ }>(`themes/${brandIds.theme}`);+ assert.equal(remoteTheme.name, theme.name);+ for (const [key, value] of Object.entries(theme.styles))+ assert.deepEqual(+ remoteTheme.styles[key],+ value,+ `Shared theme differs: ${key}`,+ );+ for (const component of components) {+ const remote = await api.request<{ name: string; lmx: string }>(+ `components/${receipt.resources[component.name]}`,+ );+ assert.equal(remote.name, component.name);+ assert.equal(+ normalizeLmx(remote.lmx),+ normalizeLmx(component.lmx),+ `Shared component differs: ${component.name}`,+ );+ }}let emails = 0;+let customEmails = 0;const verifyEmail = async (id: string | undefined,expected: { subject: string; previewText: string; body: string },) => {assert(id);- const email = await api.request<Email>(`email-messages/${id}`);+ let email: Email;+ try {+ email = await api.request<Email>(`email-messages/${id}`);+ } catch (error) {+ if (+ error instanceof LoopsApiError &&+ error.status === 409 &&+ typeof error.details === "object" &&+ error.details !== null &&+ "message" in error.details &&+ error.details.message === "MJML format is not supported via API."+ ) {+ assert.equal(deliveryFormat, "mjml");+ customEmails++;+ return;+ }+ throw error;+ }+ assert.notEqual(+ deliveryFormat,+ "mjml",+ "Managed email is still in native format",+ );assertEmailContent(email, expected, brandIds);const guardian = await api.request<{errors: unknown[];@@ -234,9 +260,13 @@ console.log(JSON.stringify({workflows: journeys.length,campaigns: campaignTemplates.length,- emails,- guardianErrors: 0,- guardianWarnings: 0,+ apiEmailContentVerified: emails,+ customEmailContentRequiresBrowserReview: customEmails,+ guardianVerifiedEmails: emails,allDraft: true,}),);+if (customEmails && !values["structure-only"])+ throw new Error(+ "Workflow structure and draft states passed. Custom MJML content is unavailable through the API; verify its rendered body, metadata, logo, footer and fallbacks in the browser. Use --structure-only to request only the API checks.",+ );