( pageContext: ChatAgentContext['pageContext'], )
| 220 | * numbers that contradict the dashboard. |
| 221 | */ |
| 222 | export function pageContextFilters( |
| 223 | pageContext: ChatAgentContext['pageContext'], |
| 224 | ): IChartEventFilter[] { |
| 225 | const raw = pageContext?.filters?.eventFilters; |
| 226 | if (!Array.isArray(raw)) return []; |
| 227 | return raw.filter( |
| 228 | (f): f is IChartEventFilter => |
| 229 | typeof (f as { name?: unknown })?.name === 'string', |
| 230 | ); |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Compute the immediately-preceding period given a (start, end) range. |