@wxcc-desktop/sdk 1.2.6 → 1.2.10

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 (67) hide show
  1. package/README.md +18 -391
  2. package/dist/index.js +1 -0
  3. package/dist/types/index.d.ts +21 -0
  4. package/dist/types/jsapi/actions-jsapi.d.ts +33 -0
  5. package/dist/types/jsapi/agent-contact-jsapi.d.ts +430 -0
  6. package/dist/types/jsapi/agent-state-info-jsapi.d.ts +88 -0
  7. package/dist/types/jsapi/common/_logger.d.ts +4 -0
  8. package/dist/types/jsapi/common/_service-checker.d.ts +12 -0
  9. package/dist/types/jsapi/common/_service-events.d.ts +31 -0
  10. package/dist/types/jsapi/config-jsapi.d.ts +26 -0
  11. package/dist/types/jsapi/dialer-jsapi.d.ts +73 -0
  12. package/dist/types/jsapi/i18n-jsapi.d.ts +23 -0
  13. package/dist/types/jsapi/logger-jsapi.d.ts +19 -0
  14. package/dist/types/jsapi/screenpop-jsapi.d.ts +29 -0
  15. package/dist/types/jsapi/shortcut-key-jsapi.d.ts +67 -0
  16. package/dist/types/sdk.d.ts +1 -0
  17. package/package.json +5 -60
  18. package/.eslintignore +0 -5
  19. package/.eslintrc.js +0 -22
  20. package/.prettierignore +0 -5
  21. package/.prettierrc +0 -5
  22. package/README_PUBLISH.md +0 -36
  23. package/jenkins-automation/MergePipeline.groovy +0 -143
  24. package/jest.config.js +0 -15
  25. package/sonar-project.properties +0 -17
  26. package/src/[sandbox]/README.md +0 -55
  27. package/src/[sandbox]/assets/i18n/de/app.json +0 -6
  28. package/src/[sandbox]/assets/i18n/en/app.json +0 -6
  29. package/src/[sandbox]/assets/i18n/widget-using-js-api/de/widget-using-js-api.json +0 -5
  30. package/src/[sandbox]/assets/i18n/widget-using-js-api/en/widget-using-js-api.json +0 -5
  31. package/src/[sandbox]/favicon.ico +0 -0
  32. package/src/[sandbox]/index.html +0 -9
  33. package/src/[sandbox]/sandbox-config.ts +0 -23
  34. package/src/[sandbox]/sandbox-mock.ts +0 -218
  35. package/src/[sandbox]/sandbox.ts +0 -164
  36. package/src/[sandbox]/widget-using-js-api.ts +0 -658
  37. package/src/global.d.ts +0 -5
  38. package/src/index.ts +0 -101
  39. package/src/jsapi/actions-jsapi.test.ts +0 -155
  40. package/src/jsapi/actions-jsapi.ts +0 -410
  41. package/src/jsapi/agent-contact-jsapi.test.ts +0 -217
  42. package/src/jsapi/agent-contact-jsapi.ts +0 -275
  43. package/src/jsapi/agent-state-info-jsapi.test.ts +0 -176
  44. package/src/jsapi/agent-state-info-jsapi.ts +0 -288
  45. package/src/jsapi/common/_logger.test.ts +0 -16
  46. package/src/jsapi/common/_logger.ts +0 -9
  47. package/src/jsapi/common/_service-checker.test.ts +0 -44
  48. package/src/jsapi/common/_service-checker.ts +0 -28
  49. package/src/jsapi/common/_service-events.test.ts +0 -122
  50. package/src/jsapi/common/_service-events.ts +0 -156
  51. package/src/jsapi/config-jsapi.test.ts +0 -78
  52. package/src/jsapi/config-jsapi.ts +0 -106
  53. package/src/jsapi/dialer-jsapi.test.ts +0 -101
  54. package/src/jsapi/dialer-jsapi.ts +0 -116
  55. package/src/jsapi/i18n-jsapi.test.ts +0 -62
  56. package/src/jsapi/i18n-jsapi.ts +0 -77
  57. package/src/jsapi/logger-jsapi.test.ts +0 -45
  58. package/src/jsapi/logger-jsapi.ts +0 -62
  59. package/src/jsapi/screenpop-jsapi.test.ts +0 -80
  60. package/src/jsapi/screenpop-jsapi.ts +0 -100
  61. package/src/jsapi/shortcut-key-jsapi.test.ts +0 -88
  62. package/src/jsapi/shortcut-key-jsapi.ts +0 -112
  63. package/src/sdk.ts +0 -3
  64. package/src/tsconfig.json +0 -18
  65. package/tsconfig.json +0 -13
  66. package/webpack.config.dev.server.ts +0 -12
  67. package/webpack.config.ts +0 -134
package/README.md CHANGED
@@ -1,409 +1,36 @@
1
- # WxCC Agent Desktop JS-API
2
- WxCC Agent Desktop JS API modules set
1
+ # WXCC Desktop JavaScript SDK
3
2
 
4
- ## Root module (`Desktop`) includes:
5
- - Config module
6
- - I18N module
7
- - Actions module
8
- - Logger service module
9
- - ShortcutKey service module
10
- - AQM/Notifs **agent-contact** service layer API module for WxCC Agent Desktop.
11
- - AQM/Notifs **agent-state** service layer API module for WxCC Agent Desktop.
12
- - AQM/Notifs **dialer** service layer API module for WxCC Agent Desktop.
13
- - AQM/Notifs **screenpop** service layer API module for WxCC Agent Desktop.
3
+ WXCC Desktop JavaScript SDK is an npm package that allows you to request up-to-date information from the WXCC Desktop. Using the SDK, you can request information such as agent details, assigned tasks, particular task details, current browser locale, and authentication token for Single Sign-On (SSO) integration.
14
4
 
15
- ### `Desktop` module
16
- Desktop module contains sub-modules:
5
+ The SDK package allows you to
17
6
 
18
- ```Javascript
19
- import { Desktop } from "@wxcc-desktop/sdk";
7
+ * request data to be passed to your widgets through properties and attributes
20
8
 
21
- const {
22
- config,
23
- actions,
24
- logger,
25
- shortcutKey,
26
- i18n,
9
+ * perform more complex operations by consuming and manipulating the system data inside your widget
27
10
 
28
- // AQM/Notifs modules
29
- agentContact,
30
- agentStateInfo,
31
- dialer,
32
- screenpop
33
- } = Desktop;
34
- ```
35
-
36
- ### `Desktop.logger` sub-module
37
- `Desktop.logger` sub-module is intended to create & maintain client-side logger's instances for third-party widgets.
38
- ```Javascript
39
- import { Desktop } from "@wxcc-desktop/sdk";
40
-
41
- //...
42
-
43
- /*
44
- Supposing Desktop.config.init() was called
45
- */
46
-
47
- const logerOne = Desktop.logger.createLogger("for-service-one");
48
- const logerTwo = Desktop.logger.createLogger("for-service-two");
49
-
50
- logerOne.info("Info test"); // console.log => "for-service-one: Info:test"
51
- logerTwo.warn("Warn test"); // console.log => "for-service-two: Warn:test"
52
- logerOne.error("Error test"); // console.log => "for-service-one: Error:test"
53
-
54
- // Start browser doanload logs as JSON for "for-service-one" prefix:
55
- Desktop.logger.browserDownloadLogsJson("for-service-one");
56
-
57
- // Start browser doanload logs as Test for "for-service-one" prefix:
58
- Desktop.logger.browserDownloadLogsText("for-service-one");
59
-
60
- // Get logs as Object's collection for "for-service-one" prefix:
61
- Desktop.logger.getLogsCollection("for-service-one");
62
-
63
- // Get logs as base64 encoded url ready to put into link href to initiate browser download as JSON for "for-service-one" prefix:
64
- Desktop.logger.getLogsJsonUrl("for-service-one");
65
-
66
- // Get logs as base64 encoded url ready to put into link href to initiate browser download as Text for "for-service-one" prefix:
67
- Desktop.logger.getLogsTextUrl("for-service-one");
68
-
69
- // Cleanup logs from LS for "for-service-one" prefix:
70
- Desktop.logger.cleanupPrefixedLogs("for-service-one");
71
-
72
- //...
73
- ```
74
-
75
- ### `Desktop.i18n` sub-module
76
- `Desktop.i18n` sub-module is intended to create & maintain client-side i18n & lit-element i18nMixin instances for third-party widgets.
77
-
78
- Desktop.i18n instantinating object is described in: https://www.i18next.com/overview/api#instance-creation
79
-
80
- i18n instance backend configuration described in: https://github.com/i18next/i18next-http-backend
81
-
82
- i18n instance languageDetector configuration described in: https://github.com/i18next/i18next-browser-languageDetector
83
-
84
- i18n instance init options are described in: https://www.i18next.com/overview/configuration-options
85
-
86
- ```Javascript
87
- import { Desktop } from "@wxcc-desktop/sdk";
88
- import { customElement, LitElement } from "lit-element";
89
- import { html } from "lit-html";
90
-
91
-
92
- //...
93
-
94
- /*
95
- Desktop.i18n service MAY NOT NEED to wait for Desktop.config.init({...}) was called for proper work
96
- */
97
-
98
- // All CreateOotions for i18n are optional
99
- type CreateOptions = {
100
- logger?:
101
- | {
102
- log(...args: any[]): void;
103
- warn(...args: any[]): void;
104
- error(...args: any[]): void;
105
- }
106
- | ReturnType<typof Desktop.createLogger>;
11
+ * subscribe to data arriving asynchronously
107
12
 
108
- backend?: Backend // import Backend from "i18next-http-backend";
109
- languageDetector?: LanguageDetector // import LanguageDetector from "i18next-browser-languagedetector";
110
- };
13
+ Some events in the WXCC Desktop happen asynchronously. To subscribe to the asynchronous events and access data within the payload, you can add a listener. A few examples for asynchronous events are:
111
14
 
112
- const i18n = Desktop.i18n.createInstance(createOptions?: CreateOptions) // returns instance described in https://www.i18next.com/overview/api#instance-creation
113
- const i18nMixin = Desktop.i18n.createMixin({ i18n /*Injecting i18n service instance into lit-element mixin */ })
15
+ * New task offered
114
16
 
115
- console.log(Desktop.i18n.DEFAULT_INIT_OPTIONS); // => i18n.init options that are using by AgentX by default
17
+ * New task assigned
116
18
 
117
- // Init i18n with options to be able call "t" function translations
118
- if (!i18n.isInitialized) {
119
- const initOptions = Desktop.i18n.getMergedInitOptions(Desktop.i18n.DEFAULT_INIT_OPTIONS || {}, {
120
- defaultNS: "my-ns",
121
- ns: ["my-ns"],
122
- fallbackLng: "en",
123
- backend: {
124
- loadPath: "/.../path-to-locales/.../{{lng}}/{{ns}}.json"
125
- }
126
- });
19
+ * Consult request created
127
20
 
128
- i18n.init(initOptions).catch(err => console.log(err));
129
- }
21
+ * Consult ended
130
22
 
131
- @customElement("my-awesome-component")
132
- export class MyAwesomeComponent extends i18nMixin(LitElement) {
133
- render() {
134
- return html`
135
- <!-- i18nMixin will subscribe component tree updates on languages load & language change -->
136
- <p>${i18n.t("my-ns:key1")}</p>
137
- <!-- Component wrapped by i18nMixin can access t funcation via this.t(...) -->
138
- <p>${this.t("my-ns:key2")}</p>`
139
- }
140
- }
23
+ * Screen pop arrived and more
141
24
 
142
- ```
143
-
144
- ### `Desktop.actions` sub-module
145
- `Desktop.actions` sub-module is intended to make a calls into and/or get data from AgentX store.
146
-
147
- ```Javascript
148
- import { Desktop } from "@wxcc-desktop/sdk";
149
-
150
- //...
151
-
152
- /*
153
- Supposing Desktop.config.init() was called
154
- */
155
-
156
-
157
- // AgentX General Notifications:
158
- Desktop.actions.fireGeneralSilentNotification({...}) // => Fires silent notification in AgentX. One way
159
-
160
- // Unlike silent notification, autodismiss and acknowledge can have controlled responses, that may reflect in status, e.g.:
161
- 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"
162
- 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"
163
-
164
-
165
- // AgentX Tasks:
166
- Desktop.actions.addCustomTask({...}) // => Add custom task object in AgentX store
167
-
168
-
169
- // AgentX Task Map:
170
- const currentTaskMap = await Desktop.actions.getTaskMap() // => Get current task map from AgentX store
25
+ ## Get Started
171
26
 
172
- // AgentX Media Type Queues:
173
- const queue = await Desktop.actions.getMediaTypeQueue("telephony" | "social" | "email" | "chat") // => Get current media queue from AgentX store
174
-
175
- // AgentX AccessToken:
176
- const accessToken = await Desktop.actions.getToken() // => Get current accessToken from AgentX store
177
-
178
- // AgentX idleCodes:
179
- const idelCodes = await Desktop.actions.getIdleCodes() // => Get current idleCodes from AgentX store
180
-
181
- // AgentX wrapUpCodes:
182
- const wrapUpCodes = await Desktop.actions.getWrapUpCodes() // => Get current idleCodes from AgentX store
27
+ Run the following command in your project folder or using yarn:
183
28
 
184
29
  ```
185
-
186
- ### `Desktop.shortcutKey` sub-module
187
- `Desktop.shortcutKey` sub-module is intended to register and call shortcut keys actions from widgets.
188
- ```Javascript
189
- import { Desktop } from "@wxcc-desktop/sdk";
190
-
191
- //...
192
-
193
- /*
194
- Supposing Desktop.config.init() was called
195
- */
196
-
197
- console.log(Desktop.shortcutKey.DEFAULT_SHORTCUT_KEYS); //=> logs default shortcut keys
198
-
199
- console.log(Desktop.shortcutKey.MODIFIERS); //=> logs keys modifiers
200
-
201
- console.log(Desktop.shortcutKey.REGISTERED_KEYS); //=> logs registered keys
202
-
203
- console.log(Desktop.shortcutKey.getRegisteredKeys()); //=> logs service registered keys
204
-
205
- Desktop.shortcutKey.listenKeyPress((event) => {...}); //=> listen shortcuts key press
206
-
207
- Desktop.shortcutKey.listenKeyConflict((event) => {...}); //=> listen shortcuts key conflict
208
-
209
- Desktop.shortcutKey.listenConflictResolved(() => {}); //=> listen to shortcut key conflict resolved status
210
-
211
- Desktop.shortcutKey.register([ {...}, {...}, ... ]); //=> registering shortcut keys actions
212
-
213
- Desktop.shortcutKey.unregisterKeys('widget-one-example'); //=> used to unregister on unmount, widgetElement used for register should be provided
214
-
215
- //...
216
- ```
217
-
218
- ### `Desktop.agentContact` sub-module
219
- `Desktop.agentContact` sub-module is intended to make aqm requests and listen to notifs events related to agent-contact entity.
220
- ```Javascript
221
- import { Desktop } from "@wxcc-desktop/sdk";
222
-
223
- //...
224
-
225
- /*
226
- Supposing Desktop.config.init() was called
227
- */
228
-
229
- // List of available agent-contact aqm reqs:
230
- await Desktop.agentContact.accept({ ... });
231
- await Desktop.agentContact.consultAccept({ ... });
232
- await Desktop.agentContact.buddyAgents({ ... });
233
- await Desktop.agentContact.end({ ... });
234
- await Desktop.agentContact.consultEnd({ ... });
235
- await Desktop.agentContact.cancelCtq({ ... });
236
- await Desktop.agentContact.wrapup({ ... });
237
- await Desktop.agentContact.vteamTransfer({ ... });
238
- await Desktop.agentContact.blindTransfer({ ... });
239
- await Desktop.agentContact.hold({ ... });
240
- await Desktop.agentContact.unHold({ ... });
241
- await Desktop.agentContact.consult({ ... });
242
- await Desktop.agentContact.decline({ ... });
243
- await Desktop.agentContact.consultTransfer({ ... });
244
- await Desktop.agentContact.vteamList({ ... });
245
- await Desktop.agentContact.pauseRecording({ ... });
246
- await Desktop.agentContact.resumeRecording({ ... });
247
-
248
- // List of available agent-contact aqm notifs events:
249
- Desktop.agentContact.addEventListener("eAgentContact", msg => console.log(msg));
250
- Desktop.agentContact.addEventListener("eAgentContactAssigned", msg => console.log(msg));
251
- Desktop.agentContact.addEventListener("eAgentContactEnded", msg => console.log(msg));
252
- Desktop.agentContact.addEventListener("eAgentContactWrappedUp", msg => console.log(msg));
253
- Desktop.agentContact.addEventListener("eAgentOfferContact", msg => console.log(msg));
254
- Desktop.agentContact.addEventListener("eAgentOfferContactRona", msg => console.log(msg));
255
- Desktop.agentContact.addEventListener("eAgentOfferConsult", msg => console.log(msg));
256
- Desktop.agentContact.addEventListener("eAgentWrapup", msg => console.log(msg));
257
- Desktop.agentContact.addEventListener("eAgentContactHeld", msg => console.log(msg));
258
- Desktop.agentContact.addEventListener("eAgentContactUnHeld", msg => console.log(msg));
259
- Desktop.agentContact.addEventListener("eCallRecordingStarted", msg => console.log(msg));
260
- Desktop.agentContact.addEventListener("eAgentConsultCreated", msg => console.log(msg));
261
- Desktop.agentContact.addEventListener("eAgentConsultConferenced", msg => console.log(msg));
262
- Desktop.agentContact.addEventListener("eAgentConsultEnded", msg => console.log(msg));
263
- Desktop.agentContact.addEventListener("eAgentCtqCancelled", msg => console.log(msg));
264
- Desktop.agentContact.addEventListener("eAgentConsulting", msg => console.log(msg));
265
- Desktop.agentContact.addEventListener("eAgentConsultFailed", msg => console.log(msg));
266
- Desktop.agentContact.addEventListener("eAgentConsultEndFailed", msg => console.log(msg));
267
- Desktop.agentContact.addEventListener("eAgentCtqFailed", msg => console.log(msg));
268
- Desktop.agentContact.addEventListener("eAgentCtqCancelFailed", msg => console.log(msg));
269
- Desktop.agentContact.addEventListener("eAgentConsultConferenceEndFailed", msg => console.log(msg));
270
-
271
- // Module supports removing added listeners like:
272
- const listener = msg => console.log(msg);
273
- Desktop.agentContact.addEventListener("eAgentContact", listener);
274
- Desktop.agentContact.removeEventListener("eAgentContact", listener);
275
-
276
- // Module supports one-time added listeners like:
277
- Desktop.agentContact.addOnceEventListener("eAgentContact", listener);
278
- Desktop.agentContact.removeOnceEventListener("eAgentContact", listener);
279
-
280
- // Module supports removing all listeners like:
281
- Desktop.agentContact.removeAllEventListeners();
282
-
283
- ```
284
-
285
- ### `Desktop.agentStateInfo` sub-module
286
- `Desktop.agentStateInfo` sub-module is intended to listen for latest data updates for data:
287
- ```Javascript
288
- type LatestInfoData = {
289
- teamId?: string;
290
- teamName?: string;
291
- dn?: string;
292
- status?: string;
293
- subStatus?: string;
294
- idleCodes?: Service.Aqm.Configs.Entity[];
295
- wrapupCodes?: Service.Aqm.Configs.Entity[];
296
- outDialRegex?: string;
297
- isOutboundEnabledForTenant?: boolean;
298
- isOutboundEnabledForAgent?: boolean;
299
- };
300
- ```
301
-
302
- ```Javascript
303
- import { Desktop } from "@wxcc-desktop/sdk";
304
-
305
- //...
306
-
307
- /*
308
- Supposing Desktop.config.init() was called
309
- */
310
-
311
- // latestData inludes latest data fields
312
- const latestData: LatestInfoData = Desktop.agentStateInfo.latestData;
313
-
314
- //...
315
- // Cumulative update event supported
316
- Desktop.agentStateInfo.addEventListener("updated", updatedList =>
317
- console.log(updatedList)
318
- /* will log (in case of "dn", "status", "subStatus" fields were updated
319
- [
320
- {
321
- "name": "dn",
322
- "value": "+12580258011",
323
- "oldValue": ""
324
- },
325
- {
326
- "name": "status",
327
- "value": "LoggedIn",
328
- "oldValue": "DefaultState"
329
- },
330
- {
331
- "name": "subStatus",
332
- "value": "Available",
333
- "oldValue": ""
334
- }
335
- ]
336
- */
337
- );
338
-
339
-
340
- // List of available agent-state aqm reqs:
341
- await Desktop.agentStateInfo.stateChange({ ... });
342
- await Desktop.agentStateInfo.fetchAddressBooks({ ... });
343
-
344
- ```
345
-
346
- ### `Desktop.dialer` sub-module
347
- `Desktop.dialer` sub-module is intended to make aqm requests and listen to notifs events related to dialer entity.
348
- ```Javascript
349
- import { Desktop } from "@wxcc-desktop/sdk";
350
-
351
- //...
352
-
353
- /*
354
- Supposing Desktop.config.init() was called
355
- */
356
-
357
- // List of available agent-contact aqm reqs:
358
- await Desktop.dialer.startOutdial({ ... });
359
-
360
- // List of available agent-contact aqm notifs events:
361
- Desktop.dialer.addEventListener("eOutdialFailed", msg => console.log(msg));
362
-
363
- // Module supports removing added listeners like:
364
- const listener = msg => console.log(msg);
365
- Desktop.dialer.addEventListener("eOutdialFailed", listener);
366
- Desktop.dialer.removeEventListener("eOutdialFailed", listener);
367
-
368
- // Module supports one-time added listeners like:
369
- Desktop.dialer.addOnceEventListener("eOutdialFailed", listener);
370
- Desktop.dialer.removeOnceEventListener("eOutdialFailed", listener);
371
-
372
- // Module supports removing all listeners like:
373
- Desktop.dialer.removeAllEventListeners();
374
-
375
- ```
376
-
377
- ### `Desktop.screenpop` sub-module
378
- `Desktop.screenpop` sub-module is intended to make aqm requests and listen to notifs events related to screenpop entity.
379
- ```Javascript
380
- import { Desktop } from "@wxcc-desktop/sdk";
381
-
382
- //...
383
-
384
- /*
385
- Supposing Desktop.config.init() was called
386
- */
387
-
388
- // List of available agent-contact aqm notifs events:
389
- Desktop.screenpop.addEventListener("eScreenPop", msg => console.log(msg));
390
-
391
- // Module supports removing added listeners like:
392
- const listener = msg => console.log(msg);
393
- Desktop.screenpop.addEventListener("eScreenPop", listener);
394
- Desktop.screenpop.removeEventListener("eScreenPop", listener);
395
-
396
- // Module supports one-time added listeners like:
397
- Desktop.screenpop.addOnceEventListener("eScreenPop", listener);
398
- Desktop.screenpop.removeOnceEventListener("eScreenPop", listener);
399
-
400
- // Module supports removing all listeners like:
401
- Desktop.screenpop.removeAllEventListeners();
402
-
30
+ npm install @wxcc-desktop/sdk --save
31
+ yarn add @wxcc-desktop/sdk
403
32
  ```
404
33
 
405
- ### Publishing the wxcc-desktop/js-api
406
- For publishing internally to Internal Cisco Repository: `yarn npm:publish:internal`
407
- For publishing to both Internal and public Repo : `yarn publish:external`
34
+ ## For detailed Info refer the below Link
408
35
 
409
- `publish:all` responsible for publishing in both first internal repository and then to the external public repository npmjs
36
+ ### [Webex Contact Center Desktop Docs](https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cust_contact/contact_center/webexcc/developer_20/webexcc_b_20-desktop-developer-guide-/webexcc_m_30-javascript-sdk.html)