@webex/cc-store 1.28.0-ccwidgets.42 → 1.28.0-ccwidgets.43

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 (2) hide show
  1. package/dist/index.js +102 -36
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2115,7 +2115,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
2115
2115
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2116
2116
 
2117
2117
  "use strict";
2118
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WxCallBackendConnector: () => (/* binding */ WxCallBackendConnector)\n/* harmony export */ });\n/* harmony import */ var _SDKConnector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../SDKConnector */ \"../../../node_modules/@webex/calling/dist/module/SDKConnector/index.js\");\n/* harmony import */ var _common_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/constants */ \"../../../node_modules/@webex/calling/dist/module/common/constants.js\");\n/* harmony import */ var _common_Utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/Utils */ \"../../../node_modules/@webex/calling/dist/module/common/Utils.js\");\n/* harmony import */ var _common_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/types */ \"../../../node_modules/@webex/calling/dist/module/common/types.js\");\n/* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Logger */ \"../../../node_modules/@webex/calling/dist/module/Logger/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/calling/dist/module/Voicemail/constants.js\");\n\n\n\n\n\n\nclass WxCallBackendConnector {\n xsiEndpoint;\n userId;\n context;\n sdkConnector;\n xsiVoiceMessageURI;\n webex;\n constructor(webex, logger) {\n this.sdkConnector = _SDKConnector__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n if (!this.sdkConnector.getWebex()) {\n _SDKConnector__WEBPACK_IMPORTED_MODULE_0__[\"default\"].setWebex(webex);\n }\n this.context = Math.random().toString(_constants__WEBPACK_IMPORTED_MODULE_5__.RADIX_RAND).substring(_constants__WEBPACK_IMPORTED_MODULE_5__.PREFIX);\n this.webex = this.sdkConnector.getWebex();\n this.userId = this.webex.internal.device.userId;\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setLogger(logger.level, _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE);\n }\n init() {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'init',\n };\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info('Initializing Webex calling voicemail connector', loggerContext);\n const response = this.setXsiVoiceMessageURI();\n return response;\n }\n getSDKConnector() {\n return this.sdkConnector;\n }\n async setXsiVoiceMessageURI() {\n let responseDetails;\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'setXsiVoiceMessageURI',\n };\n this.xsiEndpoint = await (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.getXsiActionEndpoint)(this.webex, loggerContext, _common_types__WEBPACK_IMPORTED_MODULE_3__.CALLING_BACKEND.WXC);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`XsiEndpoint is ${this.xsiEndpoint}`, loggerContext);\n if (this.userId) {\n this.xsiVoiceMessageURI = `${this.xsiEndpoint}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.BW_XSI_ENDPOINT_VERSION}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.USER}/${this.userId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.VOICE_MESSAGING_MESSAGES}`;\n responseDetails = {\n statusCode: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_STATUS_CODE,\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n }\n return responseDetails;\n }\n async getVoicemailList(offset, offsetLimit, sort, refresh) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailList',\n };\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Offset: ${offset} Offset limit: ${offsetLimit} Sort type:${sort}`, loggerContext);\n let messageinfo;\n if (refresh) {\n const urlXsi = `${this.xsiVoiceMessageURI}${_constants__WEBPACK_IMPORTED_MODULE_5__.JSON_FORMAT}`;\n const sortParam = Object.values(_common_types__WEBPACK_IMPORTED_MODULE_3__.SORT).includes(sort) ? sort : _common_types__WEBPACK_IMPORTED_MODULE_3__.SORT.DEFAULT;\n try {\n const response = await this.webex.request({\n uri: `${urlXsi}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n });\n const voicemailListResponse = response.body;\n if (Object.keys(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList).length === 0) {\n messageinfo = [];\n }\n else if (!Array.isArray(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList?.messageInfo)) {\n messageinfo = Array(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList?.messageInfo);\n }\n else {\n messageinfo = voicemailListResponse?.VoiceMessagingMessages?.messageInfoList\n ?.messageInfo;\n messageinfo = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.getSortedVoicemailList)(messageinfo, sortParam);\n }\n (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.storeVoicemailList)(this.context, messageinfo);\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n const { messages, moreVMAvailable } = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.fetchVoicemailList)(this.context, offset, offsetLimit, loggerContext);\n const responseDetails = {\n statusCode: moreVMAvailable ? _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_STATUS_CODE : _constants__WEBPACK_IMPORTED_MODULE_5__.NO_VOICEMAIL_STATUS_CODE,\n data: {\n voicemailList: messages,\n },\n message: moreVMAvailable ? _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE : _constants__WEBPACK_IMPORTED_MODULE_5__.NO_VOICEMAIL_MSG,\n };\n return responseDetails;\n }\n async getVoicemailContent(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailContent',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;\n const response = await this.webex.request({\n uri: `${voicemailContentUrl}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const mediaDetails = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.MESSAGE_MEDIA_CONTENT)[0];\n const mediaType = mediaDetails.childNodes[1]?.textContent;\n const mediaContent = mediaDetails.childNodes[2]?.textContent;\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Media type is ${mediaType}`, loggerContext);\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailContent: {\n type: mediaType,\n content: mediaContent,\n },\n },\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Voice mail content error is ${errorStatus}`, loggerContext);\n return errorStatus;\n }\n }\n async getVoicemailSummary() {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailSummary',\n };\n try {\n const voicemailSummaryUrl = `${this.xsiEndpoint}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.BW_XSI_ENDPOINT_VERSION}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.USER}/${this.userId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.CALLS}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MESSAGE_SUMMARY}`;\n const response = await this.webex.request({\n uri: `${voicemailSummaryUrl}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const voicemailSummary = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.SUMMARY)[0];\n const newMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.NEW_MESSAGES)[0];\n const newUrgentMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.NEW_URGENT_MESSAGES)[0];\n const oldMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.OLD_MESSAGES)[0];\n const oldUrgentMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.OLD_URGENT_MESSAGES)[0];\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailSummary: {\n newMessages: newMessages ? Number(newMessages.textContent) : 0,\n newUrgentMessages: newUrgentMessages ? Number(newUrgentMessages.textContent) : 0,\n oldMessages: oldMessages ? Number(oldMessages.textContent) : 0,\n oldUrgentMessages: oldUrgentMessages ? Number(oldUrgentMessages.textContent) : 0,\n },\n },\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(new Error(`Voicemail summary error is ${errorStatus}`), loggerContext);\n return errorStatus;\n }\n }\n async voicemailMarkAsRead(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'voicemailMarkAsRead',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MARK_AS_READ}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.PUT,\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async voicemailMarkAsUnread(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'voicemailMarkAsUnread',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MARK_AS_UNREAD}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.PUT,\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async deleteVoicemail(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'deleteVoicemail',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.DELETE,\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async getVMTranscript(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVMTranscript',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.TRANSCRIPT}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const status = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.TRANSCRIPT_STATUS)[0];\n const transcript = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.TRANSCRIPT_CONTENT)[0];\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailTranscript: transcript?.textContent,\n },\n message: status.textContent,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n resolveContact(callingPartyInfo) {\n return (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.resolveContact)(callingPartyInfo);\n }\n}\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/calling/dist/module/Voicemail/WxCallBackendConnector.js?");
2118
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ WxCallBackendConnector: () => (/* binding */ WxCallBackendConnector)\n/* harmony export */ });\n/* harmony import */ var _SDKConnector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../SDKConnector */ \"../../../node_modules/@webex/calling/dist/module/SDKConnector/index.js\");\n/* harmony import */ var _common_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/constants */ \"../../../node_modules/@webex/calling/dist/module/common/constants.js\");\n/* harmony import */ var _common_Utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/Utils */ \"../../../node_modules/@webex/calling/dist/module/common/Utils.js\");\n/* harmony import */ var _common_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/types */ \"../../../node_modules/@webex/calling/dist/module/common/types.js\");\n/* harmony import */ var _Logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Logger */ \"../../../node_modules/@webex/calling/dist/module/Logger/index.js\");\n/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/calling/dist/module/Voicemail/constants.js\");\n\n\n\n\n\n\nclass WxCallBackendConnector {\n xsiEndpoint;\n userId;\n context;\n sdkConnector;\n xsiVoiceMessageURI;\n webex;\n authHeaders = null;\n constructor(webex, logger) {\n this.sdkConnector = _SDKConnector__WEBPACK_IMPORTED_MODULE_0__[\"default\"];\n if (!this.sdkConnector.getWebex()) {\n _SDKConnector__WEBPACK_IMPORTED_MODULE_0__[\"default\"].setWebex(webex);\n }\n this.context = Math.random().toString(_constants__WEBPACK_IMPORTED_MODULE_5__.RADIX_RAND).substring(_constants__WEBPACK_IMPORTED_MODULE_5__.PREFIX);\n this.webex = this.sdkConnector.getWebex();\n this.userId = this.webex.internal.device.userId;\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].setLogger(logger.level, _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE);\n }\n async init() {\n this.authHeaders = await this.getAuthHeaders();\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'init',\n };\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info('Initializing Webex calling voicemail connector', loggerContext);\n const response = this.setXsiVoiceMessageURI();\n return response;\n }\n getSDKConnector() {\n return this.sdkConnector;\n }\n async setXsiVoiceMessageURI() {\n let responseDetails;\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'setXsiVoiceMessageURI',\n };\n this.xsiEndpoint = await (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.getXsiActionEndpoint)(this.webex, loggerContext, _common_types__WEBPACK_IMPORTED_MODULE_3__.CALLING_BACKEND.WXC);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`XsiEndpoint is ${this.xsiEndpoint}`, loggerContext);\n if (this.userId) {\n this.xsiVoiceMessageURI = `${this.xsiEndpoint}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.BW_XSI_ENDPOINT_VERSION}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.USER}/${this.userId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.VOICE_MESSAGING_MESSAGES}`;\n responseDetails = {\n statusCode: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_STATUS_CODE,\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n }\n return responseDetails;\n }\n async getVoicemailList(offset, offsetLimit, sort, refresh) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailList',\n };\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Offset: ${offset} Offset limit: ${offsetLimit} Sort type:${sort}`, loggerContext);\n let messageinfo;\n if (refresh) {\n const urlXsi = `${this.xsiVoiceMessageURI}${_constants__WEBPACK_IMPORTED_MODULE_5__.JSON_FORMAT}`;\n const sortParam = Object.values(_common_types__WEBPACK_IMPORTED_MODULE_3__.SORT).includes(sort) ? sort : _common_types__WEBPACK_IMPORTED_MODULE_3__.SORT.DEFAULT;\n try {\n const response = await this.webex.request({\n uri: `${urlXsi}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n headers: { ...this.authHeaders },\n });\n const voicemailListResponse = response.body;\n if (Object.keys(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList).length === 0) {\n messageinfo = [];\n }\n else if (!Array.isArray(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList?.messageInfo)) {\n messageinfo = Array(voicemailListResponse?.VoiceMessagingMessages?.messageInfoList?.messageInfo);\n }\n else {\n messageinfo = voicemailListResponse?.VoiceMessagingMessages?.messageInfoList\n ?.messageInfo;\n messageinfo = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.getSortedVoicemailList)(messageinfo, sortParam);\n }\n (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.storeVoicemailList)(this.context, messageinfo);\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n const { messages, moreVMAvailable } = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.fetchVoicemailList)(this.context, offset, offsetLimit, loggerContext);\n const responseDetails = {\n statusCode: moreVMAvailable ? _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_STATUS_CODE : _constants__WEBPACK_IMPORTED_MODULE_5__.NO_VOICEMAIL_STATUS_CODE,\n data: {\n voicemailList: messages,\n },\n message: moreVMAvailable ? _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE : _constants__WEBPACK_IMPORTED_MODULE_5__.NO_VOICEMAIL_MSG,\n };\n return responseDetails;\n }\n async getVoicemailContent(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailContent',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;\n const response = await this.webex.request({\n uri: `${voicemailContentUrl}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n headers: { ...this.authHeaders },\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const mediaDetails = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.MESSAGE_MEDIA_CONTENT)[0];\n const mediaType = mediaDetails.childNodes[1]?.textContent;\n const mediaContent = mediaDetails.childNodes[2]?.textContent;\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Media type is ${mediaType}`, loggerContext);\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailContent: {\n type: mediaType,\n content: mediaContent,\n },\n },\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].info(`Voice mail content error is ${errorStatus}`, loggerContext);\n return errorStatus;\n }\n }\n async getVoicemailSummary() {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVoicemailSummary',\n };\n try {\n const voicemailSummaryUrl = `${this.xsiEndpoint}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.BW_XSI_ENDPOINT_VERSION}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.USER}/${this.userId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.CALLS}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MESSAGE_SUMMARY}`;\n const response = await this.webex.request({\n uri: `${voicemailSummaryUrl}`,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n headers: { ...this.authHeaders },\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const voicemailSummary = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.SUMMARY)[0];\n const newMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.NEW_MESSAGES)[0];\n const newUrgentMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.NEW_URGENT_MESSAGES)[0];\n const oldMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.OLD_MESSAGES)[0];\n const oldUrgentMessages = voicemailSummary.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.OLD_URGENT_MESSAGES)[0];\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailSummary: {\n newMessages: newMessages ? Number(newMessages.textContent) : 0,\n newUrgentMessages: newUrgentMessages ? Number(newUrgentMessages.textContent) : 0,\n oldMessages: oldMessages ? Number(oldMessages.textContent) : 0,\n oldUrgentMessages: oldUrgentMessages ? Number(oldUrgentMessages.textContent) : 0,\n },\n },\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n _Logger__WEBPACK_IMPORTED_MODULE_4__[\"default\"].error(new Error(`Voicemail summary error is ${errorStatus}`), loggerContext);\n return errorStatus;\n }\n }\n async voicemailMarkAsRead(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'voicemailMarkAsRead',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MARK_AS_READ}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.PUT,\n headers: { ...this.authHeaders },\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async voicemailMarkAsUnread(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'voicemailMarkAsUnread',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_constants__WEBPACK_IMPORTED_MODULE_5__.MARK_AS_UNREAD}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.PUT,\n headers: { ...this.authHeaders },\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async deleteVoicemail(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'deleteVoicemail',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.DELETE,\n headers: { ...this.authHeaders },\n });\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {},\n message: _common_constants__WEBPACK_IMPORTED_MODULE_1__.SUCCESS_MESSAGE,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n async getVMTranscript(messageId) {\n const loggerContext = {\n file: _common_constants__WEBPACK_IMPORTED_MODULE_1__.WEBEX_CALLING_CONNECTOR_FILE,\n method: 'getVMTranscript',\n };\n try {\n const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${_common_constants__WEBPACK_IMPORTED_MODULE_1__.TRANSCRIPT}`;\n const response = await this.webex.request({\n uri: voicemailContentUrl,\n method: _common_types__WEBPACK_IMPORTED_MODULE_3__.HTTP_METHODS.GET,\n headers: { ...this.authHeaders },\n });\n const parser = new DOMParser();\n const xmlDOM = parser.parseFromString(response[_common_constants__WEBPACK_IMPORTED_MODULE_1__.RAW_REQUEST].response, _common_constants__WEBPACK_IMPORTED_MODULE_1__.XML_TYPE);\n const status = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.TRANSCRIPT_STATUS)[0];\n const transcript = xmlDOM.getElementsByTagName(_constants__WEBPACK_IMPORTED_MODULE_5__.TRANSCRIPT_CONTENT)[0];\n const responseDetails = {\n statusCode: Number(response.statusCode),\n data: {\n voicemailTranscript: transcript?.textContent,\n },\n message: status.textContent,\n };\n return responseDetails;\n }\n catch (err) {\n const errorInfo = err;\n const errorStatus = (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.serviceErrorCodeHandler)(errorInfo, loggerContext);\n return errorStatus;\n }\n }\n resolveContact(callingPartyInfo) {\n return (0,_common_Utils__WEBPACK_IMPORTED_MODULE_2__.resolveContact)(callingPartyInfo);\n }\n async getAuthHeaders() {\n const headers = {};\n if (this.webex?.config?.fedramp) {\n headers.Authorization = await this.webex.credentials.getUserToken();\n }\n return headers;\n }\n}\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/calling/dist/module/Voicemail/WxCallBackendConnector.js?");
2119
2119
 
2120
2120
  /***/ }),
2121
2121
 
@@ -2511,7 +2511,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
2511
2511
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2512
2512
 
2513
2513
  "use strict";
2514
- eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _backoff = _interopRequireDefault(__webpack_require__(/*! backoff */ \"../../../node_modules/backoff/index.js\"));\nvar _socket = _interopRequireDefault(__webpack_require__(/*! ./socket */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/socket/index.js\"));\nvar _errors = __webpack_require__(/*! ./errors */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/errors.js\");\nvar _dec, _dec2, _obj;\n/* eslint-disable require-jsdoc */\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\nvar normalReconnectReasons = ['idle', 'done (forced)', 'pong not received', 'pong mismatch'];\nvar Mercury = _webexCore.WebexPlugin.extend((_dec = (0, _common.deprecated)('Mercury#listen(): Use Mercury#connect() instead'), _dec2 = (0, _common.deprecated)('Mercury#stopListening(): Use Mercury#disconnect() instead'), (_obj = {\n namespace: 'Mercury',\n lastError: undefined,\n session: {\n connected: {\n default: false,\n type: 'boolean'\n },\n connecting: {\n default: false,\n type: 'boolean'\n },\n hasEverConnected: {\n default: false,\n type: 'boolean'\n },\n socket: 'object',\n localClusterServiceUrls: 'object',\n mercuryTimeOffset: {\n default: undefined,\n type: 'number'\n }\n },\n derived: {\n listening: {\n deps: ['connected'],\n fn: function fn() {\n return this.connected;\n }\n }\n },\n initialize: function initialize() {\n var _this = this;\n /*\n When one of these legacy feature gets updated, this event would be triggered\n * group-message-notifications\n * mention-notifications\n * thread-notifications\n */\n this.on('event:featureToggle_update', function (envelope) {\n if (envelope && envelope.data) {\n _this.webex.internal.feature.updateFeature(envelope.data.featureToggle);\n }\n });\n },\n /**\n * Get the last error.\n * @returns {any} The last error.\n */\n getLastError: function getLastError() {\n return this.lastError;\n },\n connect: function connect(webSocketUrl) {\n var _this2 = this;\n if (this.connected) {\n this.logger.info(\"\".concat(this.namespace, \": already connected, will not connect again\"));\n return _promise.default.resolve();\n }\n this.connecting = true;\n this.logger.info(\"\".concat(this.namespace, \": starting connection attempt\"));\n this.logger.info(\"\".concat(this.namespace, \": debug_mercury_logging stack: \"), new Error('debug_mercury_logging').stack);\n return _promise.default.resolve(this.webex.internal.device.registered || this.webex.internal.device.register()).then(function () {\n _this2.logger.info(\"\".concat(_this2.namespace, \": connecting\"));\n return _this2._connectWithBackoff(webSocketUrl);\n });\n },\n logout: function logout() {\n this.logger.info(\"\".concat(this.namespace, \": logout() called\"));\n this.logger.info(\"\".concat(this.namespace, \": debug_mercury_logging stack: \"), new Error('debug_mercury_logging').stack);\n return this.disconnect(this.config.beforeLogoutOptionsCloseReason && !normalReconnectReasons.includes(this.config.beforeLogoutOptionsCloseReason) ? {\n code: 3050,\n reason: this.config.beforeLogoutOptionsCloseReason\n } : undefined);\n },\n disconnect: function disconnect(options) {\n var _this3 = this;\n return new _promise.default(function (resolve) {\n if (_this3.backoffCall) {\n _this3.logger.info(\"\".concat(_this3.namespace, \": aborting connection\"));\n _this3.backoffCall.abort();\n }\n if (_this3.socket) {\n _this3.socket.removeAllListeners('message');\n _this3.once('offline', resolve);\n resolve(_this3.socket.close(options || undefined));\n }\n resolve();\n });\n },\n listen: function listen() {\n /* eslint no-invalid-this: [0] */\n return this.connect();\n },\n stopListening: function stopListening() {\n /* eslint no-invalid-this: [0] */\n return this.disconnect();\n },\n processRegistrationStatusEvent: function processRegistrationStatusEvent(message) {\n this.localClusterServiceUrls = message.localClusterServiceUrls;\n },\n _applyOverrides: function _applyOverrides(event) {\n if (!event || !event.headers) {\n return;\n }\n var headerKeys = (0, _keys.default)(event.headers);\n headerKeys.forEach(function (keyPath) {\n (0, _lodash.set)(event, keyPath, event.headers[keyPath]);\n });\n },\n _prepareUrl: function _prepareUrl(webSocketUrl) {\n var _this4 = this;\n if (!webSocketUrl) {\n webSocketUrl = this.webex.internal.device.webSocketUrl;\n }\n return this.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n return _this4.webex.internal.services.convertUrlToPriorityHostUrl(webSocketUrl);\n }\n return webSocketUrl;\n }).then(function (wsUrl) {\n webSocketUrl = wsUrl;\n }).then(function () {\n return _this4.webex.internal.feature.getFeature('developer', 'web-shared-mercury');\n }).then(function (webSharedMercury) {\n webSocketUrl = _url.default.parse(webSocketUrl, true);\n (0, _assign.default)(webSocketUrl.query, {\n outboundWireFormat: 'text',\n bufferStates: true,\n aliasHttpStatus: true\n });\n if (webSharedMercury) {\n (0, _assign.default)(webSocketUrl.query, {\n mercuryRegistrationStatus: true,\n isRegistrationRefreshEnabled: true\n });\n (0, _deleteProperty.default)(webSocketUrl.query, 'bufferStates');\n }\n if ((0, _lodash.get)(_this4, 'webex.config.device.ephemeral', false)) {\n webSocketUrl.query.multipleConnections = true;\n }\n webSocketUrl.query.clientTimestamp = (0, _now.default)();\n return _url.default.format(webSocketUrl);\n });\n },\n _attemptConnection: function _attemptConnection(socketUrl, callback) {\n var _this5 = this;\n var socket = new _socket.default();\n var attemptWSUrl;\n socket.on('close', function () {\n return _this5._onclose.apply(_this5, arguments);\n });\n socket.on('message', function () {\n return _this5._onmessage.apply(_this5, arguments);\n });\n socket.on('pong', function () {\n return _this5._setTimeOffset.apply(_this5, arguments);\n });\n socket.on('sequence-mismatch', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this5._emit.apply(_this5, ['sequence-mismatch'].concat(args));\n });\n socket.on('ping-pong-latency', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _this5._emit.apply(_this5, ['ping-pong-latency'].concat(args));\n });\n _promise.default.all([this._prepareUrl(socketUrl), this.webex.credentials.getUserToken()]).then(function (_ref) {\n var _ref2 = (0, _slicedToArray2.default)(_ref, 2),\n webSocketUrl = _ref2[0],\n token = _ref2[1];\n if (!_this5.backoffCall) {\n var msg = \"\".concat(_this5.namespace, \": prevent socket open when backoffCall no longer defined\");\n _this5.logger.info(msg);\n return _promise.default.reject(new Error(msg));\n }\n attemptWSUrl = webSocketUrl;\n var options = {\n forceCloseDelay: _this5.config.forceCloseDelay,\n pingInterval: _this5.config.pingInterval,\n pongTimeout: _this5.config.pongTimeout,\n token: token.toString(),\n trackingId: \"\".concat(_this5.webex.sessionId, \"_\").concat((0, _now.default)()),\n logger: _this5.logger\n };\n\n // if the consumer has supplied request options use them\n if (_this5.webex.config.defaultMercuryOptions) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": setting custom options\"));\n options = _objectSpread(_objectSpread({}, options), _this5.webex.config.defaultMercuryOptions);\n }\n\n // Set the socket before opening it. This allows a disconnect() to close\n // the socket if it is in the process of being opened.\n _this5.socket = socket;\n _this5.logger.info(\"\".concat(_this5.namespace, \" connection url: \").concat(webSocketUrl));\n return socket.open(webSocketUrl, options);\n }).then(function () {\n _this5.logger.info(\"\".concat(_this5.namespace, \": connected to mercury, success, action: connected, url: \").concat(attemptWSUrl));\n callback();\n return _this5.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n return _this5.webex.internal.device.refresh();\n }\n return _promise.default.resolve();\n });\n }).catch(function (reason) {\n var _this5$backoffCall, _this5$backoffCall3;\n _this5.lastError = reason; // remember the last error\n\n // Suppress connection errors that appear to be network related. This\n // may end up suppressing metrics during outages, but we might not care\n // (especially since many of our outages happen in a way that client\n // metrics can't be trusted).\n if (reason.code !== 1006 && _this5.backoffCall && ((_this5$backoffCall = _this5.backoffCall) === null || _this5$backoffCall === void 0 ? void 0 : _this5$backoffCall.getNumRetries()) > 0) {\n var _this5$backoffCall2;\n _this5._emit('connection_failed', reason, {\n retries: (_this5$backoffCall2 = _this5.backoffCall) === null || _this5$backoffCall2 === void 0 ? void 0 : _this5$backoffCall2.getNumRetries()\n });\n }\n _this5.logger.info(\"\".concat(_this5.namespace, \": connection attempt failed\"), reason, ((_this5$backoffCall3 = _this5.backoffCall) === null || _this5$backoffCall3 === void 0 ? void 0 : _this5$backoffCall3.getNumRetries()) === 0 ? reason.stack : '');\n // UnknownResponse is produced by IE for any 4XXX; treated it like a bad\n // web socket url and let WDM handle the token checking\n if (reason instanceof _errors.UnknownResponse) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received unknown response code, refreshing device registration\"));\n return _this5.webex.internal.device.refresh().then(function () {\n return callback(reason);\n });\n }\n // NotAuthorized implies expired token\n if (reason instanceof _errors.NotAuthorized) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received authorization error, reauthorizing\"));\n return _this5.webex.credentials.refresh({\n force: true\n }).then(function () {\n return callback(reason);\n });\n }\n // // NotFound implies expired web socket url\n // else if (reason instanceof NotFound) {\n // this.logger.info(`mercury: received not found error, refreshing device registration`);\n // return this.webex.internal.device.refresh()\n // .then(() => callback(reason));\n // }\n // BadRequest implies current credentials are for a Service Account\n // Forbidden implies current user is not entitle for Webex\n if (reason instanceof _errors.BadRequest || reason instanceof _errors.Forbidden) {\n _this5.logger.warn(\"\".concat(_this5.namespace, \": received unrecoverable response from mercury\"));\n _this5.backoffCall.abort();\n return callback(reason);\n }\n if (reason instanceof _errors.ConnectionError) {\n return _this5.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received a generic connection error, will try to connect to another datacenter. failed, action: 'failed', url: \").concat(attemptWSUrl, \" error: \").concat(reason.message));\n return _this5.webex.internal.services.markFailedUrl(attemptWSUrl);\n }\n return null;\n }).then(function () {\n return callback(reason);\n });\n }\n return callback(reason);\n }).catch(function (reason) {\n _this5.logger.error(\"\".concat(_this5.namespace, \": failed to handle connection failure\"), reason);\n callback(reason);\n });\n },\n _connectWithBackoff: function _connectWithBackoff(webSocketUrl) {\n var _this6 = this;\n return new _promise.default(function (resolve, reject) {\n // eslint gets confused about whether or not call is actually used\n // eslint-disable-next-line prefer-const\n var call;\n var onComplete = function onComplete(err) {\n _this6.connecting = false;\n _this6.backoffCall = undefined;\n if (err) {\n _this6.logger.info(\"\".concat(_this6.namespace, \": failed to connect after \").concat(call.getNumRetries(), \" retries; log statement about next retry was inaccurate; \").concat(err));\n return reject(err);\n }\n _this6.connected = true;\n _this6.hasEverConnected = true;\n _this6._emit('online');\n return resolve();\n };\n\n // eslint-disable-next-line prefer-reflect\n call = _backoff.default.call(function (callback) {\n _this6.logger.info(\"\".concat(_this6.namespace, \": executing connection attempt \").concat(call.getNumRetries()));\n _this6._attemptConnection(webSocketUrl, callback);\n }, onComplete);\n call.setStrategy(new _backoff.default.ExponentialStrategy({\n initialDelay: _this6.config.backoffTimeReset,\n maxDelay: _this6.config.backoffTimeMax\n }));\n if (_this6.config.initialConnectionMaxRetries && !_this6.hasEverConnected) {\n call.failAfter(_this6.config.initialConnectionMaxRetries);\n } else if (_this6.config.maxRetries) {\n call.failAfter(_this6.config.maxRetries);\n }\n call.on('abort', function () {\n _this6.logger.info(\"\".concat(_this6.namespace, \": connection aborted\"));\n reject(new Error('Mercury Connection Aborted'));\n });\n call.on('callback', function (err) {\n if (err) {\n var number = call.getNumRetries();\n var delay = Math.min(call.strategy_.nextBackoffDelay_, _this6.config.backoffTimeMax);\n _this6.logger.info(\"\".concat(_this6.namespace, \": failed to connect; attempting retry \").concat(number + 1, \" in \").concat(delay, \" ms\"));\n /* istanbul ignore if */\n if (true) {\n _this6.logger.debug(\"\".concat(_this6.namespace, \": \"), err, err.stack);\n }\n return;\n }\n _this6.logger.info(\"\".concat(_this6.namespace, \": connected\"));\n });\n call.start();\n _this6.backoffCall = call;\n });\n },\n _emit: function _emit() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n try {\n this.trigger.apply(this, args);\n } catch (error) {\n this.logger.error(\"\".concat(this.namespace, \": error occurred in event handler:\"), error, ' with args: ', args);\n }\n },\n _getEventHandlers: function _getEventHandlers(eventType) {\n var _eventType$split = eventType.split('.'),\n _eventType$split2 = (0, _slicedToArray2.default)(_eventType$split, 2),\n namespace = _eventType$split2[0],\n name = _eventType$split2[1];\n var handlers = [];\n if (!this.webex[namespace] && !this.webex.internal[namespace]) {\n return handlers;\n }\n var handlerName = (0, _lodash.camelCase)(\"process_\".concat(name, \"_event\"));\n if ((this.webex[namespace] || this.webex.internal[namespace])[handlerName]) {\n handlers.push({\n name: handlerName,\n namespace: namespace\n });\n }\n return handlers;\n },\n _onclose: function _onclose(event) {\n // I don't see any way to avoid the complexity or statement count in here.\n /* eslint complexity: [0] */\n\n try {\n var reason = event.reason && event.reason.toLowerCase();\n var socketUrl = this.socket.url;\n this.socket.removeAllListeners();\n this.unset('socket');\n this.connected = false;\n this._emit('offline', event);\n switch (event.code) {\n case 1003:\n // metric: disconnect\n this.logger.info(\"\".concat(this.namespace, \": Mercury service rejected last message; will not reconnect: \").concat(event.reason));\n this._emit('offline.permanent', event);\n break;\n case 4000:\n // metric: disconnect\n this.logger.info(\"\".concat(this.namespace, \": socket replaced; will not reconnect\"));\n this._emit('offline.replaced', event);\n break;\n case 1001:\n case 1005:\n case 1006:\n case 1011:\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; reconnecting\"));\n this._emit('offline.transient', event);\n this._reconnect(socketUrl);\n // metric: disconnect\n // if (code == 1011 && reason !== ping error) metric: unexpected disconnect\n break;\n case 1000:\n case 3050:\n // 3050 indicates logout form of closure, default to old behavior, use config reason defined by consumer to proceed with the permanent block\n if (normalReconnectReasons.includes(reason)) {\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; reconnecting\"));\n this._emit('offline.transient', event);\n this._reconnect(socketUrl);\n // metric: disconnect\n // if (reason === done forced) metric: force closure\n } else {\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; will not reconnect: \").concat(event.reason));\n this._emit('offline.permanent', event);\n }\n break;\n default:\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected unexpectedly; will not reconnect\"));\n // unexpected disconnect\n this._emit('offline.permanent', event);\n }\n } catch (error) {\n this.logger.error(\"\".concat(this.namespace, \": error occurred in close handler\"), error);\n }\n },\n _onmessage: function _onmessage(event) {\n var _this7 = this;\n this._setTimeOffset(event);\n var envelope = event.data;\n if (process.env.ENABLE_MERCURY_LOGGING) {\n this.logger.debug(\"\".concat(this.namespace, \": message envelope: \"), envelope);\n }\n var data = envelope.data;\n this._applyOverrides(data);\n return this._getEventHandlers(data.eventType).reduce(function (promise, handler) {\n return promise.then(function () {\n var namespace = handler.namespace,\n name = handler.name;\n return new _promise.default(function (resolve) {\n return resolve((_this7.webex[namespace] || _this7.webex.internal[namespace])[name](data));\n }).catch(function (reason) {\n return _this7.logger.error(\"\".concat(_this7.namespace, \": error occurred in autowired event handler for \").concat(data.eventType), reason);\n });\n });\n }, _promise.default.resolve()).then(function () {\n _this7._emit('event', event.data);\n var _data$eventType$split = data.eventType.split('.'),\n _data$eventType$split2 = (0, _slicedToArray2.default)(_data$eventType$split, 1),\n namespace = _data$eventType$split2[0];\n if (namespace === data.eventType) {\n _this7._emit(\"event:\".concat(namespace), envelope);\n } else {\n _this7._emit(\"event:\".concat(namespace), envelope);\n _this7._emit(\"event:\".concat(data.eventType), envelope);\n }\n }).catch(function (reason) {\n _this7.logger.error(\"\".concat(_this7.namespace, \": error occurred processing socket message\"), reason);\n });\n },\n _setTimeOffset: function _setTimeOffset(event) {\n var wsWriteTimestamp = event.data.wsWriteTimestamp;\n if (typeof wsWriteTimestamp === 'number' && wsWriteTimestamp > 0) {\n this.mercuryTimeOffset = (0, _now.default)() - wsWriteTimestamp;\n }\n },\n _reconnect: function _reconnect(webSocketUrl) {\n this.logger.info(\"\".concat(this.namespace, \": reconnecting\"));\n return this.connect(webSocketUrl);\n },\n version: \"3.8.0-next.12\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"connect\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"connect\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"disconnect\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"disconnect\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"listen\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"listen\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"stopListening\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"stopListening\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Mercury;\n//# sourceMappingURL=mercury.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/dist/mercury.js?");
2514
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _backoff = _interopRequireDefault(__webpack_require__(/*! backoff */ \"../../../node_modules/backoff/index.js\"));\nvar _socket = _interopRequireDefault(__webpack_require__(/*! ./socket */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/socket/index.js\"));\nvar _errors = __webpack_require__(/*! ./errors */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/errors.js\");\nvar _dec, _dec2, _obj;\n/* eslint-disable require-jsdoc */\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\nvar normalReconnectReasons = ['idle', 'done (forced)', 'pong not received', 'pong mismatch'];\nvar Mercury = _webexCore.WebexPlugin.extend((_dec = (0, _common.deprecated)('Mercury#listen(): Use Mercury#connect() instead'), _dec2 = (0, _common.deprecated)('Mercury#stopListening(): Use Mercury#disconnect() instead'), (_obj = {\n namespace: 'Mercury',\n lastError: undefined,\n session: {\n connected: {\n default: false,\n type: 'boolean'\n },\n connecting: {\n default: false,\n type: 'boolean'\n },\n hasEverConnected: {\n default: false,\n type: 'boolean'\n },\n socket: 'object',\n localClusterServiceUrls: 'object',\n mercuryTimeOffset: {\n default: undefined,\n type: 'number'\n }\n },\n derived: {\n listening: {\n deps: ['connected'],\n fn: function fn() {\n return this.connected;\n }\n }\n },\n initialize: function initialize() {\n var _this = this;\n /*\n When one of these legacy feature gets updated, this event would be triggered\n * group-message-notifications\n * mention-notifications\n * thread-notifications\n */\n this.on('event:featureToggle_update', function (envelope) {\n if (envelope && envelope.data) {\n _this.webex.internal.feature.updateFeature(envelope.data.featureToggle);\n }\n });\n },\n /**\n * Get the last error.\n * @returns {any} The last error.\n */\n getLastError: function getLastError() {\n return this.lastError;\n },\n connect: function connect(webSocketUrl) {\n var _this2 = this;\n if (this.connected) {\n this.logger.info(\"\".concat(this.namespace, \": already connected, will not connect again\"));\n return _promise.default.resolve();\n }\n this.connecting = true;\n this.logger.info(\"\".concat(this.namespace, \": starting connection attempt\"));\n this.logger.info(\"\".concat(this.namespace, \": debug_mercury_logging stack: \"), new Error('debug_mercury_logging').stack);\n return _promise.default.resolve(this.webex.internal.device.registered || this.webex.internal.device.register()).then(function () {\n _this2.logger.info(\"\".concat(_this2.namespace, \": connecting\"));\n return _this2._connectWithBackoff(webSocketUrl);\n });\n },\n logout: function logout() {\n this.logger.info(\"\".concat(this.namespace, \": logout() called\"));\n this.logger.info(\"\".concat(this.namespace, \": debug_mercury_logging stack: \"), new Error('debug_mercury_logging').stack);\n return this.disconnect(this.config.beforeLogoutOptionsCloseReason && !normalReconnectReasons.includes(this.config.beforeLogoutOptionsCloseReason) ? {\n code: 3050,\n reason: this.config.beforeLogoutOptionsCloseReason\n } : undefined);\n },\n disconnect: function disconnect(options) {\n var _this3 = this;\n return new _promise.default(function (resolve) {\n if (_this3.backoffCall) {\n _this3.logger.info(\"\".concat(_this3.namespace, \": aborting connection\"));\n _this3.backoffCall.abort();\n }\n if (_this3.socket) {\n _this3.socket.removeAllListeners('message');\n _this3.once('offline', resolve);\n resolve(_this3.socket.close(options || undefined));\n }\n resolve();\n });\n },\n listen: function listen() {\n /* eslint no-invalid-this: [0] */\n return this.connect();\n },\n stopListening: function stopListening() {\n /* eslint no-invalid-this: [0] */\n return this.disconnect();\n },\n processRegistrationStatusEvent: function processRegistrationStatusEvent(message) {\n this.localClusterServiceUrls = message.localClusterServiceUrls;\n },\n _applyOverrides: function _applyOverrides(event) {\n if (!event || !event.headers) {\n return;\n }\n var headerKeys = (0, _keys.default)(event.headers);\n headerKeys.forEach(function (keyPath) {\n (0, _lodash.set)(event, keyPath, event.headers[keyPath]);\n });\n },\n _prepareUrl: function _prepareUrl(webSocketUrl) {\n var _this4 = this;\n if (!webSocketUrl) {\n webSocketUrl = this.webex.internal.device.webSocketUrl;\n }\n return this.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n return _this4.webex.internal.services.convertUrlToPriorityHostUrl(webSocketUrl);\n }\n return webSocketUrl;\n }).then(function (wsUrl) {\n webSocketUrl = wsUrl;\n }).then(function () {\n return _this4.webex.internal.feature.getFeature('developer', 'web-shared-mercury');\n }).then(function (webSharedMercury) {\n webSocketUrl = _url.default.parse(webSocketUrl, true);\n (0, _assign.default)(webSocketUrl.query, {\n outboundWireFormat: 'text',\n bufferStates: true,\n aliasHttpStatus: true\n });\n if (webSharedMercury) {\n (0, _assign.default)(webSocketUrl.query, {\n mercuryRegistrationStatus: true,\n isRegistrationRefreshEnabled: true\n });\n (0, _deleteProperty.default)(webSocketUrl.query, 'bufferStates');\n }\n if ((0, _lodash.get)(_this4, 'webex.config.device.ephemeral', false)) {\n webSocketUrl.query.multipleConnections = true;\n }\n webSocketUrl.query.clientTimestamp = (0, _now.default)();\n return _url.default.format(webSocketUrl);\n });\n },\n _attemptConnection: function _attemptConnection(socketUrl, callback) {\n var _this5 = this;\n var socket = new _socket.default();\n var attemptWSUrl;\n socket.on('close', function () {\n return _this5._onclose.apply(_this5, arguments);\n });\n socket.on('message', function () {\n return _this5._onmessage.apply(_this5, arguments);\n });\n socket.on('pong', function () {\n return _this5._setTimeOffset.apply(_this5, arguments);\n });\n socket.on('sequence-mismatch', function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return _this5._emit.apply(_this5, ['sequence-mismatch'].concat(args));\n });\n socket.on('ping-pong-latency', function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _this5._emit.apply(_this5, ['ping-pong-latency'].concat(args));\n });\n _promise.default.all([this._prepareUrl(socketUrl), this.webex.credentials.getUserToken()]).then(function (_ref) {\n var _ref2 = (0, _slicedToArray2.default)(_ref, 2),\n webSocketUrl = _ref2[0],\n token = _ref2[1];\n if (!_this5.backoffCall) {\n var msg = \"\".concat(_this5.namespace, \": prevent socket open when backoffCall no longer defined\");\n _this5.logger.info(msg);\n return _promise.default.reject(new Error(msg));\n }\n attemptWSUrl = webSocketUrl;\n var options = {\n forceCloseDelay: _this5.config.forceCloseDelay,\n pingInterval: _this5.config.pingInterval,\n pongTimeout: _this5.config.pongTimeout,\n token: token.toString(),\n trackingId: \"\".concat(_this5.webex.sessionId, \"_\").concat((0, _now.default)()),\n logger: _this5.logger\n };\n\n // if the consumer has supplied request options use them\n if (_this5.webex.config.defaultMercuryOptions) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": setting custom options\"));\n options = _objectSpread(_objectSpread({}, options), _this5.webex.config.defaultMercuryOptions);\n }\n\n // Set the socket before opening it. This allows a disconnect() to close\n // the socket if it is in the process of being opened.\n _this5.socket = socket;\n _this5.logger.info(\"\".concat(_this5.namespace, \" connection url: \").concat(webSocketUrl));\n return socket.open(webSocketUrl, options);\n }).then(function () {\n _this5.logger.info(\"\".concat(_this5.namespace, \": connected to mercury, success, action: connected, url: \").concat(attemptWSUrl));\n callback();\n return _this5.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n return _this5.webex.internal.device.refresh();\n }\n return _promise.default.resolve();\n });\n }).catch(function (reason) {\n var _this5$backoffCall, _this5$backoffCall3;\n _this5.lastError = reason; // remember the last error\n\n // Suppress connection errors that appear to be network related. This\n // may end up suppressing metrics during outages, but we might not care\n // (especially since many of our outages happen in a way that client\n // metrics can't be trusted).\n if (reason.code !== 1006 && _this5.backoffCall && ((_this5$backoffCall = _this5.backoffCall) === null || _this5$backoffCall === void 0 ? void 0 : _this5$backoffCall.getNumRetries()) > 0) {\n var _this5$backoffCall2;\n _this5._emit('connection_failed', reason, {\n retries: (_this5$backoffCall2 = _this5.backoffCall) === null || _this5$backoffCall2 === void 0 ? void 0 : _this5$backoffCall2.getNumRetries()\n });\n }\n _this5.logger.info(\"\".concat(_this5.namespace, \": connection attempt failed\"), reason, ((_this5$backoffCall3 = _this5.backoffCall) === null || _this5$backoffCall3 === void 0 ? void 0 : _this5$backoffCall3.getNumRetries()) === 0 ? reason.stack : '');\n // UnknownResponse is produced by IE for any 4XXX; treated it like a bad\n // web socket url and let WDM handle the token checking\n if (reason instanceof _errors.UnknownResponse) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received unknown response code, refreshing device registration\"));\n return _this5.webex.internal.device.refresh().then(function () {\n return callback(reason);\n });\n }\n // NotAuthorized implies expired token\n if (reason instanceof _errors.NotAuthorized) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received authorization error, reauthorizing\"));\n return _this5.webex.credentials.refresh({\n force: true\n }).then(function () {\n return callback(reason);\n });\n }\n // // NotFound implies expired web socket url\n // else if (reason instanceof NotFound) {\n // this.logger.info(`mercury: received not found error, refreshing device registration`);\n // return this.webex.internal.device.refresh()\n // .then(() => callback(reason));\n // }\n // BadRequest implies current credentials are for a Service Account\n // Forbidden implies current user is not entitle for Webex\n if (reason instanceof _errors.BadRequest || reason instanceof _errors.Forbidden) {\n _this5.logger.warn(\"\".concat(_this5.namespace, \": received unrecoverable response from mercury\"));\n _this5.backoffCall.abort();\n return callback(reason);\n }\n if (reason instanceof _errors.ConnectionError) {\n return _this5.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {\n if (haMessagingEnabled) {\n _this5.logger.info(\"\".concat(_this5.namespace, \": received a generic connection error, will try to connect to another datacenter. failed, action: 'failed', url: \").concat(attemptWSUrl, \" error: \").concat(reason.message));\n return _this5.webex.internal.services.markFailedUrl(attemptWSUrl);\n }\n return null;\n }).then(function () {\n return callback(reason);\n });\n }\n return callback(reason);\n }).catch(function (reason) {\n _this5.logger.error(\"\".concat(_this5.namespace, \": failed to handle connection failure\"), reason);\n callback(reason);\n });\n },\n _connectWithBackoff: function _connectWithBackoff(webSocketUrl) {\n var _this6 = this;\n return new _promise.default(function (resolve, reject) {\n // eslint gets confused about whether or not call is actually used\n // eslint-disable-next-line prefer-const\n var call;\n var onComplete = function onComplete(err) {\n _this6.connecting = false;\n _this6.backoffCall = undefined;\n if (err) {\n _this6.logger.info(\"\".concat(_this6.namespace, \": failed to connect after \").concat(call.getNumRetries(), \" retries; log statement about next retry was inaccurate; \").concat(err));\n return reject(err);\n }\n _this6.connected = true;\n _this6.hasEverConnected = true;\n _this6._emit('online');\n return resolve();\n };\n\n // eslint-disable-next-line prefer-reflect\n call = _backoff.default.call(function (callback) {\n _this6.logger.info(\"\".concat(_this6.namespace, \": executing connection attempt \").concat(call.getNumRetries()));\n _this6._attemptConnection(webSocketUrl, callback);\n }, onComplete);\n call.setStrategy(new _backoff.default.ExponentialStrategy({\n initialDelay: _this6.config.backoffTimeReset,\n maxDelay: _this6.config.backoffTimeMax\n }));\n if (_this6.config.initialConnectionMaxRetries && !_this6.hasEverConnected) {\n call.failAfter(_this6.config.initialConnectionMaxRetries);\n } else if (_this6.config.maxRetries) {\n call.failAfter(_this6.config.maxRetries);\n }\n call.on('abort', function () {\n _this6.logger.info(\"\".concat(_this6.namespace, \": connection aborted\"));\n reject(new Error('Mercury Connection Aborted'));\n });\n call.on('callback', function (err) {\n if (err) {\n var number = call.getNumRetries();\n var delay = Math.min(call.strategy_.nextBackoffDelay_, _this6.config.backoffTimeMax);\n _this6.logger.info(\"\".concat(_this6.namespace, \": failed to connect; attempting retry \").concat(number + 1, \" in \").concat(delay, \" ms\"));\n /* istanbul ignore if */\n if (true) {\n _this6.logger.debug(\"\".concat(_this6.namespace, \": \"), err, err.stack);\n }\n return;\n }\n _this6.logger.info(\"\".concat(_this6.namespace, \": connected\"));\n });\n call.start();\n _this6.backoffCall = call;\n });\n },\n _emit: function _emit() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n try {\n this.trigger.apply(this, args);\n } catch (error) {\n this.logger.error(\"\".concat(this.namespace, \": error occurred in event handler:\"), error, ' with args: ', args);\n }\n },\n _getEventHandlers: function _getEventHandlers(eventType) {\n var _eventType$split = eventType.split('.'),\n _eventType$split2 = (0, _slicedToArray2.default)(_eventType$split, 2),\n namespace = _eventType$split2[0],\n name = _eventType$split2[1];\n var handlers = [];\n if (!this.webex[namespace] && !this.webex.internal[namespace]) {\n return handlers;\n }\n var handlerName = (0, _lodash.camelCase)(\"process_\".concat(name, \"_event\"));\n if ((this.webex[namespace] || this.webex.internal[namespace])[handlerName]) {\n handlers.push({\n name: handlerName,\n namespace: namespace\n });\n }\n return handlers;\n },\n _onclose: function _onclose(event) {\n // I don't see any way to avoid the complexity or statement count in here.\n /* eslint complexity: [0] */\n\n try {\n var reason = event.reason && event.reason.toLowerCase();\n var socketUrl = this.socket.url;\n this.socket.removeAllListeners();\n this.unset('socket');\n this.connected = false;\n this._emit('offline', event);\n switch (event.code) {\n case 1003:\n // metric: disconnect\n this.logger.info(\"\".concat(this.namespace, \": Mercury service rejected last message; will not reconnect: \").concat(event.reason));\n this._emit('offline.permanent', event);\n break;\n case 4000:\n // metric: disconnect\n this.logger.info(\"\".concat(this.namespace, \": socket replaced; will not reconnect\"));\n this._emit('offline.replaced', event);\n break;\n case 1001:\n case 1005:\n case 1006:\n case 1011:\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; reconnecting\"));\n this._emit('offline.transient', event);\n this._reconnect(socketUrl);\n // metric: disconnect\n // if (code == 1011 && reason !== ping error) metric: unexpected disconnect\n break;\n case 1000:\n case 3050:\n // 3050 indicates logout form of closure, default to old behavior, use config reason defined by consumer to proceed with the permanent block\n if (normalReconnectReasons.includes(reason)) {\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; reconnecting\"));\n this._emit('offline.transient', event);\n this._reconnect(socketUrl);\n // metric: disconnect\n // if (reason === done forced) metric: force closure\n } else {\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected; will not reconnect: \").concat(event.reason));\n this._emit('offline.permanent', event);\n }\n break;\n default:\n this.logger.info(\"\".concat(this.namespace, \": socket disconnected unexpectedly; will not reconnect\"));\n // unexpected disconnect\n this._emit('offline.permanent', event);\n }\n } catch (error) {\n this.logger.error(\"\".concat(this.namespace, \": error occurred in close handler\"), error);\n }\n },\n _onmessage: function _onmessage(event) {\n var _this7 = this;\n this._setTimeOffset(event);\n var envelope = event.data;\n if (process.env.ENABLE_MERCURY_LOGGING) {\n this.logger.debug(\"\".concat(this.namespace, \": message envelope: \"), envelope);\n }\n var data = envelope.data;\n this._applyOverrides(data);\n return this._getEventHandlers(data.eventType).reduce(function (promise, handler) {\n return promise.then(function () {\n var namespace = handler.namespace,\n name = handler.name;\n return new _promise.default(function (resolve) {\n return resolve((_this7.webex[namespace] || _this7.webex.internal[namespace])[name](data));\n }).catch(function (reason) {\n return _this7.logger.error(\"\".concat(_this7.namespace, \": error occurred in autowired event handler for \").concat(data.eventType), reason);\n });\n });\n }, _promise.default.resolve()).then(function () {\n _this7._emit('event', event.data);\n var _data$eventType$split = data.eventType.split('.'),\n _data$eventType$split2 = (0, _slicedToArray2.default)(_data$eventType$split, 1),\n namespace = _data$eventType$split2[0];\n if (namespace === data.eventType) {\n _this7._emit(\"event:\".concat(namespace), envelope);\n } else {\n _this7._emit(\"event:\".concat(namespace), envelope);\n _this7._emit(\"event:\".concat(data.eventType), envelope);\n }\n }).catch(function (reason) {\n _this7.logger.error(\"\".concat(_this7.namespace, \": error occurred processing socket message\"), reason);\n });\n },\n _setTimeOffset: function _setTimeOffset(event) {\n var wsWriteTimestamp = event.data.wsWriteTimestamp;\n if (typeof wsWriteTimestamp === 'number' && wsWriteTimestamp > 0) {\n this.mercuryTimeOffset = (0, _now.default)() - wsWriteTimestamp;\n }\n },\n _reconnect: function _reconnect(webSocketUrl) {\n this.logger.info(\"\".concat(this.namespace, \": reconnecting\"));\n return this.connect(webSocketUrl);\n },\n version: \"3.8.0-next.13\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"connect\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"connect\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"disconnect\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"disconnect\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"listen\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"listen\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"stopListening\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"stopListening\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Mercury;\n//# sourceMappingURL=mercury.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/dist/mercury.js?");
2515
2515
 
2516
2516
  /***/ }),
2517
2517
 
@@ -2962,7 +2962,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
2962
2962
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2963
2963
 
2964
2964
  "use strict";
2965
- eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/metrics.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/constants.js\");\nvar _featuresModel = _interopRequireDefault(__webpack_require__(/*! ./features/features-model */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/features/features-model.js\"));\nvar _ipNetworkDetector = _interopRequireDefault(__webpack_require__(/*! ./ipNetworkDetector */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/types.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj; // Internal Dependencies\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\nvar Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)('@'), _dec2 = (0, _webexCore.waitForValue)('@'), _dec3 = (0, _webexCore.waitForValue)('@'), _dec4 = (0, _webexCore.waitForValue)('@'), _dec5 = (0, _common.deprecated)('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()'), _dec6 = (0, _webexCore.persist)('@', decider), (_obj = {\n // Ampersand property members.\n\n namespace: 'Device',\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n idAttribute: 'url',\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: _featuresModel.default,\n /**\n * Helper class for detecting what IP network version (ipv4, ipv6) we're on.\n *\n * @type {IpNetworkDetector}\n */\n ipNetworkDetector: _ipNetworkDetector.default\n },\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, function () {\n return [];\n }],\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string'\n },\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn: function fn() {\n return !!this.url;\n }\n }\n },\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n /**\n * This property stores whether or not the next refresh or register request should request energy forecast data\n * in order to prevent over fetching energy forecasts\n *\n * @type {boolean}\n */\n energyForecastConfig: 'boolean',\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean'\n },\n // Event method members.\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted: function meetingStarted() {\n this.webex.trigger('meeting started');\n },\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded: function meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n /**\n * Set the value of energy forecast config for the current registered device.\n * @param {boolean} [energyForecastConfig=false] - fetch an energy forecast on the next refresh/register\n * @returns {void}\n */\n setEnergyForecastConfig: function setEnergyForecastConfig() {\n var energyForecastConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.energyForecastConfig = energyForecastConfig;\n },\n refresh: function refresh() {\n var _this = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is not registered and register instead.\n if (!_this.registered) {\n _this.logger.info('device: device not registered, registering');\n return _this.register(deviceRegistrationOptions);\n }\n\n // Merge body configurations, overriding defaults.\n var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {});\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (_this.config.ephemeral) {\n body.ttl = _this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread(_objectSpread({}, _this.config.defaults.headers ? _this.config.defaults.headers : {}), _this.config.headers ? _this.config.headers : {}), _this.etag ? {\n 'If-None-Match': _this.etag\n } : {});\n var _deviceRegistrationOp = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp;\n var requestId = _uuid.default.v4();\n _this.set('refresh-request-id', requestId);\n return _this.request({\n method: 'PUT',\n uri: _this.url,\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(_this.config.energyForecast && _this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this.get('refresh-request-id') !== requestId) {\n _this.logger.info('device: refresh request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n return _this.processRegistrationSuccess(response);\n }).catch(function (reason) {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n _this.logger.info('device: refresh failed, device is not valid');\n _this.logger.info('device: attempting to register a new device');\n _this.clear();\n return _this.register(deviceRegistrationOptions);\n }\n return _promise.default.reject(reason);\n });\n });\n },\n /**\n * Fetches the web devices and deletes the third of them which are not recent devices in use\n * @returns {Promise<void, Error>}\n */\n deleteDevices: function deleteDevices() {\n var _this2 = this;\n // Fetch devices with a GET request\n return this.request({\n method: 'GET',\n service: 'wdm',\n resource: 'devices'\n }).then(function (response) {\n var devices = response.body.devices;\n var _this2$_getBody = _this2._getBody(),\n deviceType = _this2$_getBody.deviceType;\n\n // Filter devices of type deviceType\n var webDevices = devices.filter(function (item) {\n return item.deviceType === deviceType;\n });\n var sortedDevices = (0, _lodash.orderBy)(webDevices, [function (item) {\n return new Date(item.modificationTime);\n }]);\n\n // If there are more than two devices, delete the last third\n if (sortedDevices.length > 2) {\n var totalItems = sortedDevices.length;\n var countToDelete = Math.ceil(totalItems / 3);\n var urlsToDelete = sortedDevices.slice(0, countToDelete).map(function (item) {\n return item.url;\n });\n return _promise.default.race(urlsToDelete.map(function (url) {\n return _this2.request({\n uri: url,\n method: 'DELETE'\n });\n }));\n }\n return _promise.default.resolve();\n }).catch(function (error) {\n _this2.logger.error('Failed to retrieve devices:', error);\n return _promise.default.reject(error);\n });\n },\n register: function register() {\n var _this3 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: registering');\n this.webex.internal.newMetrics.callDiagnosticMetrics.setDeviceInfo(this);\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is already registered and refresh instead.\n if (_this3.registered) {\n _this3.logger.info('device: device already registered, refreshing');\n return _this3.refresh(deviceRegistrationOptions);\n }\n return _this3._registerInternal(deviceRegistrationOptions).catch(function (error) {\n var _error$body;\n if ((error === null || error === void 0 ? void 0 : (_error$body = error.body) === null || _error$body === void 0 ? void 0 : _error$body.message) === 'User has excessive device registrations') {\n return _this3.deleteDevices().then(function () {\n return _this3._registerInternal(deviceRegistrationOptions);\n });\n }\n throw error;\n });\n });\n },\n _getBody: function _getBody() {\n return _objectSpread(_objectSpread({}, this.config.defaults.body ? this.config.defaults.body : {}), this.config.body ? this.config.body : {});\n },\n _registerInternal: function _registerInternal() {\n var _this4 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: making registration request');\n\n // Merge body configurations, overriding defaults.\n var body = this._getBody();\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread({}, this.config.defaults.headers ? this.config.defaults.headers : {}), this.config.headers ? this.config.headers : {});\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n this.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.request'\n });\n var _deviceRegistrationOp2 = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp2 === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp2;\n var requestId = _uuid.default.v4();\n this.set('register-request-id', requestId);\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(this.config.energyForecast && this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).catch(function (error) {\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n throw error;\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this4.get('register-request-id') !== requestId) {\n _this4.logger.info('device: register request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n\n // Do not add any processing of response above this as that will affect timestamp\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);\n return _this4.processRegistrationSuccess(response);\n }).catch(function (error) {\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {\n error: error\n }\n });\n throw error;\n });\n },\n unregister: function unregister() {\n var _this5 = this;\n this.logger.info('device: unregistering');\n if (!this.registered) {\n this.logger.warn('device: not registered');\n return _promise.default.resolve();\n }\n return this.request({\n uri: this.url,\n method: 'DELETE'\n }).then(function () {\n return _this5.clear();\n }).catch(function (reason) {\n if (reason.statusCode === 404) {\n _this5.logger.info('device: 404 when deleting device, device is already deleted, clearing device');\n _this5.clear();\n }\n throw reason;\n });\n },\n /* eslint-enable require-jsdoc */\n // Helper method members\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister: function canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(function () {\n return (\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm') ? _promise.default.resolve() : _promise.default.reject(new Error(['device: cannot register,', \"'wdm' service is not available from the postauth catalog\"].join(' ')))\n );\n });\n },\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability: function checkNetworkReachability() {\n var _this6 = this;\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n var headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null\n };\n\n // Send the network reachability request.\n return this.request({\n headers: headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl\n }).then(function () {\n _this6.isInNetwork = true;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n }).catch(function () {\n _this6.logger.info('device: did not reach ping endpoint');\n _this6.logger.info('device: triggering off-network timer');\n _this6.isInNetwork = false;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n });\n },\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear: function clear() {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.clear, this, args);\n },\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl: function getWebSocketUrl() {\n var _this7 = this;\n var wait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration().then(function () {\n return services.convertUrlToPriorityHostUrl(_this7.webSocketUrl);\n }).catch(function (error) {\n _this7.logger.warn(error.message);\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return _promise.default.reject(new Error('device: cannot get websocket url, device is not registered'));\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n var wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return _promise.default.resolve(wsUrl);\n }\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n },\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess: function processRegistrationSuccess(response) {\n var _this8 = this;\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n var body = _objectSpread({}, response.body);\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n var _ref = response.headers || {},\n etag = _ref.etag;\n if (this.etag && etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n var features = body.features;\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({\n etag: etag\n });\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n var delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this8.refresh();\n }, delay);\n }\n\n // Emit the registration:success event.\n this.trigger(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer: function resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (!this.isInMeeting && this.config.enableInactivityEnforcement && this.isReachabilityChecked) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n } else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer: function setLogoutTimer(duration) {\n var _this9 = this;\n this.logger.info('device: setting logout timer');\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', function () {\n _this9.resetLogoutTimer();\n });\n\n // Initialize a new timer.\n this.logoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n _this9.webex.logout();\n }, duration * 1000);\n },\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration: function waitForRegistration() {\n var _this10 = this;\n var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n this.logger.info('device: waiting for registration');\n return new _promise.default(function (resolve, reject) {\n if (_this10.registered) {\n resolve();\n }\n var timeoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return reject(new Error('device: timeout occured while waiting for registration'));\n }, timeout * 1000);\n _this10.once(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, function () {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n markUrlFailedAndGetNew: function markUrlFailedAndGetNew(url) {\n return _promise.default.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n initialize: function initialize() {\n var _this11 = this;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n // Prototype the extended class in order to preserve the parent member.\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n _constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {\n _this11.features.on(\"change:\".concat(collectionName), function (model, value, options) {\n _this11.trigger('change', _this11, options);\n _this11.trigger('change:features', _this11, _this11.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', function () {\n _this11.lastUserActivityDate = (0, _now.default)();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', function () {\n _this11.isInMeeting = true;\n _this11.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', function () {\n _this11.isInMeeting = false;\n _this11.resetLogoutTimer();\n });\n } /* eslint-enable require-jsdoc */,\n version: \"3.8.0-next.10\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"register\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"register\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"_registerInternal\", [_common.oneFlight, _dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"_registerInternal\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"unregister\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"unregister\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"markUrlFailedAndGetNew\", [_dec5], (0, _getOwnPropertyDescriptor.default)(_obj, \"markUrlFailedAndGetNew\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Device;\n//# sourceMappingURL=device.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/device.js?");
2965
+ eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/metrics.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/constants.js\");\nvar _featuresModel = _interopRequireDefault(__webpack_require__(/*! ./features/features-model */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/features/features-model.js\"));\nvar _ipNetworkDetector = _interopRequireDefault(__webpack_require__(/*! ./ipNetworkDetector */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/types.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj; // Internal Dependencies\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\nvar Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)('@'), _dec2 = (0, _webexCore.waitForValue)('@'), _dec3 = (0, _webexCore.waitForValue)('@'), _dec4 = (0, _webexCore.waitForValue)('@'), _dec5 = (0, _common.deprecated)('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()'), _dec6 = (0, _webexCore.persist)('@', decider), (_obj = {\n // Ampersand property members.\n\n namespace: 'Device',\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n idAttribute: 'url',\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: _featuresModel.default,\n /**\n * Helper class for detecting what IP network version (ipv4, ipv6) we're on.\n *\n * @type {IpNetworkDetector}\n */\n ipNetworkDetector: _ipNetworkDetector.default\n },\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, function () {\n return [];\n }],\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string'\n },\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn: function fn() {\n return !!this.url;\n }\n }\n },\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n /**\n * This property stores whether or not the next refresh or register request should request energy forecast data\n * in order to prevent over fetching energy forecasts\n *\n * @type {boolean}\n */\n energyForecastConfig: 'boolean',\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean'\n },\n // Event method members.\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted: function meetingStarted() {\n this.webex.trigger('meeting started');\n },\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded: function meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n /**\n * Set the value of energy forecast config for the current registered device.\n * @param {boolean} [energyForecastConfig=false] - fetch an energy forecast on the next refresh/register\n * @returns {void}\n */\n setEnergyForecastConfig: function setEnergyForecastConfig() {\n var energyForecastConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.energyForecastConfig = energyForecastConfig;\n },\n refresh: function refresh() {\n var _this = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is not registered and register instead.\n if (!_this.registered) {\n _this.logger.info('device: device not registered, registering');\n return _this.register(deviceRegistrationOptions);\n }\n\n // Merge body configurations, overriding defaults.\n var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {});\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (_this.config.ephemeral) {\n body.ttl = _this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread(_objectSpread({}, _this.config.defaults.headers ? _this.config.defaults.headers : {}), _this.config.headers ? _this.config.headers : {}), _this.etag ? {\n 'If-None-Match': _this.etag\n } : {});\n var _deviceRegistrationOp = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp;\n var requestId = _uuid.default.v4();\n _this.set('refresh-request-id', requestId);\n return _this.request({\n method: 'PUT',\n uri: _this.url,\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(_this.config.energyForecast && _this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this.get('refresh-request-id') !== requestId) {\n _this.logger.info('device: refresh request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n return _this.processRegistrationSuccess(response);\n }).catch(function (reason) {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n _this.logger.info('device: refresh failed, device is not valid');\n _this.logger.info('device: attempting to register a new device');\n _this.clear();\n return _this.register(deviceRegistrationOptions);\n }\n return _promise.default.reject(reason);\n });\n });\n },\n /**\n * Fetches the web devices and deletes the third of them which are not recent devices in use\n * @returns {Promise<void, Error>}\n */\n deleteDevices: function deleteDevices() {\n var _this2 = this;\n // Fetch devices with a GET request\n return this.request({\n method: 'GET',\n service: 'wdm',\n resource: 'devices'\n }).then(function (response) {\n var devices = response.body.devices;\n var _this2$_getBody = _this2._getBody(),\n deviceType = _this2$_getBody.deviceType;\n\n // Filter devices of type deviceType\n var webDevices = devices.filter(function (item) {\n return item.deviceType === deviceType;\n });\n var sortedDevices = (0, _lodash.orderBy)(webDevices, [function (item) {\n return new Date(item.modificationTime);\n }]);\n\n // If there are more than two devices, delete the last third\n if (sortedDevices.length > 2) {\n var totalItems = sortedDevices.length;\n var countToDelete = Math.ceil(totalItems / 3);\n var urlsToDelete = sortedDevices.slice(0, countToDelete).map(function (item) {\n return item.url;\n });\n return _promise.default.race(urlsToDelete.map(function (url) {\n return _this2.request({\n uri: url,\n method: 'DELETE'\n });\n }));\n }\n return _promise.default.resolve();\n }).catch(function (error) {\n _this2.logger.error('Failed to retrieve devices:', error);\n return _promise.default.reject(error);\n });\n },\n register: function register() {\n var _this3 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: registering');\n this.webex.internal.newMetrics.callDiagnosticMetrics.setDeviceInfo(this);\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is already registered and refresh instead.\n if (_this3.registered) {\n _this3.logger.info('device: device already registered, refreshing');\n return _this3.refresh(deviceRegistrationOptions);\n }\n return _this3._registerInternal(deviceRegistrationOptions).catch(function (error) {\n var _error$body;\n if ((error === null || error === void 0 ? void 0 : (_error$body = error.body) === null || _error$body === void 0 ? void 0 : _error$body.message) === 'User has excessive device registrations') {\n return _this3.deleteDevices().then(function () {\n return _this3._registerInternal(deviceRegistrationOptions);\n });\n }\n throw error;\n });\n });\n },\n _getBody: function _getBody() {\n return _objectSpread(_objectSpread({}, this.config.defaults.body ? this.config.defaults.body : {}), this.config.body ? this.config.body : {});\n },\n _registerInternal: function _registerInternal() {\n var _this4 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: making registration request');\n\n // Merge body configurations, overriding defaults.\n var body = this._getBody();\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread({}, this.config.defaults.headers ? this.config.defaults.headers : {}), this.config.headers ? this.config.headers : {});\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n this.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.request'\n });\n var _deviceRegistrationOp2 = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp2 === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp2;\n var requestId = _uuid.default.v4();\n this.set('register-request-id', requestId);\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(this.config.energyForecast && this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).catch(function (error) {\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n throw error;\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this4.get('register-request-id') !== requestId) {\n _this4.logger.info('device: register request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n\n // Do not add any processing of response above this as that will affect timestamp\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);\n return _this4.processRegistrationSuccess(response);\n }).catch(function (error) {\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {\n error: error\n }\n });\n throw error;\n });\n },\n unregister: function unregister() {\n var _this5 = this;\n this.logger.info('device: unregistering');\n if (!this.registered) {\n this.logger.warn('device: not registered');\n return _promise.default.resolve();\n }\n return this.request({\n uri: this.url,\n method: 'DELETE'\n }).then(function () {\n return _this5.clear();\n }).catch(function (reason) {\n if (reason.statusCode === 404) {\n _this5.logger.info('device: 404 when deleting device, device is already deleted, clearing device');\n _this5.clear();\n }\n throw reason;\n });\n },\n /* eslint-enable require-jsdoc */\n // Helper method members\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister: function canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(function () {\n return (\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm') ? _promise.default.resolve() : _promise.default.reject(new Error(['device: cannot register,', \"'wdm' service is not available from the postauth catalog\"].join(' ')))\n );\n });\n },\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability: function checkNetworkReachability() {\n var _this6 = this;\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n var headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null\n };\n\n // Send the network reachability request.\n return this.request({\n headers: headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl\n }).then(function () {\n _this6.isInNetwork = true;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n }).catch(function () {\n _this6.logger.info('device: did not reach ping endpoint');\n _this6.logger.info('device: triggering off-network timer');\n _this6.isInNetwork = false;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n });\n },\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear: function clear() {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.clear, this, args);\n },\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl: function getWebSocketUrl() {\n var _this7 = this;\n var wait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration().then(function () {\n return services.convertUrlToPriorityHostUrl(_this7.webSocketUrl);\n }).catch(function (error) {\n _this7.logger.warn(error.message);\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return _promise.default.reject(new Error('device: cannot get websocket url, device is not registered'));\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n var wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return _promise.default.resolve(wsUrl);\n }\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n },\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess: function processRegistrationSuccess(response) {\n var _this8 = this;\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n var body = _objectSpread({}, response.body);\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n var _ref = response.headers || {},\n etag = _ref.etag;\n if (this.etag && etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n var features = body.features;\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({\n etag: etag\n });\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n var delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this8.refresh();\n }, delay);\n }\n\n // Emit the registration:success event.\n this.trigger(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer: function resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (!this.isInMeeting && this.config.enableInactivityEnforcement && this.isReachabilityChecked) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n } else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer: function setLogoutTimer(duration) {\n var _this9 = this;\n this.logger.info('device: setting logout timer');\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', function () {\n _this9.resetLogoutTimer();\n });\n\n // Initialize a new timer.\n this.logoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n _this9.webex.logout();\n }, duration * 1000);\n },\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration: function waitForRegistration() {\n var _this10 = this;\n var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n this.logger.info('device: waiting for registration');\n return new _promise.default(function (resolve, reject) {\n if (_this10.registered) {\n resolve();\n }\n var timeoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return reject(new Error('device: timeout occured while waiting for registration'));\n }, timeout * 1000);\n _this10.once(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, function () {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n markUrlFailedAndGetNew: function markUrlFailedAndGetNew(url) {\n return _promise.default.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n initialize: function initialize() {\n var _this11 = this;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n // Prototype the extended class in order to preserve the parent member.\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n _constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {\n _this11.features.on(\"change:\".concat(collectionName), function (model, value, options) {\n _this11.trigger('change', _this11, options);\n _this11.trigger('change:features', _this11, _this11.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', function () {\n _this11.lastUserActivityDate = (0, _now.default)();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', function () {\n _this11.isInMeeting = true;\n _this11.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', function () {\n _this11.isInMeeting = false;\n _this11.resetLogoutTimer();\n });\n } /* eslint-enable require-jsdoc */,\n version: \"3.8.0-next.11\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"register\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"register\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"_registerInternal\", [_common.oneFlight, _dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"_registerInternal\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"unregister\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"unregister\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"markUrlFailedAndGetNew\", [_dec5], (0, _getOwnPropertyDescriptor.default)(_obj, \"markUrlFailedAndGetNew\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Device;\n//# sourceMappingURL=device.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/device.js?");
2966
2966
 
2967
2967
  /***/ }),
2968
2968
 
@@ -3039,7 +3039,7 @@ eval("\n\nvar _Reflect$construct = __webpack_require__(/*! @babel/runtime-corejs
3039
3039
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3040
3040
 
3041
3041
  "use strict";
3042
- eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\n/*!\n * Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar STATE = {\n INITIAL: 'initial',\n IN_PROGRESS: 'in-progress',\n IDLE: 'idle'\n};\n\n/**\n * @class\n */\nvar IpNetworkDetector = _webexCore.WebexPlugin.extend({\n idAttribute: 'IpNetworkDetectorId',\n namespace: 'Device',\n props: {\n firstIpV4: ['number', true, -1],\n // time [ms] it took to receive first IPv4 candidate\n firstIpV6: ['number', true, -1],\n // time [ms] it took to receive first IPv6 candidate\n firstMdns: ['number', true, -1],\n // time [ms] it took to receive first mDNS candidate\n totalTime: ['number', true, -1],\n // total time [ms] it took to do the last IP network detection\n state: ['string', true, STATE.INITIAL],\n pendingDetection: ['object', false, undefined]\n },\n derived: {\n /**\n * True if we know we're on an IPv4 network,\n * False if we know that we are not on an IPv4 network,\n * undefined if we are not sure\n */\n supportsIpV4: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV4 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV4 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n },\n /**\n * True if we know we're on an IPv6 network,\n * False if we know that we are not on an IPv6 network,\n * undefined if we are not sure\n */\n supportsIpV6: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV6 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV6 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n }\n },\n /**\n * Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions\n *\n * @private\n * @returns {boolean}\n */\n receivedOnlyMDnsCandidates: function receivedOnlyMDnsCandidates() {\n return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;\n },\n /**\n *\n * @param {RTCPeerConnection} pc Peer connection to use\n * @private\n * @returns {Promise<void>}\n */\n gatherLocalCandidates: function gatherLocalCandidates(pc) {\n var _this = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new _promise.default(function (resolve, reject) {\n var done = false;\n _this.firstIpV4 = -1;\n _this.firstIpV6 = -1;\n _this.firstMdns = -1;\n _this.totalTime = -1;\n var startTime = performance.now();\n var doneGatheringIceCandidates = function doneGatheringIceCandidates() {\n if (done) {\n return;\n }\n done = true;\n _this.totalTime = performance.now() - startTime;\n resolve();\n };\n pc.onicecandidate = function (event) {\n var _event$candidate;\n if ((_event$candidate = event.candidate) !== null && _event$candidate !== void 0 && _event$candidate.address) {\n if (event.candidate.address.endsWith('.local')) {\n // if we don't have camera/mic permissions, browser just gives us mDNS candidates\n if (_this.firstMdns === -1) {\n _this.firstMdns = performance.now() - startTime;\n }\n } else if (event.candidate.address.includes(':')) {\n if (_this.firstIpV6 === -1) {\n _this.firstIpV6 = performance.now() - startTime;\n }\n } else if (_this.firstIpV4 === -1) {\n _this.firstIpV4 = performance.now() - startTime;\n }\n if (_this.firstIpV4 >= 0 && _this.firstIpV6 >= 0) {\n // if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now\n resolve();\n }\n } else if (event.candidate === null) {\n doneGatheringIceCandidates();\n }\n };\n pc.onicegatheringstatechange = function () {\n if (pc.iceGatheringState === 'complete') {\n doneGatheringIceCandidates();\n }\n };\n pc.createDataChannel('data');\n pc.createOffer().then(function (offer) {\n return pc.setLocalDescription(offer);\n }).catch(function (e) {\n _this.webex.logger.error('Failed to detect ip network version:', e);\n reject(e);\n });\n }));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n /**\n * Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the\n * supportsIpV4 and supportsIpV6 props to find out the result.\n *\n * @param {boolean} force - if false, the detection will only be done if we haven't managed to get any meaningful results yet\n * @returns {Promise<void>}\n */\n detect: function detect() {\n var _arguments = arguments,\n _this2 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {\n var force, results, pc, forceParam;\n return _regenerator.default.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n force = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : false;\n if (!(_this2.state === STATE.IN_PROGRESS)) {\n _context2.next = 4;\n break;\n }\n _this2.pendingDetection = {\n force: force\n };\n return _context2.abrupt(\"return\");\n case 4:\n if (!(!force && _this2.state !== STATE.INITIAL && !_this2.receivedOnlyMDnsCandidates())) {\n _context2.next = 6;\n break;\n }\n return _context2.abrupt(\"return\");\n case 6:\n _context2.prev = 6;\n _this2.state = STATE.IN_PROGRESS;\n pc = new RTCPeerConnection();\n _context2.next = 11;\n return _this2.gatherLocalCandidates(pc);\n case 11:\n results = _context2.sent;\n case 12:\n _context2.prev = 12;\n pc.close();\n _this2.state = STATE.IDLE;\n return _context2.finish(12);\n case 16:\n if (_this2.pendingDetection) {\n forceParam = _this2.pendingDetection.force;\n _this2.pendingDetection = undefined;\n _this2.detect(forceParam);\n }\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, null, [[6,, 12, 16]]);\n }))();\n },\n version: \"3.8.0-next.10\"\n});\nvar _default = exports[\"default\"] = IpNetworkDetector;\n//# sourceMappingURL=ipNetworkDetector.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js?");
3042
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\n/*!\n * Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar STATE = {\n INITIAL: 'initial',\n IN_PROGRESS: 'in-progress',\n IDLE: 'idle'\n};\n\n/**\n * @class\n */\nvar IpNetworkDetector = _webexCore.WebexPlugin.extend({\n idAttribute: 'IpNetworkDetectorId',\n namespace: 'Device',\n props: {\n firstIpV4: ['number', true, -1],\n // time [ms] it took to receive first IPv4 candidate\n firstIpV6: ['number', true, -1],\n // time [ms] it took to receive first IPv6 candidate\n firstMdns: ['number', true, -1],\n // time [ms] it took to receive first mDNS candidate\n totalTime: ['number', true, -1],\n // total time [ms] it took to do the last IP network detection\n state: ['string', true, STATE.INITIAL],\n pendingDetection: ['object', false, undefined]\n },\n derived: {\n /**\n * True if we know we're on an IPv4 network,\n * False if we know that we are not on an IPv4 network,\n * undefined if we are not sure\n */\n supportsIpV4: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV4 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV4 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n },\n /**\n * True if we know we're on an IPv6 network,\n * False if we know that we are not on an IPv6 network,\n * undefined if we are not sure\n */\n supportsIpV6: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV6 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV6 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n }\n },\n /**\n * Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions\n *\n * @private\n * @returns {boolean}\n */\n receivedOnlyMDnsCandidates: function receivedOnlyMDnsCandidates() {\n return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;\n },\n /**\n *\n * @param {RTCPeerConnection} pc Peer connection to use\n * @private\n * @returns {Promise<void>}\n */\n gatherLocalCandidates: function gatherLocalCandidates(pc) {\n var _this = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new _promise.default(function (resolve, reject) {\n var done = false;\n _this.firstIpV4 = -1;\n _this.firstIpV6 = -1;\n _this.firstMdns = -1;\n _this.totalTime = -1;\n var startTime = performance.now();\n var doneGatheringIceCandidates = function doneGatheringIceCandidates() {\n if (done) {\n return;\n }\n done = true;\n _this.totalTime = performance.now() - startTime;\n resolve();\n };\n pc.onicecandidate = function (event) {\n var _event$candidate;\n if ((_event$candidate = event.candidate) !== null && _event$candidate !== void 0 && _event$candidate.address) {\n if (event.candidate.address.endsWith('.local')) {\n // if we don't have camera/mic permissions, browser just gives us mDNS candidates\n if (_this.firstMdns === -1) {\n _this.firstMdns = performance.now() - startTime;\n }\n } else if (event.candidate.address.includes(':')) {\n if (_this.firstIpV6 === -1) {\n _this.firstIpV6 = performance.now() - startTime;\n }\n } else if (_this.firstIpV4 === -1) {\n _this.firstIpV4 = performance.now() - startTime;\n }\n if (_this.firstIpV4 >= 0 && _this.firstIpV6 >= 0) {\n // if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now\n resolve();\n }\n } else if (event.candidate === null) {\n doneGatheringIceCandidates();\n }\n };\n pc.onicegatheringstatechange = function () {\n if (pc.iceGatheringState === 'complete') {\n doneGatheringIceCandidates();\n }\n };\n pc.createDataChannel('data');\n pc.createOffer().then(function (offer) {\n return pc.setLocalDescription(offer);\n }).catch(function (e) {\n _this.webex.logger.error('Failed to detect ip network version:', e);\n reject(e);\n });\n }));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n /**\n * Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the\n * supportsIpV4 and supportsIpV6 props to find out the result.\n *\n * @param {boolean} force - if false, the detection will only be done if we haven't managed to get any meaningful results yet\n * @returns {Promise<void>}\n */\n detect: function detect() {\n var _arguments = arguments,\n _this2 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {\n var force, results, pc, forceParam;\n return _regenerator.default.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n force = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : false;\n if (!(_this2.state === STATE.IN_PROGRESS)) {\n _context2.next = 4;\n break;\n }\n _this2.pendingDetection = {\n force: force\n };\n return _context2.abrupt(\"return\");\n case 4:\n if (!(!force && _this2.state !== STATE.INITIAL && !_this2.receivedOnlyMDnsCandidates())) {\n _context2.next = 6;\n break;\n }\n return _context2.abrupt(\"return\");\n case 6:\n _context2.prev = 6;\n _this2.state = STATE.IN_PROGRESS;\n pc = new RTCPeerConnection();\n _context2.next = 11;\n return _this2.gatherLocalCandidates(pc);\n case 11:\n results = _context2.sent;\n case 12:\n _context2.prev = 12;\n pc.close();\n _this2.state = STATE.IDLE;\n return _context2.finish(12);\n case 16:\n if (_this2.pendingDetection) {\n forceParam = _this2.pendingDetection.force;\n _this2.pendingDetection = undefined;\n _this2.detect(forceParam);\n }\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, null, [[6,, 12, 16]]);\n }))();\n },\n version: \"3.8.0-next.11\"\n});\nvar _default = exports[\"default\"] = IpNetworkDetector;\n//# sourceMappingURL=ipNetworkDetector.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-mercury/node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js?");
3043
3043
 
3044
3044
  /***/ }),
3045
3045
 
@@ -3303,7 +3303,7 @@ eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/t
3303
3303
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3304
3304
 
3305
3305
  "use strict";
3306
- eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nexports.getOSNameInternal = getOSNameInternal;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-metrics/node_modules/@webex/common/dist/index.js\");\nvar _config = __webpack_require__(/*! ./config */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/config.js\");\nvar _batcher = _interopRequireDefault(__webpack_require__(/*! ./batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/batcher.js\"));\nvar _clientMetricsBatcher = _interopRequireDefault(__webpack_require__(/*! ./client-metrics-batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/client-metrics-batcher.js\"));\nvar _clientMetricsPreloginBatcher = _interopRequireDefault(__webpack_require__(/*! ./client-metrics-prelogin-batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/client-metrics-prelogin-batcher.js\"));\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable default-param-last */ /*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nvar _BrowserDetection = (0, _common.BrowserDetection)(),\n getOSName = _BrowserDetection.getOSName,\n getOSVersion = _BrowserDetection.getOSVersion,\n getBrowserName = _BrowserDetection.getBrowserName,\n getBrowserVersion = _BrowserDetection.getBrowserVersion;\nfunction getOSNameInternal() {\n var _OSMap$getOSName;\n return (_OSMap$getOSName = _config.OSMap[getOSName()]) !== null && _OSMap$getOSName !== void 0 ? _OSMap$getOSName : _config.OS_NAME.OTHERS;\n}\nfunction getSparkUserAgent(webex) {\n var _webex$config;\n var _ref = (_webex$config = webex === null || webex === void 0 ? void 0 : webex.config) !== null && _webex$config !== void 0 ? _webex$config : {},\n appName = _ref.appName,\n appVersion = _ref.appVersion,\n appPlatform = _ref.appPlatform;\n var sparkUserAgent = _config.CLIENT_NAME;\n if (appName) {\n sparkUserAgent += \" \".concat(appName, \"/\").concat(appVersion !== null && appVersion !== void 0 ? appVersion : '0.0');\n }\n if (appPlatform) {\n sparkUserAgent += \" \".concat(appPlatform);\n }\n return sparkUserAgent;\n}\nvar Metrics = _webexCore.WebexPlugin.extend({\n children: {\n batcher: _batcher.default,\n clientMetricsBatcher: _clientMetricsBatcher.default,\n clientMetricsPreloginBatcher: _clientMetricsPreloginBatcher.default\n },\n namespace: 'Metrics',\n submit: function submit(key, value) {\n return this.batcher.request(_objectSpread({\n key: key\n }, value));\n },\n /**\n * Returns the payload for submitting client metrics.\n * @param {string} eventName\n * @param {any} props\n * @returns {any} - the payload\n */\n getClientMetricsPayload: function getClientMetricsPayload(eventName, props) {\n var _this$webex$meetings, _this$webex$meetings$, _this$webex$meetings$2;\n if (!eventName) {\n throw Error('Missing behavioral metric name. Please provide one');\n }\n var payload = {\n metricName: eventName\n };\n // @ts-ignore\n var providedClientVersion = (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$ = _this$webex$meetings.config) === null || _this$webex$meetings$ === void 0 ? void 0 : (_this$webex$meetings$2 = _this$webex$meetings$.metrics) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.clientVersion;\n payload.tags = _objectSpread(_objectSpread({}, props.tags), {}, {\n browser: getBrowserName(),\n os: getOSNameInternal(),\n appVersion: providedClientVersion,\n // Node does not like this so we need to check if it exists or not\n // eslint-disable-next-line no-undef\n domain: typeof window !== 'undefined' ? window.location.hostname || 'non-browser' : 'non-browser' // Check what else we could measure\n });\n\n payload.fields = _objectSpread(_objectSpread({}, props.fields), {}, {\n browser_version: getBrowserVersion(),\n os_version: getOSVersion(),\n sdk_version: this.webex.version,\n platform: 'Web',\n spark_user_agent: getSparkUserAgent(this.webex),\n client_id: this.webex.credentials.config.client_id\n });\n payload.type = props.type || this.webex.config.metrics.type;\n payload.context = _objectSpread(_objectSpread({}, props.context), {}, {\n app: {\n version: this.webex.version\n },\n locale: 'en-US',\n os: {\n name: getOSNameInternal(),\n version: getOSVersion()\n }\n });\n if (props.eventPayload) {\n payload.eventPayload = props.eventPayload;\n }\n\n // Mocking the time in tests when running in node\n // is impossible so unable to use Date.now()\n payload.timestamp = new Date().valueOf();\n return payload;\n },\n /**\n * This corresponds to #sendSemiStructured() in the deprecated metrics handler\n * @param {string} eventName\n * @param {Object} props\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n submitClientMetrics: function submitClientMetrics(eventName) {\n var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var preLoginId = arguments.length > 2 ? arguments[2] : undefined;\n var payload = this.getClientMetricsPayload(eventName, props);\n if (preLoginId) {\n this.clientMetricsPreloginBatcher.savePreLoginId(preLoginId);\n return this.clientMetricsPreloginBatcher.request(payload);\n }\n return this.clientMetricsBatcher.request(payload);\n },\n /**\n * Issue request to alias a user's pre-login ID with their CI UUID\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n aliasUser: function aliasUser(preLoginId) {\n return this.request({\n method: 'POST',\n api: 'metrics',\n resource: 'clientmetrics',\n headers: {\n 'x-prelogin-userid': preLoginId\n },\n body: {},\n qs: {\n alias: true\n }\n });\n },\n version: \"3.8.0-next.10\"\n});\nvar _default = exports[\"default\"] = Metrics;\n//# sourceMappingURL=metrics.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-metrics/dist/metrics.js?");
3306
+ eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nexports.getOSNameInternal = getOSNameInternal;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/internal-plugin-metrics/node_modules/@webex/common/dist/index.js\");\nvar _config = __webpack_require__(/*! ./config */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/config.js\");\nvar _batcher = _interopRequireDefault(__webpack_require__(/*! ./batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/batcher.js\"));\nvar _clientMetricsBatcher = _interopRequireDefault(__webpack_require__(/*! ./client-metrics-batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/client-metrics-batcher.js\"));\nvar _clientMetricsPreloginBatcher = _interopRequireDefault(__webpack_require__(/*! ./client-metrics-prelogin-batcher */ \"../../../node_modules/@webex/internal-plugin-metrics/dist/client-metrics-prelogin-batcher.js\"));\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable default-param-last */ /*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nvar _BrowserDetection = (0, _common.BrowserDetection)(),\n getOSName = _BrowserDetection.getOSName,\n getOSVersion = _BrowserDetection.getOSVersion,\n getBrowserName = _BrowserDetection.getBrowserName,\n getBrowserVersion = _BrowserDetection.getBrowserVersion;\nfunction getOSNameInternal() {\n var _OSMap$getOSName;\n return (_OSMap$getOSName = _config.OSMap[getOSName()]) !== null && _OSMap$getOSName !== void 0 ? _OSMap$getOSName : _config.OS_NAME.OTHERS;\n}\nfunction getSparkUserAgent(webex) {\n var _webex$config;\n var _ref = (_webex$config = webex === null || webex === void 0 ? void 0 : webex.config) !== null && _webex$config !== void 0 ? _webex$config : {},\n appName = _ref.appName,\n appVersion = _ref.appVersion,\n appPlatform = _ref.appPlatform;\n var sparkUserAgent = _config.CLIENT_NAME;\n if (appName) {\n sparkUserAgent += \" \".concat(appName, \"/\").concat(appVersion !== null && appVersion !== void 0 ? appVersion : '0.0');\n }\n if (appPlatform) {\n sparkUserAgent += \" \".concat(appPlatform);\n }\n return sparkUserAgent;\n}\nvar Metrics = _webexCore.WebexPlugin.extend({\n children: {\n batcher: _batcher.default,\n clientMetricsBatcher: _clientMetricsBatcher.default,\n clientMetricsPreloginBatcher: _clientMetricsPreloginBatcher.default\n },\n namespace: 'Metrics',\n submit: function submit(key, value) {\n return this.batcher.request(_objectSpread({\n key: key\n }, value));\n },\n /**\n * Returns the payload for submitting client metrics.\n * @param {string} eventName\n * @param {any} props\n * @returns {any} - the payload\n */\n getClientMetricsPayload: function getClientMetricsPayload(eventName, props) {\n var _this$webex$meetings, _this$webex$meetings$, _this$webex$meetings$2;\n if (!eventName) {\n throw Error('Missing behavioral metric name. Please provide one');\n }\n var payload = {\n metricName: eventName\n };\n // @ts-ignore\n var providedClientVersion = (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$ = _this$webex$meetings.config) === null || _this$webex$meetings$ === void 0 ? void 0 : (_this$webex$meetings$2 = _this$webex$meetings$.metrics) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.clientVersion;\n payload.tags = _objectSpread(_objectSpread({}, props.tags), {}, {\n browser: getBrowserName(),\n os: getOSNameInternal(),\n appVersion: providedClientVersion,\n // Node does not like this so we need to check if it exists or not\n // eslint-disable-next-line no-undef\n domain: typeof window !== 'undefined' ? window.location.hostname || 'non-browser' : 'non-browser' // Check what else we could measure\n });\n\n payload.fields = _objectSpread(_objectSpread({}, props.fields), {}, {\n browser_version: getBrowserVersion(),\n os_version: getOSVersion(),\n sdk_version: this.webex.version,\n platform: 'Web',\n spark_user_agent: getSparkUserAgent(this.webex),\n client_id: this.webex.credentials.config.client_id\n });\n payload.type = props.type || this.webex.config.metrics.type;\n payload.context = _objectSpread(_objectSpread({}, props.context), {}, {\n app: {\n version: this.webex.version\n },\n locale: 'en-US',\n os: {\n name: getOSNameInternal(),\n version: getOSVersion()\n }\n });\n if (props.eventPayload) {\n payload.eventPayload = props.eventPayload;\n }\n\n // Mocking the time in tests when running in node\n // is impossible so unable to use Date.now()\n payload.timestamp = new Date().valueOf();\n return payload;\n },\n /**\n * This corresponds to #sendSemiStructured() in the deprecated metrics handler\n * @param {string} eventName\n * @param {Object} props\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n submitClientMetrics: function submitClientMetrics(eventName) {\n var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var preLoginId = arguments.length > 2 ? arguments[2] : undefined;\n var payload = this.getClientMetricsPayload(eventName, props);\n if (preLoginId) {\n this.clientMetricsPreloginBatcher.savePreLoginId(preLoginId);\n return this.clientMetricsPreloginBatcher.request(payload);\n }\n return this.clientMetricsBatcher.request(payload);\n },\n /**\n * Issue request to alias a user's pre-login ID with their CI UUID\n * @param {string} preLoginId\n * @returns {Object} HttpResponse object\n */\n aliasUser: function aliasUser(preLoginId) {\n return this.request({\n method: 'POST',\n api: 'metrics',\n resource: 'clientmetrics',\n headers: {\n 'x-prelogin-userid': preLoginId\n },\n body: {},\n qs: {\n alias: true\n }\n });\n },\n version: \"3.8.0-next.11\"\n});\nvar _default = exports[\"default\"] = Metrics;\n//# sourceMappingURL=metrics.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/internal-plugin-metrics/dist/metrics.js?");
3307
3307
 
3308
3308
  /***/ }),
3309
3309
 
@@ -3688,7 +3688,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
3688
3688
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3689
3689
 
3690
3690
  "use strict";
3691
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _events = _interopRequireDefault(__webpack_require__(/*! events */ \"../../../node_modules/events/events.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _constants2 = __webpack_require__(/*! ./services/constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _services = _interopRequireDefault(__webpack_require__(/*! ./services */ \"../../../node_modules/@webex/plugin-cc/dist/services/index.js\"));\nvar _HttpRequest = _interopRequireDefault(__webpack_require__(/*! ./services/core/HttpRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js\"));\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ./logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _Utils = __webpack_require__(/*! ./services/core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types2 = __webpack_require__(/*! ./services/config/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/types.js\");\nvar _constants3 = __webpack_require__(/*! ./services/config/constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/constants.js\");\nvar _TaskManager = _interopRequireDefault(__webpack_require__(/*! ./services/task/TaskManager */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/TaskManager.js\"));\nvar _WebCallingService = _interopRequireDefault(__webpack_require__(/*! ./services/WebCallingService */ \"../../../node_modules/@webex/plugin-cc/dist/services/WebCallingService.js\"));\nvar _types3 = __webpack_require__(/*! ./services/task/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/types.js\");\nvar _MetricsManager = _interopRequireDefault(__webpack_require__(/*! ./metrics/MetricsManager */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js\"));\nvar _constants4 = __webpack_require__(/*! ./metrics/constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass ContactCenter extends _webexCore.WebexPlugin {\n namespace = 'cc';\n LoggerProxy = _loggerProxy.default;\n constructor(...args) {\n super(...args);\n this.eventEmitter = new _events.default();\n // @ts-ignore\n this.$webex = this.webex;\n this.$webex.once(_constants.READY, () => {\n // @ts-ignore\n this.$config = this.config;\n\n /**\n * This is used for handling the async requests by sending webex.request and wait for corresponding websocket event.\n */\n this.httpRequest = _HttpRequest.default.getInstance({\n webex: this.$webex\n });\n this.services = _services.default.getInstance({\n webex: this.$webex,\n connectionConfig: this.getConnectionConfig()\n });\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n this.webCallingService = new _WebCallingService.default(this.$webex);\n this.metricsManager = _MetricsManager.default.getInstance({\n webex: this.$webex\n });\n this.taskManager = _TaskManager.default.getTaskManager(this.services.contact, this.webCallingService, this.services.webSocketManager);\n this.incomingTaskListener();\n _loggerProxy.default.initialize(this.$webex.logger);\n });\n }\n handleIncomingTask = task => {\n // @ts-ignore\n this.trigger(_types3.TASK_EVENTS.TASK_INCOMING, task);\n };\n handleTaskHydrate = task => {\n // @ts-ignore\n this.trigger(_types3.TASK_EVENTS.TASK_HYDRATE, task);\n };\n\n /**\n * An Incoming Call listener.\n */\n incomingTaskListener() {\n this.taskManager.on(_types3.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n this.taskManager.on(_types3.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n }\n\n /**\n * This is used for making the CC SDK ready by setting up the cc mercury connection.\n */\n async register() {\n try {\n this.setupEventListeners();\n return await this.connectWebsocket();\n } catch (error) {\n _loggerProxy.default.error(`Error during register: ${error}`, {\n module: _constants.CC_FILE,\n method: this.register.name\n });\n throw error;\n }\n }\n\n /**\n * Returns the list of buddy agents in the given state and media according to agent profile settings\n *\n * @param {BuddyAgents} data - The data required to fetch buddy agents, including additional agent profile information.\n * @returns {Promise<BuddyAgentsResponse>} A promise that resolves to the response containing buddy agents information.\n * @throws Error\n * @example getBuddyAgents({state: 'Available', mediaType: 'telephony'})\n */\n async getBuddyAgents(data) {\n try {\n return await this.services.agent.buddyAgents({\n data: {\n agentProfileId: this.agentConfig.agentProfileID,\n ...data\n }\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'getBuddyAgents', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for connecting the websocket and fetching the agent profile.\n * @returns Promise<Profile>\n * @throws Error\n * @private\n */\n async connectWebsocket() {\n try {\n return this.services.webSocketManager.initWebSocket({\n body: this.getConnectionConfig()\n }).then(async data => {\n const agentId = data.agentId;\n const orgId = this.$webex.credentials.getOrgId();\n this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);\n _loggerProxy.default.log(`Agent config is fetched successfully`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER)) {\n this.$webex.internal.mercury.connect().then(() => {\n _loggerProxy.default.info('Authentication: webex.internal.mercury.connect successful', {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n }).catch(error => {\n _loggerProxy.default.error(`Error occurred during mercury.connect() ${error}`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n });\n }\n if (this.$config && this.$config.allowAutomatedRelogin) {\n await this.silentRelogin();\n }\n return this.agentConfig;\n }).catch(error => {\n throw error;\n });\n } catch (error) {\n _loggerProxy.default.error(`Error during register: ${error}`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n throw error;\n }\n }\n\n /**\n * This is used for agent login.\n * @param data\n * @returns Promise<StationLoginResponse>\n * @throws Error\n */\n async stationLogin(data) {\n try {\n this.metricsManager.timeEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGIN);\n const loginResponse = this.services.agent.stationLogin({\n data: {\n dialNumber: data.loginOption === _types.LoginOption.BROWSER ? this.agentConfig.agentId : data.dialNumber,\n teamId: data.teamId,\n deviceType: data.loginOption,\n isExtension: data.loginOption === _types.LoginOption.EXTENSION,\n deviceId: this.getDeviceId(data.loginOption, data.dialNumber),\n roles: [_constants2.AGENT],\n // TODO: The public API should not have the following properties so filling them with empty values for now. If needed, we can add them in the future.\n teamName: _constants.EMPTY_STRING,\n siteId: _constants.EMPTY_STRING,\n usesOtherDN: false,\n auxCodeId: _constants.EMPTY_STRING\n }\n });\n if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER) {\n await this.webCallingService.registerWebCallingLine();\n }\n this.webCallingService.setLoginOption(data.loginOption);\n const resp = await loginResponse;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGIN, {\n isSuccess: true,\n loginType: data.loginOption,\n agentId: resp.data.agentId,\n teamId: resp.data.teamId,\n siteId: resp.data.siteId,\n roles: resp.data.roles.join(','),\n trackingId: resp.data.trackingId,\n notifTrackingId: resp.trackingId,\n orgId: resp.orgId,\n dataEventType: resp.data.eventType,\n eventType: resp.type\n }, ['behavioral', 'business', 'operational']);\n\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n // this.incomingTaskListener();\n\n return resp;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationLogin', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /** This is used for agent logout.\n * @param data\n * @returns Promise<StationLogoutResponse>\n * @throws Error\n */\n async stationLogout(data) {\n try {\n const logoutResponse = this.services.agent.logout({\n data\n });\n await logoutResponse;\n if (this.webCallingService) {\n this.webCallingService.deregisterWebCallingLine();\n }\n\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.services.webSocketManager.off('message', this.handleWebSocketMessage);\n // this.taskManager.unregisterIncomingCallEvent();\n // this.taskManager.off(TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n // this.taskManager.off(TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n\n return logoutResponse;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationLogout', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /* This is used for agent relogin.\n * @returns Promise<StationReLoginResponse>\n * @throws Error\n */\n async stationReLogin() {\n try {\n const reLoginResponse = await this.services.agent.reload();\n return reLoginResponse;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationReLogin', _constants.CC_FILE);\n throw detailedError;\n }\n }\n getDeviceId(loginOption, dialNumber) {\n if (loginOption === _types.LoginOption.EXTENSION || loginOption === _types.LoginOption.AGENT_DN) {\n return dialNumber;\n }\n return _constants2.WEB_RTC_PREFIX + this.agentConfig.agentId;\n }\n\n /**\n * This is used for setting agent state.\n * @param options\n * @returns Promise<SetStateResponse>\n * @throws Error\n */\n\n async setAgentState(data) {\n try {\n const agentStatusResponse = await this.services.agent.stateChange({\n data: {\n ...data,\n agentId: data.agentId || this.agentConfig.agentId\n }\n });\n _loggerProxy.default.log(`SET AGENT STATUS API SUCCESS`, {\n module: _constants.CC_FILE,\n method: this.setAgentState.name\n });\n return agentStatusResponse;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'setAgentState', _constants.CC_FILE);\n throw detailedError;\n }\n }\n handleWebSocketMessage = event => {\n const eventData = JSON.parse(event);\n // Re-emit the events related to agent\n if (Object.values(_types2.CC_AGENT_EVENTS).includes(eventData.data?.type)) {\n // @ts-ignore\n this.emit(eventData.data.type, eventData.data);\n }\n if (eventData.type === _types2.CC_EVENTS.AGENT_STATE_CHANGE) {\n // @ts-ignore\n this.emit(_constants.AGENT_STATE_CHANGE, eventData.data);\n }\n if (eventData.type === _types2.CC_EVENTS.AGENT_MULTI_LOGIN) {\n // @ts-ignore\n this.emit(_constants.AGENT_MULTI_LOGIN, eventData.data);\n }\n };\n\n /**\n * For setting up the Event Emitter listeners and handlers\n */\n setupEventListeners() {\n this.services.connectionService.on('connectionLost', this.handleConnectionLost.bind(this));\n }\n\n /**\n * This method returns the connection configuration.\n */\n getConnectionConfig() {\n return {\n force: this.$config?.force ?? true,\n isKeepAliveEnabled: this.$config?.isKeepAliveEnabled ?? false,\n clientType: this.$config?.clientType ?? 'WebexCCSDK',\n allowMultiLogin: this.$config?.allowMultiLogin ?? true\n };\n }\n\n /**\n * Called when the reconnection has been completed\n */\n async handleConnectionLost(msg) {\n if (msg.isConnectionLost) {\n // TODO: Emit an event saying connection is lost\n _loggerProxy.default.info('event=handleConnectionLost | Connection lost', {\n module: _constants.CC_FILE,\n method: this.handleConnectionLost.name\n });\n } else if (msg.isSocketReconnected) {\n // TODO: Emit an event saying connection is re-estabilished\n _loggerProxy.default.info('event=handleConnectionReconnect | Connection reconnected attempting to request silent relogin', {\n module: _constants.CC_FILE,\n method: this.handleConnectionLost.name\n });\n if (this.$config && this.$config.allowAutomatedRelogin) {\n await this.silentRelogin();\n }\n }\n }\n\n /**\n * Called when we finish registration to silently handle the errors\n */\n async silentRelogin() {\n try {\n const reLoginResponse = await this.services.agent.reload();\n const {\n agentId,\n lastStateChangeReason,\n deviceType,\n dn,\n lastStateChangeTimestamp,\n lastIdleCodeChangeTimestamp\n } = reLoginResponse.data;\n let {\n auxCodeId\n } = reLoginResponse.data;\n this.agentConfig.lastStateChangeTimestamp = lastStateChangeTimestamp;\n this.agentConfig.lastIdleCodeChangeTimestamp = lastIdleCodeChangeTimestamp;\n\n // To handle re-registration of event listeners on silent relogin\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.incomingTaskListener();\n\n if (lastStateChangeReason === 'agent-wss-disconnect') {\n _loggerProxy.default.info('event=requestAutoStateChange | Requesting state change to available on socket reconnect', {\n module: _constants.CC_FILE,\n method: this.silentRelogin.name\n });\n auxCodeId = _constants3.AGENT_STATE_AVAILABLE_ID;\n const stateChangeData = {\n state: _constants3.AGENT_STATE_AVAILABLE,\n auxCodeId,\n lastStateChangeReason,\n agentId\n };\n try {\n const agentStatusResponse = await this.setAgentState(stateChangeData);\n this.agentConfig.lastStateChangeTimestamp = agentStatusResponse.data.lastStateChangeTimestamp;\n this.agentConfig.lastIdleCodeChangeTimestamp = agentStatusResponse.data.lastIdleCodeChangeTimestamp;\n } catch (error) {\n _loggerProxy.default.error(`event=requestAutoStateChange | Error requesting state change to available on socket reconnect: ${error}`, {\n module: _constants.CC_FILE,\n method: this.silentRelogin.name\n });\n }\n }\n this.agentConfig.lastStateAuxCodeId = auxCodeId;\n await this.handleDeviceType(deviceType, dn);\n this.agentConfig.isAgentLoggedIn = true;\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n } catch (error) {\n const {\n reason,\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'silentReLogin', _constants.CC_FILE);\n if (reason === 'AGENT_NOT_FOUND') {\n _loggerProxy.default.log('Agent not found during re-login, handling silently', {\n module: _constants.CC_FILE,\n method: 'silentRelogin'\n });\n return;\n }\n throw detailedError;\n }\n }\n\n /**\n * Handles the device type specific logic\n */\n async handleDeviceType(deviceType, dn) {\n switch (deviceType) {\n case _types.LoginOption.BROWSER:\n await this.webCallingService.registerWebCallingLine();\n break;\n case _types.LoginOption.AGENT_DN:\n case _types.LoginOption.EXTENSION:\n this.agentConfig.defaultDn = dn;\n break;\n default:\n _loggerProxy.default.error(`Unsupported device type: ${deviceType}`, {\n module: _constants.CC_FILE,\n method: this.handleDeviceType.name\n });\n throw new Error(`Unsupported device type: ${deviceType}`);\n }\n this.webCallingService.setLoginOption(deviceType);\n this.agentConfig.deviceType = deviceType;\n }\n\n /**\n * This is used for making the outdial call.\n * @param destination\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const destination = '1234567890';\n * const result = await webex.cc.startOutdial(destination).then(()=>{}).catch(()=>{});\n * ```\n */\n\n async startOutdial(destination) {\n try {\n // Construct the outdial payload.\n const outDialPayload = {\n destination,\n entryPointId: this.agentConfig.outDialEp,\n direction: _constants.OUTDIAL_DIRECTION,\n attributes: _constants.ATTRIBUTES,\n mediaType: _constants.OUTDIAL_MEDIA_TYPE,\n outboundType: _constants.OUTBOUND_TYPE\n };\n const result = await this.services.dialer.startOutdial({\n data: outDialPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'startOutdial', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for getting the list of queues.\n * @param search - optional\n * @param filter - optional\n * @param page - default is 0\n * @param pageSize - default is 100\n * @returns Promise<ContactServiceQueue[]>\n * @throws Error\n *\n * @example\n * ```typescript\n * const search = 'queue';\n * const filter = 'id == \"e23ad456-1ebd-1b43-b9d0-34f39c7dcb5e\"';\n * const page = 0;\n * const pageSize = 100;\n * const result = await webex.cc.getQueues(search, filter, page, pageSize);\n * ```\n */\n async getQueues(search, filter, page = _constants3.DEFAULT_PAGE, pageSize = _constants3.DEFAULT_PAGE_SIZE) {\n const orgId = this.$webex.credentials.getOrgId();\n if (!orgId) {\n _loggerProxy.default.error('Org ID not found.', {\n module: _constants.CC_FILE,\n method: this.getQueues.name\n });\n throw new Error('Org ID not found.');\n }\n return this.services.config.getQueues(orgId, page, pageSize, search, filter);\n }\n}\nexports[\"default\"] = ContactCenter;\n//# sourceMappingURL=cc.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/cc.js?");
3691
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _events = _interopRequireDefault(__webpack_require__(/*! events */ \"../../../node_modules/events/events.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _constants2 = __webpack_require__(/*! ./services/constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _services = _interopRequireDefault(__webpack_require__(/*! ./services */ \"../../../node_modules/@webex/plugin-cc/dist/services/index.js\"));\nvar _WebexRequest = _interopRequireDefault(__webpack_require__(/*! ./services/core/WebexRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js\"));\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ./logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _Utils = __webpack_require__(/*! ./services/core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types2 = __webpack_require__(/*! ./services/config/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/types.js\");\nvar _constants3 = __webpack_require__(/*! ./services/config/constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/constants.js\");\nvar _TaskManager = _interopRequireDefault(__webpack_require__(/*! ./services/task/TaskManager */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/TaskManager.js\"));\nvar _WebCallingService = _interopRequireDefault(__webpack_require__(/*! ./services/WebCallingService */ \"../../../node_modules/@webex/plugin-cc/dist/services/WebCallingService.js\"));\nvar _types3 = __webpack_require__(/*! ./services/task/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/types.js\");\nvar _MetricsManager = _interopRequireDefault(__webpack_require__(/*! ./metrics/MetricsManager */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js\"));\nvar _constants4 = __webpack_require__(/*! ./metrics/constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass ContactCenter extends _webexCore.WebexPlugin {\n namespace = 'cc';\n LoggerProxy = _loggerProxy.default;\n constructor(...args) {\n super(...args);\n this.eventEmitter = new _events.default();\n // @ts-ignore\n this.$webex = this.webex;\n this.$webex.once(_constants.READY, () => {\n // @ts-ignore\n this.$config = this.config;\n\n /**\n * This is used for handling the async requests by sending webex.request and wait for corresponding websocket event.\n */\n this.webexRequest = _WebexRequest.default.getInstance({\n webex: this.$webex\n });\n this.services = _services.default.getInstance({\n webex: this.$webex,\n connectionConfig: this.getConnectionConfig()\n });\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n this.webCallingService = new _WebCallingService.default(this.$webex);\n this.metricsManager = _MetricsManager.default.getInstance({\n webex: this.$webex\n });\n this.taskManager = _TaskManager.default.getTaskManager(this.services.contact, this.webCallingService, this.services.webSocketManager);\n this.incomingTaskListener();\n _loggerProxy.default.initialize(this.$webex.logger);\n });\n }\n handleIncomingTask = task => {\n // @ts-ignore\n this.trigger(_types3.TASK_EVENTS.TASK_INCOMING, task);\n };\n handleTaskHydrate = task => {\n // @ts-ignore\n this.trigger(_types3.TASK_EVENTS.TASK_HYDRATE, task);\n };\n\n /**\n * An Incoming Call listener.\n */\n incomingTaskListener() {\n this.taskManager.on(_types3.TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n this.taskManager.on(_types3.TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n }\n\n /**\n * This is used for making the CC SDK ready by setting up the cc mercury connection.\n */\n async register() {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_SUCCESS, _constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_FAILED]);\n this.setupEventListeners();\n const resp = await this.connectWebsocket();\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(resp),\n deviceType: resp.deviceType || _constants.EMPTY_STRING\n }, ['operational']);\n return resp;\n } catch (error) {\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_FAILED, {\n orgId: error.orgId\n }, ['operational']);\n _loggerProxy.default.error(`Error during register: ${error}`, {\n module: _constants.CC_FILE,\n method: this.register.name\n });\n throw error;\n }\n }\n\n /**\n * Returns the list of buddy agents in the given state and media according to agent profile settings\n *\n * @param {BuddyAgents} data - The data required to fetch buddy agents, including additional agent profile information.\n * @returns {Promise<BuddyAgentsResponse>} A promise that resolves to the response containing buddy agents information.\n * @throws Error\n * @example getBuddyAgents({state: 'Available', mediaType: 'telephony'})\n */\n async getBuddyAgents(data) {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_SUCCESS, _constants4.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_FAILED]);\n const resp = await this.services.agent.buddyAgents({\n data: {\n agentProfileId: this.agentConfig.agentProfileID,\n ...data\n }\n });\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(resp),\n mediaType: data.mediaType,\n buddyAgentState: data.state,\n buddyAgentCount: resp.data.agentList.length\n }, ['operational']);\n return resp;\n } catch (error) {\n const failureResp = error.details;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_FAILED, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failureResp),\n mediaType: data.mediaType,\n buddyAgentState: data.state\n }, ['operational']);\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'getBuddyAgents', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for connecting the websocket and fetching the agent profile.\n * @returns Promise<Profile>\n * @throws Error\n * @private\n */\n async connectWebsocket() {\n try {\n return this.services.webSocketManager.initWebSocket({\n body: this.getConnectionConfig()\n }).then(async data => {\n const agentId = data.agentId;\n const orgId = this.$webex.credentials.getOrgId();\n this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);\n _loggerProxy.default.log(`Agent config is fetched successfully`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n if (this.agentConfig.webRtcEnabled && this.agentConfig.loginVoiceOptions.includes(_types.LoginOption.BROWSER)) {\n this.$webex.internal.mercury.connect().then(() => {\n _loggerProxy.default.info('Authentication: webex.internal.mercury.connect successful', {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n }).catch(error => {\n _loggerProxy.default.error(`Error occurred during mercury.connect() ${error}`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n });\n }\n if (this.$config && this.$config.allowAutomatedRelogin) {\n await this.silentRelogin();\n }\n return this.agentConfig;\n }).catch(error => {\n throw error;\n });\n } catch (error) {\n _loggerProxy.default.error(`Error during register: ${error}`, {\n module: _constants.CC_FILE,\n method: this.connectWebsocket.name\n });\n throw error;\n }\n }\n\n /**\n * This is used for agent login.\n * @param data\n * @returns Promise<StationLoginResponse>\n * @throws Error\n */\n async stationLogin(data) {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.STATION_LOGIN_SUCCESS, _constants4.METRIC_EVENT_NAMES.STATION_LOGIN_FAILED]);\n const loginResponse = this.services.agent.stationLogin({\n data: {\n dialNumber: data.loginOption === _types.LoginOption.BROWSER ? this.agentConfig.agentId : data.dialNumber,\n teamId: data.teamId,\n deviceType: data.loginOption,\n isExtension: data.loginOption === _types.LoginOption.EXTENSION,\n deviceId: this.getDeviceId(data.loginOption, data.dialNumber),\n roles: [_constants2.AGENT],\n // TODO: The public API should not have the following properties so filling them with empty values for now. If needed, we can add them in the future.\n teamName: _constants.EMPTY_STRING,\n siteId: _constants.EMPTY_STRING,\n usesOtherDN: false,\n auxCodeId: _constants.EMPTY_STRING\n }\n });\n if (this.agentConfig.webRtcEnabled && data.loginOption === _types.LoginOption.BROWSER) {\n await this.webCallingService.registerWebCallingLine();\n }\n const resp = await loginResponse;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGIN_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(resp),\n loginType: data.loginOption,\n status: resp.data.status,\n // 'LoggedIn'\n type: resp.data.type,\n // 'AgentStationLoginSuccess'\n roles: resp.data.roles?.join(',') || _constants.EMPTY_STRING\n }, ['behavioral', 'business', 'operational']);\n\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n // this.incomingTaskListener();\n\n return resp;\n } catch (error) {\n const failure = error.details;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGIN_FAILED, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),\n loginType: data.loginOption\n }, ['behavioral', 'business', 'operational']);\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationLogin', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /** This is used for agent logout.\n * @param data\n * @returns Promise<StationLogoutResponse>\n * @throws Error\n */\n async stationLogout(data) {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_SUCCESS, _constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_FAILED]);\n const logoutResponse = this.services.agent.logout({\n data\n });\n const resp = await logoutResponse;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(resp),\n logoutReason: data.logoutReason\n }, ['behavioral', 'business', 'operational']);\n if (this.webCallingService) {\n this.webCallingService.deregisterWebCallingLine();\n }\n\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.services.webSocketManager.off('message', this.handleWebSocketMessage);\n // this.taskManager.unregisterIncomingCallEvent();\n // this.taskManager.off(TASK_EVENTS.TASK_INCOMING, this.handleIncomingTask);\n // this.taskManager.off(TASK_EVENTS.TASK_HYDRATE, this.handleTaskHydrate);\n\n return resp;\n } catch (error) {\n const failure = error.details;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_LOGOUT_FAILED, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),\n logoutReason: data.logoutReason\n }, ['behavioral', 'business', 'operational']);\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationLogout', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /* This is used for agent relogin.\n * @returns Promise<StationReLoginResponse>\n * @throws Error\n */\n async stationReLogin() {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.STATION_RELOGIN_SUCCESS, _constants4.METRIC_EVENT_NAMES.STATION_RELOGIN_FAILED]);\n const reLoginResponse = await this.services.agent.reload();\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_RELOGIN_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(reLoginResponse)\n }, ['behavioral', 'business', 'operational']);\n return reLoginResponse;\n } catch (error) {\n const failure = error.details;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.STATION_RELOGIN_FAILED, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure)\n }, ['behavioral', 'business', 'operational']);\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'stationReLogin', _constants.CC_FILE);\n throw detailedError;\n }\n }\n getDeviceId(loginOption, dialNumber) {\n if (loginOption === _types.LoginOption.EXTENSION || loginOption === _types.LoginOption.AGENT_DN) {\n return dialNumber;\n }\n return _constants2.WEB_RTC_PREFIX + this.agentConfig.agentId;\n }\n\n /**\n * This is used for setting agent state.\n * @param options\n * @returns Promise<SetStateResponse>\n * @throws Error\n */\n\n async setAgentState(data) {\n try {\n this.metricsManager.timeEvent([_constants4.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_SUCCESS, _constants4.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_FAILED]);\n const agentStatusResponse = await this.services.agent.stateChange({\n data: {\n ...data,\n agentId: data.agentId || this.agentConfig.agentId\n }\n });\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_SUCCESS, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponse(agentStatusResponse),\n requestedState: data.state,\n teamId: this.agentConfig?.teams[0]?.teamId ?? _constants.EMPTY_STRING,\n status: agentStatusResponse.data?.status,\n subStatus: agentStatusResponse.data?.subStatus,\n auxCodeId: data.auxCodeId,\n lastStateChangeReason: data.lastStateChangeReason || _constants.EMPTY_STRING\n }, ['behavioral', 'business', 'operational']);\n _loggerProxy.default.log(`SET AGENT STATUS API SUCCESS`, {\n module: _constants.CC_FILE,\n method: this.setAgentState.name\n });\n return agentStatusResponse;\n } catch (error) {\n const failure = error.details;\n this.metricsManager.trackEvent(_constants4.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_FAILED, {\n ..._MetricsManager.default.getCommonTrackingFieldForAQMResponseFailed(failure),\n state: data.state,\n auxCodeId: data.auxCodeId,\n lastStateChangeReason: data.lastStateChangeReason || _constants.EMPTY_STRING\n }, ['behavioral', 'business', 'operational']);\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'setAgentState', _constants.CC_FILE);\n throw detailedError;\n }\n }\n handleWebSocketMessage = event => {\n const eventData = JSON.parse(event);\n // Re-emit the events related to agent\n if (Object.values(_types2.CC_AGENT_EVENTS).includes(eventData.data?.type)) {\n // @ts-ignore\n this.emit(eventData.data.type, eventData.data);\n }\n if (eventData.type === _types2.CC_EVENTS.AGENT_STATE_CHANGE) {\n // @ts-ignore\n this.emit(_constants.AGENT_STATE_CHANGE, eventData.data);\n }\n if (eventData.type === _types2.CC_EVENTS.AGENT_MULTI_LOGIN) {\n // @ts-ignore\n this.emit(_constants.AGENT_MULTI_LOGIN, eventData.data);\n }\n };\n\n /**\n * For setting up the Event Emitter listeners and handlers\n */\n setupEventListeners() {\n this.services.connectionService.on('connectionLost', this.handleConnectionLost.bind(this));\n }\n\n /**\n * This method returns the connection configuration.\n */\n getConnectionConfig() {\n return {\n force: this.$config?.force ?? true,\n isKeepAliveEnabled: this.$config?.isKeepAliveEnabled ?? false,\n clientType: this.$config?.clientType ?? 'WebexCCSDK',\n allowMultiLogin: this.$config?.allowMultiLogin ?? true\n };\n }\n\n /**\n * Called when the reconnection has been completed\n */\n async handleConnectionLost(msg) {\n if (msg.isConnectionLost) {\n // TODO: Emit an event saying connection is lost\n _loggerProxy.default.info('event=handleConnectionLost | Connection lost', {\n module: _constants.CC_FILE,\n method: this.handleConnectionLost.name\n });\n } else if (msg.isSocketReconnected) {\n // TODO: Emit an event saying connection is re-estabilished\n _loggerProxy.default.info('event=handleConnectionReconnect | Connection reconnected attempting to request silent relogin', {\n module: _constants.CC_FILE,\n method: this.handleConnectionLost.name\n });\n if (this.$config && this.$config.allowAutomatedRelogin) {\n await this.silentRelogin();\n }\n }\n }\n\n /**\n * Called when we finish registration to silently handle the errors\n */\n async silentRelogin() {\n try {\n const reLoginResponse = await this.services.agent.reload();\n const {\n agentId,\n lastStateChangeReason,\n deviceType,\n dn,\n lastStateChangeTimestamp,\n lastIdleCodeChangeTimestamp\n } = reLoginResponse.data;\n let {\n auxCodeId\n } = reLoginResponse.data;\n this.agentConfig.lastStateChangeTimestamp = lastStateChangeTimestamp;\n this.agentConfig.lastIdleCodeChangeTimestamp = lastIdleCodeChangeTimestamp;\n\n // To handle re-registration of event listeners on silent relogin\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n // this.incomingTaskListener();\n\n if (lastStateChangeReason === 'agent-wss-disconnect') {\n _loggerProxy.default.info('event=requestAutoStateChange | Requesting state change to available on socket reconnect', {\n module: _constants.CC_FILE,\n method: this.silentRelogin.name\n });\n auxCodeId = _constants3.AGENT_STATE_AVAILABLE_ID;\n const stateChangeData = {\n state: _constants3.AGENT_STATE_AVAILABLE,\n auxCodeId,\n lastStateChangeReason,\n agentId\n };\n try {\n const agentStatusResponse = await this.setAgentState(stateChangeData);\n this.agentConfig.lastStateChangeTimestamp = agentStatusResponse.data.lastStateChangeTimestamp;\n this.agentConfig.lastIdleCodeChangeTimestamp = agentStatusResponse.data.lastIdleCodeChangeTimestamp;\n } catch (error) {\n _loggerProxy.default.error(`event=requestAutoStateChange | Error requesting state change to available on socket reconnect: ${error}`, {\n module: _constants.CC_FILE,\n method: this.silentRelogin.name\n });\n }\n }\n this.agentConfig.lastStateAuxCodeId = auxCodeId;\n await this.handleDeviceType(deviceType, dn);\n this.agentConfig.isAgentLoggedIn = true;\n // TODO: https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-626777 Implement the de-register method and close the listener there\n this.services.webSocketManager.on('message', this.handleWebSocketMessage);\n } catch (error) {\n const {\n reason,\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'silentReLogin', _constants.CC_FILE);\n if (reason === 'AGENT_NOT_FOUND') {\n _loggerProxy.default.log('Agent not found during re-login, handling silently', {\n module: _constants.CC_FILE,\n method: 'silentRelogin'\n });\n return;\n }\n throw detailedError;\n }\n }\n\n /**\n * Handles the device type specific logic\n */\n async handleDeviceType(deviceType, dn) {\n switch (deviceType) {\n case _types.LoginOption.BROWSER:\n await this.webCallingService.registerWebCallingLine();\n break;\n case _types.LoginOption.AGENT_DN:\n case _types.LoginOption.EXTENSION:\n this.agentConfig.defaultDn = dn;\n break;\n default:\n _loggerProxy.default.error(`Unsupported device type: ${deviceType}`, {\n module: _constants.CC_FILE,\n method: this.handleDeviceType.name\n });\n throw new Error(`Unsupported device type: ${deviceType}`);\n }\n this.webCallingService.setLoginOption(deviceType);\n this.agentConfig.deviceType = deviceType;\n }\n\n /**\n * This is used for making the outdial call.\n * @param destination\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const destination = '1234567890';\n * const result = await webex.cc.startOutdial(destination).then(()=>{}).catch(()=>{});\n * ```\n */\n\n async startOutdial(destination) {\n try {\n // Construct the outdial payload.\n const outDialPayload = {\n destination,\n entryPointId: this.agentConfig.outDialEp,\n direction: _constants.OUTDIAL_DIRECTION,\n attributes: _constants.ATTRIBUTES,\n mediaType: _constants.OUTDIAL_MEDIA_TYPE,\n outboundType: _constants.OUTBOUND_TYPE\n };\n const result = await this.services.dialer.startOutdial({\n data: outDialPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'startOutdial', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for getting the list of queues.\n * @param search - optional\n * @param filter - optional\n * @param page - default is 0\n * @param pageSize - default is 100\n * @returns Promise<ContactServiceQueue[]>\n * @throws Error\n *\n * @example\n * ```typescript\n * const search = 'queue';\n * const filter = 'id == \"e23ad456-1ebd-1b43-b9d0-34f39c7dcb5e\"';\n * const page = 0;\n * const pageSize = 100;\n * const result = await webex.cc.getQueues(search, filter, page, pageSize);\n * ```\n */\n async getQueues(search, filter, page = _constants3.DEFAULT_PAGE, pageSize = _constants3.DEFAULT_PAGE_SIZE) {\n const orgId = this.$webex.credentials.getOrgId();\n if (!orgId) {\n _loggerProxy.default.error('Org ID not found.', {\n module: _constants.CC_FILE,\n method: this.getQueues.name\n });\n throw new Error('Org ID not found.');\n }\n return this.services.config.getQueues(orgId, page, pageSize, search, filter);\n }\n\n /**\n * Uploads logs to help troubleshoot SDK issues.\n *\n * This method collects the current SDK logs including network requests, WebSocket\n * messages, and client-side events, then securely submits them to Webex's diagnostics\n * service. The returned tracking ID, feedbackID can be provided to Webex support for faster\n * issue resolution.\n * @returns Promise<SubmitLogsResponse>\n * @throws Error\n */\n async uploadLogs() {\n return this.webexRequest.uploadLogs();\n }\n}\nexports[\"default\"] = ContactCenter;\n//# sourceMappingURL=cc.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/cc.js?");
3692
3692
 
3693
3693
  /***/ }),
3694
3694
 
@@ -3710,7 +3710,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3710
3710
  /***/ ((__unused_webpack_module, exports) => {
3711
3711
 
3712
3712
  "use strict";
3713
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.WEB_SOCKET_MANAGER_FILE = exports.WEB_CALLING_SERVICE_FILE = exports.TIMEOUT_DURATION = exports.TASK_MANAGER_FILE = exports.READY = exports.PRODUCT_NAME = exports.OUTDIAL_MEDIA_TYPE = exports.OUTDIAL_DIRECTION = exports.OUTBOUND_TYPE = exports.LOG_PREFIX = exports.EVENT = exports.EMPTY_STRING = exports.CONNECTION_SERVICE_FILE = exports.CONFIG_FILE_NAME = exports.CC_FILE = exports.ATTRIBUTES = exports.AQM_REQS_FILE = exports.AGENT_STATE_CHANGE = exports.AGENT_MULTI_LOGIN = void 0;\nconst EVENT = exports.EVENT = 'event';\nconst READY = exports.READY = 'ready';\nconst TIMEOUT_DURATION = exports.TIMEOUT_DURATION = 20000; // 20 seconds timeout duration for webrtc registration\nconst EMPTY_STRING = exports.EMPTY_STRING = '';\nconst PRODUCT_NAME = exports.PRODUCT_NAME = 'wxcc_sdk';\n// FILE NAMES\nconst LOG_PREFIX = exports.LOG_PREFIX = 'PLUGIN_CC';\nconst WEB_CALLING_SERVICE_FILE = exports.WEB_CALLING_SERVICE_FILE = 'WebCallingService';\nconst CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = 'config-index';\nconst CC_FILE = exports.CC_FILE = 'cc';\nconst CONNECTION_SERVICE_FILE = exports.CONNECTION_SERVICE_FILE = 'connection-service';\nconst WEB_SOCKET_MANAGER_FILE = exports.WEB_SOCKET_MANAGER_FILE = 'WebSocketManager';\nconst AQM_REQS_FILE = exports.AQM_REQS_FILE = 'aqm-reqs';\nconst TASK_MANAGER_FILE = exports.TASK_MANAGER_FILE = 'TaskManager';\nconst AGENT_STATE_CHANGE = exports.AGENT_STATE_CHANGE = 'agent:stateChange';\nconst AGENT_MULTI_LOGIN = exports.AGENT_MULTI_LOGIN = 'agent:multiLogin';\n// AGENT OUTDIAL CONSTANTS\nconst OUTDIAL_DIRECTION = exports.OUTDIAL_DIRECTION = 'OUTBOUND';\nconst ATTRIBUTES = exports.ATTRIBUTES = {};\nconst OUTDIAL_MEDIA_TYPE = exports.OUTDIAL_MEDIA_TYPE = 'telephony';\nconst OUTBOUND_TYPE = exports.OUTBOUND_TYPE = 'OUTDIAL';\n//# sourceMappingURL=constants.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/constants.js?");
3713
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.WEB_SOCKET_MANAGER_FILE = exports.WEB_CALLING_SERVICE_FILE = exports.WEBEX_REQUEST_FILE = exports.TIMEOUT_DURATION = exports.TASK_MANAGER_FILE = exports.READY = exports.PRODUCT_NAME = exports.OUTDIAL_MEDIA_TYPE = exports.OUTDIAL_DIRECTION = exports.OUTBOUND_TYPE = exports.LOG_PREFIX = exports.EVENT = exports.EMPTY_STRING = exports.CONNECTION_SERVICE_FILE = exports.CONFIG_FILE_NAME = exports.CC_FILE = exports.ATTRIBUTES = exports.AQM_REQS_FILE = exports.AGENT_STATE_CHANGE = exports.AGENT_MULTI_LOGIN = void 0;\nconst EVENT = exports.EVENT = 'event';\nconst READY = exports.READY = 'ready';\nconst TIMEOUT_DURATION = exports.TIMEOUT_DURATION = 20000; // 20 seconds timeout duration for webrtc registration\nconst EMPTY_STRING = exports.EMPTY_STRING = '';\nconst PRODUCT_NAME = exports.PRODUCT_NAME = 'wxcc_sdk';\n// FILE NAMES\nconst LOG_PREFIX = exports.LOG_PREFIX = 'PLUGIN_CC';\nconst WEB_CALLING_SERVICE_FILE = exports.WEB_CALLING_SERVICE_FILE = 'WebCallingService';\nconst CONFIG_FILE_NAME = exports.CONFIG_FILE_NAME = 'config-index';\nconst CC_FILE = exports.CC_FILE = 'cc';\nconst CONNECTION_SERVICE_FILE = exports.CONNECTION_SERVICE_FILE = 'connection-service';\nconst WEB_SOCKET_MANAGER_FILE = exports.WEB_SOCKET_MANAGER_FILE = 'WebSocketManager';\nconst AQM_REQS_FILE = exports.AQM_REQS_FILE = 'aqm-reqs';\nconst WEBEX_REQUEST_FILE = exports.WEBEX_REQUEST_FILE = 'WebexRequest';\nconst TASK_MANAGER_FILE = exports.TASK_MANAGER_FILE = 'TaskManager';\nconst AGENT_STATE_CHANGE = exports.AGENT_STATE_CHANGE = 'agent:stateChange';\nconst AGENT_MULTI_LOGIN = exports.AGENT_MULTI_LOGIN = 'agent:multiLogin';\n// AGENT OUTDIAL CONSTANTS\nconst OUTDIAL_DIRECTION = exports.OUTDIAL_DIRECTION = 'OUTBOUND';\nconst ATTRIBUTES = exports.ATTRIBUTES = {};\nconst OUTDIAL_MEDIA_TYPE = exports.OUTDIAL_MEDIA_TYPE = 'telephony';\nconst OUTBOUND_TYPE = exports.OUTBOUND_TYPE = 'OUTDIAL';\n//# sourceMappingURL=constants.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/constants.js?");
3714
3714
 
3715
3715
  /***/ }),
3716
3716
 
@@ -3743,7 +3743,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3743
3743
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3744
3744
 
3745
3745
  "use strict";
3746
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _behavioralEvents = __webpack_require__(/*! ./behavioral-events */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/behavioral-events.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass MetricsManager {\n runningEvents = {};\n pendingBehavioralEvents = [];\n pendingOperationalEvents = [];\n pendingBusinessEvents = [];\n readyToSubmitEvents = false;\n submittingEvents = false; // Add a lock for submitting events\n\n // eslint-disable-next-line no-use-before-define\n metricsDisabled = false;\n\n // eslint-disable-next-line no-useless-constructor\n constructor() {}\n setReadyToSubmitEvents() {\n this.readyToSubmitEvents = true;\n this.submitPendingEvents();\n }\n async submitPendingEvents() {\n if (this.submittingEvents) {\n return;\n }\n this.submittingEvents = true;\n try {\n await this.submitPendingBehavioralEvents();\n await this.submitPendingOperationalEvents();\n await this.submitPendingBusinessEvents();\n } finally {\n this.submittingEvents = false;\n }\n }\n async submitPendingBehavioralEvents() {\n if (this.pendingBehavioralEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingBehavioralEvents];\n this.pendingBehavioralEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitBehavioralEvent({\n product: event.taxonomy.product,\n agent: event.taxonomy.agent,\n target: event.taxonomy.target,\n verb: event.taxonomy.verb,\n payload: event.payload\n });\n });\n }\n }\n async submitPendingOperationalEvents() {\n if (this.pendingOperationalEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingOperationalEvents];\n this.pendingOperationalEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitOperationalEvent({\n name: event.name,\n payload: event.payload\n });\n });\n }\n }\n async submitPendingBusinessEvents() {\n if (this.pendingBusinessEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingBusinessEvents];\n this.pendingBusinessEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitBusinessEvent({\n name: event.name,\n payload: event.payload\n });\n });\n }\n }\n addDurationIfTimed(name, options) {\n const durationKey = 'duration_ms';\n if (name in this.runningEvents) {\n const startTime = this.runningEvents[name];\n delete this.runningEvents[name];\n if (startTime && options) {\n options[durationKey] = Date.now() - startTime;\n return options;\n }\n if (startTime) {\n const payload = {};\n payload[durationKey] = Date.now() - startTime;\n return payload;\n }\n }\n if (options) {\n return options;\n }\n return {};\n }\n static spacesToUnderscore(str) {\n return str.replace(/ /g, '_');\n }\n static preparePayload(options) {\n const payload = {};\n for (const [key, value] of Object.entries(options)) {\n payload[MetricsManager.spacesToUnderscore(key)] = value; // Replace spaces with underscores\n }\n\n if (typeof window === 'undefined') {\n return payload;\n }\n const payloadWithCommonMetadata = {\n ...payload\n };\n payloadWithCommonMetadata.tabHidden = document.hidden;\n return payloadWithCommonMetadata;\n }\n isMetricsDisabled() {\n // TODO: SPARK-637285 Need to return true if in development mode to avoid sending metrics to the server\n return this.metricsDisabled;\n }\n setMetricsDisabled(disabled) {\n this.metricsDisabled = disabled;\n if (disabled) {\n this.clearPendingEvents();\n }\n }\n clearPendingEvents() {\n this.pendingBehavioralEvents.length = 0;\n this.pendingOperationalEvents.length = 0;\n this.pendingBusinessEvents.length = 0;\n }\n trackBehavioralEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const taxonomy = (0, _behavioralEvents.getEventTaxonomy)(name);\n const payload = MetricsManager.preparePayload(this.addDurationIfTimed(name, options));\n this.pendingBehavioralEvents.push({\n taxonomy,\n payload\n });\n this.submitPendingBehavioralEvents();\n }\n trackOperationalEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const payload = this.addDurationIfTimed(name, options);\n this.pendingOperationalEvents.push({\n name: MetricsManager.spacesToUnderscore(name).toUpperCase(),\n payload: MetricsManager.preparePayload(payload)\n });\n this.submitPendingOperationalEvents();\n }\n trackBusinessEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const payload = this.addDurationIfTimed(name, options);\n this.pendingBusinessEvents.push({\n name: MetricsManager.spacesToUnderscore(name).toUpperCase(),\n payload: MetricsManager.preparePayload(payload)\n });\n this.submitPendingBusinessEvents();\n }\n trackEvent(name, payload, metricServices = ['behavioral']) {\n if (this.isMetricsDisabled()) {\n return;\n }\n for (const metricService of metricServices) {\n switch (metricService) {\n case 'behavioral':\n this.trackBehavioralEvent(name, payload);\n break;\n case 'operational':\n this.trackOperationalEvent(name, payload);\n break;\n case 'business':\n this.trackBusinessEvent(name, payload);\n break;\n default:\n _loggerProxy.default.error(`[MetricsManager] Invalid metric type: ${metricService}`);\n }\n }\n }\n timeEvent(_name) {\n if (this.isMetricsDisabled()) {\n return;\n }\n this.runningEvents[_name] = Date.now();\n }\n setWebex(webex) {\n this.webex = webex;\n if (this.webex.ready) {\n this.setReadyToSubmitEvents();\n }\n this.webex.once('ready', () => {\n this.setReadyToSubmitEvents();\n });\n }\n\n // Make the class a singleton\n static getInstance(options) {\n if (!MetricsManager.instance) {\n MetricsManager.instance = new MetricsManager();\n }\n if (!MetricsManager.instance.webex && options && options.webex) {\n MetricsManager.instance.setWebex(options.webex);\n }\n return MetricsManager.instance;\n }\n static resetInstance() {\n MetricsManager.instance = undefined;\n }\n}\nexports[\"default\"] = MetricsManager;\n//# sourceMappingURL=MetricsManager.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js?");
3746
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _behavioralEvents = __webpack_require__(/*! ./behavioral-events */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/behavioral-events.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nconst PRODUCT_NAME_UPPER = _constants.PRODUCT_NAME.toUpperCase();\nclass MetricsManager {\n runningEvents = {};\n pendingBehavioralEvents = [];\n pendingOperationalEvents = [];\n pendingBusinessEvents = [];\n readyToSubmitEvents = false;\n submittingEvents = false; // Add a lock for submitting events\n\n // eslint-disable-next-line no-use-before-define\n metricsDisabled = false; // TODO: SPARK-637285\n\n // eslint-disable-next-line no-useless-constructor\n constructor() {}\n setReadyToSubmitEvents() {\n this.readyToSubmitEvents = true;\n this.submitPendingEvents();\n }\n async submitPendingEvents() {\n if (this.submittingEvents) {\n return;\n }\n this.submittingEvents = true;\n try {\n await this.submitPendingBehavioralEvents();\n await this.submitPendingOperationalEvents();\n await this.submitPendingBusinessEvents();\n } finally {\n this.submittingEvents = false;\n }\n }\n async submitPendingBehavioralEvents() {\n if (this.pendingBehavioralEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingBehavioralEvents];\n this.pendingBehavioralEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitBehavioralEvent({\n product: event.taxonomy.product,\n agent: event.taxonomy.agent,\n target: event.taxonomy.target,\n verb: event.taxonomy.verb,\n payload: event.payload\n });\n });\n }\n }\n async submitPendingOperationalEvents() {\n if (this.pendingOperationalEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingOperationalEvents];\n this.pendingOperationalEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitOperationalEvent({\n name: `${PRODUCT_NAME_UPPER}_${event.name}`,\n payload: event.payload\n });\n });\n }\n }\n async submitPendingBusinessEvents() {\n if (this.pendingBusinessEvents.length === 0) {\n return;\n }\n if (this.readyToSubmitEvents) {\n const eventsToSubmit = [...this.pendingBusinessEvents];\n this.pendingBusinessEvents.length = 0;\n eventsToSubmit.forEach(event => {\n this.webex.internal.newMetrics.submitBusinessEvent({\n name: `${PRODUCT_NAME_UPPER}_${event.name}`,\n payload: event.payload,\n metadata: {\n appType: _constants.PRODUCT_NAME\n }\n });\n });\n }\n }\n addDurationIfTimed(eventName, options) {\n const durationKey = 'duration_ms';\n for (const [genericKey, timing] of Object.entries(this.runningEvents)) {\n if (timing.keys.has(eventName)) {\n const startTime = timing.startTime;\n // Remove all keys for this operation.\n delete this.runningEvents[genericKey];\n options = options || {};\n options[durationKey] = Date.now() - startTime;\n return options;\n }\n }\n return options || {};\n }\n static spacesToUnderscore(str) {\n return str.replace(/ /g, '_');\n }\n static preparePayload(obj) {\n const payload = {};\n Object.keys(obj).forEach(key => {\n if (obj[key] !== undefined && obj[key] !== null && obj[key] !== '' && !Array.isArray(obj[key]) && !(typeof obj[key] === 'object' && Object.keys(obj[key]).length === 0)) {\n payload[MetricsManager.spacesToUnderscore(key)] = obj[key];\n }\n });\n if (typeof window === 'undefined') {\n return payload;\n }\n const payloadWithCommonMetadata = {\n ...payload\n };\n payloadWithCommonMetadata.tabHidden = document.hidden;\n return payloadWithCommonMetadata;\n }\n isMetricsDisabled() {\n // TODO: SPARK-637285 Need to return true if in development mode to avoid sending metrics to the server\n return this.metricsDisabled;\n }\n setMetricsDisabled(disabled) {\n this.metricsDisabled = disabled;\n if (disabled) {\n this.clearPendingEvents();\n }\n }\n clearPendingEvents() {\n this.pendingBehavioralEvents.length = 0;\n this.pendingOperationalEvents.length = 0;\n this.pendingBusinessEvents.length = 0;\n }\n trackBehavioralEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const taxonomy = (0, _behavioralEvents.getEventTaxonomy)(name);\n const payload = MetricsManager.preparePayload(this.addDurationIfTimed(name, options));\n this.pendingBehavioralEvents.push({\n taxonomy,\n payload\n });\n this.submitPendingBehavioralEvents();\n }\n trackOperationalEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const payload = this.addDurationIfTimed(name, options);\n this.pendingOperationalEvents.push({\n name: MetricsManager.spacesToUnderscore(name).toUpperCase(),\n payload: MetricsManager.preparePayload(payload)\n });\n this.submitPendingOperationalEvents();\n }\n trackBusinessEvent(name, options) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const payload = this.addDurationIfTimed(name, options);\n this.pendingBusinessEvents.push({\n name: MetricsManager.spacesToUnderscore(name).toUpperCase(),\n payload: MetricsManager.preparePayload(payload)\n });\n this.submitPendingBusinessEvents();\n }\n trackEvent(name, payload, metricServices = ['behavioral']) {\n if (this.isMetricsDisabled()) {\n return;\n }\n for (const metricService of metricServices) {\n switch (metricService) {\n case 'behavioral':\n this.trackBehavioralEvent(name, payload);\n break;\n case 'operational':\n this.trackOperationalEvent(name, payload);\n break;\n case 'business':\n this.trackBusinessEvent(name, payload);\n break;\n default:\n _loggerProxy.default.error(`[MetricsManager] Invalid metric type: ${metricService}`);\n }\n }\n }\n timeEvent(keys) {\n if (this.isMetricsDisabled()) {\n return;\n }\n const keyArray = Array.isArray(keys) ? keys : [keys];\n // Use the first key as the tracking key.\n if (keyArray.length === 0) {\n _loggerProxy.default.error('[MetricsManager] No keys provided for timeEvent');\n return;\n }\n const genericKey = keyArray[0];\n this.runningEvents[genericKey] = {\n startTime: Date.now(),\n keys: new Set(keyArray)\n };\n }\n setWebex(webex) {\n this.webex = webex;\n if (this.webex.ready) {\n this.setReadyToSubmitEvents();\n }\n this.webex.once('ready', () => {\n this.setReadyToSubmitEvents();\n });\n }\n\n // Make the class a singleton\n static getInstance(options) {\n if (!MetricsManager.instance) {\n MetricsManager.instance = new MetricsManager();\n }\n if (!MetricsManager.instance.webex && options && options.webex) {\n MetricsManager.instance.setWebex(options.webex);\n }\n return MetricsManager.instance;\n }\n static resetInstance() {\n MetricsManager.instance = undefined;\n }\n static getCommonTrackingFieldForAQMResponse(response) {\n // This method is used to extract common tracking fields from the AQM response\n // and return them as an object. The fields are extracted from the response\n // object and its data property.\n const fields = {\n agentId: response?.data?.agentId || response?.agentId,\n agentSessionId: response?.data?.agentSessionId || response?.agentSessionId,\n teamId: response?.teamId ?? response?.data?.teamId ?? undefined,\n siteId: response?.data?.siteId || response?.siteId,\n orgId: response?.data?.orgId || response?.orgId,\n eventType: response?.type,\n trackingId: response?.data?.trackingId,\n notifTrackingId: response?.trackingId\n };\n return fields;\n }\n static getCommonTrackingFieldForAQMResponseFailed(failureResponse) {\n // This method is used to extract common tracking fields from the AQM response failure\n // and return them as an object. The fields are extracted from the response\n // object and its data property.\n const fields = {\n agentId: failureResponse?.data?.agentId,\n trackingId: failureResponse?.trackingId,\n notifTrackingId: failureResponse?.trackingId,\n orgId: failureResponse?.orgId,\n failureType: failureResponse?.type,\n failureReason: failureResponse?.data?.reason,\n reasonCode: failureResponse?.data?.reasonCode\n };\n return fields;\n }\n}\nexports[\"default\"] = MetricsManager;\n//# sourceMappingURL=MetricsManager.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js?");
3747
3747
 
3748
3748
  /***/ }),
3749
3749
 
@@ -3754,7 +3754,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3754
3754
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3755
3755
 
3756
3756
  "use strict";
3757
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.getEventTaxonomy = getEventTaxonomy;\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nfunction getEventTaxonomy(name) {\n // Adding new metrics? Please add them to the Cypher CC metrics wiki\n // Also need to get them allowed in the metrics service by requesting in Ask metrics-A\n\n const product = _constants2.PRODUCT_NAME;\n switch (name) {\n case _constants.METRIC_EVENT_NAMES.STATION_LOGIN:\n return {\n product,\n agent: 'user',\n target: 'station',\n verb: 'login'\n };\n case _constants.METRIC_EVENT_NAMES.CALL_COMPLETED:\n return {\n product,\n agent: 'user',\n target: 'call',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.CALL_CONSULT_ACTIVATE:\n return {\n product,\n agent: 'user',\n target: 'call_consult',\n verb: 'activate'\n };\n case _constants.METRIC_EVENT_NAMES.CALL_TRANSFER_ACTIVATE:\n return {\n product,\n agent: 'user',\n target: 'call_transfer',\n verb: 'activate'\n };\n case _constants.METRIC_EVENT_NAMES.CALL_ANSWERED:\n return {\n product,\n agent: 'user',\n target: 'call',\n verb: 'answer'\n };\n case _constants.METRIC_EVENT_NAMES.AGENT_RONA:\n return {\n product,\n agent: 'service',\n target: 'agent_rona',\n verb: 'set'\n };\n case _constants.METRIC_EVENT_NAMES.TASK_END:\n return {\n product,\n agent: 'user',\n target: 'task',\n verb: 'complete'\n };\n default:\n break;\n }\n return undefined;\n}\n//# sourceMappingURL=behavioral-events.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/behavioral-events.js?");
3757
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.getEventTaxonomy = getEventTaxonomy;\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nfunction getEventTaxonomy(name) {\n // Adding new metrics? Please add them to the Cypher CC metrics wiki\n // Also need to get them allowed in the metrics service by requesting in Ask metrics-A\n\n const product = _constants2.PRODUCT_NAME;\n switch (name) {\n case _constants.METRIC_EVENT_NAMES.STATION_LOGIN_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'station_login',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.STATION_LOGIN_FAILED:\n return {\n product,\n agent: 'user',\n target: 'station_login',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.STATION_LOGOUT_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'station_logout',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.STATION_LOGOUT_FAILED:\n return {\n product,\n agent: 'user',\n target: 'station_logout',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.STATION_RELOGIN_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'station_relogin',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.STATION_RELOGIN_FAILED:\n return {\n product,\n agent: 'user',\n target: 'station_relogin',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'state_change',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.AGENT_STATE_CHANGE_FAILED:\n return {\n product,\n agent: 'user',\n target: 'state_change',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'buddy_agents_fetch',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.FETCH_BUDDY_AGENTS_FAILED:\n return {\n product,\n agent: 'user',\n target: 'buddy_agents_fetch',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'websocket_register',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.WEBSOCKET_REGISTER_FAILED:\n return {\n product,\n agent: 'user',\n target: 'websocket_register',\n verb: 'fail'\n };\n case _constants.METRIC_EVENT_NAMES.AGENT_RONA:\n return {\n product,\n agent: 'service',\n target: 'agent_rona',\n verb: 'set'\n };\n case _constants.METRIC_EVENT_NAMES.UPLOAD_LOGS_SUCCESS:\n return {\n product,\n agent: 'user',\n target: 'upload_logs',\n verb: 'complete'\n };\n case _constants.METRIC_EVENT_NAMES.UPLOAD_LOGS_FAILED:\n return {\n product,\n agent: 'user',\n target: 'upload_logs',\n verb: 'fail'\n };\n default:\n break;\n }\n return undefined;\n}\n//# sourceMappingURL=behavioral-events.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/behavioral-events.js?");
3758
3758
 
3759
3759
  /***/ }),
3760
3760
 
@@ -3765,7 +3765,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3765
3765
  /***/ ((__unused_webpack_module, exports) => {
3766
3766
 
3767
3767
  "use strict";
3768
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.METRIC_EVENT_NAMES = void 0;\nconst METRIC_EVENT_NAMES = exports.METRIC_EVENT_NAMES = {\n STATION_LOGIN: 'Station Login',\n CALL_COMPLETED: 'Call Completed',\n TASK_END: 'Task End',\n CALL_CONSULT_ACTIVATE: 'Call Consult Activate',\n CALL_TRANSFER_ACTIVATE: 'Call Transfer Activated',\n CALL_ANSWERED: 'Call Answered',\n AGENT_RONA: 'Agent RONA'\n};\n\n// Derive the type using the utility type\n//# sourceMappingURL=constants.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js?");
3768
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.METRIC_EVENT_NAMES = void 0;\nconst METRIC_EVENT_NAMES = exports.METRIC_EVENT_NAMES = {\n STATION_LOGIN_SUCCESS: 'Station Login Success',\n STATION_LOGIN_FAILED: 'Station Login Failed',\n STATION_LOGOUT_SUCCESS: 'Station Logout Success',\n STATION_LOGOUT_FAILED: 'Station Logout Failed',\n STATION_RELOGIN_SUCCESS: 'Station Relogin Success',\n STATION_RELOGIN_FAILED: 'Station Relogin Failed',\n AGENT_STATE_CHANGE_SUCCESS: 'Agent State Change Success',\n AGENT_STATE_CHANGE_FAILED: 'Agent State Change Failed',\n FETCH_BUDDY_AGENTS_SUCCESS: 'Fetch Buddy Agents Success',\n FETCH_BUDDY_AGENTS_FAILED: 'Fetch Buddy Agents Failed',\n WEBSOCKET_REGISTER_SUCCESS: 'Websocket Register Success',\n WEBSOCKET_REGISTER_FAILED: 'Websocket Register Failed',\n AGENT_RONA: 'Agent RONA',\n UPLOAD_LOGS_SUCCESS: 'Upload Logs Success',\n UPLOAD_LOGS_FAILED: 'Upload Logs Failed'\n};\n\n// Derive the type using the utility type\n//# sourceMappingURL=constants.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js?");
3769
3769
 
3770
3770
  /***/ }),
3771
3771
 
@@ -3787,7 +3787,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3787
3787
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3788
3788
 
3789
3789
  "use strict";
3790
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = routingAgent;\nvar Err = _interopRequireWildcard(__webpack_require__(/*! ../core/Err */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Err.js\"));\nvar _Utils = __webpack_require__(/*! ../core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _types2 = __webpack_require__(/*! ../config/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/types.js\");\nvar _MetricsManager = _interopRequireDefault(__webpack_require__(/*! ../../metrics/MetricsManager */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js\"));\nvar _constants2 = __webpack_require__(/*! ../../metrics/constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/*\n * routingAgent\n * @param reqs\n * @category Routing Service\n */\n\nfunction routingAgent(routing) {\n const metricsManager = _MetricsManager.default.getInstance();\n return {\n reload: routing.reqEmpty(() => ({\n host: _constants.WCC_API_GATEWAY,\n url: '/v1/agents/reload',\n data: {},\n err: _Utils.createErrDetailsObject,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_SUCCESS,\n data: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_FAILED,\n data: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_FAILED\n }\n },\n errId: 'Service.aqm.agent.reload'\n }\n })),\n logout: routing.req(p => ({\n url: '/v1/agents/logout',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: _Utils.createErrDetailsObject,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT,\n data: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT,\n data: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT_FAILED\n }\n },\n errId: 'Service.aqm.agent.logout'\n }\n })),\n stationLogin: routing.req(p => ({\n url: '/v1/agents/login',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: /* istanbul ignore next */e => {\n metricsManager.trackEvent(_constants2.METRIC_EVENT_NAMES.STATION_LOGIN, {\n ...p.data,\n isSuccess: false,\n trackingId: e.response?.headers?.trackingid?.split('_')[1],\n roles: Array.isArray(p.data.roles) ? p.data.roles.join(',') : ''\n }, ['operational', 'behavioral', 'business']);\n return new Err.Details('Service.aqm.agent.stationLogin', {\n status: e.response?.status ?? 0,\n type: e.response?.data?.errorType,\n trackingId: e.response?.headers?.trackingid?.split('_')[1]\n });\n },\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN_FAILED\n }\n },\n errId: 'Service.aqm.agent.stationLoginFailed'\n }\n })),\n stateChange: routing.req(p => ({\n url: '/v1/agents/session/state',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: _Utils.createErrDetailsObject,\n method: _types.HTTP_METHODS.PUT,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE_FAILED\n }\n },\n errId: 'Service.aqm.agent.stateChange'\n }\n })),\n buddyAgents: routing.req(p => ({\n url: `/v1/agents/buddyList`,\n host: _constants.WCC_API_GATEWAY,\n data: {\n ...p.data\n },\n err: _Utils.createErrDetailsObject,\n method: _types.HTTP_METHODS.POST,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS,\n data: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS,\n data: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS_RETRIEVE_FAILED\n }\n },\n errId: 'Service.aqm.agent.BuddyAgentsRetrieveFailed'\n }\n }))\n };\n}\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/agent/index.js?");
3790
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = routingAgent;\nvar Err = _interopRequireWildcard(__webpack_require__(/*! ../core/Err */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Err.js\"));\nvar _Utils = __webpack_require__(/*! ../core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _types2 = __webpack_require__(/*! ../config/types */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/types.js\");\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/*\n * routingAgent\n * @param reqs\n * @category Routing Service\n */\n\nfunction routingAgent(routing) {\n return {\n reload: routing.reqEmpty(() => ({\n host: _constants.WCC_API_GATEWAY,\n url: '/v1/agents/reload',\n data: {},\n err: _Utils.createErrDetailsObject,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_SUCCESS,\n data: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_FAILED,\n data: {\n type: _types2.CC_EVENTS.AGENT_RELOGIN_FAILED\n }\n },\n errId: 'Service.aqm.agent.reload'\n }\n })),\n logout: routing.req(p => ({\n url: '/v1/agents/logout',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: _Utils.createErrDetailsObject,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT,\n data: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT,\n data: {\n type: _types2.CC_EVENTS.AGENT_LOGOUT_FAILED\n }\n },\n errId: 'Service.aqm.agent.logout'\n }\n })),\n stationLogin: routing.req(p => ({\n url: '/v1/agents/login',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: /* istanbul ignore next */e => {\n return new Err.Details('Service.aqm.agent.stationLogin', {\n status: e.response?.status ?? 0,\n type: e.response?.data?.errorType,\n trackingId: e.response?.headers?.trackingid?.split('_')[1]\n });\n },\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATION_LOGIN_FAILED\n }\n },\n errId: 'Service.aqm.agent.stationLoginFailed'\n }\n })),\n stateChange: routing.req(p => ({\n url: '/v1/agents/session/state',\n host: _constants.WCC_API_GATEWAY,\n data: p.data,\n err: _Utils.createErrDetailsObject,\n method: _types.HTTP_METHODS.PUT,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE,\n data: {\n type: _types2.CC_EVENTS.AGENT_STATE_CHANGE_FAILED\n }\n },\n errId: 'Service.aqm.agent.stateChange'\n }\n })),\n buddyAgents: routing.req(p => ({\n url: `/v1/agents/buddyList`,\n host: _constants.WCC_API_GATEWAY,\n data: {\n ...p.data\n },\n err: _Utils.createErrDetailsObject,\n method: _types.HTTP_METHODS.POST,\n notifSuccess: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS,\n data: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS_SUCCESS\n }\n },\n msg: {}\n },\n notifFail: {\n bind: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS,\n data: {\n type: _types2.CC_EVENTS.AGENT_BUDDY_AGENTS_RETRIEVE_FAILED\n }\n },\n errId: 'Service.aqm.agent.BuddyAgentsRetrieveFailed'\n }\n }))\n };\n}\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/agent/index.js?");
3791
3791
 
3792
3792
  /***/ }),
3793
3793
 
@@ -3820,7 +3820,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3820
3820
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3821
3821
 
3822
3822
  "use strict";
3823
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _HttpRequest = _interopRequireDefault(__webpack_require__(/*! ../core/HttpRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js\"));\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _Util = __webpack_require__(/*! ./Util */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/Util.js\");\nvar _constants3 = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n/*\nThe AgentConfigService class provides methods to fetch agent configuration data.\n*/\nclass AgentConfigService {\n constructor() {\n this.httpReq = _HttpRequest.default.getInstance();\n }\n\n /**\n * Fetches the agent configuration data for the given orgId and agentId.\n * @param {string} orgId\n * @param {string} agentId\n * @returns {Promise<Profile>}\n */\n async getAgentConfig(orgId, agentId) {\n try {\n const userConfigPromise = this.getUserUsingCI(orgId, agentId);\n const orgInfoPromise = this.getOrgInfo(orgId);\n const orgSettingsPromise = this.getOrganizationSetting(orgId);\n const tenantDataPromise = this.getTenantData(orgId);\n const urlMappingPromise = this.getURLMapping(orgId);\n const auxCodesPromise = this.getAllAuxCodes(orgId, _constants3.DEFAULT_PAGE_SIZE, [], _constants3.DEFAULT_AUXCODE_ATTRIBUTES);\n const userConfigData = await userConfigPromise;\n _loggerProxy.default.info('Fetched user data', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n const agentProfilePromise = this.getDesktopProfileById(orgId, userConfigData.agentProfileId);\n const userDialPlanPromise = agentProfilePromise.then(agentProfileConfigData => agentProfileConfigData.dialPlanEnabled ? this.getDialPlanData(orgId) : []);\n const userTeamPromise = userConfigData.teamIds ? this.getAllTeams(orgId, _constants3.DEFAULT_PAGE_SIZE, userConfigData.teamIds, _constants3.DEFAULT_TEAM_ATTRIBUTES) : Promise.resolve([]);\n const [agentProfileConfigData, userDialPlanData, userTeamData, orgInfo, orgSettingsData, tenantData, urlMappingData, auxCodesData] = await Promise.all([agentProfilePromise, userDialPlanPromise, userTeamPromise, orgInfoPromise, orgSettingsPromise, tenantDataPromise, urlMappingPromise, auxCodesPromise]);\n _loggerProxy.default.info('Fetched all required data', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n const response = (0, _Util.parseAgentConfigs)({\n userData: userConfigData,\n teamData: userTeamData,\n tenantData,\n orgInfoData: orgInfo,\n auxCodes: auxCodesData,\n orgSettingsData,\n agentProfileData: agentProfileConfigData,\n dialPlanData: userDialPlanData,\n urlMapping: urlMappingData\n });\n\n // replace CONFIG_FILE_NAME with CONFIG_FILE_NAME\n _loggerProxy.default.info('Parsing completed for agent-config', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n _loggerProxy.default.info('Fetched configuration data successfully', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n return response;\n } catch (error) {\n _loggerProxy.default.error(`getAgentConfig call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the agent configuration data for the given orgId and agentId.\n * @param {string} orgId\n * @param {string} agentId\n * @returns {Promise<AgentResponse>}\n */\n async getUserUsingCI(orgId, agentId) {\n try {\n const resource = _constants3.endPointMap.userByCI(orgId, agentId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getUserUsingCI api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getUserUsingCI'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getUserUsingCI API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getUserUsingCI'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the desktop profile data for the given orgId and desktopProfileId.\n * @param {string} orgId\n * @param {string} desktopProfileId\n * @returns {Promise<DesktopProfileResponse>}\n */\n async getDesktopProfileById(orgId, desktopProfileId) {\n try {\n const resource = _constants3.endPointMap.desktopProfile(orgId, desktopProfileId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getDesktopProfileById api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDesktopProfileById'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getDesktopProfileById API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDesktopProfileById'\n });\n throw error;\n }\n }\n\n /**\n * fetches the list of teams for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<ListTeamsResponse>}\n */\n async getListOfTeams(orgId, page, pageSize, filter, attributes) {\n try {\n const resource = _constants3.endPointMap.listTeams(orgId, page, pageSize, filter, attributes);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getListOfTeams api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfTeams'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getListOfTeams API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfTeams'\n });\n throw error;\n }\n }\n\n /**\n * Fetches all teams from all pages for the given orgId\n * @param {string} orgId\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<TeamList[]>}\n */\n async getAllTeams(orgId, pageSize, filter, attributes) {\n try {\n let allTeams = [];\n let page = _constants3.DEFAULT_PAGE;\n const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter, attributes);\n const totalPages = firstResponse.meta.totalPages;\n allTeams = allTeams.concat(firstResponse.data);\n const requests = [];\n for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {\n requests.push(this.getListOfTeams(orgId, page, pageSize, filter, attributes));\n }\n const responses = await Promise.all(requests);\n for (const response of responses) {\n allTeams = allTeams.concat(response.data);\n }\n return allTeams;\n } catch (error) {\n _loggerProxy.default.error(`getAllTeams API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAllTeams'\n });\n throw error;\n }\n }\n\n /**\n * fetches the list of aux codes for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<ListAuxCodesResponse>}\n */\n async getListOfAuxCodes(orgId, page, pageSize, filter, attributes) {\n try {\n const resource = _constants3.endPointMap.listAuxCodes(orgId, page, pageSize, filter, attributes);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getListOfAuxCodes api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfAuxCodes'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getListOfAuxCodes API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfAuxCodes'\n });\n throw error;\n }\n }\n\n /**\n * Fetches all aux codes from all pages for the given orgId\n * @param {string} orgId\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<AuxCode[]>}\n */\n async getAllAuxCodes(orgId, pageSize, filter, attributes) {\n try {\n let allAuxCodes = [];\n let page = _constants3.DEFAULT_PAGE;\n const firstResponse = await this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes);\n allAuxCodes = allAuxCodes.concat(firstResponse.data);\n const totalPages = firstResponse.meta.totalPages;\n const promises = [];\n for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {\n promises.push(this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes));\n }\n const responses = await Promise.all(promises);\n responses.forEach(response => {\n allAuxCodes = allAuxCodes.concat(response.data);\n });\n return allAuxCodes;\n } catch (error) {\n _loggerProxy.default.error(`getAllAuxCodes API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAllAuxCodes'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the organization info for the given orgId.\n * @param {string} orgId\n * @returns {Promise<OrgInfo>}\n */\n async getOrgInfo(orgId) {\n try {\n const resource = _constants3.endPointMap.orgInfo(orgId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getOrgInfo api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrgInfo'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getOrgInfo API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrgInfo'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the organization settings for the given orgId.\n * @param {string} orgId\n * @returns {Promise<OrgSettings>}\n */\n async getOrganizationSetting(orgId) {\n try {\n const resource = _constants3.endPointMap.orgSettings(orgId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getOrganizationSetting api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrganizationSetting'\n });\n return Promise.resolve(response.body.data[0]);\n } catch (error) {\n _loggerProxy.default.error(`getOrganizationSetting API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrganizationSetting'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the tenant data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<TenantData>}\n */\n async getTenantData(orgId) {\n try {\n const resource = _constants3.endPointMap.tenantData(orgId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getTenantData api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getTenantData'\n });\n return Promise.resolve(response.body.data[0]);\n } catch (error) {\n _loggerProxy.default.error(`getTenantData API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getTenantData'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the URL mapping data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<URLMapping[]>}\n */\n async getURLMapping(orgId) {\n try {\n const resource = _constants3.endPointMap.urlMapping(orgId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getURLMapping api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getURLMapping'\n });\n return Promise.resolve(response.body.data);\n } catch (error) {\n _loggerProxy.default.error(`getURLMapping API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getURLMapping'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the dial plan data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<DialPlanEntity[]>}\n */\n async getDialPlanData(orgId) {\n try {\n const resource = _constants3.endPointMap.dialPlan(orgId);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getDialPlanData api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDialPlanData'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getDialPlanData API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDialPlanData'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the list of queues for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string} search - optional search string\n * @param {string} filter - optional filter string\n * @returns Promise<ContactServiceQueue[]>\n */\n async getQueues(orgId, page, pageSize, search, filter) {\n try {\n let queryParams = `page=${page}&pageSize=${pageSize}&desktopProfileFilter=true`;\n if (search) queryParams += `&search=${search}`;\n if (filter) queryParams += `&filter=${filter}`;\n const resource = _constants3.endPointMap.queueList(orgId, queryParams);\n const response = await this.httpReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getQueues API success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getQueues'\n });\n return response.body?.data;\n } catch (error) {\n _loggerProxy.default.error(`getQueues API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getQueues'\n });\n throw error;\n }\n }\n}\nexports[\"default\"] = AgentConfigService;\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/config/index.js?");
3823
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _WebexRequest = _interopRequireDefault(__webpack_require__(/*! ../core/WebexRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js\"));\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _Util = __webpack_require__(/*! ./Util */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/Util.js\");\nvar _constants3 = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/config/constants.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n/*\nThe AgentConfigService class provides methods to fetch agent configuration data.\n*/\nclass AgentConfigService {\n constructor() {\n this.webexReq = _WebexRequest.default.getInstance();\n }\n\n /**\n * Fetches the agent configuration data for the given orgId and agentId.\n * @param {string} orgId\n * @param {string} agentId\n * @returns {Promise<Profile>}\n */\n async getAgentConfig(orgId, agentId) {\n try {\n const userConfigPromise = this.getUserUsingCI(orgId, agentId);\n const orgInfoPromise = this.getOrgInfo(orgId);\n const orgSettingsPromise = this.getOrganizationSetting(orgId);\n const tenantDataPromise = this.getTenantData(orgId);\n const urlMappingPromise = this.getURLMapping(orgId);\n const auxCodesPromise = this.getAllAuxCodes(orgId, _constants3.DEFAULT_PAGE_SIZE, [], _constants3.DEFAULT_AUXCODE_ATTRIBUTES);\n const userConfigData = await userConfigPromise;\n _loggerProxy.default.info('Fetched user data', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n const agentProfilePromise = this.getDesktopProfileById(orgId, userConfigData.agentProfileId);\n const userDialPlanPromise = agentProfilePromise.then(agentProfileConfigData => agentProfileConfigData.dialPlanEnabled ? this.getDialPlanData(orgId) : []);\n const userTeamPromise = userConfigData.teamIds ? this.getAllTeams(orgId, _constants3.DEFAULT_PAGE_SIZE, userConfigData.teamIds, _constants3.DEFAULT_TEAM_ATTRIBUTES) : Promise.resolve([]);\n const [agentProfileConfigData, userDialPlanData, userTeamData, orgInfo, orgSettingsData, tenantData, urlMappingData, auxCodesData] = await Promise.all([agentProfilePromise, userDialPlanPromise, userTeamPromise, orgInfoPromise, orgSettingsPromise, tenantDataPromise, urlMappingPromise, auxCodesPromise]);\n _loggerProxy.default.info('Fetched all required data', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n const response = (0, _Util.parseAgentConfigs)({\n userData: userConfigData,\n teamData: userTeamData,\n tenantData,\n orgInfoData: orgInfo,\n auxCodes: auxCodesData,\n orgSettingsData,\n agentProfileData: agentProfileConfigData,\n dialPlanData: userDialPlanData,\n urlMapping: urlMappingData\n });\n\n // replace CONFIG_FILE_NAME with CONFIG_FILE_NAME\n _loggerProxy.default.info('Parsing completed for agent-config', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n _loggerProxy.default.info('Fetched configuration data successfully', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n return response;\n } catch (error) {\n _loggerProxy.default.error(`getAgentConfig call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAgentConfig'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the agent configuration data for the given orgId and agentId.\n * @param {string} orgId\n * @param {string} agentId\n * @returns {Promise<AgentResponse>}\n */\n async getUserUsingCI(orgId, agentId) {\n try {\n const resource = _constants3.endPointMap.userByCI(orgId, agentId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getUserUsingCI api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getUserUsingCI'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getUserUsingCI API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getUserUsingCI'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the desktop profile data for the given orgId and desktopProfileId.\n * @param {string} orgId\n * @param {string} desktopProfileId\n * @returns {Promise<DesktopProfileResponse>}\n */\n async getDesktopProfileById(orgId, desktopProfileId) {\n try {\n const resource = _constants3.endPointMap.desktopProfile(orgId, desktopProfileId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getDesktopProfileById api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDesktopProfileById'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getDesktopProfileById API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDesktopProfileById'\n });\n throw error;\n }\n }\n\n /**\n * fetches the list of teams for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<ListTeamsResponse>}\n */\n async getListOfTeams(orgId, page, pageSize, filter, attributes) {\n try {\n const resource = _constants3.endPointMap.listTeams(orgId, page, pageSize, filter, attributes);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getListOfTeams api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfTeams'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getListOfTeams API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfTeams'\n });\n throw error;\n }\n }\n\n /**\n * Fetches all teams from all pages for the given orgId\n * @param {string} orgId\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<TeamList[]>}\n */\n async getAllTeams(orgId, pageSize, filter, attributes) {\n try {\n let allTeams = [];\n let page = _constants3.DEFAULT_PAGE;\n const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter, attributes);\n const totalPages = firstResponse.meta.totalPages;\n allTeams = allTeams.concat(firstResponse.data);\n const requests = [];\n for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {\n requests.push(this.getListOfTeams(orgId, page, pageSize, filter, attributes));\n }\n const responses = await Promise.all(requests);\n for (const response of responses) {\n allTeams = allTeams.concat(response.data);\n }\n return allTeams;\n } catch (error) {\n _loggerProxy.default.error(`getAllTeams API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAllTeams'\n });\n throw error;\n }\n }\n\n /**\n * fetches the list of aux codes for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<ListAuxCodesResponse>}\n */\n async getListOfAuxCodes(orgId, page, pageSize, filter, attributes) {\n try {\n const resource = _constants3.endPointMap.listAuxCodes(orgId, page, pageSize, filter, attributes);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getListOfAuxCodes api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfAuxCodes'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getListOfAuxCodes API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getListOfAuxCodes'\n });\n throw error;\n }\n }\n\n /**\n * Fetches all aux codes from all pages for the given orgId\n * @param {string} orgId\n * @param {number} pageSize\n * @param {string[]} filter\n * @param {string[]} attributes\n * @returns {Promise<AuxCode[]>}\n */\n async getAllAuxCodes(orgId, pageSize, filter, attributes) {\n try {\n let allAuxCodes = [];\n let page = _constants3.DEFAULT_PAGE;\n const firstResponse = await this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes);\n allAuxCodes = allAuxCodes.concat(firstResponse.data);\n const totalPages = firstResponse.meta.totalPages;\n const promises = [];\n for (page = _constants3.DEFAULT_PAGE + 1; page < totalPages; page += 1) {\n promises.push(this.getListOfAuxCodes(orgId, page, pageSize, filter, attributes));\n }\n const responses = await Promise.all(promises);\n responses.forEach(response => {\n allAuxCodes = allAuxCodes.concat(response.data);\n });\n return allAuxCodes;\n } catch (error) {\n _loggerProxy.default.error(`getAllAuxCodes API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getAllAuxCodes'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the organization info for the given orgId.\n * @param {string} orgId\n * @returns {Promise<OrgInfo>}\n */\n async getOrgInfo(orgId) {\n try {\n const resource = _constants3.endPointMap.orgInfo(orgId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getOrgInfo api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrgInfo'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getOrgInfo API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrgInfo'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the organization settings for the given orgId.\n * @param {string} orgId\n * @returns {Promise<OrgSettings>}\n */\n async getOrganizationSetting(orgId) {\n try {\n const resource = _constants3.endPointMap.orgSettings(orgId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getOrganizationSetting api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrganizationSetting'\n });\n return Promise.resolve(response.body.data[0]);\n } catch (error) {\n _loggerProxy.default.error(`getOrganizationSetting API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getOrganizationSetting'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the tenant data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<TenantData>}\n */\n async getTenantData(orgId) {\n try {\n const resource = _constants3.endPointMap.tenantData(orgId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getTenantData api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getTenantData'\n });\n return Promise.resolve(response.body.data[0]);\n } catch (error) {\n _loggerProxy.default.error(`getTenantData API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getTenantData'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the URL mapping data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<URLMapping[]>}\n */\n async getURLMapping(orgId) {\n try {\n const resource = _constants3.endPointMap.urlMapping(orgId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getURLMapping api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getURLMapping'\n });\n return Promise.resolve(response.body.data);\n } catch (error) {\n _loggerProxy.default.error(`getURLMapping API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getURLMapping'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the dial plan data for the given orgId.\n * @param {string} orgId\n * @returns {Promise<DialPlanEntity[]>}\n */\n async getDialPlanData(orgId) {\n try {\n const resource = _constants3.endPointMap.dialPlan(orgId);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getDialPlanData api success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDialPlanData'\n });\n return Promise.resolve(response.body);\n } catch (error) {\n _loggerProxy.default.error(`getDialPlanData API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getDialPlanData'\n });\n throw error;\n }\n }\n\n /**\n * Fetches the list of queues for the given orgId.\n * @param {string} orgId\n * @param {number} page\n * @param {number} pageSize\n * @param {string} search - optional search string\n * @param {string} filter - optional filter string\n * @returns Promise<ContactServiceQueue[]>\n */\n async getQueues(orgId, page, pageSize, search, filter) {\n try {\n let queryParams = `page=${page}&pageSize=${pageSize}&desktopProfileFilter=true`;\n if (search) queryParams += `&search=${search}`;\n if (filter) queryParams += `&filter=${filter}`;\n const resource = _constants3.endPointMap.queueList(orgId, queryParams);\n const response = await this.webexReq.request({\n service: _constants.WCC_API_GATEWAY,\n resource,\n method: _types.HTTP_METHODS.GET\n });\n if (response.statusCode !== 200) {\n throw new Error(`API call failed with ${response.statusCode}`);\n }\n _loggerProxy.default.log('getQueues API success.', {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getQueues'\n });\n return response.body?.data;\n } catch (error) {\n _loggerProxy.default.error(`getQueues API call failed with ${error}`, {\n module: _constants2.CONFIG_FILE_NAME,\n method: 'getQueues'\n });\n throw error;\n }\n }\n}\nexports[\"default\"] = AgentConfigService;\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/config/index.js?");
3824
3824
 
3825
3825
  /***/ }),
3826
3826
 
@@ -3857,17 +3857,6 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3857
3857
 
3858
3858
  /***/ }),
3859
3859
 
3860
- /***/ "../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js":
3861
- /*!********************************************************************************!*\
3862
- !*** ../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js ***!
3863
- \********************************************************************************/
3864
- /***/ ((__unused_webpack_module, exports) => {
3865
-
3866
- "use strict";
3867
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nclass HttpRequest {\n static getInstance(options) {\n if (!HttpRequest.instance && options && options.webex) {\n HttpRequest.instance = new HttpRequest(options);\n }\n return HttpRequest.instance;\n }\n constructor(options) {\n const {\n webex\n } = options;\n this.webex = webex;\n }\n async request(options) {\n const {\n service,\n resource,\n method,\n body\n } = options;\n return this.webex.request({\n service,\n resource,\n method,\n body\n });\n }\n}\nvar _default = exports[\"default\"] = HttpRequest;\n//# sourceMappingURL=HttpRequest.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js?");
3868
-
3869
- /***/ }),
3870
-
3871
3860
  /***/ "../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js":
3872
3861
  /*!**************************************************************************!*\
3873
3862
  !*** ../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js ***!
@@ -3879,6 +3868,17 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3879
3868
 
3880
3869
  /***/ }),
3881
3870
 
3871
+ /***/ "../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js":
3872
+ /*!*********************************************************************************!*\
3873
+ !*** ../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js ***!
3874
+ \*********************************************************************************/
3875
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3876
+
3877
+ "use strict";
3878
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _constants = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _constants2 = __webpack_require__(/*! ../../metrics/constants */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/constants.js\");\nvar _MetricsManager = _interopRequireDefault(__webpack_require__(/*! ../../metrics/MetricsManager */ \"../../../node_modules/@webex/plugin-cc/dist/metrics/MetricsManager.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass WebexRequest {\n static getInstance(options) {\n if (!WebexRequest.instance && options && options.webex) {\n WebexRequest.instance = new WebexRequest(options);\n }\n return WebexRequest.instance;\n }\n constructor(options) {\n const {\n webex\n } = options;\n this.webex = webex;\n }\n async request(options) {\n const {\n service,\n resource,\n method,\n body\n } = options;\n return this.webex.request({\n service,\n resource,\n method,\n body\n });\n }\n\n /**\n * This is used for uploading the logs to backend/mats.\n *\n * @param metaData - meta data to be uploaded.\n */\n async uploadLogs(metaData = {}) {\n const feedbackId = crypto.randomUUID();\n try {\n const response = await this.webex.internal.support.submitLogs({\n ...metaData,\n feedbackId\n });\n _loggerProxy.default.info(`Logs uploaded successfully`, {\n module: _constants.WEBEX_REQUEST_FILE,\n method: this.uploadLogs.name\n });\n _MetricsManager.default.getInstance().trackEvent(_constants2.METRIC_EVENT_NAMES.UPLOAD_LOGS_SUCCESS, {\n trackingId: response?.trackingid,\n feedbackId\n }, ['behavioral']);\n return {\n trackingid: response.trackingid,\n ...(response.url ? {\n url: response.url\n } : {}),\n ...(response.userId ? {\n userId: response.userId\n } : {}),\n feedbackId\n };\n } catch (error) {\n _loggerProxy.default.error(`Error uploading logs: ${error}`, {\n module: _constants.WEBEX_REQUEST_FILE,\n method: this.uploadLogs.name\n });\n _MetricsManager.default.getInstance().trackEvent(_constants2.METRIC_EVENT_NAMES.UPLOAD_LOGS_FAILED, {\n stack: error?.stack,\n feedbackId\n }, ['behavioral']);\n throw error;\n }\n }\n}\nvar _default = exports[\"default\"] = WebexRequest;\n//# sourceMappingURL=WebexRequest.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js?");
3879
+
3880
+ /***/ }),
3881
+
3882
3882
  /***/ "../../../node_modules/@webex/plugin-cc/dist/services/core/aqm-reqs.js":
3883
3883
  /*!*****************************************************************************!*\
3884
3884
  !*** ../../../node_modules/@webex/plugin-cc/dist/services/core/aqm-reqs.js ***!
@@ -3886,7 +3886,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3886
3886
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3887
3887
 
3888
3888
  "use strict";
3889
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar Err = _interopRequireWildcard(__webpack_require__(/*! ./Err */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Err.js\"));\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _HttpRequest = _interopRequireDefault(__webpack_require__(/*! ./HttpRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/HttpRequest.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nclass AqmReqs {\n pendingRequests = {};\n pendingNotifCancelrequest = {};\n constructor(webSocketManager) {\n this.httpRequest = _HttpRequest.default.getInstance();\n this.webSocketManager = webSocketManager;\n this.webSocketManager.on('message', this.onMessage.bind(this));\n }\n req(c) {\n return (p, cbRes) => this.makeAPIRequest(c(p), cbRes);\n }\n reqEmpty(c) {\n return cbRes => this.makeAPIRequest(c(), cbRes);\n }\n async makeAPIRequest(c, cbRes) {\n return this.createPromise(c, cbRes);\n }\n createPromise(c, cbRes) {\n return new Promise((resolve, reject) => {\n const keySuccess = this.bindPrint(c.notifSuccess.bind);\n const keyFail = c.notifFail ? this.bindPrint(c.notifFail.bind) : null;\n const keyCancel = c.notifCancel?.bind ? this.bindPrint(c.notifCancel.bind) : null;\n let k = '';\n if (this.pendingRequests[keySuccess]) {\n k = keySuccess;\n }\n if (keyFail && this.pendingRequests[keyFail]) {\n k += keyFail;\n }\n if (k && c.timeout !== 'disabled') {\n reject(new Err.Details('Service.aqm.reqs.Pending', {\n key: k,\n msg: 'The request has been already created, multiple requests are not allowed.'\n }));\n return;\n }\n let isClear = false;\n const clear = () => {\n delete this.pendingRequests[keySuccess];\n if (keyFail) {\n delete this.pendingRequests[keyFail];\n }\n if (keyCancel) {\n delete this.pendingNotifCancelrequest[keyCancel];\n }\n isClear = true;\n };\n this.pendingRequests[keySuccess] = {\n check: msg => this.bindCheck(c.notifSuccess.bind, msg),\n handle: msg => {\n clear();\n resolve(msg);\n }\n };\n if (keyCancel) {\n this.pendingRequests[keySuccess].alternateBind = keyCancel;\n this.pendingNotifCancelrequest[keyCancel] = {\n check: msg => this.bindCheck(c.notifCancel?.bind, msg),\n handle: msg => {\n const alternateBindKey = this.pendingNotifCancelrequest[keyCancel].alternateBind;\n if (alternateBindKey) {\n this.pendingRequests[alternateBindKey].handle(msg);\n }\n },\n alternateBind: keySuccess\n };\n }\n if (keyFail) {\n this.pendingRequests[keyFail] = {\n check: msg => this.bindCheck(c.notifFail.bind, msg),\n handle: msg => {\n clear();\n const notifFail = c.notifFail;\n if ('errId' in notifFail) {\n _loggerProxy.default.log(`Routing request failed: ${msg}`, {\n module: _constants2.AQM_REQS_FILE,\n method: 'createPromise'\n });\n const eerr = new Err.Details(notifFail.errId, msg);\n _loggerProxy.default.log(`Routing request failed: ${eerr}`, {\n module: _constants2.AQM_REQS_FILE,\n method: 'createPromise'\n });\n reject(eerr);\n } else {\n reject(notifFail.err(msg));\n }\n }\n };\n }\n let response = null;\n this.httpRequest.request({\n service: c.host ?? '',\n resource: c.url,\n // eslint-disable-next-line no-nested-ternary\n method: c.method ? c.method : c.data ? _types.HTTP_METHODS.POST : _types.HTTP_METHODS.GET,\n body: c.data\n }).then(res => {\n response = res;\n if (cbRes) {\n cbRes(res);\n }\n }).catch(error => {\n clear();\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (typeof c.err === 'function') {\n reject(c.err(error));\n } else if (typeof c.err === 'string') {\n reject(new Err.Message(c.err));\n } else {\n reject(new Err.Message('Service.aqm.reqs.GenericRequestError'));\n }\n });\n if (c.timeout !== 'disabled') {\n window.setTimeout(() => {\n if (isClear) {\n return;\n }\n clear();\n if (response?.headers) {\n response.headers.Authorization = '*';\n }\n _loggerProxy.default.error(`Routing request timeout${keySuccess}${response}${c.url}`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.createPromise.name\n });\n reject(new Err.Details('Service.aqm.reqs.Timeout', {\n key: keySuccess,\n response: response\n }));\n }, c.timeout && c.timeout > 0 ? c.timeout : _constants.TIMEOUT_REQ);\n }\n });\n }\n bindPrint(bind) {\n let result = '';\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n result += `${k}=[${bind[k].join(',')}],`;\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n result += `${k}=(${this.bindPrint(bind[k])}),`;\n } else {\n result += `${k}=${bind[k]},`;\n }\n }\n return result ? result.slice(0, -1) : result;\n }\n bindCheck(bind, msg) {\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n // Check if the message value matches any of the values in the array\n if (!bind[k].includes(msg[k])) {\n return false;\n }\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n if (typeof msg[k] === 'object' && msg[k] !== null) {\n if (!this.bindCheck(bind[k], msg[k])) {\n return false;\n }\n } else {\n return false;\n }\n } else if (!msg[k] || msg[k] !== bind[k]) {\n return false;\n }\n }\n return true;\n }\n\n // must be lambda\n onMessage = msg => {\n const event = JSON.parse(msg);\n if (event.type === 'Welcome') {\n _loggerProxy.default.info(`Welcome message from Notifs Websocket`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n return;\n }\n if (event.keepalive === 'true') {\n _loggerProxy.default.info(`Keepalive from web socket`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n return;\n }\n if (event.type === 'AgentReloginFailed') {\n _loggerProxy.default.info('Silently handling the agent relogin fail', {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n }\n let isHandled = false;\n const kReq = Object.keys(this.pendingRequests);\n for (const thisReq of kReq) {\n const req = this.pendingRequests[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n break;\n }\n }\n // pendingNotifCancelrequest stores the secondary bind key, checks for the secondary bind key and handles the event\n const kReqAlt = Object.keys(this.pendingNotifCancelrequest);\n for (const thisReq of kReqAlt) {\n const req = this.pendingNotifCancelrequest[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n }\n }\n\n // TODO: add event emitter for unhandled events to replicate event.listen or .on\n\n if (!isHandled) {\n _loggerProxy.default.info(`event=missingEventHandler | [AqmReqs] missing routing message handler`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n }\n };\n}\nexports[\"default\"] = AqmReqs;\n//# sourceMappingURL=aqm-reqs.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/core/aqm-reqs.js?");
3889
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar Err = _interopRequireWildcard(__webpack_require__(/*! ./Err */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Err.js\"));\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _loggerProxy = _interopRequireDefault(__webpack_require__(/*! ../../logger-proxy */ \"../../../node_modules/@webex/plugin-cc/dist/logger-proxy.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/constants.js\");\nvar _constants2 = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _WebexRequest = _interopRequireDefault(__webpack_require__(/*! ./WebexRequest */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/WebexRequest.js\"));\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != typeof e && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nclass AqmReqs {\n pendingRequests = {};\n pendingNotifCancelrequest = {};\n constructor(webSocketManager) {\n this.webexRequest = _WebexRequest.default.getInstance();\n this.webSocketManager = webSocketManager;\n this.webSocketManager.on('message', this.onMessage.bind(this));\n }\n req(c) {\n return (p, cbRes) => this.makeAPIRequest(c(p), cbRes);\n }\n reqEmpty(c) {\n return cbRes => this.makeAPIRequest(c(), cbRes);\n }\n async makeAPIRequest(c, cbRes) {\n return this.createPromise(c, cbRes);\n }\n createPromise(c, cbRes) {\n return new Promise((resolve, reject) => {\n const keySuccess = this.bindPrint(c.notifSuccess.bind);\n const keyFail = c.notifFail ? this.bindPrint(c.notifFail.bind) : null;\n const keyCancel = c.notifCancel?.bind ? this.bindPrint(c.notifCancel.bind) : null;\n let k = '';\n if (this.pendingRequests[keySuccess]) {\n k = keySuccess;\n }\n if (keyFail && this.pendingRequests[keyFail]) {\n k += keyFail;\n }\n if (k && c.timeout !== 'disabled') {\n reject(new Err.Details('Service.aqm.reqs.Pending', {\n key: k,\n msg: 'The request has been already created, multiple requests are not allowed.'\n }));\n return;\n }\n let isClear = false;\n const clear = () => {\n delete this.pendingRequests[keySuccess];\n if (keyFail) {\n delete this.pendingRequests[keyFail];\n }\n if (keyCancel) {\n delete this.pendingNotifCancelrequest[keyCancel];\n }\n isClear = true;\n };\n this.pendingRequests[keySuccess] = {\n check: msg => this.bindCheck(c.notifSuccess.bind, msg),\n handle: msg => {\n clear();\n resolve(msg);\n }\n };\n if (keyCancel) {\n this.pendingRequests[keySuccess].alternateBind = keyCancel;\n this.pendingNotifCancelrequest[keyCancel] = {\n check: msg => this.bindCheck(c.notifCancel?.bind, msg),\n handle: msg => {\n const alternateBindKey = this.pendingNotifCancelrequest[keyCancel].alternateBind;\n if (alternateBindKey) {\n this.pendingRequests[alternateBindKey].handle(msg);\n }\n },\n alternateBind: keySuccess\n };\n }\n if (keyFail) {\n this.pendingRequests[keyFail] = {\n check: msg => this.bindCheck(c.notifFail.bind, msg),\n handle: msg => {\n clear();\n const notifFail = c.notifFail;\n if ('errId' in notifFail) {\n _loggerProxy.default.log(`Routing request failed: ${msg}`, {\n module: _constants2.AQM_REQS_FILE,\n method: 'createPromise'\n });\n const eerr = new Err.Details(notifFail.errId, msg);\n _loggerProxy.default.log(`Routing request failed: ${eerr}`, {\n module: _constants2.AQM_REQS_FILE,\n method: 'createPromise'\n });\n reject(eerr);\n } else {\n reject(notifFail.err(msg));\n }\n }\n };\n }\n let response = null;\n this.webexRequest.request({\n service: c.host ?? '',\n resource: c.url,\n // eslint-disable-next-line no-nested-ternary\n method: c.method ? c.method : c.data ? _types.HTTP_METHODS.POST : _types.HTTP_METHODS.GET,\n body: c.data\n }).then(res => {\n response = res;\n if (cbRes) {\n cbRes(res);\n }\n }).catch(error => {\n clear();\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (error?.headers) {\n error.headers.Authorization = '*';\n }\n if (typeof c.err === 'function') {\n reject(c.err(error));\n } else if (typeof c.err === 'string') {\n reject(new Err.Message(c.err));\n } else {\n reject(new Err.Message('Service.aqm.reqs.GenericRequestError'));\n }\n });\n if (c.timeout !== 'disabled') {\n window.setTimeout(() => {\n if (isClear) {\n return;\n }\n clear();\n if (response?.headers) {\n response.headers.Authorization = '*';\n }\n _loggerProxy.default.error(`Routing request timeout${keySuccess}${response}${c.url}`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.createPromise.name\n });\n reject(new Err.Details('Service.aqm.reqs.Timeout', {\n key: keySuccess,\n response: response\n }));\n }, c.timeout && c.timeout > 0 ? c.timeout : _constants.TIMEOUT_REQ);\n }\n });\n }\n bindPrint(bind) {\n let result = '';\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n result += `${k}=[${bind[k].join(',')}],`;\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n result += `${k}=(${this.bindPrint(bind[k])}),`;\n } else {\n result += `${k}=${bind[k]},`;\n }\n }\n return result ? result.slice(0, -1) : result;\n }\n bindCheck(bind, msg) {\n // eslint-disable-next-line no-restricted-syntax\n for (const k in bind) {\n if (Array.isArray(bind[k])) {\n // Check if the message value matches any of the values in the array\n if (!bind[k].includes(msg[k])) {\n return false;\n }\n } else if (typeof bind[k] === 'object' && bind[k] !== null) {\n if (typeof msg[k] === 'object' && msg[k] !== null) {\n if (!this.bindCheck(bind[k], msg[k])) {\n return false;\n }\n } else {\n return false;\n }\n } else if (!msg[k] || msg[k] !== bind[k]) {\n return false;\n }\n }\n return true;\n }\n\n // must be lambda\n onMessage = msg => {\n const event = JSON.parse(msg);\n if (event.type === 'Welcome') {\n _loggerProxy.default.info(`Welcome message from Notifs Websocket`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n return;\n }\n if (event.keepalive === 'true') {\n _loggerProxy.default.info(`Keepalive from web socket`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n return;\n }\n if (event.type === 'AgentReloginFailed') {\n _loggerProxy.default.info('Silently handling the agent relogin fail', {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n }\n let isHandled = false;\n const kReq = Object.keys(this.pendingRequests);\n for (const thisReq of kReq) {\n const req = this.pendingRequests[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n break;\n }\n }\n // pendingNotifCancelrequest stores the secondary bind key, checks for the secondary bind key and handles the event\n const kReqAlt = Object.keys(this.pendingNotifCancelrequest);\n for (const thisReq of kReqAlt) {\n const req = this.pendingNotifCancelrequest[thisReq];\n if (req.check(event)) {\n req.handle(event);\n isHandled = true;\n }\n }\n\n // TODO: add event emitter for unhandled events to replicate event.listen or .on\n\n if (!isHandled) {\n _loggerProxy.default.info(`event=missingEventHandler | [AqmReqs] missing routing message handler`, {\n module: _constants2.AQM_REQS_FILE,\n method: this.onMessage.name\n });\n }\n };\n}\nexports[\"default\"] = AqmReqs;\n//# sourceMappingURL=aqm-reqs.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/core/aqm-reqs.js?");
3890
3890
 
3891
3891
  /***/ }),
3892
3892
 
@@ -3996,7 +3996,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
3996
3996
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3997
3997
 
3998
3998
  "use strict";
3999
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _events = _interopRequireDefault(__webpack_require__(/*! events */ \"../../../node_modules/events/events.js\"));\nvar _calling = __webpack_require__(/*! @webex/calling */ \"../../../node_modules/@webex/calling/dist/module/index.js\");\nvar _Utils = __webpack_require__(/*! ../core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _types2 = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/types.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass Task extends _events.default {\n constructor(contact, webCallingService, data) {\n super();\n this.contact = contact;\n this.data = data;\n this.webCallingService = webCallingService;\n this.webCallMap = {};\n this.registerWebCallListeners();\n }\n handleRemoteMedia = track => {\n this.emit(_types2.TASK_EVENTS.TASK_MEDIA, track);\n };\n registerWebCallListeners() {\n this.webCallingService.on(_calling.CALL_EVENT_KEYS.REMOTE_MEDIA, this.handleRemoteMedia);\n }\n unregisterWebCallListeners() {\n this.webCallingService.off(_calling.CALL_EVENT_KEYS.REMOTE_MEDIA, this.handleRemoteMedia);\n }\n updateTaskData = (updatedData, shouldOverwrite = false) => {\n this.data = shouldOverwrite ? updatedData : this.reconcileData(this.data, updatedData);\n return this;\n };\n reconcileData(oldData, newData) {\n Object.keys(newData).forEach(key => {\n if (newData[key] && typeof newData[key] === 'object' && !Array.isArray(newData[key])) {\n oldData[key] = this.reconcileData({\n ...oldData[key]\n }, newData[key]);\n } else {\n oldData[key] = newData[key];\n }\n });\n return oldData;\n }\n\n /**\n * This is used for incoming task accept by agent.\n *\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.accept().then(()=>{}).catch(()=>{})\n * ```\n */\n async accept() {\n try {\n if (this.webCallingService.loginOption === _types.LoginOption.BROWSER) {\n const constraints = {\n audio: true\n };\n const localStream = await navigator.mediaDevices.getUserMedia(constraints);\n const audioTrack = localStream.getAudioTracks()[0];\n this.localAudioStream = new _calling.LocalMicrophoneStream(new MediaStream([audioTrack]));\n this.webCallingService.answerCall(this.localAudioStream, this.data.interactionId);\n return Promise.resolve(); // TODO: Update this with sending the task object received in AgentContactAssigned\n }\n\n // TODO: Invoke the accept API from services layer. This is going to be used in Outbound Dialer scenario\n return this.contact.accept({\n interactionId: this.data.interactionId\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'accept', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for the placing the call in mute or unmute by the agent.\n *\n * @throws Error\n * @example\n * ```typescript\n * task.toggleMute().then(()=>{}).catch(()=>{})\n * ```\n */\n async toggleMute() {\n try {\n this.webCallingService.muteUnmuteCall(this.localAudioStream);\n return Promise.resolve();\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'mute', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for the incoming task decline by agent.\n *\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.decline().then(()=>{}).catch(()=>{})\n * ```\n */\n async decline() {\n try {\n this.webCallingService.declineCall(this.data.interactionId);\n this.unregisterWebCallListeners();\n return Promise.resolve();\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'decline', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to hold the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.hold().then(()=>{}).catch(()=>{})\n * ```\n * */\n async hold() {\n try {\n return this.contact.hold({\n interactionId: this.data.interactionId,\n data: {\n mediaResourceId: this.data.mediaResourceId\n }\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'hold', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to resume the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.resume().then(()=>{}).catch(()=>{})\n * ```\n */\n async resume() {\n try {\n const {\n mainInteractionId\n } = this.data.interaction;\n // In case of consult call, When resume is invoked, we need to pass the mediaResourceId of the main interaction\n // It's always good to explicitly pass the main mediaResourceId to avoid any confusion\n const {\n mediaResourceId\n } = this.data.interaction.media[mainInteractionId];\n return this.contact.unHold({\n interactionId: this.data.interactionId,\n data: {\n mediaResourceId\n }\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'resume', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to end the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.end().then(()=>{}).catch(()=>{})\n * ```\n */\n async end() {\n try {\n return this.contact.end({\n interactionId: this.data.interactionId\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'end', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to wrap up the task.\n * @param wrapupPayload - WrapupPayLoad\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})\n * ```\n */\n async wrapup(wrapupPayload) {\n try {\n if (!this.data) {\n throw new Error('No task data available');\n }\n if (!wrapupPayload.auxCodeId || wrapupPayload.auxCodeId.length === 0) {\n throw new Error('AuxCodeId is required');\n }\n if (!wrapupPayload.wrapUpReason || wrapupPayload.wrapUpReason.length === 0) {\n throw new Error('WrapUpReason is required');\n }\n return this.contact.wrapup({\n interactionId: this.data.interactionId,\n data: wrapupPayload\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'wrapup', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to pause the call recording\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.pauseRecording().then(()=>{}).catch(()=>{});\n * ```\n */\n async pauseRecording() {\n try {\n const result = await this.contact.pauseRecording({\n interactionId: this.data.interactionId\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'pauseRecording', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to pause the call recording\n * @param resumeRecordingPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.resumeRecording(resumeRecordingPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async resumeRecording(resumeRecordingPayload) {\n try {\n resumeRecordingPayload ??= {\n autoResumed: false\n };\n const result = await this.contact.resumeRecording({\n interactionId: this.data.interactionId,\n data: resumeRecordingPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'resumeRecording', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to consult the task\n * @param consultPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultPayload = {\n * destination: 'myBuddyAgentId',\n * destinationType: DESTINATION_TYPE.AGENT,\n * }\n * task.consult(consultPayload).then(()=>{}).catch(()=>{});\n * ```\n * */\n async consult(consultPayload) {\n try {\n const result = await this.contact.consult({\n interactionId: this.data.interactionId,\n data: consultPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'consult', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to end the consult\n * @param consultEndPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultEndPayload = {\n * isConsult: true,\n * queueId: 'myQueueId',\n * }\n * task.endConsult(consultEndPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async endConsult(consultEndPayload) {\n try {\n const result = await this.contact.consultEnd({\n interactionId: this.data.interactionId,\n data: consultEndPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'endConsult', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to blind transfer or vTeam transfer the task\n * @param transferPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const transferPayload = {\n * to: 'myQueueId',\n * destinationType: 'queue',\n * }\n * task.transfer(transferPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async transfer(transferPayload) {\n try {\n let result;\n if (transferPayload.destinationType === _types2.DESTINATION_TYPE.QUEUE) {\n result = await this.contact.vteamTransfer({\n interactionId: this.data.interactionId,\n data: transferPayload\n });\n } else {\n result = await this.contact.blindTransfer({\n interactionId: this.data.interactionId,\n data: transferPayload\n });\n }\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'transfer', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to consult transfer the task\n * @param consultTransferPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultTransferPayload = {\n * destination: 'anotherAgentId',\n * destinationType: 'agent',\n * }\n * task.consultTransfer(consultTransferPayload).then(()=>{}).catch(()=>{});\n * ```\n * */\n async consultTransfer(consultTransferPayload) {\n try {\n const result = await this.contact.consultTransfer({\n interactionId: this.data.interactionId,\n data: consultTransferPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'consultTransfer', _constants.CC_FILE);\n throw detailedError;\n }\n }\n}\nexports[\"default\"] = Task;\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/task/index.js?");
3999
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _events = _interopRequireDefault(__webpack_require__(/*! events */ \"../../../node_modules/events/events.js\"));\nvar _calling = __webpack_require__(/*! @webex/calling */ \"../../../node_modules/@webex/calling/dist/module/index.js\");\nvar _Utils = __webpack_require__(/*! ../core/Utils */ \"../../../node_modules/@webex/plugin-cc/dist/services/core/Utils.js\");\nvar _types = __webpack_require__(/*! ../../types */ \"../../../node_modules/@webex/plugin-cc/dist/types.js\");\nvar _constants = __webpack_require__(/*! ../../constants */ \"../../../node_modules/@webex/plugin-cc/dist/constants.js\");\nvar _types2 = __webpack_require__(/*! ./types */ \"../../../node_modules/@webex/plugin-cc/dist/services/task/types.js\");\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\nclass Task extends _events.default {\n constructor(contact, webCallingService, data) {\n super();\n this.contact = contact;\n this.data = data;\n this.webCallingService = webCallingService;\n this.webCallMap = {};\n this.registerWebCallListeners();\n }\n handleRemoteMedia = track => {\n this.emit(_types2.TASK_EVENTS.TASK_MEDIA, track);\n };\n registerWebCallListeners() {\n this.webCallingService.on(_calling.CALL_EVENT_KEYS.REMOTE_MEDIA, this.handleRemoteMedia);\n }\n unregisterWebCallListeners() {\n this.webCallingService.off(_calling.CALL_EVENT_KEYS.REMOTE_MEDIA, this.handleRemoteMedia);\n }\n updateTaskData = (updatedData, shouldOverwrite = false) => {\n this.data = shouldOverwrite ? updatedData : this.reconcileData(this.data, updatedData);\n return this;\n };\n reconcileData(oldData, newData) {\n Object.keys(newData).forEach(key => {\n if (newData[key] && typeof newData[key] === 'object' && !Array.isArray(newData[key])) {\n oldData[key] = this.reconcileData({\n ...oldData[key]\n }, newData[key]);\n } else {\n oldData[key] = newData[key];\n }\n });\n return oldData;\n }\n\n /**\n * This is used for incoming task accept by agent.\n *\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.accept().then(()=>{}).catch(()=>{})\n * ```\n */\n async accept() {\n try {\n if (this.webCallingService.loginOption === _types.LoginOption.BROWSER) {\n const constraints = {\n audio: true\n };\n const localStream = await navigator.mediaDevices.getUserMedia(constraints);\n const audioTrack = localStream.getAudioTracks()[0];\n this.localAudioStream = new _calling.LocalMicrophoneStream(new MediaStream([audioTrack]));\n this.webCallingService.answerCall(this.localAudioStream, this.data.interactionId);\n return Promise.resolve(); // TODO: Update this with sending the task object received in AgentContactAssigned\n }\n\n // TODO: Invoke the accept API from services layer. This is going to be used in Outbound Dialer scenario\n return this.contact.accept({\n interactionId: this.data.interactionId\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'accept', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for the placing the call in mute or unmute by the agent.\n *\n * @throws Error\n * @example\n * ```typescript\n * task.toggleMute().then(()=>{}).catch(()=>{})\n * ```\n */\n async toggleMute() {\n try {\n this.webCallingService.muteUnmuteCall(this.localAudioStream);\n return Promise.resolve();\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'mute', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used for the incoming task decline by agent.\n *\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.decline().then(()=>{}).catch(()=>{})\n * ```\n */\n async decline() {\n try {\n this.webCallingService.declineCall(this.data.interactionId);\n this.unregisterWebCallListeners();\n return Promise.resolve();\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'decline', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to hold the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.hold().then(()=>{}).catch(()=>{})\n * ```\n * */\n async hold() {\n try {\n return this.contact.hold({\n interactionId: this.data.interactionId,\n data: {\n mediaResourceId: this.data.mediaResourceId\n }\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'hold', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to resume the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.resume().then(()=>{}).catch(()=>{})\n * ```\n */\n async resume() {\n try {\n const {\n mainInteractionId\n } = this.data.interaction;\n // In case of consult call, When resume is invoked, we need to pass the mediaResourceId of the main interaction\n // It's always good to explicitly pass the main mediaResourceId to avoid any confusion\n const {\n mediaResourceId\n } = this.data.interaction.media[mainInteractionId];\n return this.contact.unHold({\n interactionId: this.data.interactionId,\n data: {\n mediaResourceId\n }\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'resume', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to end the task.\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.end().then(()=>{}).catch(()=>{})\n * ```\n */\n async end() {\n try {\n return this.contact.end({\n interactionId: this.data.interactionId\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'end', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to wrap up the task.\n * @param wrapupPayload - WrapupPayLoad\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.wrapup(wrapupPayload).then(()=>{}).catch(()=>{})\n * ```\n */\n async wrapup(wrapupPayload) {\n try {\n if (!this.data) {\n throw new Error('No task data available');\n }\n if (!wrapupPayload.auxCodeId || wrapupPayload.auxCodeId.length === 0) {\n throw new Error('AuxCodeId is required');\n }\n if (!wrapupPayload.wrapUpReason || wrapupPayload.wrapUpReason.length === 0) {\n throw new Error('WrapUpReason is required');\n }\n return this.contact.wrapup({\n interactionId: this.data.interactionId,\n data: wrapupPayload\n });\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'wrapup', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to pause the call recording\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.pauseRecording().then(()=>{}).catch(()=>{});\n * ```\n */\n async pauseRecording() {\n try {\n const result = await this.contact.pauseRecording({\n interactionId: this.data.interactionId\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'pauseRecording', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to pause the call recording\n * @param resumeRecordingPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * task.resumeRecording(resumeRecordingPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async resumeRecording(resumeRecordingPayload) {\n try {\n resumeRecordingPayload ??= {\n autoResumed: false\n };\n const result = await this.contact.resumeRecording({\n interactionId: this.data.interactionId,\n data: resumeRecordingPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'resumeRecording', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to consult the task\n * @param consultPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultPayload = {\n * destination: 'myBuddyAgentId',\n * destinationType: DESTINATION_TYPE.AGENT,\n * }\n * task.consult(consultPayload).then(()=>{}).catch(()=>{});\n * ```\n * */\n async consult(consultPayload) {\n try {\n const result = await this.contact.consult({\n interactionId: this.data.interactionId,\n data: consultPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'consult', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to end the consult\n * @param consultEndPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultEndPayload = {\n * isConsult: true,\n * queueId: 'myQueueId',\n * }\n * task.endConsult(consultEndPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async endConsult(consultEndPayload) {\n try {\n const result = await this.contact.consultEnd({\n interactionId: this.data.interactionId,\n data: consultEndPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'endConsult', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to blind transfer or vTeam transfer the task\n * @param transferPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const transferPayload = {\n * to: 'myQueueId',\n * destinationType: 'queue',\n * }\n * task.transfer(transferPayload).then(()=>{}).catch(()=>{});\n * ```\n */\n async transfer(transferPayload) {\n try {\n let result;\n if (transferPayload.destinationType === _types2.DESTINATION_TYPE.QUEUE) {\n result = await this.contact.vteamTransfer({\n interactionId: this.data.interactionId,\n data: transferPayload\n });\n } else {\n result = await this.contact.blindTransfer({\n interactionId: this.data.interactionId,\n data: transferPayload\n });\n }\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'transfer', _constants.CC_FILE);\n throw detailedError;\n }\n }\n\n /**\n * This is used to consult transfer the task\n * @param consultTransferPayload\n * @returns Promise<TaskResponse>\n * @throws Error\n * @example\n * ```typescript\n * const consultTransferPayload = {\n * destination: 'anotherAgentId',\n * destinationType: 'agent',\n * }\n * task.consultTransfer(consultTransferPayload).then(()=>{}).catch(()=>{});\n * ```\n * */\n async consultTransfer(consultTransferPayload) {\n try {\n // For queue destinations, use the destAgentId from task data\n if (consultTransferPayload.destinationType === _types2.CONSULT_TRANSFER_DESTINATION_TYPE.QUEUE) {\n if (!this.data.destAgentId) {\n throw new Error('No agent has accepted this queue consult yet');\n }\n\n // Override the destination with the agent who accepted the queue consult\n consultTransferPayload = {\n to: this.data.destAgentId,\n destinationType: _types2.CONSULT_TRANSFER_DESTINATION_TYPE.AGENT\n };\n }\n const result = await this.contact.consultTransfer({\n interactionId: this.data.interactionId,\n data: consultTransferPayload\n });\n return result;\n } catch (error) {\n const {\n error: detailedError\n } = (0, _Utils.getErrorDetails)(error, 'consultTransfer', _constants.CC_FILE);\n throw detailedError;\n }\n }\n}\nexports[\"default\"] = Task;\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/task/index.js?");
4000
4000
 
4001
4001
  /***/ }),
4002
4002
 
@@ -4007,7 +4007,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
4007
4007
  /***/ ((__unused_webpack_module, exports) => {
4008
4008
 
4009
4009
  "use strict";
4010
- eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.TASK_EVENTS = exports.DESTINATION_TYPE = exports.CONSULT_TRANSFER_DESTINATION_TYPE = void 0;\nconst DESTINATION_TYPE = exports.DESTINATION_TYPE = {\n QUEUE: 'queue',\n DIALNUMBER: 'dialNumber',\n AGENT: 'agent',\n ENTRYPOINT: 'entryPoint' // Entrypoint is only supported for consult and not for transfer\n};\n\nconst CONSULT_TRANSFER_DESTINATION_TYPE = exports.CONSULT_TRANSFER_DESTINATION_TYPE = {\n AGENT: 'agent',\n ENTRYPOINT: 'entryPoint',\n DIALNUMBER: 'dialNumber'\n};\nconst TASK_EVENTS = exports.TASK_EVENTS = {\n TASK_INCOMING: 'task:incoming',\n TASK_ASSIGNED: 'task:assigned',\n TASK_MEDIA: 'task:media',\n TASK_UNASSIGNED: 'task:unassigned',\n TASK_HOLD: 'task:hold',\n TASK_UNHOLD: 'task:unhold',\n TASK_CONSULT_END: 'task:consultEnd',\n TASK_CONSULT_QUEUE_CANCELLED: 'task:consultQueueCancelled',\n TASK_CONSULT_QUEUE_FAILED: 'task:consultQueueFailed',\n TASK_CONSULT_ACCEPTED: 'task:consultAccepted',\n TASK_CONSULTING: 'task:consulting',\n TASK_PAUSE: 'task:pause',\n TASK_RESUME: 'task:resume',\n TASK_END: 'task:end',\n TASK_WRAPUP: 'task:wrapup',\n TASK_REJECT: 'task:rejected',\n TASK_HYDRATE: 'task:hydrate'\n};\n\n/**\n * Task payload type\n */\n\n/**\n * Parameters to be passed for pause recording task\n */\n\n/**\n * Parameters to be passed for resume recording task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for consult task\n */\n\n/**\n * Parameters to be passed for consult end task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for consult end task\n * This is the actual payload that is sent to the developer API\n */\n\n/**\n * Parameters to be passed for wrapup task\n */\n\n/**\n * Parameters to be passed for outbound dialer task\n */\n\n/**\n * Response type for the task public methods\n */\n\n/**\n * Represents an interface for managing task related operations.\n */\n//# sourceMappingURL=types.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/task/types.js?");
4010
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.TASK_EVENTS = exports.DESTINATION_TYPE = exports.CONSULT_TRANSFER_DESTINATION_TYPE = void 0;\nconst DESTINATION_TYPE = exports.DESTINATION_TYPE = {\n QUEUE: 'queue',\n DIALNUMBER: 'dialNumber',\n AGENT: 'agent',\n ENTRYPOINT: 'entryPoint' // Entrypoint is only supported for consult and not for transfer\n};\n\nconst CONSULT_TRANSFER_DESTINATION_TYPE = exports.CONSULT_TRANSFER_DESTINATION_TYPE = {\n AGENT: 'agent',\n ENTRYPOINT: 'entryPoint',\n DIALNUMBER: 'dialNumber',\n QUEUE: 'queue'\n};\nconst TASK_EVENTS = exports.TASK_EVENTS = {\n TASK_INCOMING: 'task:incoming',\n TASK_ASSIGNED: 'task:assigned',\n TASK_MEDIA: 'task:media',\n TASK_UNASSIGNED: 'task:unassigned',\n TASK_HOLD: 'task:hold',\n TASK_UNHOLD: 'task:unhold',\n TASK_CONSULT_END: 'task:consultEnd',\n TASK_CONSULT_QUEUE_CANCELLED: 'task:consultQueueCancelled',\n TASK_CONSULT_QUEUE_FAILED: 'task:consultQueueFailed',\n TASK_CONSULT_ACCEPTED: 'task:consultAccepted',\n TASK_CONSULTING: 'task:consulting',\n TASK_PAUSE: 'task:pause',\n TASK_RESUME: 'task:resume',\n TASK_END: 'task:end',\n TASK_WRAPUP: 'task:wrapup',\n TASK_REJECT: 'task:rejected',\n TASK_HYDRATE: 'task:hydrate'\n};\n\n/**\n * Task payload type\n */\n\n/**\n * Parameters to be passed for pause recording task\n */\n\n/**\n * Parameters to be passed for resume recording task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for consult task\n */\n\n/**\n * Parameters to be passed for consult end task\n */\n\n/**\n * Parameters to be passed for transfer task\n */\n\n/**\n * Parameters to be passed for consult end task\n * This is the actual payload that is sent to the developer API\n */\n\n/**\n * Parameters to be passed for wrapup task\n */\n\n/**\n * Parameters to be passed for outbound dialer task\n */\n\n/**\n * Response type for the task public methods\n */\n\n/**\n * Represents an interface for managing task related operations.\n */\n//# sourceMappingURL=types.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/plugin-cc/dist/services/task/types.js?");
4011
4011
 
4012
4012
  /***/ }),
4013
4013
 
@@ -4238,7 +4238,7 @@ eval("\n\nvar _Reflect$construct = __webpack_require__(/*! @babel/runtime-corejs
4238
4238
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4239
4239
 
4240
4240
  "use strict";
4241
- eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _map = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/map.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ./webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ./webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Base class for coalescing requests to batched APIs\n * @class Batcher\n */\nvar Batcher = _webexPlugin.default.extend({\n session: {\n deferreds: {\n type: 'object',\n default: function _default() {\n return new _map.default();\n }\n },\n queue: {\n type: 'array',\n default: function _default() {\n return [];\n }\n }\n },\n derived: {\n bounce: {\n fn: function fn() {\n var _this = this;\n return (0, _common.cappedDebounce)(function () {\n return _this.executeQueue.apply(_this, arguments);\n }, this.config.batcherWait, {\n maxCalls: this.config.batcherMaxCalls,\n maxWait: this.config.batcherMaxWait\n });\n }\n }\n },\n /**\n * Requests an item from a batched API\n * @param {Object} item\n * @returns {Promise<mixed>}\n */\n request: function request(item) {\n var _this2 = this;\n // So far, I can't find a way to avoid three layers of nesting here.\n /* eslint max-nested-callbacks: [0] */\n var defer = new _common.Defer();\n this.fingerprintRequest(item).then(function (idx) {\n if (_this2.deferreds.has(idx)) {\n defer.resolve(_this2.deferreds.get(idx).promise);\n return;\n }\n _this2.deferreds.set(idx, defer);\n _this2.prepareItem(item).then(function (req) {\n defer.promise = defer.promise.then((0, _common.tap)(function () {\n return _this2.deferreds.delete(idx);\n })).catch(function (reason) {\n _this2.deferreds.delete(idx);\n return _promise.default.reject(reason);\n });\n _this2.enqueue(req).then(function () {\n return _this2.bounce();\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n return defer.promise;\n },\n /**\n * Adds an item to the queue.\n * Intended to be overridden\n * @param {mixed} req\n * @returns {Promise<undefined>}\n */\n enqueue: function enqueue(req) {\n this.queue.push(req);\n return _promise.default.resolve();\n },\n /**\n * Transform the item before adding it to the queue\n * Intended to be overridden\n * @param {mixed} item\n * @returns {Promise<mixed>}\n */\n prepareItem: function prepareItem(item) {\n return _promise.default.resolve(item);\n },\n /**\n * Detaches the current queue, does any appropriate transforms, and submits it\n * to the API.\n * @returns {Promise<undefined>}\n */\n executeQueue: function executeQueue() {\n var _this3 = this;\n var queue = this.queue.splice(0, this.config.batcherMaxCalls);\n return new _promise.default(function (resolve) {\n resolve(_this3.prepareRequest(queue).then(function (payload) {\n return _this3.submitHttpRequest(payload).then(function (res) {\n return _this3.handleHttpSuccess(res);\n });\n }).catch(function (reason) {\n if (reason instanceof _webexHttpError.default) {\n return _this3.handleHttpError(reason);\n }\n return _promise.default.all(queue.map(function (item) {\n return _this3.getDeferredForRequest(item).then(function (defer) {\n defer.reject(reason);\n });\n }));\n }));\n }).catch(function (reason) {\n _this3.logger.error( false ? 0 : reason.stack);\n return _promise.default.reject(reason);\n });\n },\n /**\n * Performs any final transforms on the queue before submitting it to the API\n * Intended to be overridden\n * @param {Object|Array} queue\n * @returns {Promise<Object>}\n */\n prepareRequest: function prepareRequest(queue) {\n return _promise.default.resolve(queue);\n },\n /**\n * Submits the prepared request body to the API.\n * This method *must* be overridden\n * @param {Object} payload\n * @returns {Promise<HttpResponseObject>}\n */\n // eslint-disable-next-line no-unused-vars\n submitHttpRequest: function submitHttpRequest(payload) {\n throw new Error('request() must be implemented');\n },\n /**\n * Actions taken when the http request returns a success\n * Intended to be overridden\n * @param {Promise<HttpResponseObject>} res\n * @returns {Promise<undefined>}\n */\n handleHttpSuccess: function handleHttpSuccess(res) {\n var _this4 = this;\n return _promise.default.all((res.body && res.body.items || res.body).map(function (item) {\n return _this4.acceptItem(item);\n }));\n },\n /**\n * Actions taken when the http request returns a failure. Typically, this\n * means failing the entire queue, but could be overridden in some\n * implementations to e.g. reenqueue.\n * Intended to be overridden\n * @param {WebexHttpError} reason\n * @returns {Promise<undefined>}\n */\n handleHttpError: function handleHttpError(reason) {\n var _this5 = this;\n if (reason instanceof _webexHttpError.default) {\n if ((0, _lodash.has)(reason, 'options.body.map')) {\n return _promise.default.all(reason.options.body.map(function (item) {\n return _this5.getDeferredForRequest(item).then(function (defer) {\n defer.reject(reason);\n });\n }));\n }\n }\n this.logger.error('http error handler called without a WebexHttpError object', reason);\n return _promise.default.reject(reason);\n },\n /**\n * Determines if the item succeeded or failed and delegates accordingly\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n acceptItem: function acceptItem(item) {\n var _this6 = this;\n return this.didItemFail(item).then(function (didFail) {\n if (didFail) {\n return _this6.handleItemFailure(item);\n }\n return _this6.handleItemSuccess(item);\n });\n },\n /**\n * Indicates if the specified response item implies a success or a failure\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<Boolean>}\n */\n // eslint-disable-next-line no-unused-vars\n didItemFail: function didItemFail(item) {\n return _promise.default.resolve(false);\n },\n /**\n * Finds the Defer for the specified item and rejects its promise\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemFailure: function handleItemFailure(item) {\n return this.getDeferredForResponse(item).then(function (defer) {\n defer.reject(item);\n });\n },\n /**\n * Finds the Defer for the specified item and resolves its promise\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemSuccess: function handleItemSuccess(item) {\n return this.getDeferredForResponse(item).then(function (defer) {\n defer.resolve(item);\n });\n },\n /**\n * Returns the Deferred for the specified request item\n * @param {Object} item\n * @returns {Promise<Defer>}\n */\n getDeferredForRequest: function getDeferredForRequest(item) {\n var _this7 = this;\n return this.fingerprintRequest(item).then(function (idx) {\n var defer = _this7.deferreds.get(idx);\n\n /* istanbul ignore if */\n if (!defer) {\n throw new Error('Could not find pending request for received response');\n }\n return defer;\n });\n },\n /**\n * Returns the Deferred for the specified response item\n * @param {Object} item\n * @returns {Promise<Defer>}\n */\n getDeferredForResponse: function getDeferredForResponse(item) {\n var _this8 = this;\n return this.fingerprintResponse(item).then(function (idx) {\n var defer = _this8.deferreds.get(idx);\n\n /* istanbul ignore if */\n if (!defer) {\n throw new Error('Could not find pending request for received response');\n }\n return defer;\n });\n },\n /**\n * Generates a unique identifier for the item in a request payload\n * Intended to be overridden\n * Note that overrides must return a primitive.\n * @param {Object} item\n * @returns {Promise<primitive>}\n */\n // eslint-disable-next-line no-unused-vars\n fingerprintRequest: function fingerprintRequest(item) {\n throw new Error('fingerprintRequest() must be implemented');\n },\n /**\n * Generates a unique identifier for the item in a response payload\n * Intended to be overridden\n * Note that overrides must return a primitive.\n * @param {Object} item\n * @returns {Promise<primitive>}\n */\n // eslint-disable-next-line no-unused-vars\n fingerprintResponse: function fingerprintResponse(item) {\n throw new Error('fingerprintResponse() must be implemented');\n },\n version: \"3.8.0-next.10\"\n});\nvar _default2 = exports[\"default\"] = Batcher;\n//# sourceMappingURL=batcher.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/batcher.js?");
4241
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _map = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/map.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ./webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ./webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Base class for coalescing requests to batched APIs\n * @class Batcher\n */\nvar Batcher = _webexPlugin.default.extend({\n session: {\n deferreds: {\n type: 'object',\n default: function _default() {\n return new _map.default();\n }\n },\n queue: {\n type: 'array',\n default: function _default() {\n return [];\n }\n }\n },\n derived: {\n bounce: {\n fn: function fn() {\n var _this = this;\n return (0, _common.cappedDebounce)(function () {\n return _this.executeQueue.apply(_this, arguments);\n }, this.config.batcherWait, {\n maxCalls: this.config.batcherMaxCalls,\n maxWait: this.config.batcherMaxWait\n });\n }\n }\n },\n /**\n * Requests an item from a batched API\n * @param {Object} item\n * @returns {Promise<mixed>}\n */\n request: function request(item) {\n var _this2 = this;\n // So far, I can't find a way to avoid three layers of nesting here.\n /* eslint max-nested-callbacks: [0] */\n var defer = new _common.Defer();\n this.fingerprintRequest(item).then(function (idx) {\n if (_this2.deferreds.has(idx)) {\n defer.resolve(_this2.deferreds.get(idx).promise);\n return;\n }\n _this2.deferreds.set(idx, defer);\n _this2.prepareItem(item).then(function (req) {\n defer.promise = defer.promise.then((0, _common.tap)(function () {\n return _this2.deferreds.delete(idx);\n })).catch(function (reason) {\n _this2.deferreds.delete(idx);\n return _promise.default.reject(reason);\n });\n _this2.enqueue(req).then(function () {\n return _this2.bounce();\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n }).catch(function (reason) {\n return defer.reject(reason);\n });\n return defer.promise;\n },\n /**\n * Adds an item to the queue.\n * Intended to be overridden\n * @param {mixed} req\n * @returns {Promise<undefined>}\n */\n enqueue: function enqueue(req) {\n this.queue.push(req);\n return _promise.default.resolve();\n },\n /**\n * Transform the item before adding it to the queue\n * Intended to be overridden\n * @param {mixed} item\n * @returns {Promise<mixed>}\n */\n prepareItem: function prepareItem(item) {\n return _promise.default.resolve(item);\n },\n /**\n * Detaches the current queue, does any appropriate transforms, and submits it\n * to the API.\n * @returns {Promise<undefined>}\n */\n executeQueue: function executeQueue() {\n var _this3 = this;\n var queue = this.queue.splice(0, this.config.batcherMaxCalls);\n return new _promise.default(function (resolve) {\n resolve(_this3.prepareRequest(queue).then(function (payload) {\n return _this3.submitHttpRequest(payload).then(function (res) {\n return _this3.handleHttpSuccess(res);\n });\n }).catch(function (reason) {\n if (reason instanceof _webexHttpError.default) {\n return _this3.handleHttpError(reason);\n }\n return _promise.default.all(queue.map(function (item) {\n return _this3.getDeferredForRequest(item).then(function (defer) {\n defer.reject(reason);\n });\n }));\n }));\n }).catch(function (reason) {\n _this3.logger.error( false ? 0 : reason.stack);\n return _promise.default.reject(reason);\n });\n },\n /**\n * Performs any final transforms on the queue before submitting it to the API\n * Intended to be overridden\n * @param {Object|Array} queue\n * @returns {Promise<Object>}\n */\n prepareRequest: function prepareRequest(queue) {\n return _promise.default.resolve(queue);\n },\n /**\n * Submits the prepared request body to the API.\n * This method *must* be overridden\n * @param {Object} payload\n * @returns {Promise<HttpResponseObject>}\n */\n // eslint-disable-next-line no-unused-vars\n submitHttpRequest: function submitHttpRequest(payload) {\n throw new Error('request() must be implemented');\n },\n /**\n * Actions taken when the http request returns a success\n * Intended to be overridden\n * @param {Promise<HttpResponseObject>} res\n * @returns {Promise<undefined>}\n */\n handleHttpSuccess: function handleHttpSuccess(res) {\n var _this4 = this;\n return _promise.default.all((res.body && res.body.items || res.body).map(function (item) {\n return _this4.acceptItem(item);\n }));\n },\n /**\n * Actions taken when the http request returns a failure. Typically, this\n * means failing the entire queue, but could be overridden in some\n * implementations to e.g. reenqueue.\n * Intended to be overridden\n * @param {WebexHttpError} reason\n * @returns {Promise<undefined>}\n */\n handleHttpError: function handleHttpError(reason) {\n var _this5 = this;\n if (reason instanceof _webexHttpError.default) {\n if ((0, _lodash.has)(reason, 'options.body.map')) {\n return _promise.default.all(reason.options.body.map(function (item) {\n return _this5.getDeferredForRequest(item).then(function (defer) {\n defer.reject(reason);\n });\n }));\n }\n }\n this.logger.error('http error handler called without a WebexHttpError object', reason);\n return _promise.default.reject(reason);\n },\n /**\n * Determines if the item succeeded or failed and delegates accordingly\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n acceptItem: function acceptItem(item) {\n var _this6 = this;\n return this.didItemFail(item).then(function (didFail) {\n if (didFail) {\n return _this6.handleItemFailure(item);\n }\n return _this6.handleItemSuccess(item);\n });\n },\n /**\n * Indicates if the specified response item implies a success or a failure\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<Boolean>}\n */\n // eslint-disable-next-line no-unused-vars\n didItemFail: function didItemFail(item) {\n return _promise.default.resolve(false);\n },\n /**\n * Finds the Defer for the specified item and rejects its promise\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemFailure: function handleItemFailure(item) {\n return this.getDeferredForResponse(item).then(function (defer) {\n defer.reject(item);\n });\n },\n /**\n * Finds the Defer for the specified item and resolves its promise\n * Intended to be overridden\n * @param {Object} item\n * @returns {Promise<undefined>}\n */\n handleItemSuccess: function handleItemSuccess(item) {\n return this.getDeferredForResponse(item).then(function (defer) {\n defer.resolve(item);\n });\n },\n /**\n * Returns the Deferred for the specified request item\n * @param {Object} item\n * @returns {Promise<Defer>}\n */\n getDeferredForRequest: function getDeferredForRequest(item) {\n var _this7 = this;\n return this.fingerprintRequest(item).then(function (idx) {\n var defer = _this7.deferreds.get(idx);\n\n /* istanbul ignore if */\n if (!defer) {\n throw new Error('Could not find pending request for received response');\n }\n return defer;\n });\n },\n /**\n * Returns the Deferred for the specified response item\n * @param {Object} item\n * @returns {Promise<Defer>}\n */\n getDeferredForResponse: function getDeferredForResponse(item) {\n var _this8 = this;\n return this.fingerprintResponse(item).then(function (idx) {\n var defer = _this8.deferreds.get(idx);\n\n /* istanbul ignore if */\n if (!defer) {\n throw new Error('Could not find pending request for received response');\n }\n return defer;\n });\n },\n /**\n * Generates a unique identifier for the item in a request payload\n * Intended to be overridden\n * Note that overrides must return a primitive.\n * @param {Object} item\n * @returns {Promise<primitive>}\n */\n // eslint-disable-next-line no-unused-vars\n fingerprintRequest: function fingerprintRequest(item) {\n throw new Error('fingerprintRequest() must be implemented');\n },\n /**\n * Generates a unique identifier for the item in a response payload\n * Intended to be overridden\n * Note that overrides must return a primitive.\n * @param {Object} item\n * @returns {Promise<primitive>}\n */\n // eslint-disable-next-line no-unused-vars\n fingerprintResponse: function fingerprintResponse(item) {\n throw new Error('fingerprintResponse() must be implemented');\n },\n version: \"3.8.0-next.11\"\n});\nvar _default2 = exports[\"default\"] = Batcher;\n//# sourceMappingURL=batcher.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/batcher.js?");
4242
4242
 
4243
4243
  /***/ }),
4244
4244
 
@@ -4260,7 +4260,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
4260
4260
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4261
4261
 
4262
4262
  "use strict";
4263
- eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\");\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"../../../node_modules/querystring-es3/index.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _jsonwebtoken = _interopRequireDefault(__webpack_require__(/*! jsonwebtoken */ \"../../../node_modules/jsonwebtoken/index.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _decorators = __webpack_require__(/*! ../storage/decorators */ \"../../../node_modules/@webex/webex-core/dist/lib/storage/decorators.js\");\nvar _grantErrors = _interopRequireWildcard(__webpack_require__(/*! ./grant-errors */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/grant-errors.js\"));\nvar _scope = __webpack_require__(/*! ./scope */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/scope.js\");\nvar _token = _interopRequireDefault(__webpack_require__(/*! ./token */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/token.js\"));\nvar _tokenCollection = _interopRequireDefault(__webpack_require__(/*! ./token-collection */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/token-collection.js\"));\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/webex-core/dist/lib/constants.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor2; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor2(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * @class\n */\nvar Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({\n keyFactory: function keyFactory(scope) {\n return scope;\n }\n}), _dec2 = (0, _decorators.waitForValue)('@'), _dec3 = (0, _decorators.persist)('@'), _dec4 = (0, _decorators.waitForValue)('@'), _dec5 = (0, _common.whileInFlight)('isRefreshing'), _dec6 = (0, _decorators.waitForValue)('@'), (_obj = {\n collections: {\n userTokens: _tokenCollection.default\n },\n dataTypes: {\n token: (0, _common.makeStateDataType)(_token.default, 'token').dataType\n },\n derived: {\n canAuthorize: {\n deps: ['supertoken', 'supertoken.canAuthorize', 'canRefresh'],\n fn: function fn() {\n return Boolean(this.supertoken && this.supertoken.canAuthorize || this.canRefresh);\n }\n },\n canRefresh: {\n deps: ['supertoken', 'supertoken.canRefresh'],\n fn: function fn() {\n // If we're operating in JWT mode, we have to delegate to the consumer\n if (this.config.jwtRefreshCallback) {\n return true;\n }\n return Boolean(this.supertoken && this.supertoken.canRefresh);\n }\n },\n isUnverifiedGuest: {\n deps: ['supertoken'],\n /**\n * Returns true if the user is an unverified guest\n * @returns {boolean}\n */\n fn: function fn() {\n var isGuest = false;\n try {\n isGuest = JSON.parse(_common.base64.decode(this.supertoken.access_token.split('.')[1])).user_type === 'guest';\n } catch (_unused) {\n /* the non-guest token is formatted differently so catch is expected */\n }\n return isGuest;\n }\n }\n },\n props: {\n supertoken: (0, _common.makeStateDataType)(_token.default, 'token').prop\n },\n namespace: 'Credentials',\n session: {\n isRefreshing: {\n default: false,\n type: 'boolean'\n },\n /**\n * Becomes `true` once the {@link loaded} event fires.\n * @see {@link WebexPlugin#ready}\n * @instance\n * @memberof Credentials\n * @type {boolean}\n */\n ready: {\n default: false,\n type: 'boolean'\n },\n refreshTimer: {\n default: undefined,\n type: 'any'\n }\n },\n /**\n * Generates an OAuth Login URL. Prefers the api.ciscospark.com proxy if the\n * instance is initialize with an authorizatUrl, but fallsback to idbroker\n * as the base otherwise.\n * @instance\n * @memberof Credentials\n * @param {Object} [options={}]\n * @returns {string}\n */\n buildLoginUrl: function buildLoginUrl() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {\n clientType: 'public'\n };\n /* eslint-disable camelcase */\n if (options.state && !(0, _lodash.isObject)(options.state)) {\n throw new Error('if specified, `options.state` must be an object');\n }\n options.client_id = this.config.client_id;\n options.redirect_uri = this.config.redirect_uri;\n options.scope = this.config.scope;\n options = (0, _lodash.cloneDeep)(options);\n if (!options.response_type) {\n options.response_type = options.clientType === 'public' ? 'token' : 'code';\n }\n (0, _deleteProperty.default)(options, 'clientType');\n if (options.state) {\n if (!(0, _lodash.isEmpty)(options.state)) {\n options.state = _common.base64.toBase64Url((0, _stringify.default)(options.state));\n } else {\n delete options.state;\n }\n }\n return \"\".concat(this.config.authorizeUrl, \"?\").concat(_querystring.default.stringify(options));\n /* eslint-enable camelcase */\n },\n /**\n * Get the determined OrgId.\n *\n * @throws {Error} - If the OrgId could not be determined.\n * @returns {string} - The OrgId.\n */\n getOrgId: function getOrgId() {\n this.logger.info('credentials: attempting to retrieve the OrgId from token');\n try {\n // Attempt to extract a client-authenticated token's OrgId.\n this.logger.info('credentials: trying to extract OrgId from JWT');\n return this.extractOrgIdFromJWT(this.supertoken.access_token);\n } catch (e) {\n // Attempt to extract a user token's OrgId.\n this.logger.info('credentials: could not extract OrgId from JWT');\n this.logger.info('credentials: attempting to extract OrgId from user token');\n try {\n var _this$supertoken;\n return this.extractOrgIdFromUserToken((_this$supertoken = this.supertoken) === null || _this$supertoken === void 0 ? void 0 : _this$supertoken.access_token);\n } catch (f) {\n this.logger.info('credentials: could not extract OrgId from user token');\n throw f;\n }\n }\n },\n /**\n * Extract the OrgId [realm] from a provided JWT.\n *\n * @private\n * @param {string} token - The JWT to extract the OrgId from.\n * @throws {Error} - If the token does not pass JWT general/realm validation.\n * @returns {string} - The OrgId.\n */\n extractOrgIdFromJWT: function extractOrgIdFromJWT() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n // Decoded the provided token.\n var decodedJWT = _jsonwebtoken.default.decode(token);\n\n // Validate that the provided token is a JWT.\n if (!decodedJWT) {\n throw new Error('unable to extract the OrgId from the provided JWT');\n }\n if (!decodedJWT.realm) {\n throw new Error('the provided JWT does not contain an OrgId');\n }\n\n // Return the OrgId [realm].\n return decodedJWT.realm;\n },\n /**\n * Extract the OrgId [realm] from a provided user token.\n *\n * @private\n * @param {string} token - The user token to extract the OrgId from.\n * @throws {Error} - Will throw an error if the provided token is invalid.\n * @returns {string} - The OrgId.\n */\n extractOrgIdFromUserToken: function extractOrgIdFromUserToken() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n // Split the provided token into subsections.\n var fields = token.split('_');\n\n // Validate that the provided token has the proper amount of sections.\n if (fields.length !== 3) {\n throw new Error(\"the provided token is not a valid format, token has \".concat(fields.length, \" sections\"));\n }\n\n // Return the token section that contains the OrgId.\n return fields[2];\n },\n /**\n * Generates a Logout URL\n * @instance\n * @memberof Credentials\n * @param {Object} [options={}]\n * @returns {[type]}\n */\n buildLogoutUrl: function buildLogoutUrl() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return \"\".concat(this.config.logoutUrl, \"?\").concat(_querystring.default.stringify(_objectSpread({\n cisService: this.config.service,\n goto: this.config.redirect_uri\n }, options)));\n },\n /**\n * Generates a number between 60% - 90% of expired value\n * @instance\n * @memberof Credentials\n * @param {number} expiration\n * @private\n * @returns {number}\n */\n calcRefreshTimeout: function calcRefreshTimeout(expiration) {\n return Math.floor((Math.floor(Math.random() * 4) + 6) / 10 * expiration);\n },\n constructor: function constructor() {\n var _this = this;\n // HACK to deal with the fact that AmpersandState#dataTypes#set is a pure\n // function.\n this._dataTypes = (0, _lodash.cloneDeep)(this._dataTypes);\n (0, _keys.default)(this._dataTypes).forEach(function (key) {\n if (_this._dataTypes[key].set) {\n _this._dataTypes[key].set = _this._dataTypes[key].set.bind(_this);\n }\n });\n // END HACK\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexPlugin.default, this, args);\n },\n /**\n * Downscopes a token\n * @instance\n * @memberof Credentials\n * @param {string} scope\n * @private\n * @returns {Promise<Token>}\n */\n downscope: function downscope(scope) {\n var _this2 = this;\n return this.supertoken.downscope(scope).catch(function (reason) {\n var _reason$body;\n var failReason = (_reason$body = reason === null || reason === void 0 ? void 0 : reason.body) !== null && _reason$body !== void 0 ? _reason$body : reason;\n _this2.logger.warn(\"credentials: failed to downscope supertoken to \\\"\".concat(scope, \"\\\"\"), failReason);\n _this2.logger.trace(\"credentials: falling back to supertoken for \".concat(scope));\n _this2.webex.internal.metrics.submitClientMetrics(_constants.METRICS.JS_SDK_CREDENTIALS_DOWNSCOPE_FAILED, {\n fields: {\n requestedScope: scope,\n failReason: failReason\n }\n });\n return _promise.default.resolve(new _token.default(_objectSpread({\n scope: scope\n }, _this2.supertoken.serialize())), {\n parent: _this2\n });\n });\n },\n /**\n * Requests a client credentials grant and returns the token. Given the\n * limited use for such tokens as this time, this method does not cache its\n * token.\n * @instance\n * @memberof Credentials\n * @param {Object} options\n * @returns {Promise<Token>}\n */\n getClientToken: function getClientToken() {\n var _this3 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('credentials: requesting client credentials grant');\n return this.webex.request({\n /* eslint-disable camelcase */\n method: 'POST',\n uri: options.uri || this.config.tokenUrl,\n form: {\n grant_type: 'client_credentials',\n scope: options.scope || 'webexsquare:admin',\n self_contained_token: true\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n /* eslint-enable camelcase */\n }).then(function (res) {\n return new _token.default(res.body, {\n parent: _this3\n });\n }).catch(function (res) {\n if (res.statusCode !== 400) {\n return _promise.default.reject(res);\n }\n var ErrorConstructor = _grantErrors.default.select(res.body.error);\n return _promise.default.reject(new ErrorConstructor(res._res || res));\n });\n },\n /**\n * Resolves with a token with the specified scopes. If no scope is specified,\n * defaults to omit(webex.credentials.scope, 'spark:kms'). If no such token is\n * available, downscopes the supertoken to that scope.\n * @instance\n * @memberof Credentials\n * @param {string} scope\n * @returns {Promise<Token>}\n */\n getUserToken: function getUserToken(scope) {\n var _this4 = this;\n return _promise.default.resolve(!this.isRefreshing || new _promise.default(function (resolve) {\n _this4.logger.info('credentials: token refresh inflight; delaying getUserToken until refresh completes');\n _this4.once('change:isRefreshing', function () {\n _this4.logger.info('credentials: token refresh complete; reinvoking getUserToken');\n resolve();\n });\n })).then(function () {\n if (!_this4.canAuthorize) {\n _this4.logger.info('credentials: cannot produce an access token from current state');\n return _promise.default.reject(new Error('Current state cannot produce an access token'));\n }\n if (!scope) {\n scope = (0, _scope.filterScope)('spark:kms', _this4.supertoken.scope);\n }\n scope = (0, _scope.sortScope)(scope);\n if (scope === (0, _scope.sortScope)(_this4.supertoken.scope)) {\n return _promise.default.resolve(_this4.supertoken);\n }\n var token = _this4.userTokens.get(scope);\n\n // we should also check for the token.access_token since token object does\n // not get cleared on unsetting while logging out.\n if (!token || !token.access_token) {\n return _this4.downscope(scope).then((0, _common.tap)(function (t) {\n return _this4.userTokens.add(t);\n }));\n }\n return _promise.default.resolve(token);\n });\n },\n /**\n * Initializer\n * @instance\n * @memberof Credentials\n * @param {Object} attrs\n * @param {Object} options\n * @private\n * @returns {Credentials}\n */\n initialize: function initialize(attrs, options) {\n var _this5 = this;\n if (attrs) {\n if (typeof attrs === 'string') {\n this.supertoken = attrs;\n }\n if (attrs.access_token) {\n this.supertoken = attrs;\n }\n if (attrs.authorization) {\n if (attrs.authorization.supertoken) {\n this.supertoken = attrs.authorization.supertoken;\n } else {\n this.supertoken = attrs.authorization;\n }\n }\n\n // schedule refresh\n if (this.supertoken && this.supertoken.expires) {\n this.scheduleRefresh(this.supertoken.expires);\n }\n }\n (0, _apply.default)(_webexPlugin.default.prototype.initialize, this, [attrs, options]);\n this.listenToOnce(this.parent, 'change:config', function () {\n if (_this5.config.authorizationString) {\n var parsed = _url.default.parse(_this5.config.authorizationString, true);\n\n /* eslint-disable camelcase */\n _this5.config.client_id = parsed.query.client_id;\n _this5.config.redirect_uri = parsed.query.redirect_uri;\n _this5.config.scope = parsed.query.scope;\n _this5.config.authorizeUrl = parsed.href.substr(0, parsed.href.indexOf('?'));\n /* eslint-enable camelcase */\n }\n });\n\n this.webex.once('loaded', function () {\n _this5.ready = true;\n });\n },\n /**\n * Clears all tokens from store them from the stores.\n *\n * This is no longer quite the right name for this method, but all of the\n * alternatives I'm coming up with are already taken.\n * @instance\n * @memberof Credentials\n * @returns {Promise}\n */\n invalidate: function invalidate() {\n this.logger.info('credentials: invalidating tokens');\n\n // clear refresh timer\n if (this.refreshTimer) {\n clearTimeout(this.refreshTimer);\n this.unset('refreshTimer');\n }\n try {\n this.unset('supertoken');\n } catch (err) {\n this.logger.warn('credentials: failed to clear supertoken', err);\n }\n while (this.userTokens.models.length) {\n try {\n this.userTokens.remove(this.userTokens.models[0]);\n } catch (err) {\n this.logger.warn('credentials: failed to remove user token', err);\n }\n }\n this.logger.info('credentials: finished removing tokens');\n\n // Return a promise to give the storage layer a tick or two to clear\n // localStorage\n return _promise.default.resolve();\n },\n /**\n * Removes the supertoken and child tokens, then refreshes the supertoken;\n * subsequent calls to {@link Credentials#getUserToken()} will re-downscope\n * child tokens. Enqueus revocation of previous previousTokens. Yes, that's\n * the correct number of \"previous\"es.\n * @instance\n * @memberof Credentials\n * @returns {Promise}\n */\n refresh: function refresh() {\n var _this6 = this;\n this.logger.info('credentials: refresh requested');\n var supertoken = this.supertoken;\n var tokens = (0, _lodash.clone)(this.userTokens.models);\n\n // This is kind of a leaky abstraction, since it relies on the authorization\n // plugin, but the only alternatives I see are\n // 1. put all JWT support in core\n // 2. have separate jwt and non-jwt auth plugins\n // while I like #2 from a code simplicity standpoint, the third-party DX\n // isn't great\n if (this.config.jwtRefreshCallback) {\n return this.config.jwtRefreshCallback(this.webex)\n // eslint-disable-next-line no-shadow\n .then(function (jwt) {\n return _this6.webex.authorization.requestAccessTokenFromJwt({\n jwt: jwt\n });\n });\n }\n if (this.webex.internal.services) {\n this.webex.internal.services.updateCredentialsConfig();\n }\n return supertoken.refresh().catch(function (error) {\n if (error instanceof _grantErrors.OAuthError) {\n // Error: super token refresh failed with 400 status code.\n // Hence emit an event to the client, an opportunity to logout.\n _this6.unset('supertoken');\n while (_this6.userTokens.models.length) {\n try {\n _this6.userTokens.remove(_this6.userTokens.models[0]);\n } catch (err) {\n _this6.logger.warn('credentials: failed to remove user token', err);\n }\n }\n _this6.webex.trigger('client:InvalidRequestError');\n }\n return _promise.default.reject(error);\n }).then(function (st) {\n // clear refresh timer\n if (_this6.refreshTimer) {\n clearTimeout(_this6.refreshTimer);\n _this6.unset('refreshTimer');\n }\n _this6.supertoken = st;\n var invalidScopes = (0, _scope.diffScopes)(_this6.config.scope, st.scope);\n if (invalidScopes !== '') {\n _this6.logger.warn(\"credentials: \\\"\".concat(invalidScopes, \"\\\" scope(s) are invalid because not listed in the supertoken, they will be excluded from user token requests.\"));\n _this6.webex.internal.metrics.submitClientMetrics(_constants.METRICS.JS_SDK_CREDENTIALS_TOKEN_REFRESH_SCOPE_MISMATCH, {\n fields: {\n invalidScopes: invalidScopes\n }\n });\n }\n return _promise.default.all(tokens.map(function (token) {\n var tokenScope = (0, _scope.filterScope)((0, _scope.diffScopes)(token.scope, st.scope), token.scope);\n return _this6.downscope(tokenScope)\n // eslint-disable-next-line max-nested-callbacks\n .then(function (t) {\n _this6.logger.info(\"credentials: revoking token for \".concat(token.scope));\n return token.revoke().catch(function (err) {\n _this6.logger.warn('credentials: failed to revoke user token', err);\n }).then(function () {\n _this6.userTokens.remove(token.scope);\n _this6.userTokens.add(t);\n });\n });\n }));\n }).then(function () {\n _this6.scheduleRefresh(_this6.supertoken.expires);\n });\n },\n /**\n * Schedules a token refresh or refreshes the token if token has expired\n * @instance\n * @memberof Credentials\n * @param {number} expires\n * @private\n * @returns {undefined}\n */\n scheduleRefresh: function scheduleRefresh(expires) {\n var _this7 = this;\n var expiresIn = expires - (0, _now.default)();\n if (expiresIn > 0) {\n var timeoutLength = this.calcRefreshTimeout(expiresIn);\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this7.refresh();\n }, timeoutLength);\n } else {\n this.refresh();\n }\n },\n version: \"3.8.0-next.10\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"getUserToken\", [_dec, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"getUserToken\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"invalidate\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"invalidate\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec5, _dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Credentials;\n//# sourceMappingURL=credentials.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/credentials/credentials.js?");
4263
+ eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\");\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"../../../node_modules/querystring-es3/index.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _jsonwebtoken = _interopRequireDefault(__webpack_require__(/*! jsonwebtoken */ \"../../../node_modules/jsonwebtoken/index.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _decorators = __webpack_require__(/*! ../storage/decorators */ \"../../../node_modules/@webex/webex-core/dist/lib/storage/decorators.js\");\nvar _grantErrors = _interopRequireWildcard(__webpack_require__(/*! ./grant-errors */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/grant-errors.js\"));\nvar _scope = __webpack_require__(/*! ./scope */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/scope.js\");\nvar _token = _interopRequireDefault(__webpack_require__(/*! ./token */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/token.js\"));\nvar _tokenCollection = _interopRequireDefault(__webpack_require__(/*! ./token-collection */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/token-collection.js\"));\nvar _constants = __webpack_require__(/*! ../constants */ \"../../../node_modules/@webex/webex-core/dist/lib/constants.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor2; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor2(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * @class\n */\nvar Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({\n keyFactory: function keyFactory(scope) {\n return scope;\n }\n}), _dec2 = (0, _decorators.waitForValue)('@'), _dec3 = (0, _decorators.persist)('@'), _dec4 = (0, _decorators.waitForValue)('@'), _dec5 = (0, _common.whileInFlight)('isRefreshing'), _dec6 = (0, _decorators.waitForValue)('@'), (_obj = {\n collections: {\n userTokens: _tokenCollection.default\n },\n dataTypes: {\n token: (0, _common.makeStateDataType)(_token.default, 'token').dataType\n },\n derived: {\n canAuthorize: {\n deps: ['supertoken', 'supertoken.canAuthorize', 'canRefresh'],\n fn: function fn() {\n return Boolean(this.supertoken && this.supertoken.canAuthorize || this.canRefresh);\n }\n },\n canRefresh: {\n deps: ['supertoken', 'supertoken.canRefresh'],\n fn: function fn() {\n // If we're operating in JWT mode, we have to delegate to the consumer\n if (this.config.jwtRefreshCallback) {\n return true;\n }\n return Boolean(this.supertoken && this.supertoken.canRefresh);\n }\n },\n isUnverifiedGuest: {\n deps: ['supertoken'],\n /**\n * Returns true if the user is an unverified guest\n * @returns {boolean}\n */\n fn: function fn() {\n var isGuest = false;\n try {\n isGuest = JSON.parse(_common.base64.decode(this.supertoken.access_token.split('.')[1])).user_type === 'guest';\n } catch (_unused) {\n /* the non-guest token is formatted differently so catch is expected */\n }\n return isGuest;\n }\n }\n },\n props: {\n supertoken: (0, _common.makeStateDataType)(_token.default, 'token').prop\n },\n namespace: 'Credentials',\n session: {\n isRefreshing: {\n default: false,\n type: 'boolean'\n },\n /**\n * Becomes `true` once the {@link loaded} event fires.\n * @see {@link WebexPlugin#ready}\n * @instance\n * @memberof Credentials\n * @type {boolean}\n */\n ready: {\n default: false,\n type: 'boolean'\n },\n refreshTimer: {\n default: undefined,\n type: 'any'\n }\n },\n /**\n * Generates an OAuth Login URL. Prefers the api.ciscospark.com proxy if the\n * instance is initialize with an authorizatUrl, but fallsback to idbroker\n * as the base otherwise.\n * @instance\n * @memberof Credentials\n * @param {Object} [options={}]\n * @returns {string}\n */\n buildLoginUrl: function buildLoginUrl() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {\n clientType: 'public'\n };\n /* eslint-disable camelcase */\n if (options.state && !(0, _lodash.isObject)(options.state)) {\n throw new Error('if specified, `options.state` must be an object');\n }\n options.client_id = this.config.client_id;\n options.redirect_uri = this.config.redirect_uri;\n options.scope = this.config.scope;\n options = (0, _lodash.cloneDeep)(options);\n if (!options.response_type) {\n options.response_type = options.clientType === 'public' ? 'token' : 'code';\n }\n (0, _deleteProperty.default)(options, 'clientType');\n if (options.state) {\n if (!(0, _lodash.isEmpty)(options.state)) {\n options.state = _common.base64.toBase64Url((0, _stringify.default)(options.state));\n } else {\n delete options.state;\n }\n }\n return \"\".concat(this.config.authorizeUrl, \"?\").concat(_querystring.default.stringify(options));\n /* eslint-enable camelcase */\n },\n /**\n * Get the determined OrgId.\n *\n * @throws {Error} - If the OrgId could not be determined.\n * @returns {string} - The OrgId.\n */\n getOrgId: function getOrgId() {\n this.logger.info('credentials: attempting to retrieve the OrgId from token');\n try {\n // Attempt to extract a client-authenticated token's OrgId.\n this.logger.info('credentials: trying to extract OrgId from JWT');\n return this.extractOrgIdFromJWT(this.supertoken.access_token);\n } catch (e) {\n // Attempt to extract a user token's OrgId.\n this.logger.info('credentials: could not extract OrgId from JWT');\n this.logger.info('credentials: attempting to extract OrgId from user token');\n try {\n var _this$supertoken;\n return this.extractOrgIdFromUserToken((_this$supertoken = this.supertoken) === null || _this$supertoken === void 0 ? void 0 : _this$supertoken.access_token);\n } catch (f) {\n this.logger.info('credentials: could not extract OrgId from user token');\n throw f;\n }\n }\n },\n /**\n * Extract the OrgId [realm] from a provided JWT.\n *\n * @private\n * @param {string} token - The JWT to extract the OrgId from.\n * @throws {Error} - If the token does not pass JWT general/realm validation.\n * @returns {string} - The OrgId.\n */\n extractOrgIdFromJWT: function extractOrgIdFromJWT() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n // Decoded the provided token.\n var decodedJWT = _jsonwebtoken.default.decode(token);\n\n // Validate that the provided token is a JWT.\n if (!decodedJWT) {\n throw new Error('unable to extract the OrgId from the provided JWT');\n }\n if (!decodedJWT.realm) {\n throw new Error('the provided JWT does not contain an OrgId');\n }\n\n // Return the OrgId [realm].\n return decodedJWT.realm;\n },\n /**\n * Extract the OrgId [realm] from a provided user token.\n *\n * @private\n * @param {string} token - The user token to extract the OrgId from.\n * @throws {Error} - Will throw an error if the provided token is invalid.\n * @returns {string} - The OrgId.\n */\n extractOrgIdFromUserToken: function extractOrgIdFromUserToken() {\n var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n // Split the provided token into subsections.\n var fields = token.split('_');\n\n // Validate that the provided token has the proper amount of sections.\n if (fields.length !== 3) {\n throw new Error(\"the provided token is not a valid format, token has \".concat(fields.length, \" sections\"));\n }\n\n // Return the token section that contains the OrgId.\n return fields[2];\n },\n /**\n * Generates a Logout URL\n * @instance\n * @memberof Credentials\n * @param {Object} [options={}]\n * @returns {[type]}\n */\n buildLogoutUrl: function buildLogoutUrl() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return \"\".concat(this.config.logoutUrl, \"?\").concat(_querystring.default.stringify(_objectSpread({\n cisService: this.config.service,\n goto: this.config.redirect_uri\n }, options)));\n },\n /**\n * Generates a number between 60% - 90% of expired value\n * @instance\n * @memberof Credentials\n * @param {number} expiration\n * @private\n * @returns {number}\n */\n calcRefreshTimeout: function calcRefreshTimeout(expiration) {\n return Math.floor((Math.floor(Math.random() * 4) + 6) / 10 * expiration);\n },\n constructor: function constructor() {\n var _this = this;\n // HACK to deal with the fact that AmpersandState#dataTypes#set is a pure\n // function.\n this._dataTypes = (0, _lodash.cloneDeep)(this._dataTypes);\n (0, _keys.default)(this._dataTypes).forEach(function (key) {\n if (_this._dataTypes[key].set) {\n _this._dataTypes[key].set = _this._dataTypes[key].set.bind(_this);\n }\n });\n // END HACK\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexPlugin.default, this, args);\n },\n /**\n * Downscopes a token\n * @instance\n * @memberof Credentials\n * @param {string} scope\n * @private\n * @returns {Promise<Token>}\n */\n downscope: function downscope(scope) {\n var _this2 = this;\n return this.supertoken.downscope(scope).catch(function (reason) {\n var _reason$body;\n var failReason = (_reason$body = reason === null || reason === void 0 ? void 0 : reason.body) !== null && _reason$body !== void 0 ? _reason$body : reason;\n _this2.logger.warn(\"credentials: failed to downscope supertoken to \\\"\".concat(scope, \"\\\"\"), failReason);\n _this2.logger.trace(\"credentials: falling back to supertoken for \".concat(scope));\n _this2.webex.internal.metrics.submitClientMetrics(_constants.METRICS.JS_SDK_CREDENTIALS_DOWNSCOPE_FAILED, {\n fields: {\n requestedScope: scope,\n failReason: failReason\n }\n });\n return _promise.default.resolve(new _token.default(_objectSpread({\n scope: scope\n }, _this2.supertoken.serialize())), {\n parent: _this2\n });\n });\n },\n /**\n * Requests a client credentials grant and returns the token. Given the\n * limited use for such tokens as this time, this method does not cache its\n * token.\n * @instance\n * @memberof Credentials\n * @param {Object} options\n * @returns {Promise<Token>}\n */\n getClientToken: function getClientToken() {\n var _this3 = this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('credentials: requesting client credentials grant');\n return this.webex.request({\n /* eslint-disable camelcase */\n method: 'POST',\n uri: options.uri || this.config.tokenUrl,\n form: {\n grant_type: 'client_credentials',\n scope: options.scope || 'webexsquare:admin',\n self_contained_token: true\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n /* eslint-enable camelcase */\n }).then(function (res) {\n return new _token.default(res.body, {\n parent: _this3\n });\n }).catch(function (res) {\n if (res.statusCode !== 400) {\n return _promise.default.reject(res);\n }\n var ErrorConstructor = _grantErrors.default.select(res.body.error);\n return _promise.default.reject(new ErrorConstructor(res._res || res));\n });\n },\n /**\n * Resolves with a token with the specified scopes. If no scope is specified,\n * defaults to omit(webex.credentials.scope, 'spark:kms'). If no such token is\n * available, downscopes the supertoken to that scope.\n * @instance\n * @memberof Credentials\n * @param {string} scope\n * @returns {Promise<Token>}\n */\n getUserToken: function getUserToken(scope) {\n var _this4 = this;\n return _promise.default.resolve(!this.isRefreshing || new _promise.default(function (resolve) {\n _this4.logger.info('credentials: token refresh inflight; delaying getUserToken until refresh completes');\n _this4.once('change:isRefreshing', function () {\n _this4.logger.info('credentials: token refresh complete; reinvoking getUserToken');\n resolve();\n });\n })).then(function () {\n if (!_this4.canAuthorize) {\n _this4.logger.info('credentials: cannot produce an access token from current state');\n return _promise.default.reject(new Error('Current state cannot produce an access token'));\n }\n if (!scope) {\n scope = (0, _scope.filterScope)('spark:kms', _this4.supertoken.scope);\n }\n scope = (0, _scope.sortScope)(scope);\n if (scope === (0, _scope.sortScope)(_this4.supertoken.scope)) {\n return _promise.default.resolve(_this4.supertoken);\n }\n var token = _this4.userTokens.get(scope);\n\n // we should also check for the token.access_token since token object does\n // not get cleared on unsetting while logging out.\n if (!token || !token.access_token) {\n return _this4.downscope(scope).then((0, _common.tap)(function (t) {\n return _this4.userTokens.add(t);\n }));\n }\n return _promise.default.resolve(token);\n });\n },\n /**\n * Initializer\n * @instance\n * @memberof Credentials\n * @param {Object} attrs\n * @param {Object} options\n * @private\n * @returns {Credentials}\n */\n initialize: function initialize(attrs, options) {\n var _this5 = this;\n if (attrs) {\n if (typeof attrs === 'string') {\n this.supertoken = attrs;\n }\n if (attrs.access_token) {\n this.supertoken = attrs;\n }\n if (attrs.authorization) {\n if (attrs.authorization.supertoken) {\n this.supertoken = attrs.authorization.supertoken;\n } else {\n this.supertoken = attrs.authorization;\n }\n }\n\n // schedule refresh\n if (this.supertoken && this.supertoken.expires) {\n this.scheduleRefresh(this.supertoken.expires);\n }\n }\n (0, _apply.default)(_webexPlugin.default.prototype.initialize, this, [attrs, options]);\n this.listenToOnce(this.parent, 'change:config', function () {\n if (_this5.config.authorizationString) {\n var parsed = _url.default.parse(_this5.config.authorizationString, true);\n\n /* eslint-disable camelcase */\n _this5.config.client_id = parsed.query.client_id;\n _this5.config.redirect_uri = parsed.query.redirect_uri;\n _this5.config.scope = parsed.query.scope;\n _this5.config.authorizeUrl = parsed.href.substr(0, parsed.href.indexOf('?'));\n /* eslint-enable camelcase */\n }\n });\n\n this.webex.once('loaded', function () {\n _this5.ready = true;\n });\n },\n /**\n * Clears all tokens from store them from the stores.\n *\n * This is no longer quite the right name for this method, but all of the\n * alternatives I'm coming up with are already taken.\n * @instance\n * @memberof Credentials\n * @returns {Promise}\n */\n invalidate: function invalidate() {\n this.logger.info('credentials: invalidating tokens');\n\n // clear refresh timer\n if (this.refreshTimer) {\n clearTimeout(this.refreshTimer);\n this.unset('refreshTimer');\n }\n try {\n this.unset('supertoken');\n } catch (err) {\n this.logger.warn('credentials: failed to clear supertoken', err);\n }\n while (this.userTokens.models.length) {\n try {\n this.userTokens.remove(this.userTokens.models[0]);\n } catch (err) {\n this.logger.warn('credentials: failed to remove user token', err);\n }\n }\n this.logger.info('credentials: finished removing tokens');\n\n // Return a promise to give the storage layer a tick or two to clear\n // localStorage\n return _promise.default.resolve();\n },\n /**\n * Removes the supertoken and child tokens, then refreshes the supertoken;\n * subsequent calls to {@link Credentials#getUserToken()} will re-downscope\n * child tokens. Enqueus revocation of previous previousTokens. Yes, that's\n * the correct number of \"previous\"es.\n * @instance\n * @memberof Credentials\n * @returns {Promise}\n */\n refresh: function refresh() {\n var _this6 = this;\n this.logger.info('credentials: refresh requested');\n var supertoken = this.supertoken;\n var tokens = (0, _lodash.clone)(this.userTokens.models);\n\n // This is kind of a leaky abstraction, since it relies on the authorization\n // plugin, but the only alternatives I see are\n // 1. put all JWT support in core\n // 2. have separate jwt and non-jwt auth plugins\n // while I like #2 from a code simplicity standpoint, the third-party DX\n // isn't great\n if (this.config.jwtRefreshCallback) {\n return this.config.jwtRefreshCallback(this.webex)\n // eslint-disable-next-line no-shadow\n .then(function (jwt) {\n return _this6.webex.authorization.requestAccessTokenFromJwt({\n jwt: jwt\n });\n });\n }\n if (this.webex.internal.services) {\n this.webex.internal.services.updateCredentialsConfig();\n }\n return supertoken.refresh().catch(function (error) {\n if (error instanceof _grantErrors.OAuthError) {\n // Error: super token refresh failed with 400 status code.\n // Hence emit an event to the client, an opportunity to logout.\n _this6.unset('supertoken');\n while (_this6.userTokens.models.length) {\n try {\n _this6.userTokens.remove(_this6.userTokens.models[0]);\n } catch (err) {\n _this6.logger.warn('credentials: failed to remove user token', err);\n }\n }\n _this6.webex.trigger('client:InvalidRequestError');\n }\n return _promise.default.reject(error);\n }).then(function (st) {\n // clear refresh timer\n if (_this6.refreshTimer) {\n clearTimeout(_this6.refreshTimer);\n _this6.unset('refreshTimer');\n }\n _this6.supertoken = st;\n var invalidScopes = (0, _scope.diffScopes)(_this6.config.scope, st.scope);\n if (invalidScopes !== '') {\n _this6.logger.warn(\"credentials: \\\"\".concat(invalidScopes, \"\\\" scope(s) are invalid because not listed in the supertoken, they will be excluded from user token requests.\"));\n _this6.webex.internal.metrics.submitClientMetrics(_constants.METRICS.JS_SDK_CREDENTIALS_TOKEN_REFRESH_SCOPE_MISMATCH, {\n fields: {\n invalidScopes: invalidScopes\n }\n });\n }\n return _promise.default.all(tokens.map(function (token) {\n var tokenScope = (0, _scope.filterScope)((0, _scope.diffScopes)(token.scope, st.scope), token.scope);\n return _this6.downscope(tokenScope)\n // eslint-disable-next-line max-nested-callbacks\n .then(function (t) {\n _this6.logger.info(\"credentials: revoking token for \".concat(token.scope));\n return token.revoke().catch(function (err) {\n _this6.logger.warn('credentials: failed to revoke user token', err);\n }).then(function () {\n _this6.userTokens.remove(token.scope);\n _this6.userTokens.add(t);\n });\n });\n }));\n }).then(function () {\n _this6.scheduleRefresh(_this6.supertoken.expires);\n });\n },\n /**\n * Schedules a token refresh or refreshes the token if token has expired\n * @instance\n * @memberof Credentials\n * @param {number} expires\n * @private\n * @returns {undefined}\n */\n scheduleRefresh: function scheduleRefresh(expires) {\n var _this7 = this;\n var expiresIn = expires - (0, _now.default)();\n if (expiresIn > 0) {\n var timeoutLength = this.calcRefreshTimeout(expiresIn);\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this7.refresh();\n }, timeoutLength);\n } else {\n this.refresh();\n }\n },\n version: \"3.8.0-next.11\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"getUserToken\", [_dec, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"getUserToken\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"invalidate\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"invalidate\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec5, _dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Credentials;\n//# sourceMappingURL=credentials.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/credentials/credentials.js?");
4264
4264
 
4265
4265
  /***/ }),
4266
4266
 
@@ -4315,7 +4315,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
4315
4315
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4316
4316
 
4317
4317
  "use strict";
4318
- eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\");\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common-timers/dist/index.js\");\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ../webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _scope = __webpack_require__(/*! ./scope */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/scope.js\");\nvar _grantErrors = _interopRequireWildcard(__webpack_require__(/*! ./grant-errors */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/grant-errors.js\"));\nvar _dec, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor2; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor2(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/* eslint-disable camelcase */\n/**\n * Parse response from CI and converts to structured error when appropriate\n * @param {WebexHttpError} res\n * @private\n * @returns {GrantError}\n */\nfunction processGrantError(res) {\n if (res.statusCode !== 400) {\n return _promise.default.reject(res);\n }\n var ErrorConstructor = _grantErrors.default.select(res.body.error);\n if (ErrorConstructor === _grantErrors.OAuthError && res instanceof _webexHttpError.default) {\n return _promise.default.reject(res);\n }\n if (!ErrorConstructor) {\n return _promise.default.reject(res);\n }\n return _promise.default.reject(new ErrorConstructor(res._res || res));\n}\n\n/**\n * @class\n */\nvar Token = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({\n keyFactory: function keyFactory(scope) {\n return scope;\n }\n}), (_obj = {\n derived: {\n /**\n * Indicates if this token can be used in an auth header. `true` iff\n * {@link Token#access_token} is defined and {@link Token#isExpired} is\n * false.\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canAuthorize: {\n deps: ['access_token', 'isExpired'],\n fn: function fn() {\n return !!this.access_token && !this.isExpired;\n }\n },\n /**\n * Indicates that this token can be downscoped. `true` iff\n * {@link config.credentials.client_id} is defined and if\n * {@link Token#canAuthorize} is true\n *\n * Note: since {@link config} is not evented, we can't listen for changes to\n * {@link config.credentials.client_id}. As such,\n * {@link config.credentials.client_id} must always be set before\n * instantiating a {@link Token}\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canDownscope: {\n deps: ['canAuthorize'],\n fn: function fn() {\n return this.canAuthorize && !!this.config.client_id;\n }\n },\n /**\n * Indicates if this token can be refreshed. `true` iff\n * {@link Token@refresh_token} is defined and\n * {@link config.credentials.refreshCallback()} is defined\n *\n * Note: since {@link config} is not evented, we can't listen for changes to\n * {@link config.credentials.refreshCallback()}. As such,\n * {@link config.credentials.refreshCallback()} must always be set before\n * instantiating a {@link Token}\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canRefresh: {\n deps: ['refresh_token'],\n fn: function fn() {\n if (_common.inBrowser) {\n return !!this.refresh_token && !!this.config.refreshCallback;\n }\n return !!this.refresh_token && !!this.config.client_secret;\n }\n },\n /**\n * Indicates if this `Token` is expired. `true` iff {@link Token#expires} is\n * defined and is less than {@link Date.now()}.\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n isExpired: {\n deps: ['expires', '_isExpired'],\n fn: function fn() {\n // in order to avoid setting `cache:false`, we'll use a private property\n // and a timer rather than comparing to `Date.now()`;\n return !!this.expires && this._isExpired;\n }\n },\n /**\n * Cache for toString()\n * @instance\n * @memberof Token\n * @private\n * @readonly\n * @type {string}\n */\n _string: {\n deps: ['access_token', 'token_type'],\n fn: function fn() {\n if (!this.access_token || !this.token_type) {\n return '';\n }\n return \"\".concat(this.token_type, \" \").concat(this.access_token);\n }\n }\n },\n namespace: 'Credentials',\n props: {\n /**\n * Used for indexing in the credentials userTokens collection\n * @instance\n * @memberof Token\n * @private\n * @type {string}\n */\n scope: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {string}\n */\n access_token: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n expires: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n expires_in: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {string}\n */\n refresh_token: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n refresh_token_expires: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n refresh_token_expires_in: 'number',\n /**\n * @default \"Bearer\"\n * @instance\n * @memberof Token\n * @type {string}\n */\n token_type: {\n default: 'Bearer',\n type: 'string'\n }\n },\n session: {\n /**\n * Used by {@link Token#isExpired} to avoid doing a Date comparison.\n * @instance\n * @memberof Token\n * @private\n * @type {boolean}\n */\n _isExpired: {\n default: false,\n type: 'boolean'\n },\n /**\n * Handle to the previous token that we'll revoke when we refresh this\n * token. The idea is to keep allow two valid tokens when a refresh occurs;\n * we don't want revoke a token that's in the middle of being used, so when\n * we do a token refresh, we won't revoke the token being refreshed, but\n * we'll revoke the previous one.\n * @instance\n * @memberof Token\n * @private\n * @type {Object}\n */\n previousToken: {\n type: 'state'\n }\n },\n /**\n * Uses this token to request a new Token with a subset of this Token's scopes\n * @instance\n * @memberof Token\n * @param {string} scope\n * @returns {Promise<Token>}\n */\n downscope: function downscope(scope) {\n var _this = this;\n this.logger.info(\"token: downscoping token to \".concat(scope));\n if (this.isExpired) {\n this.logger.info('token: request received to downscope expired access_token');\n return _promise.default.reject(new Error('cannot downscope expired access token'));\n }\n if (!this.canDownscope) {\n if (this.config.client_id) {\n this.logger.info('token: request received to downscope invalid access_token');\n } else {\n this.logger.trace('token: cannot downscope without client_id');\n }\n return _promise.default.reject(new Error('cannot downscope access token'));\n }\n if ((0, _scope.diffScopes)(scope, this.config.scope) !== '') {\n return _promise.default.reject(new Error(\"new scope (\".concat(scope, \") is not subset of the available scopes (\").concat(this.config.scope, \")\")));\n }\n\n // Since we're going to use scope as the index in our token collection, it's\n // important scopes are always deterministically specified.\n if (scope) {\n scope = (0, _scope.sortScope)(scope);\n }\n\n // Ideally, we could depend on the service to communicate this error, but\n // all we get is \"invalid scope\", which, to the lay person, implies\n // something wrong with *one* of the scopes, not the whole thing.\n if (scope === (0, _scope.sortScope)(this.config.scope)) {\n return _promise.default.reject(new Error('token: scope reduction requires a reduced scope'));\n }\n return this.webex.request({\n method: 'POST',\n uri: this.config.tokenUrl,\n addAuthHeader: false,\n form: {\n grant_type: 'urn:cisco:oauth:grant-type:scope-reduction',\n token: this.access_token,\n scope: scope,\n client_id: this.config.client_id,\n self_contained_token: true\n }\n }).then(function (res) {\n _this.logger.info(\"token: downscoped token to \".concat(scope));\n return new Token((0, _assign.default)(res.body, {\n scope: scope\n }), {\n parent: _this.parent\n });\n });\n },\n /**\n * Initializer\n * @instance\n * @memberof Token\n * @param {Object} [attrs={}]\n * @param {Object} [options={}]\n * @see {@link WebexPlugin#initialize()}\n * @returns {Token}\n */\n initialize: function initialize() {\n var _this2 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n (0, _apply.default)(_webexPlugin.default.prototype.initialize, this, [attrs, options]);\n if (typeof attrs === 'string') {\n this.access_token = attrs;\n }\n if (!this.access_token) {\n throw new Error('`access_token` is required');\n }\n\n // We don't want the derived property `isExpired` to need {cache:false}, so\n // we'll set up a timer the runs when this token should expire.\n if (this.expires) {\n if (this.expires < (0, _now.default)()) {\n this._isExpired = true;\n } else {\n (0, _commonTimers.safeSetTimeout)(function () {\n _this2._isExpired = true;\n }, this.expires - (0, _now.default)());\n }\n }\n },\n /**\n * Refreshes this Token. Relies on\n * {@link config.credentials.refreshCallback()}\n * @instance\n * @memberof Token\n * @returns {Promise<Token>}\n */\n refresh: function refresh() {\n var _this3 = this;\n if (!this.canRefresh) {\n throw new Error('Not enough information available to refresh this access token');\n }\n var promise;\n if (_common.inBrowser) {\n if (!this.config.refreshCallback) {\n throw new Error('Cannot refresh access token without refreshCallback');\n }\n promise = _promise.default.resolve(this.config.refreshCallback(this.webex, this));\n }\n return (promise || this.webex.request({\n method: 'POST',\n uri: this.config.tokenUrl,\n form: {\n grant_type: 'refresh_token',\n redirect_uri: this.config.redirect_uri,\n refresh_token: this.refresh_token\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n }).then(function (res) {\n return res.body;\n })).then(function (obj) {\n if (!obj) {\n throw new Error('token: refreshCallback() did not produce an object');\n }\n // If the authentication server did not send back a refresh token, copy\n // the current refresh token and related values to the response (note:\n // at time of implementation, CI never sends a new refresh token)\n if (!obj.refresh_token) {\n (0, _assign.default)(obj, (0, _lodash.pick)(_this3, 'refresh_token', 'refresh_token_expires', 'refresh_token_expires_in'));\n }\n\n // If the new token is the same as the previous token, then we may have\n // found a bug in CI; log the details and reject the Promise\n if (_this3.access_token === obj.access_token) {\n _this3.logger.error('token: new token matches current token');\n // log the tokens if it is not production\n if (true) {\n _this3.logger.error('token: current token:', _this3.access_token);\n _this3.logger.error('token: new token:', obj.access_token);\n }\n return _promise.default.reject(new Error('new token matches current token'));\n }\n if (_this3.previousToken) {\n _this3.previousToken.revoke();\n _this3.unset('previousToken');\n }\n obj.previousToken = _this3;\n obj.scope = _this3.scope;\n return new Token(obj, {\n parent: _this3.parent\n });\n }).catch(processGrantError);\n },\n /**\n * Revokes this token and unsets its local properties\n * @instance\n * @memberof Token\n * @returns {Promise}\n */\n revoke: function revoke() {\n var _this4 = this;\n if (this.isExpired) {\n this.logger.info('token: already expired, not making making revocation request');\n return _promise.default.resolve();\n }\n if (!this.canAuthorize) {\n this.logger.info('token: no longer valid, not making revocation request');\n return _promise.default.resolve();\n }\n\n // FIXME we need to use the user token revocation endpoint to revoke a token\n // without a client_secret, but it doesn't current support using a token to\n // revoke itself\n // Note: I'm not making a canRevoke property because there should be changes\n // coming to the user token revocation endpoint that allow us to do this\n // correctly.\n if (!this.config.client_secret) {\n this.logger.info('token: no client secret available, not making revocation request');\n return _promise.default.resolve();\n }\n this.logger.info('token: revoking access token');\n return this.webex.request({\n method: 'POST',\n uri: this.config.revokeUrl,\n form: {\n token: this.access_token,\n token_type_hint: 'access_token'\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n }).then(function () {\n _this4.unset(['access_token', 'expires', 'expires_in', 'token_type']);\n _this4.logger.info('token: access token revoked');\n }).catch(processGrantError);\n },\n set: function set() {\n // eslint-disable-next-line prefer-const\n var _this$_filterSetParam = this._filterSetParameters.apply(this, arguments),\n _this$_filterSetParam2 = (0, _slicedToArray2.default)(_this$_filterSetParam, 2),\n attrs = _this$_filterSetParam2[0],\n options = _this$_filterSetParam2[1];\n if (!attrs.token_type && attrs.access_token && attrs.access_token.includes(' ')) {\n var _attrs$access_token$s = attrs.access_token.split(' '),\n _attrs$access_token$s2 = (0, _slicedToArray2.default)(_attrs$access_token$s, 2),\n token_type = _attrs$access_token$s2[0],\n access_token = _attrs$access_token$s2[1];\n attrs = _objectSpread(_objectSpread({}, attrs), {}, {\n access_token: access_token,\n token_type: token_type\n });\n }\n var now = (0, _now.default)();\n if (!attrs.expires && attrs.expires_in) {\n attrs.expires = now + attrs.expires_in * 1000;\n }\n if (!attrs.refresh_token_expires && attrs.refresh_token_expires_in) {\n attrs.refresh_token_expires = now + attrs.refresh_token_expires_in * 1000;\n }\n if (attrs.scope) {\n attrs.scope = (0, _scope.sortScope)(attrs.scope);\n }\n return (0, _apply.default)(_webexPlugin.default.prototype.set, this, [attrs, options]);\n },\n /**\n * Renders the token object as an HTTP Header Value\n * @instance\n * @memberof Token\n * @returns {string}\n * @see {@link Object#toString()}\n */\n toString: function toString() {\n if (!this._string) {\n throw new Error('cannot stringify Token');\n }\n return this._string;\n },\n /**\n * Uses a non-producation api to return information about this token. This\n * method is primarily for tests and will throw if NODE_ENV === production\n * @instance\n * @memberof Token\n * @private\n * @returns {Promise}\n */\n validate: function validate() {\n var _this5 = this;\n if (false) {}\n return this.webex.request({\n method: 'POST',\n service: 'conversation',\n resource: 'users/validateAuthToken',\n body: {\n token: this.access_token\n }\n }).catch(function (reason) {\n if ('statusCode' in reason) {\n return _promise.default.reject(reason);\n }\n _this5.logger.info(\"REMINDER: If you're investigating a network error here, it's normal\");\n\n // If we got an error that isn't a WebexHttpError, assume the problem is\n // that we don't have the wdm plugin loaded and service/resource isn't\n // a valid means of identifying a request.\n var convApi = process.env.CONVERSATION_SERVICE || process.env.CONVERSATION_SERVICE_URL || 'https://conv-a.wbx2.com/conversation/api/v1';\n return _this5.webex.request({\n method: 'POST',\n uri: \"\".concat(convApi, \"/users/validateAuthToken\"),\n body: {\n token: _this5.access_token\n },\n headers: {\n authorization: \"Bearer \".concat(_this5.access_token)\n }\n });\n }).then(function (res) {\n return res.body;\n });\n },\n version: \"3.8.0-next.10\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"downscope\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"downscope\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"revoke\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"revoke\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Token;\n//# sourceMappingURL=token.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/credentials/token.js?");
4318
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\");\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common-timers/dist/index.js\");\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ../webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _scope = __webpack_require__(/*! ./scope */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/scope.js\");\nvar _grantErrors = _interopRequireWildcard(__webpack_require__(/*! ./grant-errors */ \"../../../node_modules/@webex/webex-core/dist/lib/credentials/grant-errors.js\"));\nvar _dec, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor2; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor2(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/* eslint-disable camelcase */\n/**\n * Parse response from CI and converts to structured error when appropriate\n * @param {WebexHttpError} res\n * @private\n * @returns {GrantError}\n */\nfunction processGrantError(res) {\n if (res.statusCode !== 400) {\n return _promise.default.reject(res);\n }\n var ErrorConstructor = _grantErrors.default.select(res.body.error);\n if (ErrorConstructor === _grantErrors.OAuthError && res instanceof _webexHttpError.default) {\n return _promise.default.reject(res);\n }\n if (!ErrorConstructor) {\n return _promise.default.reject(res);\n }\n return _promise.default.reject(new ErrorConstructor(res._res || res));\n}\n\n/**\n * @class\n */\nvar Token = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({\n keyFactory: function keyFactory(scope) {\n return scope;\n }\n}), (_obj = {\n derived: {\n /**\n * Indicates if this token can be used in an auth header. `true` iff\n * {@link Token#access_token} is defined and {@link Token#isExpired} is\n * false.\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canAuthorize: {\n deps: ['access_token', 'isExpired'],\n fn: function fn() {\n return !!this.access_token && !this.isExpired;\n }\n },\n /**\n * Indicates that this token can be downscoped. `true` iff\n * {@link config.credentials.client_id} is defined and if\n * {@link Token#canAuthorize} is true\n *\n * Note: since {@link config} is not evented, we can't listen for changes to\n * {@link config.credentials.client_id}. As such,\n * {@link config.credentials.client_id} must always be set before\n * instantiating a {@link Token}\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canDownscope: {\n deps: ['canAuthorize'],\n fn: function fn() {\n return this.canAuthorize && !!this.config.client_id;\n }\n },\n /**\n * Indicates if this token can be refreshed. `true` iff\n * {@link Token@refresh_token} is defined and\n * {@link config.credentials.refreshCallback()} is defined\n *\n * Note: since {@link config} is not evented, we can't listen for changes to\n * {@link config.credentials.refreshCallback()}. As such,\n * {@link config.credentials.refreshCallback()} must always be set before\n * instantiating a {@link Token}\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n canRefresh: {\n deps: ['refresh_token'],\n fn: function fn() {\n if (_common.inBrowser) {\n return !!this.refresh_token && !!this.config.refreshCallback;\n }\n return !!this.refresh_token && !!this.config.client_secret;\n }\n },\n /**\n * Indicates if this `Token` is expired. `true` iff {@link Token#expires} is\n * defined and is less than {@link Date.now()}.\n * @instance\n * @memberof Token\n * @readonly\n * @type {boolean}\n */\n isExpired: {\n deps: ['expires', '_isExpired'],\n fn: function fn() {\n // in order to avoid setting `cache:false`, we'll use a private property\n // and a timer rather than comparing to `Date.now()`;\n return !!this.expires && this._isExpired;\n }\n },\n /**\n * Cache for toString()\n * @instance\n * @memberof Token\n * @private\n * @readonly\n * @type {string}\n */\n _string: {\n deps: ['access_token', 'token_type'],\n fn: function fn() {\n if (!this.access_token || !this.token_type) {\n return '';\n }\n return \"\".concat(this.token_type, \" \").concat(this.access_token);\n }\n }\n },\n namespace: 'Credentials',\n props: {\n /**\n * Used for indexing in the credentials userTokens collection\n * @instance\n * @memberof Token\n * @private\n * @type {string}\n */\n scope: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {string}\n */\n access_token: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n expires: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n expires_in: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {string}\n */\n refresh_token: 'string',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n refresh_token_expires: 'number',\n /**\n * @instance\n * @memberof Token\n * @type {number}\n */\n refresh_token_expires_in: 'number',\n /**\n * @default \"Bearer\"\n * @instance\n * @memberof Token\n * @type {string}\n */\n token_type: {\n default: 'Bearer',\n type: 'string'\n }\n },\n session: {\n /**\n * Used by {@link Token#isExpired} to avoid doing a Date comparison.\n * @instance\n * @memberof Token\n * @private\n * @type {boolean}\n */\n _isExpired: {\n default: false,\n type: 'boolean'\n },\n /**\n * Handle to the previous token that we'll revoke when we refresh this\n * token. The idea is to keep allow two valid tokens when a refresh occurs;\n * we don't want revoke a token that's in the middle of being used, so when\n * we do a token refresh, we won't revoke the token being refreshed, but\n * we'll revoke the previous one.\n * @instance\n * @memberof Token\n * @private\n * @type {Object}\n */\n previousToken: {\n type: 'state'\n }\n },\n /**\n * Uses this token to request a new Token with a subset of this Token's scopes\n * @instance\n * @memberof Token\n * @param {string} scope\n * @returns {Promise<Token>}\n */\n downscope: function downscope(scope) {\n var _this = this;\n this.logger.info(\"token: downscoping token to \".concat(scope));\n if (this.isExpired) {\n this.logger.info('token: request received to downscope expired access_token');\n return _promise.default.reject(new Error('cannot downscope expired access token'));\n }\n if (!this.canDownscope) {\n if (this.config.client_id) {\n this.logger.info('token: request received to downscope invalid access_token');\n } else {\n this.logger.trace('token: cannot downscope without client_id');\n }\n return _promise.default.reject(new Error('cannot downscope access token'));\n }\n if ((0, _scope.diffScopes)(scope, this.config.scope) !== '') {\n return _promise.default.reject(new Error(\"new scope (\".concat(scope, \") is not subset of the available scopes (\").concat(this.config.scope, \")\")));\n }\n\n // Since we're going to use scope as the index in our token collection, it's\n // important scopes are always deterministically specified.\n if (scope) {\n scope = (0, _scope.sortScope)(scope);\n }\n\n // Ideally, we could depend on the service to communicate this error, but\n // all we get is \"invalid scope\", which, to the lay person, implies\n // something wrong with *one* of the scopes, not the whole thing.\n if (scope === (0, _scope.sortScope)(this.config.scope)) {\n return _promise.default.reject(new Error('token: scope reduction requires a reduced scope'));\n }\n return this.webex.request({\n method: 'POST',\n uri: this.config.tokenUrl,\n addAuthHeader: false,\n form: {\n grant_type: 'urn:cisco:oauth:grant-type:scope-reduction',\n token: this.access_token,\n scope: scope,\n client_id: this.config.client_id,\n self_contained_token: true\n }\n }).then(function (res) {\n _this.logger.info(\"token: downscoped token to \".concat(scope));\n return new Token((0, _assign.default)(res.body, {\n scope: scope\n }), {\n parent: _this.parent\n });\n });\n },\n /**\n * Initializer\n * @instance\n * @memberof Token\n * @param {Object} [attrs={}]\n * @param {Object} [options={}]\n * @see {@link WebexPlugin#initialize()}\n * @returns {Token}\n */\n initialize: function initialize() {\n var _this2 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n (0, _apply.default)(_webexPlugin.default.prototype.initialize, this, [attrs, options]);\n if (typeof attrs === 'string') {\n this.access_token = attrs;\n }\n if (!this.access_token) {\n throw new Error('`access_token` is required');\n }\n\n // We don't want the derived property `isExpired` to need {cache:false}, so\n // we'll set up a timer the runs when this token should expire.\n if (this.expires) {\n if (this.expires < (0, _now.default)()) {\n this._isExpired = true;\n } else {\n (0, _commonTimers.safeSetTimeout)(function () {\n _this2._isExpired = true;\n }, this.expires - (0, _now.default)());\n }\n }\n },\n /**\n * Refreshes this Token. Relies on\n * {@link config.credentials.refreshCallback()}\n * @instance\n * @memberof Token\n * @returns {Promise<Token>}\n */\n refresh: function refresh() {\n var _this3 = this;\n if (!this.canRefresh) {\n throw new Error('Not enough information available to refresh this access token');\n }\n var promise;\n if (_common.inBrowser) {\n if (!this.config.refreshCallback) {\n throw new Error('Cannot refresh access token without refreshCallback');\n }\n promise = _promise.default.resolve(this.config.refreshCallback(this.webex, this));\n }\n return (promise || this.webex.request({\n method: 'POST',\n uri: this.config.tokenUrl,\n form: {\n grant_type: 'refresh_token',\n redirect_uri: this.config.redirect_uri,\n refresh_token: this.refresh_token\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n }).then(function (res) {\n return res.body;\n })).then(function (obj) {\n if (!obj) {\n throw new Error('token: refreshCallback() did not produce an object');\n }\n // If the authentication server did not send back a refresh token, copy\n // the current refresh token and related values to the response (note:\n // at time of implementation, CI never sends a new refresh token)\n if (!obj.refresh_token) {\n (0, _assign.default)(obj, (0, _lodash.pick)(_this3, 'refresh_token', 'refresh_token_expires', 'refresh_token_expires_in'));\n }\n\n // If the new token is the same as the previous token, then we may have\n // found a bug in CI; log the details and reject the Promise\n if (_this3.access_token === obj.access_token) {\n _this3.logger.error('token: new token matches current token');\n // log the tokens if it is not production\n if (true) {\n _this3.logger.error('token: current token:', _this3.access_token);\n _this3.logger.error('token: new token:', obj.access_token);\n }\n return _promise.default.reject(new Error('new token matches current token'));\n }\n if (_this3.previousToken) {\n _this3.previousToken.revoke();\n _this3.unset('previousToken');\n }\n obj.previousToken = _this3;\n obj.scope = _this3.scope;\n return new Token(obj, {\n parent: _this3.parent\n });\n }).catch(processGrantError);\n },\n /**\n * Revokes this token and unsets its local properties\n * @instance\n * @memberof Token\n * @returns {Promise}\n */\n revoke: function revoke() {\n var _this4 = this;\n if (this.isExpired) {\n this.logger.info('token: already expired, not making making revocation request');\n return _promise.default.resolve();\n }\n if (!this.canAuthorize) {\n this.logger.info('token: no longer valid, not making revocation request');\n return _promise.default.resolve();\n }\n\n // FIXME we need to use the user token revocation endpoint to revoke a token\n // without a client_secret, but it doesn't current support using a token to\n // revoke itself\n // Note: I'm not making a canRevoke property because there should be changes\n // coming to the user token revocation endpoint that allow us to do this\n // correctly.\n if (!this.config.client_secret) {\n this.logger.info('token: no client secret available, not making revocation request');\n return _promise.default.resolve();\n }\n this.logger.info('token: revoking access token');\n return this.webex.request({\n method: 'POST',\n uri: this.config.revokeUrl,\n form: {\n token: this.access_token,\n token_type_hint: 'access_token'\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true\n },\n shouldRefreshAccessToken: false\n }).then(function () {\n _this4.unset(['access_token', 'expires', 'expires_in', 'token_type']);\n _this4.logger.info('token: access token revoked');\n }).catch(processGrantError);\n },\n set: function set() {\n // eslint-disable-next-line prefer-const\n var _this$_filterSetParam = this._filterSetParameters.apply(this, arguments),\n _this$_filterSetParam2 = (0, _slicedToArray2.default)(_this$_filterSetParam, 2),\n attrs = _this$_filterSetParam2[0],\n options = _this$_filterSetParam2[1];\n if (!attrs.token_type && attrs.access_token && attrs.access_token.includes(' ')) {\n var _attrs$access_token$s = attrs.access_token.split(' '),\n _attrs$access_token$s2 = (0, _slicedToArray2.default)(_attrs$access_token$s, 2),\n token_type = _attrs$access_token$s2[0],\n access_token = _attrs$access_token$s2[1];\n attrs = _objectSpread(_objectSpread({}, attrs), {}, {\n access_token: access_token,\n token_type: token_type\n });\n }\n var now = (0, _now.default)();\n if (!attrs.expires && attrs.expires_in) {\n attrs.expires = now + attrs.expires_in * 1000;\n }\n if (!attrs.refresh_token_expires && attrs.refresh_token_expires_in) {\n attrs.refresh_token_expires = now + attrs.refresh_token_expires_in * 1000;\n }\n if (attrs.scope) {\n attrs.scope = (0, _scope.sortScope)(attrs.scope);\n }\n return (0, _apply.default)(_webexPlugin.default.prototype.set, this, [attrs, options]);\n },\n /**\n * Renders the token object as an HTTP Header Value\n * @instance\n * @memberof Token\n * @returns {string}\n * @see {@link Object#toString()}\n */\n toString: function toString() {\n if (!this._string) {\n throw new Error('cannot stringify Token');\n }\n return this._string;\n },\n /**\n * Uses a non-producation api to return information about this token. This\n * method is primarily for tests and will throw if NODE_ENV === production\n * @instance\n * @memberof Token\n * @private\n * @returns {Promise}\n */\n validate: function validate() {\n var _this5 = this;\n if (false) {}\n return this.webex.request({\n method: 'POST',\n service: 'conversation',\n resource: 'users/validateAuthToken',\n body: {\n token: this.access_token\n }\n }).catch(function (reason) {\n if ('statusCode' in reason) {\n return _promise.default.reject(reason);\n }\n _this5.logger.info(\"REMINDER: If you're investigating a network error here, it's normal\");\n\n // If we got an error that isn't a WebexHttpError, assume the problem is\n // that we don't have the wdm plugin loaded and service/resource isn't\n // a valid means of identifying a request.\n var convApi = process.env.CONVERSATION_SERVICE || process.env.CONVERSATION_SERVICE_URL || 'https://conv-a.wbx2.com/conversation/api/v1';\n return _this5.webex.request({\n method: 'POST',\n uri: \"\".concat(convApi, \"/users/validateAuthToken\"),\n body: {\n token: _this5.access_token\n },\n headers: {\n authorization: \"Bearer \".concat(_this5.access_token)\n }\n });\n }).then(function (res) {\n return res.body;\n });\n },\n version: \"3.8.0-next.11\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"downscope\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"downscope\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"revoke\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"revoke\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Token;\n//# sourceMappingURL=token.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/credentials/token.js?");
4319
4319
 
4320
4320
  /***/ }),
4321
4321
 
@@ -4469,7 +4469,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
4469
4469
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4470
4470
 
4471
4471
  "use strict";
4472
- eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = exports.DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER = void 0;\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _weakMap = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _sha = _interopRequireDefault(__webpack_require__(/*! crypto-js/sha256 */ \"../../../node_modules/crypto-js/sha256.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"../../../node_modules/@webex/webex-core/dist/lib/services/metrics.js\"));\nvar _serviceCatalog = _interopRequireDefault(__webpack_require__(/*! ./service-catalog */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-catalog.js\"));\nvar _serviceRegistry = _interopRequireDefault(__webpack_require__(/*! ./service-registry */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-registry.js\"));\nvar _serviceState = _interopRequireDefault(__webpack_require__(/*! ./service-state */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-state.js\"));\nvar _serviceFedRamp = _interopRequireDefault(__webpack_require__(/*! ./service-fed-ramp */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-fed-ramp.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/webex-core/dist/lib/services/constants.js\");\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }\nvar trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n// The default cluster when one is not provided (usually as 'US' from hydra)\nvar DEFAULT_CLUSTER = exports.DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';\n// The default service name for convo (currently identityLookup due to some weird CSB issue)\nvar DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER_SERVICE = 'identityLookup';\nvar CLUSTER_SERVICE = process.env.WEBEX_CONVERSATION_CLUSTER_SERVICE || DEFAULT_CLUSTER_SERVICE;\nvar DEFAULT_CLUSTER_IDENTIFIER = process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || \"\".concat(DEFAULT_CLUSTER, \":\").concat(CLUSTER_SERVICE);\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nvar Services = _webexPlugin.default.extend({\n namespace: 'Services',\n /**\n * The {@link WeakMap} of {@link ServiceRegistry} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceRegistry>}\n * @private\n * @memberof Services\n */\n registries: new _weakMap.default(),\n /**\n * The {@link WeakMap} of {@link ServiceState} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceState>}\n * @private\n * @memberof Services\n */\n states: new _weakMap.default(),\n props: {\n validateDomains: ['boolean', false, true],\n initFailed: ['boolean', false, false]\n },\n _catalogs: new _weakMap.default(),\n _serviceUrls: null,\n _hostCatalog: null,\n /**\n * Get the registry associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceRegistry} - The associated {@link ServiceRegistry}.\n */\n getRegistry: function getRegistry() {\n return this.registries.get(this.webex);\n },\n /**\n * Get the state associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceState} - The associated {@link ServiceState}.\n */\n getState: function getState() {\n return this.states.get(this.webex);\n },\n /**\n * @private\n * Get the current catalog based on the assocaited\n * webex instance.\n * @returns {ServiceCatalog}\n */\n _getCatalog: function _getCatalog() {\n return this._catalogs.get(this.webex);\n },\n /**\n * Get a service url from the current services list by name\n * from the associated instance catalog.\n * @param {string} name\n * @param {boolean} [priorityHost]\n * @param {string} [serviceGroup]\n * @returns {string|undefined}\n */\n get: function get(name, priorityHost, serviceGroup) {\n var catalog = this._getCatalog();\n return catalog.get(name, priorityHost, serviceGroup);\n },\n /**\n * Determine if the catalog contains a specific service\n *\n * @param {string} serviceName - The service name to validate.\n * @returns {boolean} - True if the service exists.\n */\n hasService: function hasService(serviceName) {\n return !!this.get(serviceName);\n },\n /**\n * Determine if a whilelist exists in the service catalog.\n *\n * @returns {boolean} - True if a allowed domains list exists.\n */\n hasAllowedDomains: function hasAllowedDomains() {\n var catalog = this._getCatalog();\n return catalog.getAllowedDomains().length > 0;\n },\n /**\n * Generate a service catalog as an object from\n * the associated instance catalog.\n * @param {boolean} [priorityHost] - use highest priority host if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list: function list(priorityHost, serviceGroup) {\n var catalog = this._getCatalog();\n return catalog.list(priorityHost, serviceGroup);\n },\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl: function markFailedUrl(url, noPriorityHosts) {\n var catalog = this._getCatalog();\n return catalog.markFailedUrl(url, noPriorityHosts);\n },\n /**\n * saves all the services from the pre and post catalog service\n * @param {Object} serviceUrls\n * @returns {void}\n */\n _updateServiceUrls: function _updateServiceUrls(serviceUrls) {\n this._serviceUrls = _objectSpread(_objectSpread({}, this._serviceUrls), serviceUrls);\n },\n /**\n * saves the hostCatalog object\n * @param {Object} hostCatalog\n * @returns {void}\n */\n _updateHostCatalog: function _updateHostCatalog(hostCatalog) {\n this._hostCatalog = _objectSpread(_objectSpread({}, this._hostCatalog), hostCatalog);\n },\n /**\n * Update a list of `serviceUrls` to the most current\n * catalog via the defined `discoveryUrl` then returns the current\n * list of services.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n updateServices: function updateServices() {\n var _this = this;\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n from = _ref.from,\n query = _ref.query,\n token = _ref.token,\n forceRefresh = _ref.forceRefresh;\n var catalog = this._getCatalog();\n var formattedQuery;\n var serviceGroup;\n\n // map catalog name to service group name.\n switch (from) {\n case 'limited':\n serviceGroup = 'preauth';\n break;\n case 'signin':\n serviceGroup = 'signin';\n break;\n default:\n serviceGroup = 'postauth';\n break;\n }\n\n // confirm catalog update for group is not in progress.\n if (catalog.status[serviceGroup].collecting) {\n return this.waitForCatalog(serviceGroup);\n }\n catalog.status[serviceGroup].collecting = true;\n if (serviceGroup === 'preauth') {\n var queryKey = query && (0, _keys.default)(query)[0];\n if (!['email', 'emailhash', 'userId', 'orgId', 'mode'].includes(queryKey)) {\n return _promise.default.reject(new Error('a query param of email, emailhash, userId, orgId, or mode is required'));\n }\n }\n // encode email when query key is email\n if (serviceGroup === 'preauth' || serviceGroup === 'signin') {\n var _queryKey = (0, _keys.default)(query)[0];\n formattedQuery = {};\n if (_queryKey === 'email' && query.email) {\n formattedQuery.emailhash = (0, _sha.default)(query.email.toLowerCase()).toString();\n } else {\n formattedQuery[_queryKey] = query[_queryKey];\n }\n }\n return this._fetchNewServiceHostmap({\n from: from,\n token: token,\n query: formattedQuery,\n forceRefresh: forceRefresh\n }).then(function (serviceHostMap) {\n catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n _this.updateCredentialsConfig();\n catalog.status[serviceGroup].collecting = false;\n }).catch(function (error) {\n catalog.status[serviceGroup].collecting = false;\n return _promise.default.reject(error);\n });\n },\n /**\n * User validation parameter transfer object for {@link validateUser}.\n * @param {object} ValidateUserPTO\n * @property {string} ValidateUserPTO.email - The email of the user.\n * @property {string} [ValidateUserPTO.reqId] - The activation requester.\n * @property {object} [ValidateUserPTO.activationOptions] - Extra options to pass when sending the activation\n * @property {object} [ValidateUserPTO.preloginUserId] - The prelogin user id to set when sending the activation.\n */\n /**\n * User validation return transfer object for {@link validateUser}.\n * @param {object} ValidateUserRTO\n * @property {boolean} ValidateUserRTO.activated - If the user is activated.\n * @property {boolean} ValidateUserRTO.exists - If the user exists.\n * @property {string} ValidateUserRTO.details - A descriptive status message.\n * @property {object} ValidateUserRTO.user - **License** service user object.\n */\n /**\n * Validate if a user is activated and update the service catalogs as needed\n * based on the user's activation status.\n *\n * @param {ValidateUserPTO} - The parameter transfer object.\n * @returns {ValidateUserRTO} - The return transfer object.\n */\n validateUser: function validateUser(_ref2) {\n var _this2 = this;\n var email = _ref2.email,\n _ref2$reqId = _ref2.reqId,\n reqId = _ref2$reqId === void 0 ? 'WEBCLIENT' : _ref2$reqId,\n _ref2$forceRefresh = _ref2.forceRefresh,\n forceRefresh = _ref2$forceRefresh === void 0 ? false : _ref2$forceRefresh,\n _ref2$activationOptio = _ref2.activationOptions,\n activationOptions = _ref2$activationOptio === void 0 ? {} : _ref2$activationOptio,\n preloginUserId = _ref2.preloginUserId;\n this.logger.info('services: validating a user');\n\n // Validate that an email parameter key was provided.\n if (!email) {\n return _promise.default.reject(new Error('`email` is required'));\n }\n\n // Destructure the credentials object.\n var canAuthorize = this.webex.credentials.canAuthorize;\n\n // Validate that the user is already authorized.\n if (canAuthorize) {\n return this.updateServices({\n forceRefresh: forceRefresh\n }).then(function () {\n return _this2.webex.credentials.getUserToken();\n }).then(function (token) {\n return _this2.sendUserActivation({\n email: email,\n reqId: reqId,\n token: token.toString(),\n activationOptions: activationOptions,\n preloginUserId: preloginUserId\n });\n }).then(function (userObj) {\n return {\n activated: true,\n exists: true,\n details: 'user is authorized via a user token',\n user: userObj\n };\n });\n }\n\n // Destructure the client authorization details.\n /* eslint-disable camelcase */\n var _this$webex$credentia = this.webex.credentials.config,\n client_id = _this$webex$credentia.client_id,\n client_secret = _this$webex$credentia.client_secret;\n\n // Validate that client authentication details exist.\n if (!client_id || !client_secret) {\n return _promise.default.reject(new Error('client authentication details are not available'));\n }\n /* eslint-enable camelcase */\n\n // Declare a class-memeber-scoped token for usage within the promise chain.\n var token;\n\n // Begin client authentication user validation.\n return this.collectPreauthCatalog({\n email: email\n }).then(function () {\n // Retrieve the service url from the updated catalog. This is required\n // since `WebexCore` is usually not fully initialized at the time this\n // request completes.\n var idbrokerService = _this2.get('idbroker', true);\n\n // Collect the client auth token.\n return _this2.webex.credentials.getClientToken({\n uri: \"\".concat(idbrokerService, \"idb/oauth2/v1/access_token\"),\n scope: 'webexsquare:admin webexsquare:get_conversation Identity:SCIM'\n });\n }).then(function (tokenObj) {\n // Generate the token string.\n token = tokenObj.toString();\n\n // Collect the signin catalog using the client auth information.\n return _this2.collectSigninCatalog({\n email: email,\n token: token,\n forceRefresh: forceRefresh\n });\n })\n // Validate if collecting the signin catalog failed and populate the RTO\n // with the appropriate content.\n .catch(function (error) {\n return {\n exists: error.name !== 'NotFound',\n activated: false,\n details: error.name !== 'NotFound' ? 'user exists but is not activated' : 'user does not exist and is not activated'\n };\n })\n // Validate if the previous promise resolved with an RTO and populate the\n // new RTO accordingly.\n .then(function (rto) {\n return _promise.default.all([rto || {\n activated: true,\n exists: true,\n details: 'user exists and is activated'\n }, _this2.sendUserActivation({\n email: email,\n reqId: reqId,\n token: token,\n activationOptions: activationOptions,\n preloginUserId: preloginUserId\n })]);\n }).then(function (_ref3) {\n var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),\n rto = _ref4[0],\n user = _ref4[1];\n return _objectSpread(_objectSpread({}, rto), {}, {\n user: user\n });\n }).catch(function (error) {\n var response = {\n statusCode: error.statusCode,\n responseText: error.body && error.body.message,\n body: error.body\n };\n return _promise.default.reject(response);\n });\n },\n /**\n * Get user meeting preferences (preferred webex site).\n *\n * @returns {object} - User Information including user preferrences .\n */\n getMeetingPreferences: function getMeetingPreferences() {\n var _this3 = this;\n return this.request({\n method: 'GET',\n service: 'hydra',\n resource: 'meetingPreferences'\n }).then(function (res) {\n _this3.logger.info('services: received user region info');\n return res.body;\n }).catch(function (err) {\n _this3.logger.info('services: was not able to fetch user login information', err);\n // resolve successfully even if request failed\n });\n },\n /**\n * Fetches client region info such as countryCode and timezone.\n *\n * @returns {object} - The region info object.\n */\n fetchClientRegionInfo: function fetchClientRegionInfo() {\n var _this4 = this;\n var services = this.webex.config.services;\n return this.request({\n uri: services.discovery.sqdiscovery,\n addAuthHeader: false,\n headers: {\n 'spark-user-agent': null\n },\n timeout: 5000\n }).then(function (res) {\n _this4.logger.info('services: received user region info');\n return res.body;\n }).catch(function (err) {\n _this4.logger.info('services: was not able to get user region info', err);\n // resolve successfully even if request failed\n });\n },\n /**\n * User activation parameter transfer object for {@link sendUserActivation}.\n * @typedef {object} SendUserActivationPTO\n * @property {string} SendUserActivationPTO.email - The email of the user.\n * @property {string} SendUserActivationPTO.reqId - The activation requester.\n * @property {string} SendUserActivationPTO.token - The client auth token.\n * @property {object} SendUserActivationPTO.activationOptions - Extra options to pass when sending the activation.\n * @property {object} SendUserActivationPTO.preloginUserId - The prelogin user id to set when sending the activation.\n */\n /**\n * Send a request to activate a user using a client token.\n *\n * @param {SendUserActivationPTO} - The Parameter transfer object.\n * @returns {LicenseDTO} - The DTO returned from the **License** service.\n */\n sendUserActivation: function sendUserActivation(_ref5) {\n var _this5 = this;\n var email = _ref5.email,\n reqId = _ref5.reqId,\n token = _ref5.token,\n activationOptions = _ref5.activationOptions,\n preloginUserId = _ref5.preloginUserId;\n this.logger.info('services: sending user activation request');\n var countryCode;\n var timezone;\n\n // try to fetch client region info first\n return this.fetchClientRegionInfo().then(function (clientRegionInfo) {\n if (clientRegionInfo) {\n countryCode = clientRegionInfo.countryCode;\n timezone = clientRegionInfo.timezone;\n }\n\n // Send the user activation request to the **License** service.\n return _this5.request({\n service: 'license',\n resource: 'users/activations',\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: token,\n 'x-prelogin-userid': preloginUserId\n },\n body: _objectSpread({\n email: email,\n reqId: reqId,\n countryCode: countryCode,\n timeZone: timezone\n }, activationOptions),\n shouldRefreshAccessToken: false\n });\n })\n // On success, return the **License** user object.\n .then(function (_ref6) {\n var body = _ref6.body;\n return body;\n })\n // On failure, reject with error from **License**.\n .catch(function (error) {\n return _promise.default.reject(error);\n });\n },\n /**\n * Updates a given service group i.e. preauth, signin, postauth with a new hostmap.\n * @param {string} serviceGroup - preauth, signin, postauth\n * @param {object} hostMap - The new hostmap to update the service group with.\n * @returns {Promise<void>}\n */\n updateCatalog: function updateCatalog(serviceGroup, hostMap) {\n var catalog = this._getCatalog();\n var serviceHostMap = this._formatReceivedHostmap(hostMap);\n return catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n },\n /**\n * simplified method to update the preauth catalog via email\n *\n * @param {object} query\n * @param {string} query.email - A standard format email.\n * @param {string} query.orgId - The user's OrgId.\n * @param {boolean} forceRefresh - Boolean to bypass u2c cache control header\n * @returns {Promise<void>}\n */\n collectPreauthCatalog: function collectPreauthCatalog(query) {\n var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!query) {\n return this.updateServices({\n from: 'limited',\n query: {\n mode: 'DEFAULT_BY_PROXIMITY'\n },\n forceRefresh: forceRefresh\n });\n }\n return this.updateServices({\n from: 'limited',\n query: query,\n forceRefresh: forceRefresh\n });\n },\n /**\n * simplified method to update the signin catalog via email and token\n * @param {object} param\n * @param {string} param.email - must be a standard-format email\n * @param {string} param.token - must be a client token\n * @returns {Promise<void>}\n */\n collectSigninCatalog: function collectSigninCatalog() {\n var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n email = _ref7.email,\n token = _ref7.token,\n forceRefresh = _ref7.forceRefresh;\n if (!email) {\n return _promise.default.reject(new Error('`email` is required'));\n }\n if (!token) {\n return _promise.default.reject(new Error('`token` is required'));\n }\n return this.updateServices({\n from: 'signin',\n query: {\n email: email\n },\n token: token,\n forceRefresh: forceRefresh\n });\n },\n /**\n * Updates credentials config to utilize u2c catalog\n * urls.\n * @returns {void}\n */\n updateCredentialsConfig: function updateCredentialsConfig() {\n var _this$list = this.list(true),\n idbroker = _this$list.idbroker,\n identity = _this$list.identity;\n if (idbroker && identity) {\n var _this$webex$config$cr = this.webex.config.credentials,\n authorizationString = _this$webex$config$cr.authorizationString,\n authorizeUrl = _this$webex$config$cr.authorizeUrl;\n\n // This must be set outside of the setConfig method used to assign the\n // idbroker and identity url values.\n this.webex.config.credentials.authorizeUrl = authorizationString ? authorizeUrl : \"\".concat(idbroker.replace(trailingSlashes, ''), \"/idb/oauth2/v1/authorize\");\n this.webex.setConfig({\n credentials: {\n idbroker: {\n url: idbroker.replace(trailingSlashes, '') // remove trailing slash\n },\n\n identity: {\n url: identity.replace(trailingSlashes, '') // remove trailing slash\n }\n }\n });\n }\n },\n /**\n * Wait until the service catalog is available,\n * or reject afte ra timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog: function waitForCatalog(serviceGroup, timeout) {\n var catalog = this._getCatalog();\n var supertoken = this.webex.credentials.supertoken;\n if (serviceGroup === 'postauth' && supertoken && supertoken.access_token && !catalog.status.postauth.collecting && !catalog.status.postauth.ready) {\n if (!catalog.status.preauth.ready) {\n return this.initServiceCatalogs();\n }\n return this.updateServices();\n }\n return catalog.waitForCatalog(serviceGroup, timeout);\n },\n /**\n * Service waiting parameter transfer object for {@link waitForService}.\n *\n * @typedef {object} WaitForServicePTO\n * @property {string} [WaitForServicePTO.name] - The service name.\n * @property {string} [WaitForServicePTO.url] - The service url.\n * @property {string} [WaitForServicePTO.timeout] - wait duration in seconds.\n */\n /**\n * Wait until the service has been ammended to any service catalog. This\n * method prioritizes the service name over the service url when searching.\n *\n * @param {WaitForServicePTO} - The parameter transfer object.\n * @returns {Promise<string>} - Resolves to the priority host of a service.\n */\n waitForService: function waitForService(_ref8) {\n var _this6 = this;\n var name = _ref8.name,\n _ref8$timeout = _ref8.timeout,\n timeout = _ref8$timeout === void 0 ? 5 : _ref8$timeout,\n url = _ref8.url;\n var services = this.webex.config.services;\n\n // Save memory by grabbing the catalog after there isn't a priortyURL\n var catalog = this._getCatalog();\n var fetchFromServiceUrl = services.servicesNotNeedValidation.find(function (service) {\n return service === name;\n });\n if (fetchFromServiceUrl) {\n return _promise.default.resolve(this._serviceUrls[name]);\n }\n var priorityUrl = this.get(name, true);\n var priorityUrlObj = this.getServiceFromUrl(url);\n if (priorityUrl || priorityUrlObj) {\n return _promise.default.resolve(priorityUrl || priorityUrlObj.priorityUrl);\n }\n if (catalog.isReady) {\n if (url) {\n return _promise.default.resolve(url);\n }\n this.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {\n service_name: name\n }\n });\n return _promise.default.reject(new Error(\"services: service '\".concat(name, \"' was not found in any of the catalogs\")));\n }\n return new _promise.default(function (resolve, reject) {\n var groupsToCheck = ['preauth', 'signin', 'postauth'];\n var checkCatalog = function checkCatalog(catalogGroup) {\n return catalog.waitForCatalog(catalogGroup, timeout).then(function () {\n var scopedPriorityUrl = _this6.get(name, true);\n var scopedPrioriryUrlObj = _this6.getServiceFromUrl(url);\n if (scopedPriorityUrl || scopedPrioriryUrlObj) {\n resolve(scopedPriorityUrl || scopedPrioriryUrlObj.priorityUrl);\n }\n }).catch(function () {\n return undefined;\n });\n };\n _promise.default.all(groupsToCheck.map(function (group) {\n return checkCatalog(group);\n })).then(function () {\n _this6.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {\n service_name: name\n }\n });\n reject(new Error(\"services: service '\".concat(name, \"' was not found after waiting\")));\n });\n });\n },\n /**\n * Looks up the hostname in the host catalog\n * and replaces it with the first host if it finds it\n * @param {string} uri\n * @returns {string} uri with the host replaced\n */\n replaceHostFromHostmap: function replaceHostFromHostmap(uri) {\n var url = new URL(uri);\n var hostCatalog = this._hostCatalog;\n if (!hostCatalog) {\n return uri;\n }\n var host = hostCatalog[url.host];\n if (host && host[0]) {\n var newHost = host[0].host;\n url.host = newHost;\n return url.toString();\n }\n return uri;\n },\n /**\n * @private\n * Organize a received hostmap from a service\n * catalog endpoint.\n * @param {object} serviceHostmap\n * @returns {object}\n */\n _formatReceivedHostmap: function _formatReceivedHostmap(serviceHostmap) {\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n var extractId = function extractId(entry) {\n return entry.id.split(':')[3];\n };\n var formattedHostmap = [];\n\n // for each of the services in the serviceLinks, find the matching host in the catalog\n (0, _keys.default)(serviceHostmap.serviceLinks).forEach(function (serviceName) {\n var _formattedHost$hosts;\n var serviceUrl = serviceHostmap.serviceLinks[serviceName];\n var host;\n try {\n host = new URL(serviceUrl).host;\n } catch (e) {\n return;\n }\n var matchingCatalogEntry = serviceHostmap.hostCatalog[host];\n var formattedHost = {\n name: serviceName,\n defaultUrl: serviceUrl,\n defaultHost: host,\n hosts: []\n };\n formattedHostmap.push(formattedHost);\n\n // If the catalog does not have any hosts we will be unable to find the service ID\n // so can't search for other hosts\n if (!matchingCatalogEntry || !matchingCatalogEntry[0]) {\n return;\n }\n var serviceId = extractId(matchingCatalogEntry[0]);\n (0, _lodash.forEach)(matchingCatalogEntry, function (entry) {\n // The ids for all hosts within a hostCatalog entry should be the same\n // but for safety, only add host entries that have the same id as the first one\n if (extractId(entry) === serviceId) {\n formattedHost.hosts.push(_objectSpread(_objectSpread({}, entry), {}, {\n homeCluster: true\n }));\n }\n });\n var otherHosts = [];\n\n // find the services in the host catalog that have the same id\n // and add them to the otherHosts\n (0, _lodash.forEach)(serviceHostmap.hostCatalog, function (entry) {\n // exclude the matching catalog entry as we have already added that\n if (entry === matchingCatalogEntry) {\n return;\n }\n (0, _lodash.forEach)(entry, function (entryHost) {\n // only add hosts that have the correct id\n if (extractId(entryHost) === serviceId) {\n otherHosts.push(_objectSpread(_objectSpread({}, entryHost), {}, {\n homeCluster: false\n }));\n }\n });\n });\n (_formattedHost$hosts = formattedHost.hosts).push.apply(_formattedHost$hosts, otherHosts);\n });\n\n // update all the service urls in the host catalog\n\n this._updateServiceUrls(serviceHostmap.serviceLinks);\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n return formattedHostmap;\n },\n /**\n * Get the clusterId associated with a URL string.\n * @param {string} url\n * @returns {string} - Cluster ID of url provided\n */\n getClusterId: function getClusterId(url) {\n var catalog = this._getCatalog();\n return catalog.findClusterId(url);\n },\n /**\n * Get a service value from a provided clusterId. This method will\n * return an object containing both the name and url of a found service.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n getServiceFromClusterId: function getServiceFromClusterId(params) {\n var catalog = this._getCatalog();\n return catalog.findServiceFromClusterId(params);\n },\n /**\n * @param {String} cluster the cluster containing the id\n * @param {UUID} [id] the id of the conversation.\n * If empty, just return the base URL.\n * @returns {String} url of the service\n */\n getServiceUrlFromClusterId: function getServiceUrlFromClusterId() {\n var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref9$cluster = _ref9.cluster,\n cluster = _ref9$cluster === void 0 ? 'us' : _ref9$cluster;\n var clusterId = cluster === 'us' ? DEFAULT_CLUSTER_IDENTIFIER : cluster;\n\n // Determine if cluster has service name (non-US clusters from hydra do not)\n if (clusterId.split(':').length < 4) {\n // Add Service to cluster identifier\n clusterId = \"\".concat(cluster, \":\").concat(CLUSTER_SERVICE);\n }\n var _ref10 = this.getServiceFromClusterId({\n clusterId: clusterId\n }) || {},\n url = _ref10.url;\n if (!url) {\n throw Error(\"Could not find service for cluster [\".concat(cluster, \"]\"));\n }\n return url;\n },\n /**\n * Get a service object from a service url if the service url exists in the\n * catalog.\n *\n * @param {string} url - The url to be validated.\n * @returns {object} - Service object.\n * @returns {object.name} - The name of the service found.\n * @returns {object.priorityUrl} - The priority url of the found service.\n * @returns {object.defaultUrl} - The default url of the found service.\n */\n getServiceFromUrl: function getServiceFromUrl() {\n var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var service = this._getCatalog().findServiceUrlFromUrl(url);\n if (!service) {\n return undefined;\n }\n return {\n name: service.name,\n priorityUrl: service.get(true),\n defaultUrl: service.get()\n };\n },\n /**\n * Verify that a provided url exists in the service\n * catalog.\n * @param {string} url\n * @returns {boolean} - true if exists, false otherwise\n */\n isServiceUrl: function isServiceUrl(url) {\n var catalog = this._getCatalog();\n return !!catalog.findServiceUrlFromUrl(url);\n },\n /**\n * Determine if a provided url is in the catalog's allowed domains.\n *\n * @param {string} url - The url to match allowed domains against.\n * @returns {boolean} - True if the url provided is allowed.\n */\n isAllowedDomainUrl: function isAllowedDomainUrl(url) {\n var catalog = this._getCatalog();\n return !!catalog.findAllowedDomain(url);\n },\n /**\n * Converts the host portion of the url from default host\n * to a priority host\n *\n * @param {string} url a service url that contains a default host\n * @returns {string} a service url that contains the top priority host.\n * @throws if url isn't a service url\n */\n convertUrlToPriorityHostUrl: function convertUrlToPriorityHostUrl() {\n var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var data = this.getServiceFromUrl(url);\n if (!data) {\n throw Error(\"No service associated with url: [\".concat(url, \"]\"));\n }\n return url.replace(data.defaultUrl, data.priorityUrl);\n },\n /**\n * @private\n * Simplified method wrapper for sending a request to get\n * an updated service hostmap.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n _fetchNewServiceHostmap: function _fetchNewServiceHostmap() {\n var _this7 = this;\n var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n from = _ref11.from,\n query = _ref11.query,\n token = _ref11.token,\n forceRefresh = _ref11.forceRefresh;\n var service = 'u2c';\n var resource = from ? \"/\".concat(from, \"/catalog\") : '/catalog';\n var qs = _objectSpread(_objectSpread({}, query), {}, {\n format: 'hostmap'\n });\n if (forceRefresh) {\n qs.timestamp = new Date().getTime();\n }\n var requestObject = {\n method: 'GET',\n service: service,\n resource: resource,\n qs: qs\n };\n if (token) {\n requestObject.headers = {\n authorization: token\n };\n }\n return this.webex.internal.newMetrics.callDiagnosticLatencies.measureLatency(function () {\n return _this7.request(requestObject);\n }, 'internal.get.u2c.time').then(function (_ref12) {\n var body = _ref12.body;\n return _this7._formatReceivedHostmap(body);\n });\n },\n /**\n * Initialize the discovery services and the whitelisted services.\n *\n * @returns {void}\n */\n initConfig: function initConfig() {\n // Get the catalog and destructure the services config.\n var catalog = this._getCatalog();\n var _this$webex$config = this.webex.config,\n services = _this$webex$config.services,\n fedramp = _this$webex$config.fedramp;\n\n // Validate that the services configuration exists.\n if (services) {\n if (fedramp) {\n services.discovery = _serviceFedRamp.default;\n }\n // Check for discovery services.\n if (services.discovery) {\n // Format the discovery configuration into an injectable array.\n var formattedDiscoveryServices = (0, _keys.default)(services.discovery).map(function (key) {\n return {\n name: key,\n defaultUrl: services.discovery[key]\n };\n });\n\n // Inject formatted discovery services into services catalog.\n catalog.updateServiceUrls('discovery', formattedDiscoveryServices);\n }\n if (services.override) {\n // Format the override configuration into an injectable array.\n var formattedOverrideServices = (0, _keys.default)(services.override).map(function (key) {\n return {\n name: key,\n defaultUrl: services.override[key]\n };\n });\n\n // Inject formatted override services into services catalog.\n catalog.updateServiceUrls('override', formattedOverrideServices);\n }\n\n // if not fedramp, append on the commercialAllowedDomains\n if (!fedramp) {\n services.allowedDomains = (0, _lodash.union)(services.allowedDomains, _constants.COMMERCIAL_ALLOWED_DOMAINS);\n }\n\n // Check for allowed host domains.\n if (services.allowedDomains) {\n // Store the allowed domains as a property of the catalog.\n catalog.setAllowedDomains(services.allowedDomains);\n }\n\n // Set `validateDomains` property to match configuration\n this.validateDomains = services.validateDomains;\n }\n },\n /**\n * Make the initial requests to collect the root catalogs.\n *\n * @returns {Promise<void, Error>} - Errors if the token is unavailable.\n */\n initServiceCatalogs: function initServiceCatalogs() {\n var _this8 = this;\n this.logger.info('services: initializing initial service catalogs');\n\n // Destructure the credentials plugin.\n var credentials = this.webex.credentials;\n\n // Init a promise chain. Must be done as a Promise.resolve() to allow\n // credentials#getOrgId() to properly throw.\n return _promise.default.resolve()\n // Get the user's OrgId.\n .then(function () {\n return credentials.getOrgId();\n })\n // Begin collecting the preauth/limited catalog.\n .then(function (orgId) {\n return _this8.collectPreauthCatalog({\n orgId: orgId\n });\n }).then(function () {\n // Validate if the token is authorized.\n if (credentials.canAuthorize) {\n // Attempt to collect the postauth catalog.\n return _this8.updateServices().catch(function () {\n _this8.initFailed = true;\n _this8.logger.warn('services: cannot retrieve postauth catalog');\n });\n }\n\n // Return a resolved promise for consistent return value.\n return _promise.default.resolve();\n });\n },\n /**\n * Initializer\n *\n * @instance\n * @memberof Services\n * @returns {Services}\n */\n initialize: function initialize() {\n var _this9 = this;\n var catalog = new _serviceCatalog.default();\n var registry = new _serviceRegistry.default();\n var state = new _serviceState.default();\n this._catalogs.set(this.webex, catalog);\n this.registries.set(this.webex, registry);\n this.states.set(this.webex, state);\n\n // Listen for configuration changes once.\n this.listenToOnce(this.webex, 'change:config', function () {\n _this9.initConfig();\n });\n\n // wait for webex instance to be ready before attempting\n // to update the service catalogs\n this.listenToOnce(this.webex, 'ready', function () {\n var supertoken = _this9.webex.credentials.supertoken;\n // Validate if the supertoken exists.\n if (supertoken && supertoken.access_token) {\n _this9.initServiceCatalogs().then(function () {\n catalog.isReady = true;\n }).catch(function (error) {\n _this9.initFailed = true;\n _this9.logger.error(\"services: failed to init initial services when credentials available, \".concat(error === null || error === void 0 ? void 0 : error.message));\n });\n } else {\n var email = _this9.webex.config.email;\n _this9.collectPreauthCatalog(email ? {\n email: email\n } : undefined).catch(function (error) {\n _this9.initFailed = true;\n _this9.logger.error(\"services: failed to init initial services when no credentials available, \".concat(error === null || error === void 0 ? void 0 : error.message));\n });\n }\n });\n },\n version: \"3.8.0-next.10\"\n});\n/* eslint-enable no-underscore-dangle */\nvar _default = exports[\"default\"] = Services;\n//# sourceMappingURL=services.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/services/services.js?");
4472
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = exports.DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER = void 0;\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _weakMap = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _sha = _interopRequireDefault(__webpack_require__(/*! crypto-js/sha256 */ \"../../../node_modules/crypto-js/sha256.js\"));\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"../../../node_modules/@webex/webex-core/dist/lib/services/metrics.js\"));\nvar _serviceCatalog = _interopRequireDefault(__webpack_require__(/*! ./service-catalog */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-catalog.js\"));\nvar _serviceRegistry = _interopRequireDefault(__webpack_require__(/*! ./service-registry */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-registry.js\"));\nvar _serviceState = _interopRequireDefault(__webpack_require__(/*! ./service-state */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-state.js\"));\nvar _serviceFedRamp = _interopRequireDefault(__webpack_require__(/*! ./service-fed-ramp */ \"../../../node_modules/@webex/webex-core/dist/lib/services/service-fed-ramp.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"../../../node_modules/@webex/webex-core/dist/lib/services/constants.js\");\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }\nvar trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n// The default cluster when one is not provided (usually as 'US' from hydra)\nvar DEFAULT_CLUSTER = exports.DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';\n// The default service name for convo (currently identityLookup due to some weird CSB issue)\nvar DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER_SERVICE = 'identityLookup';\nvar CLUSTER_SERVICE = process.env.WEBEX_CONVERSATION_CLUSTER_SERVICE || DEFAULT_CLUSTER_SERVICE;\nvar DEFAULT_CLUSTER_IDENTIFIER = process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || \"\".concat(DEFAULT_CLUSTER, \":\").concat(CLUSTER_SERVICE);\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nvar Services = _webexPlugin.default.extend({\n namespace: 'Services',\n /**\n * The {@link WeakMap} of {@link ServiceRegistry} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceRegistry>}\n * @private\n * @memberof Services\n */\n registries: new _weakMap.default(),\n /**\n * The {@link WeakMap} of {@link ServiceState} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceState>}\n * @private\n * @memberof Services\n */\n states: new _weakMap.default(),\n props: {\n validateDomains: ['boolean', false, true],\n initFailed: ['boolean', false, false]\n },\n _catalogs: new _weakMap.default(),\n _serviceUrls: null,\n _hostCatalog: null,\n /**\n * Get the registry associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceRegistry} - The associated {@link ServiceRegistry}.\n */\n getRegistry: function getRegistry() {\n return this.registries.get(this.webex);\n },\n /**\n * Get the state associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceState} - The associated {@link ServiceState}.\n */\n getState: function getState() {\n return this.states.get(this.webex);\n },\n /**\n * @private\n * Get the current catalog based on the assocaited\n * webex instance.\n * @returns {ServiceCatalog}\n */\n _getCatalog: function _getCatalog() {\n return this._catalogs.get(this.webex);\n },\n /**\n * Get a service url from the current services list by name\n * from the associated instance catalog.\n * @param {string} name\n * @param {boolean} [priorityHost]\n * @param {string} [serviceGroup]\n * @returns {string|undefined}\n */\n get: function get(name, priorityHost, serviceGroup) {\n var catalog = this._getCatalog();\n return catalog.get(name, priorityHost, serviceGroup);\n },\n /**\n * Determine if the catalog contains a specific service\n *\n * @param {string} serviceName - The service name to validate.\n * @returns {boolean} - True if the service exists.\n */\n hasService: function hasService(serviceName) {\n return !!this.get(serviceName);\n },\n /**\n * Determine if a whilelist exists in the service catalog.\n *\n * @returns {boolean} - True if a allowed domains list exists.\n */\n hasAllowedDomains: function hasAllowedDomains() {\n var catalog = this._getCatalog();\n return catalog.getAllowedDomains().length > 0;\n },\n /**\n * Generate a service catalog as an object from\n * the associated instance catalog.\n * @param {boolean} [priorityHost] - use highest priority host if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list: function list(priorityHost, serviceGroup) {\n var catalog = this._getCatalog();\n return catalog.list(priorityHost, serviceGroup);\n },\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl: function markFailedUrl(url, noPriorityHosts) {\n var catalog = this._getCatalog();\n return catalog.markFailedUrl(url, noPriorityHosts);\n },\n /**\n * saves all the services from the pre and post catalog service\n * @param {Object} serviceUrls\n * @returns {void}\n */\n _updateServiceUrls: function _updateServiceUrls(serviceUrls) {\n this._serviceUrls = _objectSpread(_objectSpread({}, this._serviceUrls), serviceUrls);\n },\n /**\n * saves the hostCatalog object\n * @param {Object} hostCatalog\n * @returns {void}\n */\n _updateHostCatalog: function _updateHostCatalog(hostCatalog) {\n this._hostCatalog = _objectSpread(_objectSpread({}, this._hostCatalog), hostCatalog);\n },\n /**\n * Update a list of `serviceUrls` to the most current\n * catalog via the defined `discoveryUrl` then returns the current\n * list of services.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n updateServices: function updateServices() {\n var _this = this;\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n from = _ref.from,\n query = _ref.query,\n token = _ref.token,\n forceRefresh = _ref.forceRefresh;\n var catalog = this._getCatalog();\n var formattedQuery;\n var serviceGroup;\n\n // map catalog name to service group name.\n switch (from) {\n case 'limited':\n serviceGroup = 'preauth';\n break;\n case 'signin':\n serviceGroup = 'signin';\n break;\n default:\n serviceGroup = 'postauth';\n break;\n }\n\n // confirm catalog update for group is not in progress.\n if (catalog.status[serviceGroup].collecting) {\n return this.waitForCatalog(serviceGroup);\n }\n catalog.status[serviceGroup].collecting = true;\n if (serviceGroup === 'preauth') {\n var queryKey = query && (0, _keys.default)(query)[0];\n if (!['email', 'emailhash', 'userId', 'orgId', 'mode'].includes(queryKey)) {\n return _promise.default.reject(new Error('a query param of email, emailhash, userId, orgId, or mode is required'));\n }\n }\n // encode email when query key is email\n if (serviceGroup === 'preauth' || serviceGroup === 'signin') {\n var _queryKey = (0, _keys.default)(query)[0];\n formattedQuery = {};\n if (_queryKey === 'email' && query.email) {\n formattedQuery.emailhash = (0, _sha.default)(query.email.toLowerCase()).toString();\n } else {\n formattedQuery[_queryKey] = query[_queryKey];\n }\n }\n return this._fetchNewServiceHostmap({\n from: from,\n token: token,\n query: formattedQuery,\n forceRefresh: forceRefresh\n }).then(function (serviceHostMap) {\n catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n _this.updateCredentialsConfig();\n catalog.status[serviceGroup].collecting = false;\n }).catch(function (error) {\n catalog.status[serviceGroup].collecting = false;\n return _promise.default.reject(error);\n });\n },\n /**\n * User validation parameter transfer object for {@link validateUser}.\n * @param {object} ValidateUserPTO\n * @property {string} ValidateUserPTO.email - The email of the user.\n * @property {string} [ValidateUserPTO.reqId] - The activation requester.\n * @property {object} [ValidateUserPTO.activationOptions] - Extra options to pass when sending the activation\n * @property {object} [ValidateUserPTO.preloginUserId] - The prelogin user id to set when sending the activation.\n */\n /**\n * User validation return transfer object for {@link validateUser}.\n * @param {object} ValidateUserRTO\n * @property {boolean} ValidateUserRTO.activated - If the user is activated.\n * @property {boolean} ValidateUserRTO.exists - If the user exists.\n * @property {string} ValidateUserRTO.details - A descriptive status message.\n * @property {object} ValidateUserRTO.user - **License** service user object.\n */\n /**\n * Validate if a user is activated and update the service catalogs as needed\n * based on the user's activation status.\n *\n * @param {ValidateUserPTO} - The parameter transfer object.\n * @returns {ValidateUserRTO} - The return transfer object.\n */\n validateUser: function validateUser(_ref2) {\n var _this2 = this;\n var email = _ref2.email,\n _ref2$reqId = _ref2.reqId,\n reqId = _ref2$reqId === void 0 ? 'WEBCLIENT' : _ref2$reqId,\n _ref2$forceRefresh = _ref2.forceRefresh,\n forceRefresh = _ref2$forceRefresh === void 0 ? false : _ref2$forceRefresh,\n _ref2$activationOptio = _ref2.activationOptions,\n activationOptions = _ref2$activationOptio === void 0 ? {} : _ref2$activationOptio,\n preloginUserId = _ref2.preloginUserId;\n this.logger.info('services: validating a user');\n\n // Validate that an email parameter key was provided.\n if (!email) {\n return _promise.default.reject(new Error('`email` is required'));\n }\n\n // Destructure the credentials object.\n var canAuthorize = this.webex.credentials.canAuthorize;\n\n // Validate that the user is already authorized.\n if (canAuthorize) {\n return this.updateServices({\n forceRefresh: forceRefresh\n }).then(function () {\n return _this2.webex.credentials.getUserToken();\n }).then(function (token) {\n return _this2.sendUserActivation({\n email: email,\n reqId: reqId,\n token: token.toString(),\n activationOptions: activationOptions,\n preloginUserId: preloginUserId\n });\n }).then(function (userObj) {\n return {\n activated: true,\n exists: true,\n details: 'user is authorized via a user token',\n user: userObj\n };\n });\n }\n\n // Destructure the client authorization details.\n /* eslint-disable camelcase */\n var _this$webex$credentia = this.webex.credentials.config,\n client_id = _this$webex$credentia.client_id,\n client_secret = _this$webex$credentia.client_secret;\n\n // Validate that client authentication details exist.\n if (!client_id || !client_secret) {\n return _promise.default.reject(new Error('client authentication details are not available'));\n }\n /* eslint-enable camelcase */\n\n // Declare a class-memeber-scoped token for usage within the promise chain.\n var token;\n\n // Begin client authentication user validation.\n return this.collectPreauthCatalog({\n email: email\n }).then(function () {\n // Retrieve the service url from the updated catalog. This is required\n // since `WebexCore` is usually not fully initialized at the time this\n // request completes.\n var idbrokerService = _this2.get('idbroker', true);\n\n // Collect the client auth token.\n return _this2.webex.credentials.getClientToken({\n uri: \"\".concat(idbrokerService, \"idb/oauth2/v1/access_token\"),\n scope: 'webexsquare:admin webexsquare:get_conversation Identity:SCIM'\n });\n }).then(function (tokenObj) {\n // Generate the token string.\n token = tokenObj.toString();\n\n // Collect the signin catalog using the client auth information.\n return _this2.collectSigninCatalog({\n email: email,\n token: token,\n forceRefresh: forceRefresh\n });\n })\n // Validate if collecting the signin catalog failed and populate the RTO\n // with the appropriate content.\n .catch(function (error) {\n return {\n exists: error.name !== 'NotFound',\n activated: false,\n details: error.name !== 'NotFound' ? 'user exists but is not activated' : 'user does not exist and is not activated'\n };\n })\n // Validate if the previous promise resolved with an RTO and populate the\n // new RTO accordingly.\n .then(function (rto) {\n return _promise.default.all([rto || {\n activated: true,\n exists: true,\n details: 'user exists and is activated'\n }, _this2.sendUserActivation({\n email: email,\n reqId: reqId,\n token: token,\n activationOptions: activationOptions,\n preloginUserId: preloginUserId\n })]);\n }).then(function (_ref3) {\n var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),\n rto = _ref4[0],\n user = _ref4[1];\n return _objectSpread(_objectSpread({}, rto), {}, {\n user: user\n });\n }).catch(function (error) {\n var response = {\n statusCode: error.statusCode,\n responseText: error.body && error.body.message,\n body: error.body\n };\n return _promise.default.reject(response);\n });\n },\n /**\n * Get user meeting preferences (preferred webex site).\n *\n * @returns {object} - User Information including user preferrences .\n */\n getMeetingPreferences: function getMeetingPreferences() {\n var _this3 = this;\n return this.request({\n method: 'GET',\n service: 'hydra',\n resource: 'meetingPreferences'\n }).then(function (res) {\n _this3.logger.info('services: received user region info');\n return res.body;\n }).catch(function (err) {\n _this3.logger.info('services: was not able to fetch user login information', err);\n // resolve successfully even if request failed\n });\n },\n /**\n * Fetches client region info such as countryCode and timezone.\n *\n * @returns {object} - The region info object.\n */\n fetchClientRegionInfo: function fetchClientRegionInfo() {\n var _this4 = this;\n var services = this.webex.config.services;\n return this.request({\n uri: services.discovery.sqdiscovery,\n addAuthHeader: false,\n headers: {\n 'spark-user-agent': null\n },\n timeout: 5000\n }).then(function (res) {\n _this4.logger.info('services: received user region info');\n return res.body;\n }).catch(function (err) {\n _this4.logger.info('services: was not able to get user region info', err);\n // resolve successfully even if request failed\n });\n },\n /**\n * User activation parameter transfer object for {@link sendUserActivation}.\n * @typedef {object} SendUserActivationPTO\n * @property {string} SendUserActivationPTO.email - The email of the user.\n * @property {string} SendUserActivationPTO.reqId - The activation requester.\n * @property {string} SendUserActivationPTO.token - The client auth token.\n * @property {object} SendUserActivationPTO.activationOptions - Extra options to pass when sending the activation.\n * @property {object} SendUserActivationPTO.preloginUserId - The prelogin user id to set when sending the activation.\n */\n /**\n * Send a request to activate a user using a client token.\n *\n * @param {SendUserActivationPTO} - The Parameter transfer object.\n * @returns {LicenseDTO} - The DTO returned from the **License** service.\n */\n sendUserActivation: function sendUserActivation(_ref5) {\n var _this5 = this;\n var email = _ref5.email,\n reqId = _ref5.reqId,\n token = _ref5.token,\n activationOptions = _ref5.activationOptions,\n preloginUserId = _ref5.preloginUserId;\n this.logger.info('services: sending user activation request');\n var countryCode;\n var timezone;\n\n // try to fetch client region info first\n return this.fetchClientRegionInfo().then(function (clientRegionInfo) {\n if (clientRegionInfo) {\n countryCode = clientRegionInfo.countryCode;\n timezone = clientRegionInfo.timezone;\n }\n\n // Send the user activation request to the **License** service.\n return _this5.request({\n service: 'license',\n resource: 'users/activations',\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: token,\n 'x-prelogin-userid': preloginUserId\n },\n body: _objectSpread({\n email: email,\n reqId: reqId,\n countryCode: countryCode,\n timeZone: timezone\n }, activationOptions),\n shouldRefreshAccessToken: false\n });\n })\n // On success, return the **License** user object.\n .then(function (_ref6) {\n var body = _ref6.body;\n return body;\n })\n // On failure, reject with error from **License**.\n .catch(function (error) {\n return _promise.default.reject(error);\n });\n },\n /**\n * Updates a given service group i.e. preauth, signin, postauth with a new hostmap.\n * @param {string} serviceGroup - preauth, signin, postauth\n * @param {object} hostMap - The new hostmap to update the service group with.\n * @returns {Promise<void>}\n */\n updateCatalog: function updateCatalog(serviceGroup, hostMap) {\n var catalog = this._getCatalog();\n var serviceHostMap = this._formatReceivedHostmap(hostMap);\n return catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n },\n /**\n * simplified method to update the preauth catalog via email\n *\n * @param {object} query\n * @param {string} query.email - A standard format email.\n * @param {string} query.orgId - The user's OrgId.\n * @param {boolean} forceRefresh - Boolean to bypass u2c cache control header\n * @returns {Promise<void>}\n */\n collectPreauthCatalog: function collectPreauthCatalog(query) {\n var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!query) {\n return this.updateServices({\n from: 'limited',\n query: {\n mode: 'DEFAULT_BY_PROXIMITY'\n },\n forceRefresh: forceRefresh\n });\n }\n return this.updateServices({\n from: 'limited',\n query: query,\n forceRefresh: forceRefresh\n });\n },\n /**\n * simplified method to update the signin catalog via email and token\n * @param {object} param\n * @param {string} param.email - must be a standard-format email\n * @param {string} param.token - must be a client token\n * @returns {Promise<void>}\n */\n collectSigninCatalog: function collectSigninCatalog() {\n var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n email = _ref7.email,\n token = _ref7.token,\n forceRefresh = _ref7.forceRefresh;\n if (!email) {\n return _promise.default.reject(new Error('`email` is required'));\n }\n if (!token) {\n return _promise.default.reject(new Error('`token` is required'));\n }\n return this.updateServices({\n from: 'signin',\n query: {\n email: email\n },\n token: token,\n forceRefresh: forceRefresh\n });\n },\n /**\n * Updates credentials config to utilize u2c catalog\n * urls.\n * @returns {void}\n */\n updateCredentialsConfig: function updateCredentialsConfig() {\n var _this$list = this.list(true),\n idbroker = _this$list.idbroker,\n identity = _this$list.identity;\n if (idbroker && identity) {\n var _this$webex$config$cr = this.webex.config.credentials,\n authorizationString = _this$webex$config$cr.authorizationString,\n authorizeUrl = _this$webex$config$cr.authorizeUrl;\n\n // This must be set outside of the setConfig method used to assign the\n // idbroker and identity url values.\n this.webex.config.credentials.authorizeUrl = authorizationString ? authorizeUrl : \"\".concat(idbroker.replace(trailingSlashes, ''), \"/idb/oauth2/v1/authorize\");\n this.webex.setConfig({\n credentials: {\n idbroker: {\n url: idbroker.replace(trailingSlashes, '') // remove trailing slash\n },\n\n identity: {\n url: identity.replace(trailingSlashes, '') // remove trailing slash\n }\n }\n });\n }\n },\n /**\n * Wait until the service catalog is available,\n * or reject afte ra timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog: function waitForCatalog(serviceGroup, timeout) {\n var catalog = this._getCatalog();\n var supertoken = this.webex.credentials.supertoken;\n if (serviceGroup === 'postauth' && supertoken && supertoken.access_token && !catalog.status.postauth.collecting && !catalog.status.postauth.ready) {\n if (!catalog.status.preauth.ready) {\n return this.initServiceCatalogs();\n }\n return this.updateServices();\n }\n return catalog.waitForCatalog(serviceGroup, timeout);\n },\n /**\n * Service waiting parameter transfer object for {@link waitForService}.\n *\n * @typedef {object} WaitForServicePTO\n * @property {string} [WaitForServicePTO.name] - The service name.\n * @property {string} [WaitForServicePTO.url] - The service url.\n * @property {string} [WaitForServicePTO.timeout] - wait duration in seconds.\n */\n /**\n * Wait until the service has been ammended to any service catalog. This\n * method prioritizes the service name over the service url when searching.\n *\n * @param {WaitForServicePTO} - The parameter transfer object.\n * @returns {Promise<string>} - Resolves to the priority host of a service.\n */\n waitForService: function waitForService(_ref8) {\n var _this6 = this;\n var name = _ref8.name,\n _ref8$timeout = _ref8.timeout,\n timeout = _ref8$timeout === void 0 ? 5 : _ref8$timeout,\n url = _ref8.url;\n var services = this.webex.config.services;\n\n // Save memory by grabbing the catalog after there isn't a priortyURL\n var catalog = this._getCatalog();\n var fetchFromServiceUrl = services.servicesNotNeedValidation.find(function (service) {\n return service === name;\n });\n if (fetchFromServiceUrl) {\n return _promise.default.resolve(this._serviceUrls[name]);\n }\n var priorityUrl = this.get(name, true);\n var priorityUrlObj = this.getServiceFromUrl(url);\n if (priorityUrl || priorityUrlObj) {\n return _promise.default.resolve(priorityUrl || priorityUrlObj.priorityUrl);\n }\n if (catalog.isReady) {\n if (url) {\n return _promise.default.resolve(url);\n }\n this.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {\n service_name: name\n }\n });\n return _promise.default.reject(new Error(\"services: service '\".concat(name, \"' was not found in any of the catalogs\")));\n }\n return new _promise.default(function (resolve, reject) {\n var groupsToCheck = ['preauth', 'signin', 'postauth'];\n var checkCatalog = function checkCatalog(catalogGroup) {\n return catalog.waitForCatalog(catalogGroup, timeout).then(function () {\n var scopedPriorityUrl = _this6.get(name, true);\n var scopedPrioriryUrlObj = _this6.getServiceFromUrl(url);\n if (scopedPriorityUrl || scopedPrioriryUrlObj) {\n resolve(scopedPriorityUrl || scopedPrioriryUrlObj.priorityUrl);\n }\n }).catch(function () {\n return undefined;\n });\n };\n _promise.default.all(groupsToCheck.map(function (group) {\n return checkCatalog(group);\n })).then(function () {\n _this6.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {\n service_name: name\n }\n });\n reject(new Error(\"services: service '\".concat(name, \"' was not found after waiting\")));\n });\n });\n },\n /**\n * Looks up the hostname in the host catalog\n * and replaces it with the first host if it finds it\n * @param {string} uri\n * @returns {string} uri with the host replaced\n */\n replaceHostFromHostmap: function replaceHostFromHostmap(uri) {\n var url = new URL(uri);\n var hostCatalog = this._hostCatalog;\n if (!hostCatalog) {\n return uri;\n }\n var host = hostCatalog[url.host];\n if (host && host[0]) {\n var newHost = host[0].host;\n url.host = newHost;\n return url.toString();\n }\n return uri;\n },\n /**\n * @private\n * Organize a received hostmap from a service\n * catalog endpoint.\n * @param {object} serviceHostmap\n * @returns {object}\n */\n _formatReceivedHostmap: function _formatReceivedHostmap(serviceHostmap) {\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n var extractId = function extractId(entry) {\n return entry.id.split(':')[3];\n };\n var formattedHostmap = [];\n\n // for each of the services in the serviceLinks, find the matching host in the catalog\n (0, _keys.default)(serviceHostmap.serviceLinks).forEach(function (serviceName) {\n var _formattedHost$hosts;\n var serviceUrl = serviceHostmap.serviceLinks[serviceName];\n var host;\n try {\n host = new URL(serviceUrl).host;\n } catch (e) {\n return;\n }\n var matchingCatalogEntry = serviceHostmap.hostCatalog[host];\n var formattedHost = {\n name: serviceName,\n defaultUrl: serviceUrl,\n defaultHost: host,\n hosts: []\n };\n formattedHostmap.push(formattedHost);\n\n // If the catalog does not have any hosts we will be unable to find the service ID\n // so can't search for other hosts\n if (!matchingCatalogEntry || !matchingCatalogEntry[0]) {\n return;\n }\n var serviceId = extractId(matchingCatalogEntry[0]);\n (0, _lodash.forEach)(matchingCatalogEntry, function (entry) {\n // The ids for all hosts within a hostCatalog entry should be the same\n // but for safety, only add host entries that have the same id as the first one\n if (extractId(entry) === serviceId) {\n formattedHost.hosts.push(_objectSpread(_objectSpread({}, entry), {}, {\n homeCluster: true\n }));\n }\n });\n var otherHosts = [];\n\n // find the services in the host catalog that have the same id\n // and add them to the otherHosts\n (0, _lodash.forEach)(serviceHostmap.hostCatalog, function (entry) {\n // exclude the matching catalog entry as we have already added that\n if (entry === matchingCatalogEntry) {\n return;\n }\n (0, _lodash.forEach)(entry, function (entryHost) {\n // only add hosts that have the correct id\n if (extractId(entryHost) === serviceId) {\n otherHosts.push(_objectSpread(_objectSpread({}, entryHost), {}, {\n homeCluster: false\n }));\n }\n });\n });\n (_formattedHost$hosts = formattedHost.hosts).push.apply(_formattedHost$hosts, otherHosts);\n });\n\n // update all the service urls in the host catalog\n\n this._updateServiceUrls(serviceHostmap.serviceLinks);\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n return formattedHostmap;\n },\n /**\n * Get the clusterId associated with a URL string.\n * @param {string} url\n * @returns {string} - Cluster ID of url provided\n */\n getClusterId: function getClusterId(url) {\n var catalog = this._getCatalog();\n return catalog.findClusterId(url);\n },\n /**\n * Get a service value from a provided clusterId. This method will\n * return an object containing both the name and url of a found service.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n getServiceFromClusterId: function getServiceFromClusterId(params) {\n var catalog = this._getCatalog();\n return catalog.findServiceFromClusterId(params);\n },\n /**\n * @param {String} cluster the cluster containing the id\n * @param {UUID} [id] the id of the conversation.\n * If empty, just return the base URL.\n * @returns {String} url of the service\n */\n getServiceUrlFromClusterId: function getServiceUrlFromClusterId() {\n var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref9$cluster = _ref9.cluster,\n cluster = _ref9$cluster === void 0 ? 'us' : _ref9$cluster;\n var clusterId = cluster === 'us' ? DEFAULT_CLUSTER_IDENTIFIER : cluster;\n\n // Determine if cluster has service name (non-US clusters from hydra do not)\n if (clusterId.split(':').length < 4) {\n // Add Service to cluster identifier\n clusterId = \"\".concat(cluster, \":\").concat(CLUSTER_SERVICE);\n }\n var _ref10 = this.getServiceFromClusterId({\n clusterId: clusterId\n }) || {},\n url = _ref10.url;\n if (!url) {\n throw Error(\"Could not find service for cluster [\".concat(cluster, \"]\"));\n }\n return url;\n },\n /**\n * Get a service object from a service url if the service url exists in the\n * catalog.\n *\n * @param {string} url - The url to be validated.\n * @returns {object} - Service object.\n * @returns {object.name} - The name of the service found.\n * @returns {object.priorityUrl} - The priority url of the found service.\n * @returns {object.defaultUrl} - The default url of the found service.\n */\n getServiceFromUrl: function getServiceFromUrl() {\n var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var service = this._getCatalog().findServiceUrlFromUrl(url);\n if (!service) {\n return undefined;\n }\n return {\n name: service.name,\n priorityUrl: service.get(true),\n defaultUrl: service.get()\n };\n },\n /**\n * Verify that a provided url exists in the service\n * catalog.\n * @param {string} url\n * @returns {boolean} - true if exists, false otherwise\n */\n isServiceUrl: function isServiceUrl(url) {\n var catalog = this._getCatalog();\n return !!catalog.findServiceUrlFromUrl(url);\n },\n /**\n * Determine if a provided url is in the catalog's allowed domains.\n *\n * @param {string} url - The url to match allowed domains against.\n * @returns {boolean} - True if the url provided is allowed.\n */\n isAllowedDomainUrl: function isAllowedDomainUrl(url) {\n var catalog = this._getCatalog();\n return !!catalog.findAllowedDomain(url);\n },\n /**\n * Converts the host portion of the url from default host\n * to a priority host\n *\n * @param {string} url a service url that contains a default host\n * @returns {string} a service url that contains the top priority host.\n * @throws if url isn't a service url\n */\n convertUrlToPriorityHostUrl: function convertUrlToPriorityHostUrl() {\n var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var data = this.getServiceFromUrl(url);\n if (!data) {\n throw Error(\"No service associated with url: [\".concat(url, \"]\"));\n }\n return url.replace(data.defaultUrl, data.priorityUrl);\n },\n /**\n * @private\n * Simplified method wrapper for sending a request to get\n * an updated service hostmap.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n _fetchNewServiceHostmap: function _fetchNewServiceHostmap() {\n var _this7 = this;\n var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n from = _ref11.from,\n query = _ref11.query,\n token = _ref11.token,\n forceRefresh = _ref11.forceRefresh;\n var service = 'u2c';\n var resource = from ? \"/\".concat(from, \"/catalog\") : '/catalog';\n var qs = _objectSpread(_objectSpread({}, query), {}, {\n format: 'hostmap'\n });\n if (forceRefresh) {\n qs.timestamp = new Date().getTime();\n }\n var requestObject = {\n method: 'GET',\n service: service,\n resource: resource,\n qs: qs\n };\n if (token) {\n requestObject.headers = {\n authorization: token\n };\n }\n return this.webex.internal.newMetrics.callDiagnosticLatencies.measureLatency(function () {\n return _this7.request(requestObject);\n }, 'internal.get.u2c.time').then(function (_ref12) {\n var body = _ref12.body;\n return _this7._formatReceivedHostmap(body);\n });\n },\n /**\n * Initialize the discovery services and the whitelisted services.\n *\n * @returns {void}\n */\n initConfig: function initConfig() {\n // Get the catalog and destructure the services config.\n var catalog = this._getCatalog();\n var _this$webex$config = this.webex.config,\n services = _this$webex$config.services,\n fedramp = _this$webex$config.fedramp;\n\n // Validate that the services configuration exists.\n if (services) {\n if (fedramp) {\n services.discovery = _serviceFedRamp.default;\n }\n // Check for discovery services.\n if (services.discovery) {\n // Format the discovery configuration into an injectable array.\n var formattedDiscoveryServices = (0, _keys.default)(services.discovery).map(function (key) {\n return {\n name: key,\n defaultUrl: services.discovery[key]\n };\n });\n\n // Inject formatted discovery services into services catalog.\n catalog.updateServiceUrls('discovery', formattedDiscoveryServices);\n }\n if (services.override) {\n // Format the override configuration into an injectable array.\n var formattedOverrideServices = (0, _keys.default)(services.override).map(function (key) {\n return {\n name: key,\n defaultUrl: services.override[key]\n };\n });\n\n // Inject formatted override services into services catalog.\n catalog.updateServiceUrls('override', formattedOverrideServices);\n }\n\n // if not fedramp, append on the commercialAllowedDomains\n if (!fedramp) {\n services.allowedDomains = (0, _lodash.union)(services.allowedDomains, _constants.COMMERCIAL_ALLOWED_DOMAINS);\n }\n\n // Check for allowed host domains.\n if (services.allowedDomains) {\n // Store the allowed domains as a property of the catalog.\n catalog.setAllowedDomains(services.allowedDomains);\n }\n\n // Set `validateDomains` property to match configuration\n this.validateDomains = services.validateDomains;\n }\n },\n /**\n * Make the initial requests to collect the root catalogs.\n *\n * @returns {Promise<void, Error>} - Errors if the token is unavailable.\n */\n initServiceCatalogs: function initServiceCatalogs() {\n var _this8 = this;\n this.logger.info('services: initializing initial service catalogs');\n\n // Destructure the credentials plugin.\n var credentials = this.webex.credentials;\n\n // Init a promise chain. Must be done as a Promise.resolve() to allow\n // credentials#getOrgId() to properly throw.\n return _promise.default.resolve()\n // Get the user's OrgId.\n .then(function () {\n return credentials.getOrgId();\n })\n // Begin collecting the preauth/limited catalog.\n .then(function (orgId) {\n return _this8.collectPreauthCatalog({\n orgId: orgId\n });\n }).then(function () {\n // Validate if the token is authorized.\n if (credentials.canAuthorize) {\n // Attempt to collect the postauth catalog.\n return _this8.updateServices().catch(function () {\n _this8.initFailed = true;\n _this8.logger.warn('services: cannot retrieve postauth catalog');\n });\n }\n\n // Return a resolved promise for consistent return value.\n return _promise.default.resolve();\n });\n },\n /**\n * Initializer\n *\n * @instance\n * @memberof Services\n * @returns {Services}\n */\n initialize: function initialize() {\n var _this9 = this;\n var catalog = new _serviceCatalog.default();\n var registry = new _serviceRegistry.default();\n var state = new _serviceState.default();\n this._catalogs.set(this.webex, catalog);\n this.registries.set(this.webex, registry);\n this.states.set(this.webex, state);\n\n // Listen for configuration changes once.\n this.listenToOnce(this.webex, 'change:config', function () {\n _this9.initConfig();\n });\n\n // wait for webex instance to be ready before attempting\n // to update the service catalogs\n this.listenToOnce(this.webex, 'ready', function () {\n var supertoken = _this9.webex.credentials.supertoken;\n // Validate if the supertoken exists.\n if (supertoken && supertoken.access_token) {\n _this9.initServiceCatalogs().then(function () {\n catalog.isReady = true;\n }).catch(function (error) {\n _this9.initFailed = true;\n _this9.logger.error(\"services: failed to init initial services when credentials available, \".concat(error === null || error === void 0 ? void 0 : error.message));\n });\n } else {\n var email = _this9.webex.config.email;\n _this9.collectPreauthCatalog(email ? {\n email: email\n } : undefined).catch(function (error) {\n _this9.initFailed = true;\n _this9.logger.error(\"services: failed to init initial services when no credentials available, \".concat(error === null || error === void 0 ? void 0 : error.message));\n });\n }\n });\n },\n version: \"3.8.0-next.11\"\n});\n/* eslint-enable no-underscore-dangle */\nvar _default = exports[\"default\"] = Services;\n//# sourceMappingURL=services.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/lib/services/services.js?");
4473
4473
 
4474
4474
  /***/ }),
4475
4475
 
@@ -4601,7 +4601,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
4601
4601
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4602
4602
 
4603
4603
  "use strict";
4604
- eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../lib/webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _webexCore = __webpack_require__(/*! ../webex-core */ \"../../../node_modules/@webex/webex-core/dist/webex-core.js\");\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar precedence = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log']\n};\n\n/**\n * Assigns the specified console method to Logger; uses `precedence` to fallback\n * to other console methods if the current environment doesn't provide the\n * specified level.\n * @param {string} level\n * @returns {Function}\n */\nfunction wrapConsoleMethod(level) {\n /* eslint no-console: [0] */\n var impls = precedence[level];\n if (impls) {\n impls = impls.slice();\n while (!console[level]) {\n level = impls.pop();\n }\n }\n return function wrappedConsoleMethod() {\n var _console;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n /* eslint no-invalid-this: [0] */\n /* istanbul ignore if */\n if (false) {}\n (_console = console)[level].apply(_console, args);\n };\n}\nvar Logger = _webexPlugin.default.extend({\n namespace: 'Logger',\n error: wrapConsoleMethod('error'),\n warn: wrapConsoleMethod('warn'),\n log: wrapConsoleMethod('log'),\n info: wrapConsoleMethod('info'),\n debug: wrapConsoleMethod('debug'),\n trace: wrapConsoleMethod('trace'),\n version: \"3.8.0-next.10\"\n});\n(0, _webexCore.registerPlugin)('logger', Logger);\nvar _default = exports[\"default\"] = Logger;\n//# sourceMappingURL=logger.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/plugins/logger.js?");
4604
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _webexPlugin = _interopRequireDefault(__webpack_require__(/*! ../lib/webex-plugin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-plugin.js\"));\nvar _webexCore = __webpack_require__(/*! ../webex-core */ \"../../../node_modules/@webex/webex-core/dist/webex-core.js\");\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar precedence = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log']\n};\n\n/**\n * Assigns the specified console method to Logger; uses `precedence` to fallback\n * to other console methods if the current environment doesn't provide the\n * specified level.\n * @param {string} level\n * @returns {Function}\n */\nfunction wrapConsoleMethod(level) {\n /* eslint no-console: [0] */\n var impls = precedence[level];\n if (impls) {\n impls = impls.slice();\n while (!console[level]) {\n level = impls.pop();\n }\n }\n return function wrappedConsoleMethod() {\n var _console;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n /* eslint no-invalid-this: [0] */\n /* istanbul ignore if */\n if (false) {}\n (_console = console)[level].apply(_console, args);\n };\n}\nvar Logger = _webexPlugin.default.extend({\n namespace: 'Logger',\n error: wrapConsoleMethod('error'),\n warn: wrapConsoleMethod('warn'),\n log: wrapConsoleMethod('log'),\n info: wrapConsoleMethod('info'),\n debug: wrapConsoleMethod('debug'),\n trace: wrapConsoleMethod('trace'),\n version: \"3.8.0-next.11\"\n});\n(0, _webexCore.registerPlugin)('logger', Logger);\nvar _default = exports[\"default\"] = Logger;\n//# sourceMappingURL=logger.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/plugins/logger.js?");
4605
4605
 
4606
4606
  /***/ }),
4607
4607
 
@@ -4612,7 +4612,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
4612
4612
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4613
4613
 
4614
4614
  "use strict";
4615
- eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nexports.registerInternalPlugin = registerInternalPlugin;\nexports.registerPlugin = registerPlugin;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _events = __webpack_require__(/*! events */ \"../../../node_modules/events/events.js\");\nvar _util = _interopRequireDefault(__webpack_require__(/*! util */ \"../../../node_modules/util/util.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _httpCore = __webpack_require__(/*! @webex/http-core */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/http-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _ampersandState = _interopRequireDefault(__webpack_require__(/*! ampersand-state */ \"../../../node_modules/ampersand-state/ampersand-state.js\"));\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _auth = _interopRequireDefault(__webpack_require__(/*! ./interceptors/auth */ \"../../../node_modules/@webex/webex-core/dist/interceptors/auth.js\"));\nvar _networkTiming = _interopRequireDefault(__webpack_require__(/*! ./interceptors/network-timing */ \"../../../node_modules/@webex/webex-core/dist/interceptors/network-timing.js\"));\nvar _payloadTransformer = _interopRequireDefault(__webpack_require__(/*! ./interceptors/payload-transformer */ \"../../../node_modules/@webex/webex-core/dist/interceptors/payload-transformer.js\"));\nvar _redirect = _interopRequireDefault(__webpack_require__(/*! ./interceptors/redirect */ \"../../../node_modules/@webex/webex-core/dist/interceptors/redirect.js\"));\nvar _requestEvent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-event */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-event.js\"));\nvar _requestLogger = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-logger */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-logger.js\"));\nvar _requestTiming = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-timing */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-timing.js\"));\nvar _responseLogger = _interopRequireDefault(__webpack_require__(/*! ./interceptors/response-logger */ \"../../../node_modules/@webex/webex-core/dist/interceptors/response-logger.js\"));\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\nvar _userAgent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/user-agent */ \"../../../node_modules/@webex/webex-core/dist/interceptors/user-agent.js\"));\nvar _webexTrackingId = _interopRequireDefault(__webpack_require__(/*! ./interceptors/webex-tracking-id */ \"../../../node_modules/@webex/webex-core/dist/interceptors/webex-tracking-id.js\"));\nvar _webexUserAgent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/webex-user-agent */ \"../../../node_modules/@webex/webex-core/dist/interceptors/webex-user-agent.js\"));\nvar _rateLimit = _interopRequireDefault(__webpack_require__(/*! ./interceptors/rate-limit */ \"../../../node_modules/@webex/webex-core/dist/interceptors/rate-limit.js\"));\nvar _embargo = _interopRequireDefault(__webpack_require__(/*! ./interceptors/embargo */ \"../../../node_modules/@webex/webex-core/dist/interceptors/embargo.js\"));\nvar _defaultOptions = _interopRequireDefault(__webpack_require__(/*! ./interceptors/default-options */ \"../../../node_modules/@webex/webex-core/dist/interceptors/default-options.js\"));\nvar _hostmap = _interopRequireDefault(__webpack_require__(/*! ./lib/services/interceptors/hostmap */ \"../../../node_modules/@webex/webex-core/dist/lib/services/interceptors/hostmap.js\"));\nvar _config = _interopRequireDefault(__webpack_require__(/*! ./config */ \"../../../node_modules/@webex/webex-core/dist/config.js\"));\nvar _storage = __webpack_require__(/*! ./lib/storage */ \"../../../node_modules/@webex/webex-core/dist/lib/storage/index.js\");\nvar _webexCorePluginMixin = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-core-plugin-mixin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-core-plugin-mixin.js\"));\nvar _webexInternalCorePluginMixin = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-internal-core-plugin-mixin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-internal-core-plugin-mixin.js\"));\nvar _webexInternalCore = _interopRequireDefault(__webpack_require__(/*! ./webex-internal-core */ \"../../../node_modules/@webex/webex-core/dist/webex-internal-core.js\"));\nvar _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n// TODO replace the Interceptor.create with Reflect.construct (\n// Interceptor.create exists because new was really hard to call on an array of\n// constructors)\nvar interceptors = {\n WebexTrackingIdInterceptor: _webexTrackingId.default.create,\n RequestEventInterceptor: _requestEvent.default.create,\n RateLimitInterceptor: _rateLimit.default.create,\n /* eslint-disable no-extra-parens */\n RequestLoggerInterceptor: process.env.ENABLE_NETWORK_LOGGING || process.env.ENABLE_VERBOSE_NETWORK_LOGGING ? _requestLogger.default.create : undefined,\n ResponseLoggerInterceptor: process.env.ENABLE_NETWORK_LOGGING || process.env.ENABLE_VERBOSE_NETWORK_LOGGING ? _responseLogger.default.create : undefined,\n /* eslint-enable no-extra-parens */\n RequestTimingInterceptor: _requestTiming.default.create,\n ServiceInterceptor: undefined,\n UserAgentInterceptor: _userAgent.default.create,\n WebexUserAgentInterceptor: _webexUserAgent.default.create,\n AuthInterceptor: _auth.default.create,\n KmsDryErrorInterceptor: undefined,\n PayloadTransformerInterceptor: _payloadTransformer.default.create,\n ConversationInterceptor: undefined,\n RedirectInterceptor: _redirect.default.create,\n HttpStatusInterceptor: function HttpStatusInterceptor() {\n return _httpCore.HttpStatusInterceptor.create({\n error: _webexHttpError.default\n });\n },\n NetworkTimingInterceptor: _networkTiming.default.create,\n EmbargoInterceptor: _embargo.default.create,\n DefaultOptionsInterceptor: _defaultOptions.default.create,\n HostMapInterceptor: _hostmap.default.create\n};\nvar preInterceptors = ['ResponseLoggerInterceptor', 'RequestTimingInterceptor', 'RequestEventInterceptor', 'WebexTrackingIdInterceptor', 'RateLimitInterceptor'];\nvar postInterceptors = ['HttpStatusInterceptor', 'NetworkTimingInterceptor', 'EmbargoInterceptor', 'RequestLoggerInterceptor', 'RateLimitInterceptor'];\nvar MAX_FILE_SIZE_IN_MB = 2048;\n\n/**\n * @class\n */\nvar WebexCore = _ampersandState.default.extend((_obj = {\n version: \"3.8.0-next.10\",\n children: {\n internal: _webexInternalCore.default\n },\n constructor: function constructor() {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof attrs === 'string') {\n attrs = {\n credentials: {\n supertoken: {\n // eslint-disable-next-line camelcase\n access_token: attrs\n }\n }\n };\n } else {\n // Reminder: order is important here\n ['credentials.authorization', 'authorization', 'credentials.supertoken.supertoken', 'supertoken', 'access_token', 'credentials.authorization.supertoken'].forEach(function (path) {\n var val = (0, _lodash.get)(attrs, path);\n if (val) {\n (0, _lodash.unset)(attrs, path);\n (0, _lodash.set)(attrs, 'credentials.supertoken', val);\n }\n });\n ['credentials', 'credentials.authorization'].forEach(function (path) {\n var val = (0, _lodash.get)(attrs, path);\n if (typeof val === 'string') {\n (0, _lodash.unset)(attrs, path);\n (0, _lodash.set)(attrs, 'credentials.supertoken', val);\n }\n });\n if (typeof (0, _lodash.get)(attrs, 'credentials.access_token') === 'string') {\n // Send access_token to get validated and corrected and then set it\n (0, _lodash.set)(attrs, 'credentials.access_token', this.bearerValidator((0, _lodash.get)(attrs, 'credentials.access_token').trim()));\n (0, _lodash.set)(attrs, 'credentials.supertoken', attrs.credentials);\n }\n }\n return (0, _apply.default)(_ampersandState.default, this, [attrs, options]);\n },\n derived: {\n boundedStorage: {\n deps: [],\n fn: function fn() {\n return (0, _storage.makeWebexStore)('bounded', this);\n }\n },\n unboundedStorage: {\n deps: [],\n fn: function fn() {\n return (0, _storage.makeWebexStore)('unbounded', this);\n }\n },\n ready: {\n deps: ['loaded', 'internal.ready'],\n fn: function fn() {\n var _this = this;\n return this.loaded && (0, _keys.default)(this._children).reduce(function (ready, name) {\n return ready && _this[name] && _this[name].ready !== false;\n }, true);\n }\n }\n },\n session: {\n config: {\n type: 'object'\n },\n /**\n * When true, indicates that the initial load from the storage layer is\n * complete\n * @instance\n * @memberof WebexCore\n * @type {boolean}\n */\n loaded: {\n default: false,\n type: 'boolean'\n },\n request: {\n setOnce: true,\n // It's supposed to be a function, but that's not a type defined in\n // Ampersand\n type: 'any'\n },\n sessionId: {\n type: 'string'\n }\n },\n /**\n * @instance\n * @memberof WebexCore\n * @param {[type]} args\n * @returns {[type]}\n */\n refresh: function refresh() {\n var _this$credentials;\n return (_this$credentials = this.credentials).refresh.apply(_this$credentials, arguments);\n },\n /**\n * Applies the directionally appropriate transforms to the specified object\n * @param {string} direction\n * @param {Object} object\n * @returns {Promise}\n */\n transform: function transform(direction, object) {\n var _this2 = this;\n var predicates = this.config.payloadTransformer.predicates.filter(function (p) {\n return !p.direction || p.direction === direction;\n });\n var ctx = {\n webex: this\n };\n return _promise.default.all(predicates.map(function (p) {\n return p.test(ctx, object).then(function (shouldTransform) {\n if (!shouldTransform) {\n return undefined;\n }\n return p.extract(object)\n // eslint-disable-next-line max-nested-callbacks\n .then(function (target) {\n return {\n name: p.name,\n target: target\n };\n });\n });\n })).then(function (data) {\n return data.filter(function (d) {\n return Boolean(d);\n })\n // eslint-disable-next-line max-nested-callbacks\n .reduce(function (promise, _ref) {\n var name = _ref.name,\n target = _ref.target,\n alias = _ref.alias;\n return promise.then(function () {\n if (alias) {\n return _this2.applyNamedTransform(direction, alias, target);\n }\n return _this2.applyNamedTransform(direction, name, target);\n });\n }, _promise.default.resolve());\n }).then(function () {\n return object;\n });\n },\n /**\n * Applies the directionally appropriate transform to the specified parameters\n * @param {string} direction\n * @param {Object} ctx\n * @param {string} name\n * @returns {Promise}\n */\n applyNamedTransform: function applyNamedTransform(direction, ctx, name) {\n var _this3 = this;\n for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {\n rest[_key - 3] = arguments[_key];\n }\n if ((0, _lodash.isString)(ctx)) {\n rest.unshift(name);\n name = ctx;\n ctx = {\n webex: this,\n transform: function transform() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _this3.applyNamedTransform.apply(_this3, [direction, ctx].concat(args));\n }\n };\n }\n var transforms = ctx.webex.config.payloadTransformer.transforms.filter(function (tx) {\n return tx.name === name && (!tx.direction || tx.direction === direction);\n });\n\n // too many implicit returns on the same line is difficult to interpret\n // eslint-disable-next-line arrow-body-style\n return transforms.reduce(function (promise, tx) {\n return promise.then(function () {\n if (tx.alias) {\n var _ctx;\n return (_ctx = ctx).transform.apply(_ctx, [tx.alias].concat(rest));\n }\n return _promise.default.resolve(tx.fn.apply(tx, [ctx].concat(rest)));\n });\n }, _promise.default.resolve()).then(function () {\n return (0, _lodash.last)(rest);\n });\n },\n /**\n * @private\n * @returns {Window}\n */\n getWindow: function getWindow() {\n // eslint-disable-next-line\n return window;\n },\n /**\n * Initializer\n *\n * @emits WebexCore#loaded\n * @emits WebexCore#ready\n * @instance\n * @memberof WebexCore\n * @param {Object} attrs\n * @returns {WebexCore}\n */\n initialize: function initialize() {\n var _this4 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.config = (0, _lodash.merge)({}, _config.default, attrs.config);\n\n // There's some unfortunateness with the way {@link AmpersandState#children}\n // get initialized. We'll fire the change:config event so that\n // {@link WebexPlugin#initialize()} can use\n // `this.listenToOnce(parent, 'change:config', () => {});` to act on config\n // during initialization\n this.trigger('change:config');\n var onLoaded = function onLoaded() {\n if (_this4.loaded) {\n /**\n * Fires when all data has been loaded from the storage layer\n * @event loaded\n * @instance\n * @memberof WebexCore\n */\n _this4.trigger('loaded');\n _this4.stopListening(_this4, 'change:loaded', onLoaded);\n }\n };\n\n // This needs to run on nextTick or we'll never be able to wire up listeners\n process.nextTick(function () {\n _this4.listenToAndRun(_this4, 'change:loaded', onLoaded);\n });\n var onReady = function onReady() {\n if (_this4.ready) {\n /**\n * Fires when all plugins have fully initialized\n * @event ready\n * @instance\n * @memberof WebexCore\n */\n _this4.trigger('ready');\n _this4.stopListening(_this4, 'change:ready', onReady);\n }\n };\n\n // This needs to run on nextTick or we'll never be able to wire up listeners\n process.nextTick(function () {\n _this4.listenToAndRun(_this4, 'change:ready', onReady);\n });\n\n // Make nested events propagate in a consistent manner\n (0, _keys.default)(this.constructor.prototype._children).forEach(function (key) {\n _this4.listenTo(_this4[key], 'change', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n args.unshift(\"change:\".concat(key));\n _this4.trigger.apply(_this4, args);\n });\n });\n var addInterceptor = function addInterceptor(ints, key) {\n var interceptorsObj = _this4.config.interceptors || interceptors;\n var interceptor = interceptorsObj[key];\n if (!(0, _lodash.isFunction)(interceptor)) {\n return ints;\n }\n ints.push((0, _apply.default)(interceptor, _this4, []));\n return ints;\n };\n var ints = [];\n if (this.config.interceptors) {\n (0, _keys.default)(this.config.interceptors).reduce(addInterceptor, ints);\n } else {\n ints = preInterceptors.reduce(addInterceptor, ints);\n ints = (0, _keys.default)(interceptors).filter(function (key) {\n return !(preInterceptors.includes(key) || postInterceptors.includes(key));\n }).reduce(addInterceptor, ints);\n ints = postInterceptors.reduce(addInterceptor, ints);\n }\n this.request = (0, _httpCore.defaults)({\n json: true,\n interceptors: ints\n });\n this.prepareFetchOptions = (0, _httpCore.protoprepareFetchOptions)({\n json: true,\n interceptors: ints\n });\n this.setTimingsAndFetch = _httpCore.setTimingsAndFetch;\n var sessionId = \"\".concat((0, _lodash.get)(this, 'config.trackingIdPrefix', 'webex-js-sdk'), \"_\").concat((0, _lodash.get)(this, 'config.trackingIdBase', _uuid.default.v4()));\n if ((0, _lodash.get)(this, 'config.trackingIdSuffix')) {\n sessionId += \"_\".concat((0, _lodash.get)(this, 'config.trackingIdSuffix'));\n }\n this.sessionId = sessionId;\n },\n /**\n * setConfig\n *\n * Allows updating config\n *\n * @instance\n * @memberof WebexCore\n * @param {Object} newConfig\n * @returns {null}\n */\n setConfig: function setConfig() {\n var newConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.config = (0, _lodash.merge)({}, this.config, newConfig);\n },\n /**\n *\n * Check if access token is correctly formated and correct if it's not\n * Warn user if token string has errors in it\n * @param {string} token\n * @returns {string}\n */\n bearerValidator: function bearerValidator(token) {\n if (token.includes('Bearer') && token.split(' ').length - 1 === 0) {\n console.warn(\"Your access token does not have a space between 'Bearer' and the token, please add a space to it or replace it with this already fixed version:\\n\\n\".concat(token.replace('Bearer', 'Bearer ').replace(/\\s+/g, ' ')));\n console.info(\"Tip: You don't need to add 'Bearer' to the access_token field. The token by itself is fine\");\n return token.replace('Bearer', 'Bearer ').replace(/\\s+/g, ' ');\n }\n // Allow elseIf return\n // eslint-disable-next-line no-else-return\n else if (token.split(' ').length - 1 > 1) {\n console.warn(\"Your access token has \".concat(token.split(' ').length - 2, \" too many spaces, please use this format:\\n\\n\").concat(token.replace(/\\s+/g, ' ')));\n console.info(\"Tip: You don't need to add 'Bearer' to the access_token field, the token by itself is fine\");\n return token.replace(/\\s+/g, ' ');\n }\n return token.replace(/\\s+/g, ' '); // Clean it anyway (just in case)\n },\n /**\n * @instance\n * @memberof WebexPlugin\n * @param {number} depth\n * @private\n * @returns {Object}\n */\n inspect: function inspect(depth) {\n return _util.default.inspect((0, _lodash.omit)(this.serialize({\n props: true,\n session: true,\n derived: true\n }), 'boundedStorage', 'unboundedStorage', 'request', 'config'), {\n depth: depth\n });\n },\n /**\n * Invokes all `onBeforeLogout` handlers in the scope of their plugin, clears\n * all stores, and revokes the access token\n * Note: If you're using the sdk in a server environment, you may be more\n * interested in {@link `webex.internal.mercury.disconnect()`| Mercury#disconnect()}\n * and {@link `webex.internal.device.unregister()`|Device#unregister()}\n * or {@link `webex.phone.unregister()`|Phone#unregister}\n * @instance\n * @memberof WebexCore\n * @param {Object} options Passed as the first argument to all\n * `onBeforeLogout` handlers\n * @returns {Promise}\n */\n logout: function logout(options) {\n var _this5 = this;\n for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n rest[_key4 - 1] = arguments[_key4];\n }\n // prefer the refresh token, but for clients that don't have one, fallback\n // to the access token\n var token = this.credentials.supertoken && (this.credentials.supertoken.refresh_token || this.credentials.supertoken.access_token);\n options = (0, _assign.default)({\n token: token\n }, options);\n\n // onBeforeLogout should be executed in the opposite order in which handlers\n // were registered. In that way, wdm unregister() will be above mercury\n // disconnect(), but disconnect() will execute first.\n // eslint-disable-next-line arrow-body-style\n return this.config.onBeforeLogout.reverse().reduce(function (promise, _ref2) {\n var plugin = _ref2.plugin,\n fn = _ref2.fn;\n return promise.then(function () {\n return _promise.default.resolve((0, _apply.default)(fn, _this5[plugin] || _this5.internal[plugin], [options].concat(rest)))\n // eslint-disable-next-line max-nested-callbacks\n .catch(function (err) {\n _this5.logger.warn(\"onBeforeLogout from plugin \".concat(plugin, \": failed\"), err);\n });\n });\n }, _promise.default.resolve()).then(function () {\n return _promise.default.all([_this5.boundedStorage.clear(), _this5.unboundedStorage.clear()]);\n }).then(function () {\n var _this5$credentials;\n return (_this5$credentials = _this5.credentials).invalidate.apply(_this5$credentials, rest);\n }).then(function () {\n var _this5$authorization;\n return _this5.authorization && _this5.authorization.logout && (_this5$authorization = _this5.authorization).logout.apply(_this5$authorization, [options].concat(rest));\n }).then(function () {\n return _this5.trigger('client:logout');\n });\n },\n /**\n * General purpose wrapper to submit metrics via the metrics plugin (if the\n * metrics plugin is installed)\n * @instance\n * @memberof WebexCore\n * @returns {Promise}\n */\n measure: function measure() {\n if (this.metrics) {\n var _this$metrics;\n return (_this$metrics = this.metrics).sendUnstructured.apply(_this$metrics, arguments);\n }\n return _promise.default.resolve();\n },\n upload: function upload(options) {\n var _this6 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n var shunt, promise;\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (options.file) {\n _context.next = 2;\n break;\n }\n return _context.abrupt(\"return\", _promise.default.reject(new Error('`options.file` is required')));\n case 2:\n options.phases = options.phases || {};\n options.phases.initialize = options.phases.initialize || {};\n options.phases.upload = options.phases.upload || {};\n options.phases.finalize = options.phases.finalize || {};\n (0, _lodash.defaultsDeep)(options.phases.initialize, {\n method: 'POST',\n body: {\n uploadProtocol: 'content-length'\n }\n }, (0, _lodash.omit)(options, 'file', 'phases'));\n (0, _lodash.defaultsDeep)(options.phases.upload, {\n method: 'PUT',\n json: false,\n withCredentials: false,\n body: options.file,\n headers: {\n 'x-trans-id': _uuid.default.v4(),\n authorization: undefined\n }\n });\n (0, _lodash.defaultsDeep)(options.phases.finalize, {\n method: 'POST'\n }, (0, _lodash.omit)(options, 'file', 'phases'));\n shunt = new _events.EventEmitter();\n promise = _this6._uploadPhaseInitialize(options).then(function () {\n var p = _this6._uploadPhaseUpload(options);\n (0, _common.transferEvents)('progress', p, shunt);\n return p;\n }).then(function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _this6._uploadPhaseFinalize.apply(_this6, [options].concat(args));\n }).then(function (res) {\n return _objectSpread(_objectSpread({}, res.body), res.headers);\n });\n (0, _common.proxyEvents)(shunt, promise);\n return _context.abrupt(\"return\", promise);\n case 13:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n _uploadPhaseInitialize: function _uploadPhaseInitialize(options) {\n var _this7 = this;\n this.logger.debug('client: initiating upload session');\n return this.request(options.phases.initialize).then(function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n var fileUploadSizeLimitInBytes = (args[0].body.fileUploadSizeLimit || MAX_FILE_SIZE_IN_MB) * 1024 * 1024;\n var currentFileSizeInBytes = options.file.byteLength;\n if (fileUploadSizeLimitInBytes && fileUploadSizeLimitInBytes < currentFileSizeInBytes) {\n return _this7._uploadAbortSession.apply(_this7, [currentFileSizeInBytes].concat(args));\n }\n return _this7._uploadApplySession.apply(_this7, [options].concat(args));\n }).then(function (res) {\n _this7.logger.debug('client: initiated upload session');\n return res;\n });\n },\n _uploadAbortSession: function _uploadAbortSession(currentFileSizeInBytes, response) {\n var _this8 = this;\n this.logger.debug('client: deleting uploaded file');\n return this.request({\n method: 'DELETE',\n url: response.body.url,\n headers: response.options.headers\n }).then(function () {\n _this8.logger.debug('client: deleting uploaded file complete');\n var abortErrorDetails = {\n currentFileSizeInBytes: currentFileSizeInBytes,\n fileUploadSizeLimitInMB: response.body.fileUploadSizeLimit || MAX_FILE_SIZE_IN_MB,\n message: 'file-upload-size-limit-enabled'\n };\n return _promise.default.reject(new Error(\"\".concat((0, _stringify.default)(abortErrorDetails))));\n });\n },\n _uploadApplySession: function _uploadApplySession(options, res) {\n var session = res.body;\n ['upload', 'finalize'].reduce(function (opts, key) {\n opts[key] = (0, _keys.default)(opts[key]).reduce(function (phaseOptions, phaseKey) {\n if (phaseKey.startsWith('$')) {\n phaseOptions[phaseKey.substr(1)] = phaseOptions[phaseKey](session);\n (0, _deleteProperty.default)(phaseOptions, phaseKey);\n }\n return phaseOptions;\n }, opts[key]);\n return opts;\n }, options.phases);\n },\n _uploadPhaseUpload: function _uploadPhaseUpload(options) {\n var _this9 = this;\n this.logger.debug('client: uploading file');\n var promise = this.request(options.phases.upload).then(function (res) {\n _this9.logger.debug('client: uploaded file');\n return res;\n });\n (0, _common.proxyEvents)(options.phases.upload.upload, promise);\n\n /* istanbul ignore else */\n if (false) {}\n return promise;\n },\n _uploadPhaseFinalize: function _uploadPhaseFinalize(options) {\n var _this10 = this;\n this.logger.debug('client: finalizing upload session');\n return this.request(options.phases.finalize).then(function (res) {\n _this10.logger.debug('client: finalized upload session');\n return res;\n });\n }\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"_uploadPhaseUpload\", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, \"_uploadPhaseUpload\"), _obj)), _obj));\nWebexCore.version = \"3.8.0-next.10\";\n(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);\n(0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);\nvar _default = exports[\"default\"] = WebexCore;\n/**\n * @method registerPlugin\n * @param {string} name\n * @param {function} constructor\n * @param {Object} options\n * @param {Array<string>} options.proxies\n * @param {Object} options.interceptors\n * @returns {null}\n */\nfunction registerPlugin(name, constructor) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n WebexCore.registerPlugin(name, constructor, options);\n}\n\n/**\n * Registers plugins used by internal products that do not talk to public APIs.\n * @method registerInternalPlugin\n * @param {string} name\n * @param {function} constructor\n * @param {Object} options\n * @param {Object} options.interceptors\n * @private\n * @returns {null}\n */\nfunction registerInternalPlugin(name, constructor, options) {\n _webexInternalCore.default.registerPlugin(name, constructor, options);\n}\n//# sourceMappingURL=webex-core.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/webex-core.js?");
4615
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$keys2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nexports.registerInternalPlugin = registerInternalPlugin;\nexports.registerPlugin = registerPlugin;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _events = __webpack_require__(/*! events */ \"../../../node_modules/events/events.js\");\nvar _util = _interopRequireDefault(__webpack_require__(/*! util */ \"../../../node_modules/util/util.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/common/dist/index.js\");\nvar _httpCore = __webpack_require__(/*! @webex/http-core */ \"../../../node_modules/@webex/webex-core/node_modules/@webex/http-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _ampersandState = _interopRequireDefault(__webpack_require__(/*! ampersand-state */ \"../../../node_modules/ampersand-state/ampersand-state.js\"));\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _auth = _interopRequireDefault(__webpack_require__(/*! ./interceptors/auth */ \"../../../node_modules/@webex/webex-core/dist/interceptors/auth.js\"));\nvar _networkTiming = _interopRequireDefault(__webpack_require__(/*! ./interceptors/network-timing */ \"../../../node_modules/@webex/webex-core/dist/interceptors/network-timing.js\"));\nvar _payloadTransformer = _interopRequireDefault(__webpack_require__(/*! ./interceptors/payload-transformer */ \"../../../node_modules/@webex/webex-core/dist/interceptors/payload-transformer.js\"));\nvar _redirect = _interopRequireDefault(__webpack_require__(/*! ./interceptors/redirect */ \"../../../node_modules/@webex/webex-core/dist/interceptors/redirect.js\"));\nvar _requestEvent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-event */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-event.js\"));\nvar _requestLogger = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-logger */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-logger.js\"));\nvar _requestTiming = _interopRequireDefault(__webpack_require__(/*! ./interceptors/request-timing */ \"../../../node_modules/@webex/webex-core/dist/interceptors/request-timing.js\"));\nvar _responseLogger = _interopRequireDefault(__webpack_require__(/*! ./interceptors/response-logger */ \"../../../node_modules/@webex/webex-core/dist/interceptors/response-logger.js\"));\nvar _webexHttpError = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-http-error */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-http-error.js\"));\nvar _userAgent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/user-agent */ \"../../../node_modules/@webex/webex-core/dist/interceptors/user-agent.js\"));\nvar _webexTrackingId = _interopRequireDefault(__webpack_require__(/*! ./interceptors/webex-tracking-id */ \"../../../node_modules/@webex/webex-core/dist/interceptors/webex-tracking-id.js\"));\nvar _webexUserAgent = _interopRequireDefault(__webpack_require__(/*! ./interceptors/webex-user-agent */ \"../../../node_modules/@webex/webex-core/dist/interceptors/webex-user-agent.js\"));\nvar _rateLimit = _interopRequireDefault(__webpack_require__(/*! ./interceptors/rate-limit */ \"../../../node_modules/@webex/webex-core/dist/interceptors/rate-limit.js\"));\nvar _embargo = _interopRequireDefault(__webpack_require__(/*! ./interceptors/embargo */ \"../../../node_modules/@webex/webex-core/dist/interceptors/embargo.js\"));\nvar _defaultOptions = _interopRequireDefault(__webpack_require__(/*! ./interceptors/default-options */ \"../../../node_modules/@webex/webex-core/dist/interceptors/default-options.js\"));\nvar _hostmap = _interopRequireDefault(__webpack_require__(/*! ./lib/services/interceptors/hostmap */ \"../../../node_modules/@webex/webex-core/dist/lib/services/interceptors/hostmap.js\"));\nvar _config = _interopRequireDefault(__webpack_require__(/*! ./config */ \"../../../node_modules/@webex/webex-core/dist/config.js\"));\nvar _storage = __webpack_require__(/*! ./lib/storage */ \"../../../node_modules/@webex/webex-core/dist/lib/storage/index.js\");\nvar _webexCorePluginMixin = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-core-plugin-mixin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-core-plugin-mixin.js\"));\nvar _webexInternalCorePluginMixin = _interopRequireDefault(__webpack_require__(/*! ./lib/webex-internal-core-plugin-mixin */ \"../../../node_modules/@webex/webex-core/dist/lib/webex-internal-core-plugin-mixin.js\"));\nvar _webexInternalCore = _interopRequireDefault(__webpack_require__(/*! ./webex-internal-core */ \"../../../node_modules/@webex/webex-core/dist/webex-internal-core.js\"));\nvar _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nfunction ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n// TODO replace the Interceptor.create with Reflect.construct (\n// Interceptor.create exists because new was really hard to call on an array of\n// constructors)\nvar interceptors = {\n WebexTrackingIdInterceptor: _webexTrackingId.default.create,\n RequestEventInterceptor: _requestEvent.default.create,\n RateLimitInterceptor: _rateLimit.default.create,\n /* eslint-disable no-extra-parens */\n RequestLoggerInterceptor: process.env.ENABLE_NETWORK_LOGGING || process.env.ENABLE_VERBOSE_NETWORK_LOGGING ? _requestLogger.default.create : undefined,\n ResponseLoggerInterceptor: process.env.ENABLE_NETWORK_LOGGING || process.env.ENABLE_VERBOSE_NETWORK_LOGGING ? _responseLogger.default.create : undefined,\n /* eslint-enable no-extra-parens */\n RequestTimingInterceptor: _requestTiming.default.create,\n ServiceInterceptor: undefined,\n UserAgentInterceptor: _userAgent.default.create,\n WebexUserAgentInterceptor: _webexUserAgent.default.create,\n AuthInterceptor: _auth.default.create,\n KmsDryErrorInterceptor: undefined,\n PayloadTransformerInterceptor: _payloadTransformer.default.create,\n ConversationInterceptor: undefined,\n RedirectInterceptor: _redirect.default.create,\n HttpStatusInterceptor: function HttpStatusInterceptor() {\n return _httpCore.HttpStatusInterceptor.create({\n error: _webexHttpError.default\n });\n },\n NetworkTimingInterceptor: _networkTiming.default.create,\n EmbargoInterceptor: _embargo.default.create,\n DefaultOptionsInterceptor: _defaultOptions.default.create,\n HostMapInterceptor: _hostmap.default.create\n};\nvar preInterceptors = ['ResponseLoggerInterceptor', 'RequestTimingInterceptor', 'RequestEventInterceptor', 'WebexTrackingIdInterceptor', 'RateLimitInterceptor'];\nvar postInterceptors = ['HttpStatusInterceptor', 'NetworkTimingInterceptor', 'EmbargoInterceptor', 'RequestLoggerInterceptor', 'RateLimitInterceptor'];\nvar MAX_FILE_SIZE_IN_MB = 2048;\n\n/**\n * @class\n */\nvar WebexCore = _ampersandState.default.extend((_obj = {\n version: \"3.8.0-next.11\",\n children: {\n internal: _webexInternalCore.default\n },\n constructor: function constructor() {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof attrs === 'string') {\n attrs = {\n credentials: {\n supertoken: {\n // eslint-disable-next-line camelcase\n access_token: attrs\n }\n }\n };\n } else {\n // Reminder: order is important here\n ['credentials.authorization', 'authorization', 'credentials.supertoken.supertoken', 'supertoken', 'access_token', 'credentials.authorization.supertoken'].forEach(function (path) {\n var val = (0, _lodash.get)(attrs, path);\n if (val) {\n (0, _lodash.unset)(attrs, path);\n (0, _lodash.set)(attrs, 'credentials.supertoken', val);\n }\n });\n ['credentials', 'credentials.authorization'].forEach(function (path) {\n var val = (0, _lodash.get)(attrs, path);\n if (typeof val === 'string') {\n (0, _lodash.unset)(attrs, path);\n (0, _lodash.set)(attrs, 'credentials.supertoken', val);\n }\n });\n if (typeof (0, _lodash.get)(attrs, 'credentials.access_token') === 'string') {\n // Send access_token to get validated and corrected and then set it\n (0, _lodash.set)(attrs, 'credentials.access_token', this.bearerValidator((0, _lodash.get)(attrs, 'credentials.access_token').trim()));\n (0, _lodash.set)(attrs, 'credentials.supertoken', attrs.credentials);\n }\n }\n return (0, _apply.default)(_ampersandState.default, this, [attrs, options]);\n },\n derived: {\n boundedStorage: {\n deps: [],\n fn: function fn() {\n return (0, _storage.makeWebexStore)('bounded', this);\n }\n },\n unboundedStorage: {\n deps: [],\n fn: function fn() {\n return (0, _storage.makeWebexStore)('unbounded', this);\n }\n },\n ready: {\n deps: ['loaded', 'internal.ready'],\n fn: function fn() {\n var _this = this;\n return this.loaded && (0, _keys.default)(this._children).reduce(function (ready, name) {\n return ready && _this[name] && _this[name].ready !== false;\n }, true);\n }\n }\n },\n session: {\n config: {\n type: 'object'\n },\n /**\n * When true, indicates that the initial load from the storage layer is\n * complete\n * @instance\n * @memberof WebexCore\n * @type {boolean}\n */\n loaded: {\n default: false,\n type: 'boolean'\n },\n request: {\n setOnce: true,\n // It's supposed to be a function, but that's not a type defined in\n // Ampersand\n type: 'any'\n },\n sessionId: {\n type: 'string'\n }\n },\n /**\n * @instance\n * @memberof WebexCore\n * @param {[type]} args\n * @returns {[type]}\n */\n refresh: function refresh() {\n var _this$credentials;\n return (_this$credentials = this.credentials).refresh.apply(_this$credentials, arguments);\n },\n /**\n * Applies the directionally appropriate transforms to the specified object\n * @param {string} direction\n * @param {Object} object\n * @returns {Promise}\n */\n transform: function transform(direction, object) {\n var _this2 = this;\n var predicates = this.config.payloadTransformer.predicates.filter(function (p) {\n return !p.direction || p.direction === direction;\n });\n var ctx = {\n webex: this\n };\n return _promise.default.all(predicates.map(function (p) {\n return p.test(ctx, object).then(function (shouldTransform) {\n if (!shouldTransform) {\n return undefined;\n }\n return p.extract(object)\n // eslint-disable-next-line max-nested-callbacks\n .then(function (target) {\n return {\n name: p.name,\n target: target\n };\n });\n });\n })).then(function (data) {\n return data.filter(function (d) {\n return Boolean(d);\n })\n // eslint-disable-next-line max-nested-callbacks\n .reduce(function (promise, _ref) {\n var name = _ref.name,\n target = _ref.target,\n alias = _ref.alias;\n return promise.then(function () {\n if (alias) {\n return _this2.applyNamedTransform(direction, alias, target);\n }\n return _this2.applyNamedTransform(direction, name, target);\n });\n }, _promise.default.resolve());\n }).then(function () {\n return object;\n });\n },\n /**\n * Applies the directionally appropriate transform to the specified parameters\n * @param {string} direction\n * @param {Object} ctx\n * @param {string} name\n * @returns {Promise}\n */\n applyNamedTransform: function applyNamedTransform(direction, ctx, name) {\n var _this3 = this;\n for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {\n rest[_key - 3] = arguments[_key];\n }\n if ((0, _lodash.isString)(ctx)) {\n rest.unshift(name);\n name = ctx;\n ctx = {\n webex: this,\n transform: function transform() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return _this3.applyNamedTransform.apply(_this3, [direction, ctx].concat(args));\n }\n };\n }\n var transforms = ctx.webex.config.payloadTransformer.transforms.filter(function (tx) {\n return tx.name === name && (!tx.direction || tx.direction === direction);\n });\n\n // too many implicit returns on the same line is difficult to interpret\n // eslint-disable-next-line arrow-body-style\n return transforms.reduce(function (promise, tx) {\n return promise.then(function () {\n if (tx.alias) {\n var _ctx;\n return (_ctx = ctx).transform.apply(_ctx, [tx.alias].concat(rest));\n }\n return _promise.default.resolve(tx.fn.apply(tx, [ctx].concat(rest)));\n });\n }, _promise.default.resolve()).then(function () {\n return (0, _lodash.last)(rest);\n });\n },\n /**\n * @private\n * @returns {Window}\n */\n getWindow: function getWindow() {\n // eslint-disable-next-line\n return window;\n },\n /**\n * Initializer\n *\n * @emits WebexCore#loaded\n * @emits WebexCore#ready\n * @instance\n * @memberof WebexCore\n * @param {Object} attrs\n * @returns {WebexCore}\n */\n initialize: function initialize() {\n var _this4 = this;\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.config = (0, _lodash.merge)({}, _config.default, attrs.config);\n\n // There's some unfortunateness with the way {@link AmpersandState#children}\n // get initialized. We'll fire the change:config event so that\n // {@link WebexPlugin#initialize()} can use\n // `this.listenToOnce(parent, 'change:config', () => {});` to act on config\n // during initialization\n this.trigger('change:config');\n var onLoaded = function onLoaded() {\n if (_this4.loaded) {\n /**\n * Fires when all data has been loaded from the storage layer\n * @event loaded\n * @instance\n * @memberof WebexCore\n */\n _this4.trigger('loaded');\n _this4.stopListening(_this4, 'change:loaded', onLoaded);\n }\n };\n\n // This needs to run on nextTick or we'll never be able to wire up listeners\n process.nextTick(function () {\n _this4.listenToAndRun(_this4, 'change:loaded', onLoaded);\n });\n var onReady = function onReady() {\n if (_this4.ready) {\n /**\n * Fires when all plugins have fully initialized\n * @event ready\n * @instance\n * @memberof WebexCore\n */\n _this4.trigger('ready');\n _this4.stopListening(_this4, 'change:ready', onReady);\n }\n };\n\n // This needs to run on nextTick or we'll never be able to wire up listeners\n process.nextTick(function () {\n _this4.listenToAndRun(_this4, 'change:ready', onReady);\n });\n\n // Make nested events propagate in a consistent manner\n (0, _keys.default)(this.constructor.prototype._children).forEach(function (key) {\n _this4.listenTo(_this4[key], 'change', function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n args.unshift(\"change:\".concat(key));\n _this4.trigger.apply(_this4, args);\n });\n });\n var addInterceptor = function addInterceptor(ints, key) {\n var interceptorsObj = _this4.config.interceptors || interceptors;\n var interceptor = interceptorsObj[key];\n if (!(0, _lodash.isFunction)(interceptor)) {\n return ints;\n }\n ints.push((0, _apply.default)(interceptor, _this4, []));\n return ints;\n };\n var ints = [];\n if (this.config.interceptors) {\n (0, _keys.default)(this.config.interceptors).reduce(addInterceptor, ints);\n } else {\n ints = preInterceptors.reduce(addInterceptor, ints);\n ints = (0, _keys.default)(interceptors).filter(function (key) {\n return !(preInterceptors.includes(key) || postInterceptors.includes(key));\n }).reduce(addInterceptor, ints);\n ints = postInterceptors.reduce(addInterceptor, ints);\n }\n this.request = (0, _httpCore.defaults)({\n json: true,\n interceptors: ints\n });\n this.prepareFetchOptions = (0, _httpCore.protoprepareFetchOptions)({\n json: true,\n interceptors: ints\n });\n this.setTimingsAndFetch = _httpCore.setTimingsAndFetch;\n var sessionId = \"\".concat((0, _lodash.get)(this, 'config.trackingIdPrefix', 'webex-js-sdk'), \"_\").concat((0, _lodash.get)(this, 'config.trackingIdBase', _uuid.default.v4()));\n if ((0, _lodash.get)(this, 'config.trackingIdSuffix')) {\n sessionId += \"_\".concat((0, _lodash.get)(this, 'config.trackingIdSuffix'));\n }\n this.sessionId = sessionId;\n },\n /**\n * setConfig\n *\n * Allows updating config\n *\n * @instance\n * @memberof WebexCore\n * @param {Object} newConfig\n * @returns {null}\n */\n setConfig: function setConfig() {\n var newConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.config = (0, _lodash.merge)({}, this.config, newConfig);\n },\n /**\n *\n * Check if access token is correctly formated and correct if it's not\n * Warn user if token string has errors in it\n * @param {string} token\n * @returns {string}\n */\n bearerValidator: function bearerValidator(token) {\n if (token.includes('Bearer') && token.split(' ').length - 1 === 0) {\n console.warn(\"Your access token does not have a space between 'Bearer' and the token, please add a space to it or replace it with this already fixed version:\\n\\n\".concat(token.replace('Bearer', 'Bearer ').replace(/\\s+/g, ' ')));\n console.info(\"Tip: You don't need to add 'Bearer' to the access_token field. The token by itself is fine\");\n return token.replace('Bearer', 'Bearer ').replace(/\\s+/g, ' ');\n }\n // Allow elseIf return\n // eslint-disable-next-line no-else-return\n else if (token.split(' ').length - 1 > 1) {\n console.warn(\"Your access token has \".concat(token.split(' ').length - 2, \" too many spaces, please use this format:\\n\\n\").concat(token.replace(/\\s+/g, ' ')));\n console.info(\"Tip: You don't need to add 'Bearer' to the access_token field, the token by itself is fine\");\n return token.replace(/\\s+/g, ' ');\n }\n return token.replace(/\\s+/g, ' '); // Clean it anyway (just in case)\n },\n /**\n * @instance\n * @memberof WebexPlugin\n * @param {number} depth\n * @private\n * @returns {Object}\n */\n inspect: function inspect(depth) {\n return _util.default.inspect((0, _lodash.omit)(this.serialize({\n props: true,\n session: true,\n derived: true\n }), 'boundedStorage', 'unboundedStorage', 'request', 'config'), {\n depth: depth\n });\n },\n /**\n * Invokes all `onBeforeLogout` handlers in the scope of their plugin, clears\n * all stores, and revokes the access token\n * Note: If you're using the sdk in a server environment, you may be more\n * interested in {@link `webex.internal.mercury.disconnect()`| Mercury#disconnect()}\n * and {@link `webex.internal.device.unregister()`|Device#unregister()}\n * or {@link `webex.phone.unregister()`|Phone#unregister}\n * @instance\n * @memberof WebexCore\n * @param {Object} options Passed as the first argument to all\n * `onBeforeLogout` handlers\n * @returns {Promise}\n */\n logout: function logout(options) {\n var _this5 = this;\n for (var _len4 = arguments.length, rest = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n rest[_key4 - 1] = arguments[_key4];\n }\n // prefer the refresh token, but for clients that don't have one, fallback\n // to the access token\n var token = this.credentials.supertoken && (this.credentials.supertoken.refresh_token || this.credentials.supertoken.access_token);\n options = (0, _assign.default)({\n token: token\n }, options);\n\n // onBeforeLogout should be executed in the opposite order in which handlers\n // were registered. In that way, wdm unregister() will be above mercury\n // disconnect(), but disconnect() will execute first.\n // eslint-disable-next-line arrow-body-style\n return this.config.onBeforeLogout.reverse().reduce(function (promise, _ref2) {\n var plugin = _ref2.plugin,\n fn = _ref2.fn;\n return promise.then(function () {\n return _promise.default.resolve((0, _apply.default)(fn, _this5[plugin] || _this5.internal[plugin], [options].concat(rest)))\n // eslint-disable-next-line max-nested-callbacks\n .catch(function (err) {\n _this5.logger.warn(\"onBeforeLogout from plugin \".concat(plugin, \": failed\"), err);\n });\n });\n }, _promise.default.resolve()).then(function () {\n return _promise.default.all([_this5.boundedStorage.clear(), _this5.unboundedStorage.clear()]);\n }).then(function () {\n var _this5$credentials;\n return (_this5$credentials = _this5.credentials).invalidate.apply(_this5$credentials, rest);\n }).then(function () {\n var _this5$authorization;\n return _this5.authorization && _this5.authorization.logout && (_this5$authorization = _this5.authorization).logout.apply(_this5$authorization, [options].concat(rest));\n }).then(function () {\n return _this5.trigger('client:logout');\n });\n },\n /**\n * General purpose wrapper to submit metrics via the metrics plugin (if the\n * metrics plugin is installed)\n * @instance\n * @memberof WebexCore\n * @returns {Promise}\n */\n measure: function measure() {\n if (this.metrics) {\n var _this$metrics;\n return (_this$metrics = this.metrics).sendUnstructured.apply(_this$metrics, arguments);\n }\n return _promise.default.resolve();\n },\n upload: function upload(options) {\n var _this6 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n var shunt, promise;\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (options.file) {\n _context.next = 2;\n break;\n }\n return _context.abrupt(\"return\", _promise.default.reject(new Error('`options.file` is required')));\n case 2:\n options.phases = options.phases || {};\n options.phases.initialize = options.phases.initialize || {};\n options.phases.upload = options.phases.upload || {};\n options.phases.finalize = options.phases.finalize || {};\n (0, _lodash.defaultsDeep)(options.phases.initialize, {\n method: 'POST',\n body: {\n uploadProtocol: 'content-length'\n }\n }, (0, _lodash.omit)(options, 'file', 'phases'));\n (0, _lodash.defaultsDeep)(options.phases.upload, {\n method: 'PUT',\n json: false,\n withCredentials: false,\n body: options.file,\n headers: {\n 'x-trans-id': _uuid.default.v4(),\n authorization: undefined\n }\n });\n (0, _lodash.defaultsDeep)(options.phases.finalize, {\n method: 'POST'\n }, (0, _lodash.omit)(options, 'file', 'phases'));\n shunt = new _events.EventEmitter();\n promise = _this6._uploadPhaseInitialize(options).then(function () {\n var p = _this6._uploadPhaseUpload(options);\n (0, _common.transferEvents)('progress', p, shunt);\n return p;\n }).then(function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n return _this6._uploadPhaseFinalize.apply(_this6, [options].concat(args));\n }).then(function (res) {\n return _objectSpread(_objectSpread({}, res.body), res.headers);\n });\n (0, _common.proxyEvents)(shunt, promise);\n return _context.abrupt(\"return\", promise);\n case 13:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n _uploadPhaseInitialize: function _uploadPhaseInitialize(options) {\n var _this7 = this;\n this.logger.debug('client: initiating upload session');\n return this.request(options.phases.initialize).then(function () {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n var fileUploadSizeLimitInBytes = (args[0].body.fileUploadSizeLimit || MAX_FILE_SIZE_IN_MB) * 1024 * 1024;\n var currentFileSizeInBytes = options.file.byteLength;\n if (fileUploadSizeLimitInBytes && fileUploadSizeLimitInBytes < currentFileSizeInBytes) {\n return _this7._uploadAbortSession.apply(_this7, [currentFileSizeInBytes].concat(args));\n }\n return _this7._uploadApplySession.apply(_this7, [options].concat(args));\n }).then(function (res) {\n _this7.logger.debug('client: initiated upload session');\n return res;\n });\n },\n _uploadAbortSession: function _uploadAbortSession(currentFileSizeInBytes, response) {\n var _this8 = this;\n this.logger.debug('client: deleting uploaded file');\n return this.request({\n method: 'DELETE',\n url: response.body.url,\n headers: response.options.headers\n }).then(function () {\n _this8.logger.debug('client: deleting uploaded file complete');\n var abortErrorDetails = {\n currentFileSizeInBytes: currentFileSizeInBytes,\n fileUploadSizeLimitInMB: response.body.fileUploadSizeLimit || MAX_FILE_SIZE_IN_MB,\n message: 'file-upload-size-limit-enabled'\n };\n return _promise.default.reject(new Error(\"\".concat((0, _stringify.default)(abortErrorDetails))));\n });\n },\n _uploadApplySession: function _uploadApplySession(options, res) {\n var session = res.body;\n ['upload', 'finalize'].reduce(function (opts, key) {\n opts[key] = (0, _keys.default)(opts[key]).reduce(function (phaseOptions, phaseKey) {\n if (phaseKey.startsWith('$')) {\n phaseOptions[phaseKey.substr(1)] = phaseOptions[phaseKey](session);\n (0, _deleteProperty.default)(phaseOptions, phaseKey);\n }\n return phaseOptions;\n }, opts[key]);\n return opts;\n }, options.phases);\n },\n _uploadPhaseUpload: function _uploadPhaseUpload(options) {\n var _this9 = this;\n this.logger.debug('client: uploading file');\n var promise = this.request(options.phases.upload).then(function (res) {\n _this9.logger.debug('client: uploaded file');\n return res;\n });\n (0, _common.proxyEvents)(options.phases.upload.upload, promise);\n\n /* istanbul ignore else */\n if (false) {}\n return promise;\n },\n _uploadPhaseFinalize: function _uploadPhaseFinalize(options) {\n var _this10 = this;\n this.logger.debug('client: finalizing upload session');\n return this.request(options.phases.finalize).then(function (res) {\n _this10.logger.debug('client: finalized upload session');\n return res;\n });\n }\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"_uploadPhaseUpload\", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, \"_uploadPhaseUpload\"), _obj)), _obj));\nWebexCore.version = \"3.8.0-next.11\";\n(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);\n(0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);\nvar _default = exports[\"default\"] = WebexCore;\n/**\n * @method registerPlugin\n * @param {string} name\n * @param {function} constructor\n * @param {Object} options\n * @param {Array<string>} options.proxies\n * @param {Object} options.interceptors\n * @returns {null}\n */\nfunction registerPlugin(name, constructor) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n WebexCore.registerPlugin(name, constructor, options);\n}\n\n/**\n * Registers plugins used by internal products that do not talk to public APIs.\n * @method registerInternalPlugin\n * @param {string} name\n * @param {function} constructor\n * @param {Object} options\n * @param {Object} options.interceptors\n * @private\n * @returns {null}\n */\nfunction registerInternalPlugin(name, constructor, options) {\n _webexInternalCore.default.registerPlugin(name, constructor, options);\n}\n//# sourceMappingURL=webex-core.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/../../../node_modules/@webex/webex-core/dist/webex-core.js?");
4616
4616
 
4617
4617
  /***/ }),
4618
4618
 
@@ -12049,7 +12049,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
12049
12049
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12050
12050
 
12051
12051
  "use strict";
12052
- eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"./node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"./node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"./node_modules/@webex/internal-plugin-device/dist/metrics.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"./node_modules/@webex/internal-plugin-device/dist/constants.js\");\nvar _featuresModel = _interopRequireDefault(__webpack_require__(/*! ./features/features-model */ \"./node_modules/@webex/internal-plugin-device/dist/features/features-model.js\"));\nvar _ipNetworkDetector = _interopRequireDefault(__webpack_require__(/*! ./ipNetworkDetector */ \"./node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"./node_modules/@webex/internal-plugin-device/dist/types.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj; // Internal Dependencies\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\nvar Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)('@'), _dec2 = (0, _webexCore.waitForValue)('@'), _dec3 = (0, _webexCore.waitForValue)('@'), _dec4 = (0, _webexCore.waitForValue)('@'), _dec5 = (0, _common.deprecated)('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()'), _dec6 = (0, _webexCore.persist)('@', decider), (_obj = {\n // Ampersand property members.\n\n namespace: 'Device',\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n idAttribute: 'url',\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: _featuresModel.default,\n /**\n * Helper class for detecting what IP network version (ipv4, ipv6) we're on.\n *\n * @type {IpNetworkDetector}\n */\n ipNetworkDetector: _ipNetworkDetector.default\n },\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, function () {\n return [];\n }],\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string'\n },\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn: function fn() {\n return !!this.url;\n }\n }\n },\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n /**\n * This property stores whether or not the next refresh or register request should request energy forecast data\n * in order to prevent over fetching energy forecasts\n *\n * @type {boolean}\n */\n energyForecastConfig: 'boolean',\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean'\n },\n // Event method members.\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted: function meetingStarted() {\n this.webex.trigger('meeting started');\n },\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded: function meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n /**\n * Set the value of energy forecast config for the current registered device.\n * @param {boolean} [energyForecastConfig=false] - fetch an energy forecast on the next refresh/register\n * @returns {void}\n */\n setEnergyForecastConfig: function setEnergyForecastConfig() {\n var energyForecastConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.energyForecastConfig = energyForecastConfig;\n },\n refresh: function refresh() {\n var _this = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is not registered and register instead.\n if (!_this.registered) {\n _this.logger.info('device: device not registered, registering');\n return _this.register(deviceRegistrationOptions);\n }\n\n // Merge body configurations, overriding defaults.\n var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {});\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (_this.config.ephemeral) {\n body.ttl = _this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread(_objectSpread({}, _this.config.defaults.headers ? _this.config.defaults.headers : {}), _this.config.headers ? _this.config.headers : {}), _this.etag ? {\n 'If-None-Match': _this.etag\n } : {});\n var _deviceRegistrationOp = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp;\n var requestId = _uuid.default.v4();\n _this.set('refresh-request-id', requestId);\n return _this.request({\n method: 'PUT',\n uri: _this.url,\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(_this.config.energyForecast && _this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this.get('refresh-request-id') !== requestId) {\n _this.logger.info('device: refresh request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n return _this.processRegistrationSuccess(response);\n }).catch(function (reason) {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n _this.logger.info('device: refresh failed, device is not valid');\n _this.logger.info('device: attempting to register a new device');\n _this.clear();\n return _this.register(deviceRegistrationOptions);\n }\n return _promise.default.reject(reason);\n });\n });\n },\n /**\n * Fetches the web devices and deletes the third of them which are not recent devices in use\n * @returns {Promise<void, Error>}\n */\n deleteDevices: function deleteDevices() {\n var _this2 = this;\n // Fetch devices with a GET request\n return this.request({\n method: 'GET',\n service: 'wdm',\n resource: 'devices'\n }).then(function (response) {\n var devices = response.body.devices;\n var _this2$_getBody = _this2._getBody(),\n deviceType = _this2$_getBody.deviceType;\n\n // Filter devices of type deviceType\n var webDevices = devices.filter(function (item) {\n return item.deviceType === deviceType;\n });\n var sortedDevices = (0, _lodash.orderBy)(webDevices, [function (item) {\n return new Date(item.modificationTime);\n }]);\n\n // If there are more than two devices, delete the last third\n if (sortedDevices.length > 2) {\n var totalItems = sortedDevices.length;\n var countToDelete = Math.ceil(totalItems / 3);\n var urlsToDelete = sortedDevices.slice(0, countToDelete).map(function (item) {\n return item.url;\n });\n return _promise.default.race(urlsToDelete.map(function (url) {\n return _this2.request({\n uri: url,\n method: 'DELETE'\n });\n }));\n }\n return _promise.default.resolve();\n }).catch(function (error) {\n _this2.logger.error('Failed to retrieve devices:', error);\n return _promise.default.reject(error);\n });\n },\n register: function register() {\n var _this3 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: registering');\n this.webex.internal.newMetrics.callDiagnosticMetrics.setDeviceInfo(this);\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is already registered and refresh instead.\n if (_this3.registered) {\n _this3.logger.info('device: device already registered, refreshing');\n return _this3.refresh(deviceRegistrationOptions);\n }\n return _this3._registerInternal(deviceRegistrationOptions).catch(function (error) {\n var _error$body;\n if ((error === null || error === void 0 ? void 0 : (_error$body = error.body) === null || _error$body === void 0 ? void 0 : _error$body.message) === 'User has excessive device registrations') {\n return _this3.deleteDevices().then(function () {\n return _this3._registerInternal(deviceRegistrationOptions);\n });\n }\n throw error;\n });\n });\n },\n _getBody: function _getBody() {\n return _objectSpread(_objectSpread({}, this.config.defaults.body ? this.config.defaults.body : {}), this.config.body ? this.config.body : {});\n },\n _registerInternal: function _registerInternal() {\n var _this4 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: making registration request');\n\n // Merge body configurations, overriding defaults.\n var body = this._getBody();\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread({}, this.config.defaults.headers ? this.config.defaults.headers : {}), this.config.headers ? this.config.headers : {});\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n this.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.request'\n });\n var _deviceRegistrationOp2 = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp2 === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp2;\n var requestId = _uuid.default.v4();\n this.set('register-request-id', requestId);\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(this.config.energyForecast && this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).catch(function (error) {\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n throw error;\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this4.get('register-request-id') !== requestId) {\n _this4.logger.info('device: register request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n\n // Do not add any processing of response above this as that will affect timestamp\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);\n return _this4.processRegistrationSuccess(response);\n }).catch(function (error) {\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {\n error: error\n }\n });\n throw error;\n });\n },\n unregister: function unregister() {\n var _this5 = this;\n this.logger.info('device: unregistering');\n if (!this.registered) {\n this.logger.warn('device: not registered');\n return _promise.default.resolve();\n }\n return this.request({\n uri: this.url,\n method: 'DELETE'\n }).then(function () {\n return _this5.clear();\n }).catch(function (reason) {\n if (reason.statusCode === 404) {\n _this5.logger.info('device: 404 when deleting device, device is already deleted, clearing device');\n _this5.clear();\n }\n throw reason;\n });\n },\n /* eslint-enable require-jsdoc */\n // Helper method members\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister: function canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(function () {\n return (\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm') ? _promise.default.resolve() : _promise.default.reject(new Error(['device: cannot register,', \"'wdm' service is not available from the postauth catalog\"].join(' ')))\n );\n });\n },\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability: function checkNetworkReachability() {\n var _this6 = this;\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n var headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null\n };\n\n // Send the network reachability request.\n return this.request({\n headers: headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl\n }).then(function () {\n _this6.isInNetwork = true;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n }).catch(function () {\n _this6.logger.info('device: did not reach ping endpoint');\n _this6.logger.info('device: triggering off-network timer');\n _this6.isInNetwork = false;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n });\n },\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear: function clear() {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.clear, this, args);\n },\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl: function getWebSocketUrl() {\n var _this7 = this;\n var wait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration().then(function () {\n return services.convertUrlToPriorityHostUrl(_this7.webSocketUrl);\n }).catch(function (error) {\n _this7.logger.warn(error.message);\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return _promise.default.reject(new Error('device: cannot get websocket url, device is not registered'));\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n var wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return _promise.default.resolve(wsUrl);\n }\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n },\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess: function processRegistrationSuccess(response) {\n var _this8 = this;\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n var body = _objectSpread({}, response.body);\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n var _ref = response.headers || {},\n etag = _ref.etag;\n if (this.etag && etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n var features = body.features;\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({\n etag: etag\n });\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n var delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this8.refresh();\n }, delay);\n }\n\n // Emit the registration:success event.\n this.trigger(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer: function resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (!this.isInMeeting && this.config.enableInactivityEnforcement && this.isReachabilityChecked) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n } else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer: function setLogoutTimer(duration) {\n var _this9 = this;\n this.logger.info('device: setting logout timer');\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', function () {\n _this9.resetLogoutTimer();\n });\n\n // Initialize a new timer.\n this.logoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n _this9.webex.logout();\n }, duration * 1000);\n },\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration: function waitForRegistration() {\n var _this10 = this;\n var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n this.logger.info('device: waiting for registration');\n return new _promise.default(function (resolve, reject) {\n if (_this10.registered) {\n resolve();\n }\n var timeoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return reject(new Error('device: timeout occured while waiting for registration'));\n }, timeout * 1000);\n _this10.once(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, function () {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n markUrlFailedAndGetNew: function markUrlFailedAndGetNew(url) {\n return _promise.default.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n initialize: function initialize() {\n var _this11 = this;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n // Prototype the extended class in order to preserve the parent member.\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n _constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {\n _this11.features.on(\"change:\".concat(collectionName), function (model, value, options) {\n _this11.trigger('change', _this11, options);\n _this11.trigger('change:features', _this11, _this11.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', function () {\n _this11.lastUserActivityDate = (0, _now.default)();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', function () {\n _this11.isInMeeting = true;\n _this11.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', function () {\n _this11.isInMeeting = false;\n _this11.resetLogoutTimer();\n });\n } /* eslint-enable require-jsdoc */,\n version: \"3.8.0-next.10\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"register\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"register\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"_registerInternal\", [_common.oneFlight, _dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"_registerInternal\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"unregister\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"unregister\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"markUrlFailedAndGetNew\", [_dec5], (0, _getOwnPropertyDescriptor.default)(_obj, \"markUrlFailedAndGetNew\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Device;\n//# sourceMappingURL=device.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-device/dist/device.js?");
12052
+ eval("\n\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-symbols */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-symbols.js\");\nvar _Object$getOwnPropertyDescriptor2 = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptors */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-properties */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/date/now */ \"../../../node_modules/@babel/runtime-corejs2/core-js/date/now.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/defineProperty */ \"../../../node_modules/@babel/runtime-corejs2/helpers/defineProperty.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"./node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _commonTimers = __webpack_require__(/*! @webex/common-timers */ \"./node_modules/@webex/common-timers/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _metrics = _interopRequireDefault(__webpack_require__(/*! ./metrics */ \"./node_modules/@webex/internal-plugin-device/dist/metrics.js\"));\nvar _constants = __webpack_require__(/*! ./constants */ \"./node_modules/@webex/internal-plugin-device/dist/constants.js\");\nvar _featuresModel = _interopRequireDefault(__webpack_require__(/*! ./features/features-model */ \"./node_modules/@webex/internal-plugin-device/dist/features/features-model.js\"));\nvar _ipNetworkDetector = _interopRequireDefault(__webpack_require__(/*! ./ipNetworkDetector */ \"./node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js\"));\nvar _types = __webpack_require__(/*! ./types */ \"./node_modules/@webex/internal-plugin-device/dist/types.js\");\nvar _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _obj; // Internal Dependencies\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor2(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor2(t, r)); }); } return e; }\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\nvar Device = _webexCore.WebexPlugin.extend((_dec = (0, _webexCore.waitForValue)('@'), _dec2 = (0, _webexCore.waitForValue)('@'), _dec3 = (0, _webexCore.waitForValue)('@'), _dec4 = (0, _webexCore.waitForValue)('@'), _dec5 = (0, _common.deprecated)('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()'), _dec6 = (0, _webexCore.persist)('@', decider), (_obj = {\n // Ampersand property members.\n\n namespace: 'Device',\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n idAttribute: 'url',\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: _featuresModel.default,\n /**\n * Helper class for detecting what IP network version (ipv4, ipv6) we're on.\n *\n * @type {IpNetworkDetector}\n */\n ipNetworkDetector: _ipNetworkDetector.default\n },\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, function () {\n return [];\n }],\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string'\n },\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn: function fn() {\n return !!this.url;\n }\n }\n },\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n /**\n * This property stores whether or not the next refresh or register request should request energy forecast data\n * in order to prevent over fetching energy forecasts\n *\n * @type {boolean}\n */\n energyForecastConfig: 'boolean',\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean'\n },\n // Event method members.\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted: function meetingStarted() {\n this.webex.trigger('meeting started');\n },\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded: function meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n /**\n * Set the value of energy forecast config for the current registered device.\n * @param {boolean} [energyForecastConfig=false] - fetch an energy forecast on the next refresh/register\n * @returns {void}\n */\n setEnergyForecastConfig: function setEnergyForecastConfig() {\n var energyForecastConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.energyForecastConfig = energyForecastConfig;\n },\n refresh: function refresh() {\n var _this = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is not registered and register instead.\n if (!_this.registered) {\n _this.logger.info('device: device not registered, registering');\n return _this.register(deviceRegistrationOptions);\n }\n\n // Merge body configurations, overriding defaults.\n var body = _objectSpread(_objectSpread({}, _this.serialize()), _this.config.body ? _this.config.body : {});\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (_this.config.ephemeral) {\n body.ttl = _this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread(_objectSpread({}, _this.config.defaults.headers ? _this.config.defaults.headers : {}), _this.config.headers ? _this.config.headers : {}), _this.etag ? {\n 'If-None-Match': _this.etag\n } : {});\n var _deviceRegistrationOp = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp;\n var requestId = _uuid.default.v4();\n _this.set('refresh-request-id', requestId);\n return _this.request({\n method: 'PUT',\n uri: _this.url,\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(_this.config.energyForecast && _this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this.get('refresh-request-id') !== requestId) {\n _this.logger.info('device: refresh request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n return _this.processRegistrationSuccess(response);\n }).catch(function (reason) {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n _this.logger.info('device: refresh failed, device is not valid');\n _this.logger.info('device: attempting to register a new device');\n _this.clear();\n return _this.register(deviceRegistrationOptions);\n }\n return _promise.default.reject(reason);\n });\n });\n },\n /**\n * Fetches the web devices and deletes the third of them which are not recent devices in use\n * @returns {Promise<void, Error>}\n */\n deleteDevices: function deleteDevices() {\n var _this2 = this;\n // Fetch devices with a GET request\n return this.request({\n method: 'GET',\n service: 'wdm',\n resource: 'devices'\n }).then(function (response) {\n var devices = response.body.devices;\n var _this2$_getBody = _this2._getBody(),\n deviceType = _this2$_getBody.deviceType;\n\n // Filter devices of type deviceType\n var webDevices = devices.filter(function (item) {\n return item.deviceType === deviceType;\n });\n var sortedDevices = (0, _lodash.orderBy)(webDevices, [function (item) {\n return new Date(item.modificationTime);\n }]);\n\n // If there are more than two devices, delete the last third\n if (sortedDevices.length > 2) {\n var totalItems = sortedDevices.length;\n var countToDelete = Math.ceil(totalItems / 3);\n var urlsToDelete = sortedDevices.slice(0, countToDelete).map(function (item) {\n return item.url;\n });\n return _promise.default.race(urlsToDelete.map(function (url) {\n return _this2.request({\n uri: url,\n method: 'DELETE'\n });\n }));\n }\n return _promise.default.resolve();\n }).catch(function (error) {\n _this2.logger.error('Failed to retrieve devices:', error);\n return _promise.default.reject(error);\n });\n },\n register: function register() {\n var _this3 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: registering');\n this.webex.internal.newMetrics.callDiagnosticMetrics.setDeviceInfo(this);\n\n // Validate that the device can be registered.\n return this.canRegister().then(function () {\n // Validate if the device is already registered and refresh instead.\n if (_this3.registered) {\n _this3.logger.info('device: device already registered, refreshing');\n return _this3.refresh(deviceRegistrationOptions);\n }\n return _this3._registerInternal(deviceRegistrationOptions).catch(function (error) {\n var _error$body;\n if ((error === null || error === void 0 ? void 0 : (_error$body = error.body) === null || _error$body === void 0 ? void 0 : _error$body.message) === 'User has excessive device registrations') {\n return _this3.deleteDevices().then(function () {\n return _this3._registerInternal(deviceRegistrationOptions);\n });\n }\n throw error;\n });\n });\n },\n _getBody: function _getBody() {\n return _objectSpread(_objectSpread({}, this.config.defaults.body ? this.config.defaults.body : {}), this.config.body ? this.config.body : {});\n },\n _registerInternal: function _registerInternal() {\n var _this4 = this;\n var deviceRegistrationOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger.info('device: making registration request');\n\n // Merge body configurations, overriding defaults.\n var body = this._getBody();\n\n // Merge header configurations, overriding defaults.\n var headers = _objectSpread(_objectSpread({}, this.config.defaults.headers ? this.config.defaults.headers : {}), this.config.headers ? this.config.headers : {});\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n this.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.request'\n });\n var _deviceRegistrationOp2 = deviceRegistrationOptions.includeDetails,\n includeDetails = _deviceRegistrationOp2 === void 0 ? _types.CatalogDetails.all : _deviceRegistrationOp2;\n var requestId = _uuid.default.v4();\n this.set('register-request-id', requestId);\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body: body,\n headers: headers,\n qs: {\n includeUpstreamServices: \"\".concat(includeDetails).concat(this.config.energyForecast && this.energyForecastConfig ? ',energyforecast' : '')\n }\n }).catch(function (error) {\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n throw error;\n }).then(function (response) {\n // If we've signed out in the mean time, the request ID will have changed\n if (_this4.get('register-request-id') !== requestId) {\n _this4.logger.info('device: register request ID mismatch, ignoring response');\n return _promise.default.resolve();\n }\n\n // Do not add any processing of response above this as that will affect timestamp\n _this4.webex.internal.newMetrics.submitInternalEvent({\n name: 'internal.register.device.response'\n });\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);\n return _this4.processRegistrationSuccess(response);\n }).catch(function (error) {\n _this4.webex.internal.metrics.submitClientMetrics(_metrics.default.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {\n error: error\n }\n });\n throw error;\n });\n },\n unregister: function unregister() {\n var _this5 = this;\n this.logger.info('device: unregistering');\n if (!this.registered) {\n this.logger.warn('device: not registered');\n return _promise.default.resolve();\n }\n return this.request({\n uri: this.url,\n method: 'DELETE'\n }).then(function () {\n return _this5.clear();\n }).catch(function (reason) {\n if (reason.statusCode === 404) {\n _this5.logger.info('device: 404 when deleting device, device is already deleted, clearing device');\n _this5.clear();\n }\n throw reason;\n });\n },\n /* eslint-enable require-jsdoc */\n // Helper method members\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister: function canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(function () {\n return (\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm') ? _promise.default.resolve() : _promise.default.reject(new Error(['device: cannot register,', \"'wdm' service is not available from the postauth catalog\"].join(' ')))\n );\n });\n },\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability: function checkNetworkReachability() {\n var _this6 = this;\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n return _promise.default.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n var headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null\n };\n\n // Send the network reachability request.\n return this.request({\n headers: headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl\n }).then(function () {\n _this6.isInNetwork = true;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n }).catch(function () {\n _this6.logger.info('device: did not reach ping endpoint');\n _this6.logger.info('device: triggering off-network timer');\n _this6.isInNetwork = false;\n return _promise.default.resolve(_this6.resetLogoutTimer());\n });\n },\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear: function clear() {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.clear, this, args);\n },\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl: function getWebSocketUrl() {\n var _this7 = this;\n var wait = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n var services = this.webex.internal.services;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration().then(function () {\n return services.convertUrlToPriorityHostUrl(_this7.webSocketUrl);\n }).catch(function (error) {\n _this7.logger.warn(error.message);\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return _promise.default.reject(new Error('device: cannot get websocket url, device is not registered'));\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n var wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return _promise.default.resolve(wsUrl);\n }\n return _promise.default.reject(new Error('device: failed to get the current websocket url'));\n },\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess: function processRegistrationSuccess(response) {\n var _this8 = this;\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n var body = _objectSpread({}, response.body);\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n var _ref = response.headers || {},\n etag = _ref.etag;\n if (this.etag && etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n var features = body.features;\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({\n etag: etag\n });\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n var delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n this.refreshTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return _this8.refresh();\n }, delay);\n }\n\n // Emit the registration:success event.\n this.trigger(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer: function resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (!this.isInMeeting && this.config.enableInactivityEnforcement && this.isReachabilityChecked) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n } else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer: function setLogoutTimer(duration) {\n var _this9 = this;\n this.logger.info('device: setting logout timer');\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', function () {\n _this9.resetLogoutTimer();\n });\n\n // Initialize a new timer.\n this.logoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n _this9.webex.logout();\n }, duration * 1000);\n },\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration: function waitForRegistration() {\n var _this10 = this;\n var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n this.logger.info('device: waiting for registration');\n return new _promise.default(function (resolve, reject) {\n if (_this10.registered) {\n resolve();\n }\n var timeoutTimer = (0, _commonTimers.safeSetTimeout)(function () {\n return reject(new Error('device: timeout occured while waiting for registration'));\n }, timeout * 1000);\n _this10.once(_constants.DEVICE_EVENT_REGISTRATION_SUCCESS, function () {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n markUrlFailedAndGetNew: function markUrlFailedAndGetNew(url) {\n return _promise.default.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n initialize: function initialize() {\n var _this11 = this;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n // Prototype the extended class in order to preserve the parent member.\n (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n _constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {\n _this11.features.on(\"change:\".concat(collectionName), function (model, value, options) {\n _this11.trigger('change', _this11, options);\n _this11.trigger('change:features', _this11, _this11.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', function () {\n _this11.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', function () {\n _this11.lastUserActivityDate = (0, _now.default)();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', function () {\n _this11.isInMeeting = true;\n _this11.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', function () {\n _this11.isInMeeting = false;\n _this11.resetLogoutTimer();\n });\n } /* eslint-enable require-jsdoc */,\n version: \"3.8.0-next.11\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"refresh\", [_common.oneFlight, _dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"refresh\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"register\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"register\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"_registerInternal\", [_common.oneFlight, _dec3], (0, _getOwnPropertyDescriptor.default)(_obj, \"_registerInternal\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"unregister\", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, \"unregister\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"markUrlFailedAndGetNew\", [_dec5], (0, _getOwnPropertyDescriptor.default)(_obj, \"markUrlFailedAndGetNew\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initialize\", [_dec6], (0, _getOwnPropertyDescriptor.default)(_obj, \"initialize\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Device;\n//# sourceMappingURL=device.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-device/dist/device.js?");
12053
12053
 
12054
12054
  /***/ }),
12055
12055
 
@@ -12126,7 +12126,7 @@ eval("\n\nvar _Reflect$construct = __webpack_require__(/*! @babel/runtime-corejs
12126
12126
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12127
12127
 
12128
12128
  "use strict";
12129
- eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\n/*!\n * Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar STATE = {\n INITIAL: 'initial',\n IN_PROGRESS: 'in-progress',\n IDLE: 'idle'\n};\n\n/**\n * @class\n */\nvar IpNetworkDetector = _webexCore.WebexPlugin.extend({\n idAttribute: 'IpNetworkDetectorId',\n namespace: 'Device',\n props: {\n firstIpV4: ['number', true, -1],\n // time [ms] it took to receive first IPv4 candidate\n firstIpV6: ['number', true, -1],\n // time [ms] it took to receive first IPv6 candidate\n firstMdns: ['number', true, -1],\n // time [ms] it took to receive first mDNS candidate\n totalTime: ['number', true, -1],\n // total time [ms] it took to do the last IP network detection\n state: ['string', true, STATE.INITIAL],\n pendingDetection: ['object', false, undefined]\n },\n derived: {\n /**\n * True if we know we're on an IPv4 network,\n * False if we know that we are not on an IPv4 network,\n * undefined if we are not sure\n */\n supportsIpV4: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV4 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV4 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n },\n /**\n * True if we know we're on an IPv6 network,\n * False if we know that we are not on an IPv6 network,\n * undefined if we are not sure\n */\n supportsIpV6: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV6 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV6 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n }\n },\n /**\n * Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions\n *\n * @private\n * @returns {boolean}\n */\n receivedOnlyMDnsCandidates: function receivedOnlyMDnsCandidates() {\n return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;\n },\n /**\n *\n * @param {RTCPeerConnection} pc Peer connection to use\n * @private\n * @returns {Promise<void>}\n */\n gatherLocalCandidates: function gatherLocalCandidates(pc) {\n var _this = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new _promise.default(function (resolve, reject) {\n var done = false;\n _this.firstIpV4 = -1;\n _this.firstIpV6 = -1;\n _this.firstMdns = -1;\n _this.totalTime = -1;\n var startTime = performance.now();\n var doneGatheringIceCandidates = function doneGatheringIceCandidates() {\n if (done) {\n return;\n }\n done = true;\n _this.totalTime = performance.now() - startTime;\n resolve();\n };\n pc.onicecandidate = function (event) {\n var _event$candidate;\n if ((_event$candidate = event.candidate) !== null && _event$candidate !== void 0 && _event$candidate.address) {\n if (event.candidate.address.endsWith('.local')) {\n // if we don't have camera/mic permissions, browser just gives us mDNS candidates\n if (_this.firstMdns === -1) {\n _this.firstMdns = performance.now() - startTime;\n }\n } else if (event.candidate.address.includes(':')) {\n if (_this.firstIpV6 === -1) {\n _this.firstIpV6 = performance.now() - startTime;\n }\n } else if (_this.firstIpV4 === -1) {\n _this.firstIpV4 = performance.now() - startTime;\n }\n if (_this.firstIpV4 >= 0 && _this.firstIpV6 >= 0) {\n // if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now\n resolve();\n }\n } else if (event.candidate === null) {\n doneGatheringIceCandidates();\n }\n };\n pc.onicegatheringstatechange = function () {\n if (pc.iceGatheringState === 'complete') {\n doneGatheringIceCandidates();\n }\n };\n pc.createDataChannel('data');\n pc.createOffer().then(function (offer) {\n return pc.setLocalDescription(offer);\n }).catch(function (e) {\n _this.webex.logger.error('Failed to detect ip network version:', e);\n reject(e);\n });\n }));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n /**\n * Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the\n * supportsIpV4 and supportsIpV6 props to find out the result.\n *\n * @param {boolean} force - if false, the detection will only be done if we haven't managed to get any meaningful results yet\n * @returns {Promise<void>}\n */\n detect: function detect() {\n var _arguments = arguments,\n _this2 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {\n var force, results, pc, forceParam;\n return _regenerator.default.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n force = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : false;\n if (!(_this2.state === STATE.IN_PROGRESS)) {\n _context2.next = 4;\n break;\n }\n _this2.pendingDetection = {\n force: force\n };\n return _context2.abrupt(\"return\");\n case 4:\n if (!(!force && _this2.state !== STATE.INITIAL && !_this2.receivedOnlyMDnsCandidates())) {\n _context2.next = 6;\n break;\n }\n return _context2.abrupt(\"return\");\n case 6:\n _context2.prev = 6;\n _this2.state = STATE.IN_PROGRESS;\n pc = new RTCPeerConnection();\n _context2.next = 11;\n return _this2.gatherLocalCandidates(pc);\n case 11:\n results = _context2.sent;\n case 12:\n _context2.prev = 12;\n pc.close();\n _this2.state = STATE.IDLE;\n return _context2.finish(12);\n case 16:\n if (_this2.pendingDetection) {\n forceParam = _this2.pendingDetection.force;\n _this2.pendingDetection = undefined;\n _this2.detect(forceParam);\n }\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, null, [[6,, 12, 16]]);\n }))();\n },\n version: \"3.8.0-next.10\"\n});\nvar _default = exports[\"default\"] = IpNetworkDetector;\n//# sourceMappingURL=ipNetworkDetector.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js?");
12129
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\n/*!\n * Copyright (c) 2015-2023 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar STATE = {\n INITIAL: 'initial',\n IN_PROGRESS: 'in-progress',\n IDLE: 'idle'\n};\n\n/**\n * @class\n */\nvar IpNetworkDetector = _webexCore.WebexPlugin.extend({\n idAttribute: 'IpNetworkDetectorId',\n namespace: 'Device',\n props: {\n firstIpV4: ['number', true, -1],\n // time [ms] it took to receive first IPv4 candidate\n firstIpV6: ['number', true, -1],\n // time [ms] it took to receive first IPv6 candidate\n firstMdns: ['number', true, -1],\n // time [ms] it took to receive first mDNS candidate\n totalTime: ['number', true, -1],\n // total time [ms] it took to do the last IP network detection\n state: ['string', true, STATE.INITIAL],\n pendingDetection: ['object', false, undefined]\n },\n derived: {\n /**\n * True if we know we're on an IPv4 network,\n * False if we know that we are not on an IPv4 network,\n * undefined if we are not sure\n */\n supportsIpV4: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV4 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV4 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n },\n /**\n * True if we know we're on an IPv6 network,\n * False if we know that we are not on an IPv6 network,\n * undefined if we are not sure\n */\n supportsIpV6: {\n deps: ['firstIpV4', 'firstIpV6', 'firstMdns', 'totalTime'],\n /**\n * Function for calculating the value of supportsIpV6 prop\n * @returns {boolean | undefined}\n */\n fn: function fn() {\n if (this.firstIpV6 >= 0) {\n return true;\n }\n if (this.totalTime < 0) {\n // we haven't completed the detection, yet\n return undefined;\n }\n if (this.receivedOnlyMDnsCandidates()) {\n return undefined;\n }\n return false;\n }\n }\n },\n /**\n * Returns true if we have received only mDNS candidates - browsers usually do that if we don't have any user media permissions\n *\n * @private\n * @returns {boolean}\n */\n receivedOnlyMDnsCandidates: function receivedOnlyMDnsCandidates() {\n return this.totalTime >= 0 && this.firstMdns >= 0 && this.firstIpV4 < 0 && this.firstIpV6 < 0;\n },\n /**\n *\n * @param {RTCPeerConnection} pc Peer connection to use\n * @private\n * @returns {Promise<void>}\n */\n gatherLocalCandidates: function gatherLocalCandidates(pc) {\n var _this = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", new _promise.default(function (resolve, reject) {\n var done = false;\n _this.firstIpV4 = -1;\n _this.firstIpV6 = -1;\n _this.firstMdns = -1;\n _this.totalTime = -1;\n var startTime = performance.now();\n var doneGatheringIceCandidates = function doneGatheringIceCandidates() {\n if (done) {\n return;\n }\n done = true;\n _this.totalTime = performance.now() - startTime;\n resolve();\n };\n pc.onicecandidate = function (event) {\n var _event$candidate;\n if ((_event$candidate = event.candidate) !== null && _event$candidate !== void 0 && _event$candidate.address) {\n if (event.candidate.address.endsWith('.local')) {\n // if we don't have camera/mic permissions, browser just gives us mDNS candidates\n if (_this.firstMdns === -1) {\n _this.firstMdns = performance.now() - startTime;\n }\n } else if (event.candidate.address.includes(':')) {\n if (_this.firstIpV6 === -1) {\n _this.firstIpV6 = performance.now() - startTime;\n }\n } else if (_this.firstIpV4 === -1) {\n _this.firstIpV4 = performance.now() - startTime;\n }\n if (_this.firstIpV4 >= 0 && _this.firstIpV6 >= 0) {\n // if we've got both ipv4 and ipv6 candidates, there is no need to wait for any more candidates, we can resolve now\n resolve();\n }\n } else if (event.candidate === null) {\n doneGatheringIceCandidates();\n }\n };\n pc.onicegatheringstatechange = function () {\n if (pc.iceGatheringState === 'complete') {\n doneGatheringIceCandidates();\n }\n };\n pc.createDataChannel('data');\n pc.createOffer().then(function (offer) {\n return pc.setLocalDescription(offer);\n }).catch(function (e) {\n _this.webex.logger.error('Failed to detect ip network version:', e);\n reject(e);\n });\n }));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }))();\n },\n /**\n * Detects if we are on IPv4 and/or IPv6 network. Once it resolves, read the\n * supportsIpV4 and supportsIpV6 props to find out the result.\n *\n * @param {boolean} force - if false, the detection will only be done if we haven't managed to get any meaningful results yet\n * @returns {Promise<void>}\n */\n detect: function detect() {\n var _arguments = arguments,\n _this2 = this;\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {\n var force, results, pc, forceParam;\n return _regenerator.default.wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n force = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : false;\n if (!(_this2.state === STATE.IN_PROGRESS)) {\n _context2.next = 4;\n break;\n }\n _this2.pendingDetection = {\n force: force\n };\n return _context2.abrupt(\"return\");\n case 4:\n if (!(!force && _this2.state !== STATE.INITIAL && !_this2.receivedOnlyMDnsCandidates())) {\n _context2.next = 6;\n break;\n }\n return _context2.abrupt(\"return\");\n case 6:\n _context2.prev = 6;\n _this2.state = STATE.IN_PROGRESS;\n pc = new RTCPeerConnection();\n _context2.next = 11;\n return _this2.gatherLocalCandidates(pc);\n case 11:\n results = _context2.sent;\n case 12:\n _context2.prev = 12;\n pc.close();\n _this2.state = STATE.IDLE;\n return _context2.finish(12);\n case 16:\n if (_this2.pendingDetection) {\n forceParam = _this2.pendingDetection.force;\n _this2.pendingDetection = undefined;\n _this2.detect(forceParam);\n }\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, null, [[6,, 12, 16]]);\n }))();\n },\n version: \"3.8.0-next.11\"\n});\nvar _default = exports[\"default\"] = IpNetworkDetector;\n//# sourceMappingURL=ipNetworkDetector.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-device/dist/ipNetworkDetector.js?");
12130
12130
 
12131
12131
  /***/ }),
12132
12132
 
@@ -12152,6 +12152,39 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
12152
12152
 
12153
12153
  /***/ }),
12154
12154
 
12155
+ /***/ "./node_modules/@webex/internal-plugin-support/dist/config.js":
12156
+ /*!********************************************************************!*\
12157
+ !*** ./node_modules/@webex/internal-plugin-support/dist/config.js ***!
12158
+ \********************************************************************/
12159
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12160
+
12161
+ "use strict";
12162
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nvar _default = exports[\"default\"] = {\n device: {\n preDiscoveryServices: {\n atlasServiceUrl: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n atlas: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n clientLogs: process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',\n clientLogsServiceUrl: process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1'\n }\n },\n support: {\n appType: '',\n appVersion: '',\n languageCode: '',\n incrementalLogs: false\n }\n};\n//# sourceMappingURL=config.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-support/dist/config.js?");
12163
+
12164
+ /***/ }),
12165
+
12166
+ /***/ "./node_modules/@webex/internal-plugin-support/dist/index.js":
12167
+ /*!*******************************************************************!*\
12168
+ !*** ./node_modules/@webex/internal-plugin-support/dist/index.js ***!
12169
+ \*******************************************************************/
12170
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12171
+
12172
+ "use strict";
12173
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\n_Object$defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _support.default;\n }\n});\n__webpack_require__(/*! @webex/internal-plugin-device */ \"./node_modules/@webex/internal-plugin-device/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _support = _interopRequireDefault(__webpack_require__(/*! ./support */ \"./node_modules/@webex/internal-plugin-support/dist/support.js\"));\nvar _config = _interopRequireDefault(__webpack_require__(/*! ./config */ \"./node_modules/@webex/internal-plugin-support/dist/config.js\"));\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n(0, _webexCore.registerInternalPlugin)('support', _support.default, {\n config: _config.default\n});\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-support/dist/index.js?");
12174
+
12175
+ /***/ }),
12176
+
12177
+ /***/ "./node_modules/@webex/internal-plugin-support/dist/support.js":
12178
+ /*!*********************************************************************!*\
12179
+ !*** ./node_modules/@webex/internal-plugin-support/dist/support.js ***!
12180
+ \*********************************************************************/
12181
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12182
+
12183
+ "use strict";
12184
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar Support = _webexCore.WebexPlugin.extend({\n namespace: 'Support',\n getFeedbackUrl: function getFeedbackUrl(options) {\n options = options || {};\n return this.request({\n method: 'POST',\n api: 'conversation',\n resource: 'users/deskFeedbackUrl',\n body: (0, _lodash.defaults)(options, {\n appVersion: this.config.appVersion,\n appType: this.config.appType,\n feedbackId: options.feedbackId || _uuid.default.v4(),\n languageCode: this.config.languageCode\n })\n }).then(function (res) {\n return res.body.url;\n });\n },\n getSupportUrl: function getSupportUrl() {\n return this.webex.request({\n method: 'GET',\n api: 'conversation',\n resource: 'users/deskSupportUrl',\n qs: {\n languageCode: this.config.languageCode\n }\n }).then(function (res) {\n return res.body.url;\n });\n },\n /**\n * Sends logs to the backend\n *\n * @param {Object} metadata metadata about the logs\n * @param {Array} logs logs to send, if undefined, SDK's logs will be sent\n * @param {Object} options additional options\n * @param {string} options.type 'full' or 'diff', if not specified then the config.incrementalLogs value is used to determine the type,\n * this option only applies if logs parameter is undefined\n * 'diff' means that only the logs since the last log upload will be sent\n * 'full' means that all the logs from internal buffers will be sent\n * @returns {Promise}\n */\n submitLogs: function submitLogs(metadata, logs) {\n var _this = this;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var metadataArray = this._constructFileMetadata(metadata);\n var type = options.type;\n\n // this is really testing that Ampersand is fully ready. once it's ready, these exist\n if (!logs && this.webex.logger.sdkBuffer && this.webex.logger.clientBuffer && this.webex.logger.buffer) {\n var diff = type !== undefined ? type === 'diff' : this.config.incrementalLogs;\n logs = this.webex.logger.formatLogs({\n diff: diff\n });\n }\n var filename;\n if (metadata.locusId && metadata.callStart) {\n filename = \"\".concat(metadata.locusId, \"_\").concat(metadata.callStart, \".txt\");\n } else {\n filename = \"\".concat(this.webex.sessionId, \".txt\");\n }\n var userId;\n return this.webex.credentials.getUserToken().catch(function () {\n return _this.webex.credentials.getClientToken();\n }).then( /*#__PURE__*/function () {\n var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(token) {\n var headers, initalOpts, finalOpts, uploadOptions;\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n headers = {\n authorization: token.toString()\n };\n initalOpts = {\n service: 'clientLogs',\n resource: 'logs/urls'\n };\n finalOpts = {\n service: 'clientLogs',\n resource: 'logs/meta'\n };\n uploadOptions = (0, _lodash.defaults)(initalOpts, {\n file: logs,\n shouldAttemptReauth: false,\n headers: headers,\n phases: {\n initialize: {\n body: {\n file: filename\n }\n },\n upload: {\n $uri: function $uri(session) {\n return session.tempURL;\n }\n },\n finalize: (0, _lodash.defaults)(finalOpts, {\n $body: function $body(session) {\n userId = session.userId;\n return {\n filename: session.logFilename,\n data: metadataArray,\n userId: _this.webex.internal.device.userId || session.userId\n };\n }\n })\n }\n });\n return _context.abrupt(\"return\", _this.webex.upload(uploadOptions));\n case 5:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }()).then(function (body) {\n if (userId && !body.userId) {\n body.userId = userId;\n }\n return body;\n });\n },\n /**\n * Constructs an array of key-value pairs for log upload.\n * @param {*} metadata\n * @returns {array}\n */\n _constructFileMetadata: function _constructFileMetadata(metadata) {\n var metadataArray = ['locusId', 'appVersion', 'callStart', 'feedbackId', 'correlationId', 'meetingId', 'surveySessionId', 'productAreaTag', 'issueTypeTag', 'issueDescTag', 'locussessionid', 'autoupload'].map(function (key) {\n if (metadata[key]) {\n return {\n key: key,\n value: metadata[key]\n };\n }\n return null;\n }).filter(function (entry) {\n return Boolean(entry);\n });\n if (this.webex.sessionId) {\n metadataArray.push({\n key: 'trackingId',\n value: this.webex.sessionId\n });\n }\n if (this.webex.internal.support.config.appVersion) {\n metadataArray.push({\n key: 'appVersion',\n value: this.webex.internal.support.config.appVersion\n });\n }\n if (this.webex.internal.device.userId) {\n metadataArray.push({\n key: 'userId',\n value: this.webex.internal.device.userId\n });\n }\n if (this.webex.internal.device.orgId) {\n metadataArray.push({\n key: 'orgId',\n value: this.webex.internal.device.orgId\n });\n }\n return metadataArray;\n },\n version: \"3.8.0-next.13\"\n});\nvar _default = exports[\"default\"] = Support;\n//# sourceMappingURL=support.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/internal-plugin-support/dist/support.js?");
12185
+
12186
+ /***/ }),
12187
+
12155
12188
  /***/ "./node_modules/@webex/plugin-authorization-browser/dist/authorization.js":
12156
12189
  /*!********************************************************************************!*\
12157
12190
  !*** ./node_modules/@webex/plugin-authorization-browser/dist/authorization.js ***!
@@ -12159,7 +12192,7 @@ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-co
12159
12192
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12160
12193
 
12161
12194
  "use strict";
12162
- eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _entries = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/entries */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/entries.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _parseInt2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/parse-int */ \"../../../node_modules/@babel/runtime-corejs2/core-js/parse-int.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"../../../node_modules/querystring-es3/index.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"./node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _dec, _dec2, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n/* eslint camelcase: [0] */\nvar jwt = __webpack_require__(/*! jsonwebtoken */ \"../../../node_modules/jsonwebtoken/index.js\");\nvar OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';\nvar EMPTY_OBJECT_STRING = _common.base64.encode((0, _stringify.default)({}));\n\n/**\n * Browser support for OAuth2. Automatically parses the URL hash for an access\n * token\n * @class\n * @name AuthorizationBrowser\n */\nvar Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), _dec2 = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {\n derived: {\n /**\n * Alias of {@link AuthorizationBrowser#isAuthorizing}\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthenticating: {\n deps: ['isAuthorizing'],\n fn: function fn() {\n return this.isAuthorizing;\n }\n }\n },\n session: {\n /**\n * Indicates if an Authorization Code exchange is inflight\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthorizing: {\n default: false,\n type: 'boolean'\n },\n ready: {\n default: false,\n type: 'boolean'\n }\n },\n namespace: 'Credentials',\n /**\n * Initializer\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} attrs {@link AmpersandState}\n * @param {boolean} attrs.parse Controls whether or not the the url should get\n * parsed for an access token\n * @private\n * @returns {Authorization}\n */\n // eslint-disable-next-line complexity\n initialize: function initialize(attrs, options) {\n var _this = this;\n var ret = (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, [attrs, options]);\n\n // Reminder, we can't do parse based on config, because config is not\n // available until nextTick and we want to be able to throw errors found in\n // the url.\n if (attrs.parse === false) {\n this.ready = true;\n return ret;\n }\n var location = _url.default.parse(this.webex.getWindow().location.href, true);\n this._checkForErrors(location);\n var hash = location.hash;\n if (!hash) {\n this.ready = true;\n return ret;\n }\n if (hash.includes('#')) {\n hash = hash.substr(1);\n }\n location.hash = _querystring.default.parse(hash);\n if (location.hash.state) {\n location.hash.state = JSON.parse(_common.base64.decode(location.hash.state));\n }\n var tokenData = this._parseHash(location);\n if (!tokenData) {\n return ret;\n }\n this._cleanUrl(location);\n\n // Wait until nextTick in case `credentials` hasn't initialized yet\n process.nextTick(function () {\n _this.webex.credentials.set({\n supertoken: tokenData\n });\n _this.ready = true;\n });\n return ret;\n },\n /**\n * Initiates the OAuth flow for user authentication.\n * This function determines the type of OAuth flow to use based on the client type configuration.\n * If the client is configured as \"confidential\", it will initiate the Authorization Code Grant flow;\n * otherwise, it will initiate the Implicit Grant flow.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options - The options to configure the OAuth flow.\n * @param {Object} [options.state] - An optional state object that can be used to include additional\n * information such as security tokens. A CSRF token will be automatically generated and added to\n * this state object.\n * @param {boolean|Object} [options.separateWindow] - Determines if the login should open in a separate window.\n * This can be a boolean or an object specifying window features:\n * - If `true`, a new window with default dimensions is opened.\n * - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).\n * @returns {Promise<void>} - A promise that resolves when the appropriate OAuth flow has been initiated.\n * The promise does not necessarily indicate the completion of the login process.\n * @throws {Error} - Throws an error if there are issues initiating the OAuth flow.\n */\n initiateLogin: function initiateLogin() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n options.state = options.state || {};\n options.state.csrf_token = this._generateSecurityToken();\n\n // If we're not explicitly a confidential client, assume we're a public\n // client\n if (this.config.clientType === 'confidential') {\n return this.initiateAuthorizationCodeGrant(options);\n }\n return this.initiateImplicitGrant(options);\n },\n /**\n * Initiates the Implicit Grant flow for authorization.\n * This function constructs the login URL and either opens it in a new\n * window or in the current window based on the provided options.\n * Typically called via {@link AuthorizationBrowser#initiateLogin}.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options - The options to configure the login flow.\n * @param {Object} [options.separateWindow] - Determines if the login should open in a separate window.\n * This can be a boolean or an object specifying window features:\n * - If `true`, a new window with default dimensions is opened.\n * - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).\n * @returns {Promise<void>} - A promise that resolves immediately after initiating the login flow.\n * This promise does not indicate the completion of the login process.\n * @throws {Error} - Throws an error if the login URL cannot be constructed or if window opening fails.\n */\n initiateImplicitGrant: function initiateImplicitGrant(options) {\n this.logger.info('authorization: initiating implicit grant flow');\n var loginUrl = this.webex.credentials.buildLoginUrl((0, _assign.default)({\n response_type: 'token'\n }, options));\n if (options !== null && options !== void 0 && options.separateWindow) {\n // Default window settings\n var defaultWindowSettings = {\n width: 600,\n height: 800\n };\n\n // Merge user provided settings with defaults\n var windowSettings = (0, _assign.default)(defaultWindowSettings, (0, _typeof2.default)(options.separateWindow) === 'object' ? options.separateWindow : {});\n // Convert settings object to window.open features string\n var windowFeatures = (0, _entries.default)(windowSettings).map(function (_ref) {\n var _ref2 = (0, _slicedToArray2.default)(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n return \"\".concat(key, \"=\").concat(value);\n }).join(',');\n this.webex.getWindow().open(loginUrl, '_blank', windowFeatures);\n } else {\n // Default behavior - open in same window\n this.webex.getWindow().location = loginUrl;\n }\n return _promise.default.resolve();\n },\n /**\n * Kicks off the Implicit Code grant flow. Typically called via\n * {@link AuthorizationBrowser#initiateLogin}\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @returns {Promise}\n */\n initiateAuthorizationCodeGrant: function initiateAuthorizationCodeGrant(options) {\n this.logger.info('authorization: initiating authorization code grant flow');\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl((0, _assign.default)({\n response_type: 'code'\n }, options));\n return _promise.default.resolve();\n },\n /**\n * Requests a Webex access token for a user already authenticated into\n * your product.\n *\n * Note: You'll need to supply a jwtRefreshCallback of the form\n * `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to\n * work.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {Object} options.jwt This is a jwt generated by your backend that\n * identifies a user in your system\n * @returns {Promise}\n */\n requestAccessTokenFromJwt: function requestAccessTokenFromJwt(_ref3) {\n var _this2 = this;\n var jwt = _ref3.jwt;\n var hydraUri = this.webex.internal.services.get('hydra', true);\n if (hydraUri && hydraUri.slice(-1) !== '/') {\n // add a `/` to hydra's uri from the services catalog so that\n // it matches the current env service format.\n hydraUri += '/';\n }\n hydraUri = hydraUri || process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1/';\n return this.webex.request({\n method: 'POST',\n uri: \"\".concat(hydraUri, \"jwt/login\"),\n headers: {\n authorization: jwt\n }\n }).then(function (_ref4) {\n var body = _ref4.body;\n return {\n access_token: body.token,\n token_type: 'Bearer',\n expires_in: body.expiresIn\n };\n }).then(function (token) {\n _this2.webex.credentials.set({\n supertoken: token\n });\n }).then(function () {\n return _this2.webex.internal.services.initServiceCatalogs();\n });\n },\n /**\n * Called by {@link WebexCore#logout()}. Redirects to the logout page\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {boolean} options.noRedirect if true, does not redirect\n * @returns {Promise}\n */\n logout: function logout() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!options.noRedirect) {\n this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);\n }\n },\n /**\n * Creates a jwt user token\n * @param {object} options\n * @param {String} options.issuer Guest Issuer ID\n * @param {String} options.secretId Guest Secret ID\n * @param {String} options.displayName Guest Display Name | optional\n * @param {String} options.expiresIn\n * @returns {Promise<object>}\n */\n createJwt: function createJwt(_ref5) {\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n var issuer, secretId, displayName, expiresIn, secret, payload, alg, jwtToken;\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n issuer = _ref5.issuer, secretId = _ref5.secretId, displayName = _ref5.displayName, expiresIn = _ref5.expiresIn;\n secret = Buffer.from(secretId, 'base64');\n payload = {\n \"sub\": \"guest-user-\".concat((0, _uuid.default)()),\n \"iss\": issuer,\n \"name\": displayName || \"Guest User - \".concat((0, _uuid.default)())\n };\n alg = 'HS256';\n _context.prev = 4;\n jwtToken = jwt.sign(payload, secret, {\n expiresIn: expiresIn\n });\n return _context.abrupt(\"return\", _promise.default.resolve({\n jwt: jwtToken\n }));\n case 9:\n _context.prev = 9;\n _context.t0 = _context[\"catch\"](4);\n return _context.abrupt(\"return\", _promise.default.reject(_context.t0));\n case 12:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[4, 9]]);\n }))();\n },\n /**\n * Checks if the result of the login redirect contains an error string\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _checkForErrors: function _checkForErrors(location) {\n var query = location.query;\n if (query && query.error) {\n var ErrorConstructor = _webexCore.grantErrors.select(query.error);\n throw new ErrorConstructor(query);\n }\n },\n /**\n * Removes no-longer needed values from the url (access token, csrf token, etc)\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _cleanUrl: function _cleanUrl(location) {\n location = (0, _lodash.cloneDeep)(location);\n if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {\n ['access_token', 'token_type', 'expires_in', 'refresh_token', 'refresh_token_expires_in'].forEach(function (key) {\n return (0, _deleteProperty.default)(location.hash, key);\n });\n if (!(0, _lodash.isEmpty)(location.hash.state)) {\n location.hash.state = _common.base64.encode((0, _stringify.default)((0, _lodash.omit)(location.hash.state, 'csrf_token')));\n if (location.hash.state === EMPTY_OBJECT_STRING) {\n (0, _deleteProperty.default)(location.hash, 'state');\n }\n } else {\n (0, _deleteProperty.default)(location.hash, 'state');\n }\n location.hash = _querystring.default.stringify(location.hash);\n this.webex.getWindow().history.replaceState({}, null, _url.default.format(location));\n }\n },\n /**\n * Generates a CSRF token and sticks in in sessionStorage\n * @instance\n * @memberof AuthorizationBrowser\n * @private\n * @returns {Promise}\n */\n _generateSecurityToken: function _generateSecurityToken() {\n this.logger.info('authorization: generating csrf token');\n var token = _uuid.default.v4();\n this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);\n return token;\n },\n /**\n * Parses the url hash into an access token object\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Object}\n */\n _parseHash: function _parseHash(location) {\n var hash = (0, _lodash.cloneDeep)(location.hash);\n if (hash) {\n this._verifySecurityToken(hash);\n }\n if (!hash.access_token) {\n this.ready = true;\n return undefined;\n }\n if (hash.expires_in) {\n hash.expires_in = (0, _parseInt2.default)(hash.expires_in, 10);\n }\n if (hash.refresh_token_expires_in) {\n hash.refresh_token_expires_in = (0, _parseInt2.default)(hash.refresh_token_expires_in, 10);\n }\n return hash;\n },\n /**\n * Checks if the CSRF token in sessionStorage is the same as the one returned\n * in the url.\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} hash\n * @private\n * @returns {Promise}\n */\n _verifySecurityToken: function _verifySecurityToken(hash) {\n var sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);\n this.webex.getWindow().sessionStorage.removeItem(OAUTH2_CSRF_TOKEN);\n if (!sessionToken) {\n return;\n }\n if (!hash.state) {\n throw new Error(\"Expected CSRF token \".concat(sessionToken, \", but not found in redirect hash\"));\n }\n if (!hash.state.csrf_token) {\n throw new Error(\"Expected CSRF token \".concat(sessionToken, \", but not found in redirect hash\"));\n }\n var token = hash.state.csrf_token;\n if (token !== sessionToken) {\n throw new Error(\"CSRF token \".concat(token, \" does not match stored token \").concat(sessionToken));\n }\n },\n version: \"3.8.0-next.11\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"initiateImplicitGrant\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"initiateImplicitGrant\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initiateAuthorizationCodeGrant\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"initiateAuthorizationCodeGrant\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"requestAccessTokenFromJwt\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"requestAccessTokenFromJwt\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Authorization;\n//# sourceMappingURL=authorization.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/plugin-authorization-browser/dist/authorization.js?");
12195
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/regenerator */ \"../../../node_modules/@babel/runtime-corejs2/regenerator/index.js\"));\nvar _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/asyncToGenerator */ \"../../../node_modules/@babel/runtime-corejs2/helpers/asyncToGenerator.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\"));\nvar _applyDecoratedDescriptor2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/applyDecoratedDescriptor */ \"../../../node_modules/@babel/runtime-corejs2/helpers/applyDecoratedDescriptor.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _apply = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/apply */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/apply.js\"));\nvar _assign = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/assign */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/assign.js\"));\nvar _entries = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/entries */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/entries.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/promise */ \"../../../node_modules/@babel/runtime-corejs2/core-js/promise.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _parseInt2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/parse-int */ \"../../../node_modules/@babel/runtime-corejs2/core-js/parse-int.js\"));\nvar _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\"));\nvar _querystring = _interopRequireDefault(__webpack_require__(/*! querystring */ \"../../../node_modules/querystring-es3/index.js\"));\nvar _url = _interopRequireDefault(__webpack_require__(/*! url */ \"../../../node_modules/url/url.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"./node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\nvar _uuid = _interopRequireDefault(__webpack_require__(/*! uuid */ \"../../../node_modules/uuid/index.js\"));\nvar _dec, _dec2, _obj;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n/* eslint camelcase: [0] */\nvar jwt = __webpack_require__(/*! jsonwebtoken */ \"../../../node_modules/jsonwebtoken/index.js\");\nvar OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';\nvar EMPTY_OBJECT_STRING = _common.base64.encode((0, _stringify.default)({}));\n\n/**\n * Browser support for OAuth2. Automatically parses the URL hash for an access\n * token\n * @class\n * @name AuthorizationBrowser\n */\nvar Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), _dec2 = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {\n derived: {\n /**\n * Alias of {@link AuthorizationBrowser#isAuthorizing}\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthenticating: {\n deps: ['isAuthorizing'],\n fn: function fn() {\n return this.isAuthorizing;\n }\n }\n },\n session: {\n /**\n * Indicates if an Authorization Code exchange is inflight\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthorizing: {\n default: false,\n type: 'boolean'\n },\n ready: {\n default: false,\n type: 'boolean'\n }\n },\n namespace: 'Credentials',\n /**\n * Initializer\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} attrs {@link AmpersandState}\n * @param {boolean} attrs.parse Controls whether or not the the url should get\n * parsed for an access token\n * @private\n * @returns {Authorization}\n */\n // eslint-disable-next-line complexity\n initialize: function initialize(attrs, options) {\n var _this = this;\n var ret = (0, _apply.default)(_webexCore.WebexPlugin.prototype.initialize, this, [attrs, options]);\n\n // Reminder, we can't do parse based on config, because config is not\n // available until nextTick and we want to be able to throw errors found in\n // the url.\n if (attrs.parse === false) {\n this.ready = true;\n return ret;\n }\n var location = _url.default.parse(this.webex.getWindow().location.href, true);\n this._checkForErrors(location);\n var hash = location.hash;\n if (!hash) {\n this.ready = true;\n return ret;\n }\n if (hash.includes('#')) {\n hash = hash.substr(1);\n }\n location.hash = _querystring.default.parse(hash);\n if (location.hash.state) {\n location.hash.state = JSON.parse(_common.base64.decode(location.hash.state));\n }\n var tokenData = this._parseHash(location);\n if (!tokenData) {\n return ret;\n }\n this._cleanUrl(location);\n\n // Wait until nextTick in case `credentials` hasn't initialized yet\n process.nextTick(function () {\n _this.webex.credentials.set({\n supertoken: tokenData\n });\n _this.ready = true;\n });\n return ret;\n },\n /**\n * Initiates the OAuth flow for user authentication.\n * This function determines the type of OAuth flow to use based on the client type configuration.\n * If the client is configured as \"confidential\", it will initiate the Authorization Code Grant flow;\n * otherwise, it will initiate the Implicit Grant flow.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options - The options to configure the OAuth flow.\n * @param {Object} [options.state] - An optional state object that can be used to include additional\n * information such as security tokens. A CSRF token will be automatically generated and added to\n * this state object.\n * @param {boolean|Object} [options.separateWindow] - Determines if the login should open in a separate window.\n * This can be a boolean or an object specifying window features:\n * - If `true`, a new window with default dimensions is opened.\n * - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).\n * @returns {Promise<void>} - A promise that resolves when the appropriate OAuth flow has been initiated.\n * The promise does not necessarily indicate the completion of the login process.\n * @throws {Error} - Throws an error if there are issues initiating the OAuth flow.\n */\n initiateLogin: function initiateLogin() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n options.state = options.state || {};\n options.state.csrf_token = this._generateSecurityToken();\n\n // If we're not explicitly a confidential client, assume we're a public\n // client\n if (this.config.clientType === 'confidential') {\n return this.initiateAuthorizationCodeGrant(options);\n }\n return this.initiateImplicitGrant(options);\n },\n /**\n * Initiates the Implicit Grant flow for authorization.\n * This function constructs the login URL and either opens it in a new\n * window or in the current window based on the provided options.\n * Typically called via {@link AuthorizationBrowser#initiateLogin}.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options - The options to configure the login flow.\n * @param {Object} [options.separateWindow] - Determines if the login should open in a separate window.\n * This can be a boolean or an object specifying window features:\n * - If `true`, a new window with default dimensions is opened.\n * - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).\n * @returns {Promise<void>} - A promise that resolves immediately after initiating the login flow.\n * This promise does not indicate the completion of the login process.\n * @throws {Error} - Throws an error if the login URL cannot be constructed or if window opening fails.\n */\n initiateImplicitGrant: function initiateImplicitGrant(options) {\n this.logger.info('authorization: initiating implicit grant flow');\n var loginUrl = this.webex.credentials.buildLoginUrl((0, _assign.default)({\n response_type: 'token'\n }, options));\n if (options !== null && options !== void 0 && options.separateWindow) {\n // Default window settings\n var defaultWindowSettings = {\n width: 600,\n height: 800\n };\n\n // Merge user provided settings with defaults\n var windowSettings = (0, _assign.default)(defaultWindowSettings, (0, _typeof2.default)(options.separateWindow) === 'object' ? options.separateWindow : {});\n // Convert settings object to window.open features string\n var windowFeatures = (0, _entries.default)(windowSettings).map(function (_ref) {\n var _ref2 = (0, _slicedToArray2.default)(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n return \"\".concat(key, \"=\").concat(value);\n }).join(',');\n this.webex.getWindow().open(loginUrl, '_blank', windowFeatures);\n } else {\n // Default behavior - open in same window\n this.webex.getWindow().location = loginUrl;\n }\n return _promise.default.resolve();\n },\n /**\n * Kicks off the Implicit Code grant flow. Typically called via\n * {@link AuthorizationBrowser#initiateLogin}\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @returns {Promise}\n */\n initiateAuthorizationCodeGrant: function initiateAuthorizationCodeGrant(options) {\n this.logger.info('authorization: initiating authorization code grant flow');\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl((0, _assign.default)({\n response_type: 'code'\n }, options));\n return _promise.default.resolve();\n },\n /**\n * Requests a Webex access token for a user already authenticated into\n * your product.\n *\n * Note: You'll need to supply a jwtRefreshCallback of the form\n * `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to\n * work.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {Object} options.jwt This is a jwt generated by your backend that\n * identifies a user in your system\n * @returns {Promise}\n */\n requestAccessTokenFromJwt: function requestAccessTokenFromJwt(_ref3) {\n var _this2 = this;\n var jwt = _ref3.jwt;\n var hydraUri = this.webex.internal.services.get('hydra', true);\n if (hydraUri && hydraUri.slice(-1) !== '/') {\n // add a `/` to hydra's uri from the services catalog so that\n // it matches the current env service format.\n hydraUri += '/';\n }\n hydraUri = hydraUri || process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1/';\n return this.webex.request({\n method: 'POST',\n uri: \"\".concat(hydraUri, \"jwt/login\"),\n headers: {\n authorization: jwt\n }\n }).then(function (_ref4) {\n var body = _ref4.body;\n return {\n access_token: body.token,\n token_type: 'Bearer',\n expires_in: body.expiresIn\n };\n }).then(function (token) {\n _this2.webex.credentials.set({\n supertoken: token\n });\n }).then(function () {\n return _this2.webex.internal.services.initServiceCatalogs();\n });\n },\n /**\n * Called by {@link WebexCore#logout()}. Redirects to the logout page\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {boolean} options.noRedirect if true, does not redirect\n * @returns {Promise}\n */\n logout: function logout() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!options.noRedirect) {\n this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);\n }\n },\n /**\n * Creates a jwt user token\n * @param {object} options\n * @param {String} options.issuer Guest Issuer ID\n * @param {String} options.secretId Guest Secret ID\n * @param {String} options.displayName Guest Display Name | optional\n * @param {String} options.expiresIn\n * @returns {Promise<object>}\n */\n createJwt: function createJwt(_ref5) {\n return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {\n var issuer, secretId, displayName, expiresIn, secret, payload, alg, jwtToken;\n return _regenerator.default.wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n issuer = _ref5.issuer, secretId = _ref5.secretId, displayName = _ref5.displayName, expiresIn = _ref5.expiresIn;\n secret = Buffer.from(secretId, 'base64');\n payload = {\n \"sub\": \"guest-user-\".concat((0, _uuid.default)()),\n \"iss\": issuer,\n \"name\": displayName || \"Guest User - \".concat((0, _uuid.default)())\n };\n alg = 'HS256';\n _context.prev = 4;\n jwtToken = jwt.sign(payload, secret, {\n expiresIn: expiresIn\n });\n return _context.abrupt(\"return\", _promise.default.resolve({\n jwt: jwtToken\n }));\n case 9:\n _context.prev = 9;\n _context.t0 = _context[\"catch\"](4);\n return _context.abrupt(\"return\", _promise.default.reject(_context.t0));\n case 12:\n case \"end\":\n return _context.stop();\n }\n }, _callee, null, [[4, 9]]);\n }))();\n },\n /**\n * Checks if the result of the login redirect contains an error string\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _checkForErrors: function _checkForErrors(location) {\n var query = location.query;\n if (query && query.error) {\n var ErrorConstructor = _webexCore.grantErrors.select(query.error);\n throw new ErrorConstructor(query);\n }\n },\n /**\n * Removes no-longer needed values from the url (access token, csrf token, etc)\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _cleanUrl: function _cleanUrl(location) {\n location = (0, _lodash.cloneDeep)(location);\n if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {\n ['access_token', 'token_type', 'expires_in', 'refresh_token', 'refresh_token_expires_in'].forEach(function (key) {\n return (0, _deleteProperty.default)(location.hash, key);\n });\n if (!(0, _lodash.isEmpty)(location.hash.state)) {\n location.hash.state = _common.base64.encode((0, _stringify.default)((0, _lodash.omit)(location.hash.state, 'csrf_token')));\n if (location.hash.state === EMPTY_OBJECT_STRING) {\n (0, _deleteProperty.default)(location.hash, 'state');\n }\n } else {\n (0, _deleteProperty.default)(location.hash, 'state');\n }\n location.hash = _querystring.default.stringify(location.hash);\n this.webex.getWindow().history.replaceState({}, null, _url.default.format(location));\n }\n },\n /**\n * Generates a CSRF token and sticks in in sessionStorage\n * @instance\n * @memberof AuthorizationBrowser\n * @private\n * @returns {Promise}\n */\n _generateSecurityToken: function _generateSecurityToken() {\n this.logger.info('authorization: generating csrf token');\n var token = _uuid.default.v4();\n this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);\n return token;\n },\n /**\n * Parses the url hash into an access token object\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Object}\n */\n _parseHash: function _parseHash(location) {\n var hash = (0, _lodash.cloneDeep)(location.hash);\n if (hash) {\n this._verifySecurityToken(hash);\n }\n if (!hash.access_token) {\n this.ready = true;\n return undefined;\n }\n if (hash.expires_in) {\n hash.expires_in = (0, _parseInt2.default)(hash.expires_in, 10);\n }\n if (hash.refresh_token_expires_in) {\n hash.refresh_token_expires_in = (0, _parseInt2.default)(hash.refresh_token_expires_in, 10);\n }\n return hash;\n },\n /**\n * Checks if the CSRF token in sessionStorage is the same as the one returned\n * in the url.\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} hash\n * @private\n * @returns {Promise}\n */\n _verifySecurityToken: function _verifySecurityToken(hash) {\n var sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);\n this.webex.getWindow().sessionStorage.removeItem(OAUTH2_CSRF_TOKEN);\n if (!sessionToken) {\n return;\n }\n if (!hash.state) {\n throw new Error(\"Expected CSRF token \".concat(sessionToken, \", but not found in redirect hash\"));\n }\n if (!hash.state.csrf_token) {\n throw new Error(\"Expected CSRF token \".concat(sessionToken, \", but not found in redirect hash\"));\n }\n var token = hash.state.csrf_token;\n if (token !== sessionToken) {\n throw new Error(\"CSRF token \".concat(token, \" does not match stored token \").concat(sessionToken));\n }\n },\n version: \"3.8.0-next.12\"\n}, ((0, _applyDecoratedDescriptor2.default)(_obj, \"initiateImplicitGrant\", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, \"initiateImplicitGrant\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"initiateAuthorizationCodeGrant\", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, \"initiateAuthorizationCodeGrant\"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, \"requestAccessTokenFromJwt\", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, \"requestAccessTokenFromJwt\"), _obj)), _obj)));\nvar _default = exports[\"default\"] = Authorization;\n//# sourceMappingURL=authorization.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/plugin-authorization-browser/dist/authorization.js?");
12163
12196
 
12164
12197
  /***/ }),
12165
12198
 
@@ -12196,6 +12229,39 @@ eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/t
12196
12229
 
12197
12230
  /***/ }),
12198
12231
 
12232
+ /***/ "./node_modules/@webex/plugin-logger/dist/config.js":
12233
+ /*!**********************************************************!*\
12234
+ !*** ./node_modules/@webex/plugin-logger/dist/config.js ***!
12235
+ \**********************************************************/
12236
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12237
+
12238
+ "use strict";
12239
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n/**\n * @typedef {Object} LoggerConfig\n * @property {string} [level=process.env.WEBEX_LOG_LEVEL] - Maximum log level that\n * should be printed to the console. One of\n * silent|error|warn|log|info|debug|trace\n * @property {number} [historyLength=1000] - Maximum number of entries to store in the log buffer.\n * @example\n * {\n * level: process.env.WEBEX_LOG_LEVEL,\n * historyLength: 1000\n * }\n */\nvar _default = exports[\"default\"] = {\n logger: {\n level: process.env.WEBEX_LOG_LEVEL,\n historyLength: 10000\n }\n};\n//# sourceMappingURL=config.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/plugin-logger/dist/config.js?");
12240
+
12241
+ /***/ }),
12242
+
12243
+ /***/ "./node_modules/@webex/plugin-logger/dist/index.js":
12244
+ /*!*********************************************************!*\
12245
+ !*** ./node_modules/@webex/plugin-logger/dist/index.js ***!
12246
+ \*********************************************************/
12247
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12248
+
12249
+ "use strict";
12250
+ eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs2/core-js/weak-map */ \"../../../node_modules/@babel/runtime-corejs2/core-js/weak-map.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/get-own-property-descriptor */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/get-own-property-descriptor.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\n_Object$defineProperty(exports, \"default\", {\n enumerable: true,\n get: function get() {\n return _logger.default;\n }\n});\n_Object$defineProperty(exports, \"levels\", {\n enumerable: true,\n get: function get() {\n return _logger.levels;\n }\n});\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _logger = _interopRequireWildcard(__webpack_require__(/*! ./logger */ \"./node_modules/@webex/plugin-logger/dist/logger.js\"));\nvar _config = _interopRequireDefault(__webpack_require__(/*! ./config */ \"./node_modules/@webex/plugin-logger/dist/config.js\"));\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n(0, _webexCore.registerPlugin)('logger', _logger.default, {\n config: _config.default,\n replace: true\n});\n//# sourceMappingURL=index.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/plugin-logger/dist/index.js?");
12251
+
12252
+ /***/ }),
12253
+
12254
+ /***/ "./node_modules/@webex/plugin-logger/dist/logger.js":
12255
+ /*!**********************************************************!*\
12256
+ !*** ./node_modules/@webex/plugin-logger/dist/logger.js ***!
12257
+ \**********************************************************/
12258
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12259
+
12260
+ "use strict";
12261
+ eval("/* provided dependency */ var process = __webpack_require__(/*! process/browser */ \"../../../node_modules/process/browser.js\");\n\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.levels = exports[\"default\"] = void 0;\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/typeof */ \"../../../node_modules/@babel/runtime-corejs2/helpers/typeof.js\"));\nvar _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/toConsumableArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/toConsumableArray.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/helpers/slicedToArray */ \"../../../node_modules/@babel/runtime-corejs2/helpers/slicedToArray.js\"));\nvar _keys = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/keys */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/keys.js\"));\nvar _entries = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/object/entries */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/entries.js\"));\nvar _deleteProperty = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/reflect/delete-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/reflect/delete-property.js\"));\nvar _stringify = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs2/core-js/json/stringify */ \"../../../node_modules/@babel/runtime-corejs2/core-js/json/stringify.js\"));\nvar _common = __webpack_require__(/*! @webex/common */ \"./node_modules/@webex/common/dist/index.js\");\nvar _webexCore = __webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\");\nvar _lodash = __webpack_require__(/*! lodash */ \"../../../node_modules/lodash/lodash.js\");\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nvar precedence = {\n silent: 0,\n group: 1,\n groupEnd: 2,\n error: 3,\n warn: 4,\n log: 5,\n info: 6,\n debug: 7,\n trace: 8\n};\nvar levels = exports.levels = (0, _keys.default)(precedence).filter(function (level) {\n return level !== 'silent';\n});\nvar fallbacks = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log']\n};\nvar LOG_TYPES = {\n SDK: 'sdk',\n CLIENT: 'client'\n};\nvar SDK_LOG_TYPE_NAME = 'wx-js-sdk';\nvar authTokenKeyPattern = /[Aa]uthorization/;\n\n/**\n * Recursively strips \"authorization\" fields from the specified object\n * @param {Object} object\n * @param {Array<mixed>} [visited]\n * @private\n * @returns {Object}\n */\nfunction walkAndFilter(object) {\n var visited = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n if (visited.includes(object)) {\n // Prevent circular references\n return object;\n }\n visited.push(object);\n if ((0, _lodash.isArray)(object)) {\n return object.map(function (o) {\n return walkAndFilter(o, visited);\n });\n }\n if (!(0, _lodash.isObject)(object)) {\n if ((0, _lodash.isString)(object)) {\n if (_common.patterns.containsEmails.test(object)) {\n return object.replace(_common.patterns.containsEmails, '[REDACTED]');\n }\n if (_common.patterns.containsMTID.test(object)) {\n return object.replace(_common.patterns.containsMTID, '$1[REDACTED]');\n }\n }\n return object;\n }\n for (var _i = 0, _Object$entries = (0, _entries.default)(object); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),\n key = _Object$entries$_i[0],\n value = _Object$entries$_i[1];\n if (authTokenKeyPattern.test(key)) {\n (0, _deleteProperty.default)(object, key);\n } else {\n object[key] = walkAndFilter(value, visited);\n }\n }\n return object;\n}\n\n/**\n * @class\n */\nvar Logger = _webexCore.WebexPlugin.extend({\n namespace: 'Logger',\n derived: {\n level: {\n cache: false,\n fn: function fn() {\n return this.getCurrentLevel();\n }\n },\n client_level: {\n cache: false,\n fn: function fn() {\n return this.getCurrentClientLevel();\n }\n }\n },\n session: {\n // for when configured to use single buffer\n buffer: {\n type: 'object',\n default: function _default() {\n return {\n buffer: [],\n nextIndex: 0\n };\n }\n },\n groupLevel: {\n type: 'number',\n default: function _default() {\n return 0;\n }\n },\n // for when configured to use separate buffers\n sdkBuffer: {\n type: 'object',\n default: function _default() {\n return {\n buffer: [],\n nextIndex: 0\n };\n }\n },\n clientBuffer: {\n type: 'object',\n default: function _default() {\n return {\n buffer: [],\n nextIndex: 0\n };\n }\n }\n },\n /**\n * Ensures auth headers don't get printed in logs\n * @param {Array<mixed>} args\n * @private\n * @memberof Logger\n * @returns {Array<mixed>}\n */\n filter: function filter() {\n for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return args.map(function (arg) {\n // WebexHttpError already ensures auth tokens don't get printed, so, no\n // need to alter it here.\n if (arg instanceof Error) {\n // karma logs won't print subclassed errors correctly, so we need\n // explicitly call their tostring methods.\n if (false) { var ret; }\n return arg;\n }\n arg = (0, _lodash.cloneDeep)(arg);\n return walkAndFilter(arg);\n });\n },\n /**\n * Determines if the current level allows logs at the specified level to be\n * printed\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldPrint: function shouldPrint(level) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : LOG_TYPES.SDK;\n return precedence[level] <= precedence[type === LOG_TYPES.SDK ? this.getCurrentLevel() : this.getCurrentClientLevel()];\n },\n /**\n * Determines if the current level allows logs at the specified level to be\n * put into the log buffer. We're configuring it omit trace and debug logs\n * because there are *a lot* of debug logs that really don't provide value at\n * runtime (they're helpful for debugging locally, but really just pollute the\n * uploaded logs and push useful info out).\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldBuffer: function shouldBuffer(level) {\n return precedence[level] <= (this.config.bufferLogLevel ? precedence[this.config.bufferLogLevel] : precedence.info);\n },\n /**\n * Indicates the current SDK log level based on env vars, feature toggles, and\n * user type.\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n // eslint-disable-next-line complexity\n getCurrentLevel: function getCurrentLevel() {\n // If a level has been explicitly set via config, alway use it.\n if (this.config.level) {\n return this.config.level;\n }\n if (levels.includes(process.env.WEBEX_LOG_LEVEL)) {\n return process.env.WEBEX_LOG_LEVEL;\n }\n\n // Always use debug-level logging in test mode;\n if (false) {}\n\n // Use server-side-feature toggles to configure log levels\n var level = this.webex.internal.device && this.webex.internal.device.features.developer.get('log-level');\n if (level) {\n if (levels.includes(level)) {\n return level;\n }\n }\n return 'error';\n },\n /**\n * Indicates the current client log level based on config, defaults to SDK level\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n getCurrentClientLevel: function getCurrentClientLevel() {\n // If a client log level has been explicitly set via config, alway use it.\n if (this.config.clientLevel) {\n return this.config.clientLevel;\n }\n\n // otherwise default to SDK level\n return this.getCurrentLevel();\n },\n /**\n * Format logs (for upload)\n *\n * If separate client, SDK buffers is configured, merge the buffers, if configured\n *\n * @instance\n * @memberof Logger\n * @public\n * @memberof Logger\n * @param {Object} options\n * @param {boolean} options.diff whether to only format the diff from last call to formatLogs(), false by default\n * @returns {string} formatted buffer\n */\n formatLogs: function formatLogs() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n function getDate(log) {\n return log[1];\n }\n var _options$diff = options.diff,\n diff = _options$diff === void 0 ? false : _options$diff;\n var buffer = [];\n var clientIndex = diff ? this.clientBuffer.nextIndex : 0;\n var sdkIndex = diff ? this.sdkBuffer.nextIndex : 0;\n if (this.config.separateLogBuffers) {\n // merge the client and sdk buffers\n // while we have entries in either buffer\n while (clientIndex < this.clientBuffer.buffer.length || sdkIndex < this.sdkBuffer.buffer.length) {\n // if we have remaining entries in the SDK buffer\n if (sdkIndex < this.sdkBuffer.buffer.length && (\n // and we haven't exhausted all the client buffer entries, or SDK date is before client date\n clientIndex >= this.clientBuffer.buffer.length || new Date(getDate(this.sdkBuffer.buffer[sdkIndex])) <= new Date(getDate(this.clientBuffer.buffer[clientIndex])))) {\n // then add to the SDK buffer\n buffer.push(this.sdkBuffer.buffer[sdkIndex]);\n sdkIndex += 1;\n }\n // otherwise if we haven't exhausted all the client buffer entries, add client entry, whether it was because\n // it was the only remaining entries or date was later (the above if)\n else if (clientIndex < this.clientBuffer.buffer.length) {\n buffer.push(this.clientBuffer.buffer[clientIndex]);\n clientIndex += 1;\n }\n }\n if (diff) {\n this.clientBuffer.nextIndex = clientIndex;\n this.sdkBuffer.nextIndex = sdkIndex;\n }\n } else if (diff) {\n buffer = this.buffer.buffer.slice(this.buffer.nextIndex);\n this.buffer.nextIndex = this.buffer.buffer.length;\n } else {\n buffer = this.buffer.buffer;\n }\n return buffer.join('\\n');\n },\n version: \"3.8.0-next.11\"\n});\n\n/**\n * Creates a logger method\n *\n *\n * @param {string} level level to create (info, error, warn, etc.)\n * @param {string} impl the level to use when writing to console\n * @param {string} type type of log, SDK or client\n * @param {bool} neverPrint function never prints to console\n * @param {bool} alwaysBuffer function always logs to log buffer\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {function} logger method with specified params\n */\nfunction makeLoggerMethod(level, impl, type) {\n var neverPrint = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var alwaysBuffer = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n // Much of the complexity in the following function is due to a test-mode-only\n // helper\n return function wrappedConsoleMethod() {\n // it would be easier to just pass in the name and buffer here, but the config isn't completely initialized\n // in Ampersand, even if the initialize method is used to set this up. so we keep the type to achieve\n // a sort of late binding to allow retrieving a name from config.\n var logType = type;\n var clientName = logType === LOG_TYPES.SDK ? SDK_LOG_TYPE_NAME : this.config.clientName || logType;\n var bufferRef;\n var historyLength;\n if (this.config.separateLogBuffers) {\n historyLength = this.config.clientHistoryLength ? this.config.clientHistoryLength : this.config.historyLength;\n bufferRef = logType === LOG_TYPES.SDK ? this.sdkBuffer : this.clientBuffer;\n } else {\n bufferRef = this.buffer;\n historyLength = this.config.historyLength;\n }\n try {\n var shouldPrint = !neverPrint && this.shouldPrint(level, logType);\n var shouldBuffer = alwaysBuffer || this.shouldBuffer(level);\n if (!shouldBuffer && !shouldPrint) {\n return;\n }\n var filtered = [clientName].concat((0, _toConsumableArray2.default)(this.filter.apply(this, arguments)));\n var stringified = filtered.map(function (item) {\n if (item instanceof Error) {\n return item.toString();\n }\n if ((0, _typeof2.default)(item) === 'object') {\n var cache = [];\n var returnItem;\n try {\n returnItem = (0, _stringify.default)(item, function (_key, value) {\n if ((0, _typeof2.default)(value) === 'object' && value !== null) {\n if (cache.includes(value)) {\n // Circular reference found, discard key\n return undefined;\n }\n // Store value in our collection\n cache.push(value);\n }\n return value;\n });\n } catch (e) {\n returnItem = \"Failed to stringify: \".concat(item);\n }\n cache = null;\n return returnItem;\n }\n return item;\n });\n if (shouldPrint) {\n var _console;\n // when logging an object in browsers, we tend to get a dynamic\n // reference, thus going back to look at the logged value doesn't\n // necessarily show the state at log time, thus we print the stringified\n // value.\n var toPrint = _common.inBrowser ? stringified : filtered;\n\n /* istanbul ignore if */\n if (false) {}\n // eslint-disable-next-line no-console\n (_console = console)[impl].apply(_console, (0, _toConsumableArray2.default)(toPrint));\n }\n if (shouldBuffer) {\n var logDate = new Date();\n stringified.unshift(logDate.toISOString());\n stringified.unshift('| '.repeat(this.groupLevel));\n bufferRef.buffer.push(stringified);\n if (bufferRef.buffer.length > historyLength) {\n // we've gone over the buffer limit, trim it down\n var deleteCount = bufferRef.buffer.length - historyLength;\n bufferRef.buffer.splice(0, deleteCount);\n\n // and adjust the corresponding buffer index used for log diff uploads\n bufferRef.nextIndex -= deleteCount;\n if (bufferRef.nextIndex < 0) {\n bufferRef.nextIndex = 0;\n }\n }\n if (level === 'group') this.groupLevel += 1;\n if (level === 'groupEnd' && this.groupLevel > 0) this.groupLevel -= 1;\n }\n } catch (reason) {\n if (!neverPrint) {\n /* istanbul ignore next */\n // eslint-disable-next-line no-console\n console.warn(\"failed to execute Logger#\".concat(level), reason);\n }\n }\n };\n}\nlevels.forEach(function (level) {\n var impls = fallbacks[level];\n var impl = level;\n if (impls) {\n impls = impls.slice();\n // eslint-disable-next-line no-console\n while (!console[impl]) {\n impl = impls.pop();\n }\n }\n\n // eslint-disable-next-line complexity\n Logger.prototype[\"client_\".concat(level)] = makeLoggerMethod(level, impl, LOG_TYPES.CLIENT);\n Logger.prototype[level] = makeLoggerMethod(level, impl, LOG_TYPES.SDK);\n});\nLogger.prototype.client_logToBuffer = makeLoggerMethod(levels.info, levels.info, LOG_TYPES.CLIENT, true, true);\nLogger.prototype.logToBuffer = makeLoggerMethod(levels.info, levels.info, LOG_TYPES.SDK, true, true);\nvar _default2 = exports[\"default\"] = Logger;\n//# sourceMappingURL=logger.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/@webex/plugin-logger/dist/logger.js?");
12262
+
12263
+ /***/ }),
12264
+
12199
12265
  /***/ "./node_modules/@webex/storage-adapter-local-storage/dist/index.js":
12200
12266
  /*!*************************************************************************!*\
12201
12267
  !*** ./node_modules/@webex/storage-adapter-local-storage/dist/index.js ***!
@@ -12335,7 +12401,7 @@ eval("/* provided dependency */ var process = __webpack_require__(/*! process/br
12335
12401
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12336
12402
 
12337
12403
  "use strict";
12338
- eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _merge = _interopRequireDefault(__webpack_require__(/*! lodash/merge */ \"../../../node_modules/lodash/merge.js\"));\nvar _webexCore = _interopRequireDefault(__webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\"));\n__webpack_require__(/*! @webex/plugin-authorization */ \"./node_modules/@webex/plugin-authorization/dist/index.browser.js\");\n__webpack_require__(/*! @webex/plugin-cc */ \"../../../node_modules/@webex/plugin-cc/dist/index.js\");\n__webpack_require__(/*! @webex/internal-plugin-mercury */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/index.js\");\nvar config = __webpack_require__(/*! ./config */ \"./node_modules/webex/dist/config.js\");\nvar Webex = _webexCore.default.extend({\n webex: true,\n version: \"3.8.0-next.31\"\n});\nWebex.init = function init() {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n attrs.config = (0, _merge.default)({}, config, attrs.config); // eslint-disable-line no-param-reassign\n\n return new Webex(attrs);\n};\nvar _default = exports[\"default\"] = Webex;\n//# sourceMappingURL=contact-center.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/webex/dist/contact-center.js?");
12404
+ eval("\n\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs2/core-js/object/define-property */ \"../../../node_modules/@babel/runtime-corejs2/core-js/object/define-property.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs2/helpers/interopRequireDefault */ \"../../../node_modules/@babel/runtime-corejs2/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nvar _merge = _interopRequireDefault(__webpack_require__(/*! lodash/merge */ \"../../../node_modules/lodash/merge.js\"));\nvar _webexCore = _interopRequireDefault(__webpack_require__(/*! @webex/webex-core */ \"../../../node_modules/@webex/webex-core/dist/index.js\"));\n__webpack_require__(/*! @webex/plugin-authorization */ \"./node_modules/@webex/plugin-authorization/dist/index.browser.js\");\n__webpack_require__(/*! @webex/plugin-cc */ \"../../../node_modules/@webex/plugin-cc/dist/index.js\");\n__webpack_require__(/*! @webex/internal-plugin-mercury */ \"../../../node_modules/@webex/internal-plugin-mercury/dist/index.js\");\n__webpack_require__(/*! @webex/plugin-logger */ \"./node_modules/@webex/plugin-logger/dist/index.js\");\n__webpack_require__(/*! @webex/internal-plugin-support */ \"./node_modules/@webex/internal-plugin-support/dist/index.js\");\nvar config = __webpack_require__(/*! ./config */ \"./node_modules/webex/dist/config.js\");\nvar Webex = _webexCore.default.extend({\n webex: true,\n version: \"3.8.0-next.40\"\n});\nWebex.init = function init() {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n attrs.config = (0, _merge.default)({}, config, attrs.config); // eslint-disable-line no-param-reassign\n\n return new Webex(attrs);\n};\nvar _default = exports[\"default\"] = Webex;\n//# sourceMappingURL=contact-center.js.map\n\n\n//# sourceURL=webpack://@webex/cc-store/./node_modules/webex/dist/contact-center.js?");
12339
12405
 
12340
12406
  /***/ }),
12341
12407