/** Shared helpers for system-authored letters (CE, bank, bounty, …). */ export const CENTRAL_EXCHANGE_ORG = "Central Exchange"; export const BANK_LETTER_AUTHOR = "The Bank"; export const BOUNTY_OFFICE_AUTHOR = "Bounty Office"; export function isCentralExchangeLetter (instance) { if (instance?.kind !== "letter") { return false; } if (instance.centralExchange === true) { return true; } return instance.authorOrganization === CENTRAL_EXCHANGE_ORG; } export function isBankRestNoticeLetter (instance) { return instance?.kind === "letter" && instance.bankRestNotice === true; } /** * Format the UI "Signed:" block. Optional organization is a second line under the name. * @param {{ authorDisplayName?: string, authorOrganization?: string|null }} instance * @param {string} [fallbackName] */ export function formatLetterSignature (instance, fallbackName = "Unknown") { const name = String(instance?.authorDisplayName ?? "").trim() || fallbackName; const org = String(instance?.authorOrganization ?? "").trim(); return org ? `Signed:\n${name}\n${org}` : `Signed:\n${name}`; }