feat(escalations): mount time-to-first-action stat-card on /escalations
Surfaces the new GET /analytics/flowpilot/escalations endpoint as a card
above the EscalationQueue list. Closes the loop from yesterday's metric
endpoint commit — seniors and owners see the wedge stat the moment they
open the queue, which is the daily-reps version of the GTM ROI story.
Pieces:
- EscalationMetrics TS interface mirroring the backend Pydantic model
(incl. metric_definition disclaimer field)
- flowpilotAnalyticsApi.getEscalationMetrics(period) client method
- EscalationMetricCard component:
* loading skeleton, error state, zero-data empty state
* avg + median + n_with_action/n_claimed conversion rate
* humanized seconds → "Ns" / "N.N min" formatting
* inline disclaimer reminding callers this is in-product time-to-
first-action only, NOT the savings claim — pair with manual
baseline (per /codex review's two-metric correction)
- Wired into EscalationQueuePage above EscalationQueue
DS-aligned: card-flat, accent-dim usage held to interactive elements,
text-muted-foreground for secondary copy, font-heading on the headline
number, explicit transition properties (no `transition: all`). Respects
prefers-reduced-motion implicitly (only animation is the loading pulse,
which Tailwind's animate-pulse already gates).
tsc -b clean. No new tests in this commit — component is a thin
state-machine over an axios call; integration coverage comes from the
existing backend tests + the e2e Playwright work in the plan.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -134,3 +134,16 @@ export interface EnhancedPsaMetrics {
|
||||
push_funnel: PsaFunnel
|
||||
daily_trend: PsaDailyTrend[]
|
||||
}
|
||||
|
||||
// Escalation Mode wedge metric — in-product time-to-first-action.
|
||||
// Pair with a manual baseline measurement for the savings claim.
|
||||
// See docs/plans/2026-04-27-escalation-mode-wedge-design.md.
|
||||
export interface EscalationMetrics {
|
||||
period: string
|
||||
n_handoffs_claimed: number
|
||||
n_handoffs_with_action: number
|
||||
avg_seconds_to_first_action: number | null
|
||||
median_seconds_to_first_action: number | null
|
||||
p95_seconds_to_first_action: number | null
|
||||
metric_definition: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user