// "Your Recap [Pro|Max] account is ready" email — sent after an
// anon buyer's BTCPay invoice settles. Distinct from the standard
// sign-in magic-link email because the framing is celebratory ("your
// purchase is confirmed, click here to access") rather than the
// transactional "click here to sign in." Both share the underlying
// magic-link mechanism — only the copy and subject differ.
//
// Returns { subject, text, html } in the nodemailer shape.
export function renderLicenseReadyEmail({
verifyUrl,
tierLabel = "Pro",
brandName = "Recaps",
expiresInMinutes = 15,
}) {
const subject = `Your ${brandName} ${tierLabel} account is ready`;
const text = [
`Thanks for upgrading to ${brandName} ${tierLabel} — your payment is confirmed.`,
"",
`Click the link below to sign in to your new account. ${tierLabel} is already active and your license is attached.`,
"",
verifyUrl,
"",
`This link expires in ${expiresInMinutes} minutes and can only be used once. If it expires, just go back to ${brandName} and request a fresh sign-in link from the same email.`,
"",
"Welcome aboard.",
].join("\n");
const html = `
|
Your ${escapeHtml(brandName)} ${escapeHtml(tierLabel)} account is ready
|
|
Thanks for upgrading — your payment is confirmed and your ${escapeHtml(tierLabel)} license is attached to your new account.
|
|
Click the button below to sign in. The link expires in ${expiresInMinutes} minutes.
|
|
Sign in to ${escapeHtml(brandName)}
|
|
Or copy and paste this URL into your browser:
|
|
${escapeHtml(verifyUrl)}
|
|
If the link expires before you click it, you can request a fresh sign-in link from ${escapeHtml(brandName)} using this same email. Your ${escapeHtml(tierLabel)} license will already be on the account when you sign in.
|
|
`;
return { subject, text, html };
}
function escapeHtml(s) {
return String(s)
.replace(/&/g, "&")
.replace(//g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
function escapeAttr(s) {
return escapeHtml(s);
}