@apotech-os/support-kit 3.3.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 +73 -70
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +74 -71
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
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,
|
|
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) {
|
|
@@ -317,13 +317,40 @@ var POINTS_FORMAT = new Intl.NumberFormat("fr-FR", {
|
|
|
317
317
|
maximumFractionDigits: 1,
|
|
318
318
|
signDisplay: "exceptZero"
|
|
319
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
|
+
}
|
|
320
346
|
function formatRate(value) {
|
|
321
347
|
return Number.isNaN(value) ? "\u2014" : `${Math.round(value * 100)} %`;
|
|
322
348
|
}
|
|
323
349
|
function AutonomyHero({
|
|
324
350
|
rate,
|
|
325
351
|
compareRate,
|
|
326
|
-
caption
|
|
352
|
+
caption,
|
|
353
|
+
sides = []
|
|
327
354
|
}) {
|
|
328
355
|
const points = ratePoints(rate, compareRate);
|
|
329
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: [
|
|
@@ -348,7 +375,8 @@ function AutonomyHero({
|
|
|
348
375
|
]
|
|
349
376
|
}
|
|
350
377
|
),
|
|
351
|
-
/* @__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)) })
|
|
352
380
|
] }) });
|
|
353
381
|
}
|
|
354
382
|
var DASHBOARD_PRESETS = [
|
|
@@ -408,22 +436,28 @@ function StackedRow({
|
|
|
408
436
|
formatCount: formatCount2
|
|
409
437
|
}) {
|
|
410
438
|
const width = scale > 0 ? total / scale * 100 : 0;
|
|
411
|
-
return
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
+
);
|
|
427
461
|
}
|
|
428
462
|
function StackedLegend({ segments }) {
|
|
429
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: [
|
|
@@ -543,66 +577,35 @@ function DashboardPage() {
|
|
|
543
577
|
] })
|
|
544
578
|
}
|
|
545
579
|
),
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
|
|
580
|
+
/* @__PURE__ */ jsx("div", { "data-testid": "dashboard-kpis", children: /* @__PURE__ */ jsx(
|
|
581
|
+
AutonomyHero,
|
|
548
582
|
{
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
formatValue: formatCount
|
|
567
|
-
}
|
|
568
|
-
),
|
|
569
|
-
/* @__PURE__ */ jsx(
|
|
570
|
-
KpiCard,
|
|
571
|
-
{
|
|
572
|
-
label: "Repris par un humain",
|
|
573
|
-
value: loading ? Number.NaN : totals.human,
|
|
574
|
-
...compareTotals === null ? {} : { compareValue: compareTotals.human },
|
|
575
|
-
formatValue: formatCount,
|
|
576
|
-
lowerIsBetter: true
|
|
577
|
-
}
|
|
578
|
-
)
|
|
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
|
+
}
|
|
579
600
|
]
|
|
580
601
|
}
|
|
581
|
-
),
|
|
582
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
583
|
-
/* @__PURE__ */ jsx(
|
|
584
|
-
KpiCard,
|
|
585
|
-
{
|
|
586
|
-
label: "Encore en cours",
|
|
587
|
-
value: loading ? Number.NaN : totals.inProgress,
|
|
588
|
-
formatValue: formatCount
|
|
589
|
-
}
|
|
590
|
-
),
|
|
591
|
-
/* @__PURE__ */ jsx(
|
|
592
|
-
KpiCard,
|
|
593
|
-
{
|
|
594
|
-
label: "Sans r\xE9ponse n\xE9cessaire",
|
|
595
|
-
value: loading ? Number.NaN : totals.noReplyNeeded,
|
|
596
|
-
formatValue: formatCount
|
|
597
|
-
}
|
|
598
|
-
)
|
|
599
|
-
] }),
|
|
602
|
+
) }),
|
|
600
603
|
/* @__PURE__ */ jsxs("details", { className: "text-xs leading-relaxed text-muted-foreground", children: [
|
|
601
604
|
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer select-none font-medium", children: "Comment le taux d\u2019autonomie est calcul\xE9" }),
|
|
602
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." })
|
|
603
606
|
] }),
|
|
604
607
|
dailyError !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: "Erreur lors du calcul des chiffres cl\xE9s." }),
|
|
605
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4
|
|
608
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
606
609
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
607
610
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(CardTitle, { className: "text-sm", children: [
|
|
608
611
|
"Automatique ou humain, ",
|