@apotech-os/support-kit 10.3.0 → 10.5.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
@@ -862,7 +862,7 @@ function dayLabel(day) {
862
862
  return Number.isNaN(parsed.getTime()) ? day : parsed.toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit", timeZone: "UTC" });
863
863
  }
864
864
  function DashboardPage() {
865
- const { appSlug } = uiSdk.useAppContext();
865
+ const pageHref = uiSdk.useAppPageHref();
866
866
  const [period, setPeriod] = react.useState(() => defaultPeriod());
867
867
  const { settings } = uiSdk.useAppSettings();
868
868
  const timezone = settings?.statsTimezone ?? "UTC";
@@ -964,7 +964,7 @@ function DashboardPage() {
964
964
  align: "end"
965
965
  }
966
966
  ),
967
- /* @__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" })
968
968
  ] })
969
969
  }
970
970
  ),
@@ -2431,6 +2431,49 @@ function describeGuardrail(hits, reconstructed) {
2431
2431
  function asPercent(ratio) {
2432
2432
  return Math.round(ratio * 100);
2433
2433
  }
2434
+
2435
+ // src/domain/system-prompts.ts
2436
+ var OPERATOR_MODE_PROMPT_NAME = "shared/mode-operateur";
2437
+ var DEFAULT_OPERATOR_MODE_PROMPT = [
2438
+ "MODE OP\xC9RATEUR",
2439
+ "Tu es en mode op\xE9rateur : un membre de l'\xE9quipe relit ta r\xE9ponse et l'envoie lui-m\xEAme au client.",
2440
+ "* Quand un message commence par \xAB Merci d'utiliser le contexte suivant \xBB, c'est la consigne de l'op\xE9rateur : applique-la.",
2441
+ "* Ses consignes priment sur toutes les limites indiqu\xE9es plus haut, y compris les plafonds de geste commercial.",
2442
+ "* N'\xE9cris jamais qu'un agent ou l'\xE9quipe reviendra vers le client, sauf si l'op\xE9rateur le demande : r\xE9dige la r\xE9ponse compl\xE8te, pr\xEAte \xE0 envoyer.",
2443
+ "* S'il te manque une information, r\xE9dige quand m\xEAme la r\xE9ponse et signale le point \xE0 v\xE9rifier entre crochets, par exemple [\xC0 v\xE9rifier : num\xE9ro de commande]."
2444
+ ].join("\n");
2445
+ var SYSTEM_PROMPTS = [
2446
+ {
2447
+ name: OPERATOR_MODE_PROMPT_NAME,
2448
+ description: "Ajout\xE9 \xE0 la fin du prompt de l'agent quand un membre de l'\xE9quipe g\xE9n\xE8re une r\xE9ponse depuis l'extension.",
2449
+ usage: "operator",
2450
+ defaultContent: DEFAULT_OPERATOR_MODE_PROMPT
2451
+ }
2452
+ ];
2453
+ function systemPromptOf(name) {
2454
+ return SYSTEM_PROMPTS.find((prompt) => prompt.name === name);
2455
+ }
2456
+
2457
+ // src/domain/prompt-usage.ts
2458
+ var PROMPT_USAGES = ["always", "auto", "operator"];
2459
+ var DEFAULT_PROMPT_USAGE = "always";
2460
+ function isPromptUsage(value) {
2461
+ return typeof value === "string" && PROMPT_USAGES.includes(value);
2462
+ }
2463
+ function toSharedPromptUsages(value) {
2464
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
2465
+ const usages = {};
2466
+ for (const [name, usage] of Object.entries(value)) {
2467
+ if (isPromptUsage(usage) && usage !== DEFAULT_PROMPT_USAGE) usages[name] = usage;
2468
+ }
2469
+ return usages;
2470
+ }
2471
+ function promptUsageOf(name, usages) {
2472
+ return systemPromptOf(name)?.usage ?? usages[name] ?? DEFAULT_PROMPT_USAGE;
2473
+ }
2474
+ function isPromptUsedIn(mode, usage) {
2475
+ return usage === DEFAULT_PROMPT_USAGE || usage === mode;
2476
+ }
2434
2477
  var AGENT_GUARDRAILS = [
2435
2478
  "whatsapp",
2436
2479
  "whatsapp_stop",
@@ -3370,13 +3413,13 @@ function applyPreset(value, preset, restore) {
3370
3413
  }
3371
3414
 
3372
3415
  // src/ui/shared/quality-href.ts
3373
- function qualityHref(appSlug, agent) {
3374
- const base2 = `/espace/${appSlug}/quality`;
3375
- if (!agent) return base2;
3376
- const params = new URLSearchParams({ promptName: agent.promptName });
3377
- if (agent.promptVersion !== null) params.set("promptVersion", String(agent.promptVersion));
3378
- params.set("agentId", agent.id);
3379
- return `${base2}?${params.toString()}`;
3416
+ function qualityHref(pageHref, agent) {
3417
+ if (!agent) return pageHref("quality");
3418
+ return pageHref("quality", {
3419
+ promptName: agent.promptName,
3420
+ promptVersion: agent.promptVersion,
3421
+ agentId: agent.id
3422
+ });
3380
3423
  }
3381
3424
  function usePromptCatalogue() {
3382
3425
  const { appSlug } = uiSdk.useAppContext();
@@ -3464,29 +3507,258 @@ function ConfirmModal({
3464
3507
  ] })
3465
3508
  ] }) });
3466
3509
  }
3510
+
3511
+ // src/prompts/references.ts
3512
+ var REF_RE = /@@@langfusePrompt:name=([^|@]+)\|(?:version=(\d+)|label=([^@]+))@@@/g;
3513
+ var REFERENCE_TAG_SOURCE = REF_RE.source;
3514
+
3515
+ // src/prompts/syntax.ts
3516
+ var PROMPT_VARIABLES = {
3517
+ agent_name: { replacedBy: "le pr\xE9nom de la personne qui r\xE9pond, vide quand l'agent r\xE9pond seul", allowsSpaces: true },
3518
+ categories: { replacedBy: "la liste des cat\xE9gories, dans le prompt de tri uniquement", allowsSpaces: false },
3519
+ channel_prompt: { replacedBy: null, allowsSpaces: false }
3520
+ };
3521
+ var USAGE_SENTENCES = {
3522
+ always: "Inclus dans toutes les r\xE9ponses.",
3523
+ auto: "R\xE9ponse automatique seulement : ignor\xE9 quand un membre de l'\xE9quipe g\xE9n\xE8re une r\xE9ponse depuis l'extension.",
3524
+ operator: "Op\xE9rateur seulement : ignor\xE9 quand l'agent r\xE9pond seul."
3525
+ };
3526
+ var TAG_PREFIX = "@@@langfusePrompt:";
3527
+ var TAG_EXAMPLE = "@@@langfusePrompt:name=shared/nom|label=production@@@";
3528
+ var VARIABLE_RE = /\{\{([^{}\n]*)\}\}/g;
3529
+ var UNCLOSED_VARIABLE_RE = /\{\{(?![^{}\n]*\}\})[^\n]*/g;
3530
+ function referenceTokens(content, knowledge) {
3531
+ const tokens = [];
3532
+ const wellFormedStarts = /* @__PURE__ */ new Set();
3533
+ for (const match of content.matchAll(new RegExp(REFERENCE_TAG_SOURCE, "g"))) {
3534
+ const [raw, name, version, label] = match;
3535
+ const start = match.index ?? 0;
3536
+ wellFormedStarts.add(start);
3537
+ tokens.push({ start, end: start + raw.length, kind: "reference", ...describeReference(name, version, label, knowledge) });
3538
+ }
3539
+ let from = content.indexOf(TAG_PREFIX);
3540
+ while (from !== -1) {
3541
+ if (!wellFormedStarts.has(from)) {
3542
+ tokens.push({
3543
+ start: from,
3544
+ end: malformedEnd(content, from),
3545
+ kind: "malformed",
3546
+ status: "error",
3547
+ message: `R\xE9f\xE9rence mal form\xE9e, elle sera envoy\xE9e telle quelle au mod\xE8le. Forme attendue : ${TAG_EXAMPLE}`
3548
+ });
3549
+ }
3550
+ from = content.indexOf(TAG_PREFIX, from + TAG_PREFIX.length);
3551
+ }
3552
+ return tokens;
3553
+ }
3554
+ function malformedEnd(content, start) {
3555
+ const lineEnd = content.indexOf("\n", start);
3556
+ const limit = lineEnd === -1 ? content.length : lineEnd;
3557
+ const closing = content.indexOf("@@@", start + TAG_PREFIX.length);
3558
+ return closing !== -1 && closing < limit ? closing + 3 : limit;
3559
+ }
3560
+ function describeReference(name, version, label, knowledge) {
3561
+ const entry = knowledge.catalogue?.find((prompt) => prompt.name === name);
3562
+ if (knowledge.catalogue && !entry) {
3563
+ return { status: "error", message: `Prompt introuvable : \xAB ${name} \xBB n'existe pas ou n'est pas accessible depuis cette app.` };
3564
+ }
3565
+ if (entry && version !== void 0 && Number(version) > entry.latestVersion) {
3566
+ return { status: "error", message: `La version ${version} de \xAB ${name} \xBB n'existe pas (derni\xE8re version : ${entry.latestVersion}).` };
3567
+ }
3568
+ if (entry && label !== void 0 && !entry.labels.includes(label)) {
3569
+ return { status: "error", message: `Aucune version de \xAB ${name} \xBB ne porte le label \xAB ${label} \xBB.` };
3570
+ }
3571
+ const usage = promptUsageOf(name, knowledge.usages);
3572
+ const target = version !== void 0 ? `version ${version}` : `label \xAB ${label} \xBB`;
3573
+ return {
3574
+ status: isPromptUsedIn("auto", usage) && isPromptUsedIn("operator", usage) ? "ok" : "restricted",
3575
+ message: `Prompt \xAB ${name} \xBB, ${target}. ${USAGE_SENTENCES[usage]}`
3576
+ };
3577
+ }
3578
+ function variableTokens(content) {
3579
+ const tokens = [];
3580
+ for (const match of content.matchAll(VARIABLE_RE)) {
3581
+ const start = match.index ?? 0;
3582
+ const inner = match[1] ?? "";
3583
+ tokens.push({ start, end: start + match[0].length, kind: "variable", ...describeVariable(inner) });
3584
+ }
3585
+ for (const match of content.matchAll(UNCLOSED_VARIABLE_RE)) {
3586
+ const start = match.index ?? 0;
3587
+ tokens.push({
3588
+ start,
3589
+ end: start + match[0].length,
3590
+ kind: "variable",
3591
+ status: "error",
3592
+ message: "Accolades \xAB {{ \xBB sans fermeture \xAB }} \xBB sur la m\xEAme ligne."
3593
+ });
3594
+ }
3595
+ return tokens;
3596
+ }
3597
+ function describeVariable(inner) {
3598
+ const name = inner.trim();
3599
+ const known = PROMPT_VARIABLES[name];
3600
+ if (!known) {
3601
+ return {
3602
+ status: "error",
3603
+ message: `Variable inconnue : \xAB {{${name}}} \xBB ne sera pas remplac\xE9e. Variables disponibles : ${Object.keys(PROMPT_VARIABLES).join(", ")}.`
3604
+ };
3605
+ }
3606
+ if (known.replacedBy === null) {
3607
+ return { status: "error", message: `\xAB {{${name}}} \xBB n'est pas remplac\xE9e pour l'instant : elle arrive telle quelle au mod\xE8le.` };
3608
+ }
3609
+ if (inner !== name && !known.allowsSpaces) {
3610
+ return { status: "error", message: `\xC9crire \xAB {{${name}}} \xBB sans espaces, sinon la variable n'est pas remplac\xE9e.` };
3611
+ }
3612
+ return { status: "ok", message: `Variable remplac\xE9e par ${known.replacedBy}.` };
3613
+ }
3614
+ function readPromptSyntax(content, knowledge) {
3615
+ const drafts = [...referenceTokens(content, knowledge), ...variableTokens(content)].sort((a, b) => a.start - b.start);
3616
+ const tokens = [];
3617
+ let cursor = 0;
3618
+ let line = 1;
3619
+ let counted = 0;
3620
+ for (const draft of drafts) {
3621
+ if (draft.start < cursor) continue;
3622
+ for (; counted < draft.start; counted += 1) if (content[counted] === "\n") line += 1;
3623
+ tokens.push({ ...draft, line });
3624
+ cursor = draft.end;
3625
+ }
3626
+ return tokens;
3627
+ }
3628
+ var PROMPT_USAGE_LABELS = {
3629
+ always: "Toujours",
3630
+ auto: "R\xE9ponse automatique seulement",
3631
+ operator: "Op\xE9rateur seulement"
3632
+ };
3633
+ var PROMPT_USAGE_HINTS = {
3634
+ always: "Inclus dans toutes les r\xE9ponses.",
3635
+ auto: "Inclus seulement quand l'agent r\xE9pond seul. Ignor\xE9 quand un membre de l'\xE9quipe g\xE9n\xE8re une r\xE9ponse depuis l'extension.",
3636
+ operator: "Inclus seulement quand un membre de l'\xE9quipe g\xE9n\xE8re une r\xE9ponse depuis l'extension. Ignor\xE9 quand l'agent r\xE9pond seul."
3637
+ };
3638
+ var PROMPT_USAGE_OPTIONS = Object.keys(PROMPT_USAGE_LABELS).map((value) => ({
3639
+ value,
3640
+ label: PROMPT_USAGE_LABELS[value]
3641
+ }));
3642
+ function useSharedPromptUsages() {
3643
+ const { settings, error, save, isSaving, saveError } = uiSdk.useAppSettings();
3644
+ const usages = toSharedPromptUsages(settings?.sharedPromptUsages);
3645
+ const isReady = settings !== void 0 && error === void 0;
3646
+ return {
3647
+ usages,
3648
+ usageOf: (name) => promptUsageOf(name, usages),
3649
+ isReady,
3650
+ setUsage: (name, usage) => {
3651
+ if (!isReady) return Promise.resolve();
3652
+ const next = { ...usages };
3653
+ if (usage === DEFAULT_PROMPT_USAGE) delete next[name];
3654
+ else next[name] = usage;
3655
+ return save({ sharedPromptUsages: next });
3656
+ },
3657
+ isSaving,
3658
+ saveError
3659
+ };
3660
+ }
3467
3661
  var PROMPT_PANEL_CLASS = "w-[min(92vw,64rem)] max-w-none";
3468
3662
  var PRODUCTION_LABEL = "production";
3663
+ var TOKEN_CLASSES = {
3664
+ ok: "rounded-sm bg-status-info/15 text-status-info",
3665
+ restricted: "rounded-sm bg-status-pending/15 text-status-pending underline decoration-dashed underline-offset-2",
3666
+ error: "rounded-sm bg-status-blocked/15 text-status-blocked underline decoration-wavy underline-offset-2"
3667
+ };
3668
+ var EDITOR_BOX = "whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs leading-relaxed [scrollbar-gutter:stable]";
3469
3669
  var PromptTextarea = react.forwardRef(
3470
- function PromptTextarea2({ value, className, rows = 14, ...props }, ref) {
3670
+ function PromptTextarea2({ value, className, rows = 14, onScroll, ...props }, ref) {
3671
+ const knowledge = usePromptSyntaxKnowledge();
3672
+ const tokens = react.useMemo(() => readPromptSyntax(value, knowledge), [value, knowledge]);
3673
+ const layerRef = react.useRef(null);
3674
+ const [hovered, setHovered] = react.useState(null);
3675
+ const errors = tokens.filter((token) => token.status === "error");
3676
+ function hoverAt(event) {
3677
+ const index = document.elementsFromPoint?.(event.clientX, event.clientY).map((el) => el instanceof HTMLElement ? el.dataset.promptToken : void 0).find((found) => found !== void 0);
3678
+ const token = index === void 0 ? void 0 : tokens[Number(index)];
3679
+ const box = event.currentTarget.getBoundingClientRect();
3680
+ setHovered(token ? { token, x: event.clientX - box.left, y: event.clientY - box.top } : null);
3681
+ }
3471
3682
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3472
- /* @__PURE__ */ jsxRuntime.jsx(
3473
- uiSdk.Textarea,
3474
- {
3475
- ref,
3476
- value,
3477
- rows,
3478
- className: uiSdk.cn("font-mono text-xs leading-relaxed", className),
3479
- ...props
3480
- }
3481
- ),
3683
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3684
+ /* @__PURE__ */ jsxRuntime.jsxs(
3685
+ "pre",
3686
+ {
3687
+ ref: layerRef,
3688
+ "aria-hidden": true,
3689
+ "data-testid": "prompt-syntax-layer",
3690
+ className: uiSdk.cn("absolute inset-0 m-0 overflow-hidden border border-transparent text-foreground", EDITOR_BOX),
3691
+ children: [
3692
+ renderSegments(value, tokens),
3693
+ value.endsWith("\n") ? " " : null
3694
+ ]
3695
+ }
3696
+ ),
3697
+ /* @__PURE__ */ jsxRuntime.jsx(
3698
+ uiSdk.Textarea,
3699
+ {
3700
+ ref,
3701
+ value,
3702
+ rows,
3703
+ spellCheck: false,
3704
+ className: uiSdk.cn("relative text-transparent caret-foreground", EDITOR_BOX, className),
3705
+ onScroll: (event) => {
3706
+ if (layerRef.current) layerRef.current.scrollTop = event.currentTarget.scrollTop;
3707
+ setHovered(null);
3708
+ onScroll?.(event);
3709
+ },
3710
+ onMouseMove: hoverAt,
3711
+ onMouseLeave: () => setHovered(null),
3712
+ ...props
3713
+ }
3714
+ ),
3715
+ hovered && /* @__PURE__ */ jsxRuntime.jsx(
3716
+ "div",
3717
+ {
3718
+ role: "tooltip",
3719
+ className: "pointer-events-none absolute z-50 max-w-sm rounded-md bg-foreground px-2 py-1 text-xs text-background shadow-md",
3720
+ style: { left: hovered.x + 12, top: hovered.y + 16 },
3721
+ children: hovered.token.message
3722
+ }
3723
+ )
3724
+ ] }),
3482
3725
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-right text-xs text-muted-foreground", children: [
3483
3726
  value.length.toLocaleString("fr-FR"),
3484
3727
  " caract\xE8re",
3485
3728
  value.length > 1 ? "s" : ""
3486
- ] })
3729
+ ] }),
3730
+ errors.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { "aria-label": "Erreurs dans le prompt", className: "mt-1 space-y-1 text-xs", children: errors.map((token) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex gap-2", children: [
3731
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "text-status-blocked", children: "\u2715" }),
3732
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
3733
+ "Ligne ",
3734
+ token.line,
3735
+ " : ",
3736
+ token.message
3737
+ ] })
3738
+ ] }, `${token.start}-${token.end}`)) })
3487
3739
  ] });
3488
3740
  }
3489
3741
  );
3742
+ function renderSegments(value, tokens) {
3743
+ const segments = [];
3744
+ let cursor = 0;
3745
+ tokens.forEach((token, index) => {
3746
+ if (token.start > cursor) segments.push(value.slice(cursor, token.start));
3747
+ segments.push(
3748
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-prompt-token": index, "data-status": token.status, className: TOKEN_CLASSES[token.status], children: value.slice(token.start, token.end) }, token.start)
3749
+ );
3750
+ cursor = token.end;
3751
+ });
3752
+ if (cursor < value.length) segments.push(value.slice(cursor));
3753
+ return segments;
3754
+ }
3755
+ function usePromptSyntaxKnowledge() {
3756
+ const { prompts, isLoading, error } = usePromptCatalogue();
3757
+ const { usages } = useSharedPromptUsages();
3758
+ const catalogue = isLoading || error !== void 0 ? null : prompts;
3759
+ const usagesKey = JSON.stringify(usages);
3760
+ return react.useMemo(() => ({ catalogue, usages }), [catalogue, usagesKey]);
3761
+ }
3490
3762
  function defaultExpandedVersion(versions) {
3491
3763
  const production = versions.find((v) => v.labels.includes(PRODUCTION_LABEL));
3492
3764
  if (production) return production.version;
@@ -3541,8 +3813,8 @@ function VersionCard({
3541
3813
  ] })
3542
3814
  ] });
3543
3815
  }
3544
- function useNewVersionDraft() {
3545
- const [content, setContent] = react.useState("");
3816
+ function useNewVersionDraft(initialContent = "") {
3817
+ const [content, setContent] = react.useState(initialContent);
3546
3818
  const [pendingPrefill, setPendingPrefill] = react.useState(null);
3547
3819
  const editorRef = react.useRef(null);
3548
3820
  function loadIntoEditor(versionContent) {
@@ -3958,7 +4230,7 @@ function AgentFormPanel({
3958
4230
  );
3959
4231
  }
3960
4232
  function PromptVersionsSection({ agent, canWrite }) {
3961
- const { appSlug } = uiSdk.useAppContext();
4233
+ const pageHref = uiSdk.useAppPageHref();
3962
4234
  const { versions, error, refresh, promote, deleteVersion, createVersion } = usePromptVersions(
3963
4235
  agent.promptName
3964
4236
  );
@@ -4047,7 +4319,7 @@ function PromptVersionsSection({ agent, canWrite }) {
4047
4319
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4048
4320
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
4049
4321
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
4050
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: qualityHref(appSlug, agent), children: "Voir dans Qualit\xE9" }),
4322
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: qualityHref(pageHref, agent), children: "Voir dans Qualit\xE9" }),
4051
4323
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
4052
4324
  versions.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { variant: "outline", onClick: openCompare, children: "Comparer" }),
4053
4325
  canWrite && /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { variant: "outline", onClick: () => void suggest(), disabled: isSuggesting, children: isSuggesting ? "Suggestion en cours\u2026" : "Sugg\xE9rer une am\xE9lioration" })
@@ -5543,7 +5815,10 @@ var WHATSAPP_MODE_LABELS = {
5543
5815
  draft_only: "Brouillon uniquement",
5544
5816
  auto_reply: "R\xE9ponse automatique"
5545
5817
  };
5546
- var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({ value, label: WHATSAPP_MODE_LABELS[value] }));
5818
+ var WHATSAPP_MODE_OPTIONS = WHATSAPP_MODES.map((value) => ({
5819
+ value,
5820
+ label: WHATSAPP_MODE_LABELS[value]
5821
+ }));
5547
5822
  function field(value) {
5548
5823
  return typeof value === "string" ? value : "";
5549
5824
  }
@@ -5562,7 +5837,10 @@ function parseList(value) {
5562
5837
  function describeConnection(connections) {
5563
5838
  if (connections === void 0) return { text: "Chargement\u2026", tone: "muted" };
5564
5839
  if (connections === null) {
5565
- return { text: "Ind\xE9termin\xE9e \u2014 les connexions de l\u2019instance n\u2019ont pas pu \xEAtre lues.", tone: "muted" };
5840
+ return {
5841
+ text: "Ind\xE9termin\xE9e \u2014 les connexions de l\u2019instance n\u2019ont pas pu \xEAtre lues.",
5842
+ tone: "muted"
5843
+ };
5566
5844
  }
5567
5845
  if (connections.length === 0) {
5568
5846
  return {
@@ -5579,13 +5857,17 @@ function describeConnection(connections) {
5579
5857
  tone: "error"
5580
5858
  };
5581
5859
  }
5582
- return { text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`, tone: "normal" };
5860
+ return {
5861
+ text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`,
5862
+ tone: "normal"
5863
+ };
5583
5864
  }
5584
5865
  function SettingsWarnings({ warnings }) {
5585
5866
  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)) });
5586
5867
  }
5587
5868
  function SettingsPage() {
5588
5869
  const { appSlug, role } = uiSdk.useAppContext();
5870
+ const pageHref = uiSdk.useAppPageHref();
5589
5871
  const canWrite = canWriteForRole(role);
5590
5872
  const api = uiSdk.useAppApi();
5591
5873
  const toast = uiSdk.useToast();
@@ -5608,7 +5890,12 @@ function SettingsPage() {
5608
5890
  react.useEffect(() => {
5609
5891
  if (wasSavingRef.current && !isSaving) {
5610
5892
  if (saveError === void 0) toast({ title: "R\xE9glages enregistr\xE9s.", variant: "success" });
5611
- else toast({ title: "\xC9chec de l'enregistrement", description: describeApiError(saveError), variant: "error" });
5893
+ else
5894
+ toast({
5895
+ title: "\xC9chec de l'enregistrement",
5896
+ description: describeApiError(saveError),
5897
+ variant: "error"
5898
+ });
5612
5899
  }
5613
5900
  wasSavingRef.current = isSaving;
5614
5901
  }, [isSaving, saveError, toast]);
@@ -5619,7 +5906,9 @@ function SettingsPage() {
5619
5906
  (async () => {
5620
5907
  let checkAppSlugs = [];
5621
5908
  try {
5622
- const installed = await apiRef.current.get("/platform/apps/installed");
5909
+ const installed = await apiRef.current.get(
5910
+ "/platform/apps/installed"
5911
+ );
5623
5912
  checkAppSlugs = installed.apps.map((a) => a.slug).filter((slug) => slug !== appSlug);
5624
5913
  if (!cancelled) setInstalledAppsUnavailable(false);
5625
5914
  } catch {
@@ -5627,7 +5916,9 @@ function SettingsPage() {
5627
5916
  if (!cancelled) setInstalledAppsUnavailable(true);
5628
5917
  }
5629
5918
  try {
5630
- const result = await apiRef.current.invoke("list-gorgias-views", { checkAppSlugs });
5919
+ const result = await apiRef.current.invoke("list-gorgias-views", {
5920
+ checkAppSlugs
5921
+ });
5631
5922
  if (!cancelled) {
5632
5923
  setViews(result.views);
5633
5924
  setUncheckedAppSlugs(result.uncheckedAppSlugs);
@@ -5858,7 +6149,15 @@ function SettingsPage() {
5858
6149
  ["appScopeTag", "Tag des tickets de l'application"]
5859
6150
  ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
5860
6151
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
5861
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
6152
+ /* @__PURE__ */ jsxRuntime.jsx(
6153
+ uiSdk.Input,
6154
+ {
6155
+ id: key,
6156
+ value: field(form[key]),
6157
+ onChange: (e) => set(key, e.target.value),
6158
+ disabled: !canWrite
6159
+ }
6160
+ )
5862
6161
  ] }, key)),
5863
6162
  /* @__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." }),
5864
6163
  /* @__PURE__ */ jsxRuntime.jsx(SettingsWarnings, { warnings: tagWarnings })
@@ -6014,7 +6313,7 @@ function SettingsPage() {
6014
6313
  "Catalogue de prompts indisponible \u2014 ",
6015
6314
  describeApiError(promptCatalogue.error)
6016
6315
  ] }),
6017
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
6316
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: pageHref("graph-canvas"), children: "Visualiser dans Graphe" })
6018
6317
  ] }) }),
6019
6318
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
6020
6319
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
@@ -7114,9 +7413,23 @@ function useSharedPrompts() {
7114
7413
  var SHARED_PREFIX2 = "shared/";
7115
7414
  var SLUG_RE = /^[a-z0-9-]{1,64}$/;
7116
7415
  var SLUG_ERROR = "Le nom doit contenir 1 \xE0 64 minuscules, chiffres ou tirets.";
7117
- function VersionsPanel({ name, canWrite, onClose }) {
7118
- const { versions, error, promote, deleteVersion, refresh } = usePromptVersions(name);
7119
- const draft = useNewVersionDraft();
7416
+ function VersionsPanel({
7417
+ name,
7418
+ canWrite,
7419
+ usage,
7420
+ isAdmin,
7421
+ canEditUsage,
7422
+ isSavingUsage,
7423
+ onUsageChange,
7424
+ system,
7425
+ isPublished,
7426
+ servesDefault,
7427
+ onPublished,
7428
+ onClose
7429
+ }) {
7430
+ const [exists, setExists] = react.useState(isPublished);
7431
+ const { versions, error, promote, deleteVersion, refresh } = usePromptVersions(exists ? name : null);
7432
+ const draft = useNewVersionDraft(servesDefault ? system?.defaultContent ?? "" : "");
7120
7433
  const [isCreating, setIsCreating] = react.useState(false);
7121
7434
  const [createError, setCreateError] = react.useState(null);
7122
7435
  const [deletingVersion, setDeletingVersion] = react.useState(null);
@@ -7126,6 +7439,7 @@ function VersionsPanel({ name, canWrite, onClose }) {
7126
7439
  const [compareRight, setCompareRight] = react.useState(null);
7127
7440
  const newVersionId = react.useId();
7128
7441
  const api = uiSdk.useAppApi();
7442
+ const { appSlug } = uiSdk.useAppContext();
7129
7443
  const toast = uiSdk.useToast();
7130
7444
  const sorted = [...versions].sort((a, b) => b.version - a.version);
7131
7445
  const expandedVersion = defaultExpandedVersion(versions);
@@ -7143,6 +7457,7 @@ function VersionsPanel({ name, canWrite, onClose }) {
7143
7457
  const version = promotingVersion;
7144
7458
  try {
7145
7459
  await promote(version);
7460
+ onPublished();
7146
7461
  toast({ title: `Version ${version} promue en production.`, variant: "success" });
7147
7462
  } catch (err) {
7148
7463
  toast({ title: "\xC9chec de la promotion", description: describeApiError(err), variant: "error" });
@@ -7168,13 +7483,21 @@ function VersionsPanel({ name, canWrite, onClose }) {
7168
7483
  setCreateError(null);
7169
7484
  const payload = { name, content: draft.content };
7170
7485
  try {
7171
- await api.invoke(
7486
+ const result = await api.invoke(
7172
7487
  "create-shared-prompt-version",
7173
7488
  payload,
7174
7489
  { idempotencyKey: idempotencyKeyFor("create-shared-prompt-version", payload) }
7175
7490
  );
7176
7491
  draft.setContent("");
7177
- await refresh();
7492
+ if (exists) {
7493
+ await refresh();
7494
+ } else {
7495
+ await api.post(`/data/apps/${appSlug}/prompts/promote`, { name, version: result.version, label: PRODUCTION_LABEL }).catch(() => {
7496
+ toast({ title: "Version cr\xE9\xE9e, mais pas encore en production", description: "Promouvez-la pour qu'elle soit utilis\xE9e.", variant: "error" });
7497
+ });
7498
+ setExists(true);
7499
+ onPublished();
7500
+ }
7178
7501
  } catch (err) {
7179
7502
  setCreateError(describeInvokeError(err));
7180
7503
  } finally {
@@ -7184,6 +7507,37 @@ function VersionsPanel({ name, canWrite, onClose }) {
7184
7507
  return /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.SidePanel, { open: true, onClose, title: name, description: "Ressource commune \xE0 l'entreprise \u2014 toute nouvelle version s'applique \xE0 toutes les apps qui utilisent ce prompt.", className: PROMPT_PANEL_CLASS, children: [
7185
7508
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": "shared-prompt-versions", className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto", children: [
7186
7509
  error !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: "Erreur lors du chargement des versions." }),
7510
+ system && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1 rounded-md border bg-muted/40 p-3 text-sm", children: [
7511
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: "Prompt syst\xE8me" }),
7512
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground", children: [
7513
+ system.description,
7514
+ " Il existe toujours et son nom ne peut pas changer : seul son texte se modifie."
7515
+ ] }),
7516
+ (!exists || versions.length > 0 && !hasActiveVersion) && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground", children: [
7517
+ "Aucune version en production : le texte par d\xE9faut est utilis\xE9.",
7518
+ exists ? " Promouvez une version pour la mettre en service." : " Cr\xE9ez une version pour le modifier."
7519
+ ] })
7520
+ ] }),
7521
+ !system && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
7522
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "block text-sm font-medium", children: "Utilisation" }),
7523
+ /* @__PURE__ */ jsxRuntime.jsx(
7524
+ uiSdk.Select,
7525
+ {
7526
+ "aria-label": "Utilisation",
7527
+ value: usage,
7528
+ onValueChange: (value) => {
7529
+ if (isPromptUsage(value)) onUsageChange(value);
7530
+ },
7531
+ items: PROMPT_USAGE_OPTIONS,
7532
+ disabled: !canEditUsage || isSavingUsage
7533
+ }
7534
+ ),
7535
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
7536
+ PROMPT_USAGE_HINTS[usage],
7537
+ " Ce r\xE9glage ne vaut que pour cette app.",
7538
+ !isAdmin && " Seul un administrateur de l'app peut le changer."
7539
+ ] })
7540
+ ] }),
7187
7541
  versions.length > 0 && !hasActiveVersion && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "rounded-md border border-status-warning/40 bg-status-warning/10 p-2 text-sm text-status-warning", children: "Aucune version active \u2014 aucune version ne porte le label \xAB production \xBB." }),
7188
7542
  versions.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { variant: "outline", size: "sm", onClick: openCompare, children: "Comparer" }) }),
7189
7543
  isComparing && compareLeft !== null && compareRight !== null && /* @__PURE__ */ jsxRuntime.jsx(
@@ -7208,7 +7562,7 @@ function VersionsPanel({ name, canWrite, onClose }) {
7208
7562
  },
7209
7563
  v.version
7210
7564
  )),
7211
- sorted.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Aucune version pour l'instant." })
7565
+ sorted.length === 0 && exists && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Aucune version pour l'instant." })
7212
7566
  ] }),
7213
7567
  canWrite && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 border-t pt-3", children: [
7214
7568
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: newVersionId, className: "block text-sm font-medium", children: "Nouvelle version" }),
@@ -7336,16 +7690,61 @@ function SharedPromptsPage() {
7336
7690
  const { role } = uiSdk.useAppContext();
7337
7691
  const canWrite = canWriteForRole(role);
7338
7692
  const { prompts, isLoading, error, refresh } = useSharedPrompts();
7693
+ const { usageOf, setUsage, isReady: areUsagesReady, isSaving: isSavingUsage, saveError: usageSaveError } = useSharedPromptUsages();
7694
+ const toast = uiSdk.useToast();
7339
7695
  const [selected, setSelected] = react.useState(null);
7340
7696
  const [isCreateOpen, setIsCreateOpen] = react.useState(false);
7697
+ const wasSavingUsageRef = react.useRef(false);
7698
+ react.useEffect(() => {
7699
+ if (wasSavingUsageRef.current && !isSavingUsage) {
7700
+ if (usageSaveError === void 0) toast({ title: "Utilisation enregistr\xE9e.", variant: "success" });
7701
+ else toast({ title: "\xC9chec de l'enregistrement", description: describeApiError(usageSaveError), variant: "error" });
7702
+ }
7703
+ wasSavingUsageRef.current = isSavingUsage;
7704
+ }, [isSavingUsage, usageSaveError, toast]);
7705
+ const publishedNames = new Set(prompts.map((prompt) => prompt.name));
7706
+ const rows = isLoading || error ? prompts : [
7707
+ ...prompts,
7708
+ ...SYSTEM_PROMPTS.filter((system) => !publishedNames.has(system.name)).map((system) => ({
7709
+ name: system.name,
7710
+ labels: [],
7711
+ latestVersion: 0,
7712
+ isUnpublished: true
7713
+ }))
7714
+ ].sort((a, b) => a.name.localeCompare(b.name));
7715
+ const selectedSystem = selected ? systemPromptOf(selected) : void 0;
7341
7716
  const columns = [
7342
- { key: "name", header: "Nom", cell: (row) => row.name },
7717
+ {
7718
+ key: "name",
7719
+ header: "Nom",
7720
+ cell: (row) => systemPromptOf(row.name) ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-2", children: [
7721
+ row.name,
7722
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { children: "Syst\xE8me" })
7723
+ ] }) : row.name
7724
+ },
7725
+ {
7726
+ key: "usage",
7727
+ header: "Utilisation",
7728
+ cell: (row) => {
7729
+ const usage = systemPromptOf(row.name)?.usage ?? usageOf(row.name);
7730
+ return usage === DEFAULT_PROMPT_USAGE ? PROMPT_USAGE_LABELS[usage] : /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { variant: "info", children: PROMPT_USAGE_LABELS[usage] });
7731
+ }
7732
+ },
7343
7733
  {
7344
7734
  key: "labels",
7345
7735
  header: "Labels",
7346
7736
  cell: (row) => row.labels.length > 0 ? row.labels.map((l) => /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Badge, { children: l }, l)) : "\u2014"
7347
7737
  },
7348
- { key: "latestVersion", header: "Derni\xE8re version", align: "right", cell: (row) => `v${row.latestVersion}` }
7738
+ {
7739
+ key: "latestVersion",
7740
+ header: "Derni\xE8re version",
7741
+ align: "right",
7742
+ cell: (row) => {
7743
+ if (row.isUnpublished) return "Texte par d\xE9faut";
7744
+ const servesDefault = systemPromptOf(row.name) && !row.labels.includes(PRODUCTION_LABEL);
7745
+ return servesDefault ? `v${row.latestVersion} \xB7 texte par d\xE9faut utilis\xE9` : `v${row.latestVersion}`;
7746
+ }
7747
+ }
7349
7748
  ];
7350
7749
  return /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { children: [
7351
7750
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7361,7 +7760,7 @@ function SharedPromptsPage() {
7361
7760
  uiSdk.DataTable,
7362
7761
  {
7363
7762
  columns,
7364
- rows: prompts,
7763
+ rows,
7365
7764
  rowId: (row) => row.name,
7366
7765
  manual: true,
7367
7766
  loading: isLoading,
@@ -7373,7 +7772,24 @@ function SharedPromptsPage() {
7373
7772
  empty: "Aucun prompt \xAB shared/* \xBB accessible depuis cette app."
7374
7773
  }
7375
7774
  ),
7376
- selected && /* @__PURE__ */ jsxRuntime.jsx(VersionsPanel, { name: selected, canWrite, onClose: () => setSelected(null) }, selected),
7775
+ selected && /* @__PURE__ */ jsxRuntime.jsx(
7776
+ VersionsPanel,
7777
+ {
7778
+ name: selected,
7779
+ canWrite,
7780
+ usage: usageOf(selected),
7781
+ isAdmin: role === "ADMIN",
7782
+ canEditUsage: role === "ADMIN" && areUsagesReady,
7783
+ isSavingUsage,
7784
+ onUsageChange: (usage) => void setUsage(selected, usage),
7785
+ system: selectedSystem,
7786
+ isPublished: !rows.some((row) => row.name === selected && row.isUnpublished),
7787
+ servesDefault: selectedSystem !== void 0 && !rows.some((row) => row.name === selected && row.labels.includes(PRODUCTION_LABEL)),
7788
+ onPublished: () => void refresh(),
7789
+ onClose: () => setSelected(null)
7790
+ },
7791
+ selected
7792
+ ),
7377
7793
  isCreateOpen && /* @__PURE__ */ jsxRuntime.jsx(
7378
7794
  NewSharedPromptModal,
7379
7795
  {
@@ -7650,7 +8066,8 @@ function parseRunResult(result) {
7650
8066
  };
7651
8067
  }
7652
8068
  function describeRunDecision(result, mode) {
7653
- if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed") return "Conversation finie \u2014 aucune r\xE9ponse.";
8069
+ if (result.stoppedAt === "FC" && result.outcome === "no_reply_needed")
8070
+ return "Conversation finie \u2014 aucune r\xE9ponse.";
7654
8071
  if (result.stoppedAt !== null) return `Arr\xEAt en ${result.stoppedAt}.`;
7655
8072
  const category = result.categoryName ? ` (cat\xE9gorie \xAB ${result.categoryName} \xBB)` : "";
7656
8073
  if (result.outcome === "sent") {
@@ -7662,6 +8079,7 @@ function describeRunDecision(result, mode) {
7662
8079
  function FollowupWebhookCard2() {
7663
8080
  const api = uiSdk.useAppApi();
7664
8081
  const { appSlug } = uiSdk.useAppContext();
8082
+ const pageHref = uiSdk.useAppPageHref();
7665
8083
  const toast = uiSdk.useToast();
7666
8084
  const ticketId = react.useId();
7667
8085
  const [ticket, setTicket] = react.useState("");
@@ -7691,7 +8109,9 @@ function FollowupWebhookCard2() {
7691
8109
  setIsTesting(true);
7692
8110
  setTest(null);
7693
8111
  try {
7694
- setTest(await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode }));
8112
+ setTest(
8113
+ await api.invoke("test-gorgias-webhook", { ticketId: ticket.trim(), mode })
8114
+ );
7695
8115
  } catch (err) {
7696
8116
  toast({ title: "\xC9chec du test", description: describeInvokeError(err), variant: "error" });
7697
8117
  } finally {
@@ -7719,9 +8139,36 @@ function FollowupWebhookCard2() {
7719
8139
  className: "max-w-48"
7720
8140
  }
7721
8141
  ),
7722
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("diagnostic"), disabled, children: "Diagnostic" }),
7723
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => void runTest("generate"), disabled, children: "G\xE9n\xE9rer sans envoyer" }),
7724
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { type: "button", variant: "outline", onClick: () => setConfirmingRealRun(true), disabled, children: "Ex\xE9cution r\xE9elle" })
8142
+ /* @__PURE__ */ jsxRuntime.jsx(
8143
+ uiSdk.Button,
8144
+ {
8145
+ type: "button",
8146
+ variant: "outline",
8147
+ onClick: () => void runTest("diagnostic"),
8148
+ disabled,
8149
+ children: "Diagnostic"
8150
+ }
8151
+ ),
8152
+ /* @__PURE__ */ jsxRuntime.jsx(
8153
+ uiSdk.Button,
8154
+ {
8155
+ type: "button",
8156
+ variant: "outline",
8157
+ onClick: () => void runTest("generate"),
8158
+ disabled,
8159
+ children: "G\xE9n\xE9rer sans envoyer"
8160
+ }
8161
+ ),
8162
+ /* @__PURE__ */ jsxRuntime.jsx(
8163
+ uiSdk.Button,
8164
+ {
8165
+ type: "button",
8166
+ variant: "outline",
8167
+ onClick: () => setConfirmingRealRun(true),
8168
+ disabled,
8169
+ children: "Ex\xE9cution r\xE9elle"
8170
+ }
8171
+ )
7725
8172
  ] }),
7726
8173
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
7727
8174
  "Le diagnostic \xE9value les m\xEAmes conditions que le webhook, sans aucun effet de bord.",
@@ -7761,7 +8208,13 @@ function FollowupWebhookCard2() {
7761
8208
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap rounded border bg-muted/30 p-2 text-xs", children: draftText })
7762
8209
  ] }),
7763
8210
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs", children: [
7764
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/tickets?ticket=${encodeURIComponent(runResult.ticketId ?? test.ticketId)}`, children: "Ouvrir la fiche du ticket" }),
8211
+ /* @__PURE__ */ jsxRuntime.jsx(
8212
+ uiSdk.Link,
8213
+ {
8214
+ href: pageHref("tickets", { ticket: runResult.ticketId ?? test.ticketId }),
8215
+ children: "Ouvrir la fiche du ticket"
8216
+ }
8217
+ ),
7765
8218
  runResult.ticketUrl !== null && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7766
8219
  " \xB7 ",
7767
8220
  /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: runResult.ticketUrl, target: "_blank", rel: "noopener noreferrer", children: "Ouvrir dans Gorgias" })
@@ -7782,8 +8235,7 @@ function FollowupWebhookCard2() {
7782
8235
  description: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7783
8236
  "Le ticket ",
7784
8237
  ticket.trim(),
7785
- " va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et",
7786
- " ",
8238
+ " va \xEAtre trait\xE9 comme un vrai message suivant : g\xE9n\xE9ration, garde-fous, et ",
7787
8239
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "envoi r\xE9el au client" }),
7788
8240
  " si sa cat\xE9gorie est en r\xE9ponse automatique. Pour tout voir sans rien envoyer, utilisez \xAB G\xE9n\xE9rer sans envoyer \xBB."
7789
8241
  ] }),