Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,85 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { Layout } from "../components/Layout.js";
|
||||
import { Button, Footer, Heading, Paragraph, Spacer } from "../components/primitives.js";
|
||||
|
||||
export interface TrialReminderEmailCopy {
|
||||
readonly daySingular: string;
|
||||
readonly dayPlural: string;
|
||||
readonly fallbackRecipient: string;
|
||||
readonly preview: (productName: string, daysRemaining: number, dayWord: string) => string;
|
||||
readonly title: (daysRemaining: number, dayWord: string) => string;
|
||||
readonly footerReason: (productName: string) => ReactNode;
|
||||
readonly unsubscribe: string;
|
||||
readonly heading: (daysRemaining: number, dayWord: string) => ReactNode;
|
||||
readonly greeting: (recipientName: string) => ReactNode;
|
||||
readonly intro: (productName: string, daysRemaining: number, dayWord: string) => ReactNode;
|
||||
readonly defaultCta: string;
|
||||
readonly extensionPrompt: ReactNode;
|
||||
}
|
||||
|
||||
export interface TrialReminderEmailProps {
|
||||
readonly recipientName?: string;
|
||||
readonly productName: string;
|
||||
readonly daysRemaining: number;
|
||||
readonly upgradeUrl: string;
|
||||
readonly unsubscribeUrl: string;
|
||||
readonly copy?: Partial<TrialReminderEmailCopy>;
|
||||
}
|
||||
|
||||
const defaultCopy: TrialReminderEmailCopy = {
|
||||
daySingular: "day",
|
||||
dayPlural: "days",
|
||||
fallbackRecipient: "there",
|
||||
preview: (productName, daysRemaining, dayWord) => `Your ${productName} trial ends in ${daysRemaining} ${dayWord}`,
|
||||
title: (daysRemaining, dayWord) => `Trial reminder - ${daysRemaining} ${dayWord} left`,
|
||||
footerReason: (productName) => `Trial reminder from ${productName}.`,
|
||||
unsubscribe: "Unsubscribe",
|
||||
heading: (daysRemaining, dayWord) => `${daysRemaining} ${dayWord} left in your trial`,
|
||||
greeting: (recipientName) => `Hi ${recipientName},`,
|
||||
intro: (productName, daysRemaining, dayWord) => (
|
||||
<>
|
||||
Your {productName} trial ends in <strong>{daysRemaining} {dayWord}</strong>.
|
||||
Upgrade now to keep your data, integrations and saved workflows.
|
||||
</>
|
||||
),
|
||||
defaultCta: "Upgrade my plan",
|
||||
extensionPrompt: "Need more time? Reply to this email and we will extend your trial - no questions asked.",
|
||||
};
|
||||
|
||||
/**
|
||||
* "Trial Expiring" — triggered by `tenant.trial_expiring`. The
|
||||
* sequence schedules 3 steps (7d, 3d, 1d before expiry) with the same
|
||||
* template but different `daysRemaining` values.
|
||||
*/
|
||||
export function TrialReminderEmail({
|
||||
recipientName,
|
||||
productName,
|
||||
daysRemaining,
|
||||
upgradeUrl,
|
||||
unsubscribeUrl,
|
||||
copy,
|
||||
}: TrialReminderEmailProps) {
|
||||
const resolvedCopy = { ...defaultCopy, ...copy };
|
||||
const greetingTarget = recipientName?.trim() || resolvedCopy.fallbackRecipient;
|
||||
const dayWord = daysRemaining === 1 ? resolvedCopy.daySingular : resolvedCopy.dayPlural;
|
||||
return (
|
||||
<Layout
|
||||
previewText={resolvedCopy.preview(productName, daysRemaining, dayWord)}
|
||||
title={resolvedCopy.title(daysRemaining, dayWord)}
|
||||
footer={
|
||||
<Footer>
|
||||
{resolvedCopy.footerReason(productName)}<br />
|
||||
<a href={unsubscribeUrl}>{resolvedCopy.unsubscribe}</a>
|
||||
</Footer>
|
||||
}
|
||||
>
|
||||
<Heading level={1}>{resolvedCopy.heading(daysRemaining, dayWord)}</Heading>
|
||||
<Paragraph>{resolvedCopy.greeting(greetingTarget)}</Paragraph>
|
||||
<Paragraph>{resolvedCopy.intro(productName, daysRemaining, dayWord)}</Paragraph>
|
||||
<Spacer size="md" />
|
||||
<Button href={upgradeUrl}>{resolvedCopy.defaultCta}</Button>
|
||||
<Spacer size="md" />
|
||||
<Paragraph>{resolvedCopy.extensionPrompt}</Paragraph>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user