@opencxh/domain 1.12.0 → 1.15.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.
@@ -3,7 +3,7 @@ import { Transcript } from '../transcript/types';
3
3
  export type CallStatus = "new" | "connecting" | "ringing" | "connected" | "held" | "ended" | "failed";
4
4
  export type CallDirection = "inbound" | "outbound";
5
5
  export type CallType = "audio" | "video" | "data" | "screen-share";
6
- export type ActivityType = "VOICE_CALL_STARTED" | "VOICE_CALL_ANSWERED" | "VOICE_CALL_HOLD" | "VOICE_CALL_UNHOLD" | "VOICE_CALL_ENDED" | "VOICE_CALL_MISSED" | "VOICE_CALL_VOICEMAIL" | "VIDEO_CALL_STARTED" | "VIDEO_CALL_ANSWERED" | "VIDEO_CALL_HOLD" | "VIDEO_CALL_UNHOLD" | "VIDEO_CALL_ENDED" | "VIDEO_CALL_MISSED" | "EMAIL_RECEIVED" | "EMAIL_SENT" | "CHAT_MESSAGE_SENT" | "CHAT_MESSAGE_RECEIVED" | "AI_MESSAGE_ADDED" | "MEETING_SCHEDULED" | "MEETING_STARTED" | "MEETING_ENDED" | "MEETING_PARTICIPANT_JOINED" | "MEETING_PARTICIPANT_LEFT" | "COMMENT_ADDED" | "FILE_UPLOADED" | "INTERACTION_CREATED" | "INTERACTION_STATUS_CHANGED" | "INTERACTION_ASSIGNED" | "VOICE_CALL_FAILED" | "VIDEO_CALL_FAILED" | "TRANSCRIPT_ADDED";
6
+ export type ActivityType = "VOICE_CALL_STARTED" | "VOICE_CALL_ANSWERED" | "VOICE_CALL_HOLD" | "VOICE_CALL_UNHOLD" | "VOICE_CALL_ENDED" | "VOICE_CALL_MISSED" | "VOICE_CALL_VOICEMAIL" | "VIDEO_CALL_STARTED" | "VIDEO_CALL_ANSWERED" | "VIDEO_CALL_HOLD" | "VIDEO_CALL_UNHOLD" | "VIDEO_CALL_ENDED" | "VIDEO_CALL_MISSED" | "EMAIL_RECEIVED" | "EMAIL_SENT" | "CHAT_MESSAGE_SENT" | "CHAT_MESSAGE_RECEIVED" | "CHAT_MEMBER_JOINED" | "CHAT_MEMBER_LEFT" | "CHAT_RENAMED" | "CHAT_CALL_STARTED" | "CHAT_CALL_ENDED" | "CHAT_EVENT" | "AI_MESSAGE_ADDED" | "MEETING_SCHEDULED" | "MEETING_STARTED" | "MEETING_ENDED" | "MEETING_PARTICIPANT_JOINED" | "MEETING_PARTICIPANT_LEFT" | "COMMENT_ADDED" | "FILE_UPLOADED" | "INTERACTION_CREATED" | "INTERACTION_STATUS_CHANGED" | "INTERACTION_ASSIGNED" | "VOICE_CALL_FAILED" | "VIDEO_CALL_FAILED" | "TRANSCRIPT_ADDED";
7
7
  export interface Attachment {
8
8
  id: string;
9
9
  filename: string;
@@ -81,6 +81,36 @@ export type ChatMessagePayload = {
81
81
  text: string;
82
82
  conversationId: string;
83
83
  };
84
+ export type ChatMember = {
85
+ id?: string;
86
+ name: string;
87
+ };
88
+ export type ChatMemberEventPayload = {
89
+ conversationId: string;
90
+ members: ChatMember[];
91
+ initiator?: ChatMember;
92
+ };
93
+ export type ChatRenamedPayload = {
94
+ conversationId: string;
95
+ oldName?: string;
96
+ newName: string;
97
+ initiator?: ChatMember;
98
+ };
99
+ export type ChatCallPayload = {
100
+ conversationId: string;
101
+ callId?: string;
102
+ callType?: "audio" | "video" | "screen-share" | "meeting";
103
+ duration?: number;
104
+ joinUrl?: string;
105
+ initiator?: ChatMember;
106
+ };
107
+ export type ChatEventPayload = {
108
+ conversationId: string;
109
+ eventType: string;
110
+ text?: string;
111
+ initiator?: ChatMember;
112
+ raw?: any;
113
+ };
84
114
  export type TranscriptAddedPayload = {
85
115
  transcript: Transcript;
86
116
  };
@@ -91,6 +121,9 @@ export type MeetingPayload = {
91
121
  id?: string;
92
122
  name: string;
93
123
  }[];
124
+ joinUrl?: string;
125
+ scheduledAt?: number;
126
+ providerId?: string;
94
127
  };
95
128
  export type MeetingEndedPayload = MeetingPayload & {
96
129
  duration: number;
@@ -182,6 +215,24 @@ export type Activity = (BaseActivity & {
182
215
  }) | (BaseActivity & {
183
216
  type: "CHAT_MESSAGE_RECEIVED";
184
217
  payload: ChatMessagePayload;
218
+ }) | (BaseActivity & {
219
+ type: "CHAT_MEMBER_JOINED";
220
+ payload: ChatMemberEventPayload;
221
+ }) | (BaseActivity & {
222
+ type: "CHAT_MEMBER_LEFT";
223
+ payload: ChatMemberEventPayload;
224
+ }) | (BaseActivity & {
225
+ type: "CHAT_RENAMED";
226
+ payload: ChatRenamedPayload;
227
+ }) | (BaseActivity & {
228
+ type: "CHAT_CALL_STARTED";
229
+ payload: ChatCallPayload;
230
+ }) | (BaseActivity & {
231
+ type: "CHAT_CALL_ENDED";
232
+ payload: ChatCallPayload;
233
+ }) | (BaseActivity & {
234
+ type: "CHAT_EVENT";
235
+ payload: ChatEventPayload;
185
236
  }) | (BaseActivity & {
186
237
  type: "TRANSCRIPT_ADDED";
187
238
  payload: TranscriptAddedPayload;
@@ -4,6 +4,8 @@ export interface Inbox {
4
4
  displayName: string;
5
5
  description: string;
6
6
  members: string[];
7
+ type?: "team" | "personal";
8
+ teamId?: string;
7
9
  ticketEnabled?: boolean;
8
10
  ticketPrefix?: string;
9
11
  }
@@ -33,6 +33,7 @@ export interface Interaction {
33
33
  collaborators: string[];
34
34
  assignedUserId?: string;
35
35
  ticketId?: string;
36
+ visibility?: "visible" | "hidden";
36
37
  createdAt?: number;
37
38
  updatedAt?: number;
38
39
  }
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,10 @@
1
+ export interface Team {
2
+ id: string;
3
+ organizationId: string;
4
+ name: string;
5
+ description?: string;
6
+ members: string[];
7
+ avatar?: string;
8
+ createdAt?: number;
9
+ updatedAt?: number;
10
+ }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=s=>!!s.assignedUserId||!!s.assignedInboxId,l=s=>s.status==="closed",g=s=>({urgent:10,high:5,normal:2,low:1})[s.priority]||0,d=(s,r=30)=>s.title.length<=r?s.title:`${s.title.substring(0,r)}...`;var t=(s=>(s.MAILTO="mailto",s.SIP="sip",s.TEL="tel",s.WEBHOOK="webhook",s.USERNAME="username",s.ID="id",s.CUSTOM="custom",s.URL="url",s.TELEGRAM="telegram",s.WHATSAPP="whatsapp",s.VIBER="viber",s.SMS="sms",s.FAX="fax",s))(t||{});exports.CommunicationScheme=t;exports.getShortTitle=d;exports.getUrgencyScore=g;exports.isAssigned=e;exports.isClosed=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=s=>!!s.assignedUserId||!!s.assignedInboxId,l=s=>s.status==="closed",g=s=>({urgent:10,high:5,normal:2,low:1})[s.priority]||0,d=(s,r=30)=>s.title.length<=r?s.title:`${s.title.substring(0,r)}...`;var t=(s=>(s.MAILTO="mailto",s.SIP="sip",s.TEL="tel",s.WEBHOOK="webhook",s.USERNAME="username",s.ID="id",s.CUSTOM="custom",s.URL="url",s.TELEGRAM="telegram",s.WHATSAPP="whatsapp",s.VIBER="viber",s.SMS="sms",s.FAX="fax",s.TEAMS="teams",s))(t||{});exports.CommunicationScheme=t;exports.getShortTitle=d;exports.getUrgencyScore=g;exports.isAssigned=e;exports.isClosed=l;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './entities/contact';
11
11
  export * from './entities/inbox';
12
12
  export * from './entities/interaction';
13
13
  export * from './entities/note';
14
+ export * from './entities/team';
14
15
  export * from './entities/organization';
15
16
  export * from './entities/transcript';
16
17
  export * from './entities/user';
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ const l = (s) => !!s.assignedUserId || !!s.assignedInboxId, g = (s) => s.status
4
4
  normal: 2,
5
5
  low: 1
6
6
  })[s.priority] || 0, A = (s, r = 30) => s.title.length <= r ? s.title : `${s.title.substring(0, r)}...`;
7
- var t = /* @__PURE__ */ ((s) => (s.MAILTO = "mailto", s.SIP = "sip", s.TEL = "tel", s.WEBHOOK = "webhook", s.USERNAME = "username", s.ID = "id", s.CUSTOM = "custom", s.URL = "url", s.TELEGRAM = "telegram", s.WHATSAPP = "whatsapp", s.VIBER = "viber", s.SMS = "sms", s.FAX = "fax", s))(t || {});
7
+ var t = /* @__PURE__ */ ((s) => (s.MAILTO = "mailto", s.SIP = "sip", s.TEL = "tel", s.WEBHOOK = "webhook", s.USERNAME = "username", s.ID = "id", s.CUSTOM = "custom", s.URL = "url", s.TELEGRAM = "telegram", s.WHATSAPP = "whatsapp", s.VIBER = "viber", s.SMS = "sms", s.FAX = "fax", s.TEAMS = "teams", s))(t || {});
8
8
  export {
9
9
  t as CommunicationScheme,
10
10
  A as getShortTitle,
@@ -58,7 +58,8 @@ export declare enum CommunicationScheme {
58
58
  WHATSAPP = "whatsapp",
59
59
  VIBER = "viber",
60
60
  SMS = "sms",
61
- FAX = "fax"
61
+ FAX = "fax",
62
+ TEAMS = "teams"
62
63
  }
63
64
  export interface ProviderDescription {
64
65
  id?: string;
@@ -66,9 +67,39 @@ export interface ProviderDescription {
66
67
  capabilities: Capability[];
67
68
  supportedSchemes: CommunicationScheme[];
68
69
  }
70
+ export interface PersonalAuthOption {
71
+ id: string;
72
+ label: string;
73
+ description?: string;
74
+ }
75
+ export interface PersonalAuthField {
76
+ name: string;
77
+ label: string;
78
+ type: "text" | "password" | "email" | "url";
79
+ required?: boolean;
80
+ placeholder?: string;
81
+ }
82
+ /**
83
+ * Describes how to connect a personal account for a provider.
84
+ * - mode "redirect": user picks an option → OAuth redirect flow
85
+ * - mode "form": user fills in fields → credentials submitted server-side
86
+ * - mode "unavailable": provider does not support personal connections (or no options configured)
87
+ */
88
+ export interface PersonalAuthDescription {
89
+ mode: "redirect" | "form" | "unavailable";
90
+ options?: PersonalAuthOption[];
91
+ fields?: PersonalAuthField[];
92
+ message?: string;
93
+ }
94
+ export interface PersonalAuthStartResult {
95
+ redirectUrl?: string;
96
+ success?: boolean;
97
+ message?: string;
98
+ }
69
99
  export interface Uri {
70
100
  scheme: CommunicationScheme;
71
101
  resource: string;
102
+ displayName?: string;
72
103
  }
73
104
  export interface SessionAction {
74
105
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.12.0",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",