@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.
@@ -87,6 +87,20 @@ declare interface Dialer {
87
87
  statistics: unknown
88
88
  }
89
89
 
90
+ /**
91
+ * Data structure for dialer event.
92
+ */
93
+ declare interface DialerEvent extends CommonEventProperties {
94
+ data: Dialer
95
+ eventName: EventNameEnum.DIALER
96
+ //reason: ExtensionEventReasonEnum // TODO: do research for dialer 'reason' prop
97
+ telephonyServerTime?: number
98
+ callerID?: string
99
+ ivrUniqueId?: string
100
+ dialStatus?: string
101
+ //cause?: ExtensionHangupCauseEnum // TODO: do research for dialer 'cause' prop
102
+ }
103
+
90
104
  declare enum DialerType {
91
105
  AUTOMATIC = "Automatic",
92
106
  IVR = "IVR"
@@ -104,6 +118,11 @@ declare enum DoNotCallMeStatusCodeEnum {
104
118
  RESPONSE_FROM_API_INVALID = "RESPONSE_FROM_API_INVALID"
105
119
  }
106
120
 
121
+ export declare enum Environment {
122
+ BROWSER = "browser",
123
+ CHROME_EXTENSION = "chrome-extension"
124
+ }
125
+
107
126
  /**
108
127
  * Defines a registry of callback functions for each event type.
109
128
  * Each key is an event type name, and the value is a function that takes the specific event data type as an argument.
@@ -117,15 +136,16 @@ declare type EventCallbackRegistry = {
117
136
  * Mapping of event names to their respective data structures.
118
137
  */
119
138
  declare interface EventDataMap {
120
- [EventsEnum.ALL_EXTENSION_STATUS]: AllExtensionStatusEvent
121
- [EventsEnum.ALL_DIALER_STATUS]: AllDialersStatusEvent
122
- [EventsEnum.ALL_USERS_STATUS]: AllUsersStatusEvent
123
- [EventsEnum.QUEUE_EVENT]: QueueEvent
124
- [EventsEnum.EXTENSION_EVENT]: ExtensionEvent
125
- [EventsEnum.LOGIN_SUCCESS]: LoginSuccessEvent
126
- [EventsEnum.LOGIN_STATUS]: LoginStatusEvent
127
- [EventsEnum.KEEP_ALIVE_RESPONSE]: KeepAliveResponseEvent
128
- [EventsEnum.ONLINE_STATUS_EVENT]: OnlineStatusEvent
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
129
149
  }
130
150
 
131
151
  /**
@@ -134,12 +154,32 @@ declare interface EventDataMap {
134
154
  declare enum EventNameEnum {
135
155
  EXTENSION = 'extension',
136
156
  QUEUE = 'queue',
157
+ DIALER = 'dialer',
158
+ }
159
+
160
+ /**
161
+ * All events that can be received from the server.
162
+ */
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"
137
177
  }
138
178
 
139
179
  /**
140
180
  * All events that can be received from the server.
141
181
  */
142
- declare enum EventsEnum {
182
+ declare enum EventsEnum_2 {
143
183
  ALL_DIALER_STATUS = 'AllDialersStatus',
144
184
  ALL_EXTENSION_STATUS = 'AllExtensionsStatus',
145
185
  ALL_USERS_STATUS = 'AllUsersStatus',
@@ -157,25 +197,8 @@ declare enum EventsEnum {
157
197
  // In case of wrong username or password or token, you will receive a 401 (“Unauthorized”) or 500 (“Unexpected token”) http error.
158
198
  LOGIN_SUCCESS = 'loginSuccess',
159
199
  QUEUE_EVENT = 'QueueEvent',
160
- ONLINE_STATUS_EVENT = 'onlineStatusEvent'
161
- }
162
-
163
- /**
164
- * All events that can be received from the server.
165
- */
166
- declare enum EventsEnum_2 {
167
- ALL_DIALER_STATUS = "AllDialersStatus",
168
- ALL_EXTENSION_STATUS = "AllExtensionsStatus",
169
- ALL_USERS_STATUS = "AllUsersStatus",
170
- CONNECT = "connect",
171
- DISCONNECT = "disconnect",
172
- EXTENSION_EVENT = "ExtensionEvent",
173
- KEEP_ALIVE = "keepalive",
174
- KEEP_ALIVE_RESPONSE = "keepaliveResponse",
175
- LOGIN_STATUS = "loginStatus",
176
- LOGIN_SUCCESS = "loginSuccess",
177
- QUEUE_EVENT = "QueueEvent",
178
- ONLINE_STATUS_EVENT = "onlineStatusEvent"
200
+ ONLINE_STATUS_EVENT = 'onlineStatusEvent',
201
+ DIALER_EVENT = 'DialerEvent',
179
202
  }
180
203
 
181
204
  /**
@@ -250,7 +273,7 @@ declare interface EventsSdkOptions {
250
273
  username: string;
251
274
  }
252
275
 
253
- declare type EventTypeData<T extends EventsEnum> = EventDataMap[T]
276
+ declare type EventTypeData<T extends EventsEnum_2> = EventDataMap[T]
254
277
 
255
278
  /**
256
279
  * Represents the set of all possible event type names as keys from the EventDataMap.
@@ -487,7 +510,7 @@ declare class SocketIoClass {
487
510
  private onDisconnect;
488
511
  }
489
512
 
490
- declare type SocketTyped = Socket<EventCallbackRegistry, Record<EventsEnum_2, any>>
513
+ declare type SocketTyped = Socket<EventCallbackRegistry, Record<EventsEnum, any>>
491
514
 
492
515
  declare interface Summery {
493
516
  representative: string
@@ -502,7 +525,7 @@ declare interface User {
502
525
 
503
526
  }
504
527
 
505
- declare type WrappedSocketEvent<T extends EventsEnum> = {
528
+ declare type WrappedSocketEvent<T extends EventsEnum_2> = {
506
529
  name: T
507
530
  data: EventDataMap[T]
508
531
  }