mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
108 files: README, marketing copy, page titles, meta tags, footer text, email templates, .env.example, UI strings. URLs swapped from papermark.com/papermark.io to dataroom.hanzo.ai. Internal identifiers left intact per repo policy: localStorage keys (papermark.email/papermark.name/last_papermark_login — changing them logs users out), type field names (papermarkUserId), internal helper symbols (PAPERMARK_HEADERS, PapermarkSparkle component, isPapermarkUrl helper), internal-only filenames. LLM.md retains 'Upstream: Papermark' attribution line. Per-locale .po translations regenerate from source on the next lingui-extract CI run. DB migrations untouched (append-only history; rewriting them breaks installed schemas). LICENSE stays AGPL-3.0.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { sendEmail } from "@/lib/resend";
|
|
|
|
import UpgradePersonalEmail from "@/components/emails/upgrade-personal-welcome";
|
|
|
|
import { CreateUserEmailProps } from "../types";
|
|
|
|
const PLAN_TYPE_MAP = {
|
|
pro: "Pro",
|
|
business: "Business",
|
|
datarooms: "Data Rooms",
|
|
"datarooms-plus": "Data Rooms Plus",
|
|
"datarooms-premium": "Data Rooms Premium",
|
|
};
|
|
|
|
export const sendUpgradePersonalEmail = async (
|
|
params: CreateUserEmailProps & { planSlug?: string },
|
|
) => {
|
|
const { name, email } = params.user;
|
|
const { planSlug = "pro" } = params;
|
|
|
|
// Schedule the email to be sent 6 minutes from now
|
|
const sixMinuteFromNow = new Date(Date.now() + 1000 * 60 * 6).toISOString();
|
|
|
|
// Get the first name from the full name
|
|
const firstName = name ? name.split(" ")[0] : null;
|
|
const planName = PLAN_TYPE_MAP[planSlug as keyof typeof PLAN_TYPE_MAP];
|
|
|
|
const emailTemplate = UpgradePersonalEmail({ name: firstName, planName });
|
|
try {
|
|
await sendEmail({
|
|
to: email as string,
|
|
from: "Iuliia Shnai <[email protected]>",
|
|
subject: "Your Hanzo Dataroom account is ready",
|
|
react: emailTemplate,
|
|
test: process.env.NODE_ENV === "development",
|
|
scheduledAt: sixMinuteFromNow,
|
|
});
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
};
|