@webex/contact-center 0.0.0-next.1

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.
Files changed (177) hide show
  1. package/README.md +81 -0
  2. package/__mocks__/workerMock.js +15 -0
  3. package/babel.config.js +15 -0
  4. package/dist/cc.js +1416 -0
  5. package/dist/cc.js.map +1 -0
  6. package/dist/config.js +72 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/constants.js +58 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/index.js +142 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/logger-proxy.js +115 -0
  13. package/dist/logger-proxy.js.map +1 -0
  14. package/dist/metrics/MetricsManager.js +474 -0
  15. package/dist/metrics/MetricsManager.js.map +1 -0
  16. package/dist/metrics/behavioral-events.js +322 -0
  17. package/dist/metrics/behavioral-events.js.map +1 -0
  18. package/dist/metrics/constants.js +134 -0
  19. package/dist/metrics/constants.js.map +1 -0
  20. package/dist/services/WebCallingService.js +323 -0
  21. package/dist/services/WebCallingService.js.map +1 -0
  22. package/dist/services/agent/index.js +177 -0
  23. package/dist/services/agent/index.js.map +1 -0
  24. package/dist/services/agent/types.js +137 -0
  25. package/dist/services/agent/types.js.map +1 -0
  26. package/dist/services/config/Util.js +203 -0
  27. package/dist/services/config/Util.js.map +1 -0
  28. package/dist/services/config/constants.js +221 -0
  29. package/dist/services/config/constants.js.map +1 -0
  30. package/dist/services/config/index.js +607 -0
  31. package/dist/services/config/index.js.map +1 -0
  32. package/dist/services/config/types.js +334 -0
  33. package/dist/services/config/types.js.map +1 -0
  34. package/dist/services/constants.js +117 -0
  35. package/dist/services/constants.js.map +1 -0
  36. package/dist/services/core/Err.js +43 -0
  37. package/dist/services/core/Err.js.map +1 -0
  38. package/dist/services/core/GlobalTypes.js +6 -0
  39. package/dist/services/core/GlobalTypes.js.map +1 -0
  40. package/dist/services/core/Utils.js +126 -0
  41. package/dist/services/core/Utils.js.map +1 -0
  42. package/dist/services/core/WebexRequest.js +96 -0
  43. package/dist/services/core/WebexRequest.js.map +1 -0
  44. package/dist/services/core/aqm-reqs.js +246 -0
  45. package/dist/services/core/aqm-reqs.js.map +1 -0
  46. package/dist/services/core/constants.js +109 -0
  47. package/dist/services/core/constants.js.map +1 -0
  48. package/dist/services/core/types.js +6 -0
  49. package/dist/services/core/types.js.map +1 -0
  50. package/dist/services/core/websocket/WebSocketManager.js +187 -0
  51. package/dist/services/core/websocket/WebSocketManager.js.map +1 -0
  52. package/dist/services/core/websocket/connection-service.js +111 -0
  53. package/dist/services/core/websocket/connection-service.js.map +1 -0
  54. package/dist/services/core/websocket/keepalive.worker.js +94 -0
  55. package/dist/services/core/websocket/keepalive.worker.js.map +1 -0
  56. package/dist/services/core/websocket/types.js +6 -0
  57. package/dist/services/core/websocket/types.js.map +1 -0
  58. package/dist/services/index.js +78 -0
  59. package/dist/services/index.js.map +1 -0
  60. package/dist/services/task/AutoWrapup.js +88 -0
  61. package/dist/services/task/AutoWrapup.js.map +1 -0
  62. package/dist/services/task/TaskManager.js +369 -0
  63. package/dist/services/task/TaskManager.js.map +1 -0
  64. package/dist/services/task/constants.js +58 -0
  65. package/dist/services/task/constants.js.map +1 -0
  66. package/dist/services/task/contact.js +464 -0
  67. package/dist/services/task/contact.js.map +1 -0
  68. package/dist/services/task/dialer.js +60 -0
  69. package/dist/services/task/dialer.js.map +1 -0
  70. package/dist/services/task/index.js +1188 -0
  71. package/dist/services/task/index.js.map +1 -0
  72. package/dist/services/task/types.js +214 -0
  73. package/dist/services/task/types.js.map +1 -0
  74. package/dist/types/cc.d.ts +676 -0
  75. package/dist/types/config.d.ts +66 -0
  76. package/dist/types/constants.d.ts +45 -0
  77. package/dist/types/index.d.ts +178 -0
  78. package/dist/types/logger-proxy.d.ts +71 -0
  79. package/dist/types/metrics/MetricsManager.d.ts +223 -0
  80. package/dist/types/metrics/behavioral-events.d.ts +29 -0
  81. package/dist/types/metrics/constants.d.ts +127 -0
  82. package/dist/types/services/WebCallingService.d.ts +1 -0
  83. package/dist/types/services/agent/index.d.ts +46 -0
  84. package/dist/types/services/agent/types.d.ts +413 -0
  85. package/dist/types/services/config/Util.d.ts +19 -0
  86. package/dist/types/services/config/constants.d.ts +203 -0
  87. package/dist/types/services/config/index.d.ts +171 -0
  88. package/dist/types/services/config/types.d.ts +1113 -0
  89. package/dist/types/services/constants.d.ts +97 -0
  90. package/dist/types/services/core/Err.d.ts +119 -0
  91. package/dist/types/services/core/GlobalTypes.d.ts +33 -0
  92. package/dist/types/services/core/Utils.d.ts +36 -0
  93. package/dist/types/services/core/WebexRequest.d.ts +22 -0
  94. package/dist/types/services/core/aqm-reqs.d.ts +16 -0
  95. package/dist/types/services/core/constants.d.ts +85 -0
  96. package/dist/types/services/core/types.d.ts +47 -0
  97. package/dist/types/services/core/websocket/WebSocketManager.d.ts +34 -0
  98. package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
  99. package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
  100. package/dist/types/services/core/websocket/types.d.ts +37 -0
  101. package/dist/types/services/index.d.ts +52 -0
  102. package/dist/types/services/task/AutoWrapup.d.ts +40 -0
  103. package/dist/types/services/task/TaskManager.d.ts +1 -0
  104. package/dist/types/services/task/constants.d.ts +46 -0
  105. package/dist/types/services/task/contact.d.ts +59 -0
  106. package/dist/types/services/task/dialer.d.ts +28 -0
  107. package/dist/types/services/task/index.d.ts +569 -0
  108. package/dist/types/services/task/types.d.ts +1041 -0
  109. package/dist/types/types.d.ts +452 -0
  110. package/dist/types/webex-config.d.ts +53 -0
  111. package/dist/types/webex.d.ts +7 -0
  112. package/dist/types.js +292 -0
  113. package/dist/types.js.map +1 -0
  114. package/dist/webex-config.js +60 -0
  115. package/dist/webex-config.js.map +1 -0
  116. package/dist/webex.js +99 -0
  117. package/dist/webex.js.map +1 -0
  118. package/jest.config.js +45 -0
  119. package/package.json +83 -0
  120. package/src/cc.ts +1618 -0
  121. package/src/config.ts +65 -0
  122. package/src/constants.ts +51 -0
  123. package/src/index.ts +220 -0
  124. package/src/logger-proxy.ts +110 -0
  125. package/src/metrics/MetricsManager.ts +512 -0
  126. package/src/metrics/behavioral-events.ts +332 -0
  127. package/src/metrics/constants.ts +135 -0
  128. package/src/services/WebCallingService.ts +351 -0
  129. package/src/services/agent/index.ts +149 -0
  130. package/src/services/agent/types.ts +440 -0
  131. package/src/services/config/Util.ts +261 -0
  132. package/src/services/config/constants.ts +249 -0
  133. package/src/services/config/index.ts +743 -0
  134. package/src/services/config/types.ts +1117 -0
  135. package/src/services/constants.ts +111 -0
  136. package/src/services/core/Err.ts +126 -0
  137. package/src/services/core/GlobalTypes.ts +34 -0
  138. package/src/services/core/Utils.ts +132 -0
  139. package/src/services/core/WebexRequest.ts +103 -0
  140. package/src/services/core/aqm-reqs.ts +272 -0
  141. package/src/services/core/constants.ts +106 -0
  142. package/src/services/core/types.ts +48 -0
  143. package/src/services/core/websocket/WebSocketManager.ts +196 -0
  144. package/src/services/core/websocket/connection-service.ts +142 -0
  145. package/src/services/core/websocket/keepalive.worker.js +88 -0
  146. package/src/services/core/websocket/types.ts +40 -0
  147. package/src/services/index.ts +71 -0
  148. package/src/services/task/AutoWrapup.ts +86 -0
  149. package/src/services/task/TaskManager.ts +420 -0
  150. package/src/services/task/constants.ts +52 -0
  151. package/src/services/task/contact.ts +429 -0
  152. package/src/services/task/dialer.ts +52 -0
  153. package/src/services/task/index.ts +1375 -0
  154. package/src/services/task/types.ts +1113 -0
  155. package/src/types.ts +639 -0
  156. package/src/webex-config.ts +54 -0
  157. package/src/webex.js +96 -0
  158. package/test/unit/spec/cc.ts +1985 -0
  159. package/test/unit/spec/metrics/MetricsManager.ts +491 -0
  160. package/test/unit/spec/metrics/behavioral-events.ts +102 -0
  161. package/test/unit/spec/services/WebCallingService.ts +416 -0
  162. package/test/unit/spec/services/agent/index.ts +65 -0
  163. package/test/unit/spec/services/config/index.ts +1035 -0
  164. package/test/unit/spec/services/core/Utils.ts +279 -0
  165. package/test/unit/spec/services/core/WebexRequest.ts +144 -0
  166. package/test/unit/spec/services/core/aqm-reqs.ts +570 -0
  167. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +378 -0
  168. package/test/unit/spec/services/core/websocket/connection-service.ts +178 -0
  169. package/test/unit/spec/services/task/TaskManager.ts +1351 -0
  170. package/test/unit/spec/services/task/contact.ts +204 -0
  171. package/test/unit/spec/services/task/dialer.ts +157 -0
  172. package/test/unit/spec/services/task/index.ts +1474 -0
  173. package/tsconfig.json +6 -0
  174. package/typedoc.json +37 -0
  175. package/typedoc.md +240 -0
  176. package/umd/contact-center.min.js +3 -0
  177. package/umd/contact-center.min.js.map +1 -0
package/src/types.ts ADDED
@@ -0,0 +1,639 @@
1
+ import {CallingClientConfig} from '@webex/calling';
2
+ import {
3
+ SubmitBehavioralEvent,
4
+ SubmitOperationalEvent,
5
+ SubmitBusinessEvent,
6
+ } from '@webex/internal-plugin-metrics/src/metrics.types';
7
+ import * as Agent from './services/agent/types';
8
+ import * as Contact from './services/task/types';
9
+ import {Profile} from './services/config/types';
10
+
11
+ /**
12
+ * Generic type for converting a const enum object into a union type of its values.
13
+ * @template T The enum object type
14
+ * @internal
15
+ * @ignore
16
+ */
17
+ type Enum<T extends Record<string, unknown>> = T[keyof T];
18
+
19
+ /**
20
+ * HTTP methods supported by WebexRequest.
21
+ * @enum {string}
22
+ * @public
23
+ * @example
24
+ * const method: HTTP_METHODS = HTTP_METHODS.GET;
25
+ * @ignore
26
+ */
27
+ export const HTTP_METHODS = {
28
+ /** HTTP GET method for retrieving data */
29
+ GET: 'GET',
30
+ /** HTTP POST method for creating resources */
31
+ POST: 'POST',
32
+ /** HTTP PATCH method for partial updates */
33
+ PATCH: 'PATCH',
34
+ /** HTTP PUT method for complete updates */
35
+ PUT: 'PUT',
36
+ /** HTTP DELETE method for removing resources */
37
+ DELETE: 'DELETE',
38
+ } as const;
39
+
40
+ /**
41
+ * Union type of HTTP methods.
42
+ * @public
43
+ * @example
44
+ * function makeRequest(method: HTTP_METHODS) { ... }
45
+ * @ignore
46
+ */
47
+ export type HTTP_METHODS = Enum<typeof HTTP_METHODS>;
48
+
49
+ /**
50
+ * Payload for making requests to Webex APIs.
51
+ * @public
52
+ * @example
53
+ * const payload: WebexRequestPayload = {
54
+ * service: 'identity',
55
+ * resource: '/users',
56
+ * method: HTTP_METHODS.GET
57
+ * };
58
+ * @ignore
59
+ */
60
+ export type WebexRequestPayload = {
61
+ /** Service name to target */
62
+ service?: string;
63
+ /** Resource path within the service */
64
+ resource?: string;
65
+ /** HTTP method to use */
66
+ method?: HTTP_METHODS;
67
+ /** Full URI if not using service/resource pattern */
68
+ uri?: string;
69
+ /** Whether to add authorization header */
70
+ addAuthHeader?: boolean;
71
+ /** Custom headers to include in request */
72
+ headers?: {
73
+ [key: string]: string | null;
74
+ };
75
+ /** Request body data */
76
+ body?: object;
77
+ /** Expected response status code */
78
+ statusCode?: number;
79
+ /** Whether to parse response as JSON */
80
+ json?: boolean;
81
+ };
82
+
83
+ /**
84
+ * Event listener function type.
85
+ * @internal
86
+ * @ignore
87
+ */
88
+ type Listener = (e: string, data?: unknown) => void;
89
+
90
+ /**
91
+ * Event listener removal function type.
92
+ * @internal
93
+ * @ignore
94
+ */
95
+ type ListenerOff = (e: string) => void;
96
+
97
+ /**
98
+ * Service host configuration.
99
+ * @internal
100
+ * @ignore
101
+ */
102
+ type ServiceHost = {
103
+ /** Host URL/domain for the service */
104
+ host: string;
105
+ /** Time-to-live in seconds */
106
+ ttl: number;
107
+ /** Priority level for load balancing (lower is higher priority) */
108
+ priority: number;
109
+ /** Unique identifier for this host */
110
+ id: string;
111
+ /** Whether this is the home cluster for the user */
112
+ homeCluster?: boolean;
113
+ };
114
+
115
+ /**
116
+ * Configuration options for the Contact Center Plugin.
117
+ * @interface CCPluginConfig
118
+ * @public
119
+ * @example
120
+ * const config: CCPluginConfig = {
121
+ * allowMultiLogin: true,
122
+ * allowAutomatedRelogin: false,
123
+ * clientType: 'browser',
124
+ * isKeepAliveEnabled: true,
125
+ * force: false,
126
+ * metrics: { clientName: 'myClient', clientType: 'browser' },
127
+ * logging: { enable: true, verboseEvents: false },
128
+ * callingClientConfig: { ... }
129
+ * };
130
+ */
131
+ export interface CCPluginConfig {
132
+ /** Whether to allow multiple logins from different devices */
133
+ allowMultiLogin: boolean;
134
+ /** Whether to automatically attempt relogin on connection loss */
135
+ allowAutomatedRelogin: boolean;
136
+ /** The type of client making the connection */
137
+ clientType: string;
138
+ /** Whether to enable keep-alive messages */
139
+ isKeepAliveEnabled: boolean;
140
+ /** Whether to force registration */
141
+ force: boolean;
142
+ /** Metrics configuration */
143
+ metrics: {
144
+ /** Name of the client for metrics */
145
+ clientName: string;
146
+ /** Type of client for metrics */
147
+ clientType: string;
148
+ };
149
+ /** Logging configuration */
150
+ logging: {
151
+ /** Whether to enable logging */
152
+ enable: boolean;
153
+ /** Whether to log verbose events */
154
+ verboseEvents: boolean;
155
+ };
156
+ /** Configuration for the calling client */
157
+ callingClientConfig: CallingClientConfig;
158
+ }
159
+
160
+ /**
161
+ * Logger interface for standardized logging throughout the plugin.
162
+ * @public
163
+ * @example
164
+ * logger.log('This is a log message');
165
+ * logger.error('This is an error message');
166
+ * @ignore
167
+ */
168
+ export type Logger = {
169
+ /** Log general messages */
170
+ log: (payload: string) => void;
171
+ /** Log error messages */
172
+ error: (payload: string) => void;
173
+ /** Log warning messages */
174
+ warn: (payload: string) => void;
175
+ /** Log informational messages */
176
+ info: (payload: string) => void;
177
+ /** Log detailed trace messages */
178
+ trace: (payload: string) => void;
179
+ /** Log debug messages */
180
+ debug: (payload: string) => void;
181
+ };
182
+
183
+ /**
184
+ * Contextual information for log entries.
185
+ * @public
186
+ * @ignore
187
+ */
188
+ export interface LogContext {
189
+ /** Module name where the log originated */
190
+ module?: string;
191
+ /** Method name where the log originated */
192
+ method?: string;
193
+ interactionId?: string;
194
+ trackingId?: string;
195
+ }
196
+
197
+ /**
198
+ * Available logging severity levels.
199
+ * @enum {string}
200
+ * @public
201
+ * @example
202
+ * const level: LOGGING_LEVEL = LOGGING_LEVEL.error;
203
+ * @ignore
204
+ */
205
+ export enum LOGGING_LEVEL {
206
+ /** Critical failures that require immediate attention */
207
+ error = 'ERROR',
208
+ /** Important issues that don't prevent the system from working */
209
+ warn = 'WARN',
210
+ /** General informational logs */
211
+ log = 'LOG',
212
+ /** Detailed information about system operation */
213
+ info = 'INFO',
214
+ /** Highly detailed diagnostic information */
215
+ trace = 'TRACE',
216
+ }
217
+
218
+ /**
219
+ * Metadata for log uploads.
220
+ * @public
221
+ * @example
222
+ * const meta: LogsMetaData = { feedbackId: 'fb123', correlationId: 'corr456' };
223
+ * @ignore
224
+ */
225
+ export type LogsMetaData = {
226
+ /** Optional feedback ID to associate with logs */
227
+ feedbackId?: string;
228
+ /** Optional correlation ID to track related operations */
229
+ correlationId?: string;
230
+ };
231
+
232
+ /**
233
+ * Response from uploading logs to the server.
234
+ * @public
235
+ * @example
236
+ * const response: UploadLogsResponse = { trackingid: 'track123', url: 'https://...', userId: 'user1' };
237
+ */
238
+ export type UploadLogsResponse = {
239
+ /** Tracking ID for the upload request */
240
+ trackingid?: string;
241
+ /** URL where the logs can be accessed */
242
+ url?: string;
243
+ /** ID of the user who uploaded logs */
244
+ userId?: string;
245
+ /** Feedback ID associated with the logs */
246
+ feedbackId?: string;
247
+ /** Correlation ID for tracking related operations */
248
+ correlationId?: string;
249
+ };
250
+
251
+ /**
252
+ * Internal Webex SDK interfaces needed for plugin integration.
253
+ * @internal
254
+ * @ignore
255
+ */
256
+ interface IWebexInternal {
257
+ /** Mercury service for real-time messaging */
258
+ mercury: {
259
+ /** Register an event listener */
260
+ on: Listener;
261
+ /** Remove an event listener */
262
+ off: ListenerOff;
263
+ /** Establish a connection to the Mercury service */
264
+ connect: () => Promise<void>;
265
+ /** Disconnect from the Mercury service */
266
+ disconnect: () => Promise<void>;
267
+ /** Whether Mercury is currently connected */
268
+ connected: boolean;
269
+ /** Whether Mercury is in the process of connecting */
270
+ connecting: boolean;
271
+ };
272
+ /** Device information */
273
+ device: {
274
+ /** Current WDM URL */
275
+ url: string;
276
+ /** Current user's ID */
277
+ userId: string;
278
+ /** Current organization ID */
279
+ orgId: string;
280
+ /** Device version */
281
+ version: string;
282
+ /** Calling behavior configuration */
283
+ callingBehavior: string;
284
+ };
285
+ /** Presence service */
286
+ presence: unknown;
287
+ /** Services discovery and management */
288
+ services: {
289
+ /** Get a service URL by name */
290
+ get: (service: string) => string;
291
+ /** Wait for service catalog to be loaded */
292
+ waitForCatalog: (service: string) => Promise<void>;
293
+ /** Host catalog for service discovery */
294
+ _hostCatalog: Record<string, ServiceHost[]>;
295
+ /** Service URLs cache */
296
+ _serviceUrls: {
297
+ /** Mobius calling service */
298
+ mobius: string;
299
+ /** Identity service */
300
+ identity: string;
301
+ /** Janus media server */
302
+ janus: string;
303
+ /** WDM (WebEx Device Management) service */
304
+ wdm: string;
305
+ /** BroadWorks IDP proxy service */
306
+ broadworksIdpProxy: string;
307
+ /** Hydra API service */
308
+ hydra: string;
309
+ /** Mercury API service */
310
+ mercuryApi: string;
311
+ /** UC Management gateway service */
312
+ 'ucmgmt-gateway': string;
313
+ /** Contacts service */
314
+ contactsService: string;
315
+ };
316
+ };
317
+ /** Metrics collection services */
318
+ newMetrics: {
319
+ /** Submit behavioral events (user actions) */
320
+ submitBehavioralEvent: SubmitBehavioralEvent;
321
+ /** Submit operational events (system operations) */
322
+ submitOperationalEvent: SubmitOperationalEvent;
323
+ /** Submit business events (business outcomes) */
324
+ submitBusinessEvent: SubmitBusinessEvent;
325
+ };
326
+ /** Support functionality */
327
+ support: {
328
+ /** Submit logs to server */
329
+ submitLogs: (
330
+ metaData: LogsMetaData,
331
+ logs: string,
332
+ options: {
333
+ /** Whether to submit full logs or just differences */
334
+ type: 'diff' | 'full';
335
+ }
336
+ ) => Promise<UploadLogsResponse>;
337
+ };
338
+ }
339
+
340
+ /**
341
+ * Interface representing the WebexSDK core functionality.
342
+ * @interface WebexSDK
343
+ * @public
344
+ * @example
345
+ * const sdk: WebexSDK = ...;
346
+ * sdk.request({ service: 'identity', resource: '/users', method: HTTP_METHODS.GET });
347
+ * @ignore
348
+ */
349
+ export interface WebexSDK {
350
+ /** Version of the WebexSDK */
351
+ version: string;
352
+ /** Whether the SDK can authorize requests */
353
+ canAuthorize: boolean;
354
+ /** Credentials management */
355
+ credentials: {
356
+ /** Get the user token for authentication */
357
+ getUserToken: () => Promise<string>;
358
+ /** Get the organization ID */
359
+ getOrgId: () => string;
360
+ };
361
+ /** Whether the SDK is ready for use */
362
+ ready: boolean;
363
+ /** Make a request to the Webex APIs */
364
+ request: <T>(payload: WebexRequestPayload) => Promise<T>;
365
+ /** Register a one-time event handler */
366
+ once: (event: string, callBack: () => void) => void;
367
+ /** Internal plugins and services */
368
+ internal: IWebexInternal;
369
+ /** Logger instance */
370
+ logger: Logger;
371
+ }
372
+
373
+ /**
374
+ * An interface for the `ContactCenter` class.
375
+ * The `ContactCenter` package is designed to provide a set of APIs to perform various operations for the Agent flow within Webex Contact Center.
376
+ * @public
377
+ * @example
378
+ * const cc: IContactCenter = ...;
379
+ * cc.register().then(profile => { ... });
380
+ * @ignore
381
+ */
382
+ export interface IContactCenter {
383
+ /**
384
+ * Initialize the CC SDK by setting up the contact center mercury connection.
385
+ * This establishes WebSocket connectivity for real-time communication.
386
+ *
387
+ * @returns A Promise that resolves to the agent's profile upon successful registration
388
+ * @public
389
+ * @example
390
+ * cc.register().then(profile => { ... });
391
+ */
392
+ register(): Promise<Profile>;
393
+ }
394
+
395
+ /**
396
+ * Generic HTTP response structure.
397
+ * @public
398
+ * @example
399
+ * const response: IHttpResponse = { body: {}, statusCode: 200, method: 'GET', headers: {}, url: '...' };
400
+ * @ignore
401
+ */
402
+ export interface IHttpResponse {
403
+ /** Response body content */
404
+ body: any;
405
+ /** HTTP status code */
406
+ statusCode: number;
407
+ /** HTTP method used for the request */
408
+ method: string;
409
+ /** Response headers */
410
+ headers: Headers;
411
+ /** Request URL */
412
+ url: string;
413
+ }
414
+
415
+ /**
416
+ * Supported login options for agent authentication.
417
+ * @public
418
+ * @example
419
+ * const option: LoginOption = LoginOption.AGENT_DN;
420
+ * @ignore
421
+ */
422
+ export const LoginOption = {
423
+ /** Login using agent's direct number */
424
+ AGENT_DN: 'AGENT_DN',
425
+ /** Login using an extension number */
426
+ EXTENSION: 'EXTENSION',
427
+ /** Login using browser WebRTC capabilities */
428
+ BROWSER: 'BROWSER',
429
+ } as const;
430
+
431
+ /**
432
+ * Union type of login options.
433
+ * @public
434
+ * @example
435
+ * function login(option: LoginOption) { ... }
436
+ * @ignore
437
+ */
438
+ export type LoginOption = Enum<typeof LoginOption>;
439
+
440
+ /**
441
+ * Request payload for subscribing to the contact center websocket.
442
+ * @public
443
+ * @example
444
+ * const req: SubscribeRequest = { force: true, isKeepAliveEnabled: true, clientType: 'browser', allowMultiLogin: false };
445
+ * @ignore
446
+ */
447
+ export type SubscribeRequest = {
448
+ /** Whether to force connection even if another exists */
449
+ force: boolean;
450
+ /** Whether to send keepalive messages */
451
+ isKeepAliveEnabled: boolean;
452
+ /** Type of client connecting */
453
+ clientType: string;
454
+ /** Whether to allow login from multiple devices */
455
+ allowMultiLogin: boolean;
456
+ };
457
+
458
+ /**
459
+ * Represents the response from getListOfTeams method.
460
+ * Teams are groups of agents that can be managed together.
461
+ * @public
462
+ * @example
463
+ * const team: Team = { id: 'team1', name: 'Support', desktopLayoutId: 'layout1' };
464
+ * @ignore
465
+ */
466
+ export type Team = {
467
+ /**
468
+ * Unique identifier of the team.
469
+ */
470
+ id: string;
471
+
472
+ /**
473
+ * Display name of the team.
474
+ */
475
+ name: string;
476
+
477
+ /**
478
+ * Associated desktop layout ID for the team.
479
+ * Controls how the agent desktop is displayed for team members.
480
+ */
481
+ desktopLayoutId?: string;
482
+ };
483
+
484
+ /**
485
+ * Represents the request to perform agent login.
486
+ * @public
487
+ * @example
488
+ * const login: AgentLogin = { dialNumber: '1234', teamId: 'team1', loginOption: LoginOption.AGENT_DN };
489
+ */
490
+ export type AgentLogin = {
491
+ /**
492
+ * A dialNumber field contains the number to dial such as a route point or extension.
493
+ * Required for AGENT_DN and EXTENSION login options.
494
+ */
495
+ dialNumber?: string;
496
+
497
+ /**
498
+ * The unique ID representing a team of users.
499
+ * The agent must belong to this team.
500
+ */
501
+ teamId: string;
502
+
503
+ /**
504
+ * The loginOption field specifies the type of login method.
505
+ * Controls how calls are delivered to the agent.
506
+ */
507
+ loginOption: LoginOption;
508
+ };
509
+
510
+ /**
511
+ * Represents the request to update agent profile settings.
512
+ * @public
513
+ * @example
514
+ * const update: AgentProfileUpdate = { loginOption: LoginOption.BROWSER, dialNumber: '5678' };
515
+ */
516
+ export type AgentProfileUpdate = Pick<AgentLogin, 'loginOption' | 'dialNumber' | 'teamId'>;
517
+
518
+ /**
519
+ * Union type for all possible request body types.
520
+ * @internal
521
+ * @ignore
522
+ */
523
+ export type RequestBody =
524
+ | SubscribeRequest
525
+ | Agent.Logout
526
+ | Agent.UserStationLogin
527
+ | Agent.StateChange
528
+ | Agent.BuddyAgents
529
+ | Contact.HoldResumePayload
530
+ | Contact.ResumeRecordingPayload
531
+ | Contact.ConsultPayload
532
+ | Contact.ConsultEndAPIPayload // API Payload accepts only QueueId wheres SDK API allows more params
533
+ | Contact.TransferPayLoad
534
+ | Contact.ConsultTransferPayLoad
535
+ | Contact.cancelCtq
536
+ | Contact.WrapupPayLoad
537
+ | Contact.DialerPayload;
538
+
539
+ /**
540
+ * Represents the options to fetch buddy agents for the logged in agent.
541
+ * Buddy agents are other agents who can be consulted or transfered to.
542
+ * @public
543
+ * @example
544
+ * const opts: BuddyAgents = { mediaType: 'telephony', state: 'Available' };
545
+ * @ignore
546
+ */
547
+ export type BuddyAgents = {
548
+ /**
549
+ * The media type channel to filter buddy agents.
550
+ * Determines which channel capability the returned agents must have.
551
+ */
552
+ mediaType: 'telephony' | 'chat' | 'social' | 'email';
553
+
554
+ /**
555
+ * Optional filter for agent state.
556
+ * If specified, returns only agents in that state.
557
+ * If omitted, returns both available and idle agents.
558
+ */
559
+ state?: 'Available' | 'Idle';
560
+ };
561
+
562
+ /**
563
+ * Generic error structure for Contact Center SDK errors.
564
+ * Contains detailed information about the error context.
565
+ * @public
566
+ * @example
567
+ * const err: GenericError = new Error('Failed');
568
+ * err.details = { type: 'ERR', orgId: 'org1', trackingId: 'track1', data: {} };
569
+ * @ignore
570
+ */
571
+ export interface GenericError extends Error {
572
+ /** Structured details about the error */
573
+ details: {
574
+ /** Error type identifier */
575
+ type: string;
576
+ /** Organization ID where the error occurred */
577
+ orgId: string;
578
+ /** Unique tracking ID for the error */
579
+ trackingId: string;
580
+ /** Additional error context data */
581
+ data: Record<string, any>;
582
+ };
583
+ }
584
+
585
+ /**
586
+ * Response type for station login operations.
587
+ * Either a success response with agent details or an error.
588
+ * @public
589
+ * @example
590
+ * function handleLogin(resp: StationLoginResponse) { ... }
591
+ */
592
+ export type StationLoginResponse = Agent.StationLoginSuccessResponse | Error;
593
+
594
+ /**
595
+ * Response type for station logout operations.
596
+ * Either a success response with logout details or an error.
597
+ * @public
598
+ * @example
599
+ * function handleLogout(resp: StationLogoutResponse) { ... }
600
+ */
601
+ export type StationLogoutResponse = Agent.LogoutSuccess | Error;
602
+
603
+ /**
604
+ * Response type for station relogin operations.
605
+ * Either a success response with relogin details or an error.
606
+ * @public
607
+ * @example
608
+ * function handleReLogin(resp: StationReLoginResponse) { ... }
609
+ * @ignore
610
+ */
611
+ export type StationReLoginResponse = Agent.ReloginSuccess | Error;
612
+
613
+ /**
614
+ * Response type for agent state change operations.
615
+ * Either a success response with state change details or an error.
616
+ * @public
617
+ * @example
618
+ * function handleStateChange(resp: SetStateResponse) { ... }
619
+ * @ignore
620
+ */
621
+ export type SetStateResponse = Agent.StateChangeSuccess | Error;
622
+
623
+ /**
624
+ * Response type for buddy agents query operations.
625
+ * Either a success response with list of buddy agents or an error.
626
+ * @public
627
+ * @example
628
+ * function handleBuddyAgents(resp: BuddyAgentsResponse) { ... }
629
+ */
630
+ export type BuddyAgentsResponse = Agent.BuddyAgentsSuccess | Error;
631
+
632
+ /**
633
+ * Response type for device type update operations.
634
+ * Either a success response with update confirmation or an error.
635
+ * @public
636
+ * @example
637
+ * function handleUpdateDeviceType(resp: UpdateDeviceTypeResponse) { ... }
638
+ */
639
+ export type UpdateDeviceTypeResponse = Agent.DeviceTypeUpdateSuccess | Error;
@@ -0,0 +1,54 @@
1
+ import {MemoryStoreAdapter} from '@webex/webex-core';
2
+
3
+ /**
4
+ * Default Webex SDK configuration for Contact Center integration.
5
+ *
6
+ * @public
7
+ * @example
8
+ * import webexConfig from './webex-config';
9
+ * const hydraUrl = webexConfig.hydra;
10
+ */
11
+ export default {
12
+ /**
13
+ * URL for the Hydra API service.
14
+ * @type {string}
15
+ * @public
16
+ * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'
17
+ */
18
+ hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
19
+ /**
20
+ * Alias for the Hydra API service URL.
21
+ * @type {string}
22
+ * @public
23
+ * @default process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1'
24
+ */
25
+ hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
26
+ /**
27
+ * Credentials configuration (empty by default).
28
+ * @type {object}
29
+ * @public
30
+ */
31
+ credentials: {},
32
+ /**
33
+ * Device configuration options.
34
+ * @type {object}
35
+ * @public
36
+ * @property {boolean} validateDomains - Whether to validate device domains.
37
+ * @property {boolean} ephemeral - Whether the device is ephemeral.
38
+ */
39
+ device: {
40
+ validateDomains: true,
41
+ ephemeral: true,
42
+ },
43
+ /**
44
+ * Storage configuration for the SDK.
45
+ * @type {object}
46
+ * @public
47
+ * @property {typeof MemoryStoreAdapter} boundedAdapter - Adapter for bounded storage.
48
+ * @property {typeof MemoryStoreAdapter} unboundedAdapter - Adapter for unbounded storage.
49
+ */
50
+ storage: {
51
+ boundedAdapter: MemoryStoreAdapter,
52
+ unboundedAdapter: MemoryStoreAdapter,
53
+ },
54
+ };