Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(loops): greet case-study owners as the team when no real first name is known
Richie McIlroy75686d451977
diff --git a/emails/CATALOG.md b/emails/CATALOG.mdindex 20bc77077..23524aab1 100644--- a/emails/CATALOG.md+++ b/emails/CATALOG.md@@ -603,17 +603,17 @@ See Cap v0.6 in action →### customer-case-study-Invite named Cap Pro organisation owners with more than one seat to reply if they'd like their team on the website logo wall, in a case study, or both.+Invite Cap Pro organisation owners with more than one seat to reply if they'd like their team on the website logo wall, in a case study, or both.**Subject:** Could we feature your team on the Cap website?**Preview:** A spot on our new logo wall, and a case study if you're up for it.-**Variables:** `contact.capGreeting` (fallback: Hey,)+**Variables:** `contact.capTeamGreeting` (fallback: Hey team,)**Edit:** [emails/marketing/customer-case-study.ts](../emails/marketing/customer-case-study.ts)-{contact.capGreeting}+{contact.capTeamGreeting}We're adding a logo wall to the Cap website to show the teams using Cap, and I'd love to include yours.diff --git a/emails/audiences.ts b/emails/audiences.tsindex d214e7652..31fb13bbc 100644--- a/emails/audiences.ts+++ b/emails/audiences.ts@@ -7,7 +7,7 @@ export const contactProperties = {capCustomer: "boolean",capPlanName: "string",capMultiSeatOwner: "boolean",- capHasFirstName: "boolean",+ capTeamGreeting: "string",capCustomerWelcome: "string",capPromotionalEligible: "boolean",capOnboardingEligible: "boolean",diff --git a/emails/brand.ts b/emails/brand.tsindex 1f322732f..fd095530d 100644--- a/emails/brand.ts+++ b/emails/brand.ts@@ -65,6 +65,7 @@ export const sender = {export const contactFallbacks = {capGreeting: "Hey,",+ capTeamGreeting: "Hey team,",capPlanName: "Cap",capCustomerWelcome:"If you need a hand getting set up, just reply and I'll help you sort it.",diff --git a/emails/campaigns.ts b/emails/campaigns.tsindex 3208b854d..579cb5de8 100644--- a/emails/campaigns.ts+++ b/emails/campaigns.ts@@ -26,7 +26,6 @@ export const campaignTemplates: Campaign[] = [condition("capPlanName", "Cap Pro"),condition("capTeammate", false),condition("capMultiSeatOwner", true),- condition("capHasFirstName", true),],},];diff --git a/emails/marketing/customer-case-study.ts b/emails/marketing/customer-case-study.tsindex 61974c39d..67718f81d 100644--- a/emails/marketing/customer-case-study.ts+++ b/emails/marketing/customer-case-study.ts@@ -4,13 +4,13 @@ export const customerCaseStudy = {id: "customer-case-study",key: "customer-case-study",purpose:- "Invite named Cap Pro organisation owners with more than one seat to reply if they'd like their team on the website logo wall, in a case study, or both.",+ "Invite Cap Pro organisation owners with more than one seat to reply if they'd like their team on the website logo wall, in a case study, or both.",subject: "Could we feature your team on the Cap website?",previewText:"A spot on our new logo wall, and a case study if you're up for it.",- variables: ["capGreeting"],+ variables: ["capTeamGreeting"],body: [- "<Paragraph>{contact.capGreeting}</Paragraph>",+ "<Paragraph>{contact.capTeamGreeting}</Paragraph>","<Paragraph>We're adding a logo wall to the Cap website to show the teams using Cap, and I'd love to include yours.</Paragraph>","<Paragraph>We're also putting together case studies, and it'd be great to feature your team in one of those too.</Paragraph>","<Paragraph>If you're enjoying Cap and would like to be featured, just reply and let me know if you're happy to be on the logo wall, do a case study, or both. For a case study, I'll send you a short Q&A to fill in.</Paragraph>",diff --git a/packages/database/loops/profile.ts b/packages/database/loops/profile.tsindex 9bd0fda3b..72a92fd60 100644--- a/packages/database/loops/profile.ts+++ b/packages/database/loops/profile.ts@@ -182,8 +182,10 @@ export function classifyProfile(userId: user?.id ?? `bento:${emailHash(source.email)}`,firstName,capGreeting: firstName ? `Hey ${firstName},` : "Hey,",- capHasFirstName:- Boolean(firstName) && !roleNames.has(firstName.toLowerCase()),+ capTeamGreeting:+ firstName && !roleNames.has(firstName.toLowerCase())+ ? `Hey ${firstName},`+ : "Hey team,",lastName:[source.last_name, source.lastname, user?.lastName].map((value) => value?.trim())diff --git a/packages/database/loops/sync-policy.ts b/packages/database/loops/sync-policy.tsindex 5350e6df5..cc2d5df1a 100644--- a/packages/database/loops/sync-policy.ts+++ b/packages/database/loops/sync-policy.ts@@ -27,7 +27,7 @@ export function profileFingerprint(profile: ContactProfile) {capVerifiedAt: _verified,capImportedAt: _imported,capMultiSeatOwner,- capHasFirstName,+ capTeamGreeting,...stable} = profile;// Case-study targeting only forces a sync for multi-seat owners, so adding@@ -36,7 +36,7 @@ export function profileFingerprint(profile: ContactProfile) {.update(JSON.stringify(capMultiSeatOwner- ? { ...stable, capMultiSeatOwner, capHasFirstName }+ ? { ...stable, capMultiSeatOwner, capTeamGreeting }: stable,),)diff --git a/scripts/loops/profile.test.ts b/scripts/loops/profile.test.tsindex fd9c0db89..b77a89b9a 100644--- a/scripts/loops/profile.test.ts+++ b/scripts/loops/profile.test.ts@@ -71,14 +71,14 @@ test("greetings include a name only when a nonblank name is known", () => {}});-test("first-name targeting follows the same nonblank rule as the greeting", () => {+test("team greetings use a real first name and fall back to the team", () => {const fixture = input();- assert.equal(classifyProfile(fixture).capHasFirstName, true);+ assert.equal(classifyProfile(fixture).capTeamGreeting, "Hey Taylor,");fixture.user = undefined;for (const firstName of [undefined, "", " ", "null"]) {if (firstName === undefined) delete fixture.source.first_name;else fixture.source.first_name = firstName;- assert.equal(classifyProfile(fixture).capHasFirstName, false);+ assert.equal(classifyProfile(fixture).capTeamGreeting, "Hey team,");}for (const roleName of ["Admin",@@ -91,7 +91,7 @@ test("first-name targeting follows the same nonblank rule as the greeting", () ="account",]) {fixture.source.first_name = roleName;- assert.equal(classifyProfile(fixture).capHasFirstName, false);+ assert.equal(classifyProfile(fixture).capTeamGreeting, "Hey team,");}});@@ -101,7 +101,7 @@ test("case-study targeting leaves other contacts' sync fingerprints unchanged",capVerifiedAt: _verified,capImportedAt: _imported,capMultiSeatOwner: _owner,- capHasFirstName: _name,+ capTeamGreeting: _greeting,...legacy} = profile;assert.equal(@@ -117,7 +117,7 @@ test("case-study targeting leaves other contacts' sync fingerprints unchanged",profileFingerprint({...profile,capMultiSeatOwner: true,- capHasFirstName: false,+ capTeamGreeting: "Hey team,",}),);});