@voicenter-team/events-sdk 0.0.2 → 0.0.4
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/.eslintrc.cjs +2 -1
- package/dist/voicenter-events-sdk.cjs.js +10 -10
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.d.ts +42 -33
- package/dist/voicenter-events-sdk.es.js +437 -425
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +6 -6
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +6 -6
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/events-sdk/events-sdk.class.ts +12 -0
- package/src/classes/socket-io/socket-io.class.ts +10 -1
- package/src/index.ts +6 -0
|
@@ -118,6 +118,11 @@ declare enum DoNotCallMeStatusCodeEnum {
|
|
|
118
118
|
RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID"
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
export declare enum Environment {
|
|
122
|
+
BROWSER = "browser",
|
|
123
|
+
CHROME_EXTENSION = "chrome-extension"
|
|
124
|
+
}
|
|
125
|
+
|
|
121
126
|
/**
|
|
122
127
|
* Defines a registry of callback functions for each event type.
|
|
123
128
|
* Each key is an event type name, and the value is a function that takes the specific event data type as an argument.
|
|
@@ -131,16 +136,16 @@ declare type EventCallbackRegistry = {
|
|
|
131
136
|
* Mapping of event names to their respective data structures.
|
|
132
137
|
*/
|
|
133
138
|
declare interface EventDataMap {
|
|
134
|
-
[
|
|
135
|
-
[
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
139
|
+
[EventsEnum_2.ALL_EXTENSION_STATUS]: AllExtensionStatusEvent
|
|
140
|
+
[EventsEnum_2.ALL_DIALER_STATUS]: AllDialersStatusEvent
|
|
141
|
+
[EventsEnum_2.ALL_USERS_STATUS]: AllUsersStatusEvent
|
|
142
|
+
[EventsEnum_2.QUEUE_EVENT]: QueueEvent
|
|
143
|
+
[EventsEnum_2.EXTENSION_EVENT]: ExtensionEvent
|
|
144
|
+
[EventsEnum_2.DIALER_EVENT]: DialerEvent
|
|
145
|
+
[EventsEnum_2.LOGIN_SUCCESS]: LoginSuccessEvent
|
|
146
|
+
[EventsEnum_2.LOGIN_STATUS]: LoginStatusEvent
|
|
147
|
+
[EventsEnum_2.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
|
|
148
|
+
[EventsEnum_2.ONLINE_STATUS_EVENT]: OnlineStatusEvent
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
/**
|
|
@@ -155,7 +160,26 @@ declare enum EventNameEnum {
|
|
|
155
160
|
/**
|
|
156
161
|
* All events that can be received from the server.
|
|
157
162
|
*/
|
|
158
|
-
declare enum EventsEnum {
|
|
163
|
+
export declare enum EventsEnum {
|
|
164
|
+
ALL_DIALER_STATUS = "AllDialersStatus",
|
|
165
|
+
ALL_EXTENSION_STATUS = "AllExtensionsStatus",
|
|
166
|
+
ALL_USERS_STATUS = "AllUsersStatus",
|
|
167
|
+
CONNECT = "connect",
|
|
168
|
+
DISCONNECT = "disconnect",
|
|
169
|
+
EXTENSION_EVENT = "ExtensionEvent",
|
|
170
|
+
KEEP_ALIVE = "keepalive",
|
|
171
|
+
KEEP_ALIVE_RESPONSE = "keepaliveResponse",
|
|
172
|
+
LOGIN_STATUS = "loginStatus",
|
|
173
|
+
LOGIN_SUCCESS = "loginSuccess",
|
|
174
|
+
QUEUE_EVENT = "QueueEvent",
|
|
175
|
+
ONLINE_STATUS_EVENT = "onlineStatusEvent",
|
|
176
|
+
DIALER_EVENT = "DialerEvent"
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* All events that can be received from the server.
|
|
181
|
+
*/
|
|
182
|
+
declare enum EventsEnum_2 {
|
|
159
183
|
ALL_DIALER_STATUS = 'AllDialersStatus',
|
|
160
184
|
ALL_EXTENSION_STATUS = 'AllExtensionsStatus',
|
|
161
185
|
ALL_USERS_STATUS = 'AllUsersStatus',
|
|
@@ -177,25 +201,6 @@ declare enum EventsEnum {
|
|
|
177
201
|
DIALER_EVENT = 'DialerEvent',
|
|
178
202
|
}
|
|
179
203
|
|
|
180
|
-
/**
|
|
181
|
-
* All events that can be received from the server.
|
|
182
|
-
*/
|
|
183
|
-
declare enum EventsEnum_2 {
|
|
184
|
-
ALL_DIALER_STATUS = "AllDialersStatus",
|
|
185
|
-
ALL_EXTENSION_STATUS = "AllExtensionsStatus",
|
|
186
|
-
ALL_USERS_STATUS = "AllUsersStatus",
|
|
187
|
-
CONNECT = "connect",
|
|
188
|
-
DISCONNECT = "disconnect",
|
|
189
|
-
EXTENSION_EVENT = "ExtensionEvent",
|
|
190
|
-
KEEP_ALIVE = "keepalive",
|
|
191
|
-
KEEP_ALIVE_RESPONSE = "keepaliveResponse",
|
|
192
|
-
LOGIN_STATUS = "loginStatus",
|
|
193
|
-
LOGIN_SUCCESS = "loginSuccess",
|
|
194
|
-
QUEUE_EVENT = "QueueEvent",
|
|
195
|
-
ONLINE_STATUS_EVENT = "onlineStatusEvent",
|
|
196
|
-
DIALER_EVENT = "DialerEvent"
|
|
197
|
-
}
|
|
198
|
-
|
|
199
204
|
/**
|
|
200
205
|
* This is a generic type for callback functions used in event handling.
|
|
201
206
|
* It takes a generic event name and defines a callback function that receives wrapped socket event data for that specific event.
|
|
@@ -221,6 +226,8 @@ declare class EventsSdkClass {
|
|
|
221
226
|
off(event: '*', callback: (data: GenericEventWrapper) => void): void;
|
|
222
227
|
emit<T extends EventTypeNames>(event: T, data: EventTypeData<T>): void;
|
|
223
228
|
connect(server?: ServerParameter, skipLogin?: boolean): void;
|
|
229
|
+
disconnect(): void;
|
|
230
|
+
clearKeepAliveInterval(): void;
|
|
224
231
|
private findCurrentServer;
|
|
225
232
|
private findNextAvailableServer;
|
|
226
233
|
private findMaxPriorityServer;
|
|
@@ -268,7 +275,7 @@ declare interface EventsSdkOptions {
|
|
|
268
275
|
username: string;
|
|
269
276
|
}
|
|
270
277
|
|
|
271
|
-
declare type EventTypeData<T extends
|
|
278
|
+
declare type EventTypeData<T extends EventsEnum_2> = EventDataMap[T]
|
|
272
279
|
|
|
273
280
|
/**
|
|
274
281
|
* Represents the set of all possible event type names as keys from the EventDataMap.
|
|
@@ -492,12 +499,14 @@ declare class SocketIoClass {
|
|
|
492
499
|
io: SocketTyped | undefined;
|
|
493
500
|
ioFunction: TypedSocketIo | undefined;
|
|
494
501
|
lastEventTimestamp: number;
|
|
502
|
+
doReconnect: boolean;
|
|
495
503
|
private keepAliveInterval;
|
|
496
504
|
private keepReconnectInterval;
|
|
497
505
|
private connected;
|
|
498
506
|
getSocketIoFunction(Client: string): void;
|
|
499
507
|
initSocketConnection(): void;
|
|
500
508
|
initSocketEvents(): void;
|
|
509
|
+
clearKeepAliveInterval(): void;
|
|
501
510
|
initKeepAlive(): void;
|
|
502
511
|
closeAllConnections(): void;
|
|
503
512
|
private onKeepAliveResponse;
|
|
@@ -505,7 +514,7 @@ declare class SocketIoClass {
|
|
|
505
514
|
private onDisconnect;
|
|
506
515
|
}
|
|
507
516
|
|
|
508
|
-
declare type SocketTyped = Socket<EventCallbackRegistry, Record<
|
|
517
|
+
declare type SocketTyped = Socket<EventCallbackRegistry, Record<EventsEnum, any>>
|
|
509
518
|
|
|
510
519
|
declare interface Summery {
|
|
511
520
|
representative: string
|
|
@@ -520,7 +529,7 @@ declare interface User {
|
|
|
520
529
|
|
|
521
530
|
}
|
|
522
531
|
|
|
523
|
-
declare type WrappedSocketEvent<T extends
|
|
532
|
+
declare type WrappedSocketEvent<T extends EventsEnum_2> = {
|
|
524
533
|
name: T
|
|
525
534
|
data: EventDataMap[T]
|
|
526
535
|
}
|