@apotech-os/support-kit 3.2.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/index.cjs +283 -100
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +284 -101
- package/dist/ui/index.js.map +1 -1
- package/package.json +11 -11
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GENERATED_RESPONSE_STATUSES, EVALUATION_VERDICTS, WHATSAPP_MODES, validateSettings, AGENT_GUARDRAILS, toCategory, toAgent, toGeneratedResponse, toTriageDecision, isGeneratedResponseStatus, toCategoryGroup, toResponseComparison, toDiffAnalysis, NODE_NAMES, settingsToProfile, hasNoDraftNode, guardrailBucket, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-SFOPXCD4.js';
|
|
2
2
|
import { useState, useMemo, useRef, useEffect, useCallback, useId } from 'react';
|
|
3
|
-
import { useAppContext, useAppSettings, DateRangeCompare, Link, Card,
|
|
3
|
+
import { useAppContext, useAppSettings, DateRangeCompare, Link, Card, CardHeader, CardTitle, CardContent, AreaChart, StackedBarChart, Badge, Button, Select, DataTable, useAppApi, useToast, KpiCard, FunnelChart, Spinner, LineChart, Switch, Input, Checkbox, Textarea, comparisonRange, cn, SidePanel, CopyButton, Modal, Tooltip, buttonVariants, AppInvokeError, relativeDelta, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, downloadBlob } from '@apotech-os/ui-sdk';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
function useRecordList(objectKey, query, mapper) {
|
|
@@ -248,28 +248,109 @@ function dashboardSignals(totals, compare) {
|
|
|
248
248
|
}
|
|
249
249
|
return signals;
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
|
|
251
|
+
function foldHumanReasons(rows) {
|
|
252
|
+
const reasons = { blocked: 0, invalidated: 0, expired: 0 };
|
|
253
|
+
for (const row of rows) {
|
|
254
|
+
if (outcomeOf(row["status"], row["autoSendDecision"]) !== "human") continue;
|
|
255
|
+
const count = Number(row["count"]) || 0;
|
|
256
|
+
if (row["status"] === "invalidated") reasons.invalidated += count;
|
|
257
|
+
else if (row["status"] === "expired") reasons.expired += count;
|
|
258
|
+
else reasons.blocked += count;
|
|
259
|
+
}
|
|
260
|
+
return reasons;
|
|
261
|
+
}
|
|
262
|
+
var CATEGORY_TOP_N = 10;
|
|
263
|
+
function foldCategoryOutcomes(triageRows, responseRows, categoryNames, topN = CATEGORY_TOP_N) {
|
|
264
|
+
const byId = /* @__PURE__ */ new Map();
|
|
265
|
+
const barFor = (id) => {
|
|
255
266
|
const name = typeof id === "string" ? categoryNames.get(id) : void 0;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
267
|
+
if (name === void 0) return null;
|
|
268
|
+
const existing = byId.get(id);
|
|
269
|
+
if (existing !== void 0) return existing;
|
|
270
|
+
const bar = {
|
|
271
|
+
label: name,
|
|
272
|
+
total: 0,
|
|
273
|
+
auto: 0,
|
|
274
|
+
human: 0,
|
|
275
|
+
noReply: 0,
|
|
276
|
+
undrafted: 0
|
|
277
|
+
};
|
|
278
|
+
byId.set(id, bar);
|
|
279
|
+
return bar;
|
|
280
|
+
};
|
|
281
|
+
for (const row of triageRows) {
|
|
282
|
+
const bar = barFor(row["categoryId"]);
|
|
283
|
+
if (bar !== null) bar.total += Number(row["count"]) || 0;
|
|
284
|
+
}
|
|
285
|
+
for (const row of responseRows) {
|
|
286
|
+
const bar = barFor(row["categoryId"]);
|
|
287
|
+
if (bar === null) continue;
|
|
288
|
+
const outcome = outcomeOf(row["status"], row["autoSendDecision"]);
|
|
289
|
+
const count = Number(row["count"]) || 0;
|
|
290
|
+
if (outcome === "auto") bar.auto += count;
|
|
291
|
+
else if (outcome === "human") bar.human += count;
|
|
292
|
+
else if (outcome === "noReplyNeeded") bar.noReply += count;
|
|
293
|
+
}
|
|
294
|
+
const bars = [...byId.values()].map((bar) => {
|
|
295
|
+
const accounted = bar.auto + bar.human + bar.noReply;
|
|
296
|
+
return {
|
|
297
|
+
...bar,
|
|
298
|
+
total: Math.max(bar.total, accounted),
|
|
299
|
+
undrafted: Math.max(0, bar.total - accounted)
|
|
300
|
+
};
|
|
301
|
+
}).filter((bar) => bar.total > 0).sort((a, b) => b.total - a.total);
|
|
302
|
+
if (bars.length <= topN + 1) return bars;
|
|
303
|
+
const tail = bars.slice(topN).reduce(
|
|
304
|
+
(sum, bar) => ({
|
|
305
|
+
label: "Autres",
|
|
306
|
+
total: sum.total + bar.total,
|
|
307
|
+
auto: sum.auto + bar.auto,
|
|
308
|
+
human: sum.human + bar.human,
|
|
309
|
+
noReply: sum.noReply + bar.noReply,
|
|
310
|
+
undrafted: sum.undrafted + bar.undrafted
|
|
311
|
+
}),
|
|
312
|
+
{ label: "Autres", total: 0, auto: 0, human: 0, noReply: 0, undrafted: 0 }
|
|
313
|
+
);
|
|
314
|
+
return [...bars.slice(0, topN), tail];
|
|
261
315
|
}
|
|
262
316
|
var POINTS_FORMAT = new Intl.NumberFormat("fr-FR", {
|
|
263
317
|
maximumFractionDigits: 1,
|
|
264
318
|
signDisplay: "exceptZero"
|
|
265
319
|
});
|
|
320
|
+
var DELTA_FORMAT = new Intl.NumberFormat("fr-FR", {
|
|
321
|
+
style: "percent",
|
|
322
|
+
maximumFractionDigits: 1,
|
|
323
|
+
signDisplay: "exceptZero"
|
|
324
|
+
});
|
|
325
|
+
function HeroSide({ label, value, compareValue, lowerIsBetter = false, formatValue }) {
|
|
326
|
+
const delta = relativeDelta(value, compareValue);
|
|
327
|
+
const improved = delta === null ? null : delta > 0 !== lowerIsBetter;
|
|
328
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
329
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: label }),
|
|
330
|
+
/* @__PURE__ */ jsx("p", { className: "text-xl font-semibold tabular-nums text-foreground", children: formatValue(value) }),
|
|
331
|
+
delta !== null && /* @__PURE__ */ jsxs(
|
|
332
|
+
"p",
|
|
333
|
+
{
|
|
334
|
+
className: `text-xs font-medium tabular-nums ${improved ? "text-status-success" : "text-status-blocked"}`,
|
|
335
|
+
children: [
|
|
336
|
+
DELTA_FORMAT.format(delta),
|
|
337
|
+
compareValue !== void 0 && /* @__PURE__ */ jsxs("span", { className: "ml-1 font-normal text-muted-foreground", children: [
|
|
338
|
+
"vs ",
|
|
339
|
+
formatValue(compareValue)
|
|
340
|
+
] })
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] });
|
|
345
|
+
}
|
|
266
346
|
function formatRate(value) {
|
|
267
347
|
return Number.isNaN(value) ? "\u2014" : `${Math.round(value * 100)} %`;
|
|
268
348
|
}
|
|
269
349
|
function AutonomyHero({
|
|
270
350
|
rate,
|
|
271
351
|
compareRate,
|
|
272
|
-
caption
|
|
352
|
+
caption,
|
|
353
|
+
sides = []
|
|
273
354
|
}) {
|
|
274
355
|
const points = ratePoints(rate, compareRate);
|
|
275
356
|
return /* @__PURE__ */ jsx(Card, { className: "border-primary/25 bg-gradient-to-br from-primary/10 via-card to-card", children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-1 p-4", children: [
|
|
@@ -294,7 +375,8 @@ function AutonomyHero({
|
|
|
294
375
|
]
|
|
295
376
|
}
|
|
296
377
|
),
|
|
297
|
-
/* @__PURE__ */ jsx("p", { className: "pt-1 text-xs text-muted-foreground", children: caption })
|
|
378
|
+
/* @__PURE__ */ jsx("p", { className: "pt-1 text-xs text-muted-foreground", children: caption }),
|
|
379
|
+
sides.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 border-t border-border/60 pt-3 sm:max-w-md", children: sides.map((side) => /* @__PURE__ */ jsx(HeroSide, { ...side }, side.label)) })
|
|
298
380
|
] }) });
|
|
299
381
|
}
|
|
300
382
|
var DASHBOARD_PRESETS = [
|
|
@@ -343,8 +425,68 @@ function defaultPeriod(today = /* @__PURE__ */ new Date()) {
|
|
|
343
425
|
...compareRange === void 0 ? {} : { compareRange }
|
|
344
426
|
};
|
|
345
427
|
}
|
|
428
|
+
function sharePercent(value, total) {
|
|
429
|
+
return total > 0 ? `${Math.round(value / total * 100)} %` : null;
|
|
430
|
+
}
|
|
431
|
+
function StackedRow({
|
|
432
|
+
label,
|
|
433
|
+
segments,
|
|
434
|
+
total,
|
|
435
|
+
scale,
|
|
436
|
+
formatCount: formatCount2
|
|
437
|
+
}) {
|
|
438
|
+
const width = scale > 0 ? total / scale * 100 : 0;
|
|
439
|
+
return (
|
|
440
|
+
// Utilitaires standards seulement : une colonne en valeur arbitraire
|
|
441
|
+
// (`grid-cols-[minmax(6rem,9rem)_1fr_auto]`) n'est pas générée par le
|
|
442
|
+
// Tailwind de l'instance, qui ne scanne pas le dist du kit pour ça — la
|
|
443
|
+
// ligne retombait alors en trois blocs empilés.
|
|
444
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 text-xs", children: [
|
|
445
|
+
/* @__PURE__ */ jsx("span", { className: "w-36 shrink-0 truncate text-muted-foreground", title: label, children: label }),
|
|
446
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 flex-1", children: /* @__PURE__ */ jsx("div", { className: "flex h-full overflow-hidden rounded-sm", style: { width: `${width}%` }, children: segments.filter((segment) => segment.value > 0).map((segment) => /* @__PURE__ */ jsx(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
role: "presentation",
|
|
450
|
+
title: `${segment.label} : ${formatCount2(segment.value)}${sharePercent(segment.value, total) === null ? "" : ` (${sharePercent(segment.value, total)})`}`,
|
|
451
|
+
style: {
|
|
452
|
+
width: `${segment.value / total * 100}%`,
|
|
453
|
+
backgroundColor: segment.color
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
segment.key
|
|
457
|
+
)) }) }),
|
|
458
|
+
/* @__PURE__ */ jsx("span", { className: "w-14 shrink-0 text-right tabular-nums text-muted-foreground", children: formatCount2(total) })
|
|
459
|
+
] })
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function StackedLegend({ segments }) {
|
|
463
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: segments.map((segment) => /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
464
|
+
/* @__PURE__ */ jsx(
|
|
465
|
+
"span",
|
|
466
|
+
{
|
|
467
|
+
"aria-hidden": true,
|
|
468
|
+
className: "inline-block size-2 rounded-[2px]",
|
|
469
|
+
style: { backgroundColor: segment.color }
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
segment.label
|
|
473
|
+
] }, segment.key)) });
|
|
474
|
+
}
|
|
346
475
|
var OUTCOME_METRICS = [{ op: "count", as: "count" }];
|
|
347
476
|
var OUTCOME_GROUP_BY = ["status", "autoSendDecision"];
|
|
477
|
+
var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision"];
|
|
478
|
+
var CATEGORY_COLORS = {
|
|
479
|
+
auto: "var(--chart-1)",
|
|
480
|
+
human: "var(--chart-2)",
|
|
481
|
+
noReply: "var(--chart-4)",
|
|
482
|
+
undrafted: "var(--muted)"
|
|
483
|
+
};
|
|
484
|
+
var CATEGORY_LEGEND = [
|
|
485
|
+
{ key: "auto", label: "R\xE9ponse automatis\xE9e par l\u2019agent", color: CATEGORY_COLORS.auto },
|
|
486
|
+
{ key: "human", label: "Repris par un humain", color: CATEGORY_COLORS.human },
|
|
487
|
+
{ key: "noReply", label: "Sans r\xE9ponse n\xE9cessaire", color: CATEGORY_COLORS.noReply },
|
|
488
|
+
{ key: "undrafted", label: "Sans brouillon", color: CATEGORY_COLORS.undrafted }
|
|
489
|
+
];
|
|
348
490
|
function formatCount(value) {
|
|
349
491
|
return Number.isNaN(value) ? "\u2026" : value.toLocaleString("fr-FR");
|
|
350
492
|
}
|
|
@@ -385,6 +527,11 @@ function DashboardPage() {
|
|
|
385
527
|
groupBy: ["categoryId"],
|
|
386
528
|
metrics: OUTCOME_METRICS
|
|
387
529
|
});
|
|
530
|
+
const { rows: categoryOutcomes } = useAggregate("generated-response", {
|
|
531
|
+
filter: currentFilter,
|
|
532
|
+
groupBy: CATEGORY_OUTCOME_GROUP_BY,
|
|
533
|
+
metrics: OUTCOME_METRICS
|
|
534
|
+
});
|
|
388
535
|
const { rows: categories } = useRecordList("category", { limit: 500 }, toCategory);
|
|
389
536
|
const categoryNames = useMemo(() => toNameMap(categories), [categories]);
|
|
390
537
|
const totals = useMemo(() => foldOutcomes(dailyRows), [dailyRows]);
|
|
@@ -400,20 +547,15 @@ function DashboardPage() {
|
|
|
400
547
|
const compareRate = compareTotals === null ? Number.NaN : autonomyRate(compareTotals);
|
|
401
548
|
const settled = settledCount(totals);
|
|
402
549
|
const signals = useMemo(() => dashboardSignals(totals, compareTotals), [totals, compareTotals]);
|
|
403
|
-
const
|
|
550
|
+
const reasons = useMemo(() => foldHumanReasons(dailyRows), [dailyRows]);
|
|
551
|
+
const categoryBars = useMemo(
|
|
552
|
+
() => foldCategoryOutcomes(categoryCounts, categoryOutcomes, categoryNames),
|
|
553
|
+
[categoryCounts, categoryOutcomes, categoryNames]
|
|
554
|
+
);
|
|
555
|
+
const categoryScale = categoryBars.reduce((max, bar) => Math.max(max, bar.total), 0);
|
|
404
556
|
const loading = dailyLoading || previousLoading;
|
|
405
557
|
const chartData = daily.map((point) => ({ ...point, jour: dayLabel(point.day) }));
|
|
406
558
|
const bucketWord = bounds.interval === "day" ? "jour" : "semaine";
|
|
407
|
-
const aCreuser = signals.find((signal) => signal.level === "creuser");
|
|
408
|
-
const lead = loading ? null : settled === 0 ? {
|
|
409
|
-
alert: false,
|
|
410
|
-
title: "Aucune demande r\xE9gl\xE9e sur cette p\xE9riode",
|
|
411
|
-
detail: "Choisis une autre p\xE9riode, ou v\xE9rifie que le triage tourne (Param\xE8tres \u203A Triage)."
|
|
412
|
-
} : aCreuser !== void 0 ? { alert: true, title: "Un point m\xE9rite ton attention", detail: aCreuser.text } : {
|
|
413
|
-
alert: false,
|
|
414
|
-
title: `${formatRate(rate)} des demandes r\xE9gl\xE9es sans personne`,
|
|
415
|
-
detail: `${formatCount(totals.auto)} r\xE9ponses envoy\xE9es par l\u2019IA, ${formatCount(totals.human)} reprises par un humain, sur ${formatCount(settled)} demandes r\xE9gl\xE9es.`
|
|
416
|
-
};
|
|
417
559
|
return /* @__PURE__ */ jsxs(PageShell, { children: [
|
|
418
560
|
/* @__PURE__ */ jsx(
|
|
419
561
|
PageHeader,
|
|
@@ -435,80 +577,35 @@ function DashboardPage() {
|
|
|
435
577
|
] })
|
|
436
578
|
}
|
|
437
579
|
),
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
441
|
-
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold leading-snug", children: lead.title }),
|
|
442
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm leading-relaxed text-muted-foreground", children: lead.detail })
|
|
443
|
-
] })
|
|
444
|
-
] }) }),
|
|
445
|
-
/* @__PURE__ */ jsxs(
|
|
446
|
-
"div",
|
|
580
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "dashboard-kpis", children: /* @__PURE__ */ jsx(
|
|
581
|
+
AutonomyHero,
|
|
447
582
|
{
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
formatValue: formatCount
|
|
466
|
-
}
|
|
467
|
-
),
|
|
468
|
-
/* @__PURE__ */ jsx(
|
|
469
|
-
KpiCard,
|
|
470
|
-
{
|
|
471
|
-
label: "Repris par un humain",
|
|
472
|
-
value: loading ? Number.NaN : totals.human,
|
|
473
|
-
...compareTotals === null ? {} : { compareValue: compareTotals.human },
|
|
474
|
-
formatValue: formatCount,
|
|
475
|
-
lowerIsBetter: true
|
|
476
|
-
}
|
|
477
|
-
)
|
|
583
|
+
rate: loading ? Number.NaN : rate,
|
|
584
|
+
compareRate,
|
|
585
|
+
caption: loading ? "Calcul en cours\u2026" : `${formatCount(settled)} demandes r\xE9gl\xE9es sur la p\xE9riode.`,
|
|
586
|
+
sides: loading ? [] : [
|
|
587
|
+
{
|
|
588
|
+
label: "R\xE9ponse automatis\xE9e par l\u2019agent",
|
|
589
|
+
value: totals.auto,
|
|
590
|
+
formatValue: formatCount,
|
|
591
|
+
...compareTotals === null ? {} : { compareValue: compareTotals.auto }
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
label: "Repris par un humain",
|
|
595
|
+
value: totals.human,
|
|
596
|
+
formatValue: formatCount,
|
|
597
|
+
lowerIsBetter: true,
|
|
598
|
+
...compareTotals === null ? {} : { compareValue: compareTotals.human }
|
|
599
|
+
}
|
|
478
600
|
]
|
|
479
601
|
}
|
|
480
|
-
),
|
|
481
|
-
/* @__PURE__ */ jsxs("
|
|
482
|
-
/* @__PURE__ */ jsx(
|
|
483
|
-
|
|
484
|
-
{
|
|
485
|
-
label: "Encore en cours",
|
|
486
|
-
value: loading ? Number.NaN : totals.inProgress,
|
|
487
|
-
formatValue: formatCount
|
|
488
|
-
}
|
|
489
|
-
),
|
|
490
|
-
/* @__PURE__ */ jsx(
|
|
491
|
-
KpiCard,
|
|
492
|
-
{
|
|
493
|
-
label: "Sans r\xE9ponse n\xE9cessaire",
|
|
494
|
-
value: loading ? Number.NaN : totals.noReplyNeeded,
|
|
495
|
-
formatValue: formatCount
|
|
496
|
-
}
|
|
497
|
-
),
|
|
498
|
-
/* @__PURE__ */ jsx(
|
|
499
|
-
KpiCard,
|
|
500
|
-
{
|
|
501
|
-
label: "\xC9checs techniques",
|
|
502
|
-
value: loading ? Number.NaN : totals.failed,
|
|
503
|
-
...compareTotals === null ? {} : { compareValue: compareTotals.failed },
|
|
504
|
-
formatValue: formatCount,
|
|
505
|
-
lowerIsBetter: true
|
|
506
|
-
}
|
|
507
|
-
)
|
|
602
|
+
) }),
|
|
603
|
+
/* @__PURE__ */ jsxs("details", { className: "text-xs leading-relaxed text-muted-foreground", children: [
|
|
604
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer select-none font-medium", children: "Comment le taux d\u2019autonomie est calcul\xE9" }),
|
|
605
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2", children: "Le taux d\u2019autonomie rapporte les r\xE9ponses envoy\xE9es par l\u2019IA \xE0 ces m\xEAmes r\xE9ponses plus celles qu\u2019un humain a reprises \u2014 bloqu\xE9es, escalad\xE9es, invalid\xE9es parce qu\u2019un agent avait d\xE9j\xE0 r\xE9pondu, ou expir\xE9es. \xB7 Une escalade est compt\xE9e UNE fois, du c\xF4t\xE9 humain : c\u2019est un motif de blocage, pas un camp de plus. \xB7 Les demandes encore en cours, celles sans r\xE9ponse n\xE9cessaire et les \xE9checs techniques sont hors du taux \u2014 les compter d\u2019un c\xF4t\xE9 ou de l\u2019autre le fausserait dans les deux sens. \xB7 Le d\xE9nominateur ne couvre que les demandes mises en file : un ticket escalad\xE9 avant toute g\xE9n\xE9ration n\u2019y figure pas." })
|
|
508
606
|
] }),
|
|
509
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "Le taux d\u2019autonomie rapporte les r\xE9ponses envoy\xE9es par l\u2019IA \xE0 ces m\xEAmes r\xE9ponses plus celles qu\u2019un humain a reprises \u2014 bloqu\xE9es, escalad\xE9es, invalid\xE9es parce qu\u2019un agent avait d\xE9j\xE0 r\xE9pondu, ou expir\xE9es. \xB7 Une escalade est compt\xE9e UNE fois, du c\xF4t\xE9 humain : c\u2019est un motif de blocage, pas un camp de plus. \xB7 Les demandes encore en cours, celles sans r\xE9ponse n\xE9cessaire et les \xE9checs techniques sont hors du taux \u2014 les compter d\u2019un c\xF4t\xE9 ou de l\u2019autre le fausserait dans les deux sens. \xB7 Le d\xE9nominateur ne couvre que les demandes mises en file : un ticket escalad\xE9 avant toute g\xE9n\xE9ration n\u2019y figure pas." }),
|
|
510
607
|
dailyError !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Erreur lors du calcul des chiffres cl\xE9s." }),
|
|
511
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4
|
|
608
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
512
609
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
513
610
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { className: "text-sm", children: [
|
|
514
611
|
"Automatique ou humain, ",
|
|
@@ -569,19 +666,105 @@ function DashboardPage() {
|
|
|
569
666
|
] }),
|
|
570
667
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
571
668
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-sm", children: "R\xE9partition par cat\xE9gorie" }) }),
|
|
572
|
-
/* @__PURE__ */ jsx(CardContent, { children: categoryLoading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Chargement\u2026" }) : categoryError !== void 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Impossible de calculer la r\xE9partition par cat\xE9gorie." }) : categoryBars.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Aucun volume calcul\xE9 pour l'instant sur cette p\xE9riode." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
573
|
-
/* @__PURE__ */ jsx(
|
|
574
|
-
|
|
669
|
+
/* @__PURE__ */ jsx(CardContent, { className: "space-y-3", children: categoryLoading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Chargement\u2026" }) : categoryError !== void 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Impossible de calculer la r\xE9partition par cat\xE9gorie." }) : categoryBars.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Aucun volume calcul\xE9 pour l'instant sur cette p\xE9riode." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
670
|
+
/* @__PURE__ */ jsx(StackedLegend, { segments: CATEGORY_LEGEND }),
|
|
671
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: categoryBars.map((bar) => /* @__PURE__ */ jsx(
|
|
672
|
+
StackedRow,
|
|
575
673
|
{
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
674
|
+
label: bar.label,
|
|
675
|
+
total: bar.total,
|
|
676
|
+
scale: categoryScale,
|
|
677
|
+
formatCount,
|
|
678
|
+
segments: [
|
|
679
|
+
{
|
|
680
|
+
key: "auto",
|
|
681
|
+
label: "R\xE9ponse automatis\xE9e par l\u2019agent",
|
|
682
|
+
value: bar.auto,
|
|
683
|
+
color: CATEGORY_COLORS.auto
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
key: "human",
|
|
687
|
+
label: "Repris par un humain",
|
|
688
|
+
value: bar.human,
|
|
689
|
+
color: CATEGORY_COLORS.human
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
key: "noReply",
|
|
693
|
+
label: "Sans r\xE9ponse n\xE9cessaire",
|
|
694
|
+
value: bar.noReply,
|
|
695
|
+
color: CATEGORY_COLORS.noReply
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
key: "undrafted",
|
|
699
|
+
label: "Sans brouillon",
|
|
700
|
+
value: bar.undrafted,
|
|
701
|
+
color: CATEGORY_COLORS.undrafted
|
|
702
|
+
}
|
|
703
|
+
]
|
|
704
|
+
},
|
|
705
|
+
bar.label
|
|
706
|
+
)) }),
|
|
707
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "Ce qui arrive, par cat\xE9gorie \u2014 et qui l\u2019a trait\xE9. La longueur d\u2019une barre est le volume tri\xE9 sur la p\xE9riode ; les couleurs sont ce que ce volume est devenu. \xAB\xA0Sans brouillon\xA0\xBB couvre ce que le triage a vu sans qu\u2019une r\xE9ponse soit g\xE9n\xE9r\xE9e : escalade imm\xE9diate, conversation d\xE9j\xE0 close, ou traitement encore en cours." })
|
|
582
708
|
] }) })
|
|
583
709
|
] })
|
|
584
710
|
] }),
|
|
711
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
712
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-sm", children: "Pourquoi un humain a repris" }) }),
|
|
713
|
+
/* @__PURE__ */ jsx(CardContent, { className: "space-y-3", children: loading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Chargement\u2026" }) : totals.human === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Aucune reprise humaine sur cette p\xE9riode." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
714
|
+
/* @__PURE__ */ jsx(
|
|
715
|
+
StackedRow,
|
|
716
|
+
{
|
|
717
|
+
label: "Motifs",
|
|
718
|
+
total: totals.human,
|
|
719
|
+
scale: totals.human,
|
|
720
|
+
formatCount,
|
|
721
|
+
segments: [
|
|
722
|
+
{
|
|
723
|
+
key: "blocked",
|
|
724
|
+
label: "Bloqu\xE9 avant envoi",
|
|
725
|
+
value: reasons.blocked,
|
|
726
|
+
color: "var(--chart-2)"
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
key: "invalidated",
|
|
730
|
+
label: "Un agent avait d\xE9j\xE0 r\xE9pondu",
|
|
731
|
+
value: reasons.invalidated,
|
|
732
|
+
color: "var(--chart-3)"
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
key: "expired",
|
|
736
|
+
label: "Brouillon expir\xE9",
|
|
737
|
+
value: reasons.expired,
|
|
738
|
+
color: "var(--chart-5)"
|
|
739
|
+
}
|
|
740
|
+
]
|
|
741
|
+
}
|
|
742
|
+
),
|
|
743
|
+
/* @__PURE__ */ jsx(
|
|
744
|
+
StackedLegend,
|
|
745
|
+
{
|
|
746
|
+
segments: [
|
|
747
|
+
{
|
|
748
|
+
key: "blocked",
|
|
749
|
+
label: `Bloqu\xE9 avant envoi (${formatCount(reasons.blocked)})`,
|
|
750
|
+
color: "var(--chart-2)"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
key: "invalidated",
|
|
754
|
+
label: `Un agent avait d\xE9j\xE0 r\xE9pondu (${formatCount(reasons.invalidated)})`,
|
|
755
|
+
color: "var(--chart-3)"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
key: "expired",
|
|
759
|
+
label: `Brouillon expir\xE9 (${formatCount(reasons.expired)})`,
|
|
760
|
+
color: "var(--chart-5)"
|
|
761
|
+
}
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-relaxed text-muted-foreground", children: "Les escalades sont dans \xAB\xA0bloqu\xE9\xA0\xBB : un ticket escalad\xE9 voit son brouillon retenu par le garde-fou, c\u2019est un motif de blocage et non un camp de plus. Le d\xE9tail ticket par ticket est sur la page Escalades." })
|
|
766
|
+
] }) })
|
|
767
|
+
] }),
|
|
585
768
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
586
769
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-sm", children: "Signaux \xE0 surveiller" }) }),
|
|
587
770
|
/* @__PURE__ */ jsx(CardContent, { children: signals.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Rien de notable sur cette p\xE9riode \u2014 ou pas assez de demandes r\xE9gl\xE9es pour qu\u2019une comparaison veuille dire quelque chose." }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: signals.map((signal) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|