@opencxh/domain 1.128.0 → 1.131.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/entities/activity/index.d.ts +1 -0
- package/dist/entities/activity/timestamp.d.ts +15 -0
- package/dist/entities/company/index.d.ts +1 -0
- package/dist/entities/company/types.d.ts +50 -0
- package/dist/entities/contact/types.d.ts +29 -0
- package/dist/entities/contact-source/index.d.ts +1 -0
- package/dist/entities/contact-source/types.d.ts +56 -0
- package/dist/entities/interaction/types.d.ts +15 -0
- package/dist/entities/memory/item.d.ts +36 -1
- package/dist/entities/memory/query.d.ts +42 -0
- package/dist/entities/organization/types.d.ts +7 -0
- package/dist/entities/playbook/trigger-vars.d.ts +6 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.js +452 -239
- package/dist/platform/ai-tools.d.ts +19 -0
- package/dist/platform/communication.d.ts +15 -9
- package/dist/platform/scope.d.ts +25 -0
- package/dist/platform/services.d.ts +18 -1
- package/dist/text/endpoint.d.ts +104 -0
- package/dist/text/endpoint.test.d.ts +1 -0
- package/dist/text/region.test.d.ts +1 -0
- package/package.json +8 -4
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
function
|
|
1
|
+
function S(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
|
|
5
|
-
const
|
|
6
|
-
return
|
|
4
|
+
function T(e) {
|
|
5
|
+
const n = e.trim();
|
|
6
|
+
return n.length <= 140 ? n : n.slice(0, 139).trimEnd() + "…";
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function c(e) {
|
|
9
9
|
if (!e || e < 0) return "";
|
|
10
|
-
const
|
|
11
|
-
return `${
|
|
10
|
+
const n = Math.floor(e / 60), t = Math.floor(e % 60);
|
|
11
|
+
return `${n}:${t.toString().padStart(2, "0")}`;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function h(e) {
|
|
14
14
|
switch (e.type) {
|
|
15
15
|
case "EMAIL_RECEIVED":
|
|
16
16
|
case "EMAIL_SENT": {
|
|
17
|
-
const
|
|
18
|
-
return
|
|
17
|
+
const n = e.payload, t = n.bodySnippet?.trim() || S(n.body ?? "");
|
|
18
|
+
return n.subject ? `${n.subject} — ${t}` : t;
|
|
19
19
|
}
|
|
20
20
|
case "CHAT_MESSAGE_SENT":
|
|
21
21
|
case "CHAT_MESSAGE_RECEIVED":
|
|
@@ -23,13 +23,13 @@ function A(e) {
|
|
|
23
23
|
case "CHAT_RENAMED":
|
|
24
24
|
return `Hernoemd naar "${e.payload.newName}"`;
|
|
25
25
|
case "CHAT_MEMBER_JOINED":
|
|
26
|
-
return `${e.payload.members.map((
|
|
26
|
+
return `${e.payload.members.map((n) => n.name).join(", ")} toegevoegd`;
|
|
27
27
|
case "CHAT_MEMBER_LEFT":
|
|
28
|
-
return `${e.payload.members.map((
|
|
28
|
+
return `${e.payload.members.map((n) => n.name).join(", ")} verlaten`;
|
|
29
29
|
case "CHAT_CALL_STARTED":
|
|
30
30
|
return "Gesprek gestart";
|
|
31
31
|
case "CHAT_CALL_ENDED":
|
|
32
|
-
return `Gesprek beëindigd${e.payload.duration ? ` (${
|
|
32
|
+
return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
|
|
33
33
|
case "CHAT_EVENT":
|
|
34
34
|
return e.payload.text ?? e.payload.eventType;
|
|
35
35
|
case "VOICE_CALL_STARTED":
|
|
@@ -46,7 +46,7 @@ function A(e) {
|
|
|
46
46
|
return "Hervat";
|
|
47
47
|
case "VOICE_CALL_ENDED":
|
|
48
48
|
case "VIDEO_CALL_ENDED":
|
|
49
|
-
return `Gesprek beëindigd${e.payload.duration ? ` (${
|
|
49
|
+
return `Gesprek beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
|
|
50
50
|
case "VOICE_CALL_MISSED":
|
|
51
51
|
case "VIDEO_CALL_MISSED":
|
|
52
52
|
return "Gemiste oproep";
|
|
@@ -56,7 +56,7 @@ function A(e) {
|
|
|
56
56
|
case "VOICE_CALL_VOICEMAIL":
|
|
57
57
|
return e.payload.transcription?.trim() ? e.payload.transcription : "Voicemail ontvangen";
|
|
58
58
|
case "TRANSCRIPT_ADDED":
|
|
59
|
-
return (e.payload.segments ?? []).map((
|
|
59
|
+
return (e.payload.segments ?? []).map((n) => n.text).join(" ");
|
|
60
60
|
case "AI_MESSAGE_ADDED":
|
|
61
61
|
return e.payload.output?.text ?? e.payload.input?.text ?? "";
|
|
62
62
|
case "AI_ACTION_PROPOSED":
|
|
@@ -72,7 +72,7 @@ function A(e) {
|
|
|
72
72
|
case "MEETING_STARTED":
|
|
73
73
|
return `Vergadering gestart: ${e.payload.title}`;
|
|
74
74
|
case "MEETING_ENDED":
|
|
75
|
-
return `Vergadering beëindigd${e.payload.duration ? ` (${
|
|
75
|
+
return `Vergadering beëindigd${e.payload.duration ? ` (${c(e.payload.duration)})` : ""}`;
|
|
76
76
|
case "MEETING_PARTICIPANT_JOINED":
|
|
77
77
|
return `${e.payload.name} deelgenomen`;
|
|
78
78
|
case "MEETING_PARTICIPANT_LEFT":
|
|
@@ -91,23 +91,26 @@ function A(e) {
|
|
|
91
91
|
return "";
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function ie(e) {
|
|
95
95
|
return {
|
|
96
96
|
activityId: e.id,
|
|
97
97
|
type: e.type,
|
|
98
|
-
snippet:
|
|
98
|
+
snippet: T(h(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 se(e, n, t = []) {
|
|
105
105
|
const r = e.createdAt;
|
|
106
106
|
if (!r) return [];
|
|
107
|
-
const a = new Set(
|
|
108
|
-
return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(
|
|
107
|
+
const a = new Set(t);
|
|
108
|
+
return e.author.type === "user" && e.author.id && a.add(e.author.id), Object.entries(n).filter(([i, s]) => s >= r && !a.has(i)).map(([i]) => i);
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
function oe(e) {
|
|
111
|
+
return e.createdAt ?? 0;
|
|
112
|
+
}
|
|
113
|
+
const le = [
|
|
111
114
|
{ id: "agent", label: "Agent", labelSource: "user" },
|
|
112
115
|
{ id: "team", label: "Team", labelSource: "team" },
|
|
113
116
|
{ id: "inbox", label: "Inbox", labelSource: "inbox" },
|
|
@@ -117,57 +120,57 @@ const W = [
|
|
|
117
120
|
{ id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
|
|
118
121
|
{ id: "time", label: "Tijd", labelSource: "raw" }
|
|
119
122
|
];
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
for (const
|
|
123
|
-
for (const r of Object.keys(e[
|
|
124
|
-
|
|
125
|
-
return
|
|
123
|
+
function ce(e) {
|
|
124
|
+
const n = [];
|
|
125
|
+
for (const t of Object.keys(e))
|
|
126
|
+
for (const r of Object.keys(e[t]))
|
|
127
|
+
n.push({ lang: t, key: r, value: e[t][r] });
|
|
128
|
+
return n;
|
|
126
129
|
}
|
|
127
|
-
function
|
|
130
|
+
function u(e) {
|
|
128
131
|
return e < 10 ? `0${e}` : `${e}`;
|
|
129
132
|
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
return
|
|
133
|
+
function D(e, n) {
|
|
134
|
+
const t = new Date(e), r = `${t.getUTCFullYear()}-${u(t.getUTCMonth() + 1)}-${u(t.getUTCDate())}`;
|
|
135
|
+
return n === "day" ? r : `${r}T${u(t.getUTCHours())}`;
|
|
133
136
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
return
|
|
137
|
+
function C(e, n) {
|
|
138
|
+
const t = new Date(e);
|
|
139
|
+
return t.setUTCMinutes(0, 0, 0), n === "day" && t.setUTCHours(0), t.getTime();
|
|
137
140
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
const r =
|
|
141
|
-
for (let
|
|
142
|
-
a.push(
|
|
141
|
+
const O = 36e5, N = 864e5;
|
|
142
|
+
function ue(e, n, t) {
|
|
143
|
+
const r = t === "hour" ? O : N, a = [];
|
|
144
|
+
for (let i = C(e, t); i <= n; i += r)
|
|
145
|
+
a.push(D(i, t));
|
|
143
146
|
return a;
|
|
144
147
|
}
|
|
145
|
-
const
|
|
148
|
+
const L = [
|
|
146
149
|
{ id: "resource", label: "Resource", labelSource: "raw" },
|
|
147
150
|
{ id: "origin", label: "Herkomst", labelSource: "raw" }
|
|
148
|
-
],
|
|
149
|
-
function
|
|
150
|
-
return `${e}.usage.${
|
|
151
|
-
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
154
|
-
id:
|
|
155
|
-
label:
|
|
151
|
+
], R = L.map((e) => e.id);
|
|
152
|
+
function y(e, n) {
|
|
153
|
+
return `${e}.usage.${n}`;
|
|
154
|
+
}
|
|
155
|
+
function de(e, n) {
|
|
156
|
+
return n.map((t) => ({
|
|
157
|
+
id: y(e, t.unit),
|
|
158
|
+
label: t.label,
|
|
156
159
|
category: "Verbruik",
|
|
157
|
-
valueType:
|
|
160
|
+
valueType: t.valueType ?? "count",
|
|
158
161
|
aggregation: "sum",
|
|
159
162
|
supportedDimensions: [
|
|
160
163
|
"provider",
|
|
161
|
-
...
|
|
162
|
-
...
|
|
164
|
+
...R,
|
|
165
|
+
...t.extraDimensions ?? [],
|
|
163
166
|
"time"
|
|
164
167
|
]
|
|
165
168
|
}));
|
|
166
169
|
}
|
|
167
|
-
function
|
|
170
|
+
function pe(e) {
|
|
168
171
|
return (e.startsWith("tool:") ? e.slice(5) : e).replace(/__/g, " · ").replace(/\./g, " · ").replace(/_/g, " ");
|
|
169
172
|
}
|
|
170
|
-
const
|
|
173
|
+
const fe = [
|
|
171
174
|
{ name: "text", type: "string" },
|
|
172
175
|
{ name: "subject", type: "string" },
|
|
173
176
|
{ name: "from", type: "string" },
|
|
@@ -182,12 +185,15 @@ const z = [
|
|
|
182
185
|
// Alleen gevuld bij INTERACTION_STATUS_CHANGED; een filter als
|
|
183
186
|
// `trigger.toStatus == "closed"` is de trigger voor "onthoud dit bij afsluiten".
|
|
184
187
|
{ name: "fromStatus", type: "string" },
|
|
185
|
-
{ name: "toStatus", type: "string" }
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
|
|
188
|
+
{ name: "toStatus", type: "string" },
|
|
189
|
+
// Met wie is dit gesprek. Dit stond hier eerder expliciet NIET, omdat het toen een gok via
|
|
190
|
+
// `remoteParty` zou zijn geweest; nu legt de identiteitslaag de resolutie vast als
|
|
191
|
+
// `contact:<id>`/`company:<id>` in `Interaction.partyKeys`, dus dit is een vastgelegd feit.
|
|
192
|
+
// Leeg zolang de identiteit niet is opgelost (een onbekend nummer, een eerste bericht van
|
|
193
|
+
// een nieuw adres) — een stap die hierop leunt hoort dus een `condition` te hebben.
|
|
194
|
+
{ name: "contactId", type: "string" },
|
|
195
|
+
{ name: "companyId", type: "string" }
|
|
196
|
+
], ge = {
|
|
191
197
|
topics: [
|
|
192
198
|
{ name: "topic", type: "string" },
|
|
193
199
|
{ name: "confidence", type: "number" }
|
|
@@ -198,7 +204,7 @@ const z = [
|
|
|
198
204
|
],
|
|
199
205
|
extract: []
|
|
200
206
|
};
|
|
201
|
-
function
|
|
207
|
+
function k(e) {
|
|
202
208
|
switch (e.kind) {
|
|
203
209
|
case "user":
|
|
204
210
|
return `user:${e.userId}`;
|
|
@@ -208,22 +214,22 @@ function N(e) {
|
|
|
208
214
|
return "org";
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
|
-
function
|
|
217
|
+
function Ee(e) {
|
|
212
218
|
if (typeof e != "string") return;
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
const r =
|
|
219
|
+
const n = e.trim();
|
|
220
|
+
if (n === "org") return { kind: "org" };
|
|
221
|
+
const t = n.indexOf(":");
|
|
222
|
+
if (t <= 0) return;
|
|
223
|
+
const r = n.slice(0, t), a = n.slice(t + 1).trim();
|
|
218
224
|
if (a) {
|
|
219
225
|
if (r === "user") return { kind: "user", userId: a };
|
|
220
226
|
if (r === "team") return { kind: "team", teamId: a };
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
function
|
|
224
|
-
return
|
|
229
|
+
function x(e) {
|
|
230
|
+
return k(e);
|
|
225
231
|
}
|
|
226
|
-
function
|
|
232
|
+
function me(e) {
|
|
227
233
|
switch (e.kind) {
|
|
228
234
|
case "personal":
|
|
229
235
|
return { kind: "user", userId: e.userId };
|
|
@@ -233,20 +239,20 @@ function Z(e) {
|
|
|
233
239
|
return { kind: "org" };
|
|
234
240
|
}
|
|
235
241
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
242
|
+
function be(e) {
|
|
243
|
+
return x(e);
|
|
238
244
|
}
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
return
|
|
245
|
+
const U = ["done", "escalated", "failed", "timed_out", "stopped"], P = ["awaiting_approval", "awaiting_reply"];
|
|
246
|
+
function $(e) {
|
|
247
|
+
return U.includes(e);
|
|
242
248
|
}
|
|
243
|
-
function
|
|
244
|
-
return
|
|
249
|
+
function Ae(e) {
|
|
250
|
+
return $(e);
|
|
245
251
|
}
|
|
246
|
-
function
|
|
247
|
-
return
|
|
252
|
+
function Ie(e) {
|
|
253
|
+
return P.includes(e);
|
|
248
254
|
}
|
|
249
|
-
const
|
|
255
|
+
const _ = [
|
|
250
256
|
{
|
|
251
257
|
id: "openai",
|
|
252
258
|
label: "OpenAI",
|
|
@@ -334,47 +340,239 @@ const g = [
|
|
|
334
340
|
defaultModel: "default"
|
|
335
341
|
}
|
|
336
342
|
];
|
|
337
|
-
function
|
|
338
|
-
return
|
|
343
|
+
function d(e) {
|
|
344
|
+
return _.find((n) => n.id === e);
|
|
339
345
|
}
|
|
340
|
-
function
|
|
341
|
-
return
|
|
346
|
+
function _e(e) {
|
|
347
|
+
return d(e)?.label ?? e;
|
|
342
348
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
349
|
+
function Me(e, n = "gpt-5-mini") {
|
|
350
|
+
return d(e)?.defaultModel ?? n;
|
|
345
351
|
}
|
|
346
|
-
function
|
|
347
|
-
return
|
|
352
|
+
function Se(e) {
|
|
353
|
+
return _.filter((n) => n.capabilities.includes(e));
|
|
348
354
|
}
|
|
349
|
-
function
|
|
350
|
-
const
|
|
351
|
-
return !!
|
|
352
|
-
}
|
|
353
|
-
const
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
return !
|
|
357
|
-
}
|
|
358
|
-
function
|
|
359
|
-
if (!e) return
|
|
360
|
-
const a =
|
|
361
|
-
return a ? `${
|
|
355
|
+
function Te(e) {
|
|
356
|
+
const n = d(e);
|
|
357
|
+
return !!n && !n.baseUrl;
|
|
358
|
+
}
|
|
359
|
+
const he = /* @__PURE__ */ new Set(["mail", "message"]);
|
|
360
|
+
function w(e, n) {
|
|
361
|
+
const t = e.settings?.signatures?.[n];
|
|
362
|
+
return !t || !t.enabled || !t.body || t.body.trim() === "" ? null : t;
|
|
363
|
+
}
|
|
364
|
+
function De(e, n, t, r = "html") {
|
|
365
|
+
if (!e) return t;
|
|
366
|
+
const a = w(e, n);
|
|
367
|
+
return a ? `${t}${r === "text" ? `
|
|
362
368
|
|
|
363
|
-
` :
|
|
369
|
+
` : n === "mail" ? "<br><br>-- <br>" : "<br><br>"}${a.body}` : t;
|
|
364
370
|
}
|
|
365
|
-
function
|
|
371
|
+
function Ce(e) {
|
|
366
372
|
return e.endpoints ?? [];
|
|
367
373
|
}
|
|
368
|
-
const
|
|
374
|
+
const Oe = (e) => !!e.assignedUserId || !!e.assignedInboxId, Ne = (e) => e.status === "closed", Le = (e) => ({
|
|
369
375
|
urgent: 10,
|
|
370
376
|
high: 5,
|
|
371
377
|
normal: 2,
|
|
372
378
|
low: 1
|
|
373
|
-
})[e.priority] || 0,
|
|
374
|
-
function
|
|
375
|
-
return e.lastActivityAt ? !(e.seenBy ?? []).includes(
|
|
379
|
+
})[e.priority] || 0, Re = (e, n = 30) => e.title?.length <= n ? e.title : `${e.title.substring(0, n)}...`;
|
|
380
|
+
function ye(e, n) {
|
|
381
|
+
return e.lastActivityAt ? !(e.seenBy ?? []).includes(n) : !1;
|
|
382
|
+
}
|
|
383
|
+
const ke = 2e3, xe = 500, Ue = 12e3, Pe = 4e3, G = ["contact", "company"];
|
|
384
|
+
function $e(e) {
|
|
385
|
+
if (!e) return !1;
|
|
386
|
+
const n = e.slice(0, e.indexOf(":"));
|
|
387
|
+
return G.includes(n);
|
|
388
|
+
}
|
|
389
|
+
const p = {
|
|
390
|
+
// The lower bounds are deliberately generous: service ranges (0800/0900) are
|
|
391
|
+
// shorter than geographic numbers, and a too-strict minimum silently drops them.
|
|
392
|
+
// An over-permissive key is harmless — it simply matches nothing.
|
|
393
|
+
NL: { callingCode: "31", trunkPrefix: "0", nsnMin: 7, nsnMax: 9 },
|
|
394
|
+
BE: { callingCode: "32", trunkPrefix: "0", nsnMin: 8, nsnMax: 9 },
|
|
395
|
+
LU: { callingCode: "352", nsnMin: 6, nsnMax: 9 },
|
|
396
|
+
DE: { callingCode: "49", trunkPrefix: "0", nsnMin: 6, nsnMax: 13 },
|
|
397
|
+
FR: { callingCode: "33", trunkPrefix: "0", nsnMin: 9, nsnMax: 9 },
|
|
398
|
+
GB: { callingCode: "44", trunkPrefix: "0", nsnMin: 9, nsnMax: 10 },
|
|
399
|
+
IE: { callingCode: "353", trunkPrefix: "0", nsnMin: 7, nsnMax: 9 },
|
|
400
|
+
ES: { callingCode: "34", nsnMin: 9, nsnMax: 9 },
|
|
401
|
+
PT: { callingCode: "351", nsnMin: 9, nsnMax: 9 },
|
|
402
|
+
IT: { callingCode: "39", nsnMin: 6, nsnMax: 11 },
|
|
403
|
+
AT: { callingCode: "43", trunkPrefix: "0", nsnMin: 7, nsnMax: 13 },
|
|
404
|
+
CH: { callingCode: "41", trunkPrefix: "0", nsnMin: 9, nsnMax: 9 },
|
|
405
|
+
DK: { callingCode: "45", nsnMin: 8, nsnMax: 8 },
|
|
406
|
+
SE: { callingCode: "46", trunkPrefix: "0", nsnMin: 7, nsnMax: 13 },
|
|
407
|
+
NO: { callingCode: "47", nsnMin: 8, nsnMax: 8 },
|
|
408
|
+
FI: { callingCode: "358", trunkPrefix: "0", nsnMin: 5, nsnMax: 12 },
|
|
409
|
+
PL: { callingCode: "48", nsnMin: 9, nsnMax: 9 },
|
|
410
|
+
US: { callingCode: "1", nsnMin: 10, nsnMax: 10 },
|
|
411
|
+
CA: { callingCode: "1", nsnMin: 10, nsnMax: 10 }
|
|
412
|
+
}, V = "NL", H = 15, B = 8, F = Array.from(
|
|
413
|
+
new Set(Object.values(p).map((e) => e.callingCode))
|
|
414
|
+
).sort((e, n) => n.length - e.length);
|
|
415
|
+
function f(e) {
|
|
416
|
+
if (e)
|
|
417
|
+
return p[e.trim().toUpperCase()];
|
|
418
|
+
}
|
|
419
|
+
function l(e, n) {
|
|
420
|
+
return e.length >= n.nsnMin && e.length <= n.nsnMax;
|
|
421
|
+
}
|
|
422
|
+
function g(e) {
|
|
423
|
+
if (e.length > H) return null;
|
|
424
|
+
for (const n of F) {
|
|
425
|
+
if (!e.startsWith(n)) continue;
|
|
426
|
+
const t = e.slice(n.length);
|
|
427
|
+
for (const r of Object.values(p)) {
|
|
428
|
+
if (r.callingCode !== n) continue;
|
|
429
|
+
const a = r.trunkPrefix, i = a && t.startsWith(a) ? t.slice(a.length) : t;
|
|
430
|
+
if (l(i, r)) return `+${n}${i}`;
|
|
431
|
+
}
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
return e.length < B ? null : `+${e}`;
|
|
435
|
+
}
|
|
436
|
+
function v(e) {
|
|
437
|
+
let n = e.trim();
|
|
438
|
+
const t = n.match(/^(sips?|tel|whatsapp):/i);
|
|
439
|
+
t && (n = n.slice(t[0].length));
|
|
440
|
+
const r = n.indexOf("@");
|
|
441
|
+
return r >= 0 && (n = n.slice(0, r)), n.trim();
|
|
442
|
+
}
|
|
443
|
+
function we(e) {
|
|
444
|
+
if (!e) return !1;
|
|
445
|
+
const n = e.indexOf("@");
|
|
446
|
+
if (n <= 0) return !1;
|
|
447
|
+
const t = e.slice(0, n).trim();
|
|
448
|
+
return !/^[+\d\s().-]+$/.test(t);
|
|
449
|
+
}
|
|
450
|
+
function E(e, n) {
|
|
451
|
+
if (!e) return null;
|
|
452
|
+
const t = v(e);
|
|
453
|
+
if (!t) return null;
|
|
454
|
+
const r = t.startsWith("+"), a = t.replace(/\D/g, "");
|
|
455
|
+
if (!a) return null;
|
|
456
|
+
if (r) return g(a);
|
|
457
|
+
if (a.startsWith("00")) return g(a.slice(2));
|
|
458
|
+
const i = f(n) ?? f(V);
|
|
459
|
+
if (!i) return null;
|
|
460
|
+
const s = i.trunkPrefix;
|
|
461
|
+
if (s && a.startsWith(s)) {
|
|
462
|
+
const o = a.slice(s.length);
|
|
463
|
+
return l(o, i) ? `+${i.callingCode}${o}` : null;
|
|
464
|
+
}
|
|
465
|
+
if (a.startsWith(i.callingCode)) {
|
|
466
|
+
const o = a.slice(i.callingCode.length);
|
|
467
|
+
if (l(o, i)) return `+${i.callingCode}${o}`;
|
|
468
|
+
}
|
|
469
|
+
return !s && l(a, i) ? `+${i.callingCode}${a}` : null;
|
|
470
|
+
}
|
|
471
|
+
function Ge(e, n = 9) {
|
|
472
|
+
const t = (e ?? "").replace(/\D/g, "");
|
|
473
|
+
return t.length < n ? null : t.slice(-n);
|
|
474
|
+
}
|
|
475
|
+
function M(e) {
|
|
476
|
+
if (!e) return null;
|
|
477
|
+
const n = e.trim().toLowerCase(), t = n.lastIndexOf("@");
|
|
478
|
+
if (t <= 0 || t === n.length - 1) return null;
|
|
479
|
+
const r = n.slice(0, t).split("+")[0], a = n.slice(t + 1);
|
|
480
|
+
return !r || !a.includes(".") ? null : `${r}@${a}`;
|
|
481
|
+
}
|
|
482
|
+
function Ve(e) {
|
|
483
|
+
const n = M(e);
|
|
484
|
+
return n ? n.slice(n.lastIndexOf("@") + 1) : null;
|
|
485
|
+
}
|
|
486
|
+
const W = /* @__PURE__ */ new Set([
|
|
487
|
+
"co.uk",
|
|
488
|
+
"org.uk",
|
|
489
|
+
"gov.uk",
|
|
490
|
+
"ac.uk",
|
|
491
|
+
"com.au",
|
|
492
|
+
"co.nz",
|
|
493
|
+
"com.br",
|
|
494
|
+
"co.za"
|
|
495
|
+
]);
|
|
496
|
+
function j(e) {
|
|
497
|
+
if (!e) return null;
|
|
498
|
+
const n = e.trim().toLowerCase().replace(/\.$/, "").split(".").filter(Boolean);
|
|
499
|
+
if (n.length < 2) return null;
|
|
500
|
+
const t = n.slice(-2).join(".");
|
|
501
|
+
return W.has(t) && n.length >= 3 ? n.slice(-3).join(".") : t;
|
|
502
|
+
}
|
|
503
|
+
const K = /* @__PURE__ */ new Set([
|
|
504
|
+
"gmail.com",
|
|
505
|
+
"googlemail.com",
|
|
506
|
+
"outlook.com",
|
|
507
|
+
"hotmail.com",
|
|
508
|
+
"hotmail.nl",
|
|
509
|
+
"hotmail.be",
|
|
510
|
+
"hotmail.co.uk",
|
|
511
|
+
"live.com",
|
|
512
|
+
"live.nl",
|
|
513
|
+
"live.be",
|
|
514
|
+
"msn.com",
|
|
515
|
+
"yahoo.com",
|
|
516
|
+
"yahoo.co.uk",
|
|
517
|
+
"ymail.com",
|
|
518
|
+
"icloud.com",
|
|
519
|
+
"me.com",
|
|
520
|
+
"mac.com",
|
|
521
|
+
"aol.com",
|
|
522
|
+
"gmx.net",
|
|
523
|
+
"gmx.de",
|
|
524
|
+
"web.de",
|
|
525
|
+
"protonmail.com",
|
|
526
|
+
"proton.me",
|
|
527
|
+
"pm.me",
|
|
528
|
+
"tutanota.com",
|
|
529
|
+
"zoho.com",
|
|
530
|
+
"mail.com",
|
|
531
|
+
"ziggo.nl",
|
|
532
|
+
"kpnmail.nl",
|
|
533
|
+
"planet.nl",
|
|
534
|
+
"home.nl",
|
|
535
|
+
"casema.nl",
|
|
536
|
+
"chello.nl",
|
|
537
|
+
"xs4all.nl",
|
|
538
|
+
"telfort.nl",
|
|
539
|
+
"hetnet.nl",
|
|
540
|
+
"zonnet.nl",
|
|
541
|
+
"upcmail.nl",
|
|
542
|
+
"quicknet.nl",
|
|
543
|
+
"telenet.be",
|
|
544
|
+
"skynet.be",
|
|
545
|
+
"proximus.be",
|
|
546
|
+
"scarlet.be"
|
|
547
|
+
]);
|
|
548
|
+
function He(e) {
|
|
549
|
+
const n = j(e);
|
|
550
|
+
return n ? K.has(n) : !1;
|
|
551
|
+
}
|
|
552
|
+
function Be(e) {
|
|
553
|
+
if (!e) return !1;
|
|
554
|
+
const n = e.trim().toLowerCase();
|
|
555
|
+
return n === "tel" || n === "sms" || n === "whatsapp" || n === "fax";
|
|
556
|
+
}
|
|
557
|
+
function Fe(e, n, t) {
|
|
558
|
+
if (!e || !n) return null;
|
|
559
|
+
const r = e.trim().toLowerCase();
|
|
560
|
+
if (r === "tel" || r === "sms" || r === "whatsapp") {
|
|
561
|
+
const i = E(n, t);
|
|
562
|
+
return i ? `tel:${i}` : null;
|
|
563
|
+
}
|
|
564
|
+
if (r === "fax") {
|
|
565
|
+
const i = E(n, t);
|
|
566
|
+
return i ? `fax:${i}` : null;
|
|
567
|
+
}
|
|
568
|
+
if (r === "mailto" || r === "email") {
|
|
569
|
+
const i = M(n);
|
|
570
|
+
return i ? `mailto:${i}` : null;
|
|
571
|
+
}
|
|
572
|
+
const a = n.trim().toLowerCase();
|
|
573
|
+
return a ? `${r}:${a}` : null;
|
|
376
574
|
}
|
|
377
|
-
const
|
|
575
|
+
const Y = [
|
|
378
576
|
/<blockquote/i,
|
|
379
577
|
/class="?gmail_quote/i,
|
|
380
578
|
// Gmail quote container
|
|
@@ -387,107 +585,107 @@ const fe = 2e3, be = 500, Ae = 12e3, me = 4e3, C = [
|
|
|
387
585
|
// Outlook underscore separator before "From:"
|
|
388
586
|
/\bOn\b[\s\S]{0,200}?\bwrote:/i
|
|
389
587
|
// Gmail "On <date> <name> wrote:"
|
|
390
|
-
],
|
|
391
|
-
function
|
|
392
|
-
const
|
|
588
|
+
], m = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, z = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
|
|
589
|
+
function q(e) {
|
|
590
|
+
const n = e.split(`
|
|
393
591
|
`);
|
|
394
|
-
for (let
|
|
395
|
-
if (
|
|
396
|
-
return
|
|
592
|
+
for (let t = 0; t < n.length; t++)
|
|
593
|
+
if (z.test(n[t]) || m.test(n[t]) && n.slice(t + 1, t + 4).some((r) => m.test(r)))
|
|
594
|
+
return n.slice(0, t).join(`
|
|
397
595
|
`).trim();
|
|
398
596
|
return e;
|
|
399
597
|
}
|
|
400
|
-
function
|
|
401
|
-
let
|
|
402
|
-
return
|
|
403
|
-
`),
|
|
404
|
-
`),
|
|
598
|
+
function b(e) {
|
|
599
|
+
let n = e;
|
|
600
|
+
return n = n.replace(/<(script|style)[\s\S]*?<\/\1>/gi, ""), n = n.replace(/<br\s*\/?>/gi, `
|
|
601
|
+
`), n = n.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi, `
|
|
602
|
+
`), n = n.replace(/<[^>]+>/g, ""), n = n.replace(/<[^>]*$/, ""), n;
|
|
405
603
|
}
|
|
406
|
-
function
|
|
407
|
-
return e.replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);/g, (
|
|
604
|
+
function A(e) {
|
|
605
|
+
return e.replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);/g, (n, t) => String.fromCharCode(Number(t))).replace(/&/gi, "&");
|
|
408
606
|
}
|
|
409
|
-
function
|
|
607
|
+
function I(e) {
|
|
410
608
|
return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
|
|
411
609
|
`).replace(/\n{3,}/g, `
|
|
412
610
|
|
|
413
611
|
`).trim();
|
|
414
612
|
}
|
|
415
|
-
function
|
|
613
|
+
function ve(e) {
|
|
416
614
|
if (typeof e != "string" || !e) return "";
|
|
417
|
-
let
|
|
418
|
-
for (const
|
|
419
|
-
const
|
|
420
|
-
|
|
615
|
+
let n = e.length;
|
|
616
|
+
for (const i of Y) {
|
|
617
|
+
const s = e.search(i);
|
|
618
|
+
s >= 0 && s < n && (n = s);
|
|
421
619
|
}
|
|
422
|
-
const
|
|
423
|
-
let r =
|
|
424
|
-
return r || (r =
|
|
620
|
+
const t = e.slice(0, n);
|
|
621
|
+
let r = I(A(b(t)));
|
|
622
|
+
return r || (r = I(A(b(e)))), q(r) || r;
|
|
425
623
|
}
|
|
426
|
-
const
|
|
427
|
-
function
|
|
428
|
-
return !!(e &&
|
|
624
|
+
const X = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, J = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
|
|
625
|
+
function We(e, n) {
|
|
626
|
+
return !!(e && X.test(e) || n && J.test(n));
|
|
429
627
|
}
|
|
430
|
-
const
|
|
431
|
-
function
|
|
432
|
-
return e >=
|
|
628
|
+
const Q = 3, Z = 600;
|
|
629
|
+
function je(e, n) {
|
|
630
|
+
return e >= Q || n >= Z;
|
|
433
631
|
}
|
|
434
|
-
function
|
|
435
|
-
const
|
|
632
|
+
function ee(e, n) {
|
|
633
|
+
const t = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, a = n.intents.filter((s) => !t.has(s.intent)).map((s) => te(s, r[s.intent]));
|
|
436
634
|
if (!e.extraIntents || e.extraIntents.length === 0) return a;
|
|
437
|
-
const
|
|
438
|
-
for (const
|
|
439
|
-
|
|
635
|
+
const i = new Set(a.map((s) => s.intent));
|
|
636
|
+
for (const s of e.extraIntents)
|
|
637
|
+
i.has(s.intent) || (a.push(s), i.add(s.intent));
|
|
440
638
|
return a;
|
|
441
639
|
}
|
|
442
|
-
function
|
|
443
|
-
const
|
|
640
|
+
function ne(e, n) {
|
|
641
|
+
const t = {};
|
|
444
642
|
for (const r of e.intents) {
|
|
445
643
|
if (!r.togglable) continue;
|
|
446
|
-
const a =
|
|
447
|
-
|
|
644
|
+
const a = n?.[r.intent];
|
|
645
|
+
t[r.intent] = a ?? r.defaultEnabled ?? !0;
|
|
448
646
|
}
|
|
449
|
-
return
|
|
647
|
+
return t;
|
|
450
648
|
}
|
|
451
|
-
function
|
|
452
|
-
const
|
|
453
|
-
return Object.entries(
|
|
649
|
+
function Ke(e, n) {
|
|
650
|
+
const t = ne(e, n);
|
|
651
|
+
return Object.entries(t).filter(([, r]) => !r).map(([r]) => r);
|
|
454
652
|
}
|
|
455
|
-
function
|
|
456
|
-
return
|
|
457
|
-
intent:
|
|
458
|
-
targetSchemes:
|
|
459
|
-
transport:
|
|
653
|
+
function te(e, n) {
|
|
654
|
+
return n ? {
|
|
655
|
+
intent: n.intent ?? e.intent,
|
|
656
|
+
targetSchemes: n.targetSchemes ?? e.targetSchemes,
|
|
657
|
+
transport: n.transport ?? e.transport
|
|
460
658
|
} : e;
|
|
461
659
|
}
|
|
462
|
-
function
|
|
463
|
-
const
|
|
660
|
+
function Ye(e, n) {
|
|
661
|
+
const t = [];
|
|
464
662
|
for (const r of e) {
|
|
465
663
|
if (!r.enabled) continue;
|
|
466
|
-
const a =
|
|
664
|
+
const a = n[r.providerId];
|
|
467
665
|
if (a)
|
|
468
|
-
for (const
|
|
469
|
-
|
|
666
|
+
for (const i of ee(r, a))
|
|
667
|
+
t.push({ channel: r, description: a, capability: i });
|
|
470
668
|
}
|
|
471
|
-
return
|
|
669
|
+
return t;
|
|
472
670
|
}
|
|
473
|
-
function
|
|
474
|
-
return
|
|
671
|
+
function ze(e, n) {
|
|
672
|
+
return n.filter((t) => t.capability.intent === e);
|
|
475
673
|
}
|
|
476
|
-
function
|
|
477
|
-
return
|
|
674
|
+
function re(e, n) {
|
|
675
|
+
return n.filter((t) => t.capability.targetSchemes.includes(e));
|
|
478
676
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
677
|
+
function qe(e, n) {
|
|
678
|
+
return re(e.scheme, n);
|
|
481
679
|
}
|
|
482
|
-
function
|
|
680
|
+
function Xe(e, n, t) {
|
|
483
681
|
const r = [];
|
|
484
682
|
for (const a of e)
|
|
485
|
-
for (const
|
|
486
|
-
|
|
683
|
+
for (const i of t)
|
|
684
|
+
i.capability.intent === n && i.capability.targetSchemes.includes(a.scheme) && r.push({ channelIntent: i, endpoint: a });
|
|
487
685
|
return r;
|
|
488
686
|
}
|
|
489
|
-
var
|
|
490
|
-
const
|
|
687
|
+
var ae = /* @__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))(ae || {});
|
|
688
|
+
const Je = "message_window", Qe = "message_templates", Ze = {
|
|
491
689
|
// E-mail
|
|
492
690
|
FROM: "from",
|
|
493
691
|
TO: "to",
|
|
@@ -504,73 +702,88 @@ const Oe = "message_window", he = "message_templates", Le = {
|
|
|
504
702
|
// Voice/conference
|
|
505
703
|
HOST: "host",
|
|
506
704
|
PARTICIPANT: "participant"
|
|
507
|
-
},
|
|
705
|
+
}, en = (e, n) => ({ intent: e, ...n }), nn = "folder_management", tn = "remote_search", rn = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, an = 9e4, sn = "installation-id";
|
|
508
706
|
export {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
707
|
+
_ as AI_VENDORS,
|
|
708
|
+
ge as CLASSIFY_VARS,
|
|
709
|
+
le as CORE_DIMENSIONS,
|
|
710
|
+
ae as CommunicationScheme,
|
|
711
|
+
Pe as DEFAULT_MEMORY_BUDGET,
|
|
712
|
+
V as DEFAULT_PHONE_REGION,
|
|
713
|
+
nn as FEATURE_FOLDER_MANAGEMENT,
|
|
714
|
+
tn as FEATURE_REMOTE_SEARCH,
|
|
715
|
+
sn as INSTALLATION_HEADER,
|
|
716
|
+
Ze as InteractionParticipantRole,
|
|
717
|
+
Ue as MAX_MEMORY_BUDGET,
|
|
718
|
+
ke as MAX_MEMORY_CHARS,
|
|
719
|
+
xe as MIN_MEMORY_BUDGET,
|
|
720
|
+
P as PAUSED_RUN_STATUSES,
|
|
721
|
+
p as PHONE_REGIONS,
|
|
722
|
+
an as PRESENCE_ONLINE_WINDOW_MS,
|
|
723
|
+
Qe as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
|
|
724
|
+
Je as PROVIDER_FEATURE_MESSAGE_WINDOW,
|
|
725
|
+
K as PUBLIC_EMAIL_DOMAINS,
|
|
726
|
+
G as RELATED_SUBJECT_KINDS,
|
|
727
|
+
he as SIGNATURE_INTENTS,
|
|
728
|
+
Z as SUMMARY_MIN_LAST_CHARS,
|
|
729
|
+
Q as SUMMARY_MIN_MESSAGES,
|
|
730
|
+
U as TERMINAL_RUN_STATUSES,
|
|
731
|
+
fe as TRIGGER_VARS,
|
|
732
|
+
rn as UNSUPPORTED,
|
|
733
|
+
L as USAGE_DIMENSIONS,
|
|
734
|
+
R as USAGE_DIMENSION_IDS,
|
|
735
|
+
x as actingIdentityKey,
|
|
736
|
+
oe as activityTimestamp,
|
|
737
|
+
be as actorKey,
|
|
738
|
+
Me as aiVendorDefaultModel,
|
|
739
|
+
_e as aiVendorLabel,
|
|
740
|
+
Te as aiVendorNeedsBaseUrl,
|
|
741
|
+
Se as aiVendorsWith,
|
|
742
|
+
De as applySignature,
|
|
743
|
+
ie as buildActivityPreview,
|
|
744
|
+
Ye as buildChannelIntents,
|
|
745
|
+
ve as cleanMessageText,
|
|
746
|
+
en as defineIntent,
|
|
747
|
+
Ke as disabledIntentsFromCapabilities,
|
|
748
|
+
Ve as emailDomain,
|
|
749
|
+
Fe as endpointKey,
|
|
750
|
+
qe as filterByEndpoint,
|
|
751
|
+
ze as filterByIntent,
|
|
752
|
+
re as filterByTargetScheme,
|
|
753
|
+
d as findAiVendor,
|
|
754
|
+
ce as flattenLocales,
|
|
755
|
+
C as floorToPeriod,
|
|
756
|
+
k as formatActingIdentity,
|
|
757
|
+
D as formatPeriod,
|
|
758
|
+
se as getActivitySeenUserIds,
|
|
759
|
+
Ce as getContactEndpoints,
|
|
760
|
+
Re as getShortTitle,
|
|
761
|
+
Le as getUrgencyScore,
|
|
762
|
+
pe as humanizeAction,
|
|
763
|
+
Oe as isAssigned,
|
|
764
|
+
Ne as isClosed,
|
|
765
|
+
ye as isInteractionUnseen,
|
|
766
|
+
We as isLikelyBulk,
|
|
767
|
+
Ie as isPaused,
|
|
768
|
+
He as isPublicEmailDomain,
|
|
769
|
+
Ae as isRetryable,
|
|
770
|
+
$ as isTerminal,
|
|
771
|
+
je as isThreadLongEnough,
|
|
772
|
+
we as looksLikeEmail,
|
|
773
|
+
Xe as matchContactToIntents,
|
|
774
|
+
Be as needsPhoneRegion,
|
|
775
|
+
M as normalizeEmail,
|
|
776
|
+
Ee as parseActingIdentity,
|
|
777
|
+
ue as periodsInRange,
|
|
778
|
+
Ge as phoneSuffix,
|
|
779
|
+
me as playbookActor,
|
|
780
|
+
j as registrableDomain,
|
|
781
|
+
$e as relatedByDefault,
|
|
782
|
+
ne as resolveAccountCapabilities,
|
|
783
|
+
ee as resolveChannelIntents,
|
|
784
|
+
w as resolveSignature,
|
|
785
|
+
S as stripHtml,
|
|
786
|
+
E as toE164,
|
|
787
|
+
y as usageMetricId,
|
|
788
|
+
de as usageMetrics
|
|
576
789
|
};
|