Files

23 lines
1.2 KiB
TypeScript

import type { Draft } from "../admin/actions.ts";
import type { StoredOrgRequest } from "../orgs/request.ts";
import { REPLY_DRAFT, wordsLocale } from "../../i18n/dictionaries/operator.ts";
/**
* A reply to a pilot request, written and waiting.
*
* FROM A TEMPLATE, NOT A MODEL. It costs nothing, it is there the moment the
* request is, and every sentence in it is something the product does today:
* a link the team opens on their own phones, situations chosen for the
* house, a certificate per finished situation. No price and no promise the
* owner has not made; they add those. The field it lands in has the
* microphone and «improve» for anybody who wants it reworded.
*
* In the language the request came in: German for a German page, English
* otherwise. Organisations are addressed formally.
*/
export function replyDraft(request: Pick<StoredOrgRequest, "name" | "organisation" | "people" | "locale" | "email">, from: string): Draft {
const t = REPLY_DRAFT[wordsLocale(request.locale)];
const team = request.people ? t.team(request.people) : "";
return { kind: "mail", to: request.email, subject: t.subject(request.organisation), body: t.lines(request.name, request.organisation, team, from).join("\n") };
}