@opencxh/domain 1.40.0 → 1.42.1
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 +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -5
- package/dist/platform/api.d.ts +1 -0
- package/dist/platform/installation.d.ts +29 -0
- package/dist/platform/push.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=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 A(e){const t=e.trim();return t.length<=u?t:t.slice(0,u-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 I(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 g(e){return{activityId:e.id,type:e.type,snippet:A(I(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now()}}function f(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function _(e){return e.endpoints??[]}const T=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 E(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},s=t.intents.filter(a=>!n.has(a.intent)).map(a=>b(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 d(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=d(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function b(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function O(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const s=t[r.providerId];if(s)for(const o of E(r,s))n.push({channel:r,description:s,capability:o})}return n}function M(e,t){return t.filter(n=>n.capability.intent===e)}function p(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function R(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 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 V=(e,t)=>({intent:e,...t}),h={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},m="installation-id";exports.CommunicationScheme=c;exports.INSTALLATION_HEADER=m;exports.UNSUPPORTED=h;exports.buildActivityPreview=g;exports.buildChannelIntents=O;exports.defineIntent=V;exports.disabledIntentsFromCapabilities=N;exports.filterByEndpoint=R;exports.filterByIntent=M;exports.filterByTargetScheme=p;exports.getContactEndpoints=_;exports.getShortTitle=C;exports.getUrgencyScore=L;exports.isAssigned=T;exports.isClosed=D;exports.isInteractionUnseen=S;exports.matchContactToIntents=y;exports.resolveAccountCapabilities=d;exports.resolveChannelIntents=E;exports.resolveSignature=f;exports.stripHtml=i;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -105,8 +105,8 @@ const T = (e) => !!e.assignedUserId || !!e.assignedInboxId, D = (e) => e.status
|
|
|
105
105
|
high: 5,
|
|
106
106
|
normal: 2,
|
|
107
107
|
low: 1
|
|
108
|
-
})[e.priority] || 0,
|
|
109
|
-
function
|
|
108
|
+
})[e.priority] || 0, N = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
|
|
109
|
+
function C(e, t) {
|
|
110
110
|
return e.lastActivityAt ? !(e.seenBy ?? []).includes(t) : !1;
|
|
111
111
|
}
|
|
112
112
|
function d(e, t) {
|
|
@@ -165,9 +165,10 @@ 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 V = (e, t) => ({ intent: e, ...t }), P = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" };
|
|
168
|
+
const V = (e, t) => ({ intent: e, ...t }), P = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, $ = "installation-id";
|
|
169
169
|
export {
|
|
170
170
|
I as CommunicationScheme,
|
|
171
|
+
$ as INSTALLATION_HEADER,
|
|
171
172
|
P as UNSUPPORTED,
|
|
172
173
|
_ as buildActivityPreview,
|
|
173
174
|
O as buildChannelIntents,
|
|
@@ -177,11 +178,11 @@ export {
|
|
|
177
178
|
b as filterByIntent,
|
|
178
179
|
A as filterByTargetScheme,
|
|
179
180
|
g as getContactEndpoints,
|
|
180
|
-
|
|
181
|
+
N as getShortTitle,
|
|
181
182
|
L as getUrgencyScore,
|
|
182
183
|
T as isAssigned,
|
|
183
184
|
D as isClosed,
|
|
184
|
-
|
|
185
|
+
C as isInteractionUnseen,
|
|
185
186
|
R as matchContactToIntents,
|
|
186
187
|
c as resolveAccountCapabilities,
|
|
187
188
|
d as resolveChannelIntents,
|
package/dist/platform/api.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface Installation {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
label: string;
|
|
6
|
+
userAgent: string;
|
|
7
|
+
platform: string;
|
|
8
|
+
appVersion?: string;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
lastSeenAt: number;
|
|
11
|
+
revokedAt?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface InstallationClaimInput {
|
|
14
|
+
userAgent: string;
|
|
15
|
+
platform: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
appVersion?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface InstallationUpdateInput {
|
|
20
|
+
label?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface InstallationSetting<V = unknown> {
|
|
23
|
+
installationId: string;
|
|
24
|
+
key: string;
|
|
25
|
+
value: V;
|
|
26
|
+
updatedAt?: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const INSTALLATION_HEADER = "installation-id";
|
|
29
|
+
export type PushPrefKey = `push.pref.${string}`;
|
package/dist/platform/push.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type PushPlatform = "web" | "ios" | "android" | "desktop";
|
|
|
3
3
|
export interface PushSubscription {
|
|
4
4
|
id: string;
|
|
5
5
|
userId: string;
|
|
6
|
+
installationId: string;
|
|
6
7
|
transport: PushTransport;
|
|
7
8
|
token: string;
|
|
8
9
|
keys?: {
|
|
@@ -37,13 +38,14 @@ export interface PushEnvelope<P = unknown> {
|
|
|
37
38
|
ttl?: number;
|
|
38
39
|
voip?: boolean;
|
|
39
40
|
}
|
|
40
|
-
export type PushSubscribeInput = Omit<PushSubscription, "id" | "userId" | "createdAt" | "lastSeenAt">;
|
|
41
|
+
export type PushSubscribeInput = Omit<PushSubscription, "id" | "userId" | "installationId" | "createdAt" | "lastSeenAt">;
|
|
41
42
|
export interface PushSendRequest<P = unknown> {
|
|
42
43
|
to: {
|
|
43
44
|
userIds: string[];
|
|
44
45
|
} | {
|
|
45
46
|
userId: string;
|
|
46
47
|
};
|
|
48
|
+
installationIds?: string[];
|
|
47
49
|
envelope: Omit<PushEnvelope<P>, "ts">;
|
|
48
50
|
platforms?: PushPlatform[];
|
|
49
51
|
collapseKey?: string;
|