verdictSource.ts 1.1 KB

123456789101112131415161718192021222324252627
  1. // How a post-print outcome verdict reached an archive (#1898). The backend
  2. // stamps it wherever a verdict is written, so a "good" badge nobody remembers
  3. // clicking can say where it came from — the live case being the plate-clear
  4. // default answering a prompt before the operator reached the phone.
  5. //
  6. // 'reaction' is written when a thumbs-up/down on the Telegram prompt answers
  7. // it (#3046, the backend's telegram_reactions poller).
  8. import type { VerdictSource } from '../api/client';
  9. const SOURCE_KEYS: Record<VerdictSource, string> = {
  10. dialog: 'confirmOutcome.sources.dialog',
  11. link: 'confirmOutcome.sources.link',
  12. plate_clear: 'confirmOutcome.sources.plateClear',
  13. printer_card: 'confirmOutcome.sources.printerCard',
  14. api: 'confirmOutcome.sources.api',
  15. reaction: 'confirmOutcome.sources.reaction',
  16. };
  17. /**
  18. * i18n key for a verdict source, or null when the source is unknown — archives
  19. * answered before this shipped carry no source and must show no hint at all.
  20. */
  21. export function verdictSourceKey(source: string | null | undefined): string | null {
  22. if (!source) return null;
  23. return SOURCE_KEYS[source as VerdictSource] ?? null;
  24. }