@webex/plugin-meetings 2.12.1 → 2.14.1

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.
@@ -263,20 +263,16 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
263
263
  method: _constants.HTTP_VERBS.POST,
264
264
  uri: uri,
265
265
  body: body
266
- }).catch(function (err) {
267
- var _err$body, _err$body2;
268
-
269
- throw new MeetingInfoV2AdhocMeetingError((_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.code, (_err$body2 = err.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.message);
270
266
  });
271
267
  }).catch(function (err) {
272
- var _err$body3, _err$body4;
268
+ var _err$body, _err$body2;
273
269
 
274
270
  _metrics.default.sendBehavioralMetric(_constants2.default.ADHOC_MEETING_FAILURE, {
275
271
  reason: err.message,
276
272
  stack: err.stack
277
273
  });
278
274
 
279
- throw new MeetingInfoV2AdhocMeetingError((_err$body3 = err.body) === null || _err$body3 === void 0 ? void 0 : _err$body3.code, (_err$body4 = err.body) === null || _err$body4 === void 0 ? void 0 : _err$body4.message);
275
+ throw new MeetingInfoV2AdhocMeetingError((_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.code, (_err$body2 = err.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.message);
280
276
  }));
281
277
 
282
278
  case 4:
@@ -369,25 +365,25 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
369
365
  return response;
370
366
  }).catch(function (err) {
371
367
  if ((err === null || err === void 0 ? void 0 : err.statusCode) === 403) {
372
- var _err$body5, _err$body6, _err$body6$data;
368
+ var _err$body3, _err$body4, _err$body4$data;
373
369
 
374
370
  _metrics.default.sendBehavioralMetric(_constants2.default.VERIFY_PASSWORD_ERROR, {
375
371
  reason: err.message,
376
372
  stack: err.stack
377
373
  });
378
374
 
379
- throw new MeetingInfoV2PasswordError((_err$body5 = err.body) === null || _err$body5 === void 0 ? void 0 : _err$body5.code, (_err$body6 = err.body) === null || _err$body6 === void 0 ? void 0 : (_err$body6$data = _err$body6.data) === null || _err$body6$data === void 0 ? void 0 : _err$body6$data.meetingInfo);
375
+ throw new MeetingInfoV2PasswordError((_err$body3 = err.body) === null || _err$body3 === void 0 ? void 0 : _err$body3.code, (_err$body4 = err.body) === null || _err$body4 === void 0 ? void 0 : (_err$body4$data = _err$body4.data) === null || _err$body4$data === void 0 ? void 0 : _err$body4$data.meetingInfo);
380
376
  }
381
377
 
382
378
  if ((err === null || err === void 0 ? void 0 : err.statusCode) === 423) {
383
- var _err$body7;
379
+ var _err$body5;
384
380
 
385
381
  _metrics.default.sendBehavioralMetric(_constants2.default.VERIFY_CAPTCHA_ERROR, {
386
382
  reason: err.message,
387
383
  stack: err.stack
388
384
  });
389
385
 
390
- throw new MeetingInfoV2CaptchaError((_err$body7 = err.body) === null || _err$body7 === void 0 ? void 0 : _err$body7.code, {
386
+ throw new MeetingInfoV2CaptchaError((_err$body5 = err.body) === null || _err$body5 === void 0 ? void 0 : _err$body5.code, {
391
387
  captchaId: err.body.captchaID,
392
388
  verificationImageURL: err.body.verificationImageURL,
393
389
  verificationAudioURL: err.body.verificationAudioURL,
@@ -1 +1 @@
1
- {"version":3,"names":["PASSWORD_ERROR_DEFAULT_MESSAGE","CAPTCHA_ERROR_DEFAULT_MESSAGE","ADHOC_MEETING_DEFAULT_ERROR","CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES","MeetingInfoV2PasswordError","wbxAppApiErrorCode","meetingInfo","message","name","sdkMessage","stack","Error","wbxAppApiCode","MeetingInfoV2AdhocMeetingError","MeetingInfoV2CaptchaError","captchaInfo","isPasswordRequired","includes","MeetingInfoV2","webex","destination","type","MeetingInfoUtil","getDestinationType","conversationUrl","meetings","preferredWebexSite","getInvitees","particpants","invitees","forEach","participant","push","email","emailAddress","ciUserUuid","entryUUID","internal","conversation","get","url","includeParticipants","disableTransform","then","body","title","displayName","spaceUrl","keyUrl","encryptionKeyUrl","kroUrl","kmsResourceObjectUrl","participants","items","uri","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","ADHOC_MEETING_SUCCESS","request","method","HTTP_VERBS","POST","catch","err","code","ADHOC_MEETING_FAILURE","reason","password","destinationType","_CONVERSATION_URL_","config","experimental","enableAdhocMeetings","createAdhocSpaceMeeting","getRequestBody","options","service","resource","getDirectMeetingInfoURI","directURI","response","FETCH_MEETING_INFO_V1_SUCCESS","statusCode","VERIFY_PASSWORD_ERROR","data","VERIFY_CAPTCHA_ERROR","captchaId","captchaID","verificationImageURL","verificationAudioURL","refreshURL","FETCH_MEETING_INFO_V1_FAILURE"],"sources":["meeting-info-v2.js"],"sourcesContent":["\nimport {HTTP_VERBS, _CONVERSATION_URL_} from '../constants';\nimport Metrics from '../metrics';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\n\nimport MeetingInfoUtil from './utilv2';\n\nconst PASSWORD_ERROR_DEFAULT_MESSAGE = 'Password required. Call fetchMeetingInfo() with password argument';\nconst CAPTCHA_ERROR_DEFAULT_MESSAGE = 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';\nconst ADHOC_MEETING_DEFAULT_ERROR = 'Failed starting the adhoc meeting, Please contact support team ';\nconst CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];\n\n/**\n * Error to indicate that wbxappapi requires a password\n */\nexport class MeetingInfoV2PasswordError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, meetingInfo, message = PASSWORD_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.meetingInfo = meetingInfo;\n }\n}\n\n/**\n * Error generating a adhoc space meeting\n */\nexport class MeetingInfoV2AdhocMeetingError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, message = ADHOC_MEETING_DEFAULT_ERROR) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2AdhocMeetingError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n }\n}\n\n\n/**\n * Error to indicate that preferred webex site not present to start adhoc meeting\n */\nexport class MeetingInfoV2CaptchaError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [captchaInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, captchaInfo, message = CAPTCHA_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.isPasswordRequired = CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES.includes(wbxAppApiErrorCode);\n this.captchaInfo = captchaInfo;\n }\n}\n\n/**\n * @class MeetingInfo\n */\nexport default class MeetingInfoV2 {\n /**\n *\n * @param {WebexSDK} webex\n */\n constructor(webex) {\n this.webex = webex;\n }\n\n /**\n * converts hydra id into conversation url and persons Id\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @returns {Promise} destination and type\n * @public\n * @memberof MeetingInfo\n */\n fetchInfoOptions(destination, type = null) {\n return MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n }\n\n /**\n * Creates adhoc space meetings for a space by fetching the conversation infomation\n * @param {String} conversationUrl conversationUrl to start adhoc meeting on\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async createAdhocSpaceMeeting(conversationUrl) {\n if (!this.webex.meetings.preferredWebexSite) {\n throw Error('No preferred webex site found');\n }\n const getInvitees = (particpants = []) => {\n const invitees = [];\n\n if (particpants) {\n particpants.forEach((participant) => {\n invitees.push({\n email: participant.emailAddress,\n ciUserUuid: participant.entryUUID\n });\n });\n }\n\n return invitees;\n };\n\n return this.webex.internal.conversation.get(\n {url: conversationUrl},\n {includeParticipants: true, disableTransform: true}\n )\n .then((conversation) => {\n const body = {\n title: conversation.displayName,\n spaceUrl: conversation.url,\n keyUrl: conversation.encryptionKeyUrl,\n kroUrl: conversation.kmsResourceObjectUrl,\n invitees: getInvitees(conversation.participants?.items)\n };\n\n const uri = this.webex.meetings.preferredWebexSite ?\n `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant` : '';\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS\n );\n\n return this.webex.request({\n method: HTTP_VERBS.POST,\n uri,\n body\n })\n .catch((err) => {\n throw new MeetingInfoV2AdhocMeetingError(err.body?.code, err.body?.message);\n });\n })\n .catch((err) => {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n throw new MeetingInfoV2AdhocMeetingError(err.body?.code, err.body?.message);\n });\n }\n\n /**\n * Fetches meeting info from the server\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @param {String} password\n * @param {Object} captchaInfo\n * @param {String} captchaInfo.code\n * @param {String} captchaInfo.id\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async fetchMeetingInfo(destination, type = null, password = null, captchaInfo = null) {\n const destinationType = await MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n\n if (destinationType.type === _CONVERSATION_URL_ && this.webex.config.meetings.experimental.enableAdhocMeetings) {\n return this.createAdhocSpaceMeeting(destinationType.destination);\n }\n\n const body = await MeetingInfoUtil.getRequestBody({...destinationType, password, captchaInfo});\n\n const options = {\n method: HTTP_VERBS.POST,\n service: 'webex-appapi-service',\n resource: 'meetingInfo',\n body\n };\n\n const directURI = await MeetingInfoUtil.getDirectMeetingInfoURI(destinationType);\n\n if (directURI) options.directURI = directURI;\n\n return this.webex.request(options)\n .then((response) => {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_SUCCESS\n );\n\n return response;\n })\n .catch((err) => {\n if (err?.statusCode === 403) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n\n throw new MeetingInfoV2PasswordError(err.body?.code, err.body?.data?.meetingInfo);\n }\n if (err?.statusCode === 423) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.VERIFY_CAPTCHA_ERROR,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n\n throw new MeetingInfoV2CaptchaError(err.body?.code, {\n captchaId: err.body.captchaID,\n verificationImageURL: err.body.verificationImageURL,\n verificationAudioURL: err.body.verificationAudioURL,\n refreshURL: err.body.refreshURL\n });\n }\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n throw err;\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAMA,8BAA8B,GAAG,mEAAvC;AACA,IAAMC,6BAA6B,GAAG,qEAAtC;AACA,IAAMC,2BAA2B,GAAG,iEAApC;AACA,IAAMC,qCAAqC,GAAG,CAAC,MAAD,EAAS,MAAT,CAA9C;AAEA;AACA;AACA;;IACaC,0B;;;;;EACX;AACF;AACA;AACA;AACA;AACA;AACA;EACE,oCAAYC,kBAAZ,EAAgCC,WAAhC,EAAuF;IAAA;;IAAA,IAA1CC,OAA0C,uEAAhCP,8BAAgC;IAAA;IACrF,oCAASO,OAAT,oBAA0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;YAAA;UAAA;QAAA;MAAA,C"}
1
+ {"version":3,"names":["PASSWORD_ERROR_DEFAULT_MESSAGE","CAPTCHA_ERROR_DEFAULT_MESSAGE","ADHOC_MEETING_DEFAULT_ERROR","CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES","MeetingInfoV2PasswordError","wbxAppApiErrorCode","meetingInfo","message","name","sdkMessage","stack","Error","wbxAppApiCode","MeetingInfoV2AdhocMeetingError","MeetingInfoV2CaptchaError","captchaInfo","isPasswordRequired","includes","MeetingInfoV2","webex","destination","type","MeetingInfoUtil","getDestinationType","conversationUrl","meetings","preferredWebexSite","getInvitees","particpants","invitees","forEach","participant","push","email","emailAddress","ciUserUuid","entryUUID","internal","conversation","get","url","includeParticipants","disableTransform","then","body","title","displayName","spaceUrl","keyUrl","encryptionKeyUrl","kroUrl","kmsResourceObjectUrl","participants","items","uri","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","ADHOC_MEETING_SUCCESS","request","method","HTTP_VERBS","POST","catch","err","ADHOC_MEETING_FAILURE","reason","code","password","destinationType","_CONVERSATION_URL_","config","experimental","enableAdhocMeetings","createAdhocSpaceMeeting","getRequestBody","options","service","resource","getDirectMeetingInfoURI","directURI","response","FETCH_MEETING_INFO_V1_SUCCESS","statusCode","VERIFY_PASSWORD_ERROR","data","VERIFY_CAPTCHA_ERROR","captchaId","captchaID","verificationImageURL","verificationAudioURL","refreshURL","FETCH_MEETING_INFO_V1_FAILURE"],"sources":["meeting-info-v2.js"],"sourcesContent":["\nimport {HTTP_VERBS, _CONVERSATION_URL_} from '../constants';\nimport Metrics from '../metrics';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\n\nimport MeetingInfoUtil from './utilv2';\n\nconst PASSWORD_ERROR_DEFAULT_MESSAGE = 'Password required. Call fetchMeetingInfo() with password argument';\nconst CAPTCHA_ERROR_DEFAULT_MESSAGE = 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';\nconst ADHOC_MEETING_DEFAULT_ERROR = 'Failed starting the adhoc meeting, Please contact support team ';\nconst CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];\n\n/**\n * Error to indicate that wbxappapi requires a password\n */\nexport class MeetingInfoV2PasswordError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, meetingInfo, message = PASSWORD_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.meetingInfo = meetingInfo;\n }\n}\n\n/**\n * Error generating a adhoc space meeting\n */\nexport class MeetingInfoV2AdhocMeetingError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, message = ADHOC_MEETING_DEFAULT_ERROR) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2AdhocMeetingError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n }\n}\n\n\n/**\n * Error to indicate that preferred webex site not present to start adhoc meeting\n */\nexport class MeetingInfoV2CaptchaError extends Error {\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [captchaInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode, captchaInfo, message = CAPTCHA_ERROR_DEFAULT_MESSAGE) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2PasswordError';\n this.sdkMessage = message;\n this.stack = (new Error()).stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.isPasswordRequired = CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES.includes(wbxAppApiErrorCode);\n this.captchaInfo = captchaInfo;\n }\n}\n\n/**\n * @class MeetingInfo\n */\nexport default class MeetingInfoV2 {\n /**\n *\n * @param {WebexSDK} webex\n */\n constructor(webex) {\n this.webex = webex;\n }\n\n /**\n * converts hydra id into conversation url and persons Id\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @returns {Promise} destination and type\n * @public\n * @memberof MeetingInfo\n */\n fetchInfoOptions(destination, type = null) {\n return MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n }\n\n /**\n * Creates adhoc space meetings for a space by fetching the conversation infomation\n * @param {String} conversationUrl conversationUrl to start adhoc meeting on\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async createAdhocSpaceMeeting(conversationUrl) {\n if (!this.webex.meetings.preferredWebexSite) {\n throw Error('No preferred webex site found');\n }\n const getInvitees = (particpants = []) => {\n const invitees = [];\n\n if (particpants) {\n particpants.forEach((participant) => {\n invitees.push({\n email: participant.emailAddress,\n ciUserUuid: participant.entryUUID\n });\n });\n }\n\n return invitees;\n };\n\n return this.webex.internal.conversation.get(\n {url: conversationUrl},\n {includeParticipants: true, disableTransform: true}\n )\n .then((conversation) => {\n const body = {\n title: conversation.displayName,\n spaceUrl: conversation.url,\n keyUrl: conversation.encryptionKeyUrl,\n kroUrl: conversation.kmsResourceObjectUrl,\n invitees: getInvitees(conversation.participants?.items)\n };\n\n const uri = this.webex.meetings.preferredWebexSite ?\n `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant` : '';\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS\n );\n\n return this.webex.request({\n method: HTTP_VERBS.POST,\n uri,\n body\n });\n })\n .catch((err) => {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n throw new MeetingInfoV2AdhocMeetingError(err.body?.code, err.body?.message);\n });\n }\n\n /**\n * Fetches meeting info from the server\n * @param {String} destination one of many different types of destinations to look up info for\n * @param {String} [type] to match up with the destination value\n * @param {String} password\n * @param {Object} captchaInfo\n * @param {String} captchaInfo.code\n * @param {String} captchaInfo.id\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async fetchMeetingInfo(destination, type = null, password = null, captchaInfo = null) {\n const destinationType = await MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex\n });\n\n if (destinationType.type === _CONVERSATION_URL_ && this.webex.config.meetings.experimental.enableAdhocMeetings) {\n return this.createAdhocSpaceMeeting(destinationType.destination);\n }\n\n const body = await MeetingInfoUtil.getRequestBody({...destinationType, password, captchaInfo});\n\n const options = {\n method: HTTP_VERBS.POST,\n service: 'webex-appapi-service',\n resource: 'meetingInfo',\n body\n };\n\n const directURI = await MeetingInfoUtil.getDirectMeetingInfoURI(destinationType);\n\n if (directURI) options.directURI = directURI;\n\n return this.webex.request(options)\n .then((response) => {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_SUCCESS\n );\n\n return response;\n })\n .catch((err) => {\n if (err?.statusCode === 403) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n\n throw new MeetingInfoV2PasswordError(err.body?.code, err.body?.data?.meetingInfo);\n }\n if (err?.statusCode === 423) {\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.VERIFY_CAPTCHA_ERROR,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n\n throw new MeetingInfoV2CaptchaError(err.body?.code, {\n captchaId: err.body.captchaID,\n verificationImageURL: err.body.verificationImageURL,\n verificationAudioURL: err.body.verificationAudioURL,\n refreshURL: err.body.refreshURL\n });\n }\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE,\n {\n reason: err.message,\n stack: err.stack\n }\n );\n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,CAACpB,IAAJ,CAAS+C;oBAJ6B,CAA9C,CAAN;kBAMD;;kBAEDpC,iBAAQC,oBAAR,CACEC,oBAAmBmC,6BADrB,EAEE;oBACE1B,MAAM,EAAEF,GAAG,CAACzD,OADd;oBAEEG,KAAK,EAAEsD,GAAG,CAACtD;kBAFb,CAFF;;kBAOA,MAAMsD,GAAN;gBACD,CA7CI,CAxBT;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "2.12.1",
3
+ "version": "2.14.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -24,21 +24,21 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime-corejs2": "^7.14.8",
27
- "@webex/webex-core": "2.12.1",
28
- "@webex/internal-plugin-mercury": "2.12.1",
29
- "@webex/internal-plugin-conversation": "2.12.1",
27
+ "@webex/webex-core": "2.14.1",
28
+ "@webex/internal-plugin-mercury": "2.14.1",
29
+ "@webex/internal-plugin-conversation": "2.14.1",
30
30
  "webrtc-adapter": "^7.7.0",
31
31
  "lodash": "^4.17.21",
32
32
  "uuid": "^3.3.2",
33
33
  "global": "^4.4.0",
34
34
  "ip-anonymize": "^0.1.0",
35
- "@webex/common": "2.12.1",
35
+ "@webex/common": "2.14.1",
36
36
  "bowser": "^2.11.0",
37
37
  "sdp-transform": "^2.12.0",
38
38
  "readable-stream": "^3.6.0",
39
- "@webex/common-timers": "2.12.1",
39
+ "@webex/common-timers": "2.14.1",
40
40
  "btoa": "^1.2.1",
41
- "@webex/internal-media-core": "^0.0.4-beta",
41
+ "@webex/internal-media-core": "^0.0.6-beta",
42
42
  "javascript-state-machine": "^3.1.0",
43
43
  "envify": "^4.1.0"
44
44
  }
package/src/constants.js CHANGED
@@ -1241,3 +1241,10 @@ export const MEETING_INFO_FAILURE_REASON = {
1241
1241
  WRONG_CAPTCHA: 'WRONG_CAPTCHA', // wbxappapi requires a captcha code or a wrong captcha code was provided
1242
1242
  OTHER: 'OTHER' // any other error (network, etc)
1243
1243
  };
1244
+
1245
+ export const BNR_STATUS = {
1246
+ SHOULD_ENABLE: 'SHOULD_ENABLE',
1247
+ ENABLED: 'ENABLED',
1248
+ SHOULD_DISABLE: 'SHOULD_DISABLE',
1249
+ NOT_ENABLED: 'NOT_ENABLED'
1250
+ };
@@ -0,0 +1,206 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import {Media as WebRTCMedia} from '@webex/internal-media-core';
3
+
4
+ import BEHAVIORAL_METRICS from '../metrics/constants';
5
+ import Metrics from '../metrics';
6
+ import MediaUtil from '../media/util';
7
+ import LoggerProxy from '../common/logs/logger-proxy';
8
+ import {BNR_STATUS} from '../constants';
9
+
10
+ const createEffectsState = (type) => {
11
+ LoggerProxy.logger.info(`Meeting:effectState#createEffectsState --> creating effectsState for effect ${type}`);
12
+
13
+ return new EffectsState(type);
14
+ };
15
+
16
+ /* The purpose of this class is to manage the effects state(for eg., BNR).
17
+ */
18
+ class EffectsState {
19
+ constructor(type) {
20
+ this.effectType = type;
21
+ this.state = {
22
+ bnr: {
23
+ enabled: BNR_STATUS.NOT_ENABLED
24
+ },
25
+ callToWebrtcBNRInProgress: false
26
+ };
27
+ // these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call
28
+ this.pendingPromiseResolve = null;
29
+ this.pendingPromiseReject = null;
30
+ }
31
+
32
+ /**
33
+ * @memberof EffectsState
34
+ * @param {Boolean} [isEnable] true for enableBNR, false for disableBNR request
35
+ * @param {Object} [meeting] the meeting object
36
+ * @returns {Promise}
37
+ */
38
+ async handleClientRequest(isEnable, meeting) {
39
+ return new Promise((resolve, reject) => {
40
+ if (this.pendingPromiseResolve) {
41
+ // resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one
42
+ this.pendingPromiseResolve();
43
+ }
44
+ this.pendingPromiseResolve = resolve;
45
+ this.pendingPromiseReject = reject;
46
+
47
+ if (isEnable) this.enableBNR(meeting);
48
+ else this.disableBNR(meeting);
49
+ });
50
+ }
51
+
52
+ /**
53
+ * Internal API to return status of BNR
54
+ * @memberof EffectsState
55
+ * @returns {Boolean}
56
+ * @public
57
+ * @memberof Meeting
58
+ */
59
+ isBnrEnabled() {
60
+ return this.state.bnr.enabled === BNR_STATUS.ENABLED;
61
+ }
62
+
63
+ resolvePromise() {
64
+ if (this.pendingPromiseResolve) {
65
+ this.pendingPromiseResolve(true);
66
+ }
67
+ this.pendingPromiseResolve = null;
68
+ this.pendingPromiseReject = null;
69
+ }
70
+
71
+ rejectPromise(e) {
72
+ if (this.pendingPromiseReject) {
73
+ this.pendingPromiseReject(e);
74
+ }
75
+ this.pendingPromiseResolve = null;
76
+ this.pendingPromiseReject = null;
77
+ }
78
+
79
+ /**
80
+ * enableBNR API
81
+ * @param {Object} meeting the meeting object
82
+ * @returns {Promise<Boolean>}
83
+ * @public
84
+ * @memberof EffectsState
85
+ */
86
+ async enableBNR(meeting) {
87
+ LoggerProxy.logger.info('Meeting:effectState#enableBNR. Enable BNR called');
88
+
89
+ if (this.isBnrEnabled()) {
90
+ LoggerProxy.logger.warn('Meeting:index#enableBNR. BNR is already enabled');
91
+
92
+ return this.resolvePromise();
93
+ }
94
+
95
+ if (this.state.callToWebrtcBNRInProgress) {
96
+ LoggerProxy.logger.warn('Meeting:effectState#enableBNR. Call to WebRTC in progress, we need to wait for it to complete');
97
+
98
+ return this.resolvePromise();
99
+ }
100
+
101
+ const {bnr} = this.state;
102
+
103
+ try {
104
+ bnr.enabled = BNR_STATUS.SHOULD_ENABLE;
105
+ this.state.callToWebrtcBNRInProgress = true;
106
+ const audioStream = MediaUtil.createMediaStream([meeting.mediaProperties.audioTrack]);
107
+
108
+ LoggerProxy.logger.info('Meeting:effectState#enableBNR. MediaStream created from meeting & sent to updateAudio');
109
+ await meeting.updateAudio({
110
+ sendAudio: true,
111
+ receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,
112
+ stream: audioStream,
113
+ bnrEnabled: bnr.enabled
114
+ });
115
+
116
+ LoggerProxy.logger.info('Meeting:effectState#enableBNR. Updated meeting audio with bnr enabled track');
117
+ bnr.enabled = BNR_STATUS.ENABLED;
118
+ this.state.callToWebrtcBNRInProgress = false;
119
+ Metrics.sendBehavioralMetric(
120
+ BEHAVIORAL_METRICS.ENABLE_BNR_SUCCESS,
121
+ );
122
+ }
123
+ catch (error) {
124
+ bnr.enabled = BNR_STATUS.NOT_ENABLED;
125
+ this.state.callToWebrtcBNRInProgress = false;
126
+ LoggerProxy.logger.error('Meeting:index#enableBNR.', error);
127
+
128
+ Metrics.sendBehavioralMetric(
129
+ BEHAVIORAL_METRICS.ENABLE_BNR_FAILURE,
130
+ {
131
+ reason: error.message,
132
+ stack: error.stack
133
+ }
134
+ );
135
+ this.rejectPromise(error);
136
+
137
+ throw error;
138
+ }
139
+
140
+ return this.resolvePromise();
141
+ }
142
+
143
+ /**
144
+ * disableBNR API
145
+ * @param {Object} meeting the meeting object
146
+ * @returns {Promise<Boolean>}
147
+ * @public
148
+ * @memberof EffectsState
149
+ */
150
+ async disableBNR(meeting) {
151
+ LoggerProxy.logger.info('Meeting:effectState#disableBNR. Disable BNR called');
152
+
153
+ const {bnr} = this.state;
154
+
155
+ try {
156
+ if (this.state.callToWebrtcBNRInProgress) {
157
+ LoggerProxy.logger.info('Meeting:effectState#disableBNR. Call to WebRTC in progress, we need to wait for it to complete');
158
+
159
+ return this.resolvePromise();
160
+ }
161
+
162
+ bnr.enabled = BNR_STATUS.SHOULD_DISABLE;
163
+ this.state.callToWebrtcBNRInProgress = true;
164
+
165
+ const audioTrack = WebRTCMedia.Effects.BNR.disableBNR(meeting.mediaProperties.audioTrack);
166
+
167
+ const audioStream = MediaUtil.createMediaStream([audioTrack]);
168
+
169
+ LoggerProxy.logger.info('Meeting:effectState#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
170
+
171
+ await meeting.updateAudio({
172
+ sendAudio: true,
173
+ receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,
174
+ stream: audioStream
175
+ });
176
+
177
+ bnr.enabled = BNR_STATUS.NOT_ENABLED;
178
+
179
+ this.state.callToWebrtcBNRInProgress = false;
180
+
181
+ Metrics.sendBehavioralMetric(
182
+ BEHAVIORAL_METRICS.DISABLE_BNR_SUCCESS
183
+ );
184
+ }
185
+ catch (error) {
186
+ bnr.enabled = BNR_STATUS.ENABLED;
187
+ this.state.callToWebrtcBNRInProgress = false;
188
+ LoggerProxy.logger.error(`Meeting:index#disableBNR. ${error}`);
189
+
190
+ Metrics.sendBehavioralMetric(
191
+ BEHAVIORAL_METRICS.DISABLE_BNR_FAILURE,
192
+ {
193
+ reason: error.message,
194
+ stack: error.stack
195
+ }
196
+ );
197
+ this.rejectPromise(error);
198
+
199
+ throw error;
200
+ }
201
+
202
+ return this.resolvePromise();
203
+ }
204
+ }
205
+
206
+ export default createEffectsState;
@@ -16,6 +16,7 @@ import Media from '../media';
16
16
  import MediaProperties from '../media/properties';
17
17
  import MeetingStateMachine from '../meeting/state';
18
18
  import createMuteState from '../meeting/muteState';
19
+ import createEffectsState from '../meeting/effectsState';
19
20
  import LocusInfo from '../locus-info';
20
21
  import PeerConnectionManager from '../peer-connection-manager';
21
22
  import Metrics from '../metrics';
@@ -72,6 +73,7 @@ import {
72
73
  STATS,
73
74
  VIDEO_RESOLUTIONS,
74
75
  VIDEO,
76
+ BNR_STATUS,
75
77
  HTTP_VERBS
76
78
  } from '../constants';
77
79
  import BEHAVIORAL_METRICS from '../metrics/constants';
@@ -530,6 +532,14 @@ export default class Meeting extends StatelessWebexPlugin {
530
532
  * @memberof Meeting
531
533
  */
532
534
  this.video = null;
535
+ /**
536
+ * created later
537
+ * @instance
538
+ * @type {EffectsState}
539
+ * @private
540
+ * @memberof Meeting
541
+ */
542
+ this.effects = null;
533
543
  /**
534
544
  * @instance
535
545
  * @type {MeetingStateMachine}
@@ -4482,18 +4492,26 @@ export default class Meeting extends StatelessWebexPlugin {
4482
4492
  * @public
4483
4493
  * @memberof Meeting
4484
4494
  */
4485
- updateAudio(options) {
4495
+ async updateAudio(options) {
4486
4496
  if (!this.canUpdateMedia()) {
4487
4497
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options);
4488
4498
  }
4489
- const {sendAudio, receiveAudio, stream} = options;
4499
+ const {
4500
+ sendAudio, receiveAudio, stream, bnrEnabled
4501
+ } = options;
4490
4502
  const {audioTransceiver} = this.mediaProperties.peerConnection;
4491
- const track = MeetingUtil.getTrack(stream).audioTrack;
4503
+ let track = MeetingUtil.getTrack(stream).audioTrack;
4492
4504
 
4493
4505
  if (typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean') {
4494
4506
  return Promise.reject(new ParameterError('Pass sendAudio and receiveAudio parameter'));
4495
4507
  }
4496
4508
 
4509
+ if (sendAudio && !this.isAudioMuted() && (bnrEnabled === BNR_STATUS.ENABLED || bnrEnabled === BNR_STATUS.SHOULD_ENABLE)) {
4510
+ LoggerProxy.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
4511
+ track = await this.internal_enableBNR(track);
4512
+ LoggerProxy.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
4513
+ }
4514
+
4497
4515
  return MeetingUtil.validateOptions({sendAudio, localStream: stream})
4498
4516
  .then(() => {
4499
4517
  let previousMediaDirection = {};
@@ -5751,95 +5769,104 @@ export default class Meeting extends StatelessWebexPlugin {
5751
5769
  };
5752
5770
 
5753
5771
  /**
5754
- * enableBNR API
5755
- * @returns {Promise<Boolean>}
5772
+ * Internal API to return status of BNR
5773
+ * @returns {Boolean}
5756
5774
  * @public
5757
5775
  * @memberof Meeting
5758
5776
  */
5759
- async enableBNR() {
5760
- LoggerProxy.logger.info('Meeting:index#enableBNR. Enable BNR called');
5761
- let isSuccess = false;
5777
+ isBnrEnabled() {
5778
+ return this.effects && this.effects.isBnrEnabled();
5779
+ }
5762
5780
 
5781
+ /**
5782
+ * Internal API to obtain BNR enabled MediaStream
5783
+ * @returns {Promise<MediaStreamTrack>}
5784
+ * @private
5785
+ * @param {MedaiStreamTrack} audioTrack from updateAudio
5786
+ * @memberof Meeting
5787
+ */
5788
+ async internal_enableBNR(audioTrack) {
5763
5789
  try {
5764
- if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
5765
- throw new Error("Meeting doesn't have an audioTrack attached");
5766
- }
5767
- this.mediaProperties.audioTrack = await WebRTCMedia.Effects.BNR.enableBNR(this.mediaProperties.audioTrack);
5768
- const audioStream = MediaUtil.createMediaStream([this.mediaProperties.audioTrack]);
5769
-
5770
- LoggerProxy.logger.info('Meeting:index#enableBNR. BNR enabled track obtained from WebRTC & sent to updateAudio');
5771
- await this.updateAudio({
5772
- sendAudio: true,
5773
- receiveAudio: true,
5774
- stream: audioStream
5775
- });
5776
- this.isBnrEnabled = true;
5777
- isSuccess = true;
5778
- Metrics.sendBehavioralMetric(
5779
- BEHAVIORAL_METRICS.ENABLE_BNR_SUCCESS,
5780
- );
5790
+ LoggerProxy.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
5791
+ const bnrAudioTrack = await WebRTCMedia.Effects.BNR.enableBNR(audioTrack);
5792
+
5793
+ LoggerProxy.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
5794
+
5795
+ return bnrAudioTrack;
5781
5796
  }
5782
5797
  catch (error) {
5783
- LoggerProxy.logger.error(`Meeting:index#enableBNR. ${error}`);
5798
+ LoggerProxy.logger.error('Meeting:index#internal_enableBNR.', error);
5799
+ throw error;
5800
+ }
5801
+ }
5784
5802
 
5785
- Metrics.sendBehavioralMetric(
5786
- BEHAVIORAL_METRICS.ENABLE_BNR_FAILURE,
5787
- {
5788
- reason: error.message,
5789
- stack: error.stack
5790
- }
5791
- );
5803
+ /**
5804
+ * Enable the audio track with BNR for a meeting
5805
+ * @returns {Promise} resolves the data from enable bnr or rejects if there is no audio or audio is muted
5806
+ * @public
5807
+ * @memberof Meeting
5808
+ */
5809
+ enableBNR() {
5810
+ if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
5811
+ return Promise.reject(new Error("Meeting doesn't have an audioTrack attached"));
5812
+ }
5792
5813
 
5793
- throw error;
5814
+ if (this.isAudioMuted()) {
5815
+ return Promise.reject(new Error('Cannot enable BNR while meeting is muted'));
5794
5816
  }
5795
5817
 
5796
- return isSuccess;
5818
+ this.effects = this.effects || createEffectsState('BNR');
5819
+
5820
+ const LOG_HEADER = 'Meeting:index#enableBNR -->';
5821
+
5822
+ return logRequest(this.effects.handleClientRequest(true, this)
5823
+ .then((res) => {
5824
+ LoggerProxy.logger.info('Meeting:index#enableBNR. Enable bnr completed');
5825
+
5826
+ return res;
5827
+ })
5828
+ .catch((error) => {
5829
+ throw error;
5830
+ }),
5831
+ {
5832
+ header: `${LOG_HEADER} enable bnr`,
5833
+ success: `${LOG_HEADER} enable bnr success`,
5834
+ failure: `${LOG_HEADER} enable bnr failure, `
5835
+ });
5797
5836
  }
5798
5837
 
5799
5838
  /**
5800
- * disableBNR API
5801
- * @returns {Promise<Boolean>}
5839
+ * Disable the BNR for an audio track
5840
+ * @returns {Promise} resolves the data from disable bnr or rejects if there is no audio set
5802
5841
  * @public
5803
5842
  * @memberof Meeting
5804
5843
  */
5805
- async disableBNR() {
5806
- LoggerProxy.logger.info('Meeting:index#disableBNR. Disable BNR called');
5807
- let isSuccess = false;
5808
-
5809
- try {
5810
- if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
5811
- throw new Error("Meeting doesn't have an audioTrack attached");
5812
- }
5813
- this.mediaProperties.audioTrack = WebRTCMedia.Effects.BNR.disableBNR(this.mediaProperties.audioTrack);
5814
- const audioStream = MediaUtil.createMediaStream([this.mediaProperties.audioTrack]);
5815
-
5816
- LoggerProxy.logger.info('Meeting:index#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
5817
- await this.updateAudio({
5818
- sendAudio: true,
5819
- receiveAudio: true,
5820
- stream: audioStream
5821
- });
5822
- this.isBnrEnabled = false;
5823
- isSuccess = true;
5844
+ disableBNR() {
5845
+ if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
5846
+ return Promise.reject(new Error("Meeting doesn't have an audioTrack attached"));
5847
+ }
5824
5848
 
5825
- Metrics.sendBehavioralMetric(
5826
- BEHAVIORAL_METRICS.DISABLE_BNR_SUCCESS
5827
- );
5849
+ if (!this.isBnrEnabled()) {
5850
+ return Promise.reject(new Error('Can not disable as BNR is not enabled'));
5828
5851
  }
5829
- catch (error) {
5830
- LoggerProxy.logger.error(`Meeting:index#disableBNR. ${error}`);
5831
5852
 
5832
- Metrics.sendBehavioralMetric(
5833
- BEHAVIORAL_METRICS.DISABLE_BNR_FAILURE,
5834
- {
5835
- reason: error.message,
5836
- stack: error.stack
5837
- }
5838
- );
5853
+ this.effects = this.effects || createEffectsState('BNR');
5839
5854
 
5840
- throw error;
5841
- }
5855
+ const LOG_HEADER = 'Meeting:index#disableBNR -->';
5856
+
5857
+ return logRequest(this.effects.handleClientRequest(false, this)
5858
+ .then((res) => {
5859
+ LoggerProxy.logger.info('Meeting:index#disableBNR. Disable bnr completed');
5842
5860
 
5843
- return isSuccess;
5861
+ return res;
5862
+ })
5863
+ .catch((error) => {
5864
+ throw error;
5865
+ }),
5866
+ {
5867
+ header: `${LOG_HEADER} disable bnr`,
5868
+ success: `${LOG_HEADER} disable bnr success`,
5869
+ failure: `${LOG_HEADER} disable bnr failure, `
5870
+ });
5844
5871
  }
5845
5872
  }
@@ -151,10 +151,7 @@ export default class MeetingInfoV2 {
151
151
  method: HTTP_VERBS.POST,
152
152
  uri,
153
153
  body
154
- })
155
- .catch((err) => {
156
- throw new MeetingInfoV2AdhocMeetingError(err.body?.code, err.body?.message);
157
- });
154
+ });
158
155
  })
159
156
  .catch((err) => {
160
157
  Metrics.sendBehavioralMetric(