@voicenter-team/events-sdk 0.0.120 → 0.0.121

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.
@@ -78,26 +78,6 @@ export declare type AllUsersStatusEvent = {
78
78
 
79
79
  export declare type AllUsersStatusEventSDK = EventTypeData<EventsEnum.ALL_USERS_STATUS>
80
80
 
81
- export declare type AllVoicebotsStatus = {
82
- /**
83
- * 0 - Connection was establishing successfully.
84
- */
85
- errorCode?: number;
86
- /**
87
- * “Ok” - Connection was establishing successfully.
88
- */
89
- errorDesc?: string;
90
- voicebots: Array<Voicebot>;
91
- /**
92
- * Server time at the moment of the event
93
- */
94
- servertime: number;
95
- /**
96
- * Difference in time between server and client
97
- */
98
- servertimeoffset: number;
99
- };
100
-
101
81
  declare class AuthClass {
102
82
  private readonly eventsSdkClass;
103
83
  constructor(eventsSdkClass: EventsSdkClass);
@@ -157,7 +137,7 @@ declare interface CurrentCallEnded extends CurrentCallUTCExtended {
157
137
  duration: number
158
138
  }
159
139
 
160
- export declare interface CurrentCallUTCExtended extends ExtensionCall {
140
+ declare interface CurrentCallUTCExtended extends ExtensionCall {
161
141
  callStarted_UTC: number
162
142
  callStarted_UTC_CLIENT: number
163
143
  callAnswered_UTC: number
@@ -300,7 +280,6 @@ export declare interface EventDataMap {
300
280
  [EventsEnum.ALL_EXTENSION_STATUS]: AllExtensionStatusEvent
301
281
  [EventsEnum.ALL_DIALER_STATUS]: AllDialersStatusEvent
302
282
  [EventsEnum.ALL_USERS_STATUS]: AllUsersStatusEvent
303
- [EventsEnum.ALL_VOICEBOTS_STATUS]: AllVoicebotsStatus
304
283
  [EventsEnum.QUEUE_EVENT]: QueueEvent
305
284
  [EventsEnum.EXTENSION_EVENT]: ExtensionEvent
306
285
  [EventsEnum.DIALER_EVENT]: DialerEvent
@@ -309,11 +288,6 @@ export declare interface EventDataMap {
309
288
  [EventsEnum.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
310
289
  [EventsEnum.ONLINE_STATUS_EVENT]: OnlineStatusEvent
311
290
  [EventsEnum.EXTENSIONS_UPDATED]: ExtensionsUpdated
312
- [EventsEnum.VOICEBOT_SUBSCRIBED_TO_CALL]: SubscribedToVoicebotCall
313
- [EventsEnum.VOICEBOT_SUBSCRIBE_TO_CALL_FAILED]: SubscribeToVoicebotCallFailed
314
- [EventsEnum.VOICEBOT_INITIAL_CALL_HISTORY]: InitialVoicebotCallHistory
315
- [EventsEnum.VOICEBOT_UNSUBSCRIBED_FROM_CALL]: UnsubscribedFromVoicebotCall
316
- [EventsEnum.VOICEBOT_EVENT]: VoicebotEvent
317
291
  }
318
292
 
319
293
  /**
@@ -354,12 +328,6 @@ export declare enum EventsEnum {
354
328
  ONLINE_STATUS_EVENT = 'onlineStatusEvent',
355
329
  DIALER_EVENT = 'DialerEvent',
356
330
  EXTENSIONS_UPDATED = 'ExtensionsUpdated',
357
- ALL_VOICEBOTS_STATUS = 'AllVoicebotsStatus',
358
- VOICEBOT_SUBSCRIBE_TO_CALL_FAILED = 'subscribeToCallFailed',
359
- VOICEBOT_SUBSCRIBED_TO_CALL = 'subscribedToCall',
360
- VOICEBOT_INITIAL_CALL_HISTORY = 'initialCallHistory',
361
- VOICEBOT_UNSUBSCRIBED_FROM_CALL = 'unsubscribedFromCall',
362
- VOICEBOT_EVENT = 'VoicebotEvent',
363
331
  }
364
332
 
365
333
  /**
@@ -608,10 +576,6 @@ export declare type ExtensionCall = {
608
576
  */
609
577
  callername: string;
610
578
  callstatus: CallStatusEnum;
611
- /**
612
- * cam id
613
- */
614
- campaignID?: string;
615
579
  customdata: CustomData;
616
580
  /**
617
581
  * Is internal
@@ -796,18 +760,6 @@ export declare interface ExternalLoginResponse<T> {
796
760
  */
797
761
  export declare type GenericEventWrapper = EventWrappedSocketDataMap[EventTypeNames]
798
762
 
799
- export declare type InitialVoicebotCallHistory = {
800
- history: Array<VoicebotEventDataCall>;
801
- /**
802
- * Voicebot id
803
- */
804
- voicebotID: number;
805
- /**
806
- * Ivr unique id
807
- */
808
- IvrUniqueID: string;
809
- };
810
-
811
763
  export declare type KeepAliveResponseEvent = {
812
764
  /**
813
765
  * Is ok
@@ -857,7 +809,6 @@ declare class LoggerClass {
857
809
  keepAliveEmit(): void;
858
810
  keepAliveResponse(data: KeepAliveResponseEvent): void;
859
811
  eventLog<T extends EventTypeNames>(eventName: T, data: EventDataMap[T]): void;
860
- private getStaticData;
861
812
  }
862
813
 
863
814
  export declare interface LoggerConfig {
@@ -936,8 +887,7 @@ export declare type LoginSuccessEventSDK = EventTypeData<EventsEnum.LOGIN_SUCCES
936
887
 
937
888
  export declare enum LoginType {
938
889
  USER = "User",
939
- TOKEN = "Token",
940
- JWT = "Jwt"
890
+ TOKEN = "Token"
941
891
  }
942
892
 
943
893
  export declare type OnlineStatusEvent = {
@@ -1141,9 +1091,7 @@ export declare type ServerEmitEventCallbackRegistry = {
1141
1091
  */
1142
1092
  export declare interface ServerEmitEventDataMap {
1143
1093
  [ServerListenerEventsEnum.UPDATE_MONITORED_EXTENSIONS]: UpdateMonitoredExtensionsPayload
1144
- [ServerListenerEventsEnum.KEEP_ALIVE]: string,
1145
- [ServerListenerEventsEnum.SUBSCRIBE_VOICEBOT_CALL_UPDATES]: SubscriptionVoicebotCallUpdatesPayload,
1146
- [ServerListenerEventsEnum.UNSUBSCRIBE_VOICEBOT_CALL_UPDATES]: SubscriptionVoicebotCallUpdatesPayload
1094
+ [ServerListenerEventsEnum.KEEP_ALIVE]: string
1147
1095
  }
1148
1096
 
1149
1097
  /**
@@ -1154,9 +1102,7 @@ export declare type ServerEmitEventTypeNames = keyof ServerEmitEventDataMap
1154
1102
 
1155
1103
  export declare enum ServerListenerEventsEnum {
1156
1104
  UPDATE_MONITORED_EXTENSIONS = "updateMonitoredExtensions",
1157
- KEEP_ALIVE = "keepalive",
1158
- SUBSCRIBE_VOICEBOT_CALL_UPDATES = "subscribeVoicebotCallUpdates",
1159
- UNSUBSCRIBE_VOICEBOT_CALL_UPDATES = "unsubscribeVoicebotCallUpdates"
1105
+ KEEP_ALIVE = "keepalive"
1160
1106
  }
1161
1107
 
1162
1108
  export declare enum ServerParameter {
@@ -1190,147 +1136,40 @@ export declare interface Socket {
1190
1136
  Version: string
1191
1137
  }
1192
1138
 
1193
- /**
1194
- * SocketIoClass handles WebSocket connections and real-time event management.
1195
- * Prevents duplicate connections and events with robust state management.
1196
- */
1197
1139
  declare class SocketIoClass {
1198
1140
  private readonly eventsSdkClass;
1199
- /** The active Socket.IO connection instance */
1141
+ constructor(eventsSdkClass: EventsSdkClass);
1200
1142
  io: SocketTyped | undefined;
1201
- /** The Socket.IO function used to create connections based on version */
1202
1143
  ioFunction: TypedSocketIo | undefined;
1203
- /** Timestamp of the last received event, used for keep-alive calculations */
1204
1144
  lastEventTimestamp: number;
1205
- /** Flag indicating whether automatic reconnection should be attempted */
1206
1145
  doReconnect: boolean;
1207
- /** Current connection state */
1208
- private connectionState;
1209
- /** Keep-alive interval handle */
1210
1146
  private keepAliveInterval;
1211
- /** Reconnection timeout handle */
1212
- private reconnectTimeout;
1213
- /** Network reconnect timeout handle (debounced) */
1214
- private networkReconnectTimeout;
1215
- /** Current reconnection delay in seconds */
1147
+ private keepReconnectInterval;
1148
+ private keepReconnectTimeout;
1149
+ private connected;
1216
1150
  private reconnectionTime;
1217
- /** Maximum reconnection delay in seconds */
1218
- private readonly maxReconnectionDelay;
1219
- /** Network event cleanup functions */
1220
- private networkCleanup;
1221
- /**
1222
- * Creates an instance of SocketIoClass and sets up network event listeners.
1223
- */
1224
- constructor(eventsSdkClass: EventsSdkClass);
1225
- /**
1226
- * Sets up network event listeners
1227
- */
1228
- private setupNetworkListeners;
1229
- /**
1230
- * Handles network online with debouncing to prevent rapid reconnects
1231
- */
1232
- private handleNetworkOnline;
1233
- /**
1234
- * Determines and sets the appropriate Socket.IO function based on client version.
1235
- */
1236
1151
  getSocketIoFunction(Client: string): void;
1237
- /**
1238
- * Initializes a new Socket.IO connection. Prevents multiple simultaneous connections.
1239
- */
1240
1152
  initSocketConnection(): void;
1241
- /**
1242
- * Clears the keep-alive interval
1243
- */
1244
1153
  clearKeepAliveInterval(): void;
1245
- /**
1246
- * Initializes the keep-alive mechanism
1247
- */
1248
1154
  initKeepAlive(): void;
1249
- /**
1250
- * Closes all active connections and cleans up resources properly
1251
- */
1252
- closeAllConnections(): Promise<void>;
1253
- /**
1254
- * Sets up event listeners for all Socket.IO events
1255
- */
1155
+ closeAllConnections(): void;
1256
1156
  initSocketEvents(): void;
1257
- /**
1258
- * Updates timestamp on every event to prevent unnecessary keep-alives
1259
- */
1260
- private updateEventTimestamp;
1261
1157
  private onLoginSuccessEvent;
1262
1158
  private onQueueEvent;
1263
1159
  private onExtensionEvent;
1264
1160
  private onDialerEvent;
1265
- private onVoicebotEvent;
1266
- private onAllVoicebotsStatus;
1267
- private onVoicebotSubscribedToCall;
1268
- private onVoicebotSubscribeToCallFailed;
1269
- private onVoicebotInitialCallHistory;
1270
- private onVoicebotUnsubscribedFromCall;
1271
1161
  private onLoginStatusEvent;
1272
1162
  private onAllExtensionStatus;
1273
1163
  private onAllDialerStatus;
1274
- /**
1275
- * Handles keep-alive response - fixed to prevent multiple connections
1276
- */
1277
1164
  private onKeepAliveResponse;
1278
1165
  private onExtensionsUpdatedEvent;
1279
- /**
1280
- * Handles successful connection
1281
- */
1282
1166
  private onConnect;
1283
- /**
1284
- * Schedules reconnection with exponential backoff
1285
- */
1286
- private scheduleReconnect;
1287
- /**
1288
- * Handles disconnection
1289
- */
1290
1167
  private onDisconnect;
1291
- /**
1292
- * Handles connection errors
1293
- */
1294
1168
  private onConnectError;
1295
- /**
1296
- * Cleanup when shutting down
1297
- */
1298
- destroy(): Promise<void>;
1299
1169
  }
1300
1170
 
1301
1171
  export declare type SocketTyped = Socket_2<EventCallbackRegistry, ServerEmitEventCallbackRegistry>
1302
1172
 
1303
- export declare type SubscribedToVoicebotCall = {
1304
- /**
1305
- * subscribe success?
1306
- */
1307
- success: boolean;
1308
- /**
1309
- * voicebot id
1310
- */
1311
- voicebotID: number;
1312
- /**
1313
- * ivr id
1314
- */
1315
- IvrUniqueID: string;
1316
- };
1317
-
1318
- export declare type SubscribeToVoicebotCallFailed = {
1319
- /**
1320
- * error
1321
- */
1322
- error: string;
1323
- /**
1324
- * success
1325
- */
1326
- success: boolean;
1327
- };
1328
-
1329
- export declare interface SubscriptionVoicebotCallUpdatesPayload {
1330
- voicebotID: number,
1331
- IvrUniqueID: string
1332
- }
1333
-
1334
1173
  export declare type Summery = {
1335
1174
  /**
1336
1175
  * Representative
@@ -1344,9 +1183,6 @@ export declare type TestEventListener = (event: { test: string }) => void
1344
1183
 
1345
1184
  declare type TypedSocketIo = (...args: Parameters<typeof io>) => SocketTyped;
1346
1185
 
1347
- export declare type UnsubscribedFromVoicebotCall = {
1348
- };
1349
-
1350
1186
  export declare interface UpdateMonitoredExtensionsPayload {
1351
1187
  extensionsString: string
1352
1188
  }
@@ -1370,146 +1206,6 @@ export declare type User = {
1370
1206
 
1371
1207
  export declare type UserSDK = User
1372
1208
 
1373
- export declare type Voicebot = {
1374
- Calls: Array<VoicebotEventDataCall>;
1375
- /**
1376
- * Acc id
1377
- */
1378
- AccountID: string;
1379
- /**
1380
- * Voicebot id
1381
- */
1382
- VoicebotID: number;
1383
- /**
1384
- * Voicebot name
1385
- */
1386
- VoicebotName: string;
1387
- };
1388
-
1389
- export declare type VoicebotCall = {
1390
- };
1391
-
1392
- export declare type VoicebotCallHistory = {
1393
- };
1394
-
1395
- export declare type VoicebotEvent = {
1396
- data: VoicebotEventData;
1397
- type: VoicebotEventTypeEnum;
1398
- reason: VoicebotEventReasonEnum;
1399
- /**
1400
- * Event name (voicebot)
1401
- */
1402
- eventName: string;
1403
- /**
1404
- * servertime
1405
- */
1406
- servertime: number;
1407
- /**
1408
- * servertimeoffset
1409
- */
1410
- servertimeoffset: number;
1411
- /**
1412
- * telephonyservertime
1413
- */
1414
- telephonyservertime: number;
1415
- };
1416
-
1417
- export declare type VoicebotEventData = {
1418
- Call: VoicebotEventDataCall;
1419
- /**
1420
- * account id
1421
- */
1422
- AccountID: number;
1423
- /**
1424
- * voicebot id
1425
- */
1426
- VoicebotID: number;
1427
- /**
1428
- * ivr id
1429
- */
1430
- IvrUniqueID: string;
1431
- /**
1432
- * voicebot name
1433
- */
1434
- VoicebotName: string;
1435
- };
1436
-
1437
- export declare type VoicebotEventDataCall = {
1438
- /**
1439
- * did
1440
- */
1441
- did: string;
1442
- /**
1443
- * ivrid
1444
- */
1445
- ivrid: string;
1446
- /**
1447
- * CallerID
1448
- */
1449
- CallerID: string;
1450
- /**
1451
- * callType
1452
- */
1453
- callType: string;
1454
- /**
1455
- * aiSummary
1456
- */
1457
- aiSummary: string;
1458
- direction: VoicebotEventDataCallDirectionEnum;
1459
- callStatus: VoicebotEventDataCallStatusEnum;
1460
- /**
1461
- * callername
1462
- */
1463
- callername?: string;
1464
- customData: any;
1465
- eventsData: Array<VoicebotEventDataCallEventsData>;
1466
- /**
1467
- * IvrUniqueID
1468
- */
1469
- IvrUniqueID: string;
1470
- /**
1471
- * callStarted
1472
- */
1473
- callStarted: number;
1474
- };
1475
-
1476
- export declare enum VoicebotEventDataCallDirectionEnum {
1477
- INCOMING = 'INCOMING',
1478
- OUTGOING = 'OUTGOING',
1479
- }
1480
-
1481
- export declare type VoicebotEventDataCallEventsData = {
1482
- Role: VoicebotEventDataCallEventsDataRoleEnum;
1483
- Type: VoicebotEventDataCallEventsDataTypeEnum;
1484
- ToolName?: string;
1485
- Timestamp: number;
1486
- Transcript?: string;
1487
- };
1488
-
1489
- export declare type VoicebotEventDataCallEventsDataRoleEnum = {
1490
- };
1491
-
1492
- export declare enum VoicebotEventDataCallEventsDataTypeEnum {
1493
- CALLSTARTED = 'CallStarted',
1494
- TRANSCRIPT = 'Transcript',
1495
- TOOL_EXECUTED = 'ToolExecuted',
1496
- TOOL_RESPONSE = 'ToolResponse',
1497
- CALL_ENDED = 'CallEnded',
1498
- }
1499
-
1500
- export declare enum VoicebotEventDataCallStatusEnum {
1501
- TALKING = 'Talking',
1502
- ENDED = 'Ended',
1503
- }
1504
-
1505
- export declare enum VoicebotEventReasonEnum {
1506
- CALLSTARTED = 'CALLSTARTED',
1507
- }
1508
-
1509
- export declare enum VoicebotEventTypeEnum {
1510
- UNKNOWN = 'UNKNOWN',
1511
- }
1512
-
1513
1209
  /**
1514
1210
  * The structure of received socket events.
1515
1211
  */