@wxcc-desktop/sdk 2.0.2 → 2.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/README.md CHANGED
@@ -1,595 +1,595 @@
1
- # WxCC Agent Desktop JS-API
2
-
3
- WxCC Agent Desktop JS API modules set
4
-
5
- ## Root module (`Desktop`) includes:
6
-
7
- - Config module
8
- - I18N module
9
- - Actions module
10
- - Logger service module
11
- - ShortcutKey service module
12
- - Webex Metrics module
13
- - AQM/Notifs **agent-contact** service layer API module for WxCC Agent Desktop.
14
- - AQM/Notifs **agent-state** service layer API module for WxCC Agent Desktop.
15
- - AQM/Notifs **dialer** service layer API module for WxCC Agent Desktop.
16
- - AQM/Notifs **screenpop** service layer API module for WxCC Agent Desktop.
17
-
18
- ### `Desktop` module
19
-
20
- Desktop module contains sub-modules:
21
-
22
- ````Javascript
23
- import { Desktop } from "@wxcc-desktop/sdk";
24
-
25
- const {
26
- config,
27
- actions,
28
- logger,
29
- shortcutKey,
30
- i18n,
31
- webexMetricsInternal,
32
-
33
- // AQM/Notifs modules
34
- agentContact,
35
- agentStateInfo,
36
- dialer,
37
- screenpop
38
- } = Desktop;
39
-
40
- ###`Desktop config` sub-module
41
- ```Javascript
42
- import { Desktop } from "@wxcc-desktop/sdk";
43
-
44
- Desktop.config.init({widgetName: "widgetName", widgetProvider: "widgetProvider"});
45
-
46
- ### `Desktop.logger` sub-module
47
- `Desktop.logger` sub-module is intended to create & maintain client-side logger's instances for third-party widgets.
48
- ```Javascript
49
- import { Desktop } from "@wxcc-desktop/sdk";
50
-
51
- //...
52
-
53
- /*
54
- Supposing Desktop.config.init() was called
55
- */
56
-
57
- const logerOne = Desktop.logger.createLogger("for-service-one");
58
- const logerTwo = Desktop.logger.createLogger("for-service-two");
59
-
60
- logerOne.info("Info test"); // console.log => "for-service-one: Info:test"
61
- logerTwo.warn("Warn test"); // console.log => "for-service-two: Warn:test"
62
- logerOne.error("Error test"); // console.log => "for-service-one: Error:test"
63
-
64
- // Start browser doanload logs as JSON for "for-service-one" prefix:
65
- Desktop.logger.browserDownloadLogsJson("for-service-one");
66
-
67
- // Start browser doanload logs as Test for "for-service-one" prefix:
68
- Desktop.logger.browserDownloadLogsText("for-service-one");
69
-
70
- // Get logs as Object's collection for "for-service-one" prefix:
71
- Desktop.logger.getLogsCollection("for-service-one");
72
-
73
- // Get logs as base64 encoded url ready to put into link href to initiate browser download as JSON for "for-service-one" prefix:
74
- Desktop.logger.getLogsJsonUrl("for-service-one");
75
-
76
- // Get logs as base64 encoded url ready to put into link href to initiate browser download as Text for "for-service-one" prefix:
77
- Desktop.logger.getLogsTextUrl("for-service-one");
78
-
79
- // Cleanup logs from LS for "for-service-one" prefix:
80
- Desktop.logger.cleanupPrefixedLogs("for-service-one");
81
-
82
- //...
83
- ````
84
-
85
- ### `Desktop.i18n` sub-module
86
-
87
- `Desktop.i18n` sub-module is intended to create & maintain client-side i18n & lit-element i18nMixin instances for third-party widgets.
88
-
89
- Desktop.i18n instantinating object is described in: https://www.i18next.com/overview/api#instance-creation
90
-
91
- i18n instance backend configuration described in: https://github.com/i18next/i18next-http-backend
92
-
93
- i18n instance languageDetector configuration described in: https://github.com/i18next/i18next-browser-languageDetector
94
-
95
- i18n instance init options are described in: https://www.i18next.com/overview/configuration-options
96
-
97
- ```Javascript
98
- import { Desktop } from "@wxcc-desktop/sdk";
99
- import { customElement, LitElement } from "lit-element";
100
- import { html } from "lit-html";
101
-
102
-
103
- //...
104
-
105
- /*
106
- Desktop.i18n service MAY NOT NEED to wait for Desktop.config.init({...}) was called for proper work
107
- */
108
-
109
- // All CreateOotions for i18n are optional
110
- type CreateOptions = {
111
- logger?:
112
- | {
113
- log(...args: any[]): void;
114
- warn(...args: any[]): void;
115
- error(...args: any[]): void;
116
- }
117
- | ReturnType<typof Desktop.createLogger>;
118
-
119
- backend?: Backend // import Backend from "i18next-http-backend";
120
- languageDetector?: LanguageDetector // import LanguageDetector from "i18next-browser-languagedetector";
121
- };
122
-
123
- const i18n = Desktop.i18n.createInstance(createOptions?: CreateOptions) // returns instance described in https://www.i18next.com/overview/api#instance-creation
124
- const i18nMixin = Desktop.i18n.createMixin({ i18n /*Injecting i18n service instance into lit-element mixin */ })
125
-
126
- console.log(Desktop.i18n.DEFAULT_INIT_OPTIONS); // => i18n.init options that are using by AgentX by default
127
-
128
- // Init i18n with options to be able call "t" function translations
129
- if (!i18n.isInitialized) {
130
- const initOptions = Desktop.i18n.getMergedInitOptions(Desktop.i18n.DEFAULT_INIT_OPTIONS || {}, {
131
- defaultNS: "my-ns",
132
- ns: ["my-ns"],
133
- fallbackLng: "en",
134
- backend: {
135
- loadPath: "/.../path-to-locales/.../{{lng}}/{{ns}}.json"
136
- }
137
- });
138
-
139
- i18n.init(initOptions).catch(err => console.log(err));
140
- }
141
-
142
- @customElement("my-awesome-component")
143
- export class MyAwesomeComponent extends i18nMixin(LitElement) {
144
- render() {
145
- return html`
146
- <!-- i18nMixin will subscribe component tree updates on languages load & language change -->
147
- <p>${i18n.t("my-ns:key1")}</p>
148
- <!-- Component wrapped by i18nMixin can access t funcation via this.t(...) -->
149
- <p>${this.t("my-ns:key2")}</p>`
150
- }
151
- }
152
-
153
- ```
154
-
155
- ### `Desktop.actions` sub-module
156
-
157
- `Desktop.actions` sub-module is intended to make a calls into and/or get data from AgentX store.
158
-
159
- ```Javascript
160
- import { Desktop } from "@wxcc-desktop/sdk";
161
-
162
- //...
163
-
164
- /*
165
- Supposing Desktop.config.init() was called
166
- */
167
-
168
-
169
- // AgentX General Notifications:
170
- Desktop.actions.fireGeneralSilentNotification({...}) // => Fires silent notification in AgentX. One way
171
-
172
- // Unlike silent notification, autodismiss and acknowledge can have controlled responses, that may reflect in status, e.g.:
173
- const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAutoDismissNotification({...}) // => Fires autudismiss notification in AgentX. Returns notification resolved status, reason, mode. NOTE: if AgentX notifications disabled - it will be converted into silent and reflected in "mode"
174
- const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAcknowledgeNotification({...}) // => Fires acknowledge notification in AgentX. Returns notification resolved status, reason, mode. NOTE: if AgentX notifications disabled - it will be converted into silent and reflected in "mode"
175
-
176
-
177
- // AgentX Tasks:
178
- Desktop.actions.addCustomTask({...}) // => Add custom task object in AgentX store
179
-
180
-
181
- // AgentX Task Map:
182
- const currentTaskMap = await Desktop.actions.getTaskMap() // => Get current task map from AgentX store
183
-
184
- // AgentX Media Type Queues:
185
- const queue = await Desktop.actions.getMediaTypeQueue("telephony" | "social" | "email" | "chat") // => Get current media queue from AgentX store
186
-
187
- // AgentX AccessToken:
188
- const accessToken = await Desktop.actions.getToken() // => Get current accessToken from AgentX store
189
-
190
- // AgentX idleCodes:
191
- const idelCodes = await Desktop.actions.getIdleCodes() // => Get current idleCodes from AgentX store
192
-
193
- // AgentX wrapUpCodes:
194
- const wrapUpCodes = await Desktop.actions.getWrapUpCodes() // => Get current idleCodes from AgentX store
195
-
196
- // AgentX Maximize/Restore Dynamic Widget.
197
- const toggle = Desktop.actions.toggleMiximizeRestore(e: Event) // => maximize/restore widgets with toggle-maximize-restore.
198
-
199
- ```
200
-
201
- ### `Desktop.shortcutKey` sub-module
202
-
203
- `Desktop.shortcutKey` sub-module is intended to register and call shortcut keys actions from widgets.
204
-
205
- ```Javascript
206
- import { Desktop } from "@wxcc-desktop/sdk";
207
-
208
- //...
209
-
210
- /*
211
- Supposing Desktop.config.init() was called
212
- */
213
-
214
- console.log(Desktop.shortcutKey.DEFAULT_SHORTCUT_KEYS); //=> logs default shortcut keys
215
-
216
- console.log(Desktop.shortcutKey.MODIFIERS); //=> logs keys modifiers
217
-
218
- console.log(Desktop.shortcutKey.REGISTERED_KEYS); //=> logs registered keys
219
-
220
- console.log(Desktop.shortcutKey.getRegisteredKeys()); //=> logs service registered keys
221
-
222
- Desktop.shortcutKey.listenKeyPress((event) => {...}); //=> listen shortcuts key press
223
-
224
- Desktop.shortcutKey.listenKeyConflict((event) => {...}); //=> listen shortcuts key conflict
225
-
226
- Desktop.shortcutKey.listenConflictResolved(() => {}); //=> listen to shortcut key conflict resolved status
227
-
228
- Desktop.shortcutKey.register([ {...}, {...}, ... ]); //=> registering shortcut keys actions
229
-
230
- Desktop.shortcutKey.unregisterKeys('widget-one-example'); //=> used to unregister on unmount, widgetElement used for register should be provided
231
-
232
- //...
233
- ```
234
-
235
- ### `Desktop.agentContact` sub-module
236
-
237
- `Desktop.agentContact` sub-module is intended to make aqm requests and listen to notifs events related to agent-contact entity.
238
-
239
- ```Javascript
240
- import { Desktop } from "@wxcc-desktop/sdk";
241
-
242
- //...
243
-
244
- /*
245
- Supposing Desktop.config.init() was called
246
- */
247
-
248
- // List of available agent-contact aqm reqs:
249
- await Desktop.agentContact.accept({ ... });
250
- await Desktop.agentContact.consultAccept({ ... });
251
- await Desktop.agentContact.buddyAgents({ ... });
252
- await Desktop.agentContact.end({ ... });
253
- await Desktop.agentContact.consultEnd({ ... });
254
- await Desktop.agentContact.cancelCtq({ ... });
255
- await Desktop.agentContact.wrapup({ ... });
256
- await Desktop.agentContact.vteamTransfer({ ... });
257
- await Desktop.agentContact.blindTransfer({ ... });
258
- await Desktop.agentContact.hold({ ... });
259
- await Desktop.agentContact.unHold({ ... });
260
- await Desktop.agentContact.consult({ ... });
261
- await Desktop.agentContact.decline({ ... });
262
- await Desktop.agentContact.consultTransfer({ ... });
263
- await Desktop.agentContact.vteamList({ ... });
264
- await Desktop.agentContact.pauseRecording({ ... });
265
- await Desktop.agentContact.resumeRecording({ ... });
266
-
267
- // List of new routing API's
268
- await Desktop.agentContact.acceptV2({ ... });
269
- await Desktop.agentContact.cancelTaskV2({ ... });
270
- await Desktop.agentContact.endV2({ ... });
271
- await Desktop.agentContact.pauseRecordingV2({ ... });
272
- await Desktop.agentContact.resumeRecordingV2({ ... });
273
- await Desktop.agentContact.wrapupV2({ ... });
274
- await Desktop.agentContact.consultV2({ ... });
275
- await Desktop.agentContact.consultEndV2({ ... });
276
- await Desktop.agentContact.consultConferenceV2({ ... });
277
- await Desktop.agentContact.exitConference({ ... });
278
- await Desktop.agentContact.vteamTransferV2({ ... });
279
- await Desktop.agentContact.blindTransferV2({ ... });
280
- await Desktop.agentContact.consultTransferV2({ ... });
281
- await Desktop.agentContact.buddyAgentsV2({ ... });
282
-
283
- // List of available agent-contact aqm notifs events:
284
- Desktop.agentContact.addEventListener("eAgentContact", msg => console.log(msg));
285
- Desktop.agentContact.addEventListener("eAgentContactAssigned", msg => console.log(msg));
286
- Desktop.agentContact.addEventListener("eAgentContactEnded", msg => console.log(msg));
287
- Desktop.agentContact.addEventListener("eAgentContactWrappedUp", msg => console.log(msg));
288
- Desktop.agentContact.addEventListener("eAgentOfferContact", msg => console.log(msg));
289
- Desktop.agentContact.addEventListener("eAgentOfferContactRona", msg => console.log(msg));
290
- Desktop.agentContact.addEventListener("eAgentOfferConsult", msg => console.log(msg));
291
- Desktop.agentContact.addEventListener("eAgentWrapup", msg => console.log(msg));
292
- Desktop.agentContact.addEventListener("eAgentContactHeld", msg => console.log(msg));
293
- Desktop.agentContact.addEventListener("eAgentContactUnHeld", msg => console.log(msg));
294
- Desktop.agentContact.addEventListener("eCallRecordingStarted", msg => console.log(msg));
295
- Desktop.agentContact.addEventListener("eAgentConsultCreated", msg => console.log(msg));
296
- Desktop.agentContact.addEventListener("eAgentConsultConferenced", msg => console.log(msg));
297
- Desktop.agentContact.addEventListener("eAgentConsultEnded", msg => console.log(msg));
298
- Desktop.agentContact.addEventListener("eAgentCtqCancelled", msg => console.log(msg));
299
- Desktop.agentContact.addEventListener("eAgentConsulting", msg => console.log(msg));
300
- Desktop.agentContact.addEventListener("eAgentConsultFailed", msg => console.log(msg));
301
- Desktop.agentContact.addEventListener("eAgentConsultEndFailed", msg => console.log(msg));
302
- Desktop.agentContact.addEventListener("eAgentCtqFailed", msg => console.log(msg));
303
- Desktop.agentContact.addEventListener("eAgentCtqCancelFailed", msg => console.log(msg));
304
- Desktop.agentContact.addEventListener("eAgentConsultConferenceEndFailed", msg => console.log(msg));
305
- Desktop.agentContact.addEventListener("eAgentMonitorStateChanged", msg => console.log(msg));
306
- Desktop.agentContact.addEventListener("eAgentMonitoringEnded", msg => console.log(msg));
307
- Desktop.agentContact.addEventListener("eAgentOfferCampaignReserved", msg => console.log(msg));
308
- Desktop.agentContact.addEventListener("eAgentAddCampaignReserved", msg => console.log(msg));
309
-
310
- // Module supports removing added listeners like:
311
- const listener = msg => console.log(msg);
312
- Desktop.agentContact.addEventListener("eAgentContact", listener);
313
- Desktop.agentContact.removeEventListener("eAgentContact", listener);
314
-
315
- // Module supports one-time added listeners like:
316
- Desktop.agentContact.addOnceEventListener("eAgentContact", listener);
317
- Desktop.agentContact.removeOnceEventListener("eAgentContact", listener);
318
-
319
- // Module supports removing all listeners like:
320
- Desktop.agentContact.removeAllEventListeners();
321
-
322
- ```
323
-
324
- ### `Desktop.agentStateInfo` sub-module
325
-
326
- `Desktop.agentStateInfo` sub-module is intended to listen for latest data updates for data:
327
-
328
- ```Javascript
329
- type LatestInfoData = {
330
- teamId?: string;
331
- teamName?: string;
332
- dn?: string;
333
- status?: string;
334
- subStatus?: string;
335
- idleCodes?: Service.Aqm.Configs.Entity[];
336
- wrapupCodes?: Service.Aqm.Configs.Entity[];
337
- outDialRegex?: string;
338
- isOutboundEnabledForTenant?: boolean;
339
- isOutboundEnabledForAgent?: boolean;
340
- };
341
- ```
342
-
343
- ```Javascript
344
- import { Desktop } from "@wxcc-desktop/sdk";
345
-
346
- //...
347
-
348
- /*
349
- Supposing Desktop.config.init() was called
350
- */
351
-
352
- // latestData inludes latest data fields
353
- const latestData: LatestInfoData = Desktop.agentStateInfo.latestData;
354
-
355
- //...
356
- // Cumulative update event supported
357
- Desktop.agentStateInfo.addEventListener("updated", updatedList =>
358
- console.log(updatedList)
359
- /* will log (in case of "dn", "status", "subStatus" fields were updated
360
- [
361
- {
362
- "name": "dn",
363
- "value": "+12580258011",
364
- "oldValue": ""
365
- },
366
- {
367
- "name": "status",
368
- "value": "LoggedIn",
369
- "oldValue": "DefaultState"
370
- },
371
- {
372
- "name": "subStatus",
373
- "value": "Available",
374
- "oldValue": ""
375
- }
376
- ]
377
- */
378
- );
379
-
380
-
381
- // List of available agent-state aqm reqs:
382
- await Desktop.agentStateInfo.stateChange({ ... });
383
- await Desktop.agentStateInfo.fetchAddressBooks({ ... });
384
-
385
- ```
386
-
387
- ### `Desktop.dialer` sub-module
388
-
389
- `Desktop.dialer` sub-module is intended to make aqm requests and listen to notifs events related to dialer entity.
390
-
391
- ```Javascript
392
- import { Desktop } from "@wxcc-desktop/sdk";
393
-
394
- //...
395
-
396
- /*
397
- Supposing Desktop.config.init() was called
398
- */
399
-
400
- // List of available agent-contact aqm reqs:
401
- await Desktop.dialer.startOutdial({ ... });
402
-
403
- // List of available agent-contact aqm notifs events:
404
- Desktop.dialer.addEventListener("eOutdialFailed", msg => console.log(msg));
405
-
406
- // Module supports removing added listeners like:
407
- const listener = msg => console.log(msg);
408
- Desktop.dialer.addEventListener("eOutdialFailed", listener);
409
- Desktop.dialer.removeEventListener("eOutdialFailed", listener);
410
-
411
- // Module supports one-time added listeners like:
412
- Desktop.dialer.addOnceEventListener("eOutdialFailed", listener);
413
- Desktop.dialer.removeOnceEventListener("eOutdialFailed", listener);
414
-
415
- // Module supports removing all listeners like:
416
- Desktop.dialer.removeAllEventListeners();
417
-
418
- ```
419
-
420
- ### `Desktop.monitoring` sub-module
421
-
422
- `Desktop.monitoring` sub-module is intended to make aqm requests and listen to notifs events related to call monitoring entity.
423
-
424
- ```Javascript
425
- import { Desktop } from "@wxcc-desktop/sdk";
426
-
427
- //...
428
-
429
- /*
430
- Supposing Desktop.config.init() was called
431
- */
432
-
433
- // Start the monitoring request to aqm:
434
- await Desktop.monitoring.startMonitoring({ ... });
435
-
436
- // End the monitoring request to aqm:
437
- await Desktop.monitoring.endMonitoring({ ... });
438
-
439
- // Pause the monitoring request to aqm:
440
- await Desktop.monitoring.holdMonitoring({ ... });
441
-
442
- // Resume the pause monitoring request to aqm:
443
- await Desktop.monitoring.unHoldMonitoring({ ... });
444
-
445
- // Start BargIn request to aqm:
446
- await Desktop.monitoring.bargeIn({ ... });
447
-
448
- // Module supports removing added listeners like:
449
- const listener = msg => console.log(msg);
450
- Desktop.monitoring.addEventListener("eMonitoringOffered", listener);
451
- Desktop.monitoring.addEventListener("eMonitoringStarted", listener);
452
- Desktop.monitoring.addEventListener("eMonitoringRequestCreateFailed", listener);
453
- Desktop.monitoring.addEventListener("eMonitoringFailed", listener);
454
- Desktop.monitoring.addEventListener("eMonitoringEnded", listener);
455
- Desktop.monitoring.addEventListener("eMonitoringEndFailed", listener);
456
- Desktop.monitoring.addEventListener("eMonitoringHeld", listener);
457
- Desktop.monitoring.addEventListener("eMonitoringHoldFailed", listener);
458
- Desktop.monitoring.addEventListener("eMonitoringUnHeld", listener);
459
- Desktop.monitoring.addEventListener("eMonitoringUnHoldFailed", listener);
460
- Desktop.monitoring.addEventListener("eAgentMonitorStateChanged", listener);
461
- Desktop.monitoring.addEventListener("eAgentMonitorStateChangeFailed", listener);
462
-
463
- Desktop.monitoring.removeEventListener("eMonitoringOffered", listener);
464
- Desktop.monitoring.removeEventListener("eMonitoringStarted", listener);
465
- Desktop.monitoring.removeEventListener("eMonitoringRequestCreateFailed", listener);
466
- Desktop.monitoring.removeEventListener("eMonitoringFailed", listener);
467
- Desktop.monitoring.removeEventListener("eMonitoringEnded", listener);
468
- Desktop.monitoring.removeEventListener("eMonitoringEndFailed", listener);
469
- Desktop.monitoring.removeEventListener("eMonitoringHeld", listener);
470
- Desktop.monitoring.removeEventListener("eMonitoringHoldFailed", listener);
471
- Desktop.monitoring.removeEventListener("eMonitoringUnHeld", listener);
472
- Desktop.monitoring.removeEventListener("eMonitoringUnHoldFailed", listener);
473
- Desktop.monitoring.removeEventListener("eAgentMonitorStateChanged", listener);
474
- Desktop.monitoring.removeEventListener("eAgentMonitorStateChangeFailed", listener);
475
-
476
-
477
- // Module supports one-time added listeners like:
478
- Desktop.monitoring.addOnceEventListener("eMonitoringOffered", listener);
479
- Desktop.monitoring.addOnceEventListener("eMonitoringStarted", listener);
480
- Desktop.monitoring.addOnceEventListener("eMonitoringRequestCreateFailed", listener);
481
- Desktop.monitoring.addOnceEventListener("eMonitoringFailed", listener);
482
- Desktop.monitoring.addOnceEventListener("eMonitoringEnded", listener);
483
- Desktop.monitoring.addOnceEventListener("eMonitoringEndFailed", listener);
484
- Desktop.monitoring.addOnceEventListener("eMonitoringHeld", listener);
485
- Desktop.monitoring.addOnceEventListener("eMonitoringHoldFailed", listener);
486
- Desktop.monitoring.addOnceEventListener("eMonitoringUnHeld", listener);
487
- Desktop.monitoring.addOnceEventListener("eMonitoringUnHoldFailed", listener);
488
- Desktop.monitoring.addOnceEventListener("eAgentMonitorStateChanged", listener);
489
- Desktop.monitoring.addOnceEventListener("eAgentMonitorStateChangeFailed", listener);
490
-
491
- Desktop.monitoring.removeOnceEventListener("eMonitoringOffered", listener);
492
- Desktop.monitoring.removeOnceEventListener("eMonitoringStarted", listener);
493
- Desktop.monitoring.removeOnceEventListener("eMonitoringRequestCreateFailed", listener);
494
- Desktop.monitoring.removeOnceEventListener("eMonitoringFailed", listener);
495
- Desktop.monitoring.removeOnceEventListener("eMonitoringEnded", listener);
496
- Desktop.monitoring.removeOnceEventListener("eMonitoringEndFailed", listener);
497
- Desktop.monitoring.removeOnceEventListener("eMonitoringHeld", listener);
498
- Desktop.monitoring.removeOnceEventListener("eMonitoringHoldFailed", listener);
499
- Desktop.monitoring.removeOnceEventListener("eMonitoringUnHeld", listener);
500
- Desktop.monitoring.removeOnceEventListener("eMonitoringUnHoldFailed", listener);
501
- Desktop.monitoring.removeOnceEventListener("eAgentMonitorStateChanged", listener);
502
- Desktop.monitoring.removeOnceEventListener("eAgentMonitorStateChangeFailed", listener);
503
- // Module supports removing all listeners like:
504
- Desktop.monitoring.removeAllEventListeners();
505
-
506
- ```
507
-
508
- ### `Desktop.screenpop` sub-module
509
-
510
- `Desktop.screenpop` sub-module is intended to make aqm requests and listen to notifs events related to screenpop entity.
511
-
512
- ```Javascript
513
- import { Desktop } from "@wxcc-desktop/sdk";
514
-
515
- //...
516
-
517
- /*
518
- Supposing Desktop.config.init() was called
519
- */
520
-
521
- // List of available agent-contact aqm notifs events:
522
- Desktop.screenpop.addEventListener("eScreenPop", msg => console.log(msg));
523
-
524
- // Module supports removing added listeners like:
525
- const listener = msg => console.log(msg);
526
- Desktop.screenpop.addEventListener("eScreenPop", listener);
527
- Desktop.screenpop.removeEventListener("eScreenPop", listener);
528
-
529
- // Module supports one-time added listeners like:
530
- Desktop.screenpop.addOnceEventListener("eScreenPop", listener);
531
- Desktop.screenpop.removeOnceEventListener("eScreenPop", listener);
532
-
533
- // Module supports removing all listeners like:
534
- Desktop.screenpop.removeAllEventListeners();
535
-
536
- ```
537
-
538
- ### `Desktop.postInteraction` sub-module
539
-
540
- `Desktop.postInteraction` sub-module is intended to fetch lists of audio recordings and a specific captured audio recording for supervisors.
541
-
542
- ```Javascript
543
- /*
544
- Supposing Desktop.config.init() was called
545
- */
546
-
547
- // List of recordings between startTime and endTime (in milliseconds)
548
- await Desktop.postInteraction.fetchTasks({startTime, endTime, pageNumber});
549
-
550
- // Specific captured audio recording (taskId can be found using above call)
551
- await Desktop.postInteraction.fetchCapture({taskId});
552
-
553
- ```
554
-
555
- ### `Desktop.agentConfigJsApi` sub-module
556
-
557
- `Desktop.agentConfigJsApi` sub-module is intended to fetch Agent configurations from contact center Backend service API's.
558
-
559
- ```Javascript
560
- /*
561
- Supposing Desktop.config.init() was called
562
- */
563
-
564
- // AgentX paginated idleCodes/wrapupCodes:
565
- const requestAuxCodes = {
566
- workType: "IDLE_CODE" | "WRAP_UP_CODE";
567
- page?: number;
568
- pageSize?: number;
569
- search?: string;
570
- customFilter?: string;
571
- }
572
- const paginatedAuxCodes: await Desktop.agentConfigJsApi.fetchPaginatedAuxCodes(requestAuxCodes);
573
-
574
- ```
575
-
576
- ### `Desktop.webexMetricsInternal` sub-module
577
-
578
- `Desktop.webexMetricsInternal` sub-module is intended for tracking metrics and events from widgits
579
-
580
- ```Javascript
581
- /*
582
- Supposing Desktop.config.init() was called
583
- */
584
-
585
- // Module supports tracking behavioral events within widgit
586
- Desktop.webexMetricsInternal.trackBehavioralEvent(name: string, options?: EventPayload);
587
-
588
- ```
589
-
590
- ### Publishing the wxcc-desktop/js-api
591
-
592
- For publishing internally to Internal Cisco Repository: `yarn npm:publish:internal`
593
- For publishing to both Internal and public Repo : `yarn publish:external`
594
-
595
- `publish:all` responsible for publishing in both first internal repository and then to the external public repository npmjs
1
+ # WxCC Agent Desktop JS-API
2
+
3
+ WxCC Agent Desktop JS API modules set
4
+
5
+ ## Root module (`Desktop`) includes:
6
+
7
+ - Config module
8
+ - I18N module
9
+ - Actions module
10
+ - Logger service module
11
+ - ShortcutKey service module
12
+ - Webex Metrics module
13
+ - AQM/Notifs **agent-contact** service layer API module for WxCC Agent Desktop.
14
+ - AQM/Notifs **agent-state** service layer API module for WxCC Agent Desktop.
15
+ - AQM/Notifs **dialer** service layer API module for WxCC Agent Desktop.
16
+ - AQM/Notifs **screenpop** service layer API module for WxCC Agent Desktop.
17
+
18
+ ### `Desktop` module
19
+
20
+ Desktop module contains sub-modules:
21
+
22
+ ````Javascript
23
+ import { Desktop } from "@wxcc-desktop/sdk";
24
+
25
+ const {
26
+ config,
27
+ actions,
28
+ logger,
29
+ shortcutKey,
30
+ i18n,
31
+ webexMetricsInternal,
32
+
33
+ // AQM/Notifs modules
34
+ agentContact,
35
+ agentStateInfo,
36
+ dialer,
37
+ screenpop
38
+ } = Desktop;
39
+
40
+ ###`Desktop config` sub-module
41
+ ```Javascript
42
+ import { Desktop } from "@wxcc-desktop/sdk";
43
+
44
+ Desktop.config.init({widgetName: "widgetName", widgetProvider: "widgetProvider"});
45
+
46
+ ### `Desktop.logger` sub-module
47
+ `Desktop.logger` sub-module is intended to create & maintain client-side logger's instances for third-party widgets.
48
+ ```Javascript
49
+ import { Desktop } from "@wxcc-desktop/sdk";
50
+
51
+ //...
52
+
53
+ /*
54
+ Supposing Desktop.config.init() was called
55
+ */
56
+
57
+ const logerOne = Desktop.logger.createLogger("for-service-one");
58
+ const logerTwo = Desktop.logger.createLogger("for-service-two");
59
+
60
+ logerOne.info("Info test"); // console.log => "for-service-one: Info:test"
61
+ logerTwo.warn("Warn test"); // console.log => "for-service-two: Warn:test"
62
+ logerOne.error("Error test"); // console.log => "for-service-one: Error:test"
63
+
64
+ // Start browser doanload logs as JSON for "for-service-one" prefix:
65
+ Desktop.logger.browserDownloadLogsJson("for-service-one");
66
+
67
+ // Start browser doanload logs as Test for "for-service-one" prefix:
68
+ Desktop.logger.browserDownloadLogsText("for-service-one");
69
+
70
+ // Get logs as Object's collection for "for-service-one" prefix:
71
+ Desktop.logger.getLogsCollection("for-service-one");
72
+
73
+ // Get logs as base64 encoded url ready to put into link href to initiate browser download as JSON for "for-service-one" prefix:
74
+ Desktop.logger.getLogsJsonUrl("for-service-one");
75
+
76
+ // Get logs as base64 encoded url ready to put into link href to initiate browser download as Text for "for-service-one" prefix:
77
+ Desktop.logger.getLogsTextUrl("for-service-one");
78
+
79
+ // Cleanup logs from LS for "for-service-one" prefix:
80
+ Desktop.logger.cleanupPrefixedLogs("for-service-one");
81
+
82
+ //...
83
+ ````
84
+
85
+ ### `Desktop.i18n` sub-module
86
+
87
+ `Desktop.i18n` sub-module is intended to create & maintain client-side i18n & lit-element i18nMixin instances for third-party widgets.
88
+
89
+ Desktop.i18n instantinating object is described in: https://www.i18next.com/overview/api#instance-creation
90
+
91
+ i18n instance backend configuration described in: https://github.com/i18next/i18next-http-backend
92
+
93
+ i18n instance languageDetector configuration described in: https://github.com/i18next/i18next-browser-languageDetector
94
+
95
+ i18n instance init options are described in: https://www.i18next.com/overview/configuration-options
96
+
97
+ ```Javascript
98
+ import { Desktop } from "@wxcc-desktop/sdk";
99
+ import { customElement, LitElement } from "lit-element";
100
+ import { html } from "lit-html";
101
+
102
+
103
+ //...
104
+
105
+ /*
106
+ Desktop.i18n service MAY NOT NEED to wait for Desktop.config.init({...}) was called for proper work
107
+ */
108
+
109
+ // All CreateOotions for i18n are optional
110
+ type CreateOptions = {
111
+ logger?:
112
+ | {
113
+ log(...args: any[]): void;
114
+ warn(...args: any[]): void;
115
+ error(...args: any[]): void;
116
+ }
117
+ | ReturnType<typof Desktop.createLogger>;
118
+
119
+ backend?: Backend // import Backend from "i18next-http-backend";
120
+ languageDetector?: LanguageDetector // import LanguageDetector from "i18next-browser-languagedetector";
121
+ };
122
+
123
+ const i18n = Desktop.i18n.createInstance(createOptions?: CreateOptions) // returns instance described in https://www.i18next.com/overview/api#instance-creation
124
+ const i18nMixin = Desktop.i18n.createMixin({ i18n /*Injecting i18n service instance into lit-element mixin */ })
125
+
126
+ console.log(Desktop.i18n.DEFAULT_INIT_OPTIONS); // => i18n.init options that are using by AgentX by default
127
+
128
+ // Init i18n with options to be able call "t" function translations
129
+ if (!i18n.isInitialized) {
130
+ const initOptions = Desktop.i18n.getMergedInitOptions(Desktop.i18n.DEFAULT_INIT_OPTIONS || {}, {
131
+ defaultNS: "my-ns",
132
+ ns: ["my-ns"],
133
+ fallbackLng: "en",
134
+ backend: {
135
+ loadPath: "/.../path-to-locales/.../{{lng}}/{{ns}}.json"
136
+ }
137
+ });
138
+
139
+ i18n.init(initOptions).catch(err => console.log(err));
140
+ }
141
+
142
+ @customElement("my-awesome-component")
143
+ export class MyAwesomeComponent extends i18nMixin(LitElement) {
144
+ render() {
145
+ return html`
146
+ <!-- i18nMixin will subscribe component tree updates on languages load & language change -->
147
+ <p>${i18n.t("my-ns:key1")}</p>
148
+ <!-- Component wrapped by i18nMixin can access t funcation via this.t(...) -->
149
+ <p>${this.t("my-ns:key2")}</p>`
150
+ }
151
+ }
152
+
153
+ ```
154
+
155
+ ### `Desktop.actions` sub-module
156
+
157
+ `Desktop.actions` sub-module is intended to make a calls into and/or get data from AgentX store.
158
+
159
+ ```Javascript
160
+ import { Desktop } from "@wxcc-desktop/sdk";
161
+
162
+ //...
163
+
164
+ /*
165
+ Supposing Desktop.config.init() was called
166
+ */
167
+
168
+
169
+ // AgentX General Notifications:
170
+ Desktop.actions.fireGeneralSilentNotification({...}) // => Fires silent notification in AgentX. One way
171
+
172
+ // Unlike silent notification, autodismiss and acknowledge can have controlled responses, that may reflect in status, e.g.:
173
+ const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAutoDismissNotification({...}) // => Fires autudismiss notification in AgentX. Returns notification resolved status, reason, mode. NOTE: if AgentX notifications disabled - it will be converted into silent and reflected in "mode"
174
+ const [ status, reason, mode ]: [ Notifications.ItemMeta.Status, Notifications.ItemMeta.StatusChangeEventReason, Notifications.ItemMeta.Mode ] = await Desktop.actions.fireGeneralAcknowledgeNotification({...}) // => Fires acknowledge notification in AgentX. Returns notification resolved status, reason, mode. NOTE: if AgentX notifications disabled - it will be converted into silent and reflected in "mode"
175
+
176
+
177
+ // AgentX Tasks:
178
+ Desktop.actions.addCustomTask({...}) // => Add custom task object in AgentX store
179
+
180
+
181
+ // AgentX Task Map:
182
+ const currentTaskMap = await Desktop.actions.getTaskMap() // => Get current task map from AgentX store
183
+
184
+ // AgentX Media Type Queues:
185
+ const queue = await Desktop.actions.getMediaTypeQueue("telephony" | "social" | "email" | "chat") // => Get current media queue from AgentX store
186
+
187
+ // AgentX AccessToken:
188
+ const accessToken = await Desktop.actions.getToken() // => Get current accessToken from AgentX store
189
+
190
+ // AgentX idleCodes:
191
+ const idelCodes = await Desktop.actions.getIdleCodes() // => Get current idleCodes from AgentX store
192
+
193
+ // AgentX wrapUpCodes:
194
+ const wrapUpCodes = await Desktop.actions.getWrapUpCodes() // => Get current idleCodes from AgentX store
195
+
196
+ // AgentX Maximize/Restore Dynamic Widget.
197
+ const toggle = Desktop.actions.toggleMiximizeRestore(e: Event) // => maximize/restore widgets with toggle-maximize-restore.
198
+
199
+ ```
200
+
201
+ ### `Desktop.shortcutKey` sub-module
202
+
203
+ `Desktop.shortcutKey` sub-module is intended to register and call shortcut keys actions from widgets.
204
+
205
+ ```Javascript
206
+ import { Desktop } from "@wxcc-desktop/sdk";
207
+
208
+ //...
209
+
210
+ /*
211
+ Supposing Desktop.config.init() was called
212
+ */
213
+
214
+ console.log(Desktop.shortcutKey.DEFAULT_SHORTCUT_KEYS); //=> logs default shortcut keys
215
+
216
+ console.log(Desktop.shortcutKey.MODIFIERS); //=> logs keys modifiers
217
+
218
+ console.log(Desktop.shortcutKey.REGISTERED_KEYS); //=> logs registered keys
219
+
220
+ console.log(Desktop.shortcutKey.getRegisteredKeys()); //=> logs service registered keys
221
+
222
+ Desktop.shortcutKey.listenKeyPress((event) => {...}); //=> listen shortcuts key press
223
+
224
+ Desktop.shortcutKey.listenKeyConflict((event) => {...}); //=> listen shortcuts key conflict
225
+
226
+ Desktop.shortcutKey.listenConflictResolved(() => {}); //=> listen to shortcut key conflict resolved status
227
+
228
+ Desktop.shortcutKey.register([ {...}, {...}, ... ]); //=> registering shortcut keys actions
229
+
230
+ Desktop.shortcutKey.unregisterKeys('widget-one-example'); //=> used to unregister on unmount, widgetElement used for register should be provided
231
+
232
+ //...
233
+ ```
234
+
235
+ ### `Desktop.agentContact` sub-module
236
+
237
+ `Desktop.agentContact` sub-module is intended to make aqm requests and listen to notifs events related to agent-contact entity.
238
+
239
+ ```Javascript
240
+ import { Desktop } from "@wxcc-desktop/sdk";
241
+
242
+ //...
243
+
244
+ /*
245
+ Supposing Desktop.config.init() was called
246
+ */
247
+
248
+ // List of available agent-contact aqm reqs:
249
+ await Desktop.agentContact.accept({ ... });
250
+ await Desktop.agentContact.consultAccept({ ... });
251
+ await Desktop.agentContact.buddyAgents({ ... });
252
+ await Desktop.agentContact.end({ ... });
253
+ await Desktop.agentContact.consultEnd({ ... });
254
+ await Desktop.agentContact.cancelCtq({ ... });
255
+ await Desktop.agentContact.wrapup({ ... });
256
+ await Desktop.agentContact.vteamTransfer({ ... });
257
+ await Desktop.agentContact.blindTransfer({ ... });
258
+ await Desktop.agentContact.hold({ ... });
259
+ await Desktop.agentContact.unHold({ ... });
260
+ await Desktop.agentContact.consult({ ... });
261
+ await Desktop.agentContact.decline({ ... });
262
+ await Desktop.agentContact.consultTransfer({ ... });
263
+ await Desktop.agentContact.vteamList({ ... });
264
+ await Desktop.agentContact.pauseRecording({ ... });
265
+ await Desktop.agentContact.resumeRecording({ ... });
266
+
267
+ // List of new routing API's
268
+ await Desktop.agentContact.acceptV2({ ... });
269
+ await Desktop.agentContact.cancelTaskV2({ ... });
270
+ await Desktop.agentContact.endV2({ ... });
271
+ await Desktop.agentContact.pauseRecordingV2({ ... });
272
+ await Desktop.agentContact.resumeRecordingV2({ ... });
273
+ await Desktop.agentContact.wrapupV2({ ... });
274
+ await Desktop.agentContact.consultV2({ ... });
275
+ await Desktop.agentContact.consultEndV2({ ... });
276
+ await Desktop.agentContact.consultConferenceV2({ ... });
277
+ await Desktop.agentContact.exitConference({ ... });
278
+ await Desktop.agentContact.vteamTransferV2({ ... });
279
+ await Desktop.agentContact.blindTransferV2({ ... });
280
+ await Desktop.agentContact.consultTransferV2({ ... });
281
+ await Desktop.agentContact.buddyAgentsV2({ ... });
282
+
283
+ // List of available agent-contact aqm notifs events:
284
+ Desktop.agentContact.addEventListener("eAgentContact", msg => console.log(msg));
285
+ Desktop.agentContact.addEventListener("eAgentContactAssigned", msg => console.log(msg));
286
+ Desktop.agentContact.addEventListener("eAgentContactEnded", msg => console.log(msg));
287
+ Desktop.agentContact.addEventListener("eAgentContactWrappedUp", msg => console.log(msg));
288
+ Desktop.agentContact.addEventListener("eAgentOfferContact", msg => console.log(msg));
289
+ Desktop.agentContact.addEventListener("eAgentOfferContactRona", msg => console.log(msg));
290
+ Desktop.agentContact.addEventListener("eAgentOfferConsult", msg => console.log(msg));
291
+ Desktop.agentContact.addEventListener("eAgentWrapup", msg => console.log(msg));
292
+ Desktop.agentContact.addEventListener("eAgentContactHeld", msg => console.log(msg));
293
+ Desktop.agentContact.addEventListener("eAgentContactUnHeld", msg => console.log(msg));
294
+ Desktop.agentContact.addEventListener("eCallRecordingStarted", msg => console.log(msg));
295
+ Desktop.agentContact.addEventListener("eAgentConsultCreated", msg => console.log(msg));
296
+ Desktop.agentContact.addEventListener("eAgentConsultConferenced", msg => console.log(msg));
297
+ Desktop.agentContact.addEventListener("eAgentConsultEnded", msg => console.log(msg));
298
+ Desktop.agentContact.addEventListener("eAgentCtqCancelled", msg => console.log(msg));
299
+ Desktop.agentContact.addEventListener("eAgentConsulting", msg => console.log(msg));
300
+ Desktop.agentContact.addEventListener("eAgentConsultFailed", msg => console.log(msg));
301
+ Desktop.agentContact.addEventListener("eAgentConsultEndFailed", msg => console.log(msg));
302
+ Desktop.agentContact.addEventListener("eAgentCtqFailed", msg => console.log(msg));
303
+ Desktop.agentContact.addEventListener("eAgentCtqCancelFailed", msg => console.log(msg));
304
+ Desktop.agentContact.addEventListener("eAgentConsultConferenceEndFailed", msg => console.log(msg));
305
+ Desktop.agentContact.addEventListener("eAgentMonitorStateChanged", msg => console.log(msg));
306
+ Desktop.agentContact.addEventListener("eAgentMonitoringEnded", msg => console.log(msg));
307
+ Desktop.agentContact.addEventListener("eAgentOfferCampaignReserved", msg => console.log(msg));
308
+ Desktop.agentContact.addEventListener("eAgentAddCampaignReserved", msg => console.log(msg));
309
+
310
+ // Module supports removing added listeners like:
311
+ const listener = msg => console.log(msg);
312
+ Desktop.agentContact.addEventListener("eAgentContact", listener);
313
+ Desktop.agentContact.removeEventListener("eAgentContact", listener);
314
+
315
+ // Module supports one-time added listeners like:
316
+ Desktop.agentContact.addOnceEventListener("eAgentContact", listener);
317
+ Desktop.agentContact.removeOnceEventListener("eAgentContact", listener);
318
+
319
+ // Module supports removing all listeners like:
320
+ Desktop.agentContact.removeAllEventListeners();
321
+
322
+ ```
323
+
324
+ ### `Desktop.agentStateInfo` sub-module
325
+
326
+ `Desktop.agentStateInfo` sub-module is intended to listen for latest data updates for data:
327
+
328
+ ```Javascript
329
+ type LatestInfoData = {
330
+ teamId?: string;
331
+ teamName?: string;
332
+ dn?: string;
333
+ status?: string;
334
+ subStatus?: string;
335
+ idleCodes?: Service.Aqm.Configs.Entity[];
336
+ wrapupCodes?: Service.Aqm.Configs.Entity[];
337
+ outDialRegex?: string;
338
+ isOutboundEnabledForTenant?: boolean;
339
+ isOutboundEnabledForAgent?: boolean;
340
+ };
341
+ ```
342
+
343
+ ```Javascript
344
+ import { Desktop } from "@wxcc-desktop/sdk";
345
+
346
+ //...
347
+
348
+ /*
349
+ Supposing Desktop.config.init() was called
350
+ */
351
+
352
+ // latestData inludes latest data fields
353
+ const latestData: LatestInfoData = Desktop.agentStateInfo.latestData;
354
+
355
+ //...
356
+ // Cumulative update event supported
357
+ Desktop.agentStateInfo.addEventListener("updated", updatedList =>
358
+ console.log(updatedList)
359
+ /* will log (in case of "dn", "status", "subStatus" fields were updated
360
+ [
361
+ {
362
+ "name": "dn",
363
+ "value": "+12580258011",
364
+ "oldValue": ""
365
+ },
366
+ {
367
+ "name": "status",
368
+ "value": "LoggedIn",
369
+ "oldValue": "DefaultState"
370
+ },
371
+ {
372
+ "name": "subStatus",
373
+ "value": "Available",
374
+ "oldValue": ""
375
+ }
376
+ ]
377
+ */
378
+ );
379
+
380
+
381
+ // List of available agent-state aqm reqs:
382
+ await Desktop.agentStateInfo.stateChange({ ... });
383
+ await Desktop.agentStateInfo.fetchAddressBooks({ ... });
384
+
385
+ ```
386
+
387
+ ### `Desktop.dialer` sub-module
388
+
389
+ `Desktop.dialer` sub-module is intended to make aqm requests and listen to notifs events related to dialer entity.
390
+
391
+ ```Javascript
392
+ import { Desktop } from "@wxcc-desktop/sdk";
393
+
394
+ //...
395
+
396
+ /*
397
+ Supposing Desktop.config.init() was called
398
+ */
399
+
400
+ // List of available agent-contact aqm reqs:
401
+ await Desktop.dialer.startOutdial({ ... });
402
+
403
+ // List of available agent-contact aqm notifs events:
404
+ Desktop.dialer.addEventListener("eOutdialFailed", msg => console.log(msg));
405
+
406
+ // Module supports removing added listeners like:
407
+ const listener = msg => console.log(msg);
408
+ Desktop.dialer.addEventListener("eOutdialFailed", listener);
409
+ Desktop.dialer.removeEventListener("eOutdialFailed", listener);
410
+
411
+ // Module supports one-time added listeners like:
412
+ Desktop.dialer.addOnceEventListener("eOutdialFailed", listener);
413
+ Desktop.dialer.removeOnceEventListener("eOutdialFailed", listener);
414
+
415
+ // Module supports removing all listeners like:
416
+ Desktop.dialer.removeAllEventListeners();
417
+
418
+ ```
419
+
420
+ ### `Desktop.monitoring` sub-module
421
+
422
+ `Desktop.monitoring` sub-module is intended to make aqm requests and listen to notifs events related to call monitoring entity.
423
+
424
+ ```Javascript
425
+ import { Desktop } from "@wxcc-desktop/sdk";
426
+
427
+ //...
428
+
429
+ /*
430
+ Supposing Desktop.config.init() was called
431
+ */
432
+
433
+ // Start the monitoring request to aqm:
434
+ await Desktop.monitoring.startMonitoring({ ... });
435
+
436
+ // End the monitoring request to aqm:
437
+ await Desktop.monitoring.endMonitoring({ ... });
438
+
439
+ // Pause the monitoring request to aqm:
440
+ await Desktop.monitoring.holdMonitoring({ ... });
441
+
442
+ // Resume the pause monitoring request to aqm:
443
+ await Desktop.monitoring.unHoldMonitoring({ ... });
444
+
445
+ // Start BargIn request to aqm:
446
+ await Desktop.monitoring.bargeIn({ ... });
447
+
448
+ // Module supports removing added listeners like:
449
+ const listener = msg => console.log(msg);
450
+ Desktop.monitoring.addEventListener("eMonitoringOffered", listener);
451
+ Desktop.monitoring.addEventListener("eMonitoringStarted", listener);
452
+ Desktop.monitoring.addEventListener("eMonitoringRequestCreateFailed", listener);
453
+ Desktop.monitoring.addEventListener("eMonitoringFailed", listener);
454
+ Desktop.monitoring.addEventListener("eMonitoringEnded", listener);
455
+ Desktop.monitoring.addEventListener("eMonitoringEndFailed", listener);
456
+ Desktop.monitoring.addEventListener("eMonitoringHeld", listener);
457
+ Desktop.monitoring.addEventListener("eMonitoringHoldFailed", listener);
458
+ Desktop.monitoring.addEventListener("eMonitoringUnHeld", listener);
459
+ Desktop.monitoring.addEventListener("eMonitoringUnHoldFailed", listener);
460
+ Desktop.monitoring.addEventListener("eAgentMonitorStateChanged", listener);
461
+ Desktop.monitoring.addEventListener("eAgentMonitorStateChangeFailed", listener);
462
+
463
+ Desktop.monitoring.removeEventListener("eMonitoringOffered", listener);
464
+ Desktop.monitoring.removeEventListener("eMonitoringStarted", listener);
465
+ Desktop.monitoring.removeEventListener("eMonitoringRequestCreateFailed", listener);
466
+ Desktop.monitoring.removeEventListener("eMonitoringFailed", listener);
467
+ Desktop.monitoring.removeEventListener("eMonitoringEnded", listener);
468
+ Desktop.monitoring.removeEventListener("eMonitoringEndFailed", listener);
469
+ Desktop.monitoring.removeEventListener("eMonitoringHeld", listener);
470
+ Desktop.monitoring.removeEventListener("eMonitoringHoldFailed", listener);
471
+ Desktop.monitoring.removeEventListener("eMonitoringUnHeld", listener);
472
+ Desktop.monitoring.removeEventListener("eMonitoringUnHoldFailed", listener);
473
+ Desktop.monitoring.removeEventListener("eAgentMonitorStateChanged", listener);
474
+ Desktop.monitoring.removeEventListener("eAgentMonitorStateChangeFailed", listener);
475
+
476
+
477
+ // Module supports one-time added listeners like:
478
+ Desktop.monitoring.addOnceEventListener("eMonitoringOffered", listener);
479
+ Desktop.monitoring.addOnceEventListener("eMonitoringStarted", listener);
480
+ Desktop.monitoring.addOnceEventListener("eMonitoringRequestCreateFailed", listener);
481
+ Desktop.monitoring.addOnceEventListener("eMonitoringFailed", listener);
482
+ Desktop.monitoring.addOnceEventListener("eMonitoringEnded", listener);
483
+ Desktop.monitoring.addOnceEventListener("eMonitoringEndFailed", listener);
484
+ Desktop.monitoring.addOnceEventListener("eMonitoringHeld", listener);
485
+ Desktop.monitoring.addOnceEventListener("eMonitoringHoldFailed", listener);
486
+ Desktop.monitoring.addOnceEventListener("eMonitoringUnHeld", listener);
487
+ Desktop.monitoring.addOnceEventListener("eMonitoringUnHoldFailed", listener);
488
+ Desktop.monitoring.addOnceEventListener("eAgentMonitorStateChanged", listener);
489
+ Desktop.monitoring.addOnceEventListener("eAgentMonitorStateChangeFailed", listener);
490
+
491
+ Desktop.monitoring.removeOnceEventListener("eMonitoringOffered", listener);
492
+ Desktop.monitoring.removeOnceEventListener("eMonitoringStarted", listener);
493
+ Desktop.monitoring.removeOnceEventListener("eMonitoringRequestCreateFailed", listener);
494
+ Desktop.monitoring.removeOnceEventListener("eMonitoringFailed", listener);
495
+ Desktop.monitoring.removeOnceEventListener("eMonitoringEnded", listener);
496
+ Desktop.monitoring.removeOnceEventListener("eMonitoringEndFailed", listener);
497
+ Desktop.monitoring.removeOnceEventListener("eMonitoringHeld", listener);
498
+ Desktop.monitoring.removeOnceEventListener("eMonitoringHoldFailed", listener);
499
+ Desktop.monitoring.removeOnceEventListener("eMonitoringUnHeld", listener);
500
+ Desktop.monitoring.removeOnceEventListener("eMonitoringUnHoldFailed", listener);
501
+ Desktop.monitoring.removeOnceEventListener("eAgentMonitorStateChanged", listener);
502
+ Desktop.monitoring.removeOnceEventListener("eAgentMonitorStateChangeFailed", listener);
503
+ // Module supports removing all listeners like:
504
+ Desktop.monitoring.removeAllEventListeners();
505
+
506
+ ```
507
+
508
+ ### `Desktop.screenpop` sub-module
509
+
510
+ `Desktop.screenpop` sub-module is intended to make aqm requests and listen to notifs events related to screenpop entity.
511
+
512
+ ```Javascript
513
+ import { Desktop } from "@wxcc-desktop/sdk";
514
+
515
+ //...
516
+
517
+ /*
518
+ Supposing Desktop.config.init() was called
519
+ */
520
+
521
+ // List of available agent-contact aqm notifs events:
522
+ Desktop.screenpop.addEventListener("eScreenPop", msg => console.log(msg));
523
+
524
+ // Module supports removing added listeners like:
525
+ const listener = msg => console.log(msg);
526
+ Desktop.screenpop.addEventListener("eScreenPop", listener);
527
+ Desktop.screenpop.removeEventListener("eScreenPop", listener);
528
+
529
+ // Module supports one-time added listeners like:
530
+ Desktop.screenpop.addOnceEventListener("eScreenPop", listener);
531
+ Desktop.screenpop.removeOnceEventListener("eScreenPop", listener);
532
+
533
+ // Module supports removing all listeners like:
534
+ Desktop.screenpop.removeAllEventListeners();
535
+
536
+ ```
537
+
538
+ ### `Desktop.postInteraction` sub-module
539
+
540
+ `Desktop.postInteraction` sub-module is intended to fetch lists of audio recordings and a specific captured audio recording for supervisors.
541
+
542
+ ```Javascript
543
+ /*
544
+ Supposing Desktop.config.init() was called
545
+ */
546
+
547
+ // List of recordings between startTime and endTime (in milliseconds)
548
+ await Desktop.postInteraction.fetchTasks({startTime, endTime, pageNumber});
549
+
550
+ // Specific captured audio recording (taskId can be found using above call)
551
+ await Desktop.postInteraction.fetchCapture({taskId});
552
+
553
+ ```
554
+
555
+ ### `Desktop.agentConfigJsApi` sub-module
556
+
557
+ `Desktop.agentConfigJsApi` sub-module is intended to fetch Agent configurations from contact center Backend service API's.
558
+
559
+ ```Javascript
560
+ /*
561
+ Supposing Desktop.config.init() was called
562
+ */
563
+
564
+ // AgentX paginated idleCodes/wrapupCodes:
565
+ const requestAuxCodes = {
566
+ workType: "IDLE_CODE" | "WRAP_UP_CODE";
567
+ page?: number;
568
+ pageSize?: number;
569
+ search?: string;
570
+ customFilter?: string;
571
+ }
572
+ const paginatedAuxCodes: await Desktop.agentConfigJsApi.fetchPaginatedAuxCodes(requestAuxCodes);
573
+
574
+ ```
575
+
576
+ ### `Desktop.webexMetricsInternal` sub-module
577
+
578
+ `Desktop.webexMetricsInternal` sub-module is intended for tracking metrics and events from widgits
579
+
580
+ ```Javascript
581
+ /*
582
+ Supposing Desktop.config.init() was called
583
+ */
584
+
585
+ // Module supports tracking behavioral events within widgit
586
+ Desktop.webexMetricsInternal.trackBehavioralEvent(name: string, options?: EventPayload);
587
+
588
+ ```
589
+
590
+ ### Publishing the wxcc-desktop/js-api
591
+
592
+ For publishing internally to Internal Cisco Repository: `yarn npm:publish:internal`
593
+ For publishing to both Internal and public Repo : `yarn publish:external`
594
+
595
+ `publish:all` responsible for publishing in both first internal repository and then to the external public repository npmjs