@apotech-os/support-kit 10.1.1 → 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 CHANGED
@@ -24,7 +24,7 @@ var OUTCOMES = [
24
24
  "triaged_only",
25
25
  // tenant/ticket has no draft step to run
26
26
  "no_reply_needed",
27
- // triage read the thread as already closed → NO tag, like 'ready' (whatsapp spec §5.2)
27
+ // the end-of-conversation step judged the thread finished — set on response rows, never returned by runTicket
28
28
  "failed"
29
29
  ];
30
30
  function isOutcome(value) {
@@ -616,6 +616,129 @@ function AutonomyHero({
616
616
  ] }) });
617
617
  }
618
618
 
619
+ // src/domain/reply-timing.ts
620
+ var RESPONDERS = ["ai", "human", "human_ai_assisted", "other", "none"];
621
+ var DELAY_BUCKETS = ["lt_5m", "5_15m", "15_60m", "1_4h", "4_24h", "gt_24h"];
622
+ function foldReplyTimings(rows) {
623
+ return Object.fromEntries(
624
+ RESPONDERS.map((responder) => [
625
+ responder,
626
+ timingOf(rows.filter((row) => row["responder"] === responder))
627
+ ])
628
+ );
629
+ }
630
+ function timingOf(rows) {
631
+ const buckets = emptyBuckets();
632
+ let count = 0;
633
+ let timed = 0;
634
+ let totalSeconds = 0;
635
+ for (const row of rows) {
636
+ const turns = countOf(row);
637
+ count += turns;
638
+ const bucket = row["delayBucket"];
639
+ if (!isDelayBucket(bucket)) continue;
640
+ buckets[bucket] += turns;
641
+ timed += turns;
642
+ totalSeconds += Number(row["totalSeconds"]) || 0;
643
+ }
644
+ return {
645
+ count,
646
+ avgSeconds: timed > 0 ? totalSeconds / timed : null,
647
+ medianBucket: medianBucketOf(buckets, timed),
648
+ buckets
649
+ };
650
+ }
651
+ function medianBucketOf(buckets, timed) {
652
+ let cumulative = 0;
653
+ for (const bucket of DELAY_BUCKETS) {
654
+ cumulative += buckets[bucket];
655
+ if (timed > 0 && cumulative >= timed / 2) return bucket;
656
+ }
657
+ return null;
658
+ }
659
+ function emptyBuckets() {
660
+ return Object.fromEntries(DELAY_BUCKETS.map((bucket) => [bucket, 0]));
661
+ }
662
+ function isDelayBucket(value) {
663
+ return DELAY_BUCKETS.includes(value);
664
+ }
665
+
666
+ // src/domain/dashboard-queries.ts
667
+ var OUTCOME_METRICS = [{ op: "count", as: "count" }];
668
+ var OUTCOME_GROUP_BY = ["status", "autoSendDecision", "outcome"];
669
+ var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision", "outcome"];
670
+ var TRIAGE_HANDOFF_GROUP_BY = ["escalated", "status"];
671
+ var CATEGORY_TRIAGE_GROUP_BY = ["categoryId", "escalated", "status"];
672
+ var REPLY_TIMING_GROUP_BY = ["responder", "delayBucket"];
673
+ var REPLY_TIMING_METRICS = [
674
+ { op: "count", as: "count" },
675
+ { op: "sum", field: "delaySeconds", as: "totalSeconds" }
676
+ ];
677
+ var DELAY_BUCKET_LABELS = {
678
+ lt_5m: "moins de 5 min",
679
+ "5_15m": "5 \xE0 15 min",
680
+ "15_60m": "15 \xE0 60 min",
681
+ "1_4h": "1 \xE0 4 h",
682
+ "4_24h": "4 \xE0 24 h",
683
+ gt_24h: "plus de 24 h"
684
+ };
685
+ function formatDuration(seconds) {
686
+ if (Math.round(seconds) < 60) return `${Math.round(seconds)} s`;
687
+ const minutes = Math.round(seconds / 60);
688
+ if (minutes < 60) return `${minutes} min`;
689
+ const hours = Math.floor(minutes / 60);
690
+ if (hours < 24) {
691
+ const rest = minutes % 60;
692
+ return rest === 0 ? `${hours} h` : `${hours} h ${String(rest).padStart(2, "0")}`;
693
+ }
694
+ return `${Math.floor(hours / 24)} j ${hours % 24} h`;
695
+ }
696
+ function Figure({ label, value }) {
697
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
698
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium uppercase tracking-widest text-muted-foreground", children: label }),
699
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-2xl font-semibold tabular-nums", children: value })
700
+ ] });
701
+ }
702
+ function ReplyTimesSection({ fromIso, toIso }) {
703
+ const { rows, isLoading, error } = useAggregate("reply-timing", {
704
+ filter: { customerMessageAt: { gte: fromIso, lte: toIso } },
705
+ groupBy: REPLY_TIMING_GROUP_BY,
706
+ metrics: REPLY_TIMING_METRICS
707
+ });
708
+ const ai = react.useMemo(() => foldReplyTimings(rows).ai, [rows]);
709
+ const histogram = DELAY_BUCKETS.map((bucket) => ({
710
+ tranche: DELAY_BUCKET_LABELS[bucket],
711
+ ai: ai.buckets[bucket]
712
+ }));
713
+ return /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.Card, { "data-testid": "dashboard-reply-times", children: [
714
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.CardTitle, { className: "text-sm", children: "D\xE9lais de r\xE9ponse" }) }),
715
+ /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-4", children: [
716
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Chargement\u2026" }) : error !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: "Impossible de calculer les d\xE9lais de r\xE9ponse." }) : ai.medianBucket === null || ai.avgSeconds === null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Aucune r\xE9ponse de l\u2019IA mesur\xE9e sur cette p\xE9riode." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
717
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [
718
+ /* @__PURE__ */ jsxRuntime.jsx(Figure, { label: "D\xE9lai m\xE9dian IA", value: DELAY_BUCKET_LABELS[ai.medianBucket] }),
719
+ /* @__PURE__ */ jsxRuntime.jsx(Figure, { label: "D\xE9lai moyen IA", value: formatDuration(ai.avgSeconds) }),
720
+ /* @__PURE__ */ jsxRuntime.jsx(Figure, { label: "Volume", value: `${ai.count.toLocaleString("fr-FR")} tours` })
721
+ ] }),
722
+ /* @__PURE__ */ jsxRuntime.jsx(
723
+ uiSdk.StackedBarChart,
724
+ {
725
+ data: histogram,
726
+ x: "tranche",
727
+ label: "R\xE9ponses de l\u2019IA par tranche de d\xE9lai",
728
+ series: [{ key: "ai", label: "R\xE9ponse de l\u2019IA", colorIndex: 0 }],
729
+ height: 150
730
+ }
731
+ )
732
+ ] }),
733
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs leading-relaxed text-muted-foreground", children: [
734
+ "Le d\xE9lai court du ",
735
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "premier" }),
736
+ " message du client rest\xE9 sans r\xE9ponse jusqu\u2019\xE0 la premi\xE8re r\xE9ponse qui le suit, en temps r\xE9el (nuits et week-ends compris). La m\xE9diane est une tranche : la moiti\xE9 des r\xE9ponses arrive dans cette tranche ou avant. Deux \xE9carts connus : une r\xE9ponse approuv\xE9e par un humain avant envoi compte comme une r\xE9ponse de l\u2019IA, et les tours reconstitu\xE9s apr\xE8s coup partent du dernier message du client, pas du premier."
737
+ ] })
738
+ ] })
739
+ ] });
740
+ }
741
+
619
742
  // src/domain/period.ts
620
743
  var WEEKLY_BUCKET_FROM_DAYS = 46;
621
744
  var DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
@@ -719,13 +842,6 @@ function StackedLegend({ segments }) {
719
842
  segment.label
720
843
  ] }, segment.key)) });
721
844
  }
722
-
723
- // src/domain/dashboard-queries.ts
724
- var OUTCOME_METRICS = [{ op: "count", as: "count" }];
725
- var OUTCOME_GROUP_BY = ["status", "autoSendDecision", "outcome"];
726
- var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision", "outcome"];
727
- var TRIAGE_HANDOFF_GROUP_BY = ["escalated", "status"];
728
- var CATEGORY_TRIAGE_GROUP_BY = ["categoryId", "escalated", "status"];
729
845
  var CATEGORY_COLORS = {
730
846
  auto: "var(--chart-1)",
731
847
  human: "var(--chart-2)",
@@ -746,7 +862,7 @@ function dayLabel(day) {
746
862
  return Number.isNaN(parsed.getTime()) ? day : parsed.toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit", timeZone: "UTC" });
747
863
  }
748
864
  function DashboardPage() {
749
- const { appSlug } = uiSdk.useAppContext();
865
+ const pageHref = uiSdk.useAppPageHref();
750
866
  const [period, setPeriod] = react.useState(() => defaultPeriod());
751
867
  const { settings } = uiSdk.useAppSettings();
752
868
  const timezone = settings?.statsTimezone ?? "UTC";
@@ -848,7 +964,7 @@ function DashboardPage() {
848
964
  align: "end"
849
965
  }
850
966
  ),
851
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/tickets`, children: "Voir tous les tickets" })
967
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: pageHref("tickets"), children: "Voir tous les tickets" })
852
968
  ] })
853
969
  }
854
970
  ),
@@ -880,6 +996,7 @@ function DashboardPage() {
880
996
  /* @__PURE__ */ jsxRuntime.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." })
881
997
  ] }),
882
998
  dailyError !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: "Erreur lors du calcul des chiffres cl\xE9s." }),
999
+ /* @__PURE__ */ jsxRuntime.jsx(ReplyTimesSection, { fromIso: bounds.current.fromIso, toIso: bounds.current.toIso }),
883
1000
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
884
1001
  /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.Card, { children: [
885
1002
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardTitle, { className: "text-sm", children: [
@@ -1089,7 +1206,9 @@ var SETTINGS_ISSUE_LABELS = {
1089
1206
  appScopeTag: "Tag des tickets de l'application requis \u2014 c'est lui qui rattache un ticket \xE0 cette app.",
1090
1207
  nodes: "nodes.triage doit \xEAtre configur\xE9 \u2014 une \xE9tape de triage \xE0 null ne triagerait rien.",
1091
1208
  nodePrompt: "Chaque \xE9tape active doit d\xE9signer un prompt Langfuse \u2014 sans prompt, l'\xE9tape n'a rien \xE0 dire au mod\xE8le.",
1092
- senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB)."
1209
+ senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB).",
1210
+ conversationEndTag: "Tag de fin de conversation invalide \u2014 il doit \xEAtre renseign\xE9, et diff\xE9rent des tags de reprise humaine (escalade, \xE0 revoir avant envoi, suivi requis), du tag de prise en charge et du tag de l'application.",
1211
+ conversationEndPrompt: "Prompt \xAB fin de conversation \xBB requis d\xE8s que l'action de fin de conversation est activ\xE9e."
1093
1212
  };
1094
1213
  function settingsIssueLabel(key, fallback) {
1095
1214
  return SETTINGS_ISSUE_LABELS[key] ?? fallback;
@@ -1561,6 +1680,37 @@ var DEFAULT_AUTO_SEND_CHANNELS = [
1561
1680
  "sms",
1562
1681
  "contact-form"
1563
1682
  ];
1683
+
1684
+ // src/settings/conversation-end.ts
1685
+ var CONVERSATION_END_ACTIONS = ["disabled", "tag", "close"];
1686
+ var DEFAULT_CONVERSATION_END_ACTION = "disabled";
1687
+ var DEFAULT_CONVERSATION_END_TAG = "wai/conversation-ended";
1688
+ function readConversationEnd(settings) {
1689
+ const raw = settings;
1690
+ const rawAction = raw.conversationEndAction;
1691
+ const action = CONVERSATION_END_ACTIONS.includes(rawAction) ? rawAction : DEFAULT_CONVERSATION_END_ACTION;
1692
+ const tag = typeof raw.conversationEndTag === "string" ? raw.conversationEndTag.trim() : DEFAULT_CONVERSATION_END_TAG;
1693
+ return { action, tag, prompt: readPrompt(raw.conversationEndPrompt) };
1694
+ }
1695
+ function endConfigOf({
1696
+ action,
1697
+ tag
1698
+ }) {
1699
+ return action === "disabled" ? null : { action, tag };
1700
+ }
1701
+ function toConversationEnd(settings) {
1702
+ return endConfigOf(readConversationEnd(settings));
1703
+ }
1704
+ function conversationEndEffects(end) {
1705
+ if (!end) return { tags: [], close: false };
1706
+ return end.action === "tag" ? { tags: [end.tag], close: false } : { tags: [], close: true };
1707
+ }
1708
+ function readPrompt(raw) {
1709
+ if (typeof raw !== "object" || raw === null) return null;
1710
+ const { name, label } = raw;
1711
+ if (typeof name !== "string" || name === "") return null;
1712
+ return typeof label === "string" && label !== "" ? { name, label } : { name };
1713
+ }
1564
1714
  var AGENT_FIELD_NAME_UID = "e9cfec6f-15c6-4d02-8f79-0667f64b9eb5";
1565
1715
  var AGENT_FIELD_PROVIDER_UID = "e522b809-e8a7-4439-a2df-936158d04389";
1566
1716
  var AGENT_FIELD_MODEL_ID_UID = "d95977ba-362c-44d6-a2f0-24156c76cf8a";
@@ -1799,7 +1949,8 @@ function toDeliveryPolicy(raw) {
1799
1949
  whatsappMode: typeof settings.whatsappMode === "string" ? settings.whatsappMode : null,
1800
1950
  autoSendChannels: Array.isArray(settings.autoSendChannels) ? settings.autoSendChannels : [...DEFAULT_AUTO_SEND_CHANNELS],
1801
1951
  dryRun: settings.dryRun === true,
1802
- audit: toAuditTags(settings)
1952
+ audit: toAuditTags(settings),
1953
+ conversationEnd: toConversationEnd(settings)
1803
1954
  };
1804
1955
  }
1805
1956
 
@@ -2064,6 +2215,8 @@ function deliveryReason(facts) {
2064
2215
  case "test_draft":
2065
2216
  return { code: "test_draft" };
2066
2217
  default:
2218
+ if (job.status === "no_reply_needed" && job.outcome === "no_reply_needed")
2219
+ return { code: "no_reply_needed" };
2067
2220
  return { code: "unexpected_status", status: job.status };
2068
2221
  }
2069
2222
  }
@@ -2211,6 +2364,8 @@ function describeReason(reason2) {
2211
2364
  return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
2212
2365
  case "test_draft":
2213
2366
  return "Brouillon d'essai \u2014 jamais envoy\xE9.";
2367
+ case "no_reply_needed":
2368
+ return "Aucune r\xE9ponse n\xE9cessaire \u2014 la conversation est finie.";
2214
2369
  case "unexpected_status":
2215
2370
  return `La r\xE9ponse n'a pas \xE9t\xE9 envoy\xE9e (statut : ${reason2.status}).`;
2216
2371
  case "no_correction":
@@ -2327,14 +2482,18 @@ function triageTagNames(input) {
2327
2482
  }
2328
2483
  function wasSimulated(job, policy) {
2329
2484
  if (!job) return false;
2485
+ if (job.status === "test_draft") return true;
2330
2486
  if (job.outcome === "sent" && job.status !== "sent") return true;
2331
2487
  return policy?.dryRun === true;
2332
2488
  }
2333
2489
  function ticketActions(input) {
2334
2490
  const { job, policy, notSentReason: notSentReason2 } = input;
2335
2491
  const simulated = wasSimulated(job, policy);
2492
+ const ended = job?.outcome === "no_reply_needed" && (job.status === "no_reply_needed" || job.status === "test_draft") && input.decision.conversationOver === true;
2493
+ const endEffects = conversationEndEffects(ended ? policy?.conversationEnd ?? null : null);
2336
2494
  const tags = dedupe([
2337
2495
  ...triageTagNames(input),
2496
+ ...endEffects.tags,
2338
2497
  ...policy ? outcomeTags(job?.outcome ?? null, job?.verdict ?? null, policy.audit) : []
2339
2498
  ]);
2340
2499
  const taken = [];
@@ -2345,6 +2504,7 @@ function ticketActions(input) {
2345
2504
  skipped.push(`R\xE9ponse non envoy\xE9e \u2014 ${notSentReason2 ?? "raison inconnue."}`);
2346
2505
  }
2347
2506
  if (job?.outcome === "awaiting_approval" && !simulated) taken.push("Demande d'approbation cr\xE9\xE9e.");
2507
+ if (endEffects.close && !simulated) taken.push("Ticket ferm\xE9 dans Gorgias.");
2348
2508
  return { tags, taken, skipped, simulated, unrecorded: job !== void 0 && job.outcome === null };
2349
2509
  }
2350
2510
  function TimelinePanel(props) {
@@ -3210,13 +3370,13 @@ function applyPreset(value, preset, restore) {
3210
3370
  }
3211
3371
 
3212
3372
  // src/ui/shared/quality-href.ts
3213
- function qualityHref(appSlug, agent) {
3214
- const base2 = `/espace/${appSlug}/quality`;
3215
- if (!agent) return base2;
3216
- const params = new URLSearchParams({ promptName: agent.promptName });
3217
- if (agent.promptVersion !== null) params.set("promptVersion", String(agent.promptVersion));
3218
- params.set("agentId", agent.id);
3219
- return `${base2}?${params.toString()}`;
3373
+ function qualityHref(pageHref, agent) {
3374
+ if (!agent) return pageHref("quality");
3375
+ return pageHref("quality", {
3376
+ promptName: agent.promptName,
3377
+ promptVersion: agent.promptVersion,
3378
+ agentId: agent.id
3379
+ });
3220
3380
  }
3221
3381
  function usePromptCatalogue() {
3222
3382
  const { appSlug } = uiSdk.useAppContext();
@@ -3798,7 +3958,7 @@ function AgentFormPanel({
3798
3958
  );
3799
3959
  }
3800
3960
  function PromptVersionsSection({ agent, canWrite }) {
3801
- const { appSlug } = uiSdk.useAppContext();
3961
+ const pageHref = uiSdk.useAppPageHref();
3802
3962
  const { versions, error, refresh, promote, deleteVersion, createVersion } = usePromptVersions(
3803
3963
  agent.promptName
3804
3964
  );
@@ -3887,7 +4047,7 @@ function PromptVersionsSection({ agent, canWrite }) {
3887
4047
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3888
4048
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
3889
4049
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3890
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: qualityHref(appSlug, agent), children: "Voir dans Qualit\xE9" }),
4050
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: qualityHref(pageHref, agent), children: "Voir dans Qualit\xE9" }),
3891
4051
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
3892
4052
  versions.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { variant: "outline", onClick: openCompare, children: "Comparer" }),
3893
4053
  canWrite && /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { variant: "outline", onClick: () => void suggest(), disabled: isSuggesting, children: isSuggesting ? "Suggestion en cours\u2026" : "Sugg\xE9rer une am\xE9lioration" })
@@ -4689,8 +4849,35 @@ function validateSettings(settings) {
4689
4849
  message: "senderEmail is required when autoSendEnabled is on, unless whatsappMode is 'auto_reply'."
4690
4850
  });
4691
4851
  }
4852
+ const end = readConversationEnd(settings);
4853
+ if (end.action === "tag" && end.tag === "") {
4854
+ issues.push({
4855
+ key: "conversationEndTag",
4856
+ message: 'conversationEndTag is required when the end-of-conversation action is "tag".'
4857
+ });
4858
+ } else if (end.tag !== "" && reservedTags(settings).includes(end.tag)) {
4859
+ issues.push({
4860
+ key: "conversationEndTag",
4861
+ message: "conversationEndTag must differ from escalationTag, needsReviewTag, followupTag, appScopeTag and handledTag."
4862
+ });
4863
+ }
4864
+ if (end.action !== "disabled" && end.prompt === null) {
4865
+ issues.push({
4866
+ key: "conversationEndPrompt",
4867
+ message: "conversationEndPrompt is required when the end-of-conversation action is on."
4868
+ });
4869
+ }
4692
4870
  return issues;
4693
4871
  }
4872
+ function reservedTags(settings) {
4873
+ return [
4874
+ settings.escalationTag,
4875
+ settings.needsReviewTag,
4876
+ settings.followupTag,
4877
+ settings.appScopeTag,
4878
+ settings.handledTag
4879
+ ].filter(isNonEmptyString).map((tag) => tag.trim());
4880
+ }
4694
4881
  function isNonEmptyString(value) {
4695
4882
  return typeof value === "string" && value.length > 0;
4696
4883
  }
@@ -4768,6 +4955,61 @@ function NumberField({ id, label, value, onChange, disabled, min, max, integer,
4768
4955
  hint && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: hint })
4769
4956
  ] });
4770
4957
  }
4958
+ function PromptRefPicker({
4959
+ id,
4960
+ subject,
4961
+ name,
4962
+ label,
4963
+ prompts,
4964
+ promptsLoading,
4965
+ disabled,
4966
+ onChange
4967
+ }) {
4968
+ const known = prompts.find((entry) => entry.name === name);
4969
+ const unlisted = name !== "" && !known;
4970
+ const orphaned = unlisted && !promptsLoading;
4971
+ const labels = known?.labels.length ? known.labels : [DEFAULT_PROMPT_LABEL];
4972
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4973
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "Prompt Langfuse" }),
4974
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
4975
+ /* @__PURE__ */ jsxRuntime.jsx(
4976
+ uiSdk.Select,
4977
+ {
4978
+ "aria-label": `Prompt \u2014 ${subject}`,
4979
+ value: name,
4980
+ onValueChange: (next) => onChange(next, DEFAULT_PROMPT_LABEL),
4981
+ items: [
4982
+ ...unlisted ? [{ value: name, label: orphaned ? `${name} \u2014 introuvable dans Langfuse` : name }] : [],
4983
+ ...prompts.map((entry) => ({ value: entry.name, label: entry.name }))
4984
+ ],
4985
+ disabled: disabled || promptsLoading
4986
+ }
4987
+ ),
4988
+ /* @__PURE__ */ jsxRuntime.jsx(
4989
+ uiSdk.Select,
4990
+ {
4991
+ "aria-label": `Version du prompt \u2014 ${subject}`,
4992
+ value: labels.includes(label) ? label : "",
4993
+ onValueChange: (next) => onChange(name, next),
4994
+ items: labels.map((entry) => ({ value: entry, label: entry })),
4995
+ disabled: disabled || promptsLoading || name === ""
4996
+ }
4997
+ )
4998
+ ] }),
4999
+ name === "" && !promptsLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-destructive", children: "Aucun prompt choisi \u2014 cette \xE9tape ne peut pas s'ex\xE9cuter tant qu'elle n'en d\xE9signe pas un." }),
5000
+ orphaned && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-sm text-destructive", children: [
5001
+ "\xAB ",
5002
+ name,
5003
+ " \xBB n'est pas dans le catalogue de cette app \u2014 le prochain traitement \xE9chouera tant que ce prompt n'est pas r\xE9tabli ou remplac\xE9."
5004
+ ] }),
5005
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
5006
+ "Le label suit les promotions faites dans Langfuse : promouvoir une nouvelle version sous \xAB",
5007
+ " ",
5008
+ label,
5009
+ " \xBB la met en service sans repasser ici."
5010
+ ] })
5011
+ ] });
5012
+ }
4771
5013
  var PERCENT = 100;
4772
5014
  function PipelineNodesForm({
4773
5015
  value,
@@ -5036,51 +5278,19 @@ function StepPromptField({
5036
5278
  if (stepUsesAgentPrompt(step2.key)) {
5037
5279
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: step2.key === "revise" ? "Cette \xE9tape relance l'agent qui r\xE9dige avec l'objection du relecteur \u2014 elle n'a pas de prompt \xE0 choisir." : "Le prompt de cette \xE9tape est celui de l'agent qui r\xE9dige \u2014 il se choisit sur la page Agents." });
5038
5280
  }
5039
- const name = stepPromptName(settings);
5040
- const label = stepPromptLabel(settings);
5041
- const known = prompts.find((entry) => entry.name === name);
5042
- const unlisted = name !== "" && !known;
5043
- const orphaned = unlisted && !promptsLoading;
5044
- const labels = known?.labels.length ? known.labels : [DEFAULT_PROMPT_LABEL];
5045
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5046
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "Prompt Langfuse" }),
5047
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
5048
- /* @__PURE__ */ jsxRuntime.jsx(
5049
- uiSdk.Select,
5050
- {
5051
- "aria-label": `Prompt \u2014 ${step2.label}`,
5052
- value: name,
5053
- onValueChange: (next) => onPatch(promptPatch(next, DEFAULT_PROMPT_LABEL)),
5054
- items: [
5055
- ...unlisted ? [{ value: name, label: orphaned ? `${name} \u2014 introuvable dans Langfuse` : name }] : [],
5056
- ...prompts.map((entry) => ({ value: entry.name, label: entry.name }))
5057
- ],
5058
- disabled: disabled || promptsLoading
5059
- }
5060
- ),
5061
- /* @__PURE__ */ jsxRuntime.jsx(
5062
- uiSdk.Select,
5063
- {
5064
- "aria-label": `Version du prompt \u2014 ${step2.label}`,
5065
- value: labels.includes(label) ? label : "",
5066
- onValueChange: (next) => onPatch(promptPatch(name, next)),
5067
- items: labels.map((entry) => ({ value: entry, label: entry })),
5068
- disabled: disabled || promptsLoading || name === ""
5069
- }
5070
- )
5071
- ] }),
5072
- name === "" && !promptsLoading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-destructive", children: "Aucun prompt choisi \u2014 cette \xE9tape ne peut pas s'ex\xE9cuter tant qu'elle n'en d\xE9signe pas un." }),
5073
- orphaned && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-sm text-destructive", children: [
5074
- "\xAB ",
5075
- name,
5076
- " \xBB n'est pas dans le catalogue de cette app \u2014 le prochain traitement \xE9chouera tant que ce prompt n'est pas r\xE9tabli ou remplac\xE9."
5077
- ] }),
5078
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
5079
- "Le label suit les promotions faites dans Langfuse : promouvoir une nouvelle version sous \xAB ",
5080
- label,
5081
- " \xBB la met en service sans repasser ici."
5082
- ] })
5083
- ] });
5281
+ return /* @__PURE__ */ jsxRuntime.jsx(
5282
+ PromptRefPicker,
5283
+ {
5284
+ id,
5285
+ subject: step2.label,
5286
+ name: stepPromptName(settings),
5287
+ label: stepPromptLabel(settings),
5288
+ prompts,
5289
+ promptsLoading,
5290
+ disabled,
5291
+ onChange: (name, label) => onPatch(promptPatch(name, label))
5292
+ }
5293
+ );
5084
5294
  }
5085
5295
  function useIds(stepKey) {
5086
5296
  const base2 = react.useId();
@@ -5270,12 +5480,73 @@ function RecipeRow({ label, children }) {
5270
5480
  /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "break-all font-mono", children })
5271
5481
  ] });
5272
5482
  }
5483
+ var ACTION_OPTIONS = [
5484
+ { value: "disabled", label: "D\xE9sactiv\xE9 \u2014 r\xE9pondre \xE0 tous les messages" },
5485
+ { value: "tag", label: "Poser un tag \u2014 un humain repasse via une vue Gorgias" },
5486
+ { value: "close", label: "Fermer le ticket dans Gorgias, sans tag" }
5487
+ ];
5488
+ function ConversationEndCard({
5489
+ form,
5490
+ set,
5491
+ canWrite,
5492
+ prompts,
5493
+ promptsLoading
5494
+ }) {
5495
+ const end = readConversationEnd(form);
5496
+ const tag = typeof form.conversationEndTag === "string" ? form.conversationEndTag : DEFAULT_CONVERSATION_END_TAG;
5497
+ return /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "conversation-end", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
5498
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Fin de conversation" }),
5499
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Sur un message qui n\u2019appelle aucune r\xE9ponse (\xAB merci \xBB, \xE9moji seul, \xAB c\u2019est r\xE9gl\xE9 \xBB), premier message compris, l\u2019app n\u2019envoie jamais de r\xE9ponse : elle pose le tag ou ferme le ticket, et annule un brouillon rest\xE9 ouvert. Dans le doute l\u2019app r\xE9pond. Un ticket repris par un humain n\u2019est jamais touch\xE9." }),
5500
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5501
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "conversationEndAction", className: "mb-1 block text-sm font-medium", children: "Action de fin de conversation" }),
5502
+ /* @__PURE__ */ jsxRuntime.jsx(
5503
+ uiSdk.Select,
5504
+ {
5505
+ "aria-label": "Action de fin de conversation",
5506
+ value: end.action,
5507
+ onValueChange: (value) => set("conversationEndAction", value),
5508
+ items: ACTION_OPTIONS,
5509
+ disabled: !canWrite
5510
+ }
5511
+ )
5512
+ ] }),
5513
+ end.action === "tag" && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5514
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "conversationEndTag", className: "mb-1 block text-sm font-medium", children: "Tag de fin de conversation" }),
5515
+ /* @__PURE__ */ jsxRuntime.jsx(
5516
+ uiSdk.Input,
5517
+ {
5518
+ id: "conversationEndTag",
5519
+ value: tag,
5520
+ onChange: (e) => set("conversationEndTag", e.target.value),
5521
+ disabled: !canWrite
5522
+ }
5523
+ ),
5524
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Retir\xE9 automatiquement quand le client r\xE9\xE9crit avec une demande. Cr\xE9ez une vue Gorgias sur ce tag pour repasser sur ces tickets." })
5525
+ ] }),
5526
+ end.action !== "disabled" && /* @__PURE__ */ jsxRuntime.jsx(
5527
+ PromptRefPicker,
5528
+ {
5529
+ id: "conversationEndPrompt",
5530
+ subject: "Fin de conversation",
5531
+ name: end.prompt?.name ?? "",
5532
+ label: end.prompt?.label ?? DEFAULT_PROMPT_LABEL,
5533
+ prompts,
5534
+ promptsLoading,
5535
+ disabled: !canWrite,
5536
+ onChange: (name, label) => set("conversationEndPrompt", { name, label })
5537
+ }
5538
+ )
5539
+ ] }) });
5540
+ }
5273
5541
  var WHATSAPP_MODE_LABELS = {
5274
5542
  escalate_only: "Escalade uniquement",
5275
5543
  draft_only: "Brouillon uniquement",
5276
5544
  auto_reply: "R\xE9ponse automatique"
5277
5545
  };
5278
- var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({ value, label: WHATSAPP_MODE_LABELS[value] }));
5546
+ var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({
5547
+ value,
5548
+ label: WHATSAPP_MODE_LABELS[value]
5549
+ }));
5279
5550
  function field(value) {
5280
5551
  return typeof value === "string" ? value : "";
5281
5552
  }
@@ -5294,7 +5565,10 @@ function parseList(value) {
5294
5565
  function describeConnection(connections) {
5295
5566
  if (connections === void 0) return { text: "Chargement\u2026", tone: "muted" };
5296
5567
  if (connections === null) {
5297
- return { text: "Ind\xE9termin\xE9e \u2014 les connexions de l\u2019instance n\u2019ont pas pu \xEAtre lues.", tone: "muted" };
5568
+ return {
5569
+ text: "Ind\xE9termin\xE9e \u2014 les connexions de l\u2019instance n\u2019ont pas pu \xEAtre lues.",
5570
+ tone: "muted"
5571
+ };
5298
5572
  }
5299
5573
  if (connections.length === 0) {
5300
5574
  return {
@@ -5311,13 +5585,17 @@ function describeConnection(connections) {
5311
5585
  tone: "error"
5312
5586
  };
5313
5587
  }
5314
- return { text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`, tone: "normal" };
5588
+ return {
5589
+ text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`,
5590
+ tone: "normal"
5591
+ };
5315
5592
  }
5316
5593
  function SettingsWarnings({ warnings }) {
5317
5594
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: warnings.map((warning) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-status-pending", children: warning.message }, warning.key)) });
5318
5595
  }
5319
5596
  function SettingsPage() {
5320
5597
  const { appSlug, role } = uiSdk.useAppContext();
5598
+ const pageHref = uiSdk.useAppPageHref();
5321
5599
  const canWrite = canWriteForRole(role);
5322
5600
  const api = uiSdk.useAppApi();
5323
5601
  const toast = uiSdk.useToast();
@@ -5340,7 +5618,12 @@ function SettingsPage() {
5340
5618
  react.useEffect(() => {
5341
5619
  if (wasSavingRef.current && !isSaving) {
5342
5620
  if (saveError === void 0) toast({ title: "R\xE9glages enregistr\xE9s.", variant: "success" });
5343
- else toast({ title: "\xC9chec de l'enregistrement", description: describeApiError(saveError), variant: "error" });
5621
+ else
5622
+ toast({
5623
+ title: "\xC9chec de l'enregistrement",
5624
+ description: describeApiError(saveError),
5625
+ variant: "error"
5626
+ });
5344
5627
  }
5345
5628
  wasSavingRef.current = isSaving;
5346
5629
  }, [isSaving, saveError, toast]);
@@ -5351,7 +5634,9 @@ function SettingsPage() {
5351
5634
  (async () => {
5352
5635
  let checkAppSlugs = [];
5353
5636
  try {
5354
- const installed = await apiRef.current.get("/platform/apps/installed");
5637
+ const installed = await apiRef.current.get(
5638
+ "/platform/apps/installed"
5639
+ );
5355
5640
  checkAppSlugs = installed.apps.map((a) => a.slug).filter((slug) => slug !== appSlug);
5356
5641
  if (!cancelled) setInstalledAppsUnavailable(false);
5357
5642
  } catch {
@@ -5359,7 +5644,9 @@ function SettingsPage() {
5359
5644
  if (!cancelled) setInstalledAppsUnavailable(true);
5360
5645
  }
5361
5646
  try {
5362
- const result = await apiRef.current.invoke("list-gorgias-views", { checkAppSlugs });
5647
+ const result = await apiRef.current.invoke("list-gorgias-views", {
5648
+ checkAppSlugs
5649
+ });
5363
5650
  if (!cancelled) {
5364
5651
  setViews(result.views);
5365
5652
  setUncheckedAppSlugs(result.uncheckedAppSlugs);
@@ -5590,12 +5877,30 @@ function SettingsPage() {
5590
5877
  ["appScopeTag", "Tag des tickets de l'application"]
5591
5878
  ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5592
5879
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
5593
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
5880
+ /* @__PURE__ */ jsxRuntime.jsx(
5881
+ uiSdk.Input,
5882
+ {
5883
+ id: key,
5884
+ value: field(form[key]),
5885
+ onChange: (e) => set(key, e.target.value),
5886
+ disabled: !canWrite
5887
+ }
5888
+ )
5594
5889
  ] }, key)),
5595
5890
  /* @__PURE__ */ jsxRuntime.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." }),
5596
5891
  /* @__PURE__ */ jsxRuntime.jsx(SettingsWarnings, { warnings: tagWarnings })
5597
5892
  ] }) }),
5598
5893
  /* @__PURE__ */ jsxRuntime.jsx(FollowupWebhookCard, {}),
5894
+ /* @__PURE__ */ jsxRuntime.jsx(
5895
+ ConversationEndCard,
5896
+ {
5897
+ form,
5898
+ set,
5899
+ canWrite,
5900
+ prompts: promptCatalogue.prompts,
5901
+ promptsLoading: promptCatalogue.isLoading
5902
+ }
5903
+ ),
5599
5904
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
5600
5905
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
5601
5906
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -5736,7 +6041,7 @@ function SettingsPage() {
5736
6041
  "Catalogue de prompts indisponible \u2014 ",
5737
6042
  describeApiError(promptCatalogue.error)
5738
6043
  ] }),
5739
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
6044
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: pageHref("graph-canvas"), children: "Visualiser dans Graphe" })
5740
6045
  ] }) }),
5741
6046
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
5742
6047
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
@@ -5804,11 +6109,6 @@ var NODE_EXITS = {
5804
6109
  ],
5805
6110
  triage: [
5806
6111
  { key: "triage-fallback", condition: "classification de repli", outcome: "triaged_only" },
5807
- {
5808
- key: "triage-closed",
5809
- condition: "le dernier message client cl\xF4t la conversation",
5810
- outcome: "no_reply_needed"
5811
- },
5812
6112
  {
5813
6113
  key: "triage-whatsapp-gate",
5814
6114
  condition: "r\xE8gle de canal WhatsApp (STOP ou pas notre tour)",
@@ -7377,6 +7677,8 @@ function parseRunResult(result) {
7377
7677
  };
7378
7678
  }
7379
7679
  function describeRunDecision(result, mode) {
7680
+ if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed")
7681
+ return "Conversation finie \u2014 aucune r\xE9ponse.";
7380
7682
  if (result.stoppedAt !== null) return `Arr\xEAt en ${result.stoppedAt}.`;
7381
7683
  const category = result.categoryName ? ` (cat\xE9gorie \xAB ${result.categoryName} \xBB)` : "";
7382
7684
  if (result.outcome === "sent") {
@@ -7388,6 +7690,7 @@ function describeRunDecision(result, mode) {
7388
7690
  function FollowupWebhookCard2() {
7389
7691
  const api = uiSdk.useAppApi();
7390
7692
  const { appSlug } = uiSdk.useAppContext();
7693
+ const pageHref = uiSdk.useAppPageHref();
7391
7694
  const toast = uiSdk.useToast();
7392
7695
  const ticketId = react.useId();
7393
7696
  const [ticket, setTicket] = react.useState("");
@@ -7417,7 +7720,9 @@ function FollowupWebhookCard2() {
7417
7720
  setIsTesting(true);
7418
7721
  setTest(null);
7419
7722
  try {
7420
- setTest(await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode }));
7723
+ setTest(
7724
+ await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode })
7725
+ );
7421
7726
  } catch (err) {
7422
7727
  toast({ title: "\xC9chec du test", description: describeInvokeError(err), variant: "error" });
7423
7728
  } finally {
@@ -7445,9 +7750,36 @@ function FollowupWebhookCard2() {
7445
7750
  className: "max-w-48"
7446
7751
  }
7447
7752
  ),
7448
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("diagnostic"), disabled, children: "Diagnostic" }),
7449
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("generate"), disabled, children: "G\xE9n\xE9rer sans envoyer" }),
7450
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => setConfirmingRealRun(true), disabled, children: "Ex\xE9cution r\xE9elle" })
7753
+ /* @__PURE__ */ jsxRuntime.jsx(
7754
+ uiSdk.Button,
7755
+ {
7756
+ type: "button",
7757
+ variant: "outline",
7758
+ onClick: () => void runTest("diagnostic"),
7759
+ disabled,
7760
+ children: "Diagnostic"
7761
+ }
7762
+ ),
7763
+ /* @__PURE__ */ jsxRuntime.jsx(
7764
+ uiSdk.Button,
7765
+ {
7766
+ type: "button",
7767
+ variant: "outline",
7768
+ onClick: () => void runTest("generate"),
7769
+ disabled,
7770
+ children: "G\xE9n\xE9rer sans envoyer"
7771
+ }
7772
+ ),
7773
+ /* @__PURE__ */ jsxRuntime.jsx(
7774
+ uiSdk.Button,
7775
+ {
7776
+ type: "button",
7777
+ variant: "outline",
7778
+ onClick: () => setConfirmingRealRun(true),
7779
+ disabled,
7780
+ children: "Ex\xE9cution r\xE9elle"
7781
+ }
7782
+ )
7451
7783
  ] }),
7452
7784
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
7453
7785
  "Le diagnostic \xE9value les m\xEAmes conditions que le webhook, sans aucun effet de bord.",
@@ -7487,7 +7819,13 @@ function FollowupWebhookCard2() {
7487
7819
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap rounded border bg-muted/30 p-2 text-xs", children: draftText })
7488
7820
  ] }),
7489
7821
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs", children: [
7490
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/tickets?ticket=${encodeURIComponent(runResult.ticketId ?? test.ticketId)}`, children: "Ouvrir la fiche du ticket" }),
7822
+ /* @__PURE__ */ jsxRuntime.jsx(
7823
+ uiSdk.Link,
7824
+ {
7825
+ href: pageHref("tickets", { ticket: runResult.ticketId ?? test.ticketId }),
7826
+ children: "Ouvrir la fiche du ticket"
7827
+ }
7828
+ ),
7491
7829
  runResult.ticketUrl !== null && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7492
7830
  " \xB7 ",
7493
7831
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: runResult.ticketUrl, target: "_blank", rel: "noopener noreferrer", children: "Ouvrir dans Gorgias" })
@@ -7508,8 +7846,7 @@ function FollowupWebhookCard2() {
7508
7846
  description: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7509
7847
  "Le ticket ",
7510
7848
  ticket.trim(),
7511
- " va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
7512
- " ",
7849
+ " va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et ",
7513
7850
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "envoi r\xE9el au client" }),
7514
7851
  " si sa cat\xE9gorie est en r\xE9ponse automatique. Pour tout voir sans rien envoyer, utilisez \xAB G\xE9n\xE9rer sans envoyer \xBB."
7515
7852
  ] }),