@apotech-os/support-kit 7.0.1 → 8.0.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/README.md +19 -16
- package/dist/{chunk-QCRCRNYE.js → chunk-2UHFKGMI.js} +22 -3
- package/dist/chunk-2UHFKGMI.js.map +1 -0
- package/dist/index.cjs +79 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -143
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +203 -143
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +186 -145
- package/dist/ui/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-QCRCRNYE.js.map +0 -1
package/dist/ui/index.cjs
CHANGED
|
@@ -4548,156 +4548,104 @@ function SourceViewField({ views, value, onChange, disabled }) {
|
|
|
4548
4548
|
}
|
|
4549
4549
|
);
|
|
4550
4550
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4551
|
+
|
|
4552
|
+
// src/functions/followup-webhook-install.ts
|
|
4553
|
+
var FOLLOWUP_WEBHOOK_ROUTE_PATH = "/gorgias/webhook";
|
|
4554
|
+
var FOLLOWUP_WEBHOOK_FORM = {
|
|
4555
|
+
ticket_id: "{{ticket.id}}",
|
|
4556
|
+
channel: "{{ticket.channel}}",
|
|
4557
|
+
last_message_datetime: "{{ticket.last_message_datetime}}",
|
|
4558
|
+
status: "{{ticket.status}}",
|
|
4559
|
+
tags: "{{ticket.tags}}",
|
|
4560
|
+
last_message_from_agent: "{{ticket.messages[-1].from_agent}}",
|
|
4561
|
+
last_message_public: "{{ticket.messages[-1].public}}"
|
|
4559
4562
|
};
|
|
4563
|
+
var FOLLOWUP_WEBHOOK_TRIGGER = "ticket-message-created";
|
|
4564
|
+
function followupIntegrationName(slug) {
|
|
4565
|
+
return `Wopilo \u2014 R\xE9ponses aux messages suivants (${slug})`;
|
|
4566
|
+
}
|
|
4567
|
+
function followupWebhookPath(slug) {
|
|
4568
|
+
return `/api/s/${slug}${FOLLOWUP_WEBHOOK_ROUTE_PATH}`;
|
|
4569
|
+
}
|
|
4560
4570
|
function FollowupWebhookCard({ scopeTag, onScopeTagChange, canWrite }) {
|
|
4561
|
-
const
|
|
4562
|
-
const toast = uiSdk.useToast();
|
|
4571
|
+
const { appSlug } = uiSdk.useAppContext();
|
|
4563
4572
|
const scopeId = react.useId();
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.Card, { id: "webhook-suite", children: [
|
|
4596
|
-
/* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-4 p-4", children: [
|
|
4597
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4598
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
4599
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Quand un client r\xE9pond sur un ticket d\xE9j\xE0 trait\xE9, l'agent peut g\xE9n\xE9rer une nouvelle r\xE9ponse. Chaque cat\xE9gorie d\xE9cide si elle suit le fil (page Cat\xE9gories)." })
|
|
4600
|
-
] }),
|
|
4601
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4602
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: scopeId, className: "mb-1 block text-sm font-medium", children: "Tag de p\xE9rim\xE8tre webhook" }),
|
|
4603
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4604
|
-
uiSdk.Input,
|
|
4605
|
-
{
|
|
4606
|
-
id: scopeId,
|
|
4607
|
-
value: scopeTag,
|
|
4608
|
-
onChange: (e) => onScopeTagChange(e.target.value),
|
|
4609
|
-
placeholder: "wai/triaged",
|
|
4610
|
-
disabled: !canWrite
|
|
4611
|
-
}
|
|
4612
|
-
),
|
|
4613
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4614
|
-
"Le ticket doit d\xE9j\xE0 porter ce tag pour qu'un message suivant soit trait\xE9 \u2014 typiquement le tag \xAB trait\xE9 \xBB pos\xE9 par le premier passage. ",
|
|
4615
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Vide = aucun message suivant trait\xE9" }),
|
|
4616
|
-
" (c'est aussi le kill-switch). Deux apps sur le m\xEAme compte Gorgias doivent y mettre des valeurs ",
|
|
4617
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "distinctes" }),
|
|
4618
|
-
", sinon chacune r\xE9pondrait sur les tickets de l'autre."
|
|
4619
|
-
] })
|
|
4573
|
+
return /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "webhook-suite", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-4 p-4", children: [
|
|
4574
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4575
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
4576
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Quand un client r\xE9pond sur un ticket d\xE9j\xE0 trait\xE9, l'agent peut g\xE9n\xE9rer une nouvelle r\xE9ponse. Chaque cat\xE9gorie d\xE9cide si elle suit le fil (page Cat\xE9gories)." })
|
|
4577
|
+
] }),
|
|
4578
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4579
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: scopeId, className: "mb-1 block text-sm font-medium", children: "Tag de p\xE9rim\xE8tre webhook" }),
|
|
4580
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4581
|
+
uiSdk.Input,
|
|
4582
|
+
{
|
|
4583
|
+
id: scopeId,
|
|
4584
|
+
value: scopeTag,
|
|
4585
|
+
onChange: (e) => onScopeTagChange(e.target.value),
|
|
4586
|
+
placeholder: "wai/triaged",
|
|
4587
|
+
disabled: !canWrite
|
|
4588
|
+
}
|
|
4589
|
+
),
|
|
4590
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4591
|
+
"Le ticket doit d\xE9j\xE0 porter ce tag pour qu'un message suivant soit trait\xE9 \u2014 typiquement le tag \xAB trait\xE9 \xBB pos\xE9 par le premier passage. ",
|
|
4592
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Vide = aucun message suivant trait\xE9" }),
|
|
4593
|
+
" (c'est aussi le kill-switch). Deux apps sur le m\xEAme compte Gorgias doivent y mettre des valeurs ",
|
|
4594
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "distinctes" }),
|
|
4595
|
+
", sinon chacune r\xE9pondrait sur les tickets de l'autre."
|
|
4596
|
+
] })
|
|
4597
|
+
] }),
|
|
4598
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t pt-4", children: [
|
|
4599
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "Int\xE9gration Gorgias (installation manuelle)" }),
|
|
4600
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4601
|
+
"\xC0 cr\xE9er une fois dans Gorgias, sous ",
|
|
4602
|
+
/* @__PURE__ */ jsxRuntime.jsx("em", { children: "Settings \u203A Integrations \u203A HTTP" }),
|
|
4603
|
+
". Rien n'est install\xE9 depuis cette page : l'app n'\xE9crit rien sur le compte Gorgias."
|
|
4620
4604
|
] }),
|
|
4621
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
4622
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4623
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
"
|
|
4627
|
-
|
|
4628
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "wopilo_app_\u2026" }),
|
|
4629
|
-
"), puis installez l'int\xE9gration. L'op\xE9ration est idempotente : re-cliquer la met \xE0 jour."
|
|
4605
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "space-y-1 text-xs", children: [
|
|
4606
|
+
/* @__PURE__ */ jsxRuntime.jsx(RecipeRow, { label: "Nom", children: followupIntegrationName(appSlug) }),
|
|
4607
|
+
/* @__PURE__ */ jsxRuntime.jsx(RecipeRow, { label: "D\xE9clencheur", children: FOLLOWUP_WEBHOOK_TRIGGER }),
|
|
4608
|
+
/* @__PURE__ */ jsxRuntime.jsx(RecipeRow, { label: "M\xE9thode", children: "POST" }),
|
|
4609
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RecipeRow, { label: "URL", children: [
|
|
4610
|
+
"<PUBLIC_BASE_URL>",
|
|
4611
|
+
followupWebhookPath(appSlug)
|
|
4630
4612
|
] }),
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
"
|
|
4635
|
-
" ",
|
|
4636
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { children: setup.url }),
|
|
4637
|
-
"."
|
|
4613
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RecipeRow, { label: "En-t\xEAte", children: [
|
|
4614
|
+
"Authorization: Bearer <cl\xE9 d'application ",
|
|
4615
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "wopilo_app_\u2026" }),
|
|
4616
|
+
">"
|
|
4638
4617
|
] })
|
|
4639
4618
|
] }),
|
|
4640
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
4641
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
] }),
|
|
4661
|
-
|
|
4662
|
-
"Traitement d\xE9clench\xE9. Run \xE0 suivre : ",
|
|
4663
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { children: test.runId }),
|
|
4664
|
-
"."
|
|
4665
|
-
] }),
|
|
4666
|
-
test?.mode === "diagnostic" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
4667
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: test.stoppedAt === null ? `Ticket ${test.ticketId} : il aurait re\xE7u une r\xE9ponse de suite.` : `Ticket ${test.ticketId} : arr\xEAt en ${test.stoppedAt}.` }),
|
|
4668
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1", children: test.gates.map((gate) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-start gap-2 text-xs", children: [
|
|
4669
|
-
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { variant: STATUS_BADGE[gate.status].variant, children: STATUS_BADGE[gate.status].label }),
|
|
4670
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4671
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
4672
|
-
gate.gate,
|
|
4673
|
-
" \u2014 ",
|
|
4674
|
-
gate.label
|
|
4675
|
-
] }),
|
|
4676
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
4677
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: gate.detail })
|
|
4678
|
-
] })
|
|
4679
|
-
] }, gate.gate)) })
|
|
4680
|
-
] })
|
|
4619
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4620
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "PUBLIC_BASE_URL" }),
|
|
4621
|
+
" est l'origine publique de l'",
|
|
4622
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "API" }),
|
|
4623
|
+
" \u2014 pas forc\xE9ment celle de cette interface, que l'instance peut servir depuis un autre domaine (",
|
|
4624
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "WEB_APP_URL" }),
|
|
4625
|
+
"). En cas de doute, c'est la valeur r\xE9gl\xE9e c\xF4t\xE9 instance qui fait foi : une URL construite sur la mauvaise origine renvoie 404 \xE0 chaque appel Gorgias, sans message d'erreur nulle part."
|
|
4626
|
+
] }),
|
|
4627
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
4628
|
+
"La cl\xE9 est une cl\xE9 d'application de cette app, cr\xE9\xE9e dans la plateforme puis coll\xE9e telle quelle dans l'en-t\xEAte. Elle porte le r\xF4le manifeste complet de l'app (voir",
|
|
4629
|
+
" ",
|
|
4630
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: "docs/app-platform/gorgias-callback-authentication.md" }),
|
|
4631
|
+
" \xA75)."
|
|
4632
|
+
] }),
|
|
4633
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4634
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-xs font-medium", children: "Champs du corps (onglet \xAB Body \xBB, un par ligne)" }),
|
|
4635
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-0.5 font-mono text-xs text-muted-foreground", children: Object.entries(FOLLOWUP_WEBHOOK_FORM).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
4636
|
+
key,
|
|
4637
|
+
" = ",
|
|
4638
|
+
value
|
|
4639
|
+
] }, key)) }),
|
|
4640
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Les quatre derniers champs ne sont pas document\xE9s par Gorgias : s'ils ne se r\xE9solvent pas, le traitement relit simplement le ticket et continue. Rien ne casse s'ils manquent." })
|
|
4681
4641
|
] })
|
|
4682
|
-
] })
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
ticket.trim(),
|
|
4690
|
-
" va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
|
|
4691
|
-
" ",
|
|
4692
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "envoi r\xE9el au client" }),
|
|
4693
|
-
" si sa cat\xE9gorie est en r\xE9ponse automatique. \xC0 r\xE9server \xE0 un ticket de test."
|
|
4694
|
-
] }),
|
|
4695
|
-
confirmLabel: "Lancer",
|
|
4696
|
-
busyLabel: "D\xE9clenchement\u2026",
|
|
4697
|
-
onConfirm: () => runTest("run"),
|
|
4698
|
-
onCancel: () => setConfirmingRealRun(false)
|
|
4699
|
-
}
|
|
4700
|
-
)
|
|
4642
|
+
] })
|
|
4643
|
+
] }) });
|
|
4644
|
+
}
|
|
4645
|
+
function RecipeRow({ label, children }) {
|
|
4646
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
4647
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "w-24 shrink-0 text-muted-foreground", children: label }),
|
|
4648
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "break-all font-mono", children })
|
|
4701
4649
|
] });
|
|
4702
4650
|
}
|
|
4703
4651
|
var WHATSAPP_MODE_LABELS = {
|
|
@@ -6755,6 +6703,116 @@ function DryRunResultView({ result, langfuseConfig, knownTags, tagSettings }) {
|
|
|
6755
6703
|
] })
|
|
6756
6704
|
] });
|
|
6757
6705
|
}
|
|
6706
|
+
var STATUS_BADGE = {
|
|
6707
|
+
passed: { label: "OK", variant: "success" },
|
|
6708
|
+
stopped: { label: "Arr\xEAt", variant: "danger" },
|
|
6709
|
+
// A pre-gate that could not read its field. Never shown by the diagnostic
|
|
6710
|
+
// (it evaluates no payload) but rendered honestly if it ever appears, rather
|
|
6711
|
+
// than falling through to a blank badge.
|
|
6712
|
+
muted: { label: "Muet", variant: "warning" },
|
|
6713
|
+
skipped: { label: "Non \xE9valu\xE9", variant: "neutral" }
|
|
6714
|
+
};
|
|
6715
|
+
function FollowupWebhookCard2() {
|
|
6716
|
+
const api = uiSdk.useAppApi();
|
|
6717
|
+
const toast = uiSdk.useToast();
|
|
6718
|
+
const ticketId = react.useId();
|
|
6719
|
+
const [ticket, setTicket] = react.useState("");
|
|
6720
|
+
const [test, setTest] = react.useState(null);
|
|
6721
|
+
const [isTesting, setIsTesting] = react.useState(false);
|
|
6722
|
+
const [confirmingRealRun, setConfirmingRealRun] = react.useState(false);
|
|
6723
|
+
async function runTest(mode) {
|
|
6724
|
+
setIsTesting(true);
|
|
6725
|
+
setTest(null);
|
|
6726
|
+
try {
|
|
6727
|
+
setTest(await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode }));
|
|
6728
|
+
} catch (err) {
|
|
6729
|
+
toast({ title: "\xC9chec du test", description: describeInvokeError(err), variant: "error" });
|
|
6730
|
+
} finally {
|
|
6731
|
+
setIsTesting(false);
|
|
6732
|
+
setConfirmingRealRun(false);
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6735
|
+
const disabled = !ticket.trim() || isTesting;
|
|
6736
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.Card, { id: "webhook-suite", children: [
|
|
6737
|
+
/* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
|
|
6738
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
6739
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
|
|
6740
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Rejoue sur un ticket r\xE9el ce que ferait le webhook Gorgias quand un client r\xE9pond sur un ticket d\xE9j\xE0 trait\xE9. Le tag de p\xE9rim\xE8tre et les cat\xE9gories se r\xE8glent dans Param\xE8tres." })
|
|
6741
|
+
] }),
|
|
6742
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t pt-3", children: [
|
|
6743
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: ticketId, className: "block text-sm font-medium", children: "Ticket \xE0 tester" }),
|
|
6744
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6745
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6746
|
+
uiSdk.Input,
|
|
6747
|
+
{
|
|
6748
|
+
id: ticketId,
|
|
6749
|
+
value: ticket,
|
|
6750
|
+
onChange: (e) => setTicket(e.target.value),
|
|
6751
|
+
placeholder: "1534712154",
|
|
6752
|
+
className: "max-w-48"
|
|
6753
|
+
}
|
|
6754
|
+
),
|
|
6755
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("diagnostic"), disabled, children: "Diagnostic" }),
|
|
6756
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("generate"), disabled, children: "G\xE9n\xE9rer sans envoyer" }),
|
|
6757
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => setConfirmingRealRun(true), disabled, children: "Ex\xE9cution r\xE9elle" })
|
|
6758
|
+
] }),
|
|
6759
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
6760
|
+
"Le diagnostic \xE9value les m\xEAmes conditions que le webhook, sans aucun effet de bord.",
|
|
6761
|
+
" ",
|
|
6762
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "G\xE9n\xE9rer sans envoyer" }),
|
|
6763
|
+
" produit la r\xE9ponse compl\xE8te \u2014 m\xEAme si la cat\xE9gorie n'a pas activ\xE9 les r\xE9ponses aux messages suivants \u2014 et ne l'envoie jamais ; elle se lit dans la fiche du ticket. L'ex\xE9cution r\xE9elle d\xE9clenche le vrai traitement."
|
|
6764
|
+
] }),
|
|
6765
|
+
isTesting && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
6766
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Spinner, {}),
|
|
6767
|
+
" Test en cours\u2026"
|
|
6768
|
+
] }),
|
|
6769
|
+
test?.mode === "generate" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", children: [
|
|
6770
|
+
"G\xE9n\xE9ration d\xE9clench\xE9e, sans envoi. Run \xE0 suivre : ",
|
|
6771
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: test.runId }),
|
|
6772
|
+
"."
|
|
6773
|
+
] }),
|
|
6774
|
+
test?.mode === "run" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", children: [
|
|
6775
|
+
"Traitement d\xE9clench\xE9. Run \xE0 suivre : ",
|
|
6776
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { children: test.runId }),
|
|
6777
|
+
"."
|
|
6778
|
+
] }),
|
|
6779
|
+
test?.mode === "diagnostic" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
6780
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: test.stoppedAt === null ? `Ticket ${test.ticketId} : il aurait re\xE7u une r\xE9ponse de suite.` : `Ticket ${test.ticketId} : arr\xEAt en ${test.stoppedAt}.` }),
|
|
6781
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1", children: test.gates.map((gate) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-start gap-2 text-xs", children: [
|
|
6782
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { variant: STATUS_BADGE[gate.status].variant, children: STATUS_BADGE[gate.status].label }),
|
|
6783
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6784
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
6785
|
+
gate.gate,
|
|
6786
|
+
" \u2014 ",
|
|
6787
|
+
gate.label
|
|
6788
|
+
] }),
|
|
6789
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
6790
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: gate.detail })
|
|
6791
|
+
] })
|
|
6792
|
+
] }, gate.gate)) })
|
|
6793
|
+
] })
|
|
6794
|
+
] })
|
|
6795
|
+
] }),
|
|
6796
|
+
confirmingRealRun && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6797
|
+
ConfirmModal,
|
|
6798
|
+
{
|
|
6799
|
+
title: "Lancer le traitement r\xE9el ?",
|
|
6800
|
+
description: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6801
|
+
"Le ticket ",
|
|
6802
|
+
ticket.trim(),
|
|
6803
|
+
" va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
|
|
6804
|
+
" ",
|
|
6805
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "envoi r\xE9el au client" }),
|
|
6806
|
+
" si sa cat\xE9gorie est en r\xE9ponse automatique. Pour tout voir sans rien envoyer, utilisez \xAB G\xE9n\xE9rer sans envoyer \xBB."
|
|
6807
|
+
] }),
|
|
6808
|
+
confirmLabel: "Lancer",
|
|
6809
|
+
busyLabel: "D\xE9clenchement\u2026",
|
|
6810
|
+
onConfirm: () => runTest("run"),
|
|
6811
|
+
onCancel: () => setConfirmingRealRun(false)
|
|
6812
|
+
}
|
|
6813
|
+
)
|
|
6814
|
+
] });
|
|
6815
|
+
}
|
|
6758
6816
|
var TRI_STATE_OPTIONS = [
|
|
6759
6817
|
{ value: "", label: "R\xE9glages actuels" },
|
|
6760
6818
|
{ value: "on", label: "Forcer actif" },
|
|
@@ -6942,9 +7000,11 @@ function TestControls() {
|
|
|
6942
7000
|
function TestPage() {
|
|
6943
7001
|
const { role } = uiSdk.useAppContext();
|
|
6944
7002
|
const canRun = canWriteForRole(role);
|
|
7003
|
+
const canTestFollowup = role === "ADMIN";
|
|
6945
7004
|
return /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { children: [
|
|
6946
7005
|
/* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title: "Banc de test", description: "Rejoue le graphe sans jamais agir sur un vrai ticket (\xA70)." }),
|
|
6947
|
-
!canRun ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Acc\xE8s en lecture seule \u2014 lancer un test n\xE9cessite le r\xF4le EDITOR (chaque ex\xE9cution consomme du budget LLM)." }) : /* @__PURE__ */ jsxRuntime.jsx(TestControls, {})
|
|
7006
|
+
!canRun ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Acc\xE8s en lecture seule \u2014 lancer un test n\xE9cessite le r\xF4le EDITOR (chaque ex\xE9cution consomme du budget LLM)." }) : /* @__PURE__ */ jsxRuntime.jsx(TestControls, {}),
|
|
7007
|
+
canTestFollowup && /* @__PURE__ */ jsxRuntime.jsx(FollowupWebhookCard2, {})
|
|
6948
7008
|
] });
|
|
6949
7009
|
}
|
|
6950
7010
|
function ExperimentStatusBadge({ experiment }) {
|