@webex/contact-center 3.10.0-next.2 → 3.10.0-next.21

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 (103) hide show
  1. package/dist/cc.js +13 -1
  2. package/dist/cc.js.map +1 -1
  3. package/dist/config.js.map +1 -1
  4. package/dist/constants.js.map +1 -1
  5. package/dist/index.js +17 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/logger-proxy.js.map +1 -1
  8. package/dist/metrics/MetricsManager.js +2 -1
  9. package/dist/metrics/MetricsManager.js.map +1 -1
  10. package/dist/metrics/behavioral-events.js +12 -0
  11. package/dist/metrics/behavioral-events.js.map +1 -1
  12. package/dist/metrics/constants.js +4 -0
  13. package/dist/metrics/constants.js.map +1 -1
  14. package/dist/services/AddressBook.js +2 -3
  15. package/dist/services/AddressBook.js.map +1 -1
  16. package/dist/services/EntryPoint.js +2 -3
  17. package/dist/services/EntryPoint.js.map +1 -1
  18. package/dist/services/Queue.js +2 -3
  19. package/dist/services/Queue.js.map +1 -1
  20. package/dist/services/WebCallingService.js +1 -1
  21. package/dist/services/WebCallingService.js.map +1 -1
  22. package/dist/services/agent/index.js +1 -2
  23. package/dist/services/agent/index.js.map +1 -1
  24. package/dist/services/agent/types.js +10 -0
  25. package/dist/services/agent/types.js.map +1 -1
  26. package/dist/services/config/Util.js.map +1 -1
  27. package/dist/services/config/constants.js.map +1 -1
  28. package/dist/services/config/index.js +1 -1
  29. package/dist/services/config/index.js.map +1 -1
  30. package/dist/services/config/types.js +2 -2
  31. package/dist/services/config/types.js.map +1 -1
  32. package/dist/services/constants.js.map +1 -1
  33. package/dist/services/core/Err.js.map +1 -1
  34. package/dist/services/core/GlobalTypes.js.map +1 -1
  35. package/dist/services/core/Utils.js +92 -74
  36. package/dist/services/core/Utils.js.map +1 -1
  37. package/dist/services/core/WebexRequest.js +1 -2
  38. package/dist/services/core/WebexRequest.js.map +1 -1
  39. package/dist/services/core/aqm-reqs.js +2 -3
  40. package/dist/services/core/aqm-reqs.js.map +1 -1
  41. package/dist/services/core/constants.js +17 -1
  42. package/dist/services/core/constants.js.map +1 -1
  43. package/dist/services/core/types.js.map +1 -1
  44. package/dist/services/core/websocket/WebSocketManager.js +1 -2
  45. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  46. package/dist/services/core/websocket/connection-service.js +1 -1
  47. package/dist/services/core/websocket/connection-service.js.map +1 -1
  48. package/dist/services/core/websocket/keepalive.worker.js.map +1 -1
  49. package/dist/services/core/websocket/types.js.map +1 -1
  50. package/dist/services/index.js +1 -1
  51. package/dist/services/index.js.map +1 -1
  52. package/dist/services/task/AutoWrapup.js +1 -1
  53. package/dist/services/task/AutoWrapup.js.map +1 -1
  54. package/dist/services/task/TaskManager.js +177 -56
  55. package/dist/services/task/TaskManager.js.map +1 -1
  56. package/dist/services/task/TaskUtils.js +122 -5
  57. package/dist/services/task/TaskUtils.js.map +1 -1
  58. package/dist/services/task/constants.js +3 -1
  59. package/dist/services/task/constants.js.map +1 -1
  60. package/dist/services/task/contact.js +0 -2
  61. package/dist/services/task/contact.js.map +1 -1
  62. package/dist/services/task/dialer.js.map +1 -1
  63. package/dist/services/task/index.js +46 -40
  64. package/dist/services/task/index.js.map +1 -1
  65. package/dist/services/task/types.js +377 -4
  66. package/dist/services/task/types.js.map +1 -1
  67. package/dist/types/cc.d.ts +6 -0
  68. package/dist/types/index.d.ts +1 -1
  69. package/dist/types/metrics/constants.d.ts +4 -0
  70. package/dist/types/services/config/types.d.ts +4 -4
  71. package/dist/types/services/core/Utils.d.ts +32 -17
  72. package/dist/types/services/core/constants.d.ts +14 -0
  73. package/dist/types/services/task/TaskUtils.d.ts +59 -3
  74. package/dist/types/services/task/constants.d.ts +2 -0
  75. package/dist/types/services/task/types.d.ts +57 -13
  76. package/dist/types.js +5 -0
  77. package/dist/types.js.map +1 -1
  78. package/dist/utils/PageCache.js +1 -1
  79. package/dist/utils/PageCache.js.map +1 -1
  80. package/dist/webex-config.js.map +1 -1
  81. package/dist/webex.js +2 -2
  82. package/dist/webex.js.map +1 -1
  83. package/package.json +8 -8
  84. package/src/cc.ts +12 -0
  85. package/src/index.ts +1 -0
  86. package/src/metrics/behavioral-events.ts +12 -0
  87. package/src/metrics/constants.ts +4 -0
  88. package/src/services/config/types.ts +2 -2
  89. package/src/services/core/Utils.ts +101 -85
  90. package/src/services/core/constants.ts +16 -0
  91. package/src/services/task/TaskManager.ts +204 -36
  92. package/src/services/task/TaskUtils.ts +145 -5
  93. package/src/services/task/constants.ts +2 -0
  94. package/src/services/task/index.ts +50 -63
  95. package/src/services/task/types.ts +60 -13
  96. package/test/unit/spec/cc.ts +1 -0
  97. package/test/unit/spec/metrics/behavioral-events.ts +14 -0
  98. package/test/unit/spec/services/core/Utils.ts +262 -31
  99. package/test/unit/spec/services/task/TaskManager.ts +748 -5
  100. package/test/unit/spec/services/task/TaskUtils.ts +311 -9
  101. package/test/unit/spec/services/task/index.ts +323 -68
  102. package/umd/contact-center.min.js +2 -2
  103. package/umd/contact-center.min.js.map +1 -1
package/dist/webex.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_merge","_interopRequireDefault","require","_webexCore","_safeBuffer","_webexConfig","obj","__esModule","default","global","Buffer","Webex","WebexCore","extend","webex","version","init","attrs","config","merge","_default","exports"],"sources":["webex.js"],"sourcesContent":["import merge from 'lodash/merge';\nimport WebexCore from '@webex/webex-core';\nimport {Buffer} from 'safe-buffer';\nimport '@webex/plugin-authorization';\nimport '@webex/internal-plugin-mercury';\nimport '@webex/plugin-logger';\nimport '@webex/internal-plugin-support';\n\nimport './index';\n\nimport config from './webex-config';\n\n/**\n * Ensures global Buffer is defined, which is required for SDK functionality in some environments.\n * @ignore\n */\nif (!global.Buffer) {\n global.Buffer = Buffer;\n}\n\n/**\n * Webex SDK class extended from the core SDK.\n * Includes custom configuration and plugin registration for CC (Contact Center) use cases.\n * @ignore\n */\nconst Webex = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\n/**\n * Initializes a new Webex instance with merged configuration.\n *\n * @param {Object} [attrs={}] - Initialization attributes.\n * @param {Object} [attrs.config] - Optional custom config to override defaults.\n * @param {Object} [attrs.config.logger] - Logging configuration.\n * @param {string} [attrs.config.logger.level='info'] - Logging level (e.g., 'debug', 'info').\n * @param {string} [attrs.config.logger.bufferLogLevel='log'] - Log buffering level for log uploads.\n * @param {Object} [attrs.config.cc] - Contact Center (CC) specific configurations.\n * @param {boolean} [attrs.config.cc.allowMultiLogin=false] - Whether to allow multiple logins.\n * @param {boolean} [attrs.config.cc.allowAutomatedRelogin=true] - Whether to allow automated re-login.\n * @param {string} [attrs.config.cc.clientType='WebexCCSDK'] - Type of the client.\n * @param {boolean} [attrs.config.cc.isKeepAliveEnabled=false] - Whether to enable keep-alive functionality.\n * @param {boolean} [attrs.config.cc.force=true] - Whether to force specific CC configurations.\n * @param {Object} [attrs.config.cc.metrics] - Metrics configuration for CC.\n * @param {string} [attrs.config.cc.metrics.clientName='WEBEX_JS_SDK'] - Metrics client name.\n * @param {string} [attrs.config.cc.metrics.clientType='WebexCCSDK'] - Metrics client type.\n * @returns {Webex} A new Webex instance.\n *\n * @see {@link https://developer.webex.com/meeting/docs/sdks/webex-meetings-sdk-web-quickstart#webex-object-attribute-reference} - Webex Object Attribute Reference for SDK Configuration.\n *\n * This configuration merges the default `webex-config` with any custom configuration provided as `attrs.config`.\n * The merged configuration governs various SDK behaviors, such as authorization, logging, and CC-specific settings.\n *\n * @example <caption>Basic Usage</caption>\n * import Webex from '@webex/contact-center';\n *\n * // Initialize Webex SDK with default configuration\n * const webex = Webex.init();\n *\n * @example <caption>Custom Configuration</caption>\n * import Webex from '@webex/contact-center';\n *\n * const customConfig = {\n * logger: {\n * level: 'debug', // Enable debug logging\n * bufferLogLevel: 'log', // Used for upload logs\n * },\n * credentials: {\n * client_id: 'your-client-id', // Replace with your Webex application's client ID\n * client_secret: 'your-client-secret', // Replace with your Webex application's client secret\n * redirect_uri: 'https://your-redirect-uri', // Replace with your app's redirect URI\n * },\n * cc: {\n * allowMultiLogin: false, // Disallow multiple logins\n * allowAutomatedRelogin: true, // Enable automated re-login\n * clientType: 'WebexCCSDK', // Specify the Contact Center client type\n * isKeepAliveEnabled: false, // Disable keep-alive functionality\n * force: true, // Force CC-specific configurations\n * metrics: {\n * clientName: 'WEBEX_JS_SDK', // Metrics client name\n * clientType: 'WebexCCSDK', // Metrics client type\n * },\n * },\n * };\n *\n * // Initialize Webex SDK with custom configuration\n * const webex = Webex.init({ config: customConfig });\n */\nWebex.init = function init(attrs = {}) {\n attrs.config = merge({}, config, attrs.config);\n\n return new Webex(attrs);\n};\n\nexport default Webex;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AAEA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC;AACA;AACA;AACA;AACA,IAAI,CAACG,MAAM,CAACC,MAAM,EAAE;EAClBD,MAAM,CAACC,MAAM,GAAGA,kBAAM;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAGC,kBAAS,CAACC,MAAM,CAAC;EAC7BC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAJ,KAAK,CAACK,IAAI,GAAG,SAASA,IAAIA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACrCA,KAAK,CAACC,MAAM,GAAG,IAAAC,cAAK,EAAC,CAAC,CAAC,EAAED,oBAAM,EAAED,KAAK,CAACC,MAAM,CAAC;EAE9C,OAAO,IAAIP,KAAK,CAACM,KAAK,CAAC;AACzB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEaG,KAAK"}
1
+ {"version":3,"names":["_merge","_interopRequireDefault","require","_webexCore","_safeBuffer","_webexConfig","e","__esModule","default","global","Buffer","Webex","WebexCore","extend","webex","version","init","attrs","config","merge","_default","exports"],"sources":["webex.js"],"sourcesContent":["import merge from 'lodash/merge';\nimport WebexCore from '@webex/webex-core';\nimport {Buffer} from 'safe-buffer';\nimport '@webex/plugin-authorization';\nimport '@webex/internal-plugin-mercury';\nimport '@webex/plugin-logger';\nimport '@webex/internal-plugin-support';\n\nimport './index';\n\nimport config from './webex-config';\n\n/**\n * Ensures global Buffer is defined, which is required for SDK functionality in some environments.\n * @ignore\n */\nif (!global.Buffer) {\n global.Buffer = Buffer;\n}\n\n/**\n * Webex SDK class extended from the core SDK.\n * Includes custom configuration and plugin registration for CC (Contact Center) use cases.\n * @ignore\n */\nconst Webex = WebexCore.extend({\n webex: true,\n version: PACKAGE_VERSION,\n});\n\n/**\n * Initializes a new Webex instance with merged configuration.\n *\n * @param {Object} [attrs={}] - Initialization attributes.\n * @param {Object} [attrs.config] - Optional custom config to override defaults.\n * @param {Object} [attrs.config.logger] - Logging configuration.\n * @param {string} [attrs.config.logger.level='info'] - Logging level (e.g., 'debug', 'info').\n * @param {string} [attrs.config.logger.bufferLogLevel='log'] - Log buffering level for log uploads.\n * @param {Object} [attrs.config.cc] - Contact Center (CC) specific configurations.\n * @param {boolean} [attrs.config.cc.allowMultiLogin=false] - Whether to allow multiple logins.\n * @param {boolean} [attrs.config.cc.allowAutomatedRelogin=true] - Whether to allow automated re-login.\n * @param {string} [attrs.config.cc.clientType='WebexCCSDK'] - Type of the client.\n * @param {boolean} [attrs.config.cc.isKeepAliveEnabled=false] - Whether to enable keep-alive functionality.\n * @param {boolean} [attrs.config.cc.force=true] - Whether to force specific CC configurations.\n * @param {Object} [attrs.config.cc.metrics] - Metrics configuration for CC.\n * @param {string} [attrs.config.cc.metrics.clientName='WEBEX_JS_SDK'] - Metrics client name.\n * @param {string} [attrs.config.cc.metrics.clientType='WebexCCSDK'] - Metrics client type.\n * @returns {Webex} A new Webex instance.\n *\n * @see {@link https://developer.webex.com/meeting/docs/sdks/webex-meetings-sdk-web-quickstart#webex-object-attribute-reference} - Webex Object Attribute Reference for SDK Configuration.\n *\n * This configuration merges the default `webex-config` with any custom configuration provided as `attrs.config`.\n * The merged configuration governs various SDK behaviors, such as authorization, logging, and CC-specific settings.\n *\n * @example <caption>Basic Usage</caption>\n * import Webex from '@webex/contact-center';\n *\n * // Initialize Webex SDK with default configuration\n * const webex = Webex.init();\n *\n * @example <caption>Custom Configuration</caption>\n * import Webex from '@webex/contact-center';\n *\n * const customConfig = {\n * logger: {\n * level: 'debug', // Enable debug logging\n * bufferLogLevel: 'log', // Used for upload logs\n * },\n * credentials: {\n * client_id: 'your-client-id', // Replace with your Webex application's client ID\n * client_secret: 'your-client-secret', // Replace with your Webex application's client secret\n * redirect_uri: 'https://your-redirect-uri', // Replace with your app's redirect URI\n * },\n * cc: {\n * allowMultiLogin: false, // Disallow multiple logins\n * allowAutomatedRelogin: true, // Enable automated re-login\n * clientType: 'WebexCCSDK', // Specify the Contact Center client type\n * isKeepAliveEnabled: false, // Disable keep-alive functionality\n * force: true, // Force CC-specific configurations\n * metrics: {\n * clientName: 'WEBEX_JS_SDK', // Metrics client name\n * clientType: 'WebexCCSDK', // Metrics client type\n * },\n * },\n * };\n *\n * // Initialize Webex SDK with custom configuration\n * const webex = Webex.init({ config: customConfig });\n */\nWebex.init = function init(attrs = {}) {\n attrs.config = merge({}, config, attrs.config);\n\n return new Webex(attrs);\n};\n\nexport default Webex;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AAEA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC;AACA;AACA;AACA;AACA,IAAI,CAACG,MAAM,CAACC,MAAM,EAAE;EAClBD,MAAM,CAACC,MAAM,GAAGA,kBAAM;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GAAGC,kBAAS,CAACC,MAAM,CAAC;EAC7BC,KAAK,EAAE,IAAI;EACXC,OAAO;AACT,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAJ,KAAK,CAACK,IAAI,GAAG,SAASA,IAAIA,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE;EACrCA,KAAK,CAACC,MAAM,GAAG,IAAAC,cAAK,EAAC,CAAC,CAAC,EAAED,oBAAM,EAAED,KAAK,CAACC,MAAM,CAAC;EAE9C,OAAO,IAAIP,KAAK,CAACM,KAAK,CAAC;AACzB,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEaG,KAAK","ignoreList":[]}
package/package.json CHANGED
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@types/platform": "1.3.4",
48
- "@webex/calling": "3.10.0-next.1",
49
- "@webex/internal-plugin-mercury": "3.9.0-next.7",
50
- "@webex/internal-plugin-metrics": "3.9.0-next.6",
51
- "@webex/internal-plugin-support": "3.9.0-next.9",
52
- "@webex/plugin-authorization": "3.9.0-next.6",
53
- "@webex/plugin-logger": "3.9.0-next.6",
54
- "@webex/webex-core": "3.9.0-next.6",
48
+ "@webex/calling": "3.10.0-next.15",
49
+ "@webex/internal-plugin-mercury": "3.10.0-next.4",
50
+ "@webex/internal-plugin-metrics": "3.10.0-next.4",
51
+ "@webex/internal-plugin-support": "3.10.0-next.4",
52
+ "@webex/plugin-authorization": "3.10.0-next.4",
53
+ "@webex/plugin-logger": "3.10.0-next.4",
54
+ "@webex/webex-core": "3.10.0-next.4",
55
55
  "jest-html-reporters": "3.0.11",
56
56
  "lodash": "^4.17.21"
57
57
  },
@@ -80,5 +80,5 @@
80
80
  "typedoc": "^0.25.0",
81
81
  "typescript": "4.9.5"
82
82
  },
83
- "version": "3.10.0-next.2"
83
+ "version": "3.10.0-next.21"
84
84
  }
package/src/cc.ts CHANGED
@@ -396,6 +396,16 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
396
396
  this.trigger(TASK_EVENTS.TASK_HYDRATE, task);
397
397
  };
398
398
 
399
+ /**
400
+ * Handles task merged events when tasks are combined eg: EPDN merge/transfer
401
+ * @private
402
+ * @param {ITask} task The task object that has been merged
403
+ */
404
+ private handleTaskMerged = (task: ITask) => {
405
+ // @ts-ignore
406
+ this.trigger(TASK_EVENTS.TASK_MERGED, task);
407
+ };
408
+
399
409
  /**
400
410
  * Sets up event listeners for incoming tasks and task hydration
401
411
  * Subscribes to task events from the task manager
@@ -404,6 +414,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
404
414
  private incomingTaskListener() {
405
415
  this.taskManager.on(TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);
406
416
  this.taskManager.on(TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);
417
+ this.taskManager.on(TASK_EVENTS.TASK_MERGED, this.handleTaskMerged);
407
418
  }
408
419
 
409
420
  /**
@@ -698,6 +709,7 @@ export default class ContactCenter extends WebexPlugin implements IContactCenter
698
709
  // TODO: Make profile a singleton to make it available throughout app/sdk so we dont need to inject info everywhere
699
710
  this.taskManager.setWrapupData(this.agentConfig.wrapUpData);
700
711
  this.taskManager.setAgentId(this.agentConfig.agentId);
712
+ this.taskManager.setWebRtcEnabled(this.agentConfig.webRtcEnabled);
701
713
 
702
714
  if (
703
715
  this.agentConfig.webRtcEnabled &&
package/src/index.ts CHANGED
@@ -126,6 +126,7 @@ export type {
126
126
  AgentContact,
127
127
  /** Task interface */
128
128
  ITask,
129
+ Interaction,
129
130
  TaskData,
130
131
  /** Task response */
131
132
  TaskResponse,
@@ -289,6 +289,18 @@ const eventTaxonomyMap: Record<string, BehavioralEventTaxonomy> = {
289
289
  target: 'task_accept_consult',
290
290
  verb: 'fail',
291
291
  },
292
+ [METRIC_EVENT_NAMES.TASK_AUTO_ANSWER_SUCCESS]: {
293
+ product,
294
+ agent: 'user',
295
+ target: 'task_auto_answer',
296
+ verb: 'complete',
297
+ },
298
+ [METRIC_EVENT_NAMES.TASK_AUTO_ANSWER_FAILED]: {
299
+ product,
300
+ agent: 'user',
301
+ target: 'task_auto_answer',
302
+ verb: 'fail',
303
+ },
292
304
  [METRIC_EVENT_NAMES.TASK_OUTDIAL_SUCCESS]: {
293
305
  product,
294
306
  agent: 'user',
@@ -49,6 +49,8 @@ type Enum<T extends Record<string, unknown>> = T[keyof T];
49
49
  * @property {string} TASK_PAUSE_RECORDING_FAILED - Event name for failed pause of recording.
50
50
  * @property {string} TASK_ACCEPT_CONSULT_SUCCESS - Event name for successful consult acceptance.
51
51
  * @property {string} TASK_ACCEPT_CONSULT_FAILED - Event name for failed consult acceptance.
52
+ * @property {string} TASK_AUTO_ANSWER_SUCCESS - Event name for successful auto-answer.
53
+ * @property {string} TASK_AUTO_ANSWER_FAILED - Event name for failed auto-answer.
52
54
  *
53
55
  * @property {string} TASK_CONFERENCE_START_SUCCESS - Event name for successful conference start.
54
56
  * @property {string} TASK_CONFERENCE_START_FAILED - Event name for failed conference start.
@@ -117,6 +119,8 @@ export const METRIC_EVENT_NAMES = {
117
119
  TASK_PAUSE_RECORDING_FAILED: 'Task Pause Recording Failed',
118
120
  TASK_ACCEPT_CONSULT_SUCCESS: 'Task Accept Consult Success',
119
121
  TASK_ACCEPT_CONSULT_FAILED: 'Task Accept Consult Failed',
122
+ TASK_AUTO_ANSWER_SUCCESS: 'Task Auto Answer Success',
123
+ TASK_AUTO_ANSWER_FAILED: 'Task Auto Answer Failed',
120
124
 
121
125
  // Conference Tasks
122
126
  TASK_CONFERENCE_START_SUCCESS: 'Task Conference Start Success',
@@ -63,8 +63,6 @@ export const CC_TASK_EVENTS = {
63
63
  AGENT_CONFERENCE_TRANSFERRED: 'AgentConferenceTransferred',
64
64
  /** Event emitted when conference transfer fails */
65
65
  AGENT_CONFERENCE_TRANSFER_FAILED: 'AgentConferenceTransferFailed',
66
- /** Event emitted when consulted participant is moving/being transferred */
67
- CONSULTED_PARTICIPANT_MOVING: 'ConsultedParticipantMoving',
68
66
  /** Event emitted for post-call activity by participant */
69
67
  PARTICIPANT_POST_CALL_ACTIVITY: 'ParticipantPostCallActivity',
70
68
  /** Event emitted when contact is blind transferred */
@@ -91,6 +89,8 @@ export const CC_TASK_EVENTS = {
91
89
  CONTACT_RECORDING_RESUME_FAILED: 'ContactRecordingResumeFailed',
92
90
  /** Event emitted when contact ends */
93
91
  CONTACT_ENDED: 'ContactEnded',
92
+ /** Event emitted when contact is merged */
93
+ CONTACT_MERGED: 'ContactMerged',
94
94
  /** Event emitted when ending contact fails */
95
95
  AGENT_CONTACT_END_FAILED: 'AgentContactEndFailed',
96
96
  /** Event emitted when agent enters wrap-up state */
@@ -6,11 +6,10 @@ import WebexRequest from './WebexRequest';
6
6
  import {
7
7
  TaskData,
8
8
  ConsultTransferPayLoad,
9
- ConsultConferenceData,
10
- consultConferencePayloadData,
11
9
  CONSULT_TRANSFER_DESTINATION_TYPE,
12
10
  Interaction,
13
11
  } from '../task/types';
12
+ import {PARTICIPANT_TYPES, STATE_CONSULT} from './constants';
14
13
 
15
14
  /**
16
15
  * Extracts common error details from a Webex request payload.
@@ -218,59 +217,118 @@ export const createErrDetailsObject = (errObj: WebexRequestPayload) => {
218
217
  };
219
218
 
220
219
  /**
221
- * Derives the consult transfer destination type based on the provided task data.
220
+ * Gets the consulted agent ID from the media object by finding the agent
221
+ * in the consult media participants (excluding the current agent).
222
222
  *
223
- * Logic parity with desktop behavior:
224
- * - If agent action is dialing a number (DN/EPDN/ENTRYPOINT):
225
- * - ENTRYPOINT/EPDN map to ENTRYPOINT
226
- * - DN maps to DIALNUMBER
227
- * - Otherwise defaults to AGENT
223
+ * @param media - The media object from the interaction
224
+ * @param agentId - The current agent's ID to exclude from the search
225
+ * @returns The consulted agent ID, or empty string if none found
226
+ */
227
+ export const getConsultedAgentId = (media: Interaction['media'], agentId: string): string => {
228
+ let consultParticipants: string[] = [];
229
+ let consultedParticipantId = '';
230
+
231
+ Object.keys(media).forEach((key) => {
232
+ if (media[key].mType === STATE_CONSULT) {
233
+ consultParticipants = media[key].participants;
234
+ }
235
+ });
236
+
237
+ if (consultParticipants.includes(agentId)) {
238
+ const id = consultParticipants.find((participant) => participant !== agentId);
239
+ consultedParticipantId = id || consultedParticipantId;
240
+ }
241
+
242
+ return consultedParticipantId;
243
+ };
244
+
245
+ /**
246
+ * Gets the destination agent ID for CBT (Capacity Based Team) scenarios.
247
+ * CBT refers to teams created in Control Hub with capacity-based routing
248
+ * (as opposed to agent-based routing). This handles cases where the consulted
249
+ * participant is not directly in participants but can be found by matching
250
+ * the dial number (dn).
228
251
  *
229
- * @param taskData - The task data used to infer the agent action and destination type
230
- * @returns The normalized destination type to be used for consult transfer
252
+ * @param interaction - The interaction object
253
+ * @param consultingAgent - The consulting agent identifier
254
+ * @returns The destination agent ID for CBT scenarios, or empty string if none found
231
255
  */
256
+ export const getDestAgentIdForCBT = (interaction: Interaction, consultingAgent: string): string => {
257
+ const participants = interaction.participants;
258
+ let destAgentIdForCBT = '';
259
+
260
+ // Check if this is a CBT scenario (consultingAgent exists but not directly in participants)
261
+ if (consultingAgent && !participants[consultingAgent]) {
262
+ const foundEntry = Object.entries(participants).find(
263
+ ([, participant]: [string, Interaction['participants'][string]]) => {
264
+ return (
265
+ participant.pType.toLowerCase() === PARTICIPANT_TYPES.DN &&
266
+ participant.type === PARTICIPANT_TYPES.AGENT &&
267
+ participant.dn === consultingAgent
268
+ );
269
+ }
270
+ );
271
+
272
+ if (foundEntry) {
273
+ destAgentIdForCBT = foundEntry[0];
274
+ }
275
+ }
276
+
277
+ return destAgentIdForCBT;
278
+ };
279
+
232
280
  /**
233
- * Checks if a participant type represents a non-customer participant.
234
- * Non-customer participants include agents, dial numbers, entry point dial numbers,
235
- * and entry points.
281
+ * Calculates the destination agent ID for consult operations.
282
+ *
283
+ * @param interaction - The interaction object
284
+ * @param agentId - The current agent's ID
285
+ * @returns The destination agent ID
236
286
  */
237
- const isNonCustomerParticipant = (participantType: string): boolean => {
238
- return (
239
- participantType === 'Agent' ||
240
- participantType === 'DN' ||
241
- participantType === 'EpDn' ||
242
- participantType === 'entryPoint'
243
- );
287
+ export const calculateDestAgentId = (interaction: Interaction, agentId: string): string => {
288
+ const consultingAgent = getConsultedAgentId(interaction.media, agentId);
289
+
290
+ // Check if this is a CBT (Capacity Based Team) scenario
291
+ // If not CBT, the function will return empty string and we'll use the normal flow
292
+ const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);
293
+ if (destAgentIdCBT) {
294
+ return destAgentIdCBT;
295
+ }
296
+
297
+ return interaction.participants[consultingAgent]?.type === PARTICIPANT_TYPES.EP_DN
298
+ ? interaction.participants[consultingAgent]?.epId
299
+ : interaction.participants[consultingAgent]?.id;
244
300
  };
245
301
 
246
302
  /**
247
- * Gets the destination agent ID from participants data by finding the first
248
- * non-customer participant that is not the current agent and is not in wrap-up state.
303
+ * Calculates the destination agent ID for fetching destination type.
249
304
  *
250
- * @param participants - The participants data from the interaction
251
- * @param agentId - The current agent's ID to exclude from the search
252
- * @returns The destination agent ID, or empty string if none found
305
+ * @param interaction - The interaction object
306
+ * @param agentId - The current agent's ID
307
+ * @returns The destination agent ID for determining destination type
253
308
  */
254
- export const getDestinationAgentId = (
255
- participants: Interaction['participants'],
256
- agentId: string
257
- ): string => {
258
- let id = '';
259
-
260
- if (participants) {
261
- Object.keys(participants).forEach((participant) => {
262
- const participantData = participants[participant];
263
- if (
264
- isNonCustomerParticipant(participantData.type) &&
265
- participantData.id !== agentId &&
266
- !participantData.isWrapUp
267
- ) {
268
- id = participantData.id;
269
- }
270
- });
309
+ export const calculateDestType = (interaction: Interaction, agentId: string): string => {
310
+ const consultingAgent = getConsultedAgentId(interaction.media, agentId);
311
+
312
+ // Check if this is a CBT (Capacity Based Team) scenario, otherwise use consultingAgent
313
+ const destAgentIdCBT = getDestAgentIdForCBT(interaction, consultingAgent);
314
+ const destinationaegntId = destAgentIdCBT || consultingAgent;
315
+ const destAgentType = destinationaegntId
316
+ ? interaction.participants[destinationaegntId]?.pType
317
+ : undefined;
318
+ if (destAgentType) {
319
+ if (destAgentType === 'DN') {
320
+ return CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;
321
+ }
322
+ if (destAgentType === 'EP-DN') {
323
+ return CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;
324
+ }
325
+ // Keep the existing destinationType if it's something else (like "agent" or "Agent")
326
+ // Convert "Agent" to lowercase for consistency
327
+
328
+ return destAgentType.toLowerCase();
271
329
  }
272
330
 
273
- return id;
331
+ return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
274
332
  };
275
333
 
276
334
  export const deriveConsultTransferDestinationType = (
@@ -286,45 +344,3 @@ export const deriveConsultTransferDestinationType = (
286
344
 
287
345
  return CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
288
346
  };
289
-
290
- /**
291
- * Builds consult conference parameter data using EXACT Agent Desktop logic.
292
- * This matches the Agent Desktop's consultConference implementation exactly.
293
- *
294
- * @param dataPassed - Original consultation data from Agent Desktop format
295
- * @param interactionIdPassed - The interaction ID for the task
296
- * @returns Object with interactionId and ConsultConferenceData matching Agent Desktop format
297
- * @public
298
- */
299
- export const buildConsultConferenceParamData = (
300
- dataPassed: consultConferencePayloadData,
301
- interactionIdPassed: string
302
- ): {interactionId: string; data: ConsultConferenceData} => {
303
- const data: ConsultConferenceData = {
304
- // Include agentId if present in input data
305
- ...('agentId' in dataPassed && {agentId: dataPassed.agentId}),
306
- // Handle destAgentId from consultation data
307
- to: dataPassed.destAgentId,
308
- destinationType: '',
309
- };
310
-
311
- // Agent Desktop destination type logic
312
- if ('destinationType' in dataPassed) {
313
- if (dataPassed.destinationType === 'DN') {
314
- data.destinationType = CONSULT_TRANSFER_DESTINATION_TYPE.DIALNUMBER;
315
- } else if (dataPassed.destinationType === 'EP_DN') {
316
- data.destinationType = CONSULT_TRANSFER_DESTINATION_TYPE.ENTRYPOINT;
317
- } else {
318
- // Keep the existing destinationType if it's something else (like "agent" or "Agent")
319
- // Convert "Agent" to lowercase for consistency
320
- data.destinationType = dataPassed.destinationType.toLowerCase();
321
- }
322
- } else {
323
- data.destinationType = CONSULT_TRANSFER_DESTINATION_TYPE.AGENT;
324
- }
325
-
326
- return {
327
- interactionId: interactionIdPassed,
328
- data,
329
- };
330
- };
@@ -64,6 +64,22 @@ export const CONNECTIVITY_CHECK_INTERVAL = 5000;
64
64
  */
65
65
  export const CLOSE_SOCKET_TIMEOUT = 16000;
66
66
 
67
+ /**
68
+ * Constants for participant types, destination types, and interaction states
69
+ * @ignore
70
+ */
71
+ export const PARTICIPANT_TYPES = {
72
+ /** Participant type for Entry Point Dial Number */
73
+ EP_DN: 'EpDn',
74
+ /** Participant type for dial number */
75
+ DN: 'dn',
76
+ /** Participant type for Agent */
77
+ AGENT: 'Agent',
78
+ };
79
+
80
+ /** Interaction state for consultation */
81
+ export const STATE_CONSULT = 'consult';
82
+
67
83
  // Method names for core services
68
84
  export const METHODS = {
69
85
  // WebexRequest methods