@webex/cc-store 1.28.0-ccwidgets.40 → 1.28.0-ccwidgets.41

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/dist/index.js CHANGED
@@ -12280,7 +12280,7 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
12280
12280
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12281
12281
 
12282
12282
  "use strict";
12283
- eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst mobx_1 = __webpack_require__(/*! mobx */ \"../../../node_modules/mobx/dist/mobx.esm.js\");\nconst contact_center_1 = __importDefault(__webpack_require__(/*! webex/contact-center */ \"./node_modules/webex/dist/contact-center.js\"));\nclass Store {\n constructor() {\n this.teams = [];\n this.loginOptions = [];\n this.idleCodes = [];\n this.agentId = '';\n this.currentTheme = 'LIGHT';\n this.wrapupCodes = [];\n this.incomingTask = null;\n this.currentTask = null;\n this.isAgentLoggedIn = false;\n this.deviceType = '';\n this.taskList = [];\n this.wrapupRequired = false;\n this.currentState = '';\n this.customState = null;\n this.showMultipleLoginAlert = false;\n (0, mobx_1.makeAutoObservable)(this, {\n cc: mobx_1.observable.ref,\n });\n }\n static getInstance() {\n if (!Store.instance) {\n console.log('Creating new store instance');\n Store.instance = new Store();\n }\n console.log('Returning store instance');\n return Store.instance;\n }\n registerCC(webex) {\n if (webex) {\n this.cc = webex.cc;\n }\n if (typeof webex === 'undefined' && typeof this.cc === 'undefined') {\n throw new Error('Webex SDK not initialized');\n }\n this.logger = this.cc.LoggerProxy;\n return this.cc\n .register()\n .then((response) => {\n this.teams = response.teams;\n this.loginOptions = response.webRtcEnabled\n ? response.loginVoiceOptions\n : response.loginVoiceOptions.filter((option) => option !== 'BROWSER');\n this.idleCodes = response.idleCodes;\n this.agentId = response.agentId;\n this.wrapupCodes = response.wrapupCodes;\n this.isAgentLoggedIn = response.isAgentLoggedIn;\n this.deviceType = response.deviceType;\n this.currentState = response.lastStateAuxCodeId;\n this.lastStateChangeTimestamp = response.lastStateChangeTimestamp;\n this.lastIdleCodeChangeTimestamp = response.lastIdleCodeChangeTimestamp;\n })\n .catch((error) => {\n this.logger.error(`Error registering contact center: ${error}`, {\n module: 'cc-store#store.ts',\n method: 'registerCC',\n });\n return Promise.reject(error);\n });\n }\n init(options, setupEventListeners) {\n if ('webex' in options) {\n // If devs decide to go with webex, they will have to listen to the ready event before calling init\n // This has to be documented\n setupEventListeners(options.webex.cc);\n return this.registerCC(options.webex);\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new Error('Webex SDK failed to initialize'));\n }, 6000);\n const webex = contact_center_1.default.init({\n config: options.webexConfig,\n credentials: {\n access_token: options.access_token,\n },\n });\n webex.once('ready', () => {\n setupEventListeners(webex.cc);\n clearTimeout(timer);\n this.registerCC(webex)\n .then(() => {\n resolve();\n })\n .catch((error) => {\n reject(error);\n });\n });\n });\n }\n}\nexports[\"default\"] = Store;\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/store.ts?");
12283
+ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst mobx_1 = __webpack_require__(/*! mobx */ \"../../../node_modules/mobx/dist/mobx.esm.js\");\nconst contact_center_1 = __importDefault(__webpack_require__(/*! webex/contact-center */ \"./node_modules/webex/dist/contact-center.js\"));\nclass Store {\n constructor() {\n this.teams = [];\n this.loginOptions = [];\n this.idleCodes = [];\n this.agentId = '';\n this.currentTheme = 'LIGHT';\n this.wrapupCodes = [];\n this.incomingTask = null;\n this.currentTask = null;\n this.isAgentLoggedIn = false;\n this.deviceType = '';\n this.taskList = [];\n this.wrapupRequired = false;\n this.currentState = '';\n this.customState = null;\n this.consultCompleted = false;\n this.consultInitiated = false;\n this.consultAccepted = false;\n this.consultStartTimeStamp = undefined;\n this.showMultipleLoginAlert = false;\n this.callControlAudio = null;\n this.consultOfferReceived = false;\n (0, mobx_1.makeAutoObservable)(this, {\n cc: mobx_1.observable.ref,\n });\n }\n static getInstance() {\n if (!Store.instance) {\n console.log('Creating new store instance');\n Store.instance = new Store();\n }\n console.log('Returning store instance');\n return Store.instance;\n }\n registerCC(webex) {\n if (webex) {\n this.cc = webex.cc;\n }\n if (typeof webex === 'undefined' && typeof this.cc === 'undefined') {\n throw new Error('Webex SDK not initialized');\n }\n this.logger = this.cc.LoggerProxy;\n return this.cc\n .register()\n .then((response) => {\n this.teams = response.teams;\n this.loginOptions = response.webRtcEnabled\n ? response.loginVoiceOptions\n : response.loginVoiceOptions.filter((option) => option !== 'BROWSER');\n this.idleCodes = response.idleCodes;\n this.agentId = response.agentId;\n this.wrapupCodes = response.wrapupCodes;\n this.isAgentLoggedIn = response.isAgentLoggedIn;\n this.deviceType = response.deviceType;\n this.currentState = response.lastStateAuxCodeId;\n this.lastStateChangeTimestamp = response.lastStateChangeTimestamp;\n this.lastIdleCodeChangeTimestamp = response.lastIdleCodeChangeTimestamp;\n })\n .catch((error) => {\n this.logger.error(`Error registering contact center: ${error}`, {\n module: 'cc-store#store.ts',\n method: 'registerCC',\n });\n return Promise.reject(error);\n });\n }\n init(options, setupEventListeners) {\n if ('webex' in options) {\n // If devs decide to go with webex, they will have to listen to the ready event before calling init\n // This has to be documented\n setupEventListeners(options.webex.cc);\n return this.registerCC(options.webex);\n }\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new Error('Webex SDK failed to initialize'));\n }, 6000);\n const webex = contact_center_1.default.init({\n config: options.webexConfig,\n credentials: {\n access_token: options.access_token,\n },\n });\n webex.once('ready', () => {\n setupEventListeners(webex.cc);\n clearTimeout(timer);\n this.registerCC(webex)\n .then(() => {\n resolve();\n })\n .catch((error) => {\n reject(error);\n });\n });\n });\n }\n}\nexports[\"default\"] = Store;\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/store.ts?");
12284
12284
 
12285
12285
  /***/ }),
12286
12286
 
@@ -12291,7 +12291,7 @@ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {
12291
12291
  /***/ ((__unused_webpack_module, exports) => {
12292
12292
 
12293
12293
  "use strict";
12294
- eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TASK_EVENTS = exports.CC_EVENTS = void 0;\nvar TASK_EVENTS;\n(function (TASK_EVENTS) {\n TASK_EVENTS[\"TASK_INCOMING\"] = \"task:incoming\";\n TASK_EVENTS[\"TASK_ASSIGNED\"] = \"task:assigned\";\n TASK_EVENTS[\"TASK_MEDIA\"] = \"task:media\";\n TASK_EVENTS[\"TASK_HOLD\"] = \"task:hold\";\n TASK_EVENTS[\"TASK_UNHOLD\"] = \"task:unhold\";\n TASK_EVENTS[\"TASK_CONSULT\"] = \"task:consult\";\n TASK_EVENTS[\"TASK_CONSULT_END\"] = \"task:consultEnd\";\n TASK_EVENTS[\"TASK_CONSULT_ACCEPT\"] = \"task:consultAccepted\";\n TASK_EVENTS[\"TASK_PAUSE\"] = \"task:pause\";\n TASK_EVENTS[\"TASK_RESUME\"] = \"task:resume\";\n TASK_EVENTS[\"TASK_END\"] = \"task:end\";\n TASK_EVENTS[\"TASK_WRAPUP\"] = \"task:wrapup\";\n TASK_EVENTS[\"TASK_REJECT\"] = \"task:rejected\";\n TASK_EVENTS[\"TASK_HYDRATE\"] = \"task:hydrate\";\n TASK_EVENTS[\"AGENT_CONTACT_ASSIGNED\"] = \"AgentContactAssigned\";\n TASK_EVENTS[\"CONTACT_RECORDING_PAUSED\"] = \"ContactRecordingPaused\";\n TASK_EVENTS[\"CONTACT_RECORDING_RESUMED\"] = \"ContactRecordingResumed\";\n TASK_EVENTS[\"AGENT_WRAPPEDUP\"] = \"AgentWrappedUp\";\n})(TASK_EVENTS || (exports.TASK_EVENTS = TASK_EVENTS = {})); // TODO: remove this once cc sdk exports this enum\n// Events that are received on the contact center SDK\n// TODO: Export & Import these constants from SDK\nvar CC_EVENTS;\n(function (CC_EVENTS) {\n CC_EVENTS[\"AGENT_DN_REGISTERED\"] = \"AgentDNRegistered\";\n CC_EVENTS[\"AGENT_LOGOUT_SUCCESS\"] = \"AgentLogoutSuccess\";\n CC_EVENTS[\"AGENT_STATION_LOGIN_SUCCESS\"] = \"AgentStationLoginSuccess\";\n CC_EVENTS[\"AGENT_MULTI_LOGIN\"] = \"agent:multiLogin\";\n CC_EVENTS[\"AGENT_STATE_CHANGE\"] = \"agent:stateChange\";\n CC_EVENTS[\"AGENT_RELOGIN_SUCCESS\"] = \"AgentReloginSuccess\";\n})(CC_EVENTS || (exports.CC_EVENTS = CC_EVENTS = {}));\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/store.types.ts?");
12294
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ENGAGED_USERNAME = exports.ENGAGED_LABEL = exports.TASK_EVENTS = exports.CC_EVENTS = void 0;\nvar TASK_EVENTS;\n(function (TASK_EVENTS) {\n TASK_EVENTS[\"TASK_INCOMING\"] = \"task:incoming\";\n TASK_EVENTS[\"TASK_ASSIGNED\"] = \"task:assigned\";\n TASK_EVENTS[\"TASK_MEDIA\"] = \"task:media\";\n TASK_EVENTS[\"TASK_HOLD\"] = \"task:hold\";\n TASK_EVENTS[\"TASK_UNHOLD\"] = \"task:unhold\";\n TASK_EVENTS[\"TASK_CONSULT\"] = \"task:consult\";\n TASK_EVENTS[\"TASK_CONSULT_END\"] = \"task:consultEnd\";\n TASK_EVENTS[\"TASK_CONSULT_ACCEPTED\"] = \"task:consultAccepted\";\n TASK_EVENTS[\"TASK_PAUSE\"] = \"task:pause\";\n TASK_EVENTS[\"TASK_RESUME\"] = \"task:resume\";\n TASK_EVENTS[\"TASK_END\"] = \"task:end\";\n TASK_EVENTS[\"TASK_WRAPUP\"] = \"task:wrapup\";\n TASK_EVENTS[\"TASK_REJECT\"] = \"task:rejected\";\n TASK_EVENTS[\"TASK_HYDRATE\"] = \"task:hydrate\";\n TASK_EVENTS[\"TASK_CONSULTING\"] = \"task:consulting\";\n TASK_EVENTS[\"AGENT_CONTACT_ASSIGNED\"] = \"AgentContactAssigned\";\n TASK_EVENTS[\"CONTACT_RECORDING_PAUSED\"] = \"ContactRecordingPaused\";\n TASK_EVENTS[\"CONTACT_RECORDING_RESUMED\"] = \"ContactRecordingResumed\";\n TASK_EVENTS[\"AGENT_WRAPPEDUP\"] = \"AgentWrappedUp\";\n TASK_EVENTS[\"AGENT_CONSULT_CREATED\"] = \"AgentConsultCreated\";\n})(TASK_EVENTS || (exports.TASK_EVENTS = TASK_EVENTS = {})); // TODO: remove this once cc sdk exports this enum\n// Events that are received on the contact center SDK\n// TODO: Export & Import these constants from SDK\nvar CC_EVENTS;\n(function (CC_EVENTS) {\n CC_EVENTS[\"AGENT_DN_REGISTERED\"] = \"AgentDNRegistered\";\n CC_EVENTS[\"AGENT_LOGOUT_SUCCESS\"] = \"AgentLogoutSuccess\";\n CC_EVENTS[\"AGENT_STATION_LOGIN_SUCCESS\"] = \"AgentStationLoginSuccess\";\n CC_EVENTS[\"AGENT_MULTI_LOGIN\"] = \"agent:multiLogin\";\n CC_EVENTS[\"AGENT_STATE_CHANGE\"] = \"agent:stateChange\";\n CC_EVENTS[\"AGENT_RELOGIN_SUCCESS\"] = \"AgentReloginSuccess\";\n CC_EVENTS[\"AGENT_OFFER_CONSULT\"] = \"AgentOfferConsult\";\n})(CC_EVENTS || (exports.CC_EVENTS = CC_EVENTS = {}));\nconst ENGAGED_LABEL = 'ENGAGED';\nexports.ENGAGED_LABEL = ENGAGED_LABEL;\nconst ENGAGED_USERNAME = 'Engaged';\nexports.ENGAGED_USERNAME = ENGAGED_USERNAME;\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/store.types.ts?");
12295
12295
 
12296
12296
  /***/ }),
12297
12297
 
@@ -12302,7 +12302,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
12302
12302
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12303
12303
 
12304
12304
  "use strict";
12305
- eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst store_types_1 = __webpack_require__(/*! ./store.types */ \"./src/store.types.ts\");\nconst store_1 = __importDefault(__webpack_require__(/*! ./store */ \"./src/store.ts\"));\nconst mobx_1 = __webpack_require__(/*! mobx */ \"../../../node_modules/mobx/dist/mobx.esm.js\");\nclass StoreWrapper {\n constructor() {\n this.setCurrentTheme = (theme) => {\n this.store.currentTheme = theme;\n };\n this.setShowMultipleLoginAlert = (value) => {\n this.store.showMultipleLoginAlert = value;\n };\n this.setDeviceType = (option) => {\n this.store.deviceType = option;\n };\n this.setCurrentState = (state) => {\n (0, mobx_1.runInAction)(() => {\n this.store.currentState = state;\n this.store.customState = null;\n });\n };\n this.setLastStateChangeTimestamp = (timestamp) => {\n (0, mobx_1.runInAction)(() => {\n this.store.lastStateChangeTimestamp = timestamp;\n });\n };\n this.setLastIdleCodeChangeTimestamp = (timestamp) => {\n (0, mobx_1.runInAction)(() => {\n this.store.lastIdleCodeChangeTimestamp = timestamp;\n });\n };\n this.setIsAgentLoggedIn = (value) => {\n this.store.isAgentLoggedIn = value;\n };\n this.setWrapupRequired = (value) => {\n this.store.wrapupRequired = value;\n };\n this.setCurrentTask = (task) => {\n (0, mobx_1.runInAction)(() => {\n this.store.currentTask = task;\n });\n };\n this.setIncomingTask = (task) => {\n this.store.incomingTask = task;\n };\n this.setTaskList = (taskList) => {\n this.store.taskList = taskList;\n };\n this.setWrapupCodes = (wrapupCodes) => {\n this.store.wrapupCodes = wrapupCodes;\n };\n this.setState = (state) => {\n if ('reset' in state) {\n (0, mobx_1.runInAction)(() => {\n this.store.customState = null;\n });\n return;\n }\n if ('id' in state) {\n (0, mobx_1.runInAction)(() => {\n this.setCurrentState(state.id);\n this.store.customState = null;\n });\n }\n else {\n (0, mobx_1.runInAction)(() => {\n this.store.customState = state;\n });\n }\n };\n this.setTaskRejected = (callback) => {\n this.onTaskRejected = callback;\n };\n this.setCCCallback = (event, callback) => {\n if (!callback)\n return;\n this.store.cc.on(event, callback);\n };\n this.setTaskCallback = (event, callback, taskId) => {\n if (!callback)\n return;\n const task = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (!task)\n return;\n task.on(event, callback);\n };\n this.removeCCCallback = (event) => {\n this.store.cc.off(event);\n };\n this.removeTaskCallback = (event, callback, taskId) => {\n if (!callback)\n return;\n const task = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (!task)\n return;\n task.off(event, callback);\n };\n this.registerCC = (webex) => {\n return this.store.registerCC(webex);\n };\n this.handleTaskRemove = (event) => {\n const taskId = event;\n // Remove the task from the taskList\n const taskToRemove = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (taskToRemove) {\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(taskToRemove, wrapupRequired));\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(taskToRemove.interactionId, reason));\n }\n const updateTaskList = this.store.taskList.filter((task) => task.data.interactionId !== taskId);\n (0, mobx_1.runInAction)(() => {\n var _a, _b;\n this.setTaskList(updateTaskList);\n this.setWrapupRequired(false);\n // Remove the task from currentTask or incomingTask if it is the same task\n if (((_a = this.store.currentTask) === null || _a === void 0 ? void 0 : _a.data.interactionId) === taskId) {\n this.setCurrentTask(null);\n }\n if (((_b = this.store.incomingTask) === null || _b === void 0 ? void 0 : _b.data.interactionId) === taskId) {\n this.setIncomingTask(null);\n }\n // reset the custom state\n this.setState({\n reset: true,\n });\n });\n };\n this.handleTaskEnd = (event, wrapupRequired) => {\n // If the call is ended by agent we get the task object in event.data\n // If the call is ended by customer we get the task object directly\n const task = event.data ? event.data : event;\n if (wrapupRequired) {\n this.setWrapupRequired(true);\n }\n else {\n this.handleTaskRemove(task.interactionId);\n }\n };\n this.handleTaskAssigned = (event) => {\n const task = event;\n (0, mobx_1.runInAction)(() => {\n this.setCurrentTask(task);\n this.setIncomingTask(null);\n this.setState({\n developerName: 'ENGAGED',\n name: 'Engaged',\n });\n });\n };\n this.handleTaskWrapUp = (event) => {\n const task = event;\n this.setWrapupRequired(false);\n this.handleTaskRemove(task.interactionId);\n };\n this.handleIncomingTask = (event) => {\n const task = event;\n if (this.store.taskList.some((t) => t.data.interactionId === task.data.interactionId)) {\n // Task already present in the taskList\n return;\n }\n // Attach event listeners to the task\n task.on(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(task, wrapupRequired));\n // When we receive TASK_ASSIGNED the task was accepted by the agent and we need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n // When we receive TASK_REJECT sdk changes the agent status\n // When we receive TASK_REJECT that means the task was not accepted by the agent and we wont need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(task.data.interactionId, reason));\n task.on(store_types_1.TASK_EVENTS.AGENT_WRAPPEDUP, this.handleTaskWrapUp);\n this.setIncomingTask(task);\n this.setTaskList([...this.store.taskList, task]);\n };\n this.handleStateChange = (data) => {\n var _a;\n if (data && typeof data === 'object' && data.type === 'AgentStateChangeSuccess') {\n const DEFAULT_CODE = '0'; // Default code when no aux code is present\n this.setCurrentState(((_a = data.auxCodeId) === null || _a === void 0 ? void 0 : _a.trim()) !== '' ? data.auxCodeId : DEFAULT_CODE);\n this.setLastStateChangeTimestamp(data.lastStateChangeTimestamp);\n this.setLastIdleCodeChangeTimestamp(data.lastIdleCodeChangeTimestamp);\n }\n };\n this.handleMultiLoginCloseSession = (data) => {\n if (data && typeof data === 'object' && data.type === 'AgentMultiLoginCloseSession') {\n this.setShowMultipleLoginAlert(true);\n }\n };\n this.handleTaskHydrate = (event) => {\n const task = event;\n task.on(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(task, wrapupRequired));\n // When we receive TASK_ASSIGNED the task was accepted by the agent and we need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n // When we receive TASK_REJECT sdk changes the agent status\n // When we receive TASK_REJECT that means the task was not accepted by the agent and we wont need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(task.data.interactionId, reason));\n task.on(store_types_1.TASK_EVENTS.AGENT_WRAPPEDUP, this.handleTaskWrapUp);\n if (!this.store.taskList.some((t) => t.data.interactionId === task.data.interactionId)) {\n this.setTaskList([...this.store.taskList, task]);\n }\n this.setCurrentTask(task);\n this.setState({\n developerName: 'ENGAGED',\n name: 'Engaged',\n });\n const { interaction, agentId } = task.data;\n const { state, isTerminated, participants } = interaction;\n // Update call control states\n if (isTerminated) {\n // wrapup\n const wrapupRequired = state === 'wrapUp' && !participants[agentId].isWrappedUp;\n this.setWrapupRequired(wrapupRequired);\n if (!wrapupRequired) {\n this.setState({\n reset: true,\n });\n }\n return;\n }\n };\n this.handleTaskReject = (taskId, reason) => {\n if (this.onTaskRejected) {\n this.onTaskRejected(reason || 'No reason provided');\n }\n this.handleTaskRemove(taskId);\n };\n this.getBuddyAgents = () => __awaiter(this, void 0, void 0, function* () {\n try {\n const response = yield this.store.cc.getBuddyAgents({\n mediaType: 'telephony',\n state: 'Available',\n });\n return response.data.agentList;\n }\n catch (error) {\n return Promise.reject(error);\n }\n });\n this.cleanUpStore = () => {\n (0, mobx_1.runInAction)(() => {\n this.setIsAgentLoggedIn(false);\n this.setDeviceType('');\n this.setIncomingTask(null);\n this.setCurrentTask(null);\n this.setTaskList([]);\n this.setWrapupRequired(false);\n this.setLastStateChangeTimestamp(undefined);\n this.setLastIdleCodeChangeTimestamp(undefined);\n this.setShowMultipleLoginAlert(false);\n });\n };\n this.setupIncomingTaskHandler = (ccSDK) => {\n let listenersAdded = false;\n const handleLogOut = () => {\n this.cleanUpStore();\n removeEventListeners();\n listenersAdded = false;\n };\n const addEventListeners = () => {\n ccSDK.on(store_types_1.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_STATE_CHANGE, this.handleStateChange);\n ccSDK.on(store_types_1.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_MULTI_LOGIN, this.handleMultiLoginCloseSession);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_LOGOUT_SUCCESS, handleLogOut);\n };\n const removeEventListeners = () => {\n ccSDK.off(store_types_1.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_STATE_CHANGE, this.handleStateChange);\n ccSDK.off(store_types_1.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_MULTI_LOGIN, this.handleMultiLoginCloseSession);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_LOGOUT_SUCCESS, handleLogOut);\n };\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n const handleLogin = (payload) => {\n (0, mobx_1.runInAction)(() => {\n var _a;\n this.setIsAgentLoggedIn(true);\n this.setDeviceType(payload.deviceType);\n this.setCurrentState(((_a = payload.auxCodeId) === null || _a === void 0 ? void 0 : _a.trim()) !== '' ? payload.auxCodeId : '0');\n this.setLastStateChangeTimestamp(payload.lastStateChangeTimestamp);\n this.setLastIdleCodeChangeTimestamp(payload.lastIdleCodeChangeTimestamp);\n });\n };\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_STATION_LOGIN_SUCCESS, handleLogin);\n [store_types_1.CC_EVENTS.AGENT_DN_REGISTERED, store_types_1.CC_EVENTS.AGENT_RELOGIN_SUCCESS].forEach((event) => {\n ccSDK.on(`${event}`, () => {\n if (!listenersAdded) {\n addEventListeners();\n listenersAdded = true;\n }\n });\n });\n };\n this.store = store_1.default.getInstance();\n }\n // Proxy all methods and properties of the original store\n get teams() {\n return this.store.teams;\n }\n get loginOptions() {\n return this.store.loginOptions;\n }\n get cc() {\n return this.store.cc;\n }\n get logger() {\n return this.store.logger;\n }\n get idleCodes() {\n return this.store.idleCodes.filter((code) => {\n return code.name === 'RONA' || !code.isSystem;\n });\n }\n get agentId() {\n return this.store.agentId;\n }\n get deviceType() {\n return this.store.deviceType;\n }\n get wrapupCodes() {\n return this.store.wrapupCodes;\n }\n get currentTask() {\n return this.store.currentTask;\n }\n get isAgentLoggedIn() {\n return this.store.isAgentLoggedIn;\n }\n get taskList() {\n return this.store.taskList;\n }\n get incomingTask() {\n return this.store.incomingTask;\n }\n get wrapupRequired() {\n return this.store.wrapupRequired;\n }\n get currentState() {\n return this.store.currentState;\n }\n get lastStateChangeTimestamp() {\n return this.store.lastStateChangeTimestamp;\n }\n get lastIdleCodeChangeTimestamp() {\n return this.store.lastIdleCodeChangeTimestamp;\n }\n get showMultipleLoginAlert() {\n return this.store.showMultipleLoginAlert;\n }\n get currentTheme() {\n return this.store.currentTheme;\n }\n get customState() {\n return this.store.customState;\n }\n init(options) {\n return this.store.init(options, this.setupIncomingTaskHandler);\n }\n}\n// Create and export a single instance of the wrapper\nconst storeWrapper = new StoreWrapper();\nexports[\"default\"] = storeWrapper;\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/storeEventsWrapper.ts?");
12305
+ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nconst store_types_1 = __webpack_require__(/*! ./store.types */ \"./src/store.types.ts\");\nconst store_1 = __importDefault(__webpack_require__(/*! ./store */ \"./src/store.ts\"));\nconst mobx_1 = __webpack_require__(/*! mobx */ \"../../../node_modules/mobx/dist/mobx.esm.js\");\nclass StoreWrapper {\n constructor() {\n this.setCurrentTheme = (theme) => {\n this.store.currentTheme = theme;\n };\n this.setShowMultipleLoginAlert = (value) => {\n this.store.showMultipleLoginAlert = value;\n };\n this.setDeviceType = (option) => {\n this.store.deviceType = option;\n };\n this.setCurrentState = (state) => {\n (0, mobx_1.runInAction)(() => {\n this.store.currentState = state;\n this.store.customState = null;\n });\n };\n this.setLastStateChangeTimestamp = (timestamp) => {\n (0, mobx_1.runInAction)(() => {\n this.store.lastStateChangeTimestamp = timestamp;\n });\n };\n this.setLastIdleCodeChangeTimestamp = (timestamp) => {\n (0, mobx_1.runInAction)(() => {\n this.store.lastIdleCodeChangeTimestamp = timestamp;\n });\n };\n this.setIsAgentLoggedIn = (value) => {\n this.store.isAgentLoggedIn = value;\n };\n this.setWrapupRequired = (value) => {\n this.store.wrapupRequired = value;\n };\n this.setCurrentTask = (task) => {\n (0, mobx_1.runInAction)(() => {\n this.store.currentTask = task;\n });\n };\n this.setIncomingTask = (task) => {\n this.store.incomingTask = task;\n };\n this.setTaskList = (taskList) => {\n this.store.taskList = taskList;\n };\n this.setWrapupCodes = (wrapupCodes) => {\n this.store.wrapupCodes = wrapupCodes;\n };\n this.setConsultCompleted = (value) => {\n this.store.consultCompleted = value;\n };\n this.setConsultInitiated = (value) => {\n this.store.consultInitiated = value;\n };\n this.setConsultAccepted = (value) => {\n this.store.consultAccepted = value;\n };\n this.setConsultOfferReceived = (value) => {\n this.store.consultOfferReceived = value;\n };\n this.setConsultStartTimeStamp = (timestamp) => {\n this.store.consultStartTimeStamp = timestamp;\n };\n this.setCallControlAudio = (audio) => {\n this.store.callControlAudio = audio;\n };\n this.setState = (state) => {\n if ('reset' in state) {\n (0, mobx_1.runInAction)(() => {\n this.store.customState = null;\n });\n return;\n }\n if ('id' in state) {\n (0, mobx_1.runInAction)(() => {\n this.setCurrentState(state.id);\n this.store.customState = null;\n });\n }\n else {\n (0, mobx_1.runInAction)(() => {\n this.store.customState = state;\n });\n }\n };\n this.setTaskRejected = (callback) => {\n this.onTaskRejected = callback;\n };\n this.setCCCallback = (event, callback) => {\n if (!callback)\n return;\n this.store.cc.on(event, callback);\n };\n this.setTaskCallback = (event, callback, taskId) => {\n if (!callback)\n return;\n const task = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (!task)\n return;\n task.on(event, callback);\n };\n this.removeCCCallback = (event) => {\n this.store.cc.off(event);\n };\n this.removeTaskCallback = (event, callback, taskId) => {\n if (!callback)\n return;\n const task = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (!task)\n return;\n task.off(event, callback);\n };\n this.registerCC = (webex) => {\n return this.store.registerCC(webex);\n };\n this.handleTaskRemove = (event) => {\n const taskId = event;\n // Remove the task from the taskList\n const taskToRemove = this.store.taskList.find((task) => task.data.interactionId === taskId);\n if (taskToRemove) {\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(taskToRemove, wrapupRequired));\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(taskToRemove.interactionId, reason));\n taskToRemove.off(store_types_1.TASK_EVENTS.AGENT_WRAPPEDUP, this.handleTaskWrapUp);\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_CONSULTING, this.handleConsulting);\n taskToRemove.off(store_types_1.CC_EVENTS.AGENT_OFFER_CONSULT, this.handleConsultOffer);\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_CONSULT_END, this.handleConsultEnd);\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_CONSULT_ACCEPTED, this.handleConsultAccepted);\n taskToRemove.off(store_types_1.TASK_EVENTS.AGENT_CONSULT_CREATED, this.handleConsultCreated);\n if (this.deviceType === 'BROWSER') {\n taskToRemove.off(store_types_1.TASK_EVENTS.TASK_MEDIA, this.handleTaskMedia);\n this.setCallControlAudio(null);\n }\n }\n const updateTaskList = this.store.taskList.filter((task) => task.data.interactionId !== taskId);\n (0, mobx_1.runInAction)(() => {\n var _a, _b;\n this.setTaskList(updateTaskList);\n this.setWrapupRequired(false);\n this.setConsultAccepted(false);\n this.setConsultInitiated(false);\n this.setConsultCompleted(false);\n // Remove the task from currentTask or incomingTask if it is the same task\n if (((_a = this.store.currentTask) === null || _a === void 0 ? void 0 : _a.data.interactionId) === taskId) {\n this.setCurrentTask(null);\n }\n if (((_b = this.store.incomingTask) === null || _b === void 0 ? void 0 : _b.data.interactionId) === taskId) {\n this.setIncomingTask(null);\n }\n // reset the custom state\n this.setState({\n reset: true,\n });\n });\n };\n this.handleTaskEnd = (event, wrapupRequired) => {\n // If the call is ended by agent we get the task object in event.data\n // If the call is ended by customer we get the task object directly\n const task = event.data ? event.data : event;\n if (wrapupRequired) {\n this.setWrapupRequired(true);\n }\n else {\n this.handleTaskRemove(task.interactionId);\n }\n };\n this.handleTaskAssigned = (event) => {\n const task = event;\n (0, mobx_1.runInAction)(() => {\n if (this.consultAccepted) {\n this.setConsultAccepted(false);\n this.setConsultInitiated(false);\n this.setConsultCompleted(false);\n }\n this.setCurrentTask(task);\n this.setIncomingTask(null);\n this.setState({\n developerName: store_types_1.ENGAGED_LABEL,\n name: store_types_1.ENGAGED_USERNAME,\n });\n });\n };\n this.handleTaskWrapUp = (event) => {\n const task = event;\n this.setWrapupRequired(false);\n this.handleTaskRemove(task.interactionId);\n };\n this.handleTaskMedia = (track) => {\n this.setCallControlAudio(new MediaStream([track]));\n };\n // Case to handle multi session\n this.handleConsultCreated = () => {\n this.setConsultInitiated(true);\n this.setConsultStartTimeStamp(Date.now());\n };\n this.handleConsulting = (event) => {\n this.setConsultCompleted(true);\n this.setCurrentTask(event);\n this.handleIncomingTask(event);\n this.setConsultStartTimeStamp(Date.now());\n };\n this.handleConsultEnd = (event) => {\n const task = event;\n this.setConsultInitiated(false);\n if (this.consultAccepted) {\n this.setConsultAccepted(false);\n this.handleTaskRemove(task.data.interactionId);\n }\n else if (this.consultOfferReceived) {\n this.setConsultOfferReceived(false);\n this.handleTaskRemove(task.data.interactionId);\n }\n this.setConsultCompleted(false);\n this.setConsultStartTimeStamp(null);\n };\n this.handleConsultOffer = () => {\n this.setConsultOfferReceived(true);\n };\n this.handleConsultAccepted = (event) => {\n const task = event;\n (0, mobx_1.runInAction)(() => {\n this.setCurrentTask(task);\n this.setIncomingTask(null);\n this.setConsultAccepted(true);\n this.setConsultStartTimeStamp(Date.now());\n this.setConsultCompleted(true);\n this.setState({\n developerName: store_types_1.ENGAGED_LABEL,\n name: store_types_1.ENGAGED_USERNAME,\n });\n if (this.deviceType === 'BROWSER') {\n task.on(store_types_1.TASK_EVENTS.TASK_MEDIA, this.handleTaskMedia);\n }\n });\n };\n this.handleIncomingTask = (event) => {\n const task = event;\n if (this.store.taskList.some((t) => t.data.interactionId === task.data.interactionId)) {\n // Task already present in the taskList\n return;\n }\n // Attach event listeners to the task\n task.on(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(task, wrapupRequired));\n // When we receive TASK_ASSIGNED the task was accepted by the agent and we need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n task.on(store_types_1.TASK_EVENTS.AGENT_CONSULT_CREATED, this.handleConsultCreated);\n if (this.deviceType === 'BROWSER') {\n task.on(store_types_1.TASK_EVENTS.TASK_MEDIA, this.handleTaskMedia);\n }\n // When we receive TASK_REJECT sdk changes the agent status\n // When we receive TASK_REJECT that means the task was not accepted by the agent and we wont need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(task.data.interactionId, reason));\n task.on(store_types_1.TASK_EVENTS.AGENT_WRAPPEDUP, this.handleTaskWrapUp);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULTING, this.handleConsulting);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULT_ACCEPTED, this.handleConsultAccepted);\n task.on(store_types_1.CC_EVENTS.AGENT_OFFER_CONSULT, this.handleConsultOffer);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULT_END, this.handleConsultEnd);\n this.setIncomingTask(task);\n this.setTaskList([...this.store.taskList, task]);\n };\n this.handleStateChange = (data) => {\n var _a;\n if (data && typeof data === 'object' && data.type === 'AgentStateChangeSuccess') {\n const DEFAULT_CODE = '0'; // Default code when no aux code is present\n this.setCurrentState(((_a = data.auxCodeId) === null || _a === void 0 ? void 0 : _a.trim()) !== '' ? data.auxCodeId : DEFAULT_CODE);\n this.setLastStateChangeTimestamp(data.lastStateChangeTimestamp);\n this.setLastIdleCodeChangeTimestamp(data.lastIdleCodeChangeTimestamp);\n }\n };\n this.handleMultiLoginCloseSession = (data) => {\n if (data && typeof data === 'object' && data.type === 'AgentMultiLoginCloseSession') {\n this.setShowMultipleLoginAlert(true);\n }\n };\n this.handleTaskHydrate = (event) => {\n const task = event;\n task.on(store_types_1.TASK_EVENTS.TASK_END, ({ wrapupRequired }) => this.handleTaskEnd(task, wrapupRequired));\n // When we receive TASK_ASSIGNED the task was accepted by the agent and we need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_ASSIGNED, this.handleTaskAssigned);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULT_ACCEPTED, this.handleConsultAccepted);\n task.on(store_types_1.TASK_EVENTS.AGENT_CONSULT_CREATED, this.handleConsultCreated);\n // When we receive TASK_REJECT sdk changes the agent status\n // When we receive TASK_REJECT that means the task was not accepted by the agent and we wont need wrap up\n task.on(store_types_1.TASK_EVENTS.TASK_REJECT, (reason) => this.handleTaskReject(task.data.interactionId, reason));\n task.on(store_types_1.TASK_EVENTS.AGENT_WRAPPEDUP, this.handleTaskWrapUp);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULTING, this.handleConsulting);\n task.on(store_types_1.CC_EVENTS.AGENT_OFFER_CONSULT, this.handleConsultOffer);\n task.on(store_types_1.TASK_EVENTS.TASK_CONSULT_END, this.handleConsultEnd);\n if (this.deviceType === 'BROWSER') {\n task.on(store_types_1.TASK_EVENTS.TASK_MEDIA, this.handleTaskMedia);\n }\n if (!this.store.taskList.some((t) => t.data.interactionId === task.data.interactionId)) {\n this.setTaskList([...this.store.taskList, task]);\n }\n this.setCurrentTask(task);\n this.setIncomingTask(null);\n if (task.data.interaction.state === 'consulting') {\n if (task.data.isConsulted) {\n this.setConsultAccepted(true);\n }\n else {\n this.setConsultInitiated(true);\n }\n this.setConsultStartTimeStamp(Date.now());\n this.setConsultCompleted(true);\n }\n this.setState({\n developerName: store_types_1.ENGAGED_LABEL,\n name: store_types_1.ENGAGED_USERNAME,\n });\n const { interaction, agentId } = task.data;\n const { state, isTerminated, participants } = interaction;\n // Update call control states\n if (isTerminated) {\n // wrapup\n const wrapupRequired = state === 'wrapUp' && !participants[agentId].isWrappedUp;\n this.setWrapupRequired(wrapupRequired);\n if (!wrapupRequired) {\n this.setState({\n reset: true,\n });\n }\n return;\n }\n };\n this.handleTaskReject = (taskId, reason) => {\n if (this.onTaskRejected) {\n this.onTaskRejected(reason || 'No reason provided');\n }\n this.handleTaskRemove(taskId);\n };\n this.getBuddyAgents = () => __awaiter(this, void 0, void 0, function* () {\n try {\n const response = yield this.store.cc.getBuddyAgents({\n mediaType: 'telephony',\n state: 'Available',\n });\n return response.data.agentList;\n }\n catch (error) {\n return Promise.reject(error);\n }\n });\n this.cleanUpStore = () => {\n (0, mobx_1.runInAction)(() => {\n this.setIsAgentLoggedIn(false);\n this.setDeviceType('');\n this.setIncomingTask(null);\n this.setCurrentTask(null);\n this.setTaskList([]);\n this.setWrapupRequired(false);\n this.setLastStateChangeTimestamp(undefined);\n this.setLastIdleCodeChangeTimestamp(undefined);\n this.setShowMultipleLoginAlert(false);\n this.setConsultStartTimeStamp(undefined);\n });\n };\n this.setupIncomingTaskHandler = (ccSDK) => {\n let listenersAdded = false;\n const handleLogOut = () => {\n this.cleanUpStore();\n removeEventListeners();\n listenersAdded = false;\n };\n const addEventListeners = () => {\n ccSDK.on(store_types_1.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_STATE_CHANGE, this.handleStateChange);\n ccSDK.on(store_types_1.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_MULTI_LOGIN, this.handleMultiLoginCloseSession);\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_LOGOUT_SUCCESS, handleLogOut);\n };\n const removeEventListeners = () => {\n ccSDK.off(store_types_1.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_STATE_CHANGE, this.handleStateChange);\n ccSDK.off(store_types_1.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_MULTI_LOGIN, this.handleMultiLoginCloseSession);\n ccSDK.off(store_types_1.CC_EVENTS.AGENT_LOGOUT_SUCCESS, handleLogOut);\n };\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n const handleLogin = (payload) => {\n (0, mobx_1.runInAction)(() => {\n var _a;\n this.setIsAgentLoggedIn(true);\n this.setDeviceType(payload.deviceType);\n this.setCurrentState(((_a = payload.auxCodeId) === null || _a === void 0 ? void 0 : _a.trim()) !== '' ? payload.auxCodeId : '0');\n this.setLastStateChangeTimestamp(payload.lastStateChangeTimestamp);\n this.setLastIdleCodeChangeTimestamp(payload.lastIdleCodeChangeTimestamp);\n });\n };\n ccSDK.on(store_types_1.CC_EVENTS.AGENT_STATION_LOGIN_SUCCESS, handleLogin);\n [store_types_1.CC_EVENTS.AGENT_DN_REGISTERED, store_types_1.CC_EVENTS.AGENT_RELOGIN_SUCCESS].forEach((event) => {\n ccSDK.on(`${event}`, () => {\n if (!listenersAdded) {\n addEventListeners();\n listenersAdded = true;\n }\n });\n });\n };\n this.store = store_1.default.getInstance();\n }\n // Proxy all methods and properties of the original store\n get teams() {\n return this.store.teams;\n }\n get loginOptions() {\n return this.store.loginOptions;\n }\n get cc() {\n return this.store.cc;\n }\n get logger() {\n return this.store.logger;\n }\n get idleCodes() {\n return this.store.idleCodes.filter((code) => {\n return code.name === 'RONA' || !code.isSystem;\n });\n }\n get agentId() {\n return this.store.agentId;\n }\n get deviceType() {\n return this.store.deviceType;\n }\n get wrapupCodes() {\n return this.store.wrapupCodes;\n }\n get currentTask() {\n return this.store.currentTask;\n }\n get isAgentLoggedIn() {\n return this.store.isAgentLoggedIn;\n }\n get taskList() {\n return this.store.taskList;\n }\n get incomingTask() {\n return this.store.incomingTask;\n }\n get wrapupRequired() {\n return this.store.wrapupRequired;\n }\n get currentState() {\n return this.store.currentState;\n }\n get lastStateChangeTimestamp() {\n return this.store.lastStateChangeTimestamp;\n }\n get lastIdleCodeChangeTimestamp() {\n return this.store.lastIdleCodeChangeTimestamp;\n }\n get showMultipleLoginAlert() {\n return this.store.showMultipleLoginAlert;\n }\n get currentTheme() {\n return this.store.currentTheme;\n }\n get customState() {\n return this.store.customState;\n }\n get consultCompleted() {\n return this.store.consultCompleted;\n }\n get consultInitiated() {\n return this.store.consultInitiated;\n }\n get consultAccepted() {\n return this.store.consultAccepted;\n }\n get consultStartTimeStamp() {\n return this.store.consultStartTimeStamp;\n }\n get callControlAudio() {\n return this.store.callControlAudio;\n }\n get consultOfferReceived() {\n return this.store.consultOfferReceived;\n }\n init(options) {\n return this.store.init(options, this.setupIncomingTaskHandler);\n }\n}\n// Create and export a single instance of the wrapper\nconst storeWrapper = new StoreWrapper();\nexports[\"default\"] = storeWrapper;\n\n\n//# sourceURL=webpack://@webex/cc-store/./src/storeEventsWrapper.ts?");
12306
12306
 
12307
12307
  /***/ }),
12308
12308
 
@@ -18,9 +18,15 @@ declare class Store implements IStore {
18
18
  wrapupRequired: boolean;
19
19
  currentState: string;
20
20
  customState: ICustomState;
21
+ consultCompleted: boolean;
22
+ consultInitiated: boolean;
23
+ consultAccepted: boolean;
24
+ consultStartTimeStamp: any;
21
25
  lastStateChangeTimestamp?: number;
22
26
  lastIdleCodeChangeTimestamp?: number;
23
27
  showMultipleLoginAlert: boolean;
28
+ callControlAudio: MediaStream | null;
29
+ consultOfferReceived: boolean;
24
30
  constructor();
25
31
  static getInstance(): Store;
26
32
  registerCC(webex?: WithWebex['webex']): Promise<void>;
@@ -44,6 +44,12 @@ interface IStore {
44
44
  showMultipleLoginAlert: boolean;
45
45
  currentTheme: string;
46
46
  customState: ICustomState;
47
+ consultCompleted: boolean;
48
+ consultInitiated: boolean;
49
+ consultAccepted: boolean;
50
+ consultStartTimeStamp?: number;
51
+ callControlAudio: MediaStream | null;
52
+ consultOfferReceived: boolean;
47
53
  init(params: InitParams, callback: (ccSDK: IContactCenter) => void): Promise<void>;
48
54
  registerCC(webex?: WithWebex['webex']): Promise<void>;
49
55
  }
@@ -62,6 +68,10 @@ interface IStoreWrapper extends IStore {
62
68
  setIsAgentLoggedIn(value: boolean): void;
63
69
  setWrapupCodes(wrapupCodes: IWrapupCode[]): void;
64
70
  setState(state: IdleCode | ICustomState): void;
71
+ setConsultCompleted(value: boolean): void;
72
+ setConsultInitiated(value: boolean): void;
73
+ setConsultAccepted(value: boolean): void;
74
+ setConsultStartTimeStamp(timestamp: number): void;
65
75
  }
66
76
  interface IWrapupCode {
67
77
  id: string;
@@ -75,17 +85,19 @@ declare enum TASK_EVENTS {
75
85
  TASK_UNHOLD = "task:unhold",
76
86
  TASK_CONSULT = "task:consult",
77
87
  TASK_CONSULT_END = "task:consultEnd",
78
- TASK_CONSULT_ACCEPT = "task:consultAccepted",
88
+ TASK_CONSULT_ACCEPTED = "task:consultAccepted",
79
89
  TASK_PAUSE = "task:pause",
80
90
  TASK_RESUME = "task:resume",
81
91
  TASK_END = "task:end",
82
92
  TASK_WRAPUP = "task:wrapup",
83
93
  TASK_REJECT = "task:rejected",
84
94
  TASK_HYDRATE = "task:hydrate",
95
+ TASK_CONSULTING = "task:consulting",
85
96
  AGENT_CONTACT_ASSIGNED = "AgentContactAssigned",
86
97
  CONTACT_RECORDING_PAUSED = "ContactRecordingPaused",
87
98
  CONTACT_RECORDING_RESUMED = "ContactRecordingResumed",
88
- AGENT_WRAPPEDUP = "AgentWrappedUp"
99
+ AGENT_WRAPPEDUP = "AgentWrappedUp",
100
+ AGENT_CONSULT_CREATED = "AgentConsultCreated"
89
101
  }
90
102
  declare enum CC_EVENTS {
91
103
  AGENT_DN_REGISTERED = "AgentDNRegistered",
@@ -93,7 +105,8 @@ declare enum CC_EVENTS {
93
105
  AGENT_STATION_LOGIN_SUCCESS = "AgentStationLoginSuccess",
94
106
  AGENT_MULTI_LOGIN = "agent:multiLogin",
95
107
  AGENT_STATE_CHANGE = "agent:stateChange",
96
- AGENT_RELOGIN_SUCCESS = "AgentReloginSuccess"
108
+ AGENT_RELOGIN_SUCCESS = "AgentReloginSuccess",
109
+ AGENT_OFFER_CONSULT = "AgentOfferConsult"
97
110
  }
98
111
  interface ICustomStateSet {
99
112
  name: string;
@@ -103,5 +116,7 @@ interface ICustomStateReset {
103
116
  reset: boolean;
104
117
  }
105
118
  type ICustomState = ICustomStateSet | ICustomStateReset;
119
+ declare const ENGAGED_LABEL = "ENGAGED";
120
+ declare const ENGAGED_USERNAME = "Engaged";
106
121
  export type { IContactCenter, ITask, Profile, Team, AgentLogin, WithWebex, IdleCode, InitParams, IStore, ILogger, IWrapupCode, IStoreWrapper, ICustomState, DestinationType, BuddyDetails, };
107
- export { CC_EVENTS, TASK_EVENTS };
122
+ export { CC_EVENTS, TASK_EVENTS, ENGAGED_LABEL, ENGAGED_USERNAME };
@@ -22,6 +22,12 @@ declare class StoreWrapper implements IStoreWrapper {
22
22
  get showMultipleLoginAlert(): boolean;
23
23
  get currentTheme(): string;
24
24
  get customState(): ICustomState;
25
+ get consultCompleted(): boolean;
26
+ get consultInitiated(): boolean;
27
+ get consultAccepted(): boolean;
28
+ get consultStartTimeStamp(): number;
29
+ get callControlAudio(): MediaStream;
30
+ get consultOfferReceived(): boolean;
25
31
  setCurrentTheme: (theme: string) => void;
26
32
  setShowMultipleLoginAlert: (value: boolean) => void;
27
33
  setDeviceType: (option: string) => void;
@@ -34,6 +40,12 @@ declare class StoreWrapper implements IStoreWrapper {
34
40
  setIncomingTask: (task: ITask) => void;
35
41
  setTaskList: (taskList: ITask[]) => void;
36
42
  setWrapupCodes: (wrapupCodes: IWrapupCode[]) => void;
43
+ setConsultCompleted: (value: boolean) => void;
44
+ setConsultInitiated: (value: boolean) => void;
45
+ setConsultAccepted: (value: boolean) => void;
46
+ setConsultOfferReceived: (value: boolean) => void;
47
+ setConsultStartTimeStamp: (timestamp: number) => void;
48
+ setCallControlAudio: (audio: MediaStream | null) => void;
37
49
  setState: (state: ICustomState | IdleCode) => void;
38
50
  setTaskRejected: (callback: ((reason: string) => void) | undefined) => void;
39
51
  setCCCallback: (event: CC_EVENTS | TASK_EVENTS, callback: any) => void;
@@ -46,6 +58,12 @@ declare class StoreWrapper implements IStoreWrapper {
46
58
  handleTaskEnd: (event: any, wrapupRequired: any) => void;
47
59
  handleTaskAssigned: (event: any) => void;
48
60
  handleTaskWrapUp: (event: any) => void;
61
+ handleTaskMedia: (track: any) => void;
62
+ handleConsultCreated: () => void;
63
+ handleConsulting: (event: any) => void;
64
+ handleConsultEnd: (event: any) => void;
65
+ handleConsultOffer: () => void;
66
+ handleConsultAccepted: (event: any) => void;
49
67
  handleIncomingTask: (event: any) => void;
50
68
  handleStateChange: (data: any) => void;
51
69
  handleMultiLoginCloseSession: (data: any) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webex/cc-store",
3
3
  "description": "Webex Contact Center Widgets: Widgets Store",
4
- "version": "1.28.0-ccwidgets.40",
4
+ "version": "1.28.0-ccwidgets.41",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "publishConfig": {