@opencxh/domain 1.99.0 → 1.101.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/index.cjs +6 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +124 -101
- package/dist/platform/ui.d.ts +6 -0
- package/dist/text/triage.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=140;function A(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function D(e){const t=e.trim();return t.length<=c?t:t.slice(0,c-1).trimEnd()+"…"}function l(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function O(e){switch(e.type){case"EMAIL_RECEIVED":case"EMAIL_SENT":{const t=e.payload,n=t.bodySnippet?.trim()||A(t.body??"");return t.subject?`${t.subject} — ${n}`:n}case"CHAT_MESSAGE_SENT":case"CHAT_MESSAGE_RECEIVED":return e.payload.text??"";case"CHAT_RENAMED":return`Hernoemd naar "${e.payload.newName}"`;case"CHAT_MEMBER_JOINED":return`${e.payload.members.map(t=>t.name).join(", ")} toegevoegd`;case"CHAT_MEMBER_LEFT":return`${e.payload.members.map(t=>t.name).join(", ")} verlaten`;case"CHAT_CALL_STARTED":return"Gesprek gestart";case"CHAT_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${l(e.payload.duration)})`:""}`;case"CHAT_EVENT":return e.payload.text??e.payload.eventType;case"VOICE_CALL_STARTED":case"VIDEO_CALL_STARTED":return"Gesprek gestart";case"VOICE_CALL_ANSWERED":case"VIDEO_CALL_ANSWERED":return"Gesprek aangenomen";case"VOICE_CALL_HOLD":case"VIDEO_CALL_HOLD":return"In de wacht";case"VOICE_CALL_UNHOLD":case"VIDEO_CALL_UNHOLD":return"Hervat";case"VOICE_CALL_ENDED":case"VIDEO_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${l(e.payload.duration)})`:""}`;case"VOICE_CALL_MISSED":case"VIDEO_CALL_MISSED":return"Gemiste oproep";case"VOICE_CALL_FAILED":case"VIDEO_CALL_FAILED":return"Gesprek mislukt";case"VOICE_CALL_VOICEMAIL":return e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen";case"TRANSCRIPT_ADDED":return(e.payload.segments??[]).map(t=>t.text).join(" ");case"AI_MESSAGE_ADDED":return e.payload.output?.text??e.payload.input?.text??"";case"AI_ACTION_PROPOSED":return`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`;case"PLAYBOOK_STARTED":return`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`;case"PLAYBOOK_COMPLETED":return"Playbook afgerond";case"PLAYBOOK_ESCALATED":return"Playbook geëscaleerd naar een mens";case"MEETING_SCHEDULED":return`Vergadering gepland: ${e.payload.title}`;case"MEETING_STARTED":return`Vergadering gestart: ${e.payload.title}`;case"MEETING_ENDED":return`Vergadering beëindigd${e.payload.duration?` (${l(e.payload.duration)})`:""}`;case"MEETING_PARTICIPANT_JOINED":return`${e.payload.name} deelgenomen`;case"MEETING_PARTICIPANT_LEFT":return`${e.payload.name} verlaten`;case"COMMENT_ADDED":return e.payload.text??"";case"FILE_UPLOADED":return`Bestand: ${e.payload.fileName}`;case"INTERACTION_CREATED":return"Interactie aangemaakt";case"INTERACTION_STATUS_CHANGED":return`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`;case"INTERACTION_ASSIGNED":return"Interactie toegewezen";default:return""}}function L(e){return{activityId:e.id,type:e.type,snippet:D(O(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now()}}function M(e,t,n=[]){const r=e.createdAt;if(!r)return[];const s=new Set(n);return e.author.type==="user"&&e.author.id&&s.add(e.author.id),Object.entries(t).filter(([a,o])=>o>=r&&!s.has(a)).map(([a])=>a)}const C=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function m(e){const t=[];for(const n of Object.keys(e))for(const r of Object.keys(e[n]))t.push({lang:n,key:r,value:e[n][r]});return t}function i(e){return e<10?`0${e}`:`${e}`}function g(e,t){const n=new Date(e),r=`${n.getUTCFullYear()}-${i(n.getUTCMonth()+1)}-${i(n.getUTCDate())}`;return t==="day"?r:`${r}T${i(n.getUTCHours())}`}function _(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const h=36e5,y=864e5;function P(e,t,n){const r=n==="hour"?h:y,s=[];for(let a=_(e,n);a<=t;a+=r)s.push(g(a,n));return s}const U=new Set(["mail","message"]);function I(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function $(e,t,n,r="html"){if(!e)return n;const s=I(e,t);return s?`${n}${r==="text"?`
|
|
2
2
|
|
|
3
|
-
`:t==="mail"?"<br><br>-- <br>":"<br><br>"}${
|
|
3
|
+
`:t==="mail"?"<br><br>-- <br>":"<br><br>"}${s.body}`:n}function G(e){return e.endpoints??[]}const H=e=>!!e.assignedUserId||!!e.assignedInboxId,V=e=>e.status==="closed",k=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,w=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function B(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const F=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],u=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,x=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function j(e){const t=e.split(`
|
|
4
|
+
`);for(let n=0;n<t.length;n++)if(x.test(t[n])||u.test(t[n])&&t.slice(n+1,n+4).some(r=>u.test(r)))return t.slice(0,n).join(`
|
|
5
|
+
`).trim();return e}function E(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
|
|
4
6
|
`),t=t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi,`
|
|
5
|
-
`),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function
|
|
7
|
+
`),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function d(e){return e.replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&#(\d+);/g,(t,n)=>String.fromCharCode(Number(n))).replace(/&/gi,"&")}function p(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
|
|
6
8
|
`).replace(/\n{3,}/g,`
|
|
7
9
|
|
|
8
|
-
`).trim()}function
|
|
10
|
+
`).trim()}function W(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const a of F){const o=e.search(a);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let r=p(d(E(n)));return r||(r=p(d(E(e)))),j(r)||r}const Y=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,K=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function q(e,t){return!!(e&&Y.test(e)||t&&K.test(t))}const T=3,f=600;function z(e,t){return e>=T||t>=f}function S(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},s=t.intents.filter(o=>!n.has(o.intent)).map(o=>Q(o,r[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return s;const a=new Set(s.map(o=>o.intent));for(const o of e.extraIntents)a.has(o.intent)||(s.push(o),a.add(o.intent));return s}function b(e,t){const n={};for(const r of e.intents){if(!r.togglable)continue;const s=t?.[r.intent];n[r.intent]=s??r.defaultEnabled??!0}return n}function J(e,t){const n=b(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function Q(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function X(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const s=t[r.providerId];if(s)for(const a of S(r,s))n.push({channel:r,description:s,capability:a})}return n}function Z(e,t){return t.filter(n=>n.capability.intent===e)}function N(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function v(e,t){return N(e.scheme,t)}function ee(e,t,n){const r=[];for(const s of e)for(const a of n)a.capability.intent===t&&a.capability.targetSchemes.includes(s.scheme)&&r.push({channelIntent:a,endpoint:s});return r}var R=(e=>(e.MAILTO="mailto",e.SIP="sip",e.TEL="tel",e.WEBHOOK="webhook",e.USERNAME="username",e.ID="id",e.CUSTOM="custom",e.URL="url",e.TELEGRAM="telegram",e.WHATSAPP="whatsapp",e.MESSENGER="messenger",e.INSTAGRAM="instagram",e.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(R||{});const te="message_window",ne="message_templates",re={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},se=(e,t)=>({intent:e,...t}),ae="folder_management",oe="remote_search",le={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},ie=9e4,ce="installation-id";exports.CORE_DIMENSIONS=C;exports.CommunicationScheme=R;exports.FEATURE_FOLDER_MANAGEMENT=ae;exports.FEATURE_REMOTE_SEARCH=oe;exports.INSTALLATION_HEADER=ce;exports.InteractionParticipantRole=re;exports.PRESENCE_ONLINE_WINDOW_MS=ie;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=ne;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=te;exports.SIGNATURE_INTENTS=U;exports.SUMMARY_MIN_LAST_CHARS=f;exports.SUMMARY_MIN_MESSAGES=T;exports.UNSUPPORTED=le;exports.applySignature=$;exports.buildActivityPreview=L;exports.buildChannelIntents=X;exports.cleanMessageText=W;exports.defineIntent=se;exports.disabledIntentsFromCapabilities=J;exports.filterByEndpoint=v;exports.filterByIntent=Z;exports.filterByTargetScheme=N;exports.flattenLocales=m;exports.floorToPeriod=_;exports.formatPeriod=g;exports.getActivitySeenUserIds=M;exports.getContactEndpoints=G;exports.getShortTitle=w;exports.getUrgencyScore=k;exports.isAssigned=H;exports.isClosed=V;exports.isInteractionUnseen=B;exports.isLikelyBulk=q;exports.isThreadLongEnough=z;exports.matchContactToIntents=ee;exports.periodsInRange=P;exports.resolveAccountCapabilities=b;exports.resolveChannelIntents=S;exports.resolveSignature=I;exports.stripHtml=A;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from './entities/transcript';
|
|
|
28
28
|
export * from './entities/user';
|
|
29
29
|
export * from './entities/webhook';
|
|
30
30
|
export * from './text/message';
|
|
31
|
+
export * from './text/triage';
|
|
31
32
|
export * from './platform/ai-tools';
|
|
32
33
|
export * from './platform/api';
|
|
33
34
|
export * from './platform/author';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function p(e) {
|
|
2
2
|
return e.replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/\s+/g, " ").trim();
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function g(e) {
|
|
5
5
|
const t = e.trim();
|
|
6
6
|
return t.length <= 140 ? t : t.slice(0, 139).trimEnd() + "…";
|
|
7
7
|
}
|
|
@@ -91,23 +91,23 @@ function A(e) {
|
|
|
91
91
|
return "";
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function $(e) {
|
|
95
95
|
return {
|
|
96
96
|
activityId: e.id,
|
|
97
97
|
type: e.type,
|
|
98
|
-
snippet:
|
|
98
|
+
snippet: g(A(e)),
|
|
99
99
|
authorName: e.author?.name ?? "",
|
|
100
100
|
direction: e.direction,
|
|
101
101
|
createdAt: e.createdAt ?? Date.now()
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function U(e, t, n = []) {
|
|
105
105
|
const r = e.createdAt;
|
|
106
106
|
if (!r) return [];
|
|
107
|
-
const
|
|
108
|
-
return e.author.type === "user" && e.author.id &&
|
|
107
|
+
const s = new Set(n);
|
|
108
|
+
return e.author.type === "user" && e.author.id && s.add(e.author.id), Object.entries(t).filter(([a, o]) => o >= r && !s.has(a)).map(([a]) => a);
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const H = [
|
|
111
111
|
{ id: "agent", label: "Agent", labelSource: "user" },
|
|
112
112
|
{ id: "team", label: "Team", labelSource: "team" },
|
|
113
113
|
{ id: "inbox", label: "Inbox", labelSource: "inbox" },
|
|
@@ -117,67 +117,78 @@ const M = [
|
|
|
117
117
|
{ id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
|
|
118
118
|
{ id: "time", label: "Tijd", labelSource: "raw" }
|
|
119
119
|
];
|
|
120
|
-
function
|
|
120
|
+
function G(e) {
|
|
121
121
|
const t = [];
|
|
122
122
|
for (const n of Object.keys(e))
|
|
123
123
|
for (const r of Object.keys(e[n]))
|
|
124
124
|
t.push({ lang: n, key: r, value: e[n][r] });
|
|
125
125
|
return t;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function i(e) {
|
|
128
128
|
return e < 10 ? `0${e}` : `${e}`;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
const n = new Date(e), r = `${n.getUTCFullYear()}-${
|
|
132
|
-
return t === "day" ? r : `${r}T${
|
|
130
|
+
function f(e, t) {
|
|
131
|
+
const n = new Date(e), r = `${n.getUTCFullYear()}-${i(n.getUTCMonth() + 1)}-${i(n.getUTCDate())}`;
|
|
132
|
+
return t === "day" ? r : `${r}T${i(n.getUTCHours())}`;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function _(e, t) {
|
|
135
135
|
const n = new Date(e);
|
|
136
136
|
return n.setUTCMinutes(0, 0, 0), t === "day" && n.setUTCHours(0), n.getTime();
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
const r = n === "hour" ?
|
|
141
|
-
for (let
|
|
142
|
-
|
|
143
|
-
return
|
|
138
|
+
const T = 36e5, I = 864e5;
|
|
139
|
+
function V(e, t, n) {
|
|
140
|
+
const r = n === "hour" ? T : I, s = [];
|
|
141
|
+
for (let a = _(e, n); a <= t; a += r)
|
|
142
|
+
s.push(f(a, n));
|
|
143
|
+
return s;
|
|
144
144
|
}
|
|
145
|
-
const
|
|
146
|
-
function
|
|
145
|
+
const w = /* @__PURE__ */ new Set(["mail", "message"]);
|
|
146
|
+
function S(e, t) {
|
|
147
147
|
const n = e.settings?.signatures?.[t];
|
|
148
148
|
return !n || !n.enabled || !n.body || n.body.trim() === "" ? null : n;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function k(e, t, n, r = "html") {
|
|
151
151
|
if (!e) return n;
|
|
152
|
-
const
|
|
153
|
-
return
|
|
152
|
+
const s = S(e, t);
|
|
153
|
+
return s ? `${n}${r === "text" ? `
|
|
154
154
|
|
|
155
|
-
` : t === "mail" ? "<br><br>-- <br>" : "<br><br>"}${
|
|
155
|
+
` : t === "mail" ? "<br><br>-- <br>" : "<br><br>"}${s.body}` : n;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function x(e) {
|
|
158
158
|
return e.endpoints ?? [];
|
|
159
159
|
}
|
|
160
|
-
const
|
|
160
|
+
const B = (e) => !!e.assignedUserId || !!e.assignedInboxId, F = (e) => e.status === "closed", j = (e) => ({
|
|
161
161
|
urgent: 10,
|
|
162
162
|
high: 5,
|
|
163
163
|
normal: 2,
|
|
164
164
|
low: 1
|
|
165
|
-
})[e.priority] || 0,
|
|
166
|
-
function
|
|
165
|
+
})[e.priority] || 0, W = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
|
|
166
|
+
function K(e, t) {
|
|
167
167
|
return e.lastActivityAt ? !(e.seenBy ?? []).includes(t) : !1;
|
|
168
168
|
}
|
|
169
|
-
const
|
|
169
|
+
const b = [
|
|
170
170
|
/<blockquote/i,
|
|
171
171
|
/class="?gmail_quote/i,
|
|
172
172
|
// Gmail quote container
|
|
173
173
|
/id="?[^"]*divRplyFwdMsg/i,
|
|
174
174
|
// Outlook web reply/forward header
|
|
175
|
+
/id="?[^"]*mail-editor-reference-message-container/i,
|
|
176
|
+
// Outlook new/"mail editor" quote container
|
|
175
177
|
/-{3,}\s*Original Message\s*-{3,}/i,
|
|
176
178
|
/\n_{5,}\s*\n/,
|
|
177
179
|
// Outlook underscore separator before "From:"
|
|
178
180
|
/\bOn\b[\s\S]{0,200}?\bwrote:/i
|
|
179
181
|
// Gmail "On <date> <name> wrote:"
|
|
180
|
-
];
|
|
182
|
+
], u = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, D = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
|
|
183
|
+
function N(e) {
|
|
184
|
+
const t = e.split(`
|
|
185
|
+
`);
|
|
186
|
+
for (let n = 0; n < t.length; n++)
|
|
187
|
+
if (D.test(t[n]) || u.test(t[n]) && t.slice(n + 1, n + 4).some((r) => u.test(r)))
|
|
188
|
+
return t.slice(0, n).join(`
|
|
189
|
+
`).trim();
|
|
190
|
+
return e;
|
|
191
|
+
}
|
|
181
192
|
function c(e) {
|
|
182
193
|
let t = e;
|
|
183
194
|
return t = t.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), t = t.replace(/<br\s*\/?>/gi, `
|
|
@@ -187,80 +198,88 @@ function c(e) {
|
|
|
187
198
|
function E(e) {
|
|
188
199
|
return e.replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);/g, (t, n) => String.fromCharCode(Number(n))).replace(/&/gi, "&");
|
|
189
200
|
}
|
|
190
|
-
function
|
|
201
|
+
function d(e) {
|
|
191
202
|
return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
|
|
192
203
|
`).replace(/\n{3,}/g, `
|
|
193
204
|
|
|
194
205
|
`).trim();
|
|
195
206
|
}
|
|
196
|
-
function
|
|
207
|
+
function Y(e) {
|
|
197
208
|
if (typeof e != "string" || !e) return "";
|
|
198
209
|
let t = e.length;
|
|
199
|
-
for (const a of
|
|
200
|
-
const
|
|
201
|
-
|
|
210
|
+
for (const a of b) {
|
|
211
|
+
const o = e.search(a);
|
|
212
|
+
o >= 0 && o < t && (t = o);
|
|
202
213
|
}
|
|
203
214
|
const n = e.slice(0, t);
|
|
204
|
-
let r =
|
|
205
|
-
return r || (r =
|
|
215
|
+
let r = d(E(c(n)));
|
|
216
|
+
return r || (r = d(E(c(e)))), N(r) || r;
|
|
217
|
+
}
|
|
218
|
+
const L = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, O = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
|
|
219
|
+
function q(e, t) {
|
|
220
|
+
return !!(e && L.test(e) || t && O.test(t));
|
|
221
|
+
}
|
|
222
|
+
const R = 3, m = 600;
|
|
223
|
+
function X(e, t) {
|
|
224
|
+
return e >= R || t >= m;
|
|
206
225
|
}
|
|
207
|
-
function
|
|
208
|
-
const n = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {},
|
|
209
|
-
if (!e.extraIntents || e.extraIntents.length === 0) return
|
|
210
|
-
const
|
|
226
|
+
function C(e, t) {
|
|
227
|
+
const n = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, s = t.intents.filter((o) => !n.has(o.intent)).map((o) => h(o, r[o.intent]));
|
|
228
|
+
if (!e.extraIntents || e.extraIntents.length === 0) return s;
|
|
229
|
+
const a = new Set(s.map((o) => o.intent));
|
|
211
230
|
for (const o of e.extraIntents)
|
|
212
|
-
|
|
213
|
-
return
|
|
231
|
+
a.has(o.intent) || (s.push(o), a.add(o.intent));
|
|
232
|
+
return s;
|
|
214
233
|
}
|
|
215
|
-
function
|
|
234
|
+
function M(e, t) {
|
|
216
235
|
const n = {};
|
|
217
236
|
for (const r of e.intents) {
|
|
218
237
|
if (!r.togglable) continue;
|
|
219
|
-
const
|
|
220
|
-
n[r.intent] =
|
|
238
|
+
const s = t?.[r.intent];
|
|
239
|
+
n[r.intent] = s ?? r.defaultEnabled ?? !0;
|
|
221
240
|
}
|
|
222
241
|
return n;
|
|
223
242
|
}
|
|
224
|
-
function
|
|
225
|
-
const n =
|
|
243
|
+
function z(e, t) {
|
|
244
|
+
const n = M(e, t);
|
|
226
245
|
return Object.entries(n).filter(([, r]) => !r).map(([r]) => r);
|
|
227
246
|
}
|
|
228
|
-
function
|
|
247
|
+
function h(e, t) {
|
|
229
248
|
return t ? {
|
|
230
249
|
intent: t.intent ?? e.intent,
|
|
231
250
|
targetSchemes: t.targetSchemes ?? e.targetSchemes,
|
|
232
251
|
transport: t.transport ?? e.transport
|
|
233
252
|
} : e;
|
|
234
253
|
}
|
|
235
|
-
function
|
|
254
|
+
function J(e, t) {
|
|
236
255
|
const n = [];
|
|
237
256
|
for (const r of e) {
|
|
238
257
|
if (!r.enabled) continue;
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
for (const
|
|
242
|
-
n.push({ channel: r, description:
|
|
258
|
+
const s = t[r.providerId];
|
|
259
|
+
if (s)
|
|
260
|
+
for (const a of C(r, s))
|
|
261
|
+
n.push({ channel: r, description: s, capability: a });
|
|
243
262
|
}
|
|
244
263
|
return n;
|
|
245
264
|
}
|
|
246
|
-
function
|
|
265
|
+
function Q(e, t) {
|
|
247
266
|
return t.filter((n) => n.capability.intent === e);
|
|
248
267
|
}
|
|
249
|
-
function
|
|
268
|
+
function P(e, t) {
|
|
250
269
|
return t.filter((n) => n.capability.targetSchemes.includes(e));
|
|
251
270
|
}
|
|
252
|
-
function
|
|
253
|
-
return
|
|
271
|
+
function Z(e, t) {
|
|
272
|
+
return P(e.scheme, t);
|
|
254
273
|
}
|
|
255
|
-
function
|
|
274
|
+
function v(e, t, n) {
|
|
256
275
|
const r = [];
|
|
257
|
-
for (const
|
|
258
|
-
for (const
|
|
259
|
-
|
|
276
|
+
for (const s of e)
|
|
277
|
+
for (const a of n)
|
|
278
|
+
a.capability.intent === t && a.capability.targetSchemes.includes(s.scheme) && r.push({ channelIntent: a, endpoint: s });
|
|
260
279
|
return r;
|
|
261
280
|
}
|
|
262
|
-
var
|
|
263
|
-
const
|
|
281
|
+
var y = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(y || {});
|
|
282
|
+
const ee = "message_window", te = "message_templates", ne = {
|
|
264
283
|
// E-mail
|
|
265
284
|
FROM: "from",
|
|
266
285
|
TO: "to",
|
|
@@ -277,42 +296,46 @@ const K = "message_window", Y = "message_templates", q = {
|
|
|
277
296
|
// Voice/conference
|
|
278
297
|
HOST: "host",
|
|
279
298
|
PARTICIPANT: "participant"
|
|
280
|
-
},
|
|
299
|
+
}, re = (e, t) => ({ intent: e, ...t }), se = "folder_management", ae = "remote_search", oe = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, le = 9e4, ie = "installation-id";
|
|
281
300
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
301
|
+
H as CORE_DIMENSIONS,
|
|
302
|
+
y as CommunicationScheme,
|
|
303
|
+
se as FEATURE_FOLDER_MANAGEMENT,
|
|
304
|
+
ae as FEATURE_REMOTE_SEARCH,
|
|
305
|
+
ie as INSTALLATION_HEADER,
|
|
306
|
+
ne as InteractionParticipantRole,
|
|
307
|
+
le as PRESENCE_ONLINE_WINDOW_MS,
|
|
308
|
+
te as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
|
|
309
|
+
ee as PROVIDER_FEATURE_MESSAGE_WINDOW,
|
|
310
|
+
w as SIGNATURE_INTENTS,
|
|
311
|
+
m as SUMMARY_MIN_LAST_CHARS,
|
|
312
|
+
R as SUMMARY_MIN_MESSAGES,
|
|
313
|
+
oe as UNSUPPORTED,
|
|
314
|
+
k as applySignature,
|
|
315
|
+
$ as buildActivityPreview,
|
|
316
|
+
J as buildChannelIntents,
|
|
317
|
+
Y as cleanMessageText,
|
|
318
|
+
re as defineIntent,
|
|
319
|
+
z as disabledIntentsFromCapabilities,
|
|
320
|
+
Z as filterByEndpoint,
|
|
321
|
+
Q as filterByIntent,
|
|
322
|
+
P as filterByTargetScheme,
|
|
323
|
+
G as flattenLocales,
|
|
324
|
+
_ as floorToPeriod,
|
|
325
|
+
f as formatPeriod,
|
|
326
|
+
U as getActivitySeenUserIds,
|
|
327
|
+
x as getContactEndpoints,
|
|
328
|
+
W as getShortTitle,
|
|
329
|
+
j as getUrgencyScore,
|
|
330
|
+
B as isAssigned,
|
|
331
|
+
F as isClosed,
|
|
332
|
+
K as isInteractionUnseen,
|
|
333
|
+
q as isLikelyBulk,
|
|
334
|
+
X as isThreadLongEnough,
|
|
335
|
+
v as matchContactToIntents,
|
|
336
|
+
V as periodsInRange,
|
|
337
|
+
M as resolveAccountCapabilities,
|
|
338
|
+
C as resolveChannelIntents,
|
|
339
|
+
S as resolveSignature,
|
|
317
340
|
p as stripHtml
|
|
318
341
|
};
|
package/dist/platform/ui.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export interface DockConfig {
|
|
|
25
25
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
26
26
|
props?: Record<string, any>;
|
|
27
27
|
hideHeader?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Optional federated resource rendered inside the generic header, right of
|
|
30
|
+
* the title and before the minimize/close controls — e.g. a mail composer's
|
|
31
|
+
* "from"-account dropdown. Receives the dock's `props` + `dockControls`.
|
|
32
|
+
*/
|
|
33
|
+
headerAccessory?: string;
|
|
28
34
|
/** Rendered collapsed to just its title bar when true. */
|
|
29
35
|
minimized?: boolean;
|
|
30
36
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cheap, no-LLM triage heuristics for deciding whether an interaction is worth
|
|
3
|
+
* auto-summarising in focus mode. Deliberately conservative: a false negative
|
|
4
|
+
* (summarising a newsletter) only wastes one cheap call, while a false positive
|
|
5
|
+
* (skipping a real 1-to-1 mail) hurts the user — so we only flag CLEAR bulk.
|
|
6
|
+
*/
|
|
7
|
+
/** True when a message looks like a newsletter / automated bulk send. */
|
|
8
|
+
export declare function isLikelyBulk(fromEmail?: string, body?: string): boolean;
|
|
9
|
+
/** A conversation is "worth summarising" once it has real back-and-forth or a long message. */
|
|
10
|
+
export declare const SUMMARY_MIN_MESSAGES = 3;
|
|
11
|
+
export declare const SUMMARY_MIN_LAST_CHARS = 600;
|
|
12
|
+
/** True when the thread is long enough that a summary saves the reader scrolling. */
|
|
13
|
+
export declare function isThreadLongEnough(messageCount: number, lastMessageChars: number): boolean;
|