@opencxh/domain 1.44.0 → 1.45.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.
|
@@ -19,8 +19,14 @@ export interface BaseActivity {
|
|
|
19
19
|
providerId: string;
|
|
20
20
|
author: {
|
|
21
21
|
type: "user" | "contact" | "system";
|
|
22
|
+
/** Provider/account-id (Microsoft user-id, SIP account-id, etc.). */
|
|
22
23
|
id?: string;
|
|
23
24
|
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Resolved-hint naar Contact-entity. Wordt door provider-sync gezet via
|
|
27
|
+
* endpoint-lookup. UI mag direct navigeren zonder extra lookup.
|
|
28
|
+
*/
|
|
29
|
+
contactId?: string;
|
|
24
30
|
};
|
|
25
31
|
direction: "inbound" | "outbound" | "internal" | "none";
|
|
26
32
|
externalIds?: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InteractionParticipant } from '../../platform/communication';
|
|
2
2
|
import { ActivityType } from '../activity/types';
|
|
3
3
|
export interface ActivityPreview {
|
|
4
4
|
activityId: string;
|
|
@@ -33,8 +33,26 @@ export interface Interaction {
|
|
|
33
33
|
channelId?: string;
|
|
34
34
|
title: string;
|
|
35
35
|
status: "open" | "pending" | "closed" | "snoozed";
|
|
36
|
+
/**
|
|
37
|
+
* UX-shape van de interactie. "thread" = email-stijl met aparte replyable
|
|
38
|
+
* berichten (inline reply per activity). "conversation" = chat-stijl met
|
|
39
|
+
* doorlopende stream en één bottom-composer. Backend mag dit zetten; bij
|
|
40
|
+
* afwezigheid leidt de frontend het af uit `remoteParty.scheme`.
|
|
41
|
+
*/
|
|
42
|
+
shape?: "thread" | "conversation";
|
|
36
43
|
priority: "urgent" | "high" | "normal" | "low";
|
|
37
|
-
|
|
44
|
+
/**
|
|
45
|
+
* "Headline" tegenpartij — voor 1-1 (mail/sms/direct chat) de enige
|
|
46
|
+
* counterparty; voor group-chats/meetings de groep- of meeting-Uri.
|
|
47
|
+
*/
|
|
48
|
+
remoteParty: InteractionParticipant;
|
|
49
|
+
/**
|
|
50
|
+
* Alle deelnemers behalve het eigen channel. Optioneel voor backward-
|
|
51
|
+
* compatibility met bestaande interacties; voor 1-1 mag leeg of
|
|
52
|
+
* `[remoteParty]` zijn (UI valt terug op `remoteParty`). Voor group-chats
|
|
53
|
+
* en meetings hier de volledige lijst inclusief rollen (cc/bcc/organizer/…).
|
|
54
|
+
*/
|
|
55
|
+
participants?: InteractionParticipant[];
|
|
38
56
|
source?: InteractionSource;
|
|
39
57
|
tags: string[];
|
|
40
58
|
links: InteractionLink[];
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=140;function i(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 I(e){const t=e.trim();return t.length<=E?t:t.slice(0,E-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 A(e){switch(e.type){case"EMAIL_RECEIVED":case"EMAIL_SENT":{const t=e.payload,n=t.bodySnippet?.trim()||i(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"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 T(e){return{activityId:e.id,type:e.type,snippet:I(A(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now()}}function g(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function f(e){return e.endpoints??[]}const _=e=>!!e.assignedUserId||!!e.assignedInboxId,D=e=>e.status==="closed",L=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,C=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function S(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}function u(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},s=t.intents.filter(a=>!n.has(a.intent)).map(a=>O(a,r[a.intent]));if(!e.extraIntents||e.extraIntents.length===0)return s;const o=new Set(s.map(a=>a.intent));for(const a of e.extraIntents)o.has(a.intent)||(s.push(a),o.add(a.intent));return s}function c(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 N(e,t){const n=c(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function O(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function b(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const s=t[r.providerId];if(s)for(const o of u(r,s))n.push({channel:r,description:s,capability:o})}return n}function R(e,t){return t.filter(n=>n.capability.intent===e)}function p(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function M(e,t){return p(e.scheme,t)}function y(e,t,n){const r=[];for(const s of e)for(const o of n)o.capability.intent===t&&o.capability.targetSchemes.includes(s.scheme)&&r.push({channelIntent:o,endpoint:s});return r}var d=(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.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(d||{});const P={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},m=(e,t)=>({intent:e,...t}),V={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},h="installation-id";exports.CommunicationScheme=d;exports.INSTALLATION_HEADER=h;exports.InteractionParticipantRole=P;exports.UNSUPPORTED=V;exports.buildActivityPreview=T;exports.buildChannelIntents=b;exports.defineIntent=m;exports.disabledIntentsFromCapabilities=N;exports.filterByEndpoint=M;exports.filterByIntent=R;exports.filterByTargetScheme=p;exports.getContactEndpoints=f;exports.getShortTitle=C;exports.getUrgencyScore=L;exports.isAssigned=_;exports.isClosed=D;exports.isInteractionUnseen=S;exports.matchContactToIntents=y;exports.resolveAccountCapabilities=c;exports.resolveChannelIntents=u;exports.resolveSignature=g;exports.stripHtml=i;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function
|
|
1
|
+
function u(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 l(e) {
|
|
5
5
|
const t = e.trim();
|
|
6
6
|
return t.length <= 140 ? t : t.slice(0, 139).trimEnd() + "…";
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function E(e) {
|
|
9
9
|
if (!e || e < 0) return "";
|
|
10
10
|
const t = Math.floor(e / 60), n = Math.floor(e % 60);
|
|
11
11
|
return `${t}:${n.toString().padStart(2, "0")}`;
|
|
@@ -14,7 +14,7 @@ function p(e) {
|
|
|
14
14
|
switch (e.type) {
|
|
15
15
|
case "EMAIL_RECEIVED":
|
|
16
16
|
case "EMAIL_SENT": {
|
|
17
|
-
const t = e.payload, n = t.bodySnippet?.trim() ||
|
|
17
|
+
const t = e.payload, n = t.bodySnippet?.trim() || u(t.body ?? "");
|
|
18
18
|
return t.subject ? `${t.subject} — ${n}` : n;
|
|
19
19
|
}
|
|
20
20
|
case "CHAT_MESSAGE_SENT":
|
|
@@ -29,7 +29,7 @@ function p(e) {
|
|
|
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 ? ` (${E(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 p(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 ? ` (${E(e.payload.duration)})` : ""}`;
|
|
50
50
|
case "VOICE_CALL_MISSED":
|
|
51
51
|
case "VIDEO_CALL_MISSED":
|
|
52
52
|
return "Gemiste oproep";
|
|
@@ -64,7 +64,7 @@ function p(e) {
|
|
|
64
64
|
case "MEETING_STARTED":
|
|
65
65
|
return `Vergadering gestart: ${e.payload.title}`;
|
|
66
66
|
case "MEETING_ENDED":
|
|
67
|
-
return `Vergadering beëindigd${e.payload.duration ? ` (${
|
|
67
|
+
return `Vergadering beëindigd${e.payload.duration ? ` (${E(e.payload.duration)})` : ""}`;
|
|
68
68
|
case "MEETING_PARTICIPANT_JOINED":
|
|
69
69
|
return `${e.payload.name} deelgenomen`;
|
|
70
70
|
case "MEETING_PARTICIPANT_LEFT":
|
|
@@ -83,24 +83,24 @@ function p(e) {
|
|
|
83
83
|
return "";
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function T(e) {
|
|
87
87
|
return {
|
|
88
88
|
activityId: e.id,
|
|
89
89
|
type: e.type,
|
|
90
|
-
snippet:
|
|
90
|
+
snippet: l(p(e)),
|
|
91
91
|
authorName: e.author?.name ?? "",
|
|
92
92
|
direction: e.direction,
|
|
93
93
|
createdAt: e.createdAt ?? Date.now()
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function _(e, t) {
|
|
97
97
|
const n = e.settings?.signatures?.[t];
|
|
98
98
|
return !n || !n.enabled || !n.body || n.body.trim() === "" ? null : n;
|
|
99
99
|
}
|
|
100
100
|
function g(e) {
|
|
101
101
|
return e.endpoints ?? [];
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const f = (e) => !!e.assignedUserId || !!e.assignedInboxId, D = (e) => e.status === "closed", L = (e) => ({
|
|
104
104
|
urgent: 10,
|
|
105
105
|
high: 5,
|
|
106
106
|
normal: 2,
|
|
@@ -148,16 +148,16 @@ function O(e, t) {
|
|
|
148
148
|
}
|
|
149
149
|
return n;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function R(e, t) {
|
|
152
152
|
return t.filter((n) => n.capability.intent === e);
|
|
153
153
|
}
|
|
154
154
|
function A(e, t) {
|
|
155
155
|
return t.filter((n) => n.capability.targetSchemes.includes(e));
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function b(e, t) {
|
|
158
158
|
return A(e.scheme, t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function M(e, t, n) {
|
|
161
161
|
const r = [];
|
|
162
162
|
for (const s of e)
|
|
163
163
|
for (const o of n)
|
|
@@ -165,27 +165,45 @@ function R(e, t, n) {
|
|
|
165
165
|
return r;
|
|
166
166
|
}
|
|
167
167
|
var I = /* @__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.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(I || {});
|
|
168
|
-
const
|
|
168
|
+
const P = {
|
|
169
|
+
// E-mail
|
|
170
|
+
FROM: "from",
|
|
171
|
+
TO: "to",
|
|
172
|
+
CC: "cc",
|
|
173
|
+
BCC: "bcc",
|
|
174
|
+
// Meeting (Teams/Zoom/etc.)
|
|
175
|
+
ORGANIZER: "organizer",
|
|
176
|
+
PRESENTER: "presenter",
|
|
177
|
+
ATTENDEE: "attendee",
|
|
178
|
+
// Group chat
|
|
179
|
+
OWNER: "owner",
|
|
180
|
+
MEMBER: "member",
|
|
181
|
+
GUEST: "guest",
|
|
182
|
+
// Voice/conference
|
|
183
|
+
HOST: "host",
|
|
184
|
+
PARTICIPANT: "participant"
|
|
185
|
+
}, V = (e, t) => ({ intent: e, ...t }), H = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, $ = "installation-id";
|
|
169
186
|
export {
|
|
170
187
|
I as CommunicationScheme,
|
|
171
188
|
$ as INSTALLATION_HEADER,
|
|
172
|
-
P as
|
|
173
|
-
|
|
189
|
+
P as InteractionParticipantRole,
|
|
190
|
+
H as UNSUPPORTED,
|
|
191
|
+
T as buildActivityPreview,
|
|
174
192
|
O as buildChannelIntents,
|
|
175
193
|
V as defineIntent,
|
|
176
194
|
S as disabledIntentsFromCapabilities,
|
|
177
|
-
|
|
178
|
-
|
|
195
|
+
b as filterByEndpoint,
|
|
196
|
+
R as filterByIntent,
|
|
179
197
|
A as filterByTargetScheme,
|
|
180
198
|
g as getContactEndpoints,
|
|
181
199
|
N as getShortTitle,
|
|
182
200
|
L as getUrgencyScore,
|
|
183
|
-
|
|
201
|
+
f as isAssigned,
|
|
184
202
|
D as isClosed,
|
|
185
203
|
C as isInteractionUnseen,
|
|
186
|
-
|
|
204
|
+
M as matchContactToIntents,
|
|
187
205
|
c as resolveAccountCapabilities,
|
|
188
206
|
d as resolveChannelIntents,
|
|
189
|
-
|
|
190
|
-
|
|
207
|
+
_ as resolveSignature,
|
|
208
|
+
u as stripHtml
|
|
191
209
|
};
|
|
@@ -175,6 +175,44 @@ export interface Uri {
|
|
|
175
175
|
resource: string;
|
|
176
176
|
displayName?: string;
|
|
177
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Een Uri uitgebreid met identity-cache. Gebruikt voor remote counterparties
|
|
180
|
+
* (afzender, ontvangers, meeting-attendees). Channels (eigen adressen) blijven
|
|
181
|
+
* een plain `Uri`.
|
|
182
|
+
*
|
|
183
|
+
* - `contactId`: resolved-hint, gezet door de server tijdens ingest. UI mag
|
|
184
|
+
* direct navigeren zonder lookup; voor live displayName/avatar blijft de
|
|
185
|
+
* Contact-entity de autoriteit.
|
|
186
|
+
* - `role`: rol van deze deelnemer in deze interactie. Open string; zie
|
|
187
|
+
* `InteractionParticipantRole` voor well-known waardes per kanaal.
|
|
188
|
+
*
|
|
189
|
+
* Niet te verwarren met `Participant` uit `entities/communication` — dat is
|
|
190
|
+
* een live call-session-participant (muted/speaking/etc.).
|
|
191
|
+
*/
|
|
192
|
+
export interface InteractionParticipant extends Uri {
|
|
193
|
+
contactId?: string;
|
|
194
|
+
role?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Well-known rollen voor `InteractionParticipant.role`. Open string in het
|
|
198
|
+
* type zodat provider-specifieke rollen geen domain-PR vereisen — gebruik
|
|
199
|
+
* deze constants wanneer het kanaal een standaardrol kent.
|
|
200
|
+
*/
|
|
201
|
+
export declare const InteractionParticipantRole: {
|
|
202
|
+
readonly FROM: "from";
|
|
203
|
+
readonly TO: "to";
|
|
204
|
+
readonly CC: "cc";
|
|
205
|
+
readonly BCC: "bcc";
|
|
206
|
+
readonly ORGANIZER: "organizer";
|
|
207
|
+
readonly PRESENTER: "presenter";
|
|
208
|
+
readonly ATTENDEE: "attendee";
|
|
209
|
+
readonly OWNER: "owner";
|
|
210
|
+
readonly MEMBER: "member";
|
|
211
|
+
readonly GUEST: "guest";
|
|
212
|
+
readonly HOST: "host";
|
|
213
|
+
readonly PARTICIPANT: "participant";
|
|
214
|
+
};
|
|
215
|
+
export type InteractionParticipantRoleValue = typeof InteractionParticipantRole[keyof typeof InteractionParticipantRole];
|
|
178
216
|
export interface SessionAction {
|
|
179
217
|
id: string;
|
|
180
218
|
label: string;
|