@voicenter-team/events-sdk 0.0.1 → 0.0.3
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/.idea/inspectionProfiles/Project_Default.xml +5 -5
- package/dist/voicenter-events-sdk.cjs.js +15 -15
- package/dist/voicenter-events-sdk.cjs.js.map +1 -1
- package/dist/voicenter-events-sdk.d.ts +55 -32
- package/dist/voicenter-events-sdk.es.js +949 -946
- package/dist/voicenter-events-sdk.es.js.map +1 -1
- package/dist/voicenter-events-sdk.iife.js +15 -15
- package/dist/voicenter-events-sdk.iife.js.map +1 -1
- package/dist/voicenter-events-sdk.umd.js +15 -15
- package/dist/voicenter-events-sdk.umd.js.map +1 -1
- package/interface.ts +261 -0
- package/package.json +1 -1
- package/src/classes/events-sdk/events-sdk.class.ts +1 -0
- package/src/classes/socket-io/socket-io.class.ts +1 -0
- package/src/enum/events.enum.ts +3 -1
- package/src/index.ts +6 -0
- package/src/types/events.d.ts +15 -0
package/interface.ts
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
interface options {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* the authentication payload sent when connecting to the Namespace
|
|
5
|
+
*/
|
|
6
|
+
auth?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
} | ((cb: (data: object) => void) => void);
|
|
9
|
+
/**
|
|
10
|
+
* The maximum number of retries. Above the limit, the packet will be discarded.
|
|
11
|
+
*
|
|
12
|
+
* Using `Infinity` means the delivery guarantee is "at-least-once" (instead of "at-most-once" by default), but a
|
|
13
|
+
* smaller value like 10 should be sufficient in practice.
|
|
14
|
+
*/
|
|
15
|
+
retries?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The default timeout in milliseconds used when waiting for an acknowledgement.
|
|
18
|
+
*/
|
|
19
|
+
ackTimeout?: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The host that we're connecting to. Set from the URI passed when connecting
|
|
23
|
+
*/
|
|
24
|
+
host: string;
|
|
25
|
+
/**
|
|
26
|
+
* The hostname for our connection. Set from the URI passed when connecting
|
|
27
|
+
*/
|
|
28
|
+
hostname: string;
|
|
29
|
+
/**
|
|
30
|
+
* If this is a secure connection. Set from the URI passed when connecting
|
|
31
|
+
*/
|
|
32
|
+
secure: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The port for our connection. Set from the URI passed when connecting
|
|
35
|
+
*/
|
|
36
|
+
port: string | number;
|
|
37
|
+
/**
|
|
38
|
+
* Any query parameters in our uri. Set from the URI passed when connecting
|
|
39
|
+
*/
|
|
40
|
+
query: {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* `http.Agent` to use, defaults to `false` (NodeJS only)
|
|
45
|
+
*
|
|
46
|
+
* Note: the type should be "undefined | http.Agent | https.Agent | false", but this would break browser-only clients.
|
|
47
|
+
*
|
|
48
|
+
* @see https://nodejs.org/api/http.html#httprequestoptions-callback
|
|
49
|
+
*/
|
|
50
|
+
agent: string | boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the client should try to upgrade the transport from
|
|
53
|
+
* long-polling to something better.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
upgrade: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Forces base 64 encoding for polling transport even when XHR2
|
|
59
|
+
* responseType is available and WebSocket even if the used standard
|
|
60
|
+
* supports binary.
|
|
61
|
+
*/
|
|
62
|
+
forceBase64: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The param name to use as our timestamp key
|
|
65
|
+
* @default 't'
|
|
66
|
+
*/
|
|
67
|
+
timestampParam: string;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to add the timestamp with each transport request. Note: this
|
|
70
|
+
* is ignored if the browser is IE or Android, in which case requests
|
|
71
|
+
* are always stamped
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
timestampRequests: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* A list of transports to try (in order). Engine.io always attempts to
|
|
77
|
+
* connect directly with the first one, provided the feature detection test
|
|
78
|
+
* for it passes.
|
|
79
|
+
*
|
|
80
|
+
* @default ['polling','websocket', 'webtransport']
|
|
81
|
+
*/
|
|
82
|
+
transports: string[];
|
|
83
|
+
/**
|
|
84
|
+
* If true and if the previous websocket connection to the server succeeded,
|
|
85
|
+
* the connection attempt will bypass the normal upgrade process and will
|
|
86
|
+
* initially try websocket. A connection attempt following a transport error
|
|
87
|
+
* will use the normal upgrade process. It is recommended you turn this on
|
|
88
|
+
* only when using SSL/TLS connections, or if you know that your network does
|
|
89
|
+
* not block websockets.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
rememberUpgrade: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Are we only interested in transports that support binary?
|
|
95
|
+
*/
|
|
96
|
+
onlyBinaryUpgrades: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Timeout for xhr-polling requests in milliseconds (0) (only for polling transport)
|
|
99
|
+
*/
|
|
100
|
+
requestTimeout: number;
|
|
101
|
+
/**
|
|
102
|
+
* Transport options for Node.js client (headers etc)
|
|
103
|
+
*/
|
|
104
|
+
transportOptions: Object;
|
|
105
|
+
/**
|
|
106
|
+
* (SSL) Certificate, Private key and CA certificates to use for SSL.
|
|
107
|
+
* Can be used in Node.js client environment to manually specify
|
|
108
|
+
* certificate information.
|
|
109
|
+
*/
|
|
110
|
+
pfx: string;
|
|
111
|
+
/**
|
|
112
|
+
* (SSL) Private key to use for SSL. Can be used in Node.js client
|
|
113
|
+
* environment to manually specify certificate information.
|
|
114
|
+
*/
|
|
115
|
+
key: string;
|
|
116
|
+
/**
|
|
117
|
+
* (SSL) A string or passphrase for the private key or pfx. Can be
|
|
118
|
+
* used in Node.js client environment to manually specify certificate
|
|
119
|
+
* information.
|
|
120
|
+
*/
|
|
121
|
+
passphrase: string;
|
|
122
|
+
/**
|
|
123
|
+
* (SSL) Public x509 certificate to use. Can be used in Node.js client
|
|
124
|
+
* environment to manually specify certificate information.
|
|
125
|
+
*/
|
|
126
|
+
cert: string;
|
|
127
|
+
/**
|
|
128
|
+
* (SSL) An authority certificate or array of authority certificates to
|
|
129
|
+
* check the remote host against.. Can be used in Node.js client
|
|
130
|
+
* environment to manually specify certificate information.
|
|
131
|
+
*/
|
|
132
|
+
ca: string | string[];
|
|
133
|
+
/**
|
|
134
|
+
* (SSL) A string describing the ciphers to use or exclude. Consult the
|
|
135
|
+
* [cipher format list]
|
|
136
|
+
* (http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for
|
|
137
|
+
* details on the format.. Can be used in Node.js client environment to
|
|
138
|
+
* manually specify certificate information.
|
|
139
|
+
*/
|
|
140
|
+
ciphers: string;
|
|
141
|
+
/**
|
|
142
|
+
* (SSL) If true, the server certificate is verified against the list of
|
|
143
|
+
* supplied CAs. An 'error' event is emitted if verification fails.
|
|
144
|
+
* Verification happens at the connection level, before the HTTP request
|
|
145
|
+
* is sent. Can be used in Node.js client environment to manually specify
|
|
146
|
+
* certificate information.
|
|
147
|
+
*/
|
|
148
|
+
rejectUnauthorized: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Headers that will be passed for each request to the server (via xhr-polling and via websockets).
|
|
151
|
+
* These values then can be used during handshake or for special proxies.
|
|
152
|
+
*/
|
|
153
|
+
extraHeaders?: {
|
|
154
|
+
[header: string]: string;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Whether to include credentials (cookies, authorization headers, TLS
|
|
158
|
+
* client certificates, etc.) with cross-origin XHR polling requests
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
161
|
+
withCredentials: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Whether to automatically close the connection whenever the beforeunload event is received.
|
|
164
|
+
* @default false
|
|
165
|
+
*/
|
|
166
|
+
closeOnBeforeunload: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Whether to always use the native timeouts. This allows the client to
|
|
169
|
+
* reconnect when the native timeout functions are overridden, such as when
|
|
170
|
+
* mock clocks are installed.
|
|
171
|
+
* @default false
|
|
172
|
+
*/
|
|
173
|
+
useNativeTimers: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* weather we should unref the reconnect timer when it is
|
|
176
|
+
* create automatically
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
autoUnref: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable.
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
perMessageDeflate: {
|
|
185
|
+
threshold: number;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* The path to get our client file from, in the case of the server
|
|
189
|
+
* serving it
|
|
190
|
+
* @default '/engine.io'
|
|
191
|
+
*/
|
|
192
|
+
path: string;
|
|
193
|
+
/**
|
|
194
|
+
* Whether we should add a trailing slash to the request path.
|
|
195
|
+
* @default true
|
|
196
|
+
*/
|
|
197
|
+
addTrailingSlash: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols,
|
|
200
|
+
* so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to
|
|
201
|
+
* be able to handle different types of interactions depending on the specified protocol)
|
|
202
|
+
* @default []
|
|
203
|
+
*/
|
|
204
|
+
protocols: string | string[];
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Should we force a new Manager for this connection?
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
forceNew: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Should we multiplex our connection (reuse existing Manager) ?
|
|
213
|
+
* @default true
|
|
214
|
+
*/
|
|
215
|
+
multiplex: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* The path to get our client file from, in the case of the server
|
|
218
|
+
* serving it
|
|
219
|
+
* @default '/socket.io'
|
|
220
|
+
*/
|
|
221
|
+
path: string;
|
|
222
|
+
/**
|
|
223
|
+
* Should we allow reconnections?
|
|
224
|
+
* @default true
|
|
225
|
+
*/
|
|
226
|
+
reconnection: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* How many reconnection attempts should we try?
|
|
229
|
+
* @default Infinity
|
|
230
|
+
*/
|
|
231
|
+
reconnectionAttempts: number;
|
|
232
|
+
/**
|
|
233
|
+
* The time delay in milliseconds between reconnection attempts
|
|
234
|
+
* @default 1000
|
|
235
|
+
*/
|
|
236
|
+
reconnectionDelay: number;
|
|
237
|
+
/**
|
|
238
|
+
* The max time delay in milliseconds between reconnection attempts
|
|
239
|
+
* @default 5000
|
|
240
|
+
*/
|
|
241
|
+
reconnectionDelayMax: number;
|
|
242
|
+
/**
|
|
243
|
+
* Used in the exponential backoff jitter when reconnecting
|
|
244
|
+
* @default 0.5
|
|
245
|
+
*/
|
|
246
|
+
randomizationFactor: number;
|
|
247
|
+
/**
|
|
248
|
+
* The timeout in milliseconds for our connection attempt
|
|
249
|
+
* @default 20000
|
|
250
|
+
*/
|
|
251
|
+
timeout: number;
|
|
252
|
+
/**
|
|
253
|
+
* Should we automatically connect?
|
|
254
|
+
* @default true
|
|
255
|
+
*/
|
|
256
|
+
autoConnect: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* the parser to use. Defaults to an instance of the Parser that ships with socket.io.
|
|
259
|
+
*/
|
|
260
|
+
parser: any;
|
|
261
|
+
}
|
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@ class EventsSdkClass{
|
|
|
57
57
|
[EventsEnum.ALL_USERS_STATUS]: [],
|
|
58
58
|
[EventsEnum.QUEUE_EVENT]: [],
|
|
59
59
|
[EventsEnum.EXTENSION_EVENT]: [],
|
|
60
|
+
[EventsEnum.DIALER_EVENT]: [],
|
|
60
61
|
[EventsEnum.LOGIN_SUCCESS]: [],
|
|
61
62
|
[EventsEnum.LOGIN_STATUS]: [],
|
|
62
63
|
[EventsEnum.KEEP_ALIVE_RESPONSE]: [],
|
|
@@ -72,6 +72,7 @@ export class SocketIoClass{
|
|
|
72
72
|
.on(EventsEnum.LOGIN_SUCCESS, (data) => this.eventsSdkClass.emit(EventsEnum.LOGIN_SUCCESS, data))
|
|
73
73
|
.on(EventsEnum.QUEUE_EVENT, (data) => this.eventsSdkClass.emit(EventsEnum.QUEUE_EVENT, data))
|
|
74
74
|
.on(EventsEnum.EXTENSION_EVENT, (data) => this.eventsSdkClass.emit(EventsEnum.EXTENSION_EVENT, data))
|
|
75
|
+
.on(EventsEnum.DIALER_EVENT, (data) => this.eventsSdkClass.emit(EventsEnum.DIALER_EVENT, data))
|
|
75
76
|
.on(EventsEnum.LOGIN_STATUS, (data) => this.eventsSdkClass.emit(EventsEnum.LOGIN_STATUS, data))
|
|
76
77
|
.on(EventsEnum.ALL_EXTENSION_STATUS, (data) => this.eventsSdkClass.emit(EventsEnum.ALL_EXTENSION_STATUS, data))
|
|
77
78
|
.on(EventsEnum.ALL_DIALER_STATUS, (data) => this.eventsSdkClass.emit(EventsEnum.ALL_DIALER_STATUS, data))
|
package/src/enum/events.enum.ts
CHANGED
|
@@ -19,7 +19,8 @@ export enum EventsEnum {
|
|
|
19
19
|
// In case of wrong username or password or token, you will receive a 401 (“Unauthorized”) or 500 (“Unexpected token”) http error.
|
|
20
20
|
LOGIN_SUCCESS = 'loginSuccess',
|
|
21
21
|
QUEUE_EVENT = 'QueueEvent',
|
|
22
|
-
ONLINE_STATUS_EVENT = 'onlineStatusEvent'
|
|
22
|
+
ONLINE_STATUS_EVENT = 'onlineStatusEvent',
|
|
23
|
+
DIALER_EVENT = 'DialerEvent',
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -58,6 +59,7 @@ export enum DialerType {
|
|
|
58
59
|
export enum EventNameEnum {
|
|
59
60
|
EXTENSION = 'extension',
|
|
60
61
|
QUEUE = 'queue',
|
|
62
|
+
DIALER = 'dialer',
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export enum ExtensionHangupCauseEnum {
|
package/src/index.ts
CHANGED
package/src/types/events.d.ts
CHANGED
|
@@ -81,6 +81,20 @@ export interface ExtensionEvent extends CommonEventProperties {
|
|
|
81
81
|
cause?: ExtensionHangupCauseEnum
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Data structure for dialer event.
|
|
86
|
+
*/
|
|
87
|
+
export interface DialerEvent extends CommonEventProperties {
|
|
88
|
+
data: Dialer
|
|
89
|
+
eventName: EventNameEnum.DIALER
|
|
90
|
+
//reason: ExtensionEventReasonEnum // TODO: do research for dialer 'reason' prop
|
|
91
|
+
telephonyServerTime?: number
|
|
92
|
+
callerID?: string
|
|
93
|
+
ivrUniqueId?: string
|
|
94
|
+
dialStatus?: string
|
|
95
|
+
//cause?: ExtensionHangupCauseEnum // TODO: do research for dialer 'cause' prop
|
|
96
|
+
}
|
|
97
|
+
|
|
84
98
|
/**
|
|
85
99
|
* Data structure for keep alive response event.
|
|
86
100
|
*/
|
|
@@ -101,6 +115,7 @@ export interface EventDataMap {
|
|
|
101
115
|
[EventsEnum.ALL_USERS_STATUS]: AllUsersStatusEvent
|
|
102
116
|
[EventsEnum.QUEUE_EVENT]: QueueEvent
|
|
103
117
|
[EventsEnum.EXTENSION_EVENT]: ExtensionEvent
|
|
118
|
+
[EventsEnum.DIALER_EVENT]: DialerEvent
|
|
104
119
|
[EventsEnum.LOGIN_SUCCESS]: LoginSuccessEvent
|
|
105
120
|
[EventsEnum.LOGIN_STATUS]: LoginStatusEvent
|
|
106
121
|
[EventsEnum.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
|