@opencxh/domain 1.31.0 → 1.34.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.
|
@@ -24,6 +24,12 @@ export interface BaseActivity {
|
|
|
24
24
|
direction: "inbound" | "outbound" | "internal" | "none";
|
|
25
25
|
externalIds?: string[];
|
|
26
26
|
attachments?: Attachment[];
|
|
27
|
+
/**
|
|
28
|
+
* Activity is optimistisch geschreven en wacht op bevestiging vanuit
|
|
29
|
+
* provider-sync. Sync zet 'm op `false` zodra de canonieke versie is
|
|
30
|
+
* opgehaald. UI kan een "verzenden..." indicator tonen wanneer true.
|
|
31
|
+
*/
|
|
32
|
+
pending?: boolean;
|
|
27
33
|
/** Epoch ms — matcht DB-model en Interaction.createdAt. */
|
|
28
34
|
createdAt?: number;
|
|
29
35
|
updatedAt?: number;
|
|
@@ -72,6 +78,10 @@ export type EmailPayload = {
|
|
|
72
78
|
email: string;
|
|
73
79
|
name?: string;
|
|
74
80
|
}[];
|
|
81
|
+
bcc?: {
|
|
82
|
+
email: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
}[];
|
|
75
85
|
subject: string;
|
|
76
86
|
body: string;
|
|
77
87
|
bodySnippet?: string;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=140;function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=140;function p(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<=l?t:t.slice(0,l-1).trimEnd()+"…"}function E(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()||p(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?` (${E(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?` (${E(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.text??"";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?` (${E(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 i(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 _(e){return e.endpoints??[]}const g=e=>!!e.assignedUserId||!!e.assignedInboxId,T=e=>e.status==="closed",D=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,f=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function d(e,t){const n=new Set(e.disabledIntents??[]),a=e.intentOverrides??{},r=t.intents.filter(s=>!n.has(s.intent)).map(s=>L(s,a[s.intent]));if(!e.extraIntents||e.extraIntents.length===0)return r;const o=new Set(r.map(s=>s.intent));for(const s of e.extraIntents)o.has(s.intent)||(r.push(s),o.add(s.intent));return r}function L(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function C(e,t){const n=[];for(const a of e){if(!a.enabled)continue;const r=t[a.providerId];if(r)for(const o of d(a,r))n.push({channel:a,description:r,capability:o})}return n}function S(e,t){return t.filter(n=>n.capability.intent===e)}function u(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function N(e,t){return u(e.scheme,t)}function O(e,t,n){const a=[];for(const r of e)for(const o of n)o.capability.intent===t&&o.capability.targetSchemes.includes(r.scheme)&&a.push({channelIntent:o,endpoint:r});return a}var c=(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))(c||{});const M=(e,t)=>({intent:e,...t}),b={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"};exports.CommunicationScheme=c;exports.UNSUPPORTED=b;exports.buildActivityPreview=i;exports.buildChannelIntents=C;exports.defineIntent=M;exports.filterByEndpoint=N;exports.filterByIntent=S;exports.filterByTargetScheme=u;exports.getContactEndpoints=_;exports.getShortTitle=f;exports.getUrgencyScore=D;exports.isAssigned=g;exports.isClosed=T;exports.matchContactToIntents=O;exports.resolveChannelIntents=d;exports.stripHtml=p;
|
package/dist/index.js
CHANGED
|
@@ -29,10 +29,7 @@ export interface ITransportProvider {
|
|
|
29
29
|
readonly id: string;
|
|
30
30
|
subscribeSessions(callback: (sessions: Session[]) => void): () => void;
|
|
31
31
|
subscribeAccounts(callback: (accounts: CommsAccount[]) => void): () => void;
|
|
32
|
-
subscribeStreams(callback: (data:
|
|
33
|
-
sessionId: string;
|
|
34
|
-
stream: MediaStream;
|
|
35
|
-
}) => void): () => void;
|
|
32
|
+
subscribeStreams(callback: (data: RemoteStreamEvent) => void): () => void;
|
|
36
33
|
registerAccount(orgId: string, userId: string, config: any): Promise<CommsAccount>;
|
|
37
34
|
unregisterAccount(accountId: string): Promise<void>;
|
|
38
35
|
/**
|
|
@@ -178,6 +175,7 @@ export interface RemoteStreamEvent {
|
|
|
178
175
|
sessionId: string;
|
|
179
176
|
streamId: string;
|
|
180
177
|
stream: MediaStream | null;
|
|
178
|
+
speaker?: 'local' | 'remote';
|
|
181
179
|
label?: string;
|
|
182
180
|
}
|
|
183
181
|
/**
|
|
@@ -205,6 +203,19 @@ export interface MessageBody {
|
|
|
205
203
|
mimeType?: string;
|
|
206
204
|
}>;
|
|
207
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Adressering-envelope voor message-ops. Mail honoreert cc/bcc;
|
|
208
|
+
* chat/SMS gebruikt alleen `to[0]`. Providers droppen velden die ze
|
|
209
|
+
* niet ondersteunen.
|
|
210
|
+
*/
|
|
211
|
+
export interface RecipientList {
|
|
212
|
+
/** 1+ primary recipients (verplicht). */
|
|
213
|
+
to: Uri[];
|
|
214
|
+
/** Carbon-copy. Alleen mail-flow. */
|
|
215
|
+
cc?: Uri[];
|
|
216
|
+
/** Blind carbon-copy. Alleen mail-flow. */
|
|
217
|
+
bcc?: Uri[];
|
|
218
|
+
}
|
|
208
219
|
export interface NoteBody {
|
|
209
220
|
text: string;
|
|
210
221
|
visibility?: "internal" | "team";
|
|
@@ -239,7 +250,7 @@ export type ServerOp = {
|
|
|
239
250
|
kind: "message.new";
|
|
240
251
|
channelId: string;
|
|
241
252
|
intent: string;
|
|
242
|
-
|
|
253
|
+
recipients: RecipientList;
|
|
243
254
|
body: MessageBody;
|
|
244
255
|
} | {
|
|
245
256
|
kind: "message.reply";
|
|
@@ -247,6 +258,8 @@ export type ServerOp = {
|
|
|
247
258
|
interactionId: string;
|
|
248
259
|
activityId?: string;
|
|
249
260
|
body: MessageBody;
|
|
261
|
+
/** Override van default reply-targets (bv. reply-all). */
|
|
262
|
+
recipients?: RecipientList;
|
|
250
263
|
} | {
|
|
251
264
|
kind: "message.comment";
|
|
252
265
|
channelId: string;
|
|
@@ -256,7 +269,7 @@ export type ServerOp = {
|
|
|
256
269
|
kind: "message.forward";
|
|
257
270
|
channelId: string;
|
|
258
271
|
activityId: string;
|
|
259
|
-
|
|
272
|
+
recipients: RecipientList;
|
|
260
273
|
body?: MessageBody;
|
|
261
274
|
} | {
|
|
262
275
|
kind: "message.transcribe";
|
|
@@ -14,7 +14,11 @@ export interface ComposePayload {
|
|
|
14
14
|
body: string;
|
|
15
15
|
channelId: string;
|
|
16
16
|
channelUri?: Uri;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Adressering-envelope. `to` verplicht (1+); `cc`/`bcc` alleen voor
|
|
19
|
+
* mail. Niet-mail providers gebruiken `to[0]`.
|
|
20
|
+
*/
|
|
21
|
+
recipients: import('./communication').RecipientList;
|
|
18
22
|
subject?: string;
|
|
19
23
|
/**
|
|
20
24
|
* The user-intent picked in the starter / contact buttons. Lets a
|