Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

finalize email

Steven Tey523dbf0e2bad
diff --git a/apps/web/lib/api/partners/notify-partner-sale.ts b/apps/web/lib/api/partners/notify-partner-sale.ts
index 3948192d34..4d6ad3f81f 100644
--- a/apps/web/lib/api/partners/notify-partner-sale.ts
+++ b/apps/web/lib/api/partners/notify-partner-sale.ts
@@ -66,6 +66,7 @@ export async function notifyPartnerSale({
include: {
user: {
select: {
+ name: true,
email: true,
},
},
@@ -120,12 +121,15 @@ export async function notifyPartnerSale({
...workspaceUsers.map(({ user }) =>
limiter.schedule(() =>
sendEmailViaResend({
- subject: "You just made a sale via Dub Partners!",
+ subject: `New commission for ${partnerProfile.name}`,
from: "Dub Partners <[email protected]>",
email: user.email!,
react: NewSaleAlertProgramOwner({
- email: user.email!,
...data,
+ user: {
+ name: user.name,
+ email: user.email!,
+ },
workspace,
}),
}),
diff --git a/packages/email/src/templates/new-sale-alert-program-owner.tsx b/packages/email/src/templates/new-sale-alert-program-owner.tsx
index 73c7d27f16..24d164f81b 100644
--- a/packages/email/src/templates/new-sale-alert-program-owner.tsx
+++ b/packages/email/src/templates/new-sale-alert-program-owner.tsx
@@ -1,4 +1,4 @@
-import { currencyFormatter, DUB_WORDMARK } from "@dub/utils";
+import { capitalize, currencyFormatter, DUB_WORDMARK } from "@dub/utils";
import {
Body,
Column,
@@ -17,7 +17,10 @@ import {
import { Footer } from "../components/footer";
export function NewSaleAlertProgramOwner({
- email = "[email protected]",
+ user = {
+ name: "Brendan Urie",
+ email: "[email protected]",
+ },
workspace = {
name: "Acme",
slug: "acme",
@@ -38,7 +41,10 @@ export function NewSaleAlertProgramOwner({
earnings: 399,
},
}: {
- email: string;
+ user: {
+ name?: string | null;
+ email: string;
+ };
workspace: {
name: string;
slug: string;
@@ -92,6 +98,10 @@ export function NewSaleAlertProgramOwner({
});
}
+ const finalName = user.name
+ ? user.name.split(" ")[0]
+ : capitalize(user.email.split("@")[0]);
+
return (
<Html>
<Head />
@@ -108,7 +118,7 @@ export function NewSaleAlertProgramOwner({
</Section>
<Heading className="mx-0 my-6 p-0 text-lg font-medium text-black">
- Hi {email.split("@")[0]},
+ Hi {finalName},
</Heading>
<Text className="text-sm leading-6 text-neutral-600">
@@ -168,7 +178,7 @@ export function NewSaleAlertProgramOwner({
{formattedDueDate && (
<Text className="text-sm leading-6 text-neutral-600">
- Payment for this commission is not due until{" "}
+ Payment for this commission will be due on{" "}
<strong>{formattedDueDate}</strong>, based on your campaign
settings.
</Text>
@@ -184,7 +194,7 @@ export function NewSaleAlertProgramOwner({
<Text className="text-sm leading-6 text-neutral-600">Thanks!</Text>
- <Footer email={email} />
+ <Footer email={user.email} />
</Container>
</Body>
</Tailwind>