@apotech-os/support-kit 2.8.0 → 2.9.1

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
@@ -990,6 +990,7 @@ function idempotencyKeyFor(operation, payload) {
990
990
  var SETTINGS_ISSUE_LABELS = {
991
991
  sourceViewId: "Vue Gorgias source requise \u2014 choisissez la vue que cette app poss\xE8de.",
992
992
  nodes: "nodes.triage doit \xEAtre configur\xE9 \u2014 une \xE9tape de triage \xE0 null ne triagerait rien.",
993
+ nodePrompt: "Chaque \xE9tape active doit d\xE9signer un prompt Langfuse \u2014 sans prompt, l'\xE9tape n'a rien \xE0 dire au mod\xE8le.",
993
994
  senderEmail: "Adresse d'envoi requise quand l'envoi automatique est actif (sauf en mode WhatsApp \xAB auto_reply \xBB)."
994
995
  };
995
996
  function settingsIssueLabel(key, fallback) {
@@ -3178,6 +3179,13 @@ function validateSettings(settings) {
3178
3179
  message: "nodes.triage must be configured \u2014 a null triage step would triage nothing."
3179
3180
  });
3180
3181
  }
3182
+ const stepsWithoutPrompt = stepsMissingPrompt(settings.nodes);
3183
+ if (stepsWithoutPrompt.length > 0) {
3184
+ issues.push({
3185
+ key: "nodePrompt",
3186
+ message: `Every active step needs a Langfuse prompt \u2014 missing on: ${stepsWithoutPrompt.join(", ")}.`
3187
+ });
3188
+ }
3181
3189
  const autoSendEnabled = settings.autoSendEnabled === true;
3182
3190
  const isWhatsappAutoReply = settings.whatsappMode === "auto_reply";
3183
3191
  if (autoSendEnabled && !isWhatsappAutoReply && !isNonEmptyString(settings.senderEmail)) {
@@ -3191,6 +3199,20 @@ function validateSettings(settings) {
3191
3199
  function isNonEmptyString(value) {
3192
3200
  return typeof value === "string" && value.length > 0;
3193
3201
  }
3202
+ var STEPS_REQUIRING_PROMPT = ["triage", "escalate", "evaluate", "revise"];
3203
+ function stepsMissingPrompt(nodes) {
3204
+ if (typeof nodes !== "object" || nodes === null) return [];
3205
+ const byStep = nodes;
3206
+ return STEPS_REQUIRING_PROMPT.filter((step) => {
3207
+ const node = byStep[step];
3208
+ if (typeof node !== "object" || node === null) return false;
3209
+ return !isNonEmptyString(promptNameOf(node));
3210
+ });
3211
+ }
3212
+ function promptNameOf(node) {
3213
+ const prompt = node.prompt;
3214
+ return typeof prompt === "object" && prompt !== null ? prompt.name : void 0;
3215
+ }
3194
3216
  function isConfiguredNode(nodes) {
3195
3217
  if (typeof nodes !== "object" || nodes === null) return false;
3196
3218
  const triage = nodes.triage;
@@ -3523,6 +3545,25 @@ function stepBoolean(step, field2, fallback) {
3523
3545
  const value = step?.[field2];
3524
3546
  return typeof value === "boolean" ? value : fallback;
3525
3547
  }
3548
+ function stepUsesAgentPrompt(key) {
3549
+ return key === "draft";
3550
+ }
3551
+ var DEFAULT_PROMPT_LABEL = "production";
3552
+ function stepPromptName(step) {
3553
+ return readPromptField(step, "name");
3554
+ }
3555
+ function stepPromptLabel(step) {
3556
+ return readPromptField(step, "label") || DEFAULT_PROMPT_LABEL;
3557
+ }
3558
+ function readPromptField(step, field2) {
3559
+ const prompt = step?.prompt;
3560
+ if (typeof prompt !== "object" || prompt === null) return "";
3561
+ const value = prompt[field2];
3562
+ return typeof value === "string" ? value : "";
3563
+ }
3564
+ function promptPatch(name, label) {
3565
+ return { prompt: { name, label } };
3566
+ }
3526
3567
  function stepReasoning(step) {
3527
3568
  const value = step?.reasoning;
3528
3569
  return REASONING_EFFORTS.some((effort) => effort.value === value) ? value : "off";
@@ -3602,7 +3643,14 @@ function applyPreset(value, preset, restore) {
3602
3643
  return next;
3603
3644
  }
3604
3645
  var PERCENT = 100;
3605
- function PipelineNodesForm({ value, onChange, canWrite, issueMessage }) {
3646
+ function PipelineNodesForm({
3647
+ value,
3648
+ onChange,
3649
+ canWrite,
3650
+ issueMessage,
3651
+ prompts,
3652
+ promptsLoading = false
3653
+ }) {
3606
3654
  const [remembered, setRemembered] = react.useState({});
3607
3655
  react.useEffect(() => {
3608
3656
  setRemembered((prev) => {
@@ -3647,15 +3695,13 @@ function PipelineNodesForm({ value, onChange, canWrite, issueMessage }) {
3647
3695
  value,
3648
3696
  canWrite,
3649
3697
  issueMessage: step.key === "triage" ? issueMessage : null,
3698
+ prompts,
3699
+ promptsLoading,
3650
3700
  onToggle: (on) => toggleStep(step.key, on),
3651
3701
  onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
3652
3702
  },
3653
3703
  step.key
3654
- )) }),
3655
- /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
3656
- /* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cursor-pointer text-sm font-medium", children: "Mode avanc\xE9 (JSON)" }),
3657
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsx(NodesJsonField, { value, onChange, disabled: !canWrite }) })
3658
- ] })
3704
+ )) })
3659
3705
  ] });
3660
3706
  }
3661
3707
  function StepRow({
@@ -3663,11 +3709,14 @@ function StepRow({
3663
3709
  value,
3664
3710
  canWrite,
3665
3711
  issueMessage,
3712
+ prompts,
3713
+ promptsLoading,
3666
3714
  onToggle,
3667
3715
  onPatch
3668
3716
  }) {
3669
3717
  const enabled = isStepEnabled(value, step.key);
3670
3718
  const blockedReason = stepBlockedReason(value, step.key);
3719
+ const promptFieldId = react.useId();
3671
3720
  const triageLocked = step.key === "triage" && enabled;
3672
3721
  const editable = canWrite && !blockedReason && !triageLocked;
3673
3722
  const toggle = /* @__PURE__ */ jsxRuntime.jsx(
@@ -3692,6 +3741,21 @@ function StepRow({
3692
3741
  ] }),
3693
3742
  blockedReason && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: blockedReason }),
3694
3743
  issueMessage && !enabled && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: issueMessage }),
3744
+ enabled && // In the row itself, NOT behind « Options »: this is the one field
3745
+ // without which the step cannot run at all, so it is stated where the
3746
+ // step is, next to its own switch.
3747
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md bg-muted/40 p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
3748
+ StepPromptField,
3749
+ {
3750
+ step,
3751
+ settings: readStep(value, step.key),
3752
+ disabled: !canWrite || blockedReason !== null,
3753
+ prompts,
3754
+ promptsLoading,
3755
+ id: promptFieldId,
3756
+ onPatch
3757
+ }
3758
+ ) }),
3695
3759
  enabled && /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
3696
3760
  /* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cursor-pointer text-sm text-muted-foreground", children: "Options" }),
3697
3761
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 grid gap-4 rounded-md bg-muted/40 p-3 sm:grid-cols-2", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -3830,6 +3894,63 @@ function StepOptions({
3830
3894
  ] })
3831
3895
  ] });
3832
3896
  }
3897
+ function StepPromptField({
3898
+ step,
3899
+ settings,
3900
+ disabled,
3901
+ prompts,
3902
+ promptsLoading,
3903
+ id,
3904
+ onPatch
3905
+ }) {
3906
+ if (stepUsesAgentPrompt(step.key)) {
3907
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Le prompt de cette \xE9tape est celui de l'agent qui r\xE9dige \u2014 il se choisit sur la page Agents." });
3908
+ }
3909
+ const name = stepPromptName(settings);
3910
+ const label = stepPromptLabel(settings);
3911
+ const known = prompts.find((entry) => entry.name === name);
3912
+ const orphaned = name !== "" && !known && !promptsLoading;
3913
+ const labels = known?.labels.length ? known.labels : [DEFAULT_PROMPT_LABEL];
3914
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3915
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "Prompt Langfuse" }),
3916
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 sm:grid-cols-2", children: [
3917
+ /* @__PURE__ */ jsxRuntime.jsx(
3918
+ uiSdk.Select,
3919
+ {
3920
+ "aria-label": `Prompt \u2014 ${step.label}`,
3921
+ value: known ? name : void 0,
3922
+ onValueChange: (next) => onPatch(promptPatch(next, DEFAULT_PROMPT_LABEL)),
3923
+ items: [
3924
+ ...orphaned ? [{ value: name, label: `${name} \u2014 introuvable dans Langfuse` }] : [],
3925
+ ...prompts.map((entry) => ({ value: entry.name, label: entry.name }))
3926
+ ],
3927
+ disabled: disabled || promptsLoading
3928
+ }
3929
+ ),
3930
+ /* @__PURE__ */ jsxRuntime.jsx(
3931
+ uiSdk.Select,
3932
+ {
3933
+ "aria-label": `Version du prompt \u2014 ${step.label}`,
3934
+ value: labels.includes(label) ? label : void 0,
3935
+ onValueChange: (next) => onPatch(promptPatch(name, next)),
3936
+ items: labels.map((entry) => ({ value: entry, label: entry })),
3937
+ disabled: disabled || promptsLoading || name === ""
3938
+ }
3939
+ )
3940
+ ] }),
3941
+ 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." }),
3942
+ orphaned && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-sm text-destructive", children: [
3943
+ "\xAB ",
3944
+ name,
3945
+ " \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."
3946
+ ] }),
3947
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
3948
+ "Le label suit les promotions faites dans Langfuse : promouvoir une nouvelle version sous \xAB ",
3949
+ label,
3950
+ " \xBB la met en service sans repasser ici."
3951
+ ] })
3952
+ ] });
3953
+ }
3833
3954
  function useIds(stepKey) {
3834
3955
  const base2 = react.useId();
3835
3956
  return {
@@ -3840,68 +3961,36 @@ function useIds(stepKey) {
3840
3961
  minConfidence: `${base2}-${stepKey}-min-confidence`
3841
3962
  };
3842
3963
  }
3843
- function NodesJsonField({
3844
- value,
3845
- onChange,
3846
- disabled
3847
- }) {
3848
- const id = react.useId();
3849
- const serialized = stringify(value);
3850
- const [text, setText] = react.useState(serialized);
3851
- const [parseError, setParseError] = react.useState(null);
3852
- const emittedRef = react.useRef(serialized);
3964
+ function usePromptCatalogue() {
3965
+ const { appSlug } = uiSdk.useAppContext();
3966
+ const api = uiSdk.useAppApi();
3967
+ const [prompts, setPrompts] = react.useState([]);
3968
+ const [isLoading, setIsLoading] = react.useState(true);
3969
+ const [error, setError] = react.useState(void 0);
3970
+ const clientRef = react.useRef(api);
3971
+ clientRef.current = api;
3972
+ const requestIdRef = react.useRef(0);
3973
+ const isMountedRef = react.useRef(true);
3853
3974
  react.useEffect(() => {
3854
- if (serialized === emittedRef.current) return;
3855
- emittedRef.current = serialized;
3856
- setText(serialized);
3857
- setParseError(null);
3858
- }, [serialized]);
3859
- function handleChange(next) {
3860
- setText(next);
3861
- try {
3862
- const parsed = JSON.parse(next);
3863
- emittedRef.current = stringify(parsed);
3864
- onChange(parsed);
3865
- setParseError(null);
3866
- } catch {
3867
- setParseError("JSON invalide \u2014 la derni\xE8re valeur valide est conserv\xE9e tant que ce texte ne parse pas.");
3868
- }
3869
- }
3870
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3871
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "\xC9tapes du graphe (JSON)" }),
3872
- /* @__PURE__ */ jsxRuntime.jsx(
3873
- uiSdk.Textarea,
3874
- {
3875
- id,
3876
- className: "font-mono text-xs",
3877
- rows: 10,
3878
- value: text,
3879
- disabled,
3880
- onChange: (e) => handleChange(e.target.value)
3881
- }
3882
- ),
3883
- parseError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-destructive", children: parseError }),
3884
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
3885
- "Chaque cl\xE9 optionnelle (",
3886
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "escalate" }),
3887
- ", ",
3888
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "draft" }),
3889
- ", ",
3890
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "evaluate" }),
3891
- ",",
3892
- " ",
3893
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "revise" }),
3894
- ") accepte ",
3895
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "null" }),
3896
- " pour d\xE9sactiver l'\xE9tape (\xA73.6).",
3897
- " ",
3898
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "triage" }),
3899
- " est obligatoire."
3900
- ] })
3901
- ] });
3902
- }
3903
- function stringify(value) {
3904
- return JSON.stringify(value ?? null, null, 2);
3975
+ isMountedRef.current = true;
3976
+ const requestId = ++requestIdRef.current;
3977
+ setIsLoading(true);
3978
+ void clientRef.current.get(`/data/apps/${appSlug}/prompts`).then((catalogue) => {
3979
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3980
+ setPrompts(catalogue);
3981
+ setError(void 0);
3982
+ }).catch((err) => {
3983
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3984
+ setError(err);
3985
+ }).finally(() => {
3986
+ if (requestId !== requestIdRef.current || !isMountedRef.current) return;
3987
+ setIsLoading(false);
3988
+ });
3989
+ return () => {
3990
+ isMountedRef.current = false;
3991
+ };
3992
+ }, [appSlug]);
3993
+ return { prompts, isLoading, error };
3905
3994
  }
3906
3995
  var WHATSAPP_MODE_LABELS = {
3907
3996
  escalate_only: "Escalade uniquement",
@@ -3957,6 +4046,7 @@ function SettingsPage() {
3957
4046
  const [uncheckedAppSlugs, setUncheckedAppSlugs] = react.useState([]);
3958
4047
  const [installedAppsUnavailable, setInstalledAppsUnavailable] = react.useState(false);
3959
4048
  const [connections, setConnections] = react.useState(void 0);
4049
+ const promptCatalogue = usePromptCatalogue();
3960
4050
  const formInitializedRef = react.useRef(false);
3961
4051
  react.useEffect(() => {
3962
4052
  if (settings && !formInitializedRef.current) {
@@ -4025,319 +4115,333 @@ function SettingsPage() {
4025
4115
  checked ? [.../* @__PURE__ */ new Set([...guardrailsActive, id])] : guardrailsActive.filter((g) => g !== id)
4026
4116
  );
4027
4117
  }
4028
- return /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { className: "max-w-3xl", children: [
4029
- /* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title: "Param\xE8tres", description: "Configuration du pipeline de support." }),
4030
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "source", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4031
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Source" }),
4032
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4033
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
4034
- /* @__PURE__ */ jsxRuntime.jsx(
4035
- "p",
4036
- {
4037
- className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
4038
- children: connection.text
4039
- }
4040
- ),
4041
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Cette application utilise la connexion Gorgias de l\u2019instance ; elle se r\xE8gle dans les int\xE9grations de la plateforme, pas ici." })
4042
- ] }),
4043
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4044
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
4045
- views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4046
- uiSdk.Select,
4047
- {
4048
- "aria-label": "Vue Gorgias source",
4049
- value: sourceViewId || void 0,
4050
- onValueChange: (v) => set("sourceViewId", v),
4051
- items: views.map((v) => ({ value: v.id, label: v.name })),
4052
- disabled: !canWrite
4053
- }
4054
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4055
- uiSdk.Input,
4056
- {
4057
- id: "sourceViewId",
4058
- value: sourceViewId,
4059
- onChange: (e) => set("sourceViewId", e.target.value),
4060
- disabled: !canWrite
4061
- }
4062
- )
4063
- ] }),
4064
- claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-status-pending", children: [
4065
- "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
4066
- claimedView.claimedByAppSlugs.join(", ")
4067
- ] }),
4068
- claimUnverifiable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Conflit avec une autre application : inv\xE9rifiable (droits administrateur plateforme requis pour lister les applications install\xE9es). Ce contr\xF4le est informatif \u2014 il ne bloque rien, mais ne peut pas garantir l'absence de conflit." }),
4069
- sourceViewId === "" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: "Aucune vue Gorgias configur\xE9e \u2014 le triage ne peut pas d\xE9marrer tant que ce champ n'est pas renseign\xE9." })
4070
- ] }) }),
4071
- sourceViewId === "" ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4072
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "cadence", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4073
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Cadence" }),
4074
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4075
- /* @__PURE__ */ jsxRuntime.jsx(
4076
- uiSdk.Switch,
4077
- {
4078
- "aria-label": "Triage activ\xE9",
4079
- checked: bool(form.triageEnabled),
4080
- onCheckedChange: (v) => set("triageEnabled", v),
4081
- disabled: !canWrite
4082
- }
4083
- ),
4084
- "Triage activ\xE9"
4085
- ] }),
4086
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4087
- /* @__PURE__ */ jsxRuntime.jsx(
4088
- uiSdk.Switch,
4089
- {
4090
- "aria-label": "Mode d'essai",
4091
- checked: bool(form.dryRun),
4092
- onCheckedChange: (v) => set("dryRun", v),
4093
- disabled: !canWrite
4094
- }
4095
- ),
4096
- "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
4097
- ] }),
4098
- /* @__PURE__ */ jsxRuntime.jsx(
4099
- NumberField,
4100
- {
4101
- id: "batchLimit",
4102
- label: "Taille de lot",
4103
- value: num(form.batchLimit),
4104
- onChange: (v) => set("batchLimit", v),
4105
- disabled: !canWrite,
4106
- min: 1,
4107
- integer: true
4108
- }
4109
- ),
4110
- /* @__PURE__ */ jsxRuntime.jsx(
4111
- NumberField,
4112
- {
4113
- id: "triageIntervalMinutes",
4114
- label: "Intervalle de triage (minutes)",
4115
- value: num(form.triageIntervalMinutes),
4116
- onChange: (v) => set("triageIntervalMinutes", v),
4117
- disabled: !canWrite,
4118
- min: 1,
4119
- integer: true
4120
- }
4121
- ),
4122
- /* @__PURE__ */ jsxRuntime.jsx(
4123
- NumberField,
4124
- {
4125
- id: "responseTtlMinutes",
4126
- label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
4127
- value: num(form.responseTtlMinutes),
4128
- onChange: (v) => set("responseTtlMinutes", v),
4129
- disabled: !canWrite,
4130
- min: 1,
4131
- integer: true
4132
- }
4133
- )
4134
- ] }) }),
4135
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "envoi", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4136
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Envoi" }),
4137
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4138
- /* @__PURE__ */ jsxRuntime.jsx(
4139
- uiSdk.Switch,
4140
- {
4141
- "aria-label": "Envoi automatique",
4142
- checked: bool(form.autoSendEnabled),
4143
- onCheckedChange: (v) => set("autoSendEnabled", v),
4144
- disabled: !canWrite
4145
- }
4146
- ),
4147
- "Envoi automatique"
4148
- ] }),
4118
+ return (
4119
+ // No PageHeader here, unlike every other page of this kit: this one is
4120
+ // mounted INSIDE the platform's own settings screen
4121
+ // (`app-settings-view.tsx`), which already prints the breadcrumb and an
4122
+ // `<h1>` carrying this page's title. A second « Paramètres » heading right
4123
+ // under the first said nothing the operator had not just read, and pushed
4124
+ // the one field that actually gates the app — the Gorgias source view —
4125
+ // further down the screen.
4126
+ /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { className: "max-w-3xl", children: [
4127
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "source", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4128
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Source" }),
4149
4129
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4150
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4151
- /* @__PURE__ */ jsxRuntime.jsx(
4152
- uiSdk.Input,
4153
- {
4154
- id: "senderEmail",
4155
- value: field(form.senderEmail),
4156
- onChange: (e) => set("senderEmail", e.target.value),
4157
- disabled: !canWrite
4158
- }
4159
- )
4160
- ] }),
4161
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4130
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
4162
4131
  /* @__PURE__ */ jsxRuntime.jsx(
4163
- uiSdk.Switch,
4132
+ "p",
4164
4133
  {
4165
- "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
4166
- checked: bool(form.requireHighTriageConfidence),
4167
- onCheckedChange: (v) => set("requireHighTriageConfidence", v),
4168
- disabled: !canWrite
4134
+ className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
4135
+ children: connection.text
4169
4136
  }
4170
4137
  ),
4171
- "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
4138
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Cette application utilise la connexion Gorgias de l\u2019instance ; elle se r\xE8gle dans les int\xE9grations de la plateforme, pas ici." })
4172
4139
  ] }),
4173
4140
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4174
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
4175
- /* @__PURE__ */ jsxRuntime.jsx(
4141
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
4142
+ views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4176
4143
  uiSdk.Select,
4177
4144
  {
4178
- "aria-label": "Mode WhatsApp",
4179
- value: field(form.whatsappMode) || void 0,
4180
- onValueChange: (v) => set("whatsappMode", v),
4181
- items: WHATSAPP_MODE_OPTIONS,
4182
- disabled: !canWrite
4183
- }
4184
- )
4185
- ] })
4186
- ] }) }),
4187
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4188
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
4189
- [
4190
- ["unknownTag", "Tag inconnu"],
4191
- ["handledTag", "Tag trait\xE9"],
4192
- ["escalationTag", "Tag d'escalade"],
4193
- ["needsHumanTag", "Tag besoin humain"],
4194
- ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4195
- ["needsReviewTag", "Tag \xE0 revoir"],
4196
- ["followupTag", "Tag suivi requis"]
4197
- ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4198
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4199
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4200
- ] }, key))
4201
- ] }) }),
4202
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4203
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
4204
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4205
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
4206
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4207
- uiSdk.Checkbox,
4208
- {
4209
- label: guardrailHitLabel(id),
4210
- checked: guardrailsActive.includes(id),
4211
- onCheckedChange: (checked) => toggleGuardrail(id, checked),
4212
- disabled: !canWrite
4213
- },
4214
- id
4215
- )) })
4216
- ] }),
4217
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4218
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
4219
- /* @__PURE__ */ jsxRuntime.jsx(
4220
- uiSdk.Textarea,
4221
- {
4222
- id: "blocklist",
4223
- value: list(form.blocklist),
4224
- onChange: (e) => set("blocklist", parseList(e.target.value)),
4145
+ "aria-label": "Vue Gorgias source",
4146
+ value: sourceViewId || void 0,
4147
+ onValueChange: (v) => set("sourceViewId", v),
4148
+ items: views.map((v) => ({ value: v.id, label: v.name })),
4225
4149
  disabled: !canWrite
4226
4150
  }
4227
- )
4228
- ] }),
4229
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4230
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
4231
- /* @__PURE__ */ jsxRuntime.jsx(
4232
- uiSdk.Textarea,
4233
- {
4234
- id: "noreplySenders",
4235
- value: list(form.noreplySenders),
4236
- onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4237
- disabled: !canWrite
4238
- }
4239
- )
4240
- ] })
4241
- ] }) }),
4242
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4243
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4244
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4245
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4246
- /* @__PURE__ */ jsxRuntime.jsx(
4151
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4247
4152
  uiSdk.Input,
4248
4153
  {
4249
- id: "channelPromptEmail",
4250
- value: field(form.channelPromptEmail),
4251
- onChange: (e) => set("channelPromptEmail", e.target.value),
4154
+ id: "sourceViewId",
4155
+ value: sourceViewId,
4156
+ onChange: (e) => set("sourceViewId", e.target.value),
4252
4157
  disabled: !canWrite
4253
4158
  }
4254
4159
  )
4255
4160
  ] }),
4256
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4257
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4258
- /* @__PURE__ */ jsxRuntime.jsx(
4259
- uiSdk.Input,
4260
- {
4261
- id: "channelPromptWhatsapp",
4262
- value: field(form.channelPromptWhatsapp),
4263
- onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4264
- disabled: !canWrite
4265
- }
4266
- )
4267
- ] })
4161
+ claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-status-pending", children: [
4162
+ "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
4163
+ claimedView.claimedByAppSlugs.join(", ")
4164
+ ] }),
4165
+ claimUnverifiable && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Conflit avec une autre application : inv\xE9rifiable (droits administrateur plateforme requis pour lister les applications install\xE9es). Ce contr\xF4le est informatif \u2014 il ne bloque rien, mais ne peut pas garantir l'absence de conflit." }),
4166
+ sourceViewId === "" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: "Aucune vue Gorgias configur\xE9e \u2014 le triage ne peut pas d\xE9marrer tant que ce champ n'est pas renseign\xE9." })
4268
4167
  ] }) }),
4269
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4270
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Divers" }),
4271
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4168
+ sourceViewId === "" ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4169
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "cadence", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4170
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Cadence" }),
4171
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4172
+ /* @__PURE__ */ jsxRuntime.jsx(
4173
+ uiSdk.Switch,
4174
+ {
4175
+ "aria-label": "Triage activ\xE9",
4176
+ checked: bool(form.triageEnabled),
4177
+ onCheckedChange: (v) => set("triageEnabled", v),
4178
+ disabled: !canWrite
4179
+ }
4180
+ ),
4181
+ "Triage activ\xE9"
4182
+ ] }),
4183
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4184
+ /* @__PURE__ */ jsxRuntime.jsx(
4185
+ uiSdk.Switch,
4186
+ {
4187
+ "aria-label": "Mode d'essai",
4188
+ checked: bool(form.dryRun),
4189
+ onCheckedChange: (v) => set("dryRun", v),
4190
+ disabled: !canWrite
4191
+ }
4192
+ ),
4193
+ "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
4194
+ ] }),
4272
4195
  /* @__PURE__ */ jsxRuntime.jsx(
4273
- uiSdk.Checkbox,
4196
+ NumberField,
4274
4197
  {
4275
- checked: bool(form.renameEnabled),
4276
- onCheckedChange: (v) => set("renameEnabled", v === true),
4277
- disabled: !canWrite
4198
+ id: "batchLimit",
4199
+ label: "Taille de lot",
4200
+ value: num(form.batchLimit),
4201
+ onChange: (v) => set("batchLimit", v),
4202
+ disabled: !canWrite,
4203
+ min: 1,
4204
+ integer: true
4278
4205
  }
4279
4206
  ),
4280
- "Renommage de sujet activ\xE9"
4281
- ] }),
4282
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4283
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4284
4207
  /* @__PURE__ */ jsxRuntime.jsx(
4285
- uiSdk.Input,
4208
+ NumberField,
4286
4209
  {
4287
- id: "renameFrom",
4288
- value: field(form.renameFrom),
4289
- onChange: (e) => set("renameFrom", e.target.value),
4290
- disabled: !canWrite
4210
+ id: "triageIntervalMinutes",
4211
+ label: "Intervalle de triage (minutes)",
4212
+ value: num(form.triageIntervalMinutes),
4213
+ onChange: (v) => set("triageIntervalMinutes", v),
4214
+ disabled: !canWrite,
4215
+ min: 1,
4216
+ integer: true
4291
4217
  }
4292
- )
4293
- ] }),
4294
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4295
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4218
+ ),
4296
4219
  /* @__PURE__ */ jsxRuntime.jsx(
4297
- uiSdk.Input,
4220
+ NumberField,
4298
4221
  {
4299
- id: "renameTo",
4300
- value: field(form.renameTo),
4301
- onChange: (e) => set("renameTo", e.target.value),
4302
- disabled: !canWrite
4222
+ id: "responseTtlMinutes",
4223
+ label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
4224
+ value: num(form.responseTtlMinutes),
4225
+ onChange: (v) => set("responseTtlMinutes", v),
4226
+ disabled: !canWrite,
4227
+ min: 1,
4228
+ integer: true
4303
4229
  }
4304
4230
  )
4305
- ] }),
4306
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4307
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
4231
+ ] }) }),
4232
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "envoi", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4233
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Envoi" }),
4234
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4235
+ /* @__PURE__ */ jsxRuntime.jsx(
4236
+ uiSdk.Switch,
4237
+ {
4238
+ "aria-label": "Envoi automatique",
4239
+ checked: bool(form.autoSendEnabled),
4240
+ onCheckedChange: (v) => set("autoSendEnabled", v),
4241
+ disabled: !canWrite
4242
+ }
4243
+ ),
4244
+ "Envoi automatique"
4245
+ ] }),
4246
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4247
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4248
+ /* @__PURE__ */ jsxRuntime.jsx(
4249
+ uiSdk.Input,
4250
+ {
4251
+ id: "senderEmail",
4252
+ value: field(form.senderEmail),
4253
+ onChange: (e) => set("senderEmail", e.target.value),
4254
+ disabled: !canWrite
4255
+ }
4256
+ )
4257
+ ] }),
4258
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4259
+ /* @__PURE__ */ jsxRuntime.jsx(
4260
+ uiSdk.Switch,
4261
+ {
4262
+ "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
4263
+ checked: bool(form.requireHighTriageConfidence),
4264
+ onCheckedChange: (v) => set("requireHighTriageConfidence", v),
4265
+ disabled: !canWrite
4266
+ }
4267
+ ),
4268
+ "Exiger une confiance de triage \xE9lev\xE9e avant tout envoi automatique"
4269
+ ] }),
4270
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4271
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
4272
+ /* @__PURE__ */ jsxRuntime.jsx(
4273
+ uiSdk.Select,
4274
+ {
4275
+ "aria-label": "Mode WhatsApp",
4276
+ value: field(form.whatsappMode) || void 0,
4277
+ onValueChange: (v) => set("whatsappMode", v),
4278
+ items: WHATSAPP_MODE_OPTIONS,
4279
+ disabled: !canWrite
4280
+ }
4281
+ )
4282
+ ] })
4283
+ ] }) }),
4284
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4285
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
4286
+ [
4287
+ ["unknownTag", "Tag inconnu"],
4288
+ ["handledTag", "Tag trait\xE9"],
4289
+ ["escalationTag", "Tag d'escalade"],
4290
+ ["needsHumanTag", "Tag besoin humain"],
4291
+ ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4292
+ ["needsReviewTag", "Tag \xE0 revoir"],
4293
+ ["followupTag", "Tag suivi requis"]
4294
+ ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4295
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4296
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4297
+ ] }, key))
4298
+ ] }) }),
4299
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4300
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
4301
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4302
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
4303
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4304
+ uiSdk.Checkbox,
4305
+ {
4306
+ label: guardrailHitLabel(id),
4307
+ checked: guardrailsActive.includes(id),
4308
+ onCheckedChange: (checked) => toggleGuardrail(id, checked),
4309
+ disabled: !canWrite
4310
+ },
4311
+ id
4312
+ )) })
4313
+ ] }),
4314
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4315
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
4316
+ /* @__PURE__ */ jsxRuntime.jsx(
4317
+ uiSdk.Textarea,
4318
+ {
4319
+ id: "blocklist",
4320
+ value: list(form.blocklist),
4321
+ onChange: (e) => set("blocklist", parseList(e.target.value)),
4322
+ disabled: !canWrite
4323
+ }
4324
+ )
4325
+ ] }),
4326
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4327
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "noreplySenders", className: "mb-1 block text-sm font-medium", children: "Exp\xE9diteurs no-reply (s\xE9par\xE9s par des virgules)" }),
4328
+ /* @__PURE__ */ jsxRuntime.jsx(
4329
+ uiSdk.Textarea,
4330
+ {
4331
+ id: "noreplySenders",
4332
+ value: list(form.noreplySenders),
4333
+ onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4334
+ disabled: !canWrite
4335
+ }
4336
+ )
4337
+ ] })
4338
+ ] }) }),
4339
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4340
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4341
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4342
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4343
+ /* @__PURE__ */ jsxRuntime.jsx(
4344
+ uiSdk.Input,
4345
+ {
4346
+ id: "channelPromptEmail",
4347
+ value: field(form.channelPromptEmail),
4348
+ onChange: (e) => set("channelPromptEmail", e.target.value),
4349
+ disabled: !canWrite
4350
+ }
4351
+ )
4352
+ ] }),
4353
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4354
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4355
+ /* @__PURE__ */ jsxRuntime.jsx(
4356
+ uiSdk.Input,
4357
+ {
4358
+ id: "channelPromptWhatsapp",
4359
+ value: field(form.channelPromptWhatsapp),
4360
+ onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4361
+ disabled: !canWrite
4362
+ }
4363
+ )
4364
+ ] })
4365
+ ] }) }),
4366
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4367
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Divers" }),
4368
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4369
+ /* @__PURE__ */ jsxRuntime.jsx(
4370
+ uiSdk.Checkbox,
4371
+ {
4372
+ checked: bool(form.renameEnabled),
4373
+ onCheckedChange: (v) => set("renameEnabled", v === true),
4374
+ disabled: !canWrite
4375
+ }
4376
+ ),
4377
+ "Renommage de sujet activ\xE9"
4378
+ ] }),
4379
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4380
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4381
+ /* @__PURE__ */ jsxRuntime.jsx(
4382
+ uiSdk.Input,
4383
+ {
4384
+ id: "renameFrom",
4385
+ value: field(form.renameFrom),
4386
+ onChange: (e) => set("renameFrom", e.target.value),
4387
+ disabled: !canWrite
4388
+ }
4389
+ )
4390
+ ] }),
4391
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4392
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4393
+ /* @__PURE__ */ jsxRuntime.jsx(
4394
+ uiSdk.Input,
4395
+ {
4396
+ id: "renameTo",
4397
+ value: field(form.renameTo),
4398
+ onChange: (e) => set("renameTo", e.target.value),
4399
+ disabled: !canWrite
4400
+ }
4401
+ )
4402
+ ] }),
4403
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4404
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "statsTimezone", className: "mb-1 block text-sm font-medium", children: "Fuseau horaire des statistiques" }),
4405
+ /* @__PURE__ */ jsxRuntime.jsx(
4406
+ uiSdk.Input,
4407
+ {
4408
+ id: "statsTimezone",
4409
+ value: field(form.statsTimezone),
4410
+ onChange: (e) => set("statsTimezone", e.target.value),
4411
+ disabled: !canWrite
4412
+ }
4413
+ )
4414
+ ] })
4415
+ ] }) }),
4416
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4417
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4308
4418
  /* @__PURE__ */ jsxRuntime.jsx(
4309
- uiSdk.Input,
4419
+ PipelineNodesForm,
4310
4420
  {
4311
- id: "statsTimezone",
4312
- value: field(form.statsTimezone),
4313
- onChange: (e) => set("statsTimezone", e.target.value),
4314
- disabled: !canWrite
4421
+ value: form.nodes,
4422
+ onChange: (v) => set("nodes", v),
4423
+ canWrite,
4424
+ issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4425
+ prompts: promptCatalogue.prompts,
4426
+ promptsLoading: promptCatalogue.isLoading
4315
4427
  }
4316
- )
4317
- ] })
4318
- ] }) }),
4319
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4320
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4321
- /* @__PURE__ */ jsxRuntime.jsx(
4322
- PipelineNodesForm,
4323
- {
4324
- value: form.nodes,
4325
- onChange: (v) => set("nodes", v),
4326
- canWrite,
4327
- issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null
4328
- }
4329
- ),
4330
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4331
- ] }) }),
4332
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4333
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
4334
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Les agents support sont des utilisateurs plateforme \u2014 donnez-leur acc\xE8s \xE0 cette application depuis la gestion des membres." }),
4335
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4336
- ] }) }),
4337
- summaryIssues.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsxRuntime.jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4338
- canWrite && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4428
+ ),
4429
+ promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-destructive", children: [
4430
+ "Catalogue de prompts indisponible \u2014 ",
4431
+ describeApiError(promptCatalogue.error)
4432
+ ] }),
4433
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4434
+ ] }) }),
4435
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4436
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
4437
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Les agents support sont des utilisateurs plateforme \u2014 donnez-leur acc\xE8s \xE0 cette application depuis la gestion des membres." }),
4438
+ /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4439
+ ] }) }),
4440
+ summaryIssues.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-status-pending bg-status-pending/10 p-3 text-sm", children: summaryIssues.map((issue) => /* @__PURE__ */ jsxRuntime.jsx("p", { children: settingsIssueLabel(issue.key, issue.message) }, issue.key)) }),
4441
+ canWrite && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Button, { onClick: () => void save(form), disabled: isSaving || issues.length > 0, children: isSaving ? "Enregistrement\u2026" : "Enregistrer" }) })
4442
+ ] })
4339
4443
  ] })
4340
- ] });
4444
+ );
4341
4445
  }
4342
4446
 
4343
4447
  // src/graph/state.ts