All files / lib/email templates.ts

49.72% Statements 92/185
100% Branches 9/9
53.84% Functions 7/13
49.72% Lines 92/185

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723                  73x 73x             73x                                                           73x                 73x                 73x         1x         18x 18x   18x         18x         18x 18x 18x                               18x                       18x 18x 18x 18x 18x         1x             11x 11x   11x         11x         11x 11x 11x 11x                     11x                       11x 11x 11x 11x 11x         1x           11x 11x   11x         11x       11x 11x 11x                     11x                       11x 11x 11x 11x 11x         1x           11x 11x   11x         11x       11x                     11x               11x 11x 11x 11x 11x         1x         11x 11x   11x         11x       11x 11x                     11x               11x 11x 11x 11x 11x         1x       11x 11x   11x         11x       11x                       11x               11x 11x 11x 11x 11x         1x                                                                                                                                                                               1x                                                                                                   1x                                                                                                       1x                                                                                                         1x                                                                                                         1x                                                                                                              
/**
 * Email Templates for ProofID
 *
 * Simple HTML email templates for transactional emails
 */
 
/**
 * Wrapper for centered email layout (matching Supabase style)
 */
function centeredEmailWrapper(content: string, title: string): string {
  return `
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="color-scheme" content="light dark">
  <title>${title}</title>
  <style>
    :root { color-scheme: light dark; }
    @media (prefers-color-scheme: dark) {
      .email-body { background-color: #0a0a0f !important; }
      .email-card { background-color: #111118 !important; border-color: #1e1e2e !important; }
      .text-primary { color: #ffffff !important; }
      .text-secondary { color: #a1a1aa !important; }
      .text-muted { color: #71717a !important; }
    }
  </style>
</head>
<body class="email-body" style="margin: 0; padding: 0; background-color: #f4f4f5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;">
  <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color: inherit;">
    <tr>
      <td style="padding: 48px 24px;">
        <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="max-width: 480px; margin: 0 auto;">
          <!-- Logo -->
          <tr>
            <td style="text-align: center; padding-bottom: 32px;">
              <img src="https://proofid-templates.s3.ap-south-1.amazonaws.com/logo_3.png" alt="ProofID" width="80" height="80" style="display: block; margin: 0 auto 12px auto; width: 80px; height: 80px; border-radius: 12px;">
              <p class="text-primary" style="margin: 0; font-size: 24px; font-weight: 700; color: #18181b; letter-spacing: -0.5px;">ProofID</p>
            </td>
          </tr>
          <!-- Card -->
          <tr>
            <td>
              <table class="email-card" role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color: #ffffff; border-radius: 16px; border: 1px solid #e4e4e7;">
                <tr>
                  <td style="padding: 40px 32px;">
                    ${content}
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <!-- Footer -->
          <tr>
            <td style="padding-top: 24px; text-align: center;">
              <p class="text-muted" style="margin: 0; font-size: 12px; color: #71717a;">&copy; ${new Date().getFullYear()} ProofID. All rights reserved.</p>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>`;
}
 
/**
 * Welcome email after account creation
 */
export function welcomeEmail(params: {
  displayName: string;
  username: string;
  identityCode: string;
  profileUrl: string;
}): { subject: string; html: string } {
  const { displayName, username, identityCode, profileUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #7c3aed; text-align: center;">
      Welcome to ProofID!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, your proof-of-work identity is ready.
    </p>
 
    <div style="background: #f4f4f5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0;">
      <p style="margin: 0 0 12px 0; font-size: 16px; font-weight: 600; color: #18181b;">Your Identity Triplet</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Username:</strong> ${username}</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Identity Code:</strong> <code style="background: #e5e7eb; padding: 4px 8px; border-radius: 4px; color: #7c3aed;">${identityCode}</code></p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Profile URL:</strong> <a href="${profileUrl}" style="color: #7c3aed;">${profileUrl}</a></p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 8px 0; font-size: 14px; color: #52525b; line-height: 1.5;">
      Share your identity code or profile link with clients to prove who you are. Next steps:
    </p>
    <ul style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; line-height: 1.8;">
      <li>Add work samples to showcase your skills</li>
      <li>Request testimonials from past clients</li>
      <li>Set up your service packages and pricing</li>
    </ul>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${profileUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            View Your Profile
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      If you didn't create this account, please ignore this email.
    </p>
  `;
 
  return {
    subject: `Welcome to ProofID, ${displayName}!`,
    html: centeredEmailWrapper(content, 'Welcome to ProofID'),
  };
}
 
/**
 * Payment successful email
 */
export function paymentSuccessEmail(params: {
  displayName: string;
  planName: string;
  amount: string;
  transactionId: string;
  validUntil: string;
  dashboardUrl: string;
}): { subject: string; html: string } {
  const { displayName, planName, amount, transactionId, validUntil, dashboardUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #059669; text-align: center;">
      Payment Successful!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, thank you for upgrading to ProofID ${planName}. Your payment has been processed successfully.
    </p>
 
    <div style="background: #f4f4f5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0;">
      <p style="margin: 0 0 12px 0; font-size: 16px; font-weight: 600; color: #18181b;">Payment Details</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Plan:</strong> ${planName}</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Amount:</strong> ${amount}</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Transaction ID:</strong> ${transactionId}</p>
      <p style="margin: 8px 0; font-size: 14px; color: #52525b;"><strong>Valid Until:</strong> ${validUntil}</p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Your new features are now active. Enjoy your upgraded ProofID experience!
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${dashboardUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Go to Dashboard
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      If you have any questions, contact us at support@proofid.in
    </p>
  `;
 
  return {
    subject: `Payment Successful - ProofID ${planName} Plan`,
    html: centeredEmailWrapper(content, 'Payment Successful - ProofID'),
  };
}
 
/**
 * Payment failed email
 */
export function paymentFailedEmail(params: {
  displayName: string;
  planName: string;
  amount: string;
  reason?: string;
  retryUrl: string;
}): { subject: string; html: string } {
  const { displayName, planName, amount, reason, retryUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #dc2626; text-align: center;">
      Payment Failed
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, unfortunately your payment for ProofID ${planName} could not be processed.
    </p>
 
    <div style="background: #fef2f2; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; border: 1px solid #fecaca;">
      <p style="margin: 8px 0; font-size: 14px; color: #991b1b;"><strong>Plan:</strong> ${planName}</p>
      <p style="margin: 8px 0; font-size: 14px; color: #991b1b;"><strong>Amount:</strong> ${amount}</p>
      ${reason ? `<p style="margin: 8px 0; font-size: 14px; color: #991b1b;"><strong>Reason:</strong> ${reason}</p>` : ''}
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Please try again or use a different payment method.
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${retryUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Retry Payment
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      If you continue to experience issues, contact us at support@proofid.in
    </p>
  `;
 
  return {
    subject: `Payment Failed - ProofID ${planName} Plan`,
    html: centeredEmailWrapper(content, 'Payment Failed - ProofID'),
  };
}
 
/**
 * Subscription expiring soon email
 */
export function subscriptionExpiringEmail(params: {
  displayName: string;
  planName: string;
  expiresOn: string;
  daysLeft: number;
  renewUrl: string;
}): { subject: string; html: string } {
  const { displayName, planName, expiresOn, daysLeft, renewUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #f59e0b; text-align: center;">
      Subscription Expiring Soon
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, your ProofID ${planName} subscription will expire on ${expiresOn}.
    </p>
 
    <div style="background: #fffbeb; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; border: 1px solid #fde68a; text-align: center;">
      <p style="margin: 0; font-size: 18px; font-weight: 600; color: #92400e;">${daysLeft} days remaining</p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      To continue enjoying premium features without interruption, please renew your subscription.
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${renewUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Renew Now
          </a>
        </td>
      </tr>
    </table>
  `;
 
  return {
    subject: `Your ProofID ${planName} subscription expires in ${daysLeft} days`,
    html: centeredEmailWrapper(content, 'Subscription Expiring - ProofID'),
  };
}
 
/**
 * New testimonial received email
 */
export function newTestimonialEmail(params: {
  displayName: string;
  authorName: string;
  content: string;
  dashboardUrl: string;
}): { subject: string; html: string } {
  const { displayName, authorName, content, dashboardUrl } = params;
 
  const emailContent = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #7c3aed; text-align: center;">
      New Testimonial Received!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, ${authorName} just left you a testimonial.
    </p>
 
    <div style="background: #f4f4f5; padding: 16px 20px; border-radius: 12px; margin: 0 0 24px 0; border-left: 4px solid #7c3aed;">
      <p style="margin: 0; font-size: 14px; color: #52525b; font-style: italic; line-height: 1.6;">"${content}"</p>
      <p style="margin: 8px 0 0 0; font-size: 13px; color: #71717a; font-weight: 500;">- ${authorName}</p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Log in to your dashboard to review and publish this testimonial.
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${dashboardUrl}/testimonials" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Review Testimonial
          </a>
        </td>
      </tr>
    </table>
  `;
 
  return {
    subject: `New testimonial from ${authorName}`,
    html: centeredEmailWrapper(emailContent, 'New Testimonial - ProofID'),
  };
}
 
/**
 * Profile view milestone email
 */
export function profileMilestoneEmail(params: {
  displayName: string;
  viewCount: number;
  dashboardUrl: string;
}): { subject: string; html: string } {
  const { displayName, viewCount, dashboardUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #7c3aed; text-align: center;">
      Milestone Reached!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, congratulations!
    </p>
 
    <div style="background: #f4f4f5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; text-align: center;">
      <p style="margin: 0 0 4px 0; font-size: 32px; font-weight: 700; color: #7c3aed;">${viewCount.toLocaleString()}</p>
      <p style="margin: 0; font-size: 14px; color: #52525b;">Profile Views</p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Your proof-of-work identity is gaining traction. Keep building your portfolio!
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${dashboardUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            View Analytics
          </a>
        </td>
      </tr>
    </table>
  `;
 
  return {
    subject: `Your profile just hit ${viewCount} views!`,
    html: centeredEmailWrapper(content, 'Milestone Reached - ProofID'),
  };
}
 
/**
 * Invite email - sent when a user invites someone to join ProofID
 */
export function inviteEmail(params: {
  inviterName: string;
  inviteeName: string | null;
  inviteType: 'referral' | 'collaboration' | 'testimonial';
  message: string | null;
  inviteUrl: string;
  inviterProfileUrl: string;
}): { subject: string; html: string } {
  const { inviterName, inviteeName, inviteType, message, inviteUrl, inviterProfileUrl } = params;
 
  const greeting = inviteeName ? inviteeName : 'there';
 
  const typeMessages = {
    referral:
      'You have been invited to join ProofID, the platform for proof-of-work professionals.',
    collaboration: `${inviterName} wants to connect with you on ProofID for potential collaboration.`,
    testimonial: `${inviterName} would love for you to share your experience working with them.`,
  };
 
  const ctaText = {
    referral: 'Accept Invitation',
    collaboration: 'Connect Now',
    testimonial: 'Write Testimonial',
  };
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #18181b; text-align: center;">
      You're Invited!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${greeting}, ${typeMessages[inviteType]}
    </p>
 
    ${
      message
        ? `
    <div style="background: #f4f4f5; padding: 16px 20px; border-radius: 12px; margin: 0 0 24px 0; border-left: 4px solid #7c3aed;">
      <p style="margin: 0 0 8px 0; font-size: 14px; color: #52525b; font-style: italic;">"${message}"</p>
      <p style="margin: 0; font-size: 13px; color: #71717a; font-weight: 500;">- ${inviterName}</p>
    </div>
    `
        : ''
    }
 
    <!-- Inviter info -->
    <div style="background: #f4f4f5; padding: 16px 20px; border-radius: 12px; margin: 0 0 24px 0; text-align: center;">
      <p class="text-secondary" style="margin: 0 0 8px 0; font-size: 14px; color: #52525b;">
        <strong>Invited by:</strong> ${inviterName}
      </p>
      <a href="${inviterProfileUrl}" style="font-size: 13px; color: #7c3aed; text-decoration: none;">
        View their profile →
      </a>
    </div>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${inviteUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            ${ctaText[inviteType]}
          </a>
        </td>
      </tr>
    </table>
 
    <!-- Link fallback -->
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center; word-break: break-all;">
      Or copy this link: <a href="${inviteUrl}" style="color: #8b5cf6;">${inviteUrl}</a>
    </p>
 
    <!-- Expiry note -->
    <p class="text-muted" style="margin: 16px 0 0 0; font-size: 12px; color: #a1a1aa; text-align: center;">
      This invitation expires in 7 days.
    </p>
  `;
 
  return {
    subject:
      inviteType === 'testimonial'
        ? `${inviterName} is requesting a testimonial from you`
        : `${inviterName} invited you to join ProofID`,
    html: centeredEmailWrapper(content, "You're Invited to ProofID"),
  };
}
 
/**
 * Invite accepted notification - sent to inviter when invite is accepted
 */
export function inviteAcceptedEmail(params: {
  inviterName: string;
  inviteeName: string;
  inviteeProfileUrl: string;
  dashboardUrl: string;
}): { subject: string; html: string } {
  const { inviterName, inviteeName, inviteeProfileUrl, dashboardUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #18181b; text-align: center;">
      Invite Accepted! 🎉
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${inviterName}, great news!
    </p>
 
    <div style="background: #ecfdf5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; text-align: center; border: 1px solid #a7f3d0;">
      <p style="margin: 0 0 8px 0; font-size: 16px; color: #065f46; font-weight: 600;">
        ${inviteeName} has joined ProofID!
      </p>
      <a href="${inviteeProfileUrl}" style="font-size: 14px; color: #7c3aed; text-decoration: none;">
        View their profile →
      </a>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Keep inviting more professionals to grow your network!
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${dashboardUrl}/invites" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Manage Your Invites
          </a>
        </td>
      </tr>
    </table>
  `;
 
  return {
    subject: `${inviteeName} accepted your ProofID invite!`,
    html: centeredEmailWrapper(content, 'Invite Accepted - ProofID'),
  };
}
 
/**
 * Email verification email - for phone-based users adding their email
 */
export function emailVerificationEmail(params: {
  displayName: string;
  email: string;
  verifyUrl: string;
}): { subject: string; html: string } {
  const { displayName, verifyUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #18181b; text-align: center;">
      Verify Your Email
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, please confirm your email address to complete verification.
    </p>
 
    <div style="background: #f4f4f5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; text-align: center;">
      <p class="text-secondary" style="margin: 0; font-size: 14px; color: #52525b;">
        Click the button below to verify your email and get the <strong>"Email Verified"</strong> badge on your profile.
      </p>
    </div>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${verifyUrl}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Verify Email Address
          </a>
        </td>
      </tr>
    </table>
 
    <!-- Link fallback -->
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center; word-break: break-all;">
      Or copy this link: <a href="${verifyUrl}" style="color: #8b5cf6;">${verifyUrl}</a>
    </p>
 
    <!-- Expiry note -->
    <p class="text-muted" style="margin: 16px 0 0 0; font-size: 12px; color: #a1a1aa; text-align: center;">
      This link expires in 24 hours. If you didn't request this, please ignore this email.
    </p>
  `;
 
  return {
    subject: 'Verify Your Email - ProofID',
    html: centeredEmailWrapper(content, 'Verify Your Email - ProofID'),
  };
}
 
/**
 * Account deletion confirmation email
 */
export function accountDeletionEmail(params: { displayName: string; confirmUrl: string }): {
  subject: string;
  html: string;
} {
  const { displayName, confirmUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #dc2626; text-align: center;">
      Account Deletion Request
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName}, we received a request to delete your ProofID account. This action is <strong>permanent and cannot be undone</strong>.
    </p>
 
    <div style="background: #fef2f2; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; border: 1px solid #fecaca;">
      <p style="margin: 0 0 8px 0; font-size: 14px; color: #991b1b; font-weight: 600;">Warning: Deleting your account will permanently remove:</p>
      <ul style="color: #991b1b; margin: 8px 0 0 0; font-size: 14px; line-height: 1.8;">
        <li>Your profile and identity code</li>
        <li>All work samples and packages</li>
        <li>All testimonials and requests</li>
        <li>Your subscription (no refund)</li>
      </ul>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      If you want to proceed, click the button below:
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${confirmUrl}" style="display: inline-block; background-color: #dc2626; color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Confirm Account Deletion
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      This link expires in 1 hour. If you didn't request this, please ignore this email.
    </p>
  `;
 
  return {
    subject: 'Confirm Account Deletion - ProofID',
    html: centeredEmailWrapper(content, 'Account Deletion - ProofID'),
  };
}
 
/**
 * Application approved email - sent when admin approves a regulated vertical application
 */
export function applicationApprovedEmail(params: {
  displayName: string;
  verticalName: string;
  dashboardUrl: string;
}): { subject: string; html: string } {
  const { displayName, verticalName, dashboardUrl } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #18181b; text-align: center;">
      Application Approved!
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Congratulations ${displayName}!
    </p>
 
    <div style="background: #ecfdf5; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; text-align: center; border: 1px solid #a7f3d0;">
      <p style="margin: 0 0 8px 0; font-size: 16px; color: #065f46; font-weight: 600;">
        Your ${verticalName} application has been approved!
      </p>
      <p style="margin: 0; font-size: 14px; color: #047857;">
        You now have full access to all ${verticalName} features.
      </p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      Your profile is now verified and you can start showcasing your credentials, building trust, and connecting with clients.
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="${dashboardUrl}" style="display: inline-block; background: linear-gradient(135deg, #10B981, #059669); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Go to Your Dashboard
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      Welcome to the ProofID ${verticalName} community!
    </p>
  `;
 
  return {
    subject: `Your ${verticalName} Application is Approved - ProofID`,
    html: centeredEmailWrapper(content, 'Application Approved - ProofID'),
  };
}
 
/**
 * Application rejected email - sent when admin rejects a regulated vertical application
 */
export function applicationRejectedEmail(params: {
  displayName: string;
  verticalName: string;
  reason: string;
  supportEmail: string;
}): { subject: string; html: string } {
  const { displayName, verticalName, reason, supportEmail } = params;
 
  const content = `
    <h1 class="text-primary" style="margin: 0 0 8px 0; font-size: 24px; font-weight: 600; color: #18181b; text-align: center;">
      Application Update
    </h1>
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 15px; color: #52525b; text-align: center; line-height: 1.5;">
      Hi ${displayName},
    </p>
 
    <div style="background: #fef2f2; padding: 20px; border-radius: 12px; margin: 0 0 24px 0; border: 1px solid #fecaca;">
      <p style="margin: 0 0 8px 0; font-size: 16px; color: #991b1b; font-weight: 600;">
        Your ${verticalName} application was not approved
      </p>
      <p style="margin: 0; font-size: 14px; color: #b91c1c;">
        We were unable to approve your application at this time.
      </p>
    </div>
 
    <div style="background: #f4f4f5; padding: 16px 20px; border-radius: 12px; margin: 0 0 24px 0; border-left: 4px solid #a1a1aa;">
      <p style="margin: 0 0 8px 0; font-size: 12px; color: #71717a; text-transform: uppercase; font-weight: 600;">Reason</p>
      <p style="margin: 0; font-size: 14px; color: #52525b; line-height: 1.5;">${reason}</p>
    </div>
 
    <p class="text-secondary" style="margin: 0 0 24px 0; font-size: 14px; color: #52525b; text-align: center; line-height: 1.5;">
      If you believe this was a mistake or have additional documentation to provide, please contact our support team.
    </p>
 
    <!-- Button -->
    <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
        <td style="text-align: center;">
          <a href="mailto:${supportEmail}" style="display: inline-block; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 14px 32px; border-radius: 10px;">
            Contact Support
          </a>
        </td>
      </tr>
    </table>
 
    <p class="text-muted" style="margin: 24px 0 0 0; font-size: 12px; color: #71717a; text-align: center;">
      You may reapply after addressing the concerns mentioned above.
    </p>
  `;
 
  return {
    subject: `Update on Your ${verticalName} Application - ProofID`,
    html: centeredEmailWrapper(content, 'Application Update - ProofID'),
  };
}