@apotech-os/support-kit 10.3.0 → 10.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 +90 -27
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +91 -28
- package/dist/ui/index.js.map +1 -1
- package/package.json +5 -5
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EVALUATION_VERDICTS, WHATSAPP_MODES, foldOutcomes, foldDailyOutcomes, fillMissingDays, autonomyRate, settledCount, countFailed, dashboardSignals, foldHumanReasons, foldCategoryOutcomes, toDeliveryPolicy, validateSettings, settingsWarnings, SUPPORT_CHANNELS, AGENT_GUARDRAILS, periodBoundsOf, toCategory, OUTCOME_METRICS, OUTCOME_GROUP_BY, TRIAGE_HANDOFF_GROUP_BY, CATEGORY_TRIAGE_GROUP_BY, CATEGORY_OUTCOME_GROUP_BY, ratePoints, REPLY_TIMING_METRICS, REPLY_TIMING_GROUP_BY, foldReplyTimings, DELAY_BUCKETS, toGeneratedResponse, toTriageDecision, toAgent, toResponseComparison, isGeneratedResponseStatus, isInvalidatableStatus, toCategoryGroup, followupIntegrationName, FOLLOWUP_WEBHOOK_TRIGGER, followupWebhookPath, FOLLOWUP_WEBHOOK_FORM, readConversationEnd, DEFAULT_CONVERSATION_END_TAG, NODE_NAMES, settingsToProfile, hasNoDraftNode, buildTimelineSteps, conversationEndEffects, outcomeTags, DEFAULT_LLM_PROVIDER, computeWordDiff, isSendableVerdict, COLLISION_GUARDRAILS, DEFAULT_MAX_TOOL_CALLS, DEFAULT_MIN_CONFIDENCE, DEFAULT_ESCALATION_ENABLED } from '../chunk-ZKFQ3DIY.js';
|
|
2
2
|
import { forwardRef, useState, useMemo, useRef, useCallback, useEffect, useId } from 'react';
|
|
3
|
-
import { Textarea, cn,
|
|
3
|
+
import { Textarea, cn, useAppPageHref, useAppSettings, DateRangeCompare, Link, Card, CardHeader, CardTitle, CardContent, AreaChart, StackedBarChart, Badge, useAppContext, useAppApi, useToast, Button, Select, DataTable, Spinner, Switch, Checkbox, Input, comparisonRange, SidePanel, Modal, Tooltip, buttonVariants, useAppRun, AppInvokeError, CopyButton, 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) {
|
|
@@ -364,7 +364,7 @@ function dayLabel(day) {
|
|
|
364
364
|
return Number.isNaN(parsed.getTime()) ? day : parsed.toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit", timeZone: "UTC" });
|
|
365
365
|
}
|
|
366
366
|
function DashboardPage() {
|
|
367
|
-
const
|
|
367
|
+
const pageHref = useAppPageHref();
|
|
368
368
|
const [period, setPeriod] = useState(() => defaultPeriod());
|
|
369
369
|
const { settings } = useAppSettings();
|
|
370
370
|
const timezone = settings?.statsTimezone ?? "UTC";
|
|
@@ -466,7 +466,7 @@ function DashboardPage() {
|
|
|
466
466
|
align: "end"
|
|
467
467
|
}
|
|
468
468
|
),
|
|
469
|
-
/* @__PURE__ */ jsx(Link, { href:
|
|
469
|
+
/* @__PURE__ */ jsx(Link, { href: pageHref("tickets"), children: "Voir tous les tickets" })
|
|
470
470
|
] })
|
|
471
471
|
}
|
|
472
472
|
),
|
|
@@ -2286,13 +2286,13 @@ function applyPreset(value, preset, restore) {
|
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
2288
|
// src/ui/shared/quality-href.ts
|
|
2289
|
-
function qualityHref(
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2289
|
+
function qualityHref(pageHref, agent) {
|
|
2290
|
+
if (!agent) return pageHref("quality");
|
|
2291
|
+
return pageHref("quality", {
|
|
2292
|
+
promptName: agent.promptName,
|
|
2293
|
+
promptVersion: agent.promptVersion,
|
|
2294
|
+
agentId: agent.id
|
|
2295
|
+
});
|
|
2296
2296
|
}
|
|
2297
2297
|
function usePromptCatalogue() {
|
|
2298
2298
|
const { appSlug } = useAppContext();
|
|
@@ -2874,7 +2874,7 @@ function AgentFormPanel({
|
|
|
2874
2874
|
);
|
|
2875
2875
|
}
|
|
2876
2876
|
function PromptVersionsSection({ agent, canWrite }) {
|
|
2877
|
-
const
|
|
2877
|
+
const pageHref = useAppPageHref();
|
|
2878
2878
|
const { versions, error, refresh, promote, deleteVersion, createVersion } = usePromptVersions(
|
|
2879
2879
|
agent.promptName
|
|
2880
2880
|
);
|
|
@@ -2963,7 +2963,7 @@ function PromptVersionsSection({ agent, canWrite }) {
|
|
|
2963
2963
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2964
2964
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
2965
2965
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2966
|
-
/* @__PURE__ */ jsx(Link, { href: qualityHref(
|
|
2966
|
+
/* @__PURE__ */ jsx(Link, { href: qualityHref(pageHref, agent), children: "Voir dans Qualit\xE9" }),
|
|
2967
2967
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
2968
2968
|
versions.length >= 2 && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: openCompare, children: "Comparer" }),
|
|
2969
2969
|
canWrite && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => void suggest(), disabled: isSuggesting, children: isSuggesting ? "Suggestion en cours\u2026" : "Sugg\xE9rer une am\xE9lioration" })
|
|
@@ -4322,7 +4322,10 @@ var WHATSAPP_MODE_LABELS = {
|
|
|
4322
4322
|
draft_only: "Brouillon uniquement",
|
|
4323
4323
|
auto_reply: "R\xE9ponse automatique"
|
|
4324
4324
|
};
|
|
4325
|
-
var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({
|
|
4325
|
+
var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({
|
|
4326
|
+
value,
|
|
4327
|
+
label: WHATSAPP_MODE_LABELS[value]
|
|
4328
|
+
}));
|
|
4326
4329
|
function field(value) {
|
|
4327
4330
|
return typeof value === "string" ? value : "";
|
|
4328
4331
|
}
|
|
@@ -4341,7 +4344,10 @@ function parseList(value) {
|
|
|
4341
4344
|
function describeConnection(connections) {
|
|
4342
4345
|
if (connections === void 0) return { text: "Chargement\u2026", tone: "muted" };
|
|
4343
4346
|
if (connections === null) {
|
|
4344
|
-
return {
|
|
4347
|
+
return {
|
|
4348
|
+
text: "Ind\xE9termin\xE9e \u2014 les connexions de l\u2019instance n\u2019ont pas pu \xEAtre lues.",
|
|
4349
|
+
tone: "muted"
|
|
4350
|
+
};
|
|
4345
4351
|
}
|
|
4346
4352
|
if (connections.length === 0) {
|
|
4347
4353
|
return {
|
|
@@ -4358,13 +4364,17 @@ function describeConnection(connections) {
|
|
|
4358
4364
|
tone: "error"
|
|
4359
4365
|
};
|
|
4360
4366
|
}
|
|
4361
|
-
return {
|
|
4367
|
+
return {
|
|
4368
|
+
text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`,
|
|
4369
|
+
tone: "normal"
|
|
4370
|
+
};
|
|
4362
4371
|
}
|
|
4363
4372
|
function SettingsWarnings({ warnings }) {
|
|
4364
4373
|
return /* @__PURE__ */ jsx(Fragment, { children: warnings.map((warning) => /* @__PURE__ */ jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key)) });
|
|
4365
4374
|
}
|
|
4366
4375
|
function SettingsPage() {
|
|
4367
4376
|
const { appSlug, role } = useAppContext();
|
|
4377
|
+
const pageHref = useAppPageHref();
|
|
4368
4378
|
const canWrite = canWriteForRole(role);
|
|
4369
4379
|
const api = useAppApi();
|
|
4370
4380
|
const toast = useToast();
|
|
@@ -4387,7 +4397,12 @@ function SettingsPage() {
|
|
|
4387
4397
|
useEffect(() => {
|
|
4388
4398
|
if (wasSavingRef.current && !isSaving) {
|
|
4389
4399
|
if (saveError === void 0) toast({ title: "R\xE9glages enregistr\xE9s.", variant: "success" });
|
|
4390
|
-
else
|
|
4400
|
+
else
|
|
4401
|
+
toast({
|
|
4402
|
+
title: "\xC9chec de l'enregistrement",
|
|
4403
|
+
description: describeApiError(saveError),
|
|
4404
|
+
variant: "error"
|
|
4405
|
+
});
|
|
4391
4406
|
}
|
|
4392
4407
|
wasSavingRef.current = isSaving;
|
|
4393
4408
|
}, [isSaving, saveError, toast]);
|
|
@@ -4398,7 +4413,9 @@ function SettingsPage() {
|
|
|
4398
4413
|
(async () => {
|
|
4399
4414
|
let checkAppSlugs = [];
|
|
4400
4415
|
try {
|
|
4401
|
-
const installed = await apiRef.current.get(
|
|
4416
|
+
const installed = await apiRef.current.get(
|
|
4417
|
+
"/platform/apps/installed"
|
|
4418
|
+
);
|
|
4402
4419
|
checkAppSlugs = installed.apps.map((a) => a.slug).filter((slug) => slug !== appSlug);
|
|
4403
4420
|
if (!cancelled) setInstalledAppsUnavailable(false);
|
|
4404
4421
|
} catch {
|
|
@@ -4406,7 +4423,9 @@ function SettingsPage() {
|
|
|
4406
4423
|
if (!cancelled) setInstalledAppsUnavailable(true);
|
|
4407
4424
|
}
|
|
4408
4425
|
try {
|
|
4409
|
-
const result = await apiRef.current.invoke("list-gorgias-views", {
|
|
4426
|
+
const result = await apiRef.current.invoke("list-gorgias-views", {
|
|
4427
|
+
checkAppSlugs
|
|
4428
|
+
});
|
|
4410
4429
|
if (!cancelled) {
|
|
4411
4430
|
setViews(result.views);
|
|
4412
4431
|
setUncheckedAppSlugs(result.uncheckedAppSlugs);
|
|
@@ -4637,7 +4656,15 @@ function SettingsPage() {
|
|
|
4637
4656
|
["appScopeTag", "Tag des tickets de l'application"]
|
|
4638
4657
|
].map(([key, label]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
4639
4658
|
/* @__PURE__ */ jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
|
|
4640
|
-
/* @__PURE__ */ jsx(
|
|
4659
|
+
/* @__PURE__ */ jsx(
|
|
4660
|
+
Input,
|
|
4661
|
+
{
|
|
4662
|
+
id: key,
|
|
4663
|
+
value: field(form[key]),
|
|
4664
|
+
onChange: (e) => set(key, e.target.value),
|
|
4665
|
+
disabled: !canWrite
|
|
4666
|
+
}
|
|
4667
|
+
)
|
|
4641
4668
|
] }, key)),
|
|
4642
4669
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag des tickets de l\u2019application est obligatoire. Il est pos\xE9 sur chaque ticket que le triage examine, et c\u2019est lui qui dit qu\u2019un ticket appartient \xE0 cette app : les r\xE9ponses aux messages suivants et l\u2019agent par d\xE9faut propos\xE9 dans l\u2019extension Gorgias s\u2019appuient dessus. Il doit \xEAtre propre \xE0 cette app, distinct de celui d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
|
|
4643
4670
|
/* @__PURE__ */ jsx(SettingsWarnings, { warnings: tagWarnings })
|
|
@@ -4793,7 +4820,7 @@ function SettingsPage() {
|
|
|
4793
4820
|
"Catalogue de prompts indisponible \u2014 ",
|
|
4794
4821
|
describeApiError(promptCatalogue.error)
|
|
4795
4822
|
] }),
|
|
4796
|
-
/* @__PURE__ */ jsx(Link, { href:
|
|
4823
|
+
/* @__PURE__ */ jsx(Link, { href: pageHref("graph-canvas"), children: "Visualiser dans Graphe" })
|
|
4797
4824
|
] }) }),
|
|
4798
4825
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "space-y-3 p-4", children: [
|
|
4799
4826
|
/* @__PURE__ */ jsx("h2", { className: "font-medium", children: "Agents support" }),
|
|
@@ -6429,7 +6456,8 @@ function parseRunResult(result) {
|
|
|
6429
6456
|
};
|
|
6430
6457
|
}
|
|
6431
6458
|
function describeRunDecision(result, mode) {
|
|
6432
|
-
if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed")
|
|
6459
|
+
if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed")
|
|
6460
|
+
return "Conversation finie \u2014 aucune r\xE9ponse.";
|
|
6433
6461
|
if (result.stoppedAt !== null) return `Arr\xEAt en ${result.stoppedAt}.`;
|
|
6434
6462
|
const category = result.categoryName ? ` (cat\xE9gorie \xAB ${result.categoryName} \xBB)` : "";
|
|
6435
6463
|
if (result.outcome === "sent") {
|
|
@@ -6441,6 +6469,7 @@ function describeRunDecision(result, mode) {
|
|
|
6441
6469
|
function FollowupWebhookCard2() {
|
|
6442
6470
|
const api = useAppApi();
|
|
6443
6471
|
const { appSlug } = useAppContext();
|
|
6472
|
+
const pageHref = useAppPageHref();
|
|
6444
6473
|
const toast = useToast();
|
|
6445
6474
|
const ticketId = useId();
|
|
6446
6475
|
const [ticket, setTicket] = useState("");
|
|
@@ -6470,7 +6499,9 @@ function FollowupWebhookCard2() {
|
|
|
6470
6499
|
setIsTesting(true);
|
|
6471
6500
|
setTest(null);
|
|
6472
6501
|
try {
|
|
6473
|
-
setTest(
|
|
6502
|
+
setTest(
|
|
6503
|
+
await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode })
|
|
6504
|
+
);
|
|
6474
6505
|
} catch (err) {
|
|
6475
6506
|
toast({ title: "\xC9chec du test", description: describeInvokeError(err), variant: "error" });
|
|
6476
6507
|
} finally {
|
|
@@ -6498,9 +6529,36 @@ function FollowupWebhookCard2() {
|
|
|
6498
6529
|
className: "max-w-48"
|
|
6499
6530
|
}
|
|
6500
6531
|
),
|
|
6501
|
-
/* @__PURE__ */ jsx(
|
|
6502
|
-
|
|
6503
|
-
|
|
6532
|
+
/* @__PURE__ */ jsx(
|
|
6533
|
+
Button,
|
|
6534
|
+
{
|
|
6535
|
+
type: "button",
|
|
6536
|
+
variant: "outline",
|
|
6537
|
+
onClick: () => void runTest("diagnostic"),
|
|
6538
|
+
disabled,
|
|
6539
|
+
children: "Diagnostic"
|
|
6540
|
+
}
|
|
6541
|
+
),
|
|
6542
|
+
/* @__PURE__ */ jsx(
|
|
6543
|
+
Button,
|
|
6544
|
+
{
|
|
6545
|
+
type: "button",
|
|
6546
|
+
variant: "outline",
|
|
6547
|
+
onClick: () => void runTest("generate"),
|
|
6548
|
+
disabled,
|
|
6549
|
+
children: "G\xE9n\xE9rer sans envoyer"
|
|
6550
|
+
}
|
|
6551
|
+
),
|
|
6552
|
+
/* @__PURE__ */ jsx(
|
|
6553
|
+
Button,
|
|
6554
|
+
{
|
|
6555
|
+
type: "button",
|
|
6556
|
+
variant: "outline",
|
|
6557
|
+
onClick: () => setConfirmingRealRun(true),
|
|
6558
|
+
disabled,
|
|
6559
|
+
children: "Ex\xE9cution r\xE9elle"
|
|
6560
|
+
}
|
|
6561
|
+
)
|
|
6504
6562
|
] }),
|
|
6505
6563
|
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
6506
6564
|
"Le diagnostic \xE9value les m\xEAmes conditions que le webhook, sans aucun effet de bord.",
|
|
@@ -6540,7 +6598,13 @@ function FollowupWebhookCard2() {
|
|
|
6540
6598
|
/* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap rounded border bg-muted/30 p-2 text-xs", children: draftText })
|
|
6541
6599
|
] }),
|
|
6542
6600
|
/* @__PURE__ */ jsxs("p", { className: "text-xs", children: [
|
|
6543
|
-
/* @__PURE__ */ jsx(
|
|
6601
|
+
/* @__PURE__ */ jsx(
|
|
6602
|
+
Link,
|
|
6603
|
+
{
|
|
6604
|
+
href: pageHref("tickets", { ticket: runResult.ticketId ?? test.ticketId }),
|
|
6605
|
+
children: "Ouvrir la fiche du ticket"
|
|
6606
|
+
}
|
|
6607
|
+
),
|
|
6544
6608
|
runResult.ticketUrl !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6545
6609
|
" \xB7 ",
|
|
6546
6610
|
/* @__PURE__ */ jsx(Link, { href: runResult.ticketUrl, target: "_blank", rel: "noopener noreferrer", children: "Ouvrir dans Gorgias" })
|
|
@@ -6561,8 +6625,7 @@ function FollowupWebhookCard2() {
|
|
|
6561
6625
|
description: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6562
6626
|
"Le ticket ",
|
|
6563
6627
|
ticket.trim(),
|
|
6564
|
-
" va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
|
|
6565
|
-
" ",
|
|
6628
|
+
" va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et ",
|
|
6566
6629
|
/* @__PURE__ */ jsx("strong", { children: "envoi r\xE9el au client" }),
|
|
6567
6630
|
" si sa cat\xE9gorie est en r\xE9ponse automatique. Pour tout voir sans rien envoyer, utilisez \xAB G\xE9n\xE9rer sans envoyer \xBB."
|
|
6568
6631
|
] }),
|