@apotech-os/support-kit 8.4.0 → 9.0.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/{chunk-D3QGGJAI.js → chunk-MHRKUDEZ.js} +288 -61
- package/dist/chunk-MHRKUDEZ.js.map +1 -0
- package/dist/index.cjs +355 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -9
- package/dist/index.d.ts +246 -9
- package/dist/index.js +58 -59
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +221 -29
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +180 -30
- package/dist/ui/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-D3QGGJAI.js.map +0 -1
package/dist/ui/index.cjs
CHANGED
|
@@ -159,9 +159,12 @@ function toGeneratedResponse(record) {
|
|
|
159
159
|
sources: Array.isArray(data.sources) ? data.sources : [],
|
|
160
160
|
verdict: toVerdict(data.verdict),
|
|
161
161
|
guardrailHits: data.guardrailHits ?? [],
|
|
162
|
+
guardrailHitsReconstructedAt: data.guardrailHitsReconstructedAt ?? null,
|
|
162
163
|
outcome: isOutcome(data.outcome) ? data.outcome : null,
|
|
163
164
|
triageDecisionId: data.triageDecisionId ?? null,
|
|
164
165
|
channel: data.channel ?? null,
|
|
166
|
+
sourceChannel: data.sourceChannel ?? null,
|
|
167
|
+
ineligibleReason: data.ineligibleReason ?? null,
|
|
165
168
|
autoSendDecision: data.autoSendDecision ?? null,
|
|
166
169
|
sentAt: data.sentAt ?? null,
|
|
167
170
|
sentMessageId: data.sentMessageId ?? null,
|
|
@@ -1508,6 +1511,28 @@ function responseOutcome(job) {
|
|
|
1508
1511
|
// src/domain/profile.ts
|
|
1509
1512
|
var DEFAULT_PROFILE_KEY = "customer";
|
|
1510
1513
|
var WHATSAPP_MODES = ["escalate_only", "draft_only", "auto_reply"];
|
|
1514
|
+
var SUPPORT_CHANNELS = [
|
|
1515
|
+
"email",
|
|
1516
|
+
"whatsapp",
|
|
1517
|
+
"phone",
|
|
1518
|
+
"chat",
|
|
1519
|
+
"sms",
|
|
1520
|
+
"contact-form",
|
|
1521
|
+
"instagram-direct-message",
|
|
1522
|
+
"instagram-comment",
|
|
1523
|
+
"instagram-mention",
|
|
1524
|
+
"instagram-ad-comment",
|
|
1525
|
+
"facebook",
|
|
1526
|
+
"facebook-messenger"
|
|
1527
|
+
];
|
|
1528
|
+
var DEFAULT_AUTO_SEND_CHANNELS = [
|
|
1529
|
+
"email",
|
|
1530
|
+
"whatsapp",
|
|
1531
|
+
"phone",
|
|
1532
|
+
"chat",
|
|
1533
|
+
"sms",
|
|
1534
|
+
"contact-form"
|
|
1535
|
+
];
|
|
1511
1536
|
var AGENT_FIELD_NAME_UID = "e9cfec6f-15c6-4d02-8f79-0667f64b9eb5";
|
|
1512
1537
|
var AGENT_FIELD_PROVIDER_UID = "e522b809-e8a7-4439-a2df-936158d04389";
|
|
1513
1538
|
var AGENT_FIELD_MODEL_ID_UID = "d95977ba-362c-44d6-a2f0-24156c76cf8a";
|
|
@@ -1693,7 +1718,11 @@ function settingsToProfile(settings, prompts) {
|
|
|
1693
1718
|
// The auto-send floor is the evaluation floor: a second, independent
|
|
1694
1719
|
// threshold would be a silent way to send below the one an operator set.
|
|
1695
1720
|
minConfidence: evaluate?.minConfidence ?? DEFAULT_MIN_CONFIDENCE,
|
|
1696
|
-
requireHighTriage: settings.requireHighTriageConfidence
|
|
1721
|
+
requireHighTriage: settings.requireHighTriageConfidence,
|
|
1722
|
+
// Defaulted rather than required: `SupportKitSettings` describes what a
|
|
1723
|
+
// SettingsPage writes, and an app deployed before this field existed
|
|
1724
|
+
// has no value stored for it.
|
|
1725
|
+
channels: [...settings.autoSendChannels ?? DEFAULT_AUTO_SEND_CHANNELS]
|
|
1697
1726
|
},
|
|
1698
1727
|
rename: settings.renameEnabled ? { enabled: true, from: settings.renameFrom, to: settings.renameTo } : null,
|
|
1699
1728
|
// Locks and run stamps are per-run state: they live in the
|
|
@@ -1740,6 +1769,7 @@ function toDeliveryPolicy(raw) {
|
|
|
1740
1769
|
autoSendEnabled: settings.autoSendEnabled === true,
|
|
1741
1770
|
senderEmail: senderEmail === "" ? null : senderEmail,
|
|
1742
1771
|
whatsappMode: typeof settings.whatsappMode === "string" ? settings.whatsappMode : null,
|
|
1772
|
+
autoSendChannels: Array.isArray(settings.autoSendChannels) ? settings.autoSendChannels : [...DEFAULT_AUTO_SEND_CHANNELS],
|
|
1743
1773
|
dryRun: settings.dryRun === true,
|
|
1744
1774
|
audit: toAuditTags(settings)
|
|
1745
1775
|
};
|
|
@@ -1832,24 +1862,113 @@ function WordDiffView({ title, tokens, keep, hideEqual = false }) {
|
|
|
1832
1862
|
|
|
1833
1863
|
// src/ui/tickets/guardrail-labels.ts
|
|
1834
1864
|
var NO_GUARDRAIL_REASON = "no_guardrail";
|
|
1835
|
-
var
|
|
1836
|
-
whatsapp:
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1865
|
+
var GUARDRAIL_COPY = {
|
|
1866
|
+
whatsapp: {
|
|
1867
|
+
label: "conversation WhatsApp",
|
|
1868
|
+
explanation: "Le mode WhatsApp est r\xE9gl\xE9 sur \xAB escalade seule \xBB : sur ce canal la r\xE9ponse est r\xE9dig\xE9e puis confi\xE9e \xE0 un humain, jamais envoy\xE9e automatiquement."
|
|
1869
|
+
},
|
|
1870
|
+
whatsapp_stop: {
|
|
1871
|
+
label: "le client a demand\xE9 \xE0 ne plus \xEAtre contact\xE9 (STOP)",
|
|
1872
|
+
explanation: "Le client a \xE9crit \xAB STOP \xBB : il demande \xE0 ne plus \xEAtre contact\xE9. Rien ne part automatiquement, et le ticket est escalad\xE9 pour qu\u2019un humain acte la demande."
|
|
1873
|
+
},
|
|
1874
|
+
not_customer_turn: {
|
|
1875
|
+
label: "le dernier message du fil est de nous",
|
|
1876
|
+
explanation: "Le dernier message du fil vient de nous, pas du client : envoyer reviendrait \xE0 nous r\xE9pondre \xE0 nous-m\xEAmes."
|
|
1877
|
+
},
|
|
1878
|
+
judgeme: {
|
|
1879
|
+
label: "avis Judge.me",
|
|
1880
|
+
explanation: "Ce ticket est une notification d\u2019avis Judge.me, pas un message de client : il n\u2019appelle aucune r\xE9ponse automatique."
|
|
1881
|
+
},
|
|
1882
|
+
noreply_sender: {
|
|
1883
|
+
label: "exp\xE9diteur automatique",
|
|
1884
|
+
explanation: "L\u2019adresse de l\u2019exp\xE9diteur figure dans la liste des exp\xE9diteurs automatiques : la r\xE9ponse n\u2019atteindrait aucun humain."
|
|
1885
|
+
},
|
|
1886
|
+
triage_not_high: {
|
|
1887
|
+
label: "triage pas en confiance haute",
|
|
1888
|
+
explanation: "Le triage n\u2019a pas class\xE9 ce ticket avec une confiance haute, et les r\xE9glages exigent une confiance haute avant tout envoi automatique."
|
|
1889
|
+
},
|
|
1890
|
+
escalated: {
|
|
1891
|
+
label: "ticket d\xE9j\xE0 escalad\xE9",
|
|
1892
|
+
explanation: "Le ticket \xE9tait d\xE9j\xE0 escalad\xE9 vers un humain : l\u2019envoi automatique n\u2019a pas lieu d\u2019\xEAtre."
|
|
1893
|
+
},
|
|
1894
|
+
blocklist: {
|
|
1895
|
+
label: "terme de la liste de blocage",
|
|
1896
|
+
explanation: "Le premier message du client contient un terme de la liste de blocage : ces sujets passent obligatoirement par un humain."
|
|
1897
|
+
},
|
|
1898
|
+
attachment: {
|
|
1899
|
+
label: "pi\xE8ce jointe c\xF4t\xE9 client",
|
|
1900
|
+
explanation: "Le client a joint un ou plusieurs fichiers, que l\u2019agent ne sait pas lire : la r\xE9ponse part en revue humaine plut\xF4t que de r\xE9pondre \xE0 c\xF4t\xE9."
|
|
1901
|
+
},
|
|
1902
|
+
short_answer: {
|
|
1903
|
+
label: "r\xE9ponse trop courte",
|
|
1904
|
+
explanation: "Le brouillon fait moins de 20 caract\xE8res : trop court pour \xEAtre une vraie r\xE9ponse, il est retenu."
|
|
1905
|
+
},
|
|
1906
|
+
uncertainty_marker: {
|
|
1907
|
+
label: "marqueur d\u2019incertitude dans la r\xE9ponse",
|
|
1908
|
+
explanation: "Le brouillon contient une formule d\u2019incertitude (\xAB je ne suis pas s\xFBr \xBB, \xAB je ne peux pas \xBB\u2026) : une r\xE9ponse qui doute ne part pas seule."
|
|
1909
|
+
},
|
|
1910
|
+
evaluation_missing: {
|
|
1911
|
+
label: "aucune \xE9valuation produite",
|
|
1912
|
+
explanation: "Aucun verdict d\u2019\xE9valuation n\u2019a \xE9t\xE9 produit : sans jugement sur la r\xE9ponse, l\u2019envoi automatique est impossible."
|
|
1913
|
+
},
|
|
1914
|
+
customer_email_missing: {
|
|
1915
|
+
label: "client sans adresse e-mail",
|
|
1916
|
+
explanation: "Ce ticket n\u2019est pas un ticket WhatsApp, l\u2019envoi se ferait donc par e-mail \u2014 mais le client n\u2019a pas d\u2019adresse, ce qui est le cas des messages Instagram, Facebook ou SMS. Il n\u2019y a nulle part o\xF9 envoyer la r\xE9ponse."
|
|
1917
|
+
},
|
|
1918
|
+
ticket_closed: {
|
|
1919
|
+
label: "ticket ferm\xE9 entre-temps",
|
|
1920
|
+
explanation: "Le ticket a \xE9t\xE9 ferm\xE9 pendant que la r\xE9ponse se r\xE9digeait : l\u2019envoyer rouvrirait une conversation que quelqu\u2019un a close."
|
|
1921
|
+
},
|
|
1922
|
+
agent_replied: {
|
|
1923
|
+
label: "r\xE9ponse d\u2019un agent en cours de route",
|
|
1924
|
+
explanation: "Un agent a r\xE9pondu au client entre le lancement du run et l\u2019envoi : la r\xE9ponse automatique a \xE9t\xE9 annul\xE9e pour ne pas doubler la r\xE9ponse humaine."
|
|
1925
|
+
},
|
|
1926
|
+
diverged: {
|
|
1927
|
+
label: "la conversation a boug\xE9",
|
|
1928
|
+
explanation: "Le fil a chang\xE9 depuis la r\xE9daction \u2014 nouveau message, ou message modifi\xE9 : la r\xE9ponse pr\xE9par\xE9e ne correspond plus \xE0 ce que le client a \xE9crit."
|
|
1929
|
+
},
|
|
1930
|
+
run_deadline: {
|
|
1931
|
+
label: "d\xE9lai du run d\xE9pass\xE9",
|
|
1932
|
+
explanation: "Le run a d\xE9pass\xE9 son temps imparti avant de poster : la r\xE9ponse n\u2019est plus sous la responsabilit\xE9 de ce passage, elle n\u2019est pas envoy\xE9e."
|
|
1933
|
+
}
|
|
1934
|
+
};
|
|
1935
|
+
var NO_GUARDRAIL_COPY = {
|
|
1936
|
+
label: "bloqu\xE9e par le verdict ou le seuil, sans garde-fou",
|
|
1937
|
+
explanation: "Aucun garde-fou n\u2019a \xE9t\xE9 d\xE9clench\xE9 : c\u2019est le verdict du juge ou le seuil de confiance qui a retenu la r\xE9ponse."
|
|
1848
1938
|
};
|
|
1939
|
+
function blockedTerm(hit) {
|
|
1940
|
+
return hit.startsWith("blocklist:") ? hit.slice("blocklist:".length) : null;
|
|
1941
|
+
}
|
|
1849
1942
|
function guardrailHitLabel(hit) {
|
|
1850
|
-
if (hit === NO_GUARDRAIL_REASON) return
|
|
1851
|
-
|
|
1852
|
-
return
|
|
1943
|
+
if (hit === NO_GUARDRAIL_REASON) return NO_GUARDRAIL_COPY.label;
|
|
1944
|
+
const term = blockedTerm(hit);
|
|
1945
|
+
if (term !== null) return `terme bloqu\xE9 \xAB ${term} \xBB`;
|
|
1946
|
+
return GUARDRAIL_COPY[hit]?.label ?? hit;
|
|
1947
|
+
}
|
|
1948
|
+
function guardrailExplanation(hit) {
|
|
1949
|
+
if (hit === NO_GUARDRAIL_REASON) return NO_GUARDRAIL_COPY.explanation;
|
|
1950
|
+
const term = blockedTerm(hit);
|
|
1951
|
+
if (term !== null) {
|
|
1952
|
+
return `Le premier message du client contient \xAB ${term} \xBB, inscrit dans la liste de blocage : ces sujets passent obligatoirement par un humain.`;
|
|
1953
|
+
}
|
|
1954
|
+
return GUARDRAIL_COPY[hit]?.explanation ?? null;
|
|
1955
|
+
}
|
|
1956
|
+
var CHANNEL_LABELS = {
|
|
1957
|
+
email: "E-mail",
|
|
1958
|
+
whatsapp: "WhatsApp",
|
|
1959
|
+
chat: "Chat",
|
|
1960
|
+
phone: "T\xE9l\xE9phone",
|
|
1961
|
+
"contact-form": "Formulaire de contact",
|
|
1962
|
+
sms: "SMS",
|
|
1963
|
+
"instagram-direct-message": "Instagram (message priv\xE9)",
|
|
1964
|
+
"instagram-comment": "Instagram (commentaire)",
|
|
1965
|
+
"instagram-mention": "Instagram (mention)",
|
|
1966
|
+
"instagram-ad-comment": "Instagram (commentaire sous publicit\xE9)",
|
|
1967
|
+
facebook: "Facebook",
|
|
1968
|
+
"facebook-messenger": "Facebook Messenger"
|
|
1969
|
+
};
|
|
1970
|
+
function channelLabel(channel) {
|
|
1971
|
+
return CHANNEL_LABELS[channel] ?? channel;
|
|
1853
1972
|
}
|
|
1854
1973
|
|
|
1855
1974
|
// src/ui/tickets/timeline.ts
|
|
@@ -1931,9 +2050,10 @@ function deliveryReason(input) {
|
|
|
1931
2050
|
var GENERIC_NOT_SENT = "R\xE9dig\xE9e, en attente d'un envoi.";
|
|
1932
2051
|
function notSentReason({ job, policy, category }) {
|
|
1933
2052
|
if (!job) return GENERIC_NOT_SENT;
|
|
1934
|
-
if (job.autoSendDecision === "hold") {
|
|
2053
|
+
if (job.autoSendDecision === "hold" && job.guardrailHits.length === 0) {
|
|
1935
2054
|
return "Mise en attente d\xE9finitive : cette r\xE9ponse ne repartira pas toute seule (refus d\u2019approbation, contr\xF4le de derni\xE8re minute, ou envoi interrompu puis repris).";
|
|
1936
2055
|
}
|
|
2056
|
+
if (job.autoSendDecision === "hold") return guardrailReason(job);
|
|
1937
2057
|
switch (job.outcome) {
|
|
1938
2058
|
case "needs_human":
|
|
1939
2059
|
return notSendableReason(job, policy);
|
|
@@ -1978,14 +2098,36 @@ function notEligibleReason(job, policy, category) {
|
|
|
1978
2098
|
if (isWhatsapp && policy.whatsappMode === "draft_only") {
|
|
1979
2099
|
return "Mode WhatsApp \xAB brouillon seul \xBB : la r\xE9ponse est r\xE9dig\xE9e, jamais envoy\xE9e automatiquement.";
|
|
1980
2100
|
}
|
|
1981
|
-
if (
|
|
2101
|
+
if (job.ineligibleReason === "no_publication_path") {
|
|
2102
|
+
const channel = job.sourceChannel ? ` ${channelLabel(job.sourceChannel)}` : "";
|
|
2103
|
+
return `Aucun moyen de publier une r\xE9ponse sur ce ticket : Gorgias ne d\xE9clare pas le canal${channel} r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige. Le brouillon reste disponible pour un agent.`;
|
|
2104
|
+
}
|
|
2105
|
+
if (isRestrictedChannel(job.sourceChannel, policy.autoSendChannels)) {
|
|
2106
|
+
return `L'envoi automatique n'est pas activ\xE9 pour le canal ${channelLabel(job.sourceChannel ?? "")}. Le brouillon reste disponible pour un agent.`;
|
|
2107
|
+
}
|
|
2108
|
+
if (!policy.senderEmail && !isWhatsapp) {
|
|
1982
2109
|
return "Aucune adresse d'exp\xE9dition n'est configur\xE9e dans les r\xE9glages.";
|
|
1983
2110
|
}
|
|
1984
2111
|
return GENERIC_NOT_SENT;
|
|
1985
2112
|
}
|
|
2113
|
+
function isRestrictedChannel(sourceChannel, allowed) {
|
|
2114
|
+
if (!sourceChannel) return false;
|
|
2115
|
+
if (!SUPPORT_CHANNELS.includes(sourceChannel)) return false;
|
|
2116
|
+
return !allowed.includes(sourceChannel);
|
|
2117
|
+
}
|
|
1986
2118
|
function guardrailReason(job) {
|
|
1987
|
-
|
|
1988
|
-
|
|
2119
|
+
const [first, ...rest] = job.guardrailHits;
|
|
2120
|
+
if (first === void 0) {
|
|
2121
|
+
return "Un garde-fou a bloqu\xE9 l\u2019envoi (r\xE9ponse ant\xE9rieure \xE0 l\u2019enregistrement du motif).";
|
|
2122
|
+
}
|
|
2123
|
+
const explanation = guardrailExplanation(first);
|
|
2124
|
+
const head = `Garde-fou d\xE9clench\xE9 : ${guardrailHitLabel(first)}.`;
|
|
2125
|
+
const others = rest.length > 0 ? ` \xC9galement d\xE9clench\xE9 : ${rest.map(guardrailHitLabel).join(", ")}.` : "";
|
|
2126
|
+
return `${head}${explanation ? ` ${explanation}` : ""}${others}${reconstructionCaveat(job)}`;
|
|
2127
|
+
}
|
|
2128
|
+
function reconstructionCaveat(job) {
|
|
2129
|
+
if (!job.guardrailHitsReconstructedAt) return "";
|
|
2130
|
+
return " (Motif reconstitu\xE9 a posteriori depuis Gorgias \u2014 lecture faite avec les r\xE9glages actuels.)";
|
|
1989
2131
|
}
|
|
1990
2132
|
function legacyNotSentReason(job, policy, category) {
|
|
1991
2133
|
if (job.guardrailHits.length > 0) return guardrailReason(job);
|
|
@@ -2023,6 +2165,13 @@ var AGENT_GUARDRAILS = [
|
|
|
2023
2165
|
"uncertainty_marker",
|
|
2024
2166
|
"evaluation_missing"
|
|
2025
2167
|
];
|
|
2168
|
+
var COLLISION_GUARDRAILS = [
|
|
2169
|
+
"customer_email_missing",
|
|
2170
|
+
"ticket_closed",
|
|
2171
|
+
"agent_replied",
|
|
2172
|
+
"diverged",
|
|
2173
|
+
"run_deadline"
|
|
2174
|
+
];
|
|
2026
2175
|
|
|
2027
2176
|
// src/graph/run-ticket.ts
|
|
2028
2177
|
function outcomeTags(outcome, verdict, audit) {
|
|
@@ -4453,6 +4602,12 @@ function settingsWarnings(settings) {
|
|
|
4453
4602
|
message: "Le tag d\u2019appartenance est l\u2019un des autres tags d\u2019audit, que toutes les apps posent avec la m\xEAme valeur par d\xE9faut : il ne distingue donc pas cette app d\u2019une autre install\xE9e sur le m\xEAme compte Gorgias."
|
|
4454
4603
|
});
|
|
4455
4604
|
}
|
|
4605
|
+
if (settings.autoSendEnabled === true && Array.isArray(settings.autoSendChannels) && settings.autoSendChannels.length === 0) {
|
|
4606
|
+
warnings.push({
|
|
4607
|
+
key: "noAutoSendChannels",
|
|
4608
|
+
message: "L\u2019envoi automatique est actif mais aucun canal n\u2019est coch\xE9 : aucune r\xE9ponse ne peut partir. Cochez au moins un canal, ou coupez l\u2019envoi automatique."
|
|
4609
|
+
});
|
|
4610
|
+
}
|
|
4456
4611
|
if (appScopeTag && webhookScopeTag && appScopeTag !== webhookScopeTag) {
|
|
4457
4612
|
warnings.push({
|
|
4458
4613
|
key: "scopeTagMismatch",
|
|
@@ -5055,6 +5210,9 @@ function describeConnection(connections) {
|
|
|
5055
5210
|
}
|
|
5056
5211
|
return { text: `${fallback.label} (par d\xE9faut, parmi ${connections.length} connexions)`, tone: "normal" };
|
|
5057
5212
|
}
|
|
5213
|
+
function SettingsWarnings({ warnings }) {
|
|
5214
|
+
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)) });
|
|
5215
|
+
}
|
|
5058
5216
|
function SettingsPage() {
|
|
5059
5217
|
const { appSlug, role } = uiSdk.useAppContext();
|
|
5060
5218
|
const canWrite = canWriteForRole(role);
|
|
@@ -5128,9 +5286,18 @@ function SettingsPage() {
|
|
|
5128
5286
|
const claimUnverifiable = installedAppsUnavailable || uncheckedAppSlugs.length > 0;
|
|
5129
5287
|
const issues = validateSettings(form);
|
|
5130
5288
|
const warnings = settingsWarnings(form);
|
|
5289
|
+
const sendWarnings = warnings.filter((warning) => warning.key === "noAutoSendChannels");
|
|
5290
|
+
const tagWarnings = warnings.filter((warning) => warning.key !== "noAutoSendChannels");
|
|
5131
5291
|
const nodesIssue = issues.find((issue) => issue.key === "nodes");
|
|
5132
5292
|
const summaryIssues = issues.filter((issue) => issue !== nodesIssue);
|
|
5133
5293
|
const guardrailsActive = Array.isArray(form.guardrailsActive) ? form.guardrailsActive : [];
|
|
5294
|
+
const autoSendChannels = Array.isArray(form.autoSendChannels) ? form.autoSendChannels : [];
|
|
5295
|
+
function toggleAutoSendChannel(channel, checked) {
|
|
5296
|
+
set(
|
|
5297
|
+
"autoSendChannels",
|
|
5298
|
+
checked ? [.../* @__PURE__ */ new Set([...autoSendChannels, channel])] : autoSendChannels.filter((c) => c !== channel)
|
|
5299
|
+
);
|
|
5300
|
+
}
|
|
5134
5301
|
function toggleGuardrail(id, checked) {
|
|
5135
5302
|
set(
|
|
5136
5303
|
"guardrailsActive",
|
|
@@ -5256,6 +5423,20 @@ function SettingsPage() {
|
|
|
5256
5423
|
),
|
|
5257
5424
|
"Envoi automatique"
|
|
5258
5425
|
] }),
|
|
5426
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5427
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 text-sm font-medium", children: "Canaux o\xF9 l'envoi automatique s'applique" }),
|
|
5428
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-1", children: SUPPORT_CHANNELS.map((channel) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5429
|
+
uiSdk.Checkbox,
|
|
5430
|
+
{
|
|
5431
|
+
label: channelLabel(channel),
|
|
5432
|
+
checked: autoSendChannels.includes(channel),
|
|
5433
|
+
onCheckedChange: (checked) => toggleAutoSendChannel(channel, checked),
|
|
5434
|
+
disabled: !canWrite
|
|
5435
|
+
},
|
|
5436
|
+
channel
|
|
5437
|
+
)) }),
|
|
5438
|
+
/* @__PURE__ */ jsxRuntime.jsx(SettingsWarnings, { warnings: sendWarnings })
|
|
5439
|
+
] }),
|
|
5259
5440
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
5260
5441
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "senderEmail", className: "mb-1 block text-sm font-medium", children: "Adresse d'envoi" }),
|
|
5261
5442
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5309,7 +5490,7 @@ function SettingsPage() {
|
|
|
5309
5490
|
/* @__PURE__ */ jsxRuntime.jsx(uiSdk.Input, { id: key, value: field(form[key]), onChange: (e) => set(key, e.target.value), disabled: !canWrite })
|
|
5310
5491
|
] }, key)),
|
|
5311
5492
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Le tag d\u2019appartenance est pos\xE9 sur chaque ticket que le triage examine, dans le m\xEAme appel que les tags ci-dessus. Il doit \xEAtre propre \xE0 cette app : c\u2019est lui qui distingue ses tickets de ceux d\u2019une autre app install\xE9e sur le m\xEAme compte Gorgias." }),
|
|
5312
|
-
|
|
5493
|
+
/* @__PURE__ */ jsxRuntime.jsx(SettingsWarnings, { warnings: tagWarnings })
|
|
5313
5494
|
] }) }),
|
|
5314
5495
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5315
5496
|
FollowupWebhookCard,
|
|
@@ -6855,7 +7036,6 @@ function tagOrigin(tag, settings) {
|
|
|
6855
7036
|
}
|
|
6856
7037
|
|
|
6857
7038
|
// src/ui/test/verdict-summary.ts
|
|
6858
|
-
var COLLISION_GUARDRAILS = ["ticket_closed", "agent_replied", "diverged", "customer_email_missing", "run_deadline"];
|
|
6859
7039
|
function base(result) {
|
|
6860
7040
|
return { label: outcomeLabel(result.outcome), collisionHits: [], contentHits: [] };
|
|
6861
7041
|
}
|
|
@@ -6871,17 +7051,29 @@ function needsHumanSentence(result) {
|
|
|
6871
7051
|
const confidencePct = verdict.confidence !== null ? `${Math.round(verdict.confidence * 100)} %` : "une confiance inconnue";
|
|
6872
7052
|
return `Le juge a r\xE9pondu \xAB ${verdict.verdict} \xBB avec ${confidencePct} de confiance${verdict.reason ? ` : ${verdict.reason}` : "."}`;
|
|
6873
7053
|
}
|
|
7054
|
+
function isCollisionHit(hit) {
|
|
7055
|
+
return COLLISION_GUARDRAILS.includes(hit);
|
|
7056
|
+
}
|
|
6874
7057
|
function guardrailHoldSummary(result) {
|
|
6875
|
-
const collisionHits = result.guardrailHits.filter((hit) =>
|
|
6876
|
-
const contentHits = result.guardrailHits.filter((hit) => !
|
|
7058
|
+
const collisionHits = result.guardrailHits.filter((hit) => isCollisionHit(hit));
|
|
7059
|
+
const contentHits = result.guardrailHits.filter((hit) => !isCollisionHit(hit));
|
|
6877
7060
|
const sentence = collisionHits.length > 0 ? "Le contr\xF4le anti-collision, juste avant de poster, a bloqu\xE9 la r\xE9ponse : la conversation avait boug\xE9." : `${contentHits.length} garde-fou${contentHits.length > 1 ? "s" : ""} de contenu ${contentHits.length > 1 ? "ont" : "a"} bloqu\xE9 la r\xE9ponse avant l'envoi.`;
|
|
6878
7061
|
return { sentence, collisionHits, contentHits };
|
|
6879
7062
|
}
|
|
6880
|
-
function
|
|
7063
|
+
function readySummary(result) {
|
|
7064
|
+
if (result.ineligibleReason === "no_publication_path") {
|
|
7065
|
+
return {
|
|
7066
|
+
tone: "warning",
|
|
7067
|
+
sentence: "La r\xE9ponse est pr\xEAte pour l'extension, mais rien ne permet de la publier : Gorgias ne d\xE9clare pas ce canal r\xE9pondable, ou le contact n'a pas l'adresse que ce canal exige."
|
|
7068
|
+
};
|
|
7069
|
+
}
|
|
6881
7070
|
if (!result.verdict) {
|
|
6882
|
-
return
|
|
7071
|
+
return {
|
|
7072
|
+
tone: "success",
|
|
7073
|
+
sentence: "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi n'a pas \xE9t\xE9 tent\xE9 : sans \xE9valuation, aucun verdict n'a \xE9t\xE9 produit, et l'envoi auto est impossible par construction."
|
|
7074
|
+
};
|
|
6883
7075
|
}
|
|
6884
|
-
return "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi automatique n'\xE9tait pas \xE9ligible.";
|
|
7076
|
+
return { tone: "success", sentence: "La r\xE9ponse est pr\xEAte pour l'extension. L'envoi automatique n'\xE9tait pas \xE9ligible." };
|
|
6885
7077
|
}
|
|
6886
7078
|
function describeVerdict(result) {
|
|
6887
7079
|
if (result.error) {
|
|
@@ -6906,7 +7098,7 @@ function describeVerdict(result) {
|
|
|
6906
7098
|
case "guardrail_hold":
|
|
6907
7099
|
return { ...base(result), tone: "warning", ...guardrailHoldSummary(result) };
|
|
6908
7100
|
case "ready":
|
|
6909
|
-
return { ...base(result),
|
|
7101
|
+
return { ...base(result), ...readySummary(result) };
|
|
6910
7102
|
case "escalated":
|
|
6911
7103
|
return { ...base(result), tone: "warning", sentence: "Le n\u0153ud d'escalade a pass\xE9 la main \xE0 un humain \u2014 aucune r\xE9ponse n'a \xE9t\xE9 r\xE9dig\xE9e." };
|
|
6912
7104
|
case "triaged_only":
|