Client-facing confirmation emails now:
- use the PUBLIC port name ("Port Nimara" via ports.name), never the CRM
appName ("Port Nimara CRM") which is reserved for internal/staff surfaces
- mirror the website's wording verbatim ("Thank you for expressing
interest…", "Best regards,") and drop the CRM-style headings
- sign off per category: berth → "Port Nimara Sales Team", contact →
"Port Nimara Team", residential → "Port Nimara Residences Team"
- show + reply-to a public contact address, admin-configurable per category
(inquiry_contact_email → sales@ for berth/residence,
contact_form_contact_email → hello@ for contact form), never the noreply From
Internal alerts keep the CRM detail-line format + link (name fixed to
"Port Nimara"), EXCEPT the residential alert which drops all CRM mention
(it reaches an external recipient) and signs "- Port Nimara Residences".
sendEmail gains an optional per-message replyTo.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2qc3xZTfif7N4Wq3QDa8X
98 lines
2.7 KiB
TypeScript
98 lines
2.7 KiB
TypeScript
import { Link, Text, render } from '@react-email/components';
|
|
import * as React from 'react';
|
|
|
|
import { brandingPrimaryColor, renderShell, safeUrl, type BrandingShell } from '@/lib/email/shell';
|
|
|
|
export interface InquiryClientConfirmationData {
|
|
firstName: string;
|
|
mooringNumber: string | null;
|
|
contactEmail: string;
|
|
portName?: string;
|
|
}
|
|
|
|
interface RenderOpts {
|
|
branding?: BrandingShell | null;
|
|
subject?: string | null;
|
|
}
|
|
|
|
function ClientConfirmationBody({
|
|
firstName,
|
|
berthText,
|
|
contactEmail,
|
|
portName,
|
|
accent,
|
|
}: {
|
|
firstName: string;
|
|
berthText: string;
|
|
contactEmail: string;
|
|
portName: string;
|
|
accent: string;
|
|
}) {
|
|
return (
|
|
<>
|
|
<Text style={{ marginBottom: '10px', fontSize: '16px' }}>Dear {firstName},</Text>
|
|
<Text style={{ marginBottom: '10px', fontSize: '16px' }}>
|
|
Thank you for expressing interest in {berthText}. Our team has registered your interest, and
|
|
we will reach out to you very shortly by your preferred method of contact with more
|
|
information.
|
|
</Text>
|
|
<Text style={{ marginBottom: '10px', fontSize: '16px' }}>
|
|
If you have any questions, please feel free to reach out to us at{' '}
|
|
<Link
|
|
href={safeUrl(`mailto:${contactEmail}`)}
|
|
style={{ color: accent, textDecoration: 'underline' }}
|
|
>
|
|
{contactEmail}
|
|
</Link>
|
|
.
|
|
</Text>
|
|
<Text style={{ fontSize: '16px' }}>
|
|
Best regards,
|
|
<br />
|
|
The {portName} Sales Team
|
|
</Text>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export async function inquiryClientConfirmation(
|
|
data: InquiryClientConfirmationData,
|
|
overrides?: RenderOpts,
|
|
) {
|
|
const { firstName, mooringNumber, contactEmail } = data;
|
|
const portName = data.portName ?? 'Port Nimara';
|
|
const berthText = mooringNumber ? `Berth ${mooringNumber}` : 'a Berth';
|
|
const subject = overrides?.subject?.trim()
|
|
? overrides.subject
|
|
: `${portName} — Thank You for Your Interest`;
|
|
const accent = brandingPrimaryColor(overrides?.branding);
|
|
|
|
const body = await render(
|
|
<ClientConfirmationBody
|
|
firstName={firstName}
|
|
berthText={berthText}
|
|
contactEmail={contactEmail}
|
|
portName={portName}
|
|
accent={accent}
|
|
/>,
|
|
{ pretty: false },
|
|
);
|
|
|
|
const text = [
|
|
`Dear ${firstName},`,
|
|
'',
|
|
`Thank you for expressing interest in ${berthText}. Our team has registered your interest, and we will reach out to you very shortly by your preferred method of contact with more information.`,
|
|
'',
|
|
`If you have any questions, please feel free to reach out to us at ${contactEmail}.`,
|
|
'',
|
|
'Best regards,',
|
|
`The ${portName} Sales Team`,
|
|
].join('\n');
|
|
|
|
return {
|
|
subject,
|
|
html: renderShell({ title: subject, body, branding: overrides?.branding }),
|
|
text,
|
|
};
|
|
}
|