Skip to content

Commit e34310a

Browse files
authored
Merge pull request #539 from trycompai/main
Prod Deploy
2 parents 1cb4e41 + d97fd0b commit e34310a

3 files changed

Lines changed: 38 additions & 102 deletions

File tree

apps/app/src/actions/organization/create-organization-action.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,21 @@ export const createOrganizationAction = authActionClient
8282
const resend = new Resend(process.env.RESEND_API_KEY);
8383

8484
await resend.contacts.create({
85-
firstName: session.user.name?.split(" ")[0] || "",
86-
lastName: session.user.name?.split(" ")[1] || "",
85+
firstName:
86+
session.user.name?.split(" ")[0] ||
87+
session.user.email.split("@")[0] ||
88+
"",
89+
lastName:
90+
session.user.name?.split(" ")[1] ||
91+
session.user.email.split("@")[1] ||
92+
"",
8793
email: session.user.email,
8894
unsubscribed: false,
8995
audienceId: process.env.RESEND_AUDIENCE_ID,
9096
});
9197

9298
await tasks.trigger<typeof newOrgSequence>("new-org-sequence", {
9399
email: session.user.email,
94-
name: session.user.name?.split(" ")[0] || "",
95100
});
96101
}
97102

Lines changed: 19 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
import { task, retry, wait, logger } from "@trigger.dev/sdk/v3";
2-
import {
3-
Body,
4-
Button,
5-
Container,
6-
Font,
7-
Heading,
8-
Html,
9-
Preview,
10-
Section,
11-
Tailwind,
12-
Text,
13-
} from "@react-email/components";
14-
import { Footer } from "@comp/email/components/footer";
15-
import { Logo } from "@comp/email/components/logo";
1+
import { task, retry, logger, wait } from "@trigger.dev/sdk/v3";
162
import { Resend } from "resend";
173

184
const resend = new Resend(process.env.RESEND_API_KEY);
@@ -21,101 +7,44 @@ export const newOrgSequence = task({
217
id: "new-org-sequence",
228
run: async (payload: {
239
email: string;
24-
name: string;
2510
}) => {
2611
logger.info(`Start new sequence for user ${payload.email}`);
2712

28-
await wait.for({ seconds: 5 });
13+
await wait.for({
14+
minutes: 15,
15+
});
2916

3017
const firstEmailResult = await retry.onThrow(
3118
async ({ attempt }) => {
19+
logger.info(`Sending first email to ${payload.email} - attempt ${attempt}`);
20+
3221
const { data, error } = await resend.emails.send({
3322
from: "Lewis Carhart <lewis@mail.trycomp.ai>",
23+
replyTo: "Lewis Carhart <lewis@trycomp.ai>",
3424
to: payload.email,
35-
subject: "Welcome to Comp AI",
36-
react: WelcomeEmail({ name: payload.name }),
25+
subject: "Comp AI",
26+
text: `Hey,
27+
28+
Thanks for signing up to Comp AI! I just wanted to reach out to let you know you can reach out to me anytime by replying to this email, or by booking a call with me here: https://cal.com/team/compai/meet-us
29+
30+
p.s. if you want us to do SOC 2 for you, reply to this email and I can send you some details :)
31+
32+
Best,
33+
Lewis
34+
Founder, Comp AI`
3735
});
3836

3937
if (error) {
40-
throw new Error(error.message);
38+
console.log(error);
4139
}
4240

4341
return data;
4442
},
4543
{ maxAttempts: 3 },
4644
);
4745

48-
await wait.for({ days: 3 });
49-
5046
return {
5147
success: true,
5248
};
5349
},
54-
});
55-
56-
const WelcomeEmail = ({
57-
name,
58-
}: {
59-
name: string;
60-
}) => {
61-
return (
62-
<Html>
63-
<Tailwind>
64-
<head>
65-
<Font
66-
fontFamily="Geist"
67-
fallbackFontFamily="Helvetica"
68-
webFont={{
69-
url: "https://cdn.jsdelivr.net/npm/@fontsource/geist-sans@5.0.1/files/geist-sans-latin-400-normal.woff2",
70-
format: "woff2",
71-
}}
72-
fontWeight={400}
73-
fontStyle="normal"
74-
/>
75-
76-
<Font
77-
fontFamily="Geist"
78-
fallbackFontFamily="Helvetica"
79-
webFont={{
80-
url: "https://cdn.jsdelivr.net/npm/@fontsource/geist-sans@5.0.1/files/geist-sans-latin-500-normal.woff2",
81-
format: "woff2",
82-
}}
83-
fontWeight={500}
84-
fontStyle="normal"
85-
/>
86-
</head>
87-
88-
<Preview>Get started with Comp AI</Preview>
89-
90-
<Body className="bg-[#fff] my-auto mx-auto font-sans">
91-
<Container
92-
className="border-transparent md:border-[#E8E7E1] my-[40px] mx-auto p-[20px] max-w-[600px]"
93-
style={{ borderStyle: "solid", borderWidth: 1 }}
94-
>
95-
<Logo />
96-
<Heading className="mx-0 my-[30px] p-0 text-[24px] font-normal text-[#121212] text-center">
97-
Welcome to Comp AI!
98-
</Heading>
99-
100-
<Section>
101-
<Text className="text-[14px] leading-[24px] text-[#121212]">
102-
Hey {name},
103-
<br />
104-
<br />
105-
We're excited to have you on board with Comp AI. I just wanted to reach out and say welcome!
106-
<br />
107-
<br />
108-
If I can help with anything, you can reach me by replying to this email, or book a call with me here: <a href="https://cal.com/team/compai/meet-us">https://cal.com/team/compai/meet-us</a>
109-
<br />
110-
<br />
111-
p.s. if you're interested, we're currently offering a fast-track path for SOC 2 Type I and II - if you're interested, let me know and I'll send you an invite to Slack :)
112-
</Text>
113-
</Section>
114-
115-
<Footer />
116-
</Container>
117-
</Body>
118-
</Tailwind>
119-
</Html>
120-
);
121-
};
50+
});

packages/email/package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",
77
"types": "./dist/index.d.ts",
8-
"files": ["dist/**"],
8+
"files": [
9+
"dist/**"
10+
],
911
"scripts": {
1012
"build": "tsup index.ts --format cjs,esm --dts",
1113
"dev": "tsup index.ts --format cjs,esm --watch --dts",
@@ -17,19 +19,19 @@
1719
"dependencies": {
1820
"@comp/ui": "workspace:*",
1921
"@comp/utils": "workspace:*",
20-
"@react-email/components": "0.0.31",
21-
"@react-email/render": "1.0.6",
22+
"@react-email/components": "0.0.36",
23+
"@react-email/render": "0.0.9-canary.2",
2224
"@react-email/tailwind": "1.0.4",
2325
"date-fns": "^4.1.0",
24-
"react-email": "4.0.11",
25-
"responsive-react-email": "^0.0.5",
2626
"react": "^19.1.0",
27-
"react-dom": "^19.1.0"
27+
"react-dom": "^19.1.0",
28+
"react-email": "4.0.11",
29+
"responsive-react-email": "^0.0.5"
2830
},
2931
"devDependencies": {
3032
"typescript": "^5.8.3",
31-
"@types/react": "^19.1.2",
32-
"@types/react-dom": "^19.1.1",
33+
"@types/react": "^19.1.3",
34+
"@types/react-dom": "^19.1.3",
3335
"tsup": "^8.4.0"
3436
}
35-
}
37+
}

0 commit comments

Comments
 (0)