import type { UserDoc } from './types.js'; /** * Ported from imports/modules/get-email-of-user.js. * Returns the recipient email only if verified. firstName from the profile. * (The old code also consults an OAuth profile; for our channels the verified * primary email is the operative case — OAuth users still carry emails[].) */ export function getEmailOf(user: UserDoc): { emailAddress: string | null; firstName: string } { const firstName = user.profile?.name?.first ?? ''; const primary = user.emails?.[0]; const emailAddress = primary && primary.verified ? primary.address : null; return { emailAddress, firstName }; }