Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat(email): update upgrade email with proper plan
Marc Seitz02e01962b9cd
diff --git a/components/emails/upgrade-plan.tsx b/components/emails/upgrade-plan.tsxindex d513dd4f..3f1f4cdc 100644--- a/components/emails/upgrade-plan.tsx+++ b/components/emails/upgrade-plan.tsx@@ -16,8 +16,13 @@ import {interface UpgradePlanEmailProps {name: string | null | undefined;+ planType: string;}+const UpgradePlanEmail = ({+ name,+ planType = "Pro",+}: UpgradePlanEmailProps) => {const previewText = `The document sharing infrastructure for the modern web`;const features: any = {diff --git a/lib/emails/send-upgrade-plan.ts b/lib/emails/send-upgrade-plan.tsindex e9c3ce85..a89d84bb 100644--- a/lib/emails/send-upgrade-plan.ts+++ b/lib/emails/send-upgrade-plan.ts@@ -1,16 +1,18 @@import UpgradePlanEmail from "@/components/emails/upgrade-plan";import { sendEmail } from "@/lib/resend";+import { CreateUserEmailProps } from "@/lib/types";-import { CreateUserEmailProps } from "../types";--export const sendUpgradePlanEmail = async (params: CreateUserEmailProps) => {+export const sendUpgradePlanEmail = async (+ params: CreateUserEmailProps & { planType: string },+) => {const { name, email } = params.user;- const emailTemplate = UpgradePlanEmail({ name });+ const { planType } = params;+ const emailTemplate = UpgradePlanEmail({ name, planType });try {await sendEmail({to: email as string,- subject: "Thank you for upgrading to Papermark Pro!",+ subject: `Thank you for upgrading to Papermark ${planType}!`,react: emailTemplate,test: process.env.NODE_ENV === "development",});diff --git a/pages/api/stripe/webhook.ts b/pages/api/stripe/webhook.tsindex 8a8dbfbe..19c5b701 100644--- a/pages/api/stripe/webhook.ts+++ b/pages/api/stripe/webhook.ts@@ -120,6 +120,8 @@ export default async function webhookHandler(email: team.users[0].user.email as string,name: team.users[0].user.name as string,},+ planType:+ plan.slug.charAt(0).toUpperCase() + plan.slug.slice(1),});}