The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
send email
Kiran Kc3769bac0ede
diff --git a/apps/web/emails/partner-invite.tsx b/apps/web/emails/partner-invite.tsxnew file mode 100644index 0000000000..d00783d18a--- /dev/null+++ b/apps/web/emails/partner-invite.tsx@@ -0,0 +1,72 @@+import { DUB_WORDMARK } from "@dub/utils";+import {+ Body,+ Container,+ Head,+ Heading,+ Html,+ Img,+ Link,+ Preview,+ Section,+ Tailwind,+ Text,+} from "@react-email/components";+import Footer from "./components/footer";++export default function PartnerInvite({+ email = "[email protected]",+ appName = "Dub.co",+ url = "https://dub.co",+ workspaceUser = "Brendon Urie",+ workspaceUserEmail = "[email protected]",+}: {+ email: string;+ appName: string;+ url: string;+ workspaceUser: string | null;+ workspaceUserEmail: string | null;+}) {+ return (+ <Html>+ <Head />+ <Preview>Sign up for {appName}</Preview>+ <Tailwind>+ <Body className="mx-auto my-auto bg-white font-sans">+ <Container className="mx-auto my-10 max-w-[500px] rounded border border-solid border-gray-200 px-10 py-5">+ <Section className="mt-8">+ <Img+ src={DUB_WORDMARK}+ height="40"+ alt={appName}+ className="mx-auto my-0"+ />+ </Section>++ <Heading className="mx-0 my-7 p-0 text-center text-xl font-semibold text-black">+ Sign up for {appName}+ </Heading>++ <Section className="mb-8 text-center">+ <Link+ className="rounded-full bg-black px-6 py-3 text-center text-[12px] font-semibold text-white no-underline"+ href={url}+ >+ Learn More+ </Link>+ </Section>++ <Text className="text-sm leading-6 text-black">+ or copy and paste this URL into your browser:+ </Text>++ <Text className="max-w-sm flex-wrap break-words font-medium text-purple-600 no-underline">+ {url.replace(/^https?:\/\//, "")}+ </Text>+ <Footer email={email} />+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+}diff --git a/apps/web/lib/actions/invite-partner.ts b/apps/web/lib/actions/invite-partner.tsindex f36d4a2c75..949d17f297 100644--- a/apps/web/lib/actions/invite-partner.ts+++ b/apps/web/lib/actions/invite-partner.ts@@ -1,6 +1,8 @@"use server";import { prisma } from "@/lib/prisma";+import { sendEmail } from "emails";+import PartnerInvite from "emails/partner-invite";import { z } from "zod";import { getLinkOrThrow } from "../api/links/get-link-or-throw";import { getProgramOrThrow } from "../api/programs/get-program";@@ -55,8 +57,18 @@ export const invitePartnerAction = authActionClient},});- return result;+ // TODO: Update email template+ await sendEmail({+ subject: `You've been invited to start using ${process.env.NEXT_PUBLIC_APP_NAME}`,+ email,+ react: PartnerInvite({+ email,+ appName: process.env.NEXT_PUBLIC_APP_NAME as string,+ url: `https://refer.dub.co/${workspace.slug}`,+ workspaceUser: ctx.user.name || null,+ workspaceUserEmail: ctx.user.email || null,+ }),+ });- // TODO- // Send email+ return result;});