feat(workflows): admin review gates before sends + migrate lifecycle/time triggers

Booking built-ins now gate every outbound document on an explicit admin OK:
prepare_* drafts the doc, the admin adjusts line items/terms, confirms the
"Review … before sending" gate, and only then does send_document fire. Added to
booking_full (contract + invoice) and booking_simple (invoice); seed versions
bumped so the disabled built-ins self-heal.

Migrated the remaining time- and event-driven triggers into the engine, all
additive / best-effort / fail-closed (no behaviour change when the flag is off):
- gallery.published (event creation)
- gallery.expiring + gallery.expired (expiration checker, alongside the email)
- quote.sent (was queued but never emitted — gap closed)
- contract.sent + contract.signed (sent, fully-signed via counter-sign or wet upload)
- customer.created (direct add + invitation accept)
- invoice.overdue (status→overdue flip, deduped per invoice)

Editor trigger list extended to match. Tests assert the review gates wire
confirm→send on both booking flows.
This commit is contained in:
Luca
2026-06-23 14:58:48 +02:00
parent b38c216f22
commit fa7b1bae95
9 changed files with 221 additions and 38 deletions
@@ -26,8 +26,12 @@ import { NodeConfigPanel } from './NodeConfigPanel';
const PALETTE: WorkflowNodeType[] = ['trigger', 'condition', 'branch', 'loop', 'wait', 'action', 'gate', 'webhook'];
const TRIGGERS = [
'invoice.sent', 'invoice.paid', 'invoice.overdue', 'quote.accepted', 'quote.declined',
'contract.signed', 'event.date_approaching', 'gallery.published', 'gallery.expiring', 'customer.created',
'invoice.sent', 'invoice.paid', 'invoice.overdue',
'quote.sent', 'quote.accepted', 'quote.declined',
'contract.sent', 'contract.signed',
'event.date_approaching',
'gallery.published', 'gallery.expiring', 'gallery.expired',
'customer.created',
];
const COLORS: Record<string, string> = {