Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
refactor
Marc Seitz2147acec7cbf
diff --git a/components/emails/subscription-renewal-reminder.tsx b/components/emails/subscription-renewal-reminder.tsxdeleted file mode 100644index bcc8f394..00000000--- a/components/emails/subscription-renewal-reminder.tsx+++ /dev/null@@ -1,59 +0,0 @@-import React from "react";--import {- Body,- Head,- Html,- Preview,- Tailwind,- Text,-} from "@react-email/components";--interface SubscriptionRenewalReminderEmailProps {- customerName: string | null;- renewalDate: string;- amount: string;- currency: string;-}--const SubscriptionRenewalReminderEmail = ({- customerName,- renewalDate,- amount,- currency,-}: SubscriptionRenewalReminderEmailProps) => {- return (- <Html>- <Head />- <Preview>Is your payment information up to date?</Preview>- <Tailwind>- <Body className="font-sans text-sm">- <Text className="font-bold">- Is your payment information up to date?- </Text>- <Text>Hi{customerName && ` ${customerName}`},</Text>- <Text>- Another year has come and gone, which means your annual Papermark- subscription will automatically renew on {renewalDate}.- </Text>- <Text>- We know many things can change in a year, so if you could make sure- the payment method listed on your account is up to date, that would- be dandy.- </Text>- <Text>- Your subscription will renew for {amount} {currency.toUpperCase()}.- </Text>- <Text>- If you need to update your billing details or have any questions,- please visit your account settings.- </Text>- <Text>Best regards,</Text>- <Text>The Papermark Team</Text>- </Body>- </Tailwind>- </Html>- );-};--export default SubscriptionRenewalReminderEmail;diff --git a/ee/features/billing/renewal-reminder/emails/subscription-renewal-reminder.tsx b/ee/features/billing/renewal-reminder/emails/subscription-renewal-reminder.tsxnew file mode 100644index 00000000..71f6e5d2--- /dev/null+++ b/ee/features/billing/renewal-reminder/emails/subscription-renewal-reminder.tsx@@ -0,0 +1,69 @@+import React from "react";++import {+ Body,+ Container,+ Head,+ Hr,+ Html,+ Preview,+ Tailwind,+ Text,+} from "@react-email/components";++import { Footer } from "@/components/emails/shared/footer";++interface SubscriptionRenewalReminderEmailProps {+ customerName: string | null;+ renewalDate: string;+ isOldAccount: boolean;+}++const SubscriptionRenewalReminderEmail = ({+ customerName,+ renewalDate,+ isOldAccount,+}: SubscriptionRenewalReminderEmailProps) => {+ return (+ <Html>+ <Head />+ <Preview>Your Papermark subscription renews soon</Preview>+ <Tailwind>+ <Body className="mx-auto my-auto bg-white font-sans text-sm">+ <Container className="mx-auto my-10 w-[465px] p-5">+ <Text className="mx-0 mb-8 mt-4 p-0 text-2xl font-normal">+ <span className="font-bold tracking-tighter">Papermark</span>+ </Text>+ <Text className="text-2xl font-bold">+ Is your payment information up to date?+ </Text>+ <Text>Hi{customerName && ` ${customerName}`},</Text>+ <Text>+ Another year has come and gone, which means your annual Papermark+ subscription will automatically renew on {renewalDate}.+ </Text>+ <Text>+ We know many things can change in a year, so if you could ask your+ team admin to make sure the payment method listed on your account+ is up to date, that would be great.+ </Text>+ <Text>+ If you need to update your billing details or have any questions,+ please visit your account settings.+ </Text>+ {isOldAccount ? (+ <>+ <Hr />+ <Text className="text-gray-400">Papermark Team</Text>+ </>+ ) : (+ <Footer />+ )}+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+};++export default SubscriptionRenewalReminderEmail;diff --git a/lib/emails/send-subscription-renewal-reminder.ts b/ee/features/billing/renewal-reminder/lib/send-subscription-renewal-reminder.tssimilarity index 71%rename from lib/emails/send-subscription-renewal-reminder.tsrename to ee/features/billing/renewal-reminder/lib/send-subscription-renewal-reminder.tsindex c2ff2dad..fb40ec10 100644--- a/lib/emails/send-subscription-renewal-reminder.ts+++ b/ee/features/billing/renewal-reminder/lib/send-subscription-renewal-reminder.ts@@ -1,22 +1,19 @@-import { sendEmail } from "@/lib/resend";+import SubscriptionRenewalReminderEmail from "@/ee/features/billing/renewal-reminder/emails/subscription-renewal-reminder";-import SubscriptionRenewalReminderEmail from "@/components/emails/subscription-renewal-reminder";+import { sendEmail } from "@/lib/resend";export const sendSubscriptionRenewalReminderEmail = async (params: {customerName: string | null;customerEmail: string;renewalDate: string;- amount: string;- currency: string;+ isOldAccount: boolean;}) => {- const { customerName, customerEmail, renewalDate, amount, currency } =- params;+ const { customerName, customerEmail, renewalDate, isOldAccount } = params;const emailTemplate = SubscriptionRenewalReminderEmail({customerName,renewalDate,- amount,- currency,+ isOldAccount,});try {diff --git a/lib/trigger/send-renewal-reminder.ts b/lib/trigger/send-renewal-reminder.tsdeleted file mode 100644index 1089e793..00000000--- a/lib/trigger/send-renewal-reminder.ts+++ /dev/null@@ -1,40 +0,0 @@-import { logger, task } from "@trigger.dev/sdk/v3";--import { sendSubscriptionRenewalReminderEmail } from "@/lib/emails/send-subscription-renewal-reminder";--export const sendRenewalReminderEmailTask = task({- id: "send-renewal-reminder-email",- retry: { maxAttempts: 3 },- run: async (payload: {- customerEmail: string;- customerName: string | null;- renewalDate: string;- amount: string;- currency: string;- }) => {- try {- logger.info("Sending renewal reminder email", {- to: payload.customerEmail,- renewalDate: payload.renewalDate,- });-- await sendSubscriptionRenewalReminderEmail({- customerEmail: payload.customerEmail,- customerName: payload.customerName,- renewalDate: payload.renewalDate,- amount: payload.amount,- currency: payload.currency,- });-- logger.info("Renewal reminder email sent successfully", {- to: payload.customerEmail,- });- } catch (error) {- logger.error("Error sending renewal reminder email", {- error,- customerEmail: payload.customerEmail,- });- throw error;- }- },-});