mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-29 09:12:56 +00:00
Add trial system
This commit is contained in:
127
server/emails/templates/NotifyTrialExpiring.tsx
Normal file
127
server/emails/templates/NotifyTrialExpiring.tsx
Normal file
@@ -0,0 +1,127 @@
|
||||
import React from "react";
|
||||
import { Body, Head, Html, Preview, Tailwind } from "@react-email/components";
|
||||
import { themeColors } from "./lib/theme";
|
||||
import {
|
||||
EmailContainer,
|
||||
EmailFooter,
|
||||
EmailGreeting,
|
||||
EmailHeading,
|
||||
EmailLetterHead,
|
||||
EmailSignature,
|
||||
EmailText
|
||||
} from "./components/Email";
|
||||
|
||||
interface Props {
|
||||
email: string;
|
||||
orgName: string;
|
||||
trialEndsAt: string;
|
||||
daysRemaining: number | null;
|
||||
billingLink: string;
|
||||
}
|
||||
|
||||
export const NotifyTrialExpiring = ({
|
||||
email,
|
||||
orgName,
|
||||
trialEndsAt,
|
||||
daysRemaining,
|
||||
billingLink
|
||||
}: Props) => {
|
||||
const hasEnded = daysRemaining === null || daysRemaining === 0;
|
||||
const isLastDay = daysRemaining === 1;
|
||||
|
||||
const previewText = hasEnded
|
||||
? `Your trial for ${orgName} has ended.`
|
||||
: isLastDay
|
||||
? `Your trial for ${orgName} ends tomorrow.`
|
||||
: `Your trial for ${orgName} ends in ${daysRemaining} days.`;
|
||||
|
||||
const heading = hasEnded
|
||||
? "Your Trial Has Ended"
|
||||
: "Your Trial Is Ending Soon";
|
||||
|
||||
return (
|
||||
<Html>
|
||||
<Head />
|
||||
<Preview>{previewText}</Preview>
|
||||
<Tailwind config={themeColors}>
|
||||
<Body className="font-sans bg-gray-50">
|
||||
<EmailContainer>
|
||||
<EmailLetterHead />
|
||||
|
||||
<EmailHeading>{heading}</EmailHeading>
|
||||
|
||||
<EmailGreeting>Hi there,</EmailGreeting>
|
||||
|
||||
{hasEnded ? (
|
||||
<>
|
||||
<EmailText>
|
||||
Your free trial for{" "}
|
||||
<strong>{orgName}</strong> ended on{" "}
|
||||
<strong>{trialEndsAt}</strong>. Your account
|
||||
has been moved to the free plan, which
|
||||
includes limited functionality.
|
||||
</EmailText>
|
||||
|
||||
<EmailText>
|
||||
Some features and resources may now be
|
||||
restricted or disconnected. To restore full
|
||||
access and continue using all the features
|
||||
you had during your trial, please upgrade to
|
||||
a paid plan.
|
||||
</EmailText>
|
||||
|
||||
<EmailText>
|
||||
You can{" "}
|
||||
<a href={billingLink}>
|
||||
upgrade your plan here
|
||||
</a>{" "}
|
||||
to get back up and running right away.
|
||||
</EmailText>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<EmailText>
|
||||
Just a reminder that your free trial for{" "}
|
||||
<strong>{orgName}</strong> will end on{" "}
|
||||
<strong>{trialEndsAt}</strong>
|
||||
{isLastDay
|
||||
? " — that's tomorrow!"
|
||||
: `, in ${daysRemaining} days`}
|
||||
.
|
||||
</EmailText>
|
||||
|
||||
<EmailText>
|
||||
After your trial ends, your account will be
|
||||
moved to the free plan and some
|
||||
functionality may be restricted or your
|
||||
sites may disconnect.
|
||||
</EmailText>
|
||||
|
||||
<EmailText>
|
||||
To avoid any interruption to your service,
|
||||
we encourage you to upgrade before your
|
||||
trial expires. You can{" "}
|
||||
<a href={billingLink}>
|
||||
upgrade your plan here
|
||||
</a>
|
||||
.
|
||||
</EmailText>
|
||||
</>
|
||||
)}
|
||||
|
||||
<EmailText>
|
||||
If you have any questions or need assistance, please
|
||||
don't hesitate to reach out to our support team.
|
||||
</EmailText>
|
||||
|
||||
<EmailFooter>
|
||||
<EmailSignature />
|
||||
</EmailFooter>
|
||||
</EmailContainer>
|
||||
</Body>
|
||||
</Tailwind>
|
||||
</Html>
|
||||
);
|
||||
};
|
||||
|
||||
export default NotifyTrialExpiring;
|
||||
Reference in New Issue
Block a user