@apotech-os/support-kit 9.0.0 → 10.1.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
@@ -124,7 +124,9 @@ function toTriageDecision(record) {
124
124
  error: data.error ?? null,
125
125
  runId: data.runId ?? null,
126
126
  subjectRenamed: data.subjectRenamed ?? false,
127
- origin: toDecisionOrigin(data.origin)
127
+ origin: toDecisionOrigin(data.origin),
128
+ langfuseTraceId: data.langfuseTraceId ?? null,
129
+ langfuseObservationIds: Array.isArray(data.langfuseObservationIds) ? data.langfuseObservationIds.filter((id) => typeof id === "string" && id !== "") : []
128
130
  };
129
131
  }
130
132
  function toVerdict(raw) {
@@ -136,6 +138,11 @@ function toVerdict(raw) {
136
138
  const status = data.status === "success" || data.status === "error" ? data.status : "error";
137
139
  return { verdict, confidence, reason: reason2, status };
138
140
  }
141
+ function toEvaluationObservationId(raw) {
142
+ if (raw === null || typeof raw !== "object") return null;
143
+ const observationId = raw.observationId;
144
+ return typeof observationId === "string" && observationId !== "" ? observationId : null;
145
+ }
139
146
  function toGeneratedResponse(record) {
140
147
  const data = record.data;
141
148
  return {
@@ -158,6 +165,7 @@ function toGeneratedResponse(record) {
158
165
  tracedInput: Array.isArray(data.tracedInput) ? data.tracedInput : [],
159
166
  sources: Array.isArray(data.sources) ? data.sources : [],
160
167
  verdict: toVerdict(data.verdict),
168
+ evaluationObservationId: toEvaluationObservationId(data.verdict),
161
169
  guardrailHits: data.guardrailHits ?? [],
162
170
  guardrailHitsReconstructedAt: data.guardrailHitsReconstructedAt ?? null,
163
171
  outcome: isOutcome(data.outcome) ? data.outcome : null,
@@ -190,6 +198,8 @@ function toResponseComparison(record) {
190
198
  diff: data.diff ?? null
191
199
  };
192
200
  }
201
+ JSON.stringify([{ field: "decidedAt", direction: "desc" }]);
202
+ JSON.stringify([{ field: "generatedAt", direction: "desc" }]);
193
203
  function useRecordList(objectKey, query, mapper) {
194
204
  const { appSlug } = uiSdk.useAppContext();
195
205
  const api = uiSdk.useAppApi();
@@ -331,7 +341,7 @@ function toNameMap(rows) {
331
341
  return new Map(rows.map((r) => [r.id, r.name]));
332
342
  }
333
343
 
334
- // src/ui/dashboard/dashboard-stats.ts
344
+ // src/domain/dashboard-stats.ts
335
345
  function sumCounts(rows, countField = "count") {
336
346
  return rows.reduce((sum, row) => sum + (Number(row[countField]) || 0), 0);
337
347
  }
@@ -348,8 +358,11 @@ function countFailed(rows) {
348
358
  return sumCounts(rows.filter((row) => row["status"] === "failed"));
349
359
  }
350
360
  var HUMAN_OUTCOMES = /* @__PURE__ */ new Set(["needs_human", "guardrail_hold", "escalated", "awaiting_approval"]);
351
- function isUnautomatedTriage(row) {
352
- return row["escalated"] === "true" || row["status"] === "error";
361
+ function isUnautomatedTriage(decision) {
362
+ return decision.escalated === "true" || decision.escalated === true || decision.status === "error";
363
+ }
364
+ function countOf(row) {
365
+ return Number(row["count"]) || 0;
353
366
  }
354
367
  function outcomeOf(row) {
355
368
  const status = row["status"];
@@ -369,10 +382,10 @@ function foldOutcomes(rows, triageRows = []) {
369
382
  const totals = { ...EMPTY_TOTALS };
370
383
  for (const row of rows) {
371
384
  const outcome = outcomeOf(row);
372
- if (outcome !== null) totals[outcome] += Number(row["count"]) || 0;
385
+ if (outcome !== null) totals[outcome] += countOf(row);
373
386
  }
374
387
  for (const row of triageRows) {
375
- if (isUnautomatedTriage(row)) totals.human += Number(row["count"]) || 0;
388
+ if (isUnautomatedTriage(row)) totals.human += countOf(row);
376
389
  }
377
390
  return totals;
378
391
  }
@@ -395,10 +408,10 @@ function foldDailyOutcomes(rows, triageRows = []) {
395
408
  for (const row of rows) {
396
409
  const outcome = outcomeOf(row);
397
410
  if (outcome === null) continue;
398
- totalsFor(bucketDay(row))[outcome] += Number(row["count"]) || 0;
411
+ totalsFor(bucketDay(row))[outcome] += countOf(row);
399
412
  }
400
413
  for (const row of triageRows) {
401
- if (isUnautomatedTriage(row)) totalsFor(bucketDay(row)).human += Number(row["count"]) || 0;
414
+ if (isUnautomatedTriage(row)) totalsFor(bucketDay(row)).human += countOf(row);
402
415
  }
403
416
  return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, totals]) => ({
404
417
  day,
@@ -468,14 +481,14 @@ function foldHumanReasons(rows, triageRows = []) {
468
481
  const reasons = { blocked: 0, invalidated: 0, expired: 0, escalatedNoDraft: 0, failed: 0 };
469
482
  for (const row of rows) {
470
483
  if (outcomeOf(row) !== "human") continue;
471
- const count = Number(row["count"]) || 0;
484
+ const count = countOf(row);
472
485
  if (row["status"] === "invalidated") reasons.invalidated += count;
473
486
  else if (row["status"] === "expired") reasons.expired += count;
474
487
  else if (row["status"] === "failed") reasons.failed += count;
475
488
  else reasons.blocked += count;
476
489
  }
477
490
  for (const row of triageRows) {
478
- if (isUnautomatedTriage(row)) reasons.escalatedNoDraft += Number(row["count"]) || 0;
491
+ if (isUnautomatedTriage(row)) reasons.escalatedNoDraft += countOf(row);
479
492
  }
480
493
  return reasons;
481
494
  }
@@ -501,7 +514,7 @@ function foldCategoryOutcomes(triageRows, responseRows, categoryNames, topN = CA
501
514
  for (const row of triageRows) {
502
515
  const bar = barFor(row["categoryId"]);
503
516
  if (bar === null) continue;
504
- const count = Number(row["count"]) || 0;
517
+ const count = countOf(row);
505
518
  bar.total += count;
506
519
  if (isUnautomatedTriage(row)) bar.human += count;
507
520
  }
@@ -509,7 +522,7 @@ function foldCategoryOutcomes(triageRows, responseRows, categoryNames, topN = CA
509
522
  const bar = barFor(row["categoryId"]);
510
523
  if (bar === null) continue;
511
524
  const outcome = outcomeOf(row);
512
- const count = Number(row["count"]) || 0;
525
+ const count = countOf(row);
513
526
  if (outcome === "auto") bar.auto += count;
514
527
  else if (outcome === "human") bar.human += count;
515
528
  else if (outcome === "noReplyNeeded") bar.noReply += count;
@@ -602,12 +615,11 @@ function AutonomyHero({
602
615
  sides.length > 0 && /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(HeroSide, { ...side }, side.label)) })
603
616
  ] }) });
604
617
  }
605
- var DASHBOARD_PRESETS = [
606
- { key: "last7", label: "7 derniers jours" },
607
- { key: "last30", label: "30 derniers jours" }
608
- ];
618
+
619
+ // src/domain/period.ts
609
620
  var WEEKLY_BUCKET_FROM_DAYS = 46;
610
621
  var DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
622
+ var MS_PER_DAY = 864e5;
611
623
  var EPOCH_ISO = "1970-01-01T00:00:00.000Z";
612
624
  function startOfDayIso(day) {
613
625
  return day !== void 0 && DAY_PATTERN.test(day) ? `${day}T00:00:00.000Z` : EPOCH_ISO;
@@ -619,22 +631,34 @@ function dayCount(bounds) {
619
631
  const from = Date.parse(bounds.fromIso);
620
632
  const to = Date.parse(bounds.toIso);
621
633
  if (Number.isNaN(from) || Number.isNaN(to)) return 0;
622
- return Math.max(1, Math.round((to - from) / 864e5));
634
+ return Math.max(1, Math.round((to - from) / MS_PER_DAY));
623
635
  }
624
- function periodBoundsOf(value) {
625
- const current = {
626
- fromIso: startOfDayIso(value.range.from),
627
- toIso: endOfDayIso(value.range.to)
628
- };
629
- const compare = value.compare === "none" ? void 0 : value.compareRange ?? uiSdk.comparisonRange(value.preset, value.range, value.compare);
636
+ function boundsOf(range) {
637
+ return { fromIso: startOfDayIso(range.from), toIso: endOfDayIso(range.to) };
638
+ }
639
+ function periodBoundsOf({ range, compareRange }) {
640
+ const current = boundsOf(range);
630
641
  const days = dayCount(current);
631
642
  return {
632
643
  current,
633
- previous: compare === void 0 ? null : { fromIso: startOfDayIso(compare.from), toIso: endOfDayIso(compare.to) },
644
+ previous: compareRange === void 0 ? null : boundsOf(compareRange),
634
645
  days,
635
646
  interval: days >= WEEKLY_BUCKET_FROM_DAYS ? "week" : "day"
636
647
  };
637
648
  }
649
+
650
+ // src/ui/dashboard/period.ts
651
+ var DASHBOARD_PRESETS = [
652
+ { key: "last7", label: "7 derniers jours" },
653
+ { key: "last30", label: "30 derniers jours" }
654
+ ];
655
+ function periodBoundsOf2(value) {
656
+ const compareRange = value.compare === "none" ? void 0 : value.compareRange ?? uiSdk.comparisonRange(value.preset, value.range, value.compare);
657
+ return periodBoundsOf({
658
+ range: value.range,
659
+ ...compareRange === void 0 ? {} : { compareRange }
660
+ });
661
+ }
638
662
  function defaultPeriod(today = /* @__PURE__ */ new Date()) {
639
663
  const to = today.toISOString().slice(0, 10);
640
664
  const start = new Date(today);
@@ -695,6 +719,8 @@ function StackedLegend({ segments }) {
695
719
  segment.label
696
720
  ] }, segment.key)) });
697
721
  }
722
+
723
+ // src/domain/dashboard-queries.ts
698
724
  var OUTCOME_METRICS = [{ op: "count", as: "count" }];
699
725
  var OUTCOME_GROUP_BY = ["status", "autoSendDecision", "outcome"];
700
726
  var CATEGORY_OUTCOME_GROUP_BY = ["categoryId", "status", "autoSendDecision", "outcome"];
@@ -725,7 +751,7 @@ function DashboardPage() {
725
751
  const { settings } = uiSdk.useAppSettings();
726
752
  const timezone = settings?.statsTimezone ?? "UTC";
727
753
  const periodKey = JSON.stringify(period);
728
- const bounds = react.useMemo(() => periodBoundsOf(JSON.parse(periodKey)), [periodKey]);
754
+ const bounds = react.useMemo(() => periodBoundsOf2(JSON.parse(periodKey)), [periodKey]);
729
755
  const currentFilter = { generatedAt: { gte: bounds.current.fromIso, lte: bounds.current.toIso } };
730
756
  const previousBounds = bounds.previous ?? bounds.current;
731
757
  const {
@@ -1060,6 +1086,7 @@ function idempotencyKeyFor(operation, payload) {
1060
1086
  // src/ui/shared/settings-issue-labels.ts
1061
1087
  var SETTINGS_ISSUE_LABELS = {
1062
1088
  sourceViewId: "Vue Gorgias source requise \u2014 choisissez la vue que cette app poss\xE8de.",
1089
+ appScopeTag: "Tag des tickets de l'application requis \u2014 c'est lui qui rattache un ticket \xE0 cette app.",
1063
1090
  nodes: "nodes.triage doit \xEAtre configur\xE9 \u2014 une \xE9tape de triage \xE0 null ne triagerait rien.",
1064
1091
  nodePrompt: "Chaque \xE9tape active doit d\xE9signer un prompt Langfuse \u2014 sans prompt, l'\xE9tape n'a rien \xE0 dire au mod\xE8le.",
1065
1092
  senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB)."
@@ -1080,6 +1107,7 @@ var EXACT_MESSAGE_LABELS = {
1080
1107
  };
1081
1108
  var SETTINGS_VALIDATION_MESSAGE_LABELS = {
1082
1109
  "sourceViewId is required \u2014 pick the Gorgias view this app owns.": SETTINGS_ISSUE_LABELS.sourceViewId,
1110
+ "appScopeTag is required \u2014 set the tag that marks this app's tickets.": SETTINGS_ISSUE_LABELS.appScopeTag,
1083
1111
  "nodes.triage must be configured \u2014 a null triage step would triage nothing.": SETTINGS_ISSUE_LABELS.nodes,
1084
1112
  "senderEmail is required when autoSendEnabled is on, unless whatsappMode is 'auto_reply'.": SETTINGS_ISSUE_LABELS.senderEmail
1085
1113
  };
@@ -1752,7 +1780,7 @@ function toEvaluateNode(node) {
1752
1780
  };
1753
1781
  }
1754
1782
 
1755
- // src/ui/tickets/delivery-policy.ts
1783
+ // src/settings/delivery-policy.ts
1756
1784
  function evaluateNode(settings) {
1757
1785
  const node = settings.nodes?.evaluate;
1758
1786
  return node && typeof node === "object" ? node : null;
@@ -1971,88 +1999,77 @@ function channelLabel(channel) {
1971
1999
  return CHANNEL_LABELS[channel] ?? channel;
1972
2000
  }
1973
2001
 
1974
- // src/ui/tickets/timeline.ts
1975
- var TITLES = {
1976
- received: "Re\xE7u",
1977
- prompt: "Prompt envoy\xE9",
1978
- triage: "Triage",
1979
- draft: "R\xE9daction",
1980
- evaluation: "\xC9valuation",
1981
- delivery: "Envoi",
1982
- correction: "Corrig\xE9 par un humain"
1983
- };
1984
- function buildTimeline(input) {
2002
+ // src/domain/timeline.ts
2003
+ var GENERIC_NOT_SENT = { code: "generic_not_sent" };
2004
+ function buildTimelineSteps(facts) {
1985
2005
  return [
1986
- step("received", receivedReason(input)),
1987
- step("prompt", promptReason(input)),
1988
- step("triage", triageReason(input)),
1989
- step("draft", draftReason(input)),
1990
- step("evaluation", evaluationReason(input)),
1991
- step("delivery", deliveryReason(input)),
1992
- step("correction", correctionReason(input))
2006
+ step("received", receivedReason(facts)),
2007
+ step("prompt", promptReason(facts)),
2008
+ step("triage", triageReason(facts)),
2009
+ step("draft", draftReason(facts)),
2010
+ step("evaluation", evaluationReason(facts)),
2011
+ step("delivery", deliveryReason(facts)),
2012
+ step("correction", correctionReason(facts))
1993
2013
  ];
1994
2014
  }
1995
2015
  function step(key, reason2) {
1996
- return reason2 === null ? { key, title: TITLES[key], reached: true } : { key, title: TITLES[key], reached: false, reason: reason2 };
2016
+ return reason2 === null ? { key, reached: true } : { key, reached: false, reason: reason2 };
1997
2017
  }
1998
- function receivedReason({ conversation, conversationLoading }) {
2018
+ function receivedReason({
2019
+ conversation,
2020
+ conversationLoading
2021
+ }) {
1999
2022
  if (conversation) return null;
2000
- if (conversationLoading) return "Lecture de la conversation en cours\u2026";
2001
- return "Aucune conversation disponible : rien n'a \xE9t\xE9 captur\xE9 au moment du run, et le fil n'a pas pu \xEAtre relu chez Gorgias.";
2023
+ return conversationLoading ? { code: "conversation_loading" } : { code: "conversation_unavailable" };
2002
2024
  }
2003
2025
  function promptReason({ conversation, job, decision }) {
2004
- if (!job) return noResponseCause(decision);
2026
+ if (!job) return noResponseReason(decision);
2005
2027
  if (conversation?.systemPrompt) return null;
2006
- return "Le prompt rendu n'a pas \xE9t\xE9 captur\xE9 sur cette r\xE9ponse \u2014 les r\xE9ponses \xE9crites avant cette capture n'en gardent que le nom et la version.";
2028
+ return { code: "prompt_not_captured" };
2007
2029
  }
2008
2030
  function triageReason({ decision }) {
2009
- if (decision.status === "error" && !decision.tag) {
2010
- return decision.error ?? "Le triage a \xE9chou\xE9 sans produire de classification.";
2011
- }
2031
+ if (decision.status === "error" && !decision.tag)
2032
+ return { code: "triage_failed", error: decision.error ?? null };
2012
2033
  return null;
2013
2034
  }
2014
2035
  function draftReason({ job, decision }) {
2015
- if (!job) return noResponseCause(decision);
2036
+ if (!job) return noResponseReason(decision);
2016
2037
  if (job.responseText) return null;
2017
- if (job.status === "pending") return "La r\xE9daction n'a pas encore tourn\xE9.";
2018
- return job.error ?? "La r\xE9daction n'a produit aucun texte.";
2038
+ if (job.status === "pending") return { code: "draft_pending" };
2039
+ return { code: "draft_empty", error: job.error ?? null };
2019
2040
  }
2020
2041
  function evaluationReason({ job, decision }) {
2021
- if (!job) return noResponseCause(decision);
2042
+ if (!job) return noResponseReason(decision);
2022
2043
  if (job.verdict) return null;
2023
- if (job.status === "pending") return "L'\xE9valuation n'a pas encore tourn\xE9.";
2024
- return "Aucun verdict : l'\xE9valuation n'a pas \xE9t\xE9 atteinte.";
2044
+ return job.status === "pending" ? { code: "evaluation_pending" } : { code: "evaluation_missing" };
2025
2045
  }
2026
- function deliveryReason(input) {
2027
- const { job, decision } = input;
2028
- if (!job) return noResponseCause(decision);
2046
+ function deliveryReason(facts) {
2047
+ const { job, decision } = facts;
2048
+ if (!job) return noResponseReason(decision);
2029
2049
  switch (job.status) {
2030
2050
  case "sent":
2031
2051
  return null;
2032
2052
  case "pending":
2033
- return "La r\xE9ponse est encore en file.";
2053
+ return { code: "reply_queued" };
2034
2054
  case "ready":
2035
- return notSentReason(input);
2055
+ return notSentReason(facts, job);
2036
2056
  case "expired": {
2037
- const why = notSentReason(input);
2038
- return why === GENERIC_NOT_SENT ? "La r\xE9ponse a expir\xE9 avant son envoi." : `La r\xE9ponse a expir\xE9 avant son envoi. ${why}`;
2057
+ const why = notSentReason(facts, job);
2058
+ return { code: "expired", detail: why.code === "generic_not_sent" ? null : why };
2039
2059
  }
2040
2060
  case "failed":
2041
- return job.error ?? "La r\xE9ponse a \xE9chou\xE9 avant son envoi.";
2061
+ return { code: "delivery_failed", error: job.error ?? null };
2042
2062
  case "superseded":
2043
- return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
2063
+ return { code: "superseded" };
2044
2064
  case "test_draft":
2045
- return "Brouillon d'essai \u2014 jamais envoy\xE9.";
2065
+ return { code: "test_draft" };
2046
2066
  default:
2047
- return `La r\xE9ponse n'a pas \xE9t\xE9 envoy\xE9e (statut : ${job.status}).`;
2067
+ return { code: "unexpected_status", status: job.status };
2048
2068
  }
2049
2069
  }
2050
- var GENERIC_NOT_SENT = "R\xE9dig\xE9e, en attente d'un envoi.";
2051
- function notSentReason({ job, policy, category }) {
2052
- if (!job) return GENERIC_NOT_SENT;
2053
- if (job.autoSendDecision === "hold" && job.guardrailHits.length === 0) {
2054
- return "Mise en attente d\xE9finitive : cette r\xE9ponse ne repartira pas toute seule (refus d\u2019approbation, contr\xF4le de derni\xE8re minute, ou envoi interrompu puis repris).";
2055
- }
2070
+ function notSentReason({ policy, category }, job) {
2071
+ if (job.autoSendDecision === "hold" && job.guardrailHits.length === 0)
2072
+ return { code: "held_permanently" };
2056
2073
  if (job.autoSendDecision === "hold") return guardrailReason(job);
2057
2074
  switch (job.outcome) {
2058
2075
  case "needs_human":
@@ -2060,11 +2077,11 @@ function notSentReason({ job, policy, category }) {
2060
2077
  case "guardrail_hold":
2061
2078
  return guardrailReason(job);
2062
2079
  case "awaiting_approval":
2063
- return "En attente d'une approbation humaine avant envoi.";
2080
+ return { code: "awaiting_approval" };
2064
2081
  case "ready":
2065
2082
  return notEligibleReason(job, policy, category);
2066
2083
  case "sent":
2067
- return "Mode essai : la r\xE9ponse aurait \xE9t\xE9 envoy\xE9e, mais rien n'a \xE9t\xE9 transmis au client.";
2084
+ return { code: "trial_mode" };
2068
2085
  case null:
2069
2086
  return legacyNotSentReason(job, policy, category);
2070
2087
  default:
@@ -2073,41 +2090,36 @@ function notSentReason({ job, policy, category }) {
2073
2090
  }
2074
2091
  function notSendableReason(job, policy) {
2075
2092
  const verdict = job.verdict;
2076
- if (!verdict) return "L'\xE9valuation n'a produit aucun verdict \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
2077
- if (verdict.status === "error") return "L'\xE9valuation a \xE9chou\xE9 \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
2078
- if (verdict.verdict === "hold") return "Le juge a retenu la r\xE9ponse (verdict \xAB Retenir \xBB) \u2014 elle demande une relecture.";
2079
- if (!policy) return "Le juge n'a pas autoris\xE9 l'envoi automatique.";
2093
+ if (!verdict) return { code: "no_verdict" };
2094
+ if (verdict.status === "error") return { code: "evaluation_failed" };
2095
+ if (verdict.verdict === "hold") return { code: "judge_held" };
2096
+ if (!policy) return { code: "judge_not_authorized" };
2080
2097
  if ((verdict.confidence ?? 0) < policy.minConfidence) {
2081
- return `Confiance de ${asPercent(verdict.confidence ?? 0)} %, sous le seuil de ${asPercent(policy.minConfidence)} % fix\xE9 sur l'\xE9tape \xC9valuation.`;
2082
- }
2083
- if (requiresFollowup(verdict.verdict) && !policy.followupSendable) {
2084
- return "Le juge a valid\xE9 la r\xE9ponse mais demand\xE9 un suivi humain (verdict \xAB Envoyer et escalader \xBB). L'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation : la r\xE9ponse n'est donc pas envoy\xE9e.";
2098
+ return {
2099
+ code: "below_confidence",
2100
+ confidence: verdict.confidence ?? 0,
2101
+ minConfidence: policy.minConfidence
2102
+ };
2085
2103
  }
2086
- return "Le juge n'a pas autoris\xE9 l'envoi automatique.";
2104
+ if (requiresFollowup(verdict.verdict) && !policy.followupSendable)
2105
+ return { code: "followup_not_sendable" };
2106
+ return { code: "judge_not_authorized" };
2087
2107
  }
2088
2108
  function notEligibleReason(job, policy, category) {
2089
2109
  if (!policy) return GENERIC_NOT_SENT;
2090
- if (!policy.evaluateConfigured) {
2091
- return "L'\xE9tape \xC9valuation est coup\xE9e : sans verdict, l'envoi automatique est impossible.";
2092
- }
2093
- if (!policy.autoSendEnabled) return "L'envoi automatique est d\xE9sactiv\xE9 dans les r\xE9glages.";
2094
- if (category && !category.autoReplyEnabled) {
2095
- return `La cat\xE9gorie \xAB ${category.name} \xBB n'a pas l'auto-r\xE9ponse activ\xE9e.`;
2096
- }
2110
+ if (!policy.evaluateConfigured) return { code: "evaluation_disabled" };
2111
+ if (!policy.autoSendEnabled) return { code: "auto_send_disabled" };
2112
+ if (category && !category.autoReplyEnabled)
2113
+ return { code: "category_auto_reply_off", categoryName: category.name };
2097
2114
  const isWhatsapp = job.channel === "whatsapp";
2098
- if (isWhatsapp && policy.whatsappMode === "draft_only") {
2099
- return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
2100
- }
2115
+ if (isWhatsapp && policy.whatsappMode === "draft_only") return { code: "whatsapp_draft_only" };
2101
2116
  if (job.ineligibleReason === "no_publication_path") {
2102
- const channel = job.sourceChannel ? ` ${channelLabel(job.sourceChannel)}` : "";
2103
- return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
2117
+ return { code: "no_publication_path", channel: job.sourceChannel || null };
2104
2118
  }
2105
2119
  if (isRestrictedChannel(job.sourceChannel, policy.autoSendChannels)) {
2106
- return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(job.sourceChannel ?? "")}. Le brouillon reste disponible pour un agent.`;
2107
- }
2108
- if (!policy.senderEmail && !isWhatsapp) {
2109
- return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
2120
+ return { code: "channel_not_enabled", channel: job.sourceChannel };
2110
2121
  }
2122
+ if (!policy.senderEmail && !isWhatsapp) return { code: "no_sender_address" };
2111
2123
  return GENERIC_NOT_SENT;
2112
2124
  }
2113
2125
  function isRestrictedChannel(sourceChannel, allowed) {
@@ -2116,40 +2128,153 @@ function isRestrictedChannel(sourceChannel, allowed) {
2116
2128
  return !allowed.includes(sourceChannel);
2117
2129
  }
2118
2130
  function guardrailReason(job) {
2119
- const [first, ...rest] = job.guardrailHits;
2120
- if (first === void 0) {
2121
- return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
2122
- }
2123
- const explanation = guardrailExplanation(first);
2124
- const head = `Garde-fou d\xE9clench\xE9 : ${guardrailHitLabel(first)}.`;
2125
- const others = rest.length > 0 ? ` \xC9galement d\xE9clench\xE9 : ${rest.map(guardrailHitLabel).join(", ")}.` : "";
2126
- return `${head}${explanation ? ` ${explanation}` : ""}${others}${reconstructionCaveat(job)}`;
2127
- }
2128
- function reconstructionCaveat(job) {
2129
- if (!job.guardrailHitsReconstructedAt) return "";
2130
- return " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)";
2131
+ if (job.guardrailHits.length === 0) return { code: "guardrail_unrecorded" };
2132
+ return {
2133
+ code: "guardrail",
2134
+ hits: [...job.guardrailHits],
2135
+ reconstructed: Boolean(job.guardrailHitsReconstructedAt)
2136
+ };
2131
2137
  }
2132
2138
  function legacyNotSentReason(job, policy, category) {
2133
2139
  if (job.guardrailHits.length > 0) return guardrailReason(job);
2134
2140
  const verdict = job.verdict;
2135
2141
  if (policy && verdict && verdict.status === "success" && requiresFollowup(verdict.verdict) && !policy.followupSendable) {
2136
- return "Probablement : le juge a valid\xE9 la r\xE9ponse en demandant un suivi humain, et l'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation. (R\xE9ponse ant\xE9rieure \xE0 l'enregistrement des sorties de run \u2014 lecture faite avec les r\xE9glages actuels.)";
2142
+ return { code: "legacy_followup_probable" };
2137
2143
  }
2138
- if (verdict && (verdict.status === "error" || verdict.verdict === "hold")) return notSendableReason(job, policy);
2144
+ if (verdict && (verdict.status === "error" || verdict.verdict === "hold"))
2145
+ return notSendableReason(job, policy);
2139
2146
  return notEligibleReason(job, policy, category);
2140
2147
  }
2141
- function asPercent(ratio) {
2142
- return Math.round(ratio * 100);
2143
- }
2144
2148
  function correctionReason({ comparisons }) {
2145
- if (comparisons.length > 0) return null;
2146
- return "Aucune correction captur\xE9e : l'agent n'a pas r\xE9\xE9crit de r\xE9ponse sur ce ticket.";
2149
+ return comparisons.length > 0 ? null : { code: "no_correction" };
2147
2150
  }
2148
- function noResponseCause(decision) {
2149
- if (decision.escalated) return "Ticket escalad\xE9 \xE0 un humain \u2014 le graphe ne r\xE9dige pas.";
2150
- if (decision.conversationOver) return "Conversation consid\xE9r\xE9e close \u2014 rien \xE0 r\xE9pondre.";
2151
- if (decision.status === "error") return decision.error ?? "Le triage a \xE9chou\xE9.";
2152
- return "La cat\xE9gorie n'a pas la r\xE9ponse rapide activ\xE9e, ou n'a pas d'agent r\xE9dacteur.";
2151
+ function noResponseReason(decision) {
2152
+ if (decision.escalated) return { code: "ticket_escalated" };
2153
+ if (decision.conversationOver) return { code: "conversation_over" };
2154
+ if (decision.status === "error") return { code: "triage_error", error: decision.error ?? null };
2155
+ return { code: "category_not_drafting" };
2156
+ }
2157
+
2158
+ // src/ui/tickets/timeline.ts
2159
+ var TITLES = {
2160
+ received: "Re\xE7u",
2161
+ prompt: "Prompt envoy\xE9",
2162
+ triage: "Triage",
2163
+ draft: "R\xE9daction",
2164
+ evaluation: "\xC9valuation",
2165
+ delivery: "Envoi",
2166
+ correction: "Corrig\xE9 par un humain"
2167
+ };
2168
+ function buildTimeline(input) {
2169
+ return buildTimelineSteps(input).map(
2170
+ (state) => state.reached ? { key: state.key, title: TITLES[state.key], reached: true } : {
2171
+ key: state.key,
2172
+ title: TITLES[state.key],
2173
+ reached: false,
2174
+ reason: describeReason(state.reason)
2175
+ }
2176
+ );
2177
+ }
2178
+ function describeReason(reason2) {
2179
+ switch (reason2.code) {
2180
+ case "conversation_loading":
2181
+ return "Lecture de la conversation en cours\u2026";
2182
+ case "conversation_unavailable":
2183
+ return "Aucune conversation disponible : rien n'a \xE9t\xE9 captur\xE9 au moment du run, et le fil n'a pas pu \xEAtre relu chez Gorgias.";
2184
+ case "ticket_escalated":
2185
+ return "Ticket escalad\xE9 \xE0 un humain \u2014 le graphe ne r\xE9dige pas.";
2186
+ case "conversation_over":
2187
+ return "Conversation consid\xE9r\xE9e close \u2014 rien \xE0 r\xE9pondre.";
2188
+ case "triage_error":
2189
+ return reason2.error ?? "Le triage a \xE9chou\xE9.";
2190
+ case "category_not_drafting":
2191
+ return "La cat\xE9gorie n'a pas la r\xE9ponse rapide activ\xE9e, ou n'a pas d'agent r\xE9dacteur.";
2192
+ case "triage_failed":
2193
+ return reason2.error ?? "Le triage a \xE9chou\xE9 sans produire de classification.";
2194
+ case "prompt_not_captured":
2195
+ return "Le prompt rendu n'a pas \xE9t\xE9 captur\xE9 sur cette r\xE9ponse \u2014 les r\xE9ponses \xE9crites avant cette capture n'en gardent que le nom et la version.";
2196
+ case "draft_pending":
2197
+ return "La r\xE9daction n'a pas encore tourn\xE9.";
2198
+ case "draft_empty":
2199
+ return reason2.error ?? "La r\xE9daction n'a produit aucun texte.";
2200
+ case "evaluation_pending":
2201
+ return "L'\xE9valuation n'a pas encore tourn\xE9.";
2202
+ case "evaluation_missing":
2203
+ return "Aucun verdict : l'\xE9valuation n'a pas \xE9t\xE9 atteinte.";
2204
+ case "reply_queued":
2205
+ return "La r\xE9ponse est encore en file.";
2206
+ case "expired":
2207
+ return reason2.detail === null ? "La r\xE9ponse a expir\xE9 avant son envoi." : `La r\xE9ponse a expir\xE9 avant son envoi. ${describeNotSent(reason2.detail)}`;
2208
+ case "delivery_failed":
2209
+ return reason2.error ?? "La r\xE9ponse a \xE9chou\xE9 avant son envoi.";
2210
+ case "superseded":
2211
+ return "Le client a \xE9crit \xE0 nouveau avant l\u2019envoi : une r\xE9ponse plus r\xE9cente a remplac\xE9 celle-ci.";
2212
+ case "test_draft":
2213
+ return "Brouillon d'essai \u2014 jamais envoy\xE9.";
2214
+ case "unexpected_status":
2215
+ return `La r\xE9ponse n'a pas \xE9t\xE9 envoy\xE9e (statut : ${reason2.status}).`;
2216
+ case "no_correction":
2217
+ return "Aucune correction captur\xE9e : l'agent n'a pas r\xE9\xE9crit de r\xE9ponse sur ce ticket.";
2218
+ default:
2219
+ return describeNotSent(reason2);
2220
+ }
2221
+ }
2222
+ function describeNotSent(reason2) {
2223
+ switch (reason2.code) {
2224
+ case "generic_not_sent":
2225
+ return "R\xE9dig\xE9e, en attente d'un envoi.";
2226
+ case "held_permanently":
2227
+ return "Mise en attente d\xE9finitive : cette r\xE9ponse ne repartira pas toute seule (refus d\u2019approbation, contr\xF4le de derni\xE8re minute, ou envoi interrompu puis repris).";
2228
+ case "guardrail_unrecorded":
2229
+ return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
2230
+ case "guardrail":
2231
+ return describeGuardrail(reason2.hits, reason2.reconstructed);
2232
+ case "awaiting_approval":
2233
+ return "En attente d'une approbation humaine avant envoi.";
2234
+ case "trial_mode":
2235
+ return "Mode essai : la r\xE9ponse aurait \xE9t\xE9 envoy\xE9e, mais rien n'a \xE9t\xE9 transmis au client.";
2236
+ case "no_verdict":
2237
+ return "L'\xE9valuation n'a produit aucun verdict \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
2238
+ case "evaluation_failed":
2239
+ return "L'\xE9valuation a \xE9chou\xE9 \u2014 par s\xE9curit\xE9, la r\xE9ponse part en revue humaine.";
2240
+ case "judge_held":
2241
+ return "Le juge a retenu la r\xE9ponse (verdict \xAB Retenir \xBB) \u2014 elle demande une relecture.";
2242
+ case "judge_not_authorized":
2243
+ return "Le juge n'a pas autoris\xE9 l'envoi automatique.";
2244
+ case "below_confidence":
2245
+ return `Confiance de ${asPercent(reason2.confidence)} %, sous le seuil de ${asPercent(reason2.minConfidence)} % fix\xE9 sur l'\xE9tape \xC9valuation.`;
2246
+ case "followup_not_sendable":
2247
+ return "Le juge a valid\xE9 la r\xE9ponse mais demand\xE9 un suivi humain (verdict \xAB Envoyer et escalader \xBB). L'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation : la r\xE9ponse n'est donc pas envoy\xE9e.";
2248
+ case "legacy_followup_probable":
2249
+ return "Probablement : le juge a valid\xE9 la r\xE9ponse en demandant un suivi humain, et l'option \xAB Envoyer les r\xE9ponses qui demandent un suivi humain \xBB est d\xE9sactiv\xE9e sur l'\xE9tape \xC9valuation. (R\xE9ponse ant\xE9rieure \xE0 l'enregistrement des sorties de run \u2014 lecture faite avec les r\xE9glages actuels.)";
2250
+ case "evaluation_disabled":
2251
+ return "L'\xE9tape \xC9valuation est coup\xE9e : sans verdict, l'envoi automatique est impossible.";
2252
+ case "auto_send_disabled":
2253
+ return "L'envoi automatique est d\xE9sactiv\xE9 dans les r\xE9glages.";
2254
+ case "category_auto_reply_off":
2255
+ return `La cat\xE9gorie \xAB ${reason2.categoryName} \xBB n'a pas l'auto-r\xE9ponse activ\xE9e.`;
2256
+ case "whatsapp_draft_only":
2257
+ return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
2258
+ case "no_publication_path": {
2259
+ const channel = reason2.channel ? ` ${channelLabel(reason2.channel)}` : "";
2260
+ return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
2261
+ }
2262
+ case "channel_not_enabled":
2263
+ return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(reason2.channel ?? "")}. Le brouillon reste disponible pour un agent.`;
2264
+ case "no_sender_address":
2265
+ return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
2266
+ }
2267
+ }
2268
+ function describeGuardrail(hits, reconstructed) {
2269
+ const [first = "", ...rest] = hits;
2270
+ const explanation = guardrailExplanation(first);
2271
+ const head = `Garde-fou d\xE9clench\xE9 : ${guardrailHitLabel(first)}.`;
2272
+ const others = rest.length > 0 ? ` \xC9galement d\xE9clench\xE9 : ${rest.map(guardrailHitLabel).join(", ")}.` : "";
2273
+ const caveat = reconstructed ? " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)" : "";
2274
+ return `${head}${explanation ? ` ${explanation}` : ""}${others}${caveat}`;
2275
+ }
2276
+ function asPercent(ratio) {
2277
+ return Math.round(ratio * 100);
2153
2278
  }
2154
2279
  var AGENT_GUARDRAILS = [
2155
2280
  "whatsapp",
@@ -2557,7 +2682,7 @@ function TicketsPage() {
2557
2682
  const history = useTicketHistory(detailDecision?.ticketId ?? null);
2558
2683
  const [triageInFlight] = react.useState(() => ({ current: false }));
2559
2684
  const periodKey = JSON.stringify(period);
2560
- const bounds = react.useMemo(() => periodBoundsOf(JSON.parse(periodKey)).current, [periodKey]);
2685
+ const bounds = react.useMemo(() => periodBoundsOf2(JSON.parse(periodKey)).current, [periodKey]);
2561
2686
  const decisionFilter = react.useMemo(() => {
2562
2687
  if (ticketSearch) return { ticketId: { eq: ticketSearch } };
2563
2688
  const filter = { decidedAt: { gte: bounds.fromIso, lte: bounds.toIso } };
@@ -4537,6 +4662,12 @@ function validateSettings(settings) {
4537
4662
  message: "sourceViewId is required \u2014 pick the Gorgias view this app owns."
4538
4663
  });
4539
4664
  }
4665
+ if (!isNonEmptyString(settings.appScopeTag) || settings.appScopeTag.trim() === "") {
4666
+ issues.push({
4667
+ key: "appScopeTag",
4668
+ message: "appScopeTag is required \u2014 set the tag that marks this app's tickets."
4669
+ });
4670
+ }
4540
4671
  if (!isConfiguredNode(settings.nodes)) {
4541
4672
  issues.push({
4542
4673
  key: "nodes",
@@ -4589,17 +4720,16 @@ var AUDIT_TAG_KEYS = ["unknownTag", "handledTag", "escalationTag", "autoRepliedT
4589
4720
  function settingsWarnings(settings) {
4590
4721
  const warnings = [];
4591
4722
  const appScopeTag = trimmed(settings.appScopeTag);
4592
- const webhookScopeTag = trimmed(settings.webhookScopeTag);
4593
4723
  const collidesWith = (keys) => appScopeTag ? keys.filter((key) => trimmed(settings[key]) === appScopeTag) : [];
4594
4724
  if (collidesWith(HUMAN_TAKEOVER_KEYS).length > 0) {
4595
4725
  warnings.push({
4596
4726
  key: "appScopeTagVetoesFollowups",
4597
- message: "Le tag d\u2019appartenance est l\u2019un des tags de reprise humaine (escalade, relecture, suivi) : le webhook de suivi consid\xE9rera que chaque ticket tri\xE9 a \xE9t\xE9 repris par un humain et ne r\xE9pondra plus \xE0 aucun message suivant."
4727
+ message: "Le tag des tickets de l\u2019application est l\u2019un des tags de reprise humaine (escalade, relecture, suivi) : le webhook de suivi consid\xE9rera que chaque ticket tri\xE9 a \xE9t\xE9 repris par un humain et ne r\xE9pondra plus \xE0 aucun message suivant."
4598
4728
  });
4599
4729
  } else if (collidesWith(AUDIT_TAG_KEYS).length > 0) {
4600
4730
  warnings.push({
4601
4731
  key: "appScopeTagCollision",
4602
- message: "Le tag d\u2019appartenance est l\u2019un des autres tags d\u2019audit, que toutes les apps posent avec la m\xEAme valeur par d\xE9faut : il ne distingue donc pas cette app d\u2019une autre install\xE9e sur le m\xEAme compte Gorgias."
4732
+ message: "Le tag des tickets de l\u2019application est l\u2019un des autres tags d\u2019audit, que toutes les apps posent avec la m\xEAme valeur par d\xE9faut : il ne distingue donc pas cette app d\u2019une autre install\xE9e sur le m\xEAme compte Gorgias."
4603
4733
  });
4604
4734
  }
4605
4735
  if (settings.autoSendEnabled === true && Array.isArray(settings.autoSendChannels) && settings.autoSendChannels.length === 0) {
@@ -4608,12 +4738,6 @@ function settingsWarnings(settings) {
4608
4738
  message: "L\u2019envoi automatique est actif mais aucun canal n\u2019est coch\xE9 : aucune r\xE9ponse ne peut partir. Cochez au moins un canal, ou coupez l\u2019envoi automatique."
4609
4739
  });
4610
4740
  }
4611
- if (appScopeTag && webhookScopeTag && appScopeTag !== webhookScopeTag) {
4612
- warnings.push({
4613
- key: "scopeTagMismatch",
4614
- message: "Le tag de p\xE9rim\xE8tre du webhook de suivi n\u2019est pas celui que cette app pose sur ses tickets : le webhook ne r\xE9pondra sur aucun ticket tri\xE9 ici."
4615
- });
4616
- }
4617
4741
  return warnings;
4618
4742
  }
4619
4743
  function trimmed(value) {
@@ -5086,33 +5210,12 @@ function followupIntegrationName(slug) {
5086
5210
  function followupWebhookPath(slug) {
5087
5211
  return `/api/s/${slug}${FOLLOWUP_WEBHOOK_ROUTE_PATH}`;
5088
5212
  }
5089
- function FollowupWebhookCard({ scopeTag, onScopeTagChange, canWrite }) {
5213
+ function FollowupWebhookCard() {
5090
5214
  const { appSlug } = uiSdk.useAppContext();
5091
- const scopeId = react.useId();
5092
5215
  return /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "webhook-suite", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-4 p-4", children: [
5093
5216
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5094
5217
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
5095
- /* @__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)." })
5096
- ] }),
5097
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5098
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: scopeId, className: "mb-1 block text-sm font-medium", children: "Tag de p\xE9rim\xE8tre webhook" }),
5099
- /* @__PURE__ */ jsxRuntime.jsx(
5100
- uiSdk.Input,
5101
- {
5102
- id: scopeId,
5103
- value: scopeTag,
5104
- onChange: (e) => onScopeTagChange(e.target.value),
5105
- placeholder: "wai/triaged",
5106
- disabled: !canWrite
5107
- }
5108
- ),
5109
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
5110
- "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. ",
5111
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Vide = aucun message suivant trait\xE9" }),
5112
- " (c'est aussi le kill-switch). Deux apps sur le m\xEAme compte Gorgias doivent y mettre des valeurs ",
5113
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "distinctes" }),
5114
- ", sinon chacune r\xE9pondrait sur les tickets de l'autre."
5115
- ] })
5218
+ /* @__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). Seuls les tickets qui portent le tag des tickets de l'application sont concern\xE9s." })
5116
5219
  ] }),
5117
5220
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t pt-4", children: [
5118
5221
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "Int\xE9gration Gorgias (installation manuelle)" }),
@@ -5484,22 +5587,15 @@ function SettingsPage() {
5484
5587
  ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
5485
5588
  ["needsReviewTag", "Tag \xE0 revoir avant envoi"],
5486
5589
  ["followupTag", "Tag suivi requis"],
5487
- ["appScopeTag", "Tag d'appartenance"]
5590
+ ["appScopeTag", "Tag des tickets de l'application"]
5488
5591
  ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5489
5592
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
5490
5593
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
5491
5594
  ] }, key)),
5492
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag d\u2019appartenance est pos\xE9 sur chaque ticket que le triage examine, dans le m\xEAme appel que les tags ci-dessus. Il doit \xEAtre propre \xE0 cette app : c\u2019est lui qui distingue ses tickets de ceux d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
5595
+ /* @__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." }),
5493
5596
  /* @__PURE__ */ jsxRuntime.jsx(SettingsWarnings, { warnings: tagWarnings })
5494
5597
  ] }) }),
5495
- /* @__PURE__ */ jsxRuntime.jsx(
5496
- FollowupWebhookCard,
5497
- {
5498
- scopeTag: field(form.webhookScopeTag),
5499
- onScopeTagChange: (value) => set("webhookScopeTag", value),
5500
- canWrite
5501
- }
5502
- ),
5598
+ /* @__PURE__ */ jsxRuntime.jsx(FollowupWebhookCard, {}),
5503
5599
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
5504
5600
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
5505
5601
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -7334,7 +7430,7 @@ function FollowupWebhookCard2() {
7334
7430
  /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
7335
7431
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7336
7432
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "R\xE9ponses aux messages suivants" }),
7337
- /* @__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." })
7433
+ /* @__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 des tickets de l\u2019application et les cat\xE9gories se r\xE8glent dans Param\xE8tres." })
7338
7434
  ] }),
7339
7435
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t pt-3", children: [
7340
7436
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: ticketId, className: "block text-sm font-medium", children: "Ticket \xE0 tester" }),