@apotech-os/support-kit 2.9.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
@@ -3701,11 +3701,7 @@ function PipelineNodesForm({
3701
3701
  onPatch: (patch) => onChange(withStepFields(value, step.key, patch))
3702
3702
  },
3703
3703
  step.key
3704
- )) }),
3705
- /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
3706
- /* @__PURE__ */ jsxRuntime.jsx("summary", { className: "cursor-pointer text-sm font-medium", children: "Mode avanc\xE9 (JSON)" }),
3707
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsxRuntime.jsx(NodesJsonField, { value, onChange, disabled: !canWrite }) })
3708
- ] })
3704
+ )) })
3709
3705
  ] });
3710
3706
  }
3711
3707
  function StepRow({
@@ -3965,69 +3961,6 @@ function useIds(stepKey) {
3965
3961
  minConfidence: `${base2}-${stepKey}-min-confidence`
3966
3962
  };
3967
3963
  }
3968
- function NodesJsonField({
3969
- value,
3970
- onChange,
3971
- disabled
3972
- }) {
3973
- const id = react.useId();
3974
- const serialized = stringify(value);
3975
- const [text, setText] = react.useState(serialized);
3976
- const [parseError, setParseError] = react.useState(null);
3977
- const emittedRef = react.useRef(serialized);
3978
- react.useEffect(() => {
3979
- if (serialized === emittedRef.current) return;
3980
- emittedRef.current = serialized;
3981
- setText(serialized);
3982
- setParseError(null);
3983
- }, [serialized]);
3984
- function handleChange(next) {
3985
- setText(next);
3986
- try {
3987
- const parsed = JSON.parse(next);
3988
- emittedRef.current = stringify(parsed);
3989
- onChange(parsed);
3990
- setParseError(null);
3991
- } catch {
3992
- setParseError("JSON invalide \u2014 la derni\xE8re valeur valide est conserv\xE9e tant que ce texte ne parse pas.");
3993
- }
3994
- }
3995
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3996
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "mb-1 block text-sm font-medium", children: "\xC9tapes du graphe (JSON)" }),
3997
- /* @__PURE__ */ jsxRuntime.jsx(
3998
- uiSdk.Textarea,
3999
- {
4000
- id,
4001
- className: "font-mono text-xs",
4002
- rows: 10,
4003
- value: text,
4004
- disabled,
4005
- onChange: (e) => handleChange(e.target.value)
4006
- }
4007
- ),
4008
- parseError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-destructive", children: parseError }),
4009
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "mt-1 text-xs text-muted-foreground", children: [
4010
- "Chaque cl\xE9 optionnelle (",
4011
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "escalate" }),
4012
- ", ",
4013
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "draft" }),
4014
- ", ",
4015
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "evaluate" }),
4016
- ",",
4017
- " ",
4018
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "revise" }),
4019
- ") accepte ",
4020
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "null" }),
4021
- " pour d\xE9sactiver l'\xE9tape (\xA73.6).",
4022
- " ",
4023
- /* @__PURE__ */ jsxRuntime.jsx("code", { children: "triage" }),
4024
- " est obligatoire."
4025
- ] })
4026
- ] });
4027
- }
4028
- function stringify(value) {
4029
- return JSON.stringify(value ?? null, null, 2);
4030
- }
4031
3964
  function usePromptCatalogue() {
4032
3965
  const { appSlug } = uiSdk.useAppContext();
4033
3966
  const api = uiSdk.useAppApi();
@@ -4182,325 +4115,333 @@ function SettingsPage() {
4182
4115
  checked ? [.../* @__PURE__ */ new Set([...guardrailsActive, id])] : guardrailsActive.filter((g) => g !== id)
4183
4116
  );
4184
4117
  }
4185
- return /* @__PURE__ */ jsxRuntime.jsxs(PageShell, { className: "max-w-3xl", children: [
4186
- /* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title: "Param\xE8tres", description: "Configuration du pipeline de support." }),
4187
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "source", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4188
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Source" }),
4189
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4190
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mb-1 block text-sm font-medium", children: "Connexion Gorgias" }),
4191
- /* @__PURE__ */ jsxRuntime.jsx(
4192
- "p",
4193
- {
4194
- className: connection.tone === "error" ? "text-sm text-destructive" : connection.tone === "muted" ? "text-sm text-muted-foreground" : "text-sm",
4195
- children: connection.text
4196
- }
4197
- ),
4198
- /* @__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." })
4199
- ] }),
4200
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4201
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "sourceViewId", className: "mb-1 block text-sm font-medium", children: "Vue Gorgias source" }),
4202
- views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
4203
- uiSdk.Select,
4204
- {
4205
- "aria-label": "Vue Gorgias source",
4206
- value: sourceViewId || void 0,
4207
- onValueChange: (v) => set("sourceViewId", v),
4208
- items: views.map((v) => ({ value: v.id, label: v.name })),
4209
- disabled: !canWrite
4210
- }
4211
- ) : /* @__PURE__ */ jsxRuntime.jsx(
4212
- uiSdk.Input,
4213
- {
4214
- id: "sourceViewId",
4215
- value: sourceViewId,
4216
- onChange: (e) => set("sourceViewId", e.target.value),
4217
- disabled: !canWrite
4218
- }
4219
- )
4220
- ] }),
4221
- claimedView && claimedView.claimedByAppSlugs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-status-pending", children: [
4222
- "Cette vue est d\xE9j\xE0 utilis\xE9e par : ",
4223
- claimedView.claimedByAppSlugs.join(", ")
4224
- ] }),
4225
- 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." }),
4226
- 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." })
4227
- ] }) }),
4228
- sourceViewId === "" ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4229
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "cadence", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4230
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Cadence" }),
4231
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4232
- /* @__PURE__ */ jsxRuntime.jsx(
4233
- uiSdk.Switch,
4234
- {
4235
- "aria-label": "Triage activ\xE9",
4236
- checked: bool(form.triageEnabled),
4237
- onCheckedChange: (v) => set("triageEnabled", v),
4238
- disabled: !canWrite
4239
- }
4240
- ),
4241
- "Triage activ\xE9"
4242
- ] }),
4243
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4244
- /* @__PURE__ */ jsxRuntime.jsx(
4245
- uiSdk.Switch,
4246
- {
4247
- "aria-label": "Mode d'essai",
4248
- checked: bool(form.dryRun),
4249
- onCheckedChange: (v) => set("dryRun", v),
4250
- disabled: !canWrite
4251
- }
4252
- ),
4253
- "Mode d'essai \u2014 le triage tourne en entier, sans aucune \xE9criture Gorgias (ni r\xE9ponse, ni tag)"
4254
- ] }),
4255
- /* @__PURE__ */ jsxRuntime.jsx(
4256
- NumberField,
4257
- {
4258
- id: "batchLimit",
4259
- label: "Taille de lot",
4260
- value: num(form.batchLimit),
4261
- onChange: (v) => set("batchLimit", v),
4262
- disabled: !canWrite,
4263
- min: 1,
4264
- integer: true
4265
- }
4266
- ),
4267
- /* @__PURE__ */ jsxRuntime.jsx(
4268
- NumberField,
4269
- {
4270
- id: "triageIntervalMinutes",
4271
- label: "Intervalle de triage (minutes)",
4272
- value: num(form.triageIntervalMinutes),
4273
- onChange: (v) => set("triageIntervalMinutes", v),
4274
- disabled: !canWrite,
4275
- min: 1,
4276
- integer: true
4277
- }
4278
- ),
4279
- /* @__PURE__ */ jsxRuntime.jsx(
4280
- NumberField,
4281
- {
4282
- id: "responseTtlMinutes",
4283
- label: "Dur\xE9e de vie des r\xE9ponses (minutes)",
4284
- value: num(form.responseTtlMinutes),
4285
- onChange: (v) => set("responseTtlMinutes", v),
4286
- disabled: !canWrite,
4287
- min: 1,
4288
- integer: true
4289
- }
4290
- )
4291
- ] }) }),
4292
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "envoi", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4293
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Envoi" }),
4294
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
4295
- /* @__PURE__ */ jsxRuntime.jsx(
4296
- uiSdk.Switch,
4297
- {
4298
- "aria-label": "Envoi automatique",
4299
- checked: bool(form.autoSendEnabled),
4300
- onCheckedChange: (v) => set("autoSendEnabled", v),
4301
- disabled: !canWrite
4302
- }
4303
- ),
4304
- "Envoi automatique"
4305
- ] }),
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" }),
4306
4129
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4307
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
4308
- /* @__PURE__ */ jsxRuntime.jsx(
4309
- uiSdk.Input,
4310
- {
4311
- id: "senderEmail",
4312
- value: field(form.senderEmail),
4313
- onChange: (e) => set("senderEmail", e.target.value),
4314
- disabled: !canWrite
4315
- }
4316
- )
4317
- ] }),
4318
- /* @__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" }),
4319
4131
  /* @__PURE__ */ jsxRuntime.jsx(
4320
- uiSdk.Switch,
4132
+ "p",
4321
4133
  {
4322
- "aria-label": "Exiger une confiance de triage \xE9lev\xE9e",
4323
- checked: bool(form.requireHighTriageConfidence),
4324
- onCheckedChange: (v) => set("requireHighTriageConfidence", v),
4325
- 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
4326
4136
  }
4327
4137
  ),
4328
- "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." })
4329
4139
  ] }),
4330
4140
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4331
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "whatsappMode", className: "mb-1 block text-sm font-medium", children: "Mode WhatsApp" }),
4332
- /* @__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(
4333
4143
  uiSdk.Select,
4334
4144
  {
4335
- "aria-label": "Mode WhatsApp",
4336
- value: field(form.whatsappMode) || void 0,
4337
- onValueChange: (v) => set("whatsappMode", v),
4338
- items: WHATSAPP_MODE_OPTIONS,
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 })),
4339
4149
  disabled: !canWrite
4340
4150
  }
4341
- )
4342
- ] })
4343
- ] }) }),
4344
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4345
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Tags d'audit" }),
4346
- [
4347
- ["unknownTag", "Tag inconnu"],
4348
- ["handledTag", "Tag trait\xE9"],
4349
- ["escalationTag", "Tag d'escalade"],
4350
- ["needsHumanTag", "Tag besoin humain"],
4351
- ["autoRepliedTag", "Tag r\xE9pondu automatiquement"],
4352
- ["needsReviewTag", "Tag \xE0 revoir"],
4353
- ["followupTag", "Tag suivi requis"]
4354
- ].map(([key, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4355
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: key, className: "mb-1 block text-sm font-medium", children: label }),
4356
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
4357
- ] }, key))
4358
- ] }) }),
4359
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "guardrails", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4360
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Garde-fous" }),
4361
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4362
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Garde-fous actifs" }),
4363
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: AGENT_GUARDRAILS.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
4364
- uiSdk.Checkbox,
4365
- {
4366
- label: guardrailHitLabel(id),
4367
- checked: guardrailsActive.includes(id),
4368
- onCheckedChange: (checked) => toggleGuardrail(id, checked),
4369
- disabled: !canWrite
4370
- },
4371
- id
4372
- )) })
4373
- ] }),
4374
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4375
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "blocklist", className: "mb-1 block text-sm font-medium", children: "Liste de blocage" }),
4376
- /* @__PURE__ */ jsxRuntime.jsx(
4377
- uiSdk.Textarea,
4378
- {
4379
- id: "blocklist",
4380
- value: list(form.blocklist),
4381
- onChange: (e) => set("blocklist", parseList(e.target.value)),
4382
- disabled: !canWrite
4383
- }
4384
- )
4385
- ] }),
4386
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4387
- /* @__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)" }),
4388
- /* @__PURE__ */ jsxRuntime.jsx(
4389
- uiSdk.Textarea,
4390
- {
4391
- id: "noreplySenders",
4392
- value: list(form.noreplySenders),
4393
- onChange: (e) => set("noreplySenders", parseList(e.target.value)),
4394
- disabled: !canWrite
4395
- }
4396
- )
4397
- ] })
4398
- ] }) }),
4399
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4400
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Prompts de style par canal" }),
4401
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4402
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptEmail", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 email" }),
4403
- /* @__PURE__ */ jsxRuntime.jsx(
4151
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
4404
4152
  uiSdk.Input,
4405
4153
  {
4406
- id: "channelPromptEmail",
4407
- value: field(form.channelPromptEmail),
4408
- onChange: (e) => set("channelPromptEmail", e.target.value),
4154
+ id: "sourceViewId",
4155
+ value: sourceViewId,
4156
+ onChange: (e) => set("sourceViewId", e.target.value),
4409
4157
  disabled: !canWrite
4410
4158
  }
4411
4159
  )
4412
4160
  ] }),
4413
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4414
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "channelPromptWhatsapp", className: "mb-1 block text-sm font-medium", children: "Prompt de style \u2014 WhatsApp" }),
4415
- /* @__PURE__ */ jsxRuntime.jsx(
4416
- uiSdk.Input,
4417
- {
4418
- id: "channelPromptWhatsapp",
4419
- value: field(form.channelPromptWhatsapp),
4420
- onChange: (e) => set("channelPromptWhatsapp", e.target.value),
4421
- disabled: !canWrite
4422
- }
4423
- )
4424
- ] })
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." })
4425
4167
  ] }) }),
4426
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4427
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Divers" }),
4428
- /* @__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
+ ] }),
4429
4195
  /* @__PURE__ */ jsxRuntime.jsx(
4430
- uiSdk.Checkbox,
4196
+ NumberField,
4431
4197
  {
4432
- checked: bool(form.renameEnabled),
4433
- onCheckedChange: (v) => set("renameEnabled", v === true),
4434
- 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
4435
4205
  }
4436
4206
  ),
4437
- "Renommage de sujet activ\xE9"
4438
- ] }),
4439
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4440
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameFrom", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 motif \xE0 rep\xE9rer dans le sujet" }),
4441
4207
  /* @__PURE__ */ jsxRuntime.jsx(
4442
- uiSdk.Input,
4208
+ NumberField,
4443
4209
  {
4444
- id: "renameFrom",
4445
- value: field(form.renameFrom),
4446
- onChange: (e) => set("renameFrom", e.target.value),
4447
- 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
4448
4217
  }
4449
- )
4450
- ] }),
4451
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4452
- /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "renameTo", className: "mb-1 block text-sm font-medium", children: "Renommage \u2014 sujet de remplacement" }),
4218
+ ),
4453
4219
  /* @__PURE__ */ jsxRuntime.jsx(
4454
- uiSdk.Input,
4220
+ NumberField,
4455
4221
  {
4456
- id: "renameTo",
4457
- value: field(form.renameTo),
4458
- onChange: (e) => set("renameTo", e.target.value),
4459
- 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
4460
4229
  }
4461
4230
  )
4462
- ] }),
4463
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4464
- /* @__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" }),
4465
4418
  /* @__PURE__ */ jsxRuntime.jsx(
4466
- uiSdk.Input,
4419
+ PipelineNodesForm,
4467
4420
  {
4468
- id: "statsTimezone",
4469
- value: field(form.statsTimezone),
4470
- onChange: (e) => set("statsTimezone", e.target.value),
4471
- 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
4472
4427
  }
4473
- )
4474
- ] })
4475
- ] }) }),
4476
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { id: "pipeline-avance", children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4477
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Traitement automatique" }),
4478
- /* @__PURE__ */ jsxRuntime.jsx(
4479
- PipelineNodesForm,
4480
- {
4481
- value: form.nodes,
4482
- onChange: (v) => set("nodes", v),
4483
- canWrite,
4484
- issueMessage: nodesIssue ? settingsIssueLabel(nodesIssue.key, nodesIssue.message) : null,
4485
- prompts: promptCatalogue.prompts,
4486
- promptsLoading: promptCatalogue.isLoading
4487
- }
4488
- ),
4489
- promptCatalogue.error !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-destructive", children: [
4490
- "Catalogue de prompts indisponible \u2014 ",
4491
- describeApiError(promptCatalogue.error)
4492
- ] }),
4493
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: `/espace/${appSlug}/graph-canvas`, children: "Visualiser dans Graphe" })
4494
- ] }) }),
4495
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(uiSdk.CardContent, { className: "space-y-3 p-4", children: [
4496
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-medium", children: "Agents support" }),
4497
- /* @__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." }),
4498
- /* @__PURE__ */ jsxRuntime.jsx(uiSdk.Link, { href: "/parametres/membres", children: "G\xE9rer les acc\xE8s" })
4499
- ] }) }),
4500
- 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)) }),
4501
- 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
+ ] })
4502
4443
  ] })
4503
- ] });
4444
+ );
4504
4445
  }
4505
4446
 
4506
4447
  // src/graph/state.ts