@webex/plugin-meetings 3.0.0-beta.113 → 3.0.0-beta.114

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.
@@ -169,7 +169,7 @@ var Breakout = _webexCore.WebexPlugin.extend({
169
169
  sessionId: this.sessionId
170
170
  });
171
171
  },
172
- version: "3.0.0-beta.113"
172
+ version: "3.0.0-beta.114"
173
173
  });
174
174
  var _default = Breakout;
175
175
  exports.default = _default;
@@ -937,7 +937,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
937
937
  this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
938
938
  }
939
939
  },
940
- version: "3.0.0-beta.113"
940
+ version: "3.0.0-beta.114"
941
941
  });
942
942
  var _default = Breakouts;
943
943
  exports.default = _default;
@@ -174,6 +174,19 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
174
174
  function MeetingInfoV2(webex) {
175
175
  (0, _classCallCheck2.default)(this, MeetingInfoV2);
176
176
  (0, _defineProperty2.default)(this, "webex", void 0);
177
+ (0, _defineProperty2.default)(this, "handlePolicyError", function (err) {
178
+ var _err$body;
179
+ if (!err.body) {
180
+ return;
181
+ }
182
+ if (POLICY_ERROR_CODES.includes((_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.code)) {
183
+ var _err$body2, _err$body3, _err$body4, _err$body4$data, _err$body5;
184
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_INFO_POLICY_ERROR, {
185
+ code: (_err$body2 = err.body) === null || _err$body2 === void 0 ? void 0 : _err$body2.code
186
+ });
187
+ throw new MeetingInfoV2PolicyError((_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, (_err$body5 = err.body) === null || _err$body5 === void 0 ? void 0 : _err$body5.message);
188
+ }
189
+ });
177
190
  this.webex = webex;
178
191
  }
179
192
 
@@ -196,17 +209,24 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
196
209
  });
197
210
  }
198
211
 
212
+ /**
213
+ * Raises a MeetingInfoV2PolicyError for policy error codes
214
+ * @param {any} err the error from the request
215
+ * @returns {void}
216
+ */
217
+ }, {
218
+ key: "createAdhocSpaceMeeting",
219
+ value:
199
220
  /**
200
221
  * Creates adhoc space meetings for a space by fetching the conversation infomation
201
222
  * @param {String} conversationUrl conversationUrl to start adhoc meeting on
223
+ * @param {String} installedOrgID org ID of user's machine
202
224
  * @returns {Promise} returns a meeting info object
203
225
  * @public
204
226
  * @memberof MeetingInfo
205
227
  */
206
- }, {
207
- key: "createAdhocSpaceMeeting",
208
- value: function () {
209
- var _createAdhocSpaceMeeting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(conversationUrl) {
228
+ function () {
229
+ var _createAdhocSpaceMeeting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(conversationUrl, installedOrgID) {
210
230
  var _this5 = this;
211
231
  var getInvitees;
212
232
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -245,20 +265,26 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
245
265
  kroUrl: conversation.kmsResourceObjectUrl,
246
266
  invitees: getInvitees((_conversation$partici = conversation.participants) === null || _conversation$partici === void 0 ? void 0 : _conversation$partici.items)
247
267
  };
268
+ if (installedOrgID) {
269
+ body.installedOrgID = installedOrgID;
270
+ }
248
271
  var uri = _this5.webex.meetings.preferredWebexSite ? "https://".concat(_this5.webex.meetings.preferredWebexSite, "/wbxappapi/v2/meetings/spaceInstant") : '';
249
- _metrics.default.sendBehavioralMetric(_constants2.default.ADHOC_MEETING_SUCCESS);
250
272
  return _this5.webex.request({
251
273
  method: _constants.HTTP_VERBS.POST,
252
274
  uri: uri,
253
275
  body: body
254
276
  });
277
+ }).then(function (requestResult) {
278
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADHOC_MEETING_SUCCESS);
279
+ return requestResult;
255
280
  }).catch(function (err) {
256
- var _err$body, _err$body2;
281
+ var _err$body6, _err$body7;
282
+ _this5.handlePolicyError(err);
257
283
  _metrics.default.sendBehavioralMetric(_constants2.default.ADHOC_MEETING_FAILURE, {
258
284
  reason: err.message,
259
285
  stack: err.stack
260
286
  });
261
- 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);
287
+ throw new MeetingInfoV2AdhocMeetingError((_err$body6 = err.body) === null || _err$body6 === void 0 ? void 0 : _err$body6.code, (_err$body7 = err.body) === null || _err$body7 === void 0 ? void 0 : _err$body7.message);
262
288
  }));
263
289
  case 4:
264
290
  case "end":
@@ -266,7 +292,7 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
266
292
  }
267
293
  }, _callee, this);
268
294
  }));
269
- function createAdhocSpaceMeeting(_x) {
295
+ function createAdhocSpaceMeeting(_x, _x2) {
270
296
  return _createAdhocSpaceMeeting.apply(this, arguments);
271
297
  }
272
298
  return createAdhocSpaceMeeting;
@@ -279,7 +305,7 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
279
305
  * @param {Object} captchaInfo
280
306
  * @param {String} captchaInfo.code
281
307
  * @param {String} captchaInfo.id
282
- * @param {String} installedOrgID
308
+ * @param {String} installedOrgID org ID of user's machine
283
309
  * @param {String} locusId
284
310
  * @param {Object} extraParams
285
311
  * @param {Object} options
@@ -291,6 +317,7 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
291
317
  key: "fetchMeetingInfo",
292
318
  value: function () {
293
319
  var _fetchMeetingInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(destination) {
320
+ var _this6 = this;
294
321
  var type,
295
322
  password,
296
323
  captchaInfo,
@@ -330,7 +357,7 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
330
357
  _context2.next = 13;
331
358
  break;
332
359
  }
333
- return _context2.abrupt("return", this.createAdhocSpaceMeeting(destinationType.destination));
360
+ return _context2.abrupt("return", this.createAdhocSpaceMeeting(destinationType.destination, installedOrgID));
334
361
  case 13:
335
362
  _context2.next = 15;
336
363
  return _utilv.default.getRequestBody(_objectSpread(_objectSpread({}, destinationType), {}, {
@@ -384,14 +411,8 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
384
411
  });
385
412
  }
386
413
  if ((err === null || err === void 0 ? void 0 : err.statusCode) === 403) {
387
- var _err$body3, _err$body8, _err$body9, _err$body9$data;
388
- if (POLICY_ERROR_CODES.includes((_err$body3 = err.body) === null || _err$body3 === void 0 ? void 0 : _err$body3.code)) {
389
- var _err$body4, _err$body5, _err$body6, _err$body6$data, _err$body7;
390
- _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_INFO_POLICY_ERROR, {
391
- code: (_err$body4 = err.body) === null || _err$body4 === void 0 ? void 0 : _err$body4.code
392
- });
393
- throw new MeetingInfoV2PolicyError((_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, (_err$body7 = err.body) === null || _err$body7 === void 0 ? void 0 : _err$body7.message);
394
- }
414
+ var _err$body8, _err$body9, _err$body9$data;
415
+ _this6.handlePolicyError(err);
395
416
  _metrics.default.sendBehavioralMetric(_constants2.default.VERIFY_PASSWORD_ERROR, {
396
417
  reason: err.message,
397
418
  stack: err.stack
@@ -423,7 +444,7 @@ var MeetingInfoV2 = /*#__PURE__*/function () {
423
444
  }
424
445
  }, _callee2, this);
425
446
  }));
426
- function fetchMeetingInfo(_x2) {
447
+ function fetchMeetingInfo(_x3) {
427
448
  return _fetchMeetingInfo.apply(this, arguments);
428
449
  }
429
450
  return fetchMeetingInfo;
@@ -1 +1 @@
1
- {"version":3,"names":["PASSWORD_ERROR_DEFAULT_MESSAGE","CAPTCHA_ERROR_DEFAULT_MESSAGE","ADHOC_MEETING_DEFAULT_ERROR","CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES","POLICY_ERROR_CODES","MeetingInfoV2PasswordError","wbxAppApiErrorCode","meetingInfo","message","name","sdkMessage","stack","Error","wbxAppApiCode","MeetingInfoV2AdhocMeetingError","MeetingInfoV2PolicyError","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","installedOrgID","locusId","extraParams","options","meetingId","destinationType","_CONVERSATION_URL_","config","experimental","enableAdhocMeetings","createAdhocSpaceMeeting","getRequestBody","DEFAULT_MEETING_INFO_REQUEST_BODY","length","FETCH_MEETING_INFO_V1_FAILURE","webExMeetingId","info","sipUri","requestOptions","getDirectMeetingInfoURI","directURI","service","WBXAPPAPI_SERVICE","resource","response","FETCH_MEETING_INFO_V1_SUCCESS","postEvent","event","eventType","MEETING_INFO_RESPONSE","data","errors","parseWebexApiError","meetingLookupUrl","statusCode","MEETING_INFO_POLICY_ERROR","VERIFY_PASSWORD_ERROR","VERIFY_CAPTCHA_ERROR","captchaId","captchaID","verificationImageURL","verificationAudioURL","refreshURL"],"sources":["meeting-info-v2.ts"],"sourcesContent":["import lodash from 'lodash';\nimport {\n HTTP_VERBS,\n _CONVERSATION_URL_,\n WBXAPPAPI_SERVICE,\n DEFAULT_MEETING_INFO_REQUEST_BODY,\n} from '../constants';\nimport Metrics from '../metrics';\nimport {eventType} from '../metrics/config';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\n\nimport MeetingInfoUtil from './utilv2';\n\nconst PASSWORD_ERROR_DEFAULT_MESSAGE =\n 'Password required. Call fetchMeetingInfo() with password argument';\nconst CAPTCHA_ERROR_DEFAULT_MESSAGE =\n 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';\nconst ADHOC_MEETING_DEFAULT_ERROR =\n 'Failed starting the adhoc meeting, Please contact support team ';\nconst CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];\nconst POLICY_ERROR_CODES = [403049, 403104, 403103, 403048, 403102, 403101];\n\n/**\n * Error to indicate that wbxappapi requires a password\n */\nexport class MeetingInfoV2PasswordError extends Error {\n meetingInfo: any;\n sdkMessage: any;\n wbxAppApiCode: any;\n body: any;\n\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(\n wbxAppApiErrorCode?: number,\n meetingInfo?: object,\n message: string = PASSWORD_ERROR_DEFAULT_MESSAGE\n ) {\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 sdkMessage: any;\n wbxAppApiCode: any;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode?: number, message: string = 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 * Error preventing join because of a meeting policy\n */\nexport class MeetingInfoV2PolicyError extends Error {\n meetingInfo: object;\n sdkMessage: string;\n wbxAppApiCode: number;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode?: number, meetingInfo?: object, message?: string) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2AdhocMeetingError';\n this.sdkMessage = message;\n this.stack = new Error().stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.meetingInfo = meetingInfo;\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 captchaInfo: any;\n isPasswordRequired: any;\n sdkMessage: any;\n wbxAppApiCode: any;\n body: any;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [captchaInfo]\n * @param {String} [message]\n */\n constructor(\n wbxAppApiErrorCode?: number,\n captchaInfo?: object,\n message: string = CAPTCHA_ERROR_DEFAULT_MESSAGE\n ) {\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 webex: any;\n\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: string, type: string = 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: string) {\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\n .get({url: conversationUrl}, {includeParticipants: true, disableTransform: true})\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\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);\n\n return this.webex.request({\n method: HTTP_VERBS.POST,\n uri,\n body,\n });\n })\n .catch((err) => {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE, {\n reason: err.message,\n stack: err.stack,\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 * @param {String} installedOrgID\n * @param {String} locusId\n * @param {Object} extraParams\n * @param {Object} options\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async fetchMeetingInfo(\n destination: string,\n type: string = null,\n password: string = null,\n captchaInfo: {\n code: string;\n id: string;\n } = null,\n installedOrgID = null,\n locusId = null,\n extraParams: object = {},\n options: {meetingId?: string} = {}\n ) {\n const {meetingId} = options;\n\n const destinationType = await MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex,\n });\n\n if (\n destinationType.type === _CONVERSATION_URL_ &&\n this.webex.config.meetings.experimental.enableAdhocMeetings &&\n this.webex.meetings.preferredWebexSite\n ) {\n return this.createAdhocSpaceMeeting(destinationType.destination);\n }\n\n const body = await MeetingInfoUtil.getRequestBody({\n ...destinationType,\n password,\n captchaInfo,\n installedOrgID,\n locusId,\n extraParams,\n });\n\n // If the body only contains the default properties, we don't have enough to\n // fetch the meeting info so don't bother trying.\n if (\n !lodash.difference(Object.keys(body), Object.keys(DEFAULT_MEETING_INFO_REQUEST_BODY)).length\n ) {\n const err = new Error('Not enough information to fetch meeting info');\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE, {\n reason: err.message,\n destinationType: destinationType?.type,\n webExMeetingId: destinationType?.info?.webExMeetingId,\n sipUri: destinationType?.info?.sipUri,\n });\n\n throw err;\n }\n\n const requestOptions: any = {\n method: HTTP_VERBS.POST,\n body,\n };\n\n const directURI = await MeetingInfoUtil.getDirectMeetingInfoURI(destinationType);\n\n if (directURI) {\n requestOptions.uri = directURI;\n } else {\n requestOptions.service = WBXAPPAPI_SERVICE;\n requestOptions.resource = 'meetingInfo';\n }\n\n return this.webex\n .request(requestOptions)\n .then((response) => {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_SUCCESS);\n\n return response;\n })\n .catch((err) => {\n if (meetingId) {\n Metrics.postEvent({\n event: eventType.MEETING_INFO_RESPONSE,\n meetingId,\n data: {\n errors: [Metrics.parseWebexApiError(err, true)],\n meetingLookupUrl: err?.url,\n },\n });\n }\n\n if (err?.statusCode === 403) {\n if (POLICY_ERROR_CODES.includes(err.body?.code)) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR, {\n code: err.body?.code,\n });\n\n throw new MeetingInfoV2PolicyError(\n err.body?.code,\n err.body?.data?.meetingInfo,\n err.body?.message\n );\n }\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR, {\n reason: err.message,\n stack: err.stack,\n });\n\n throw new MeetingInfoV2PasswordError(err.body?.code, err.body?.data?.meetingInfo);\n }\n if (err?.statusCode === 423) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_CAPTCHA_ERROR, {\n reason: err.message,\n stack: err.stack,\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(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE, {\n reason: err.message,\n stack: err.stack,\n });\n throw err;\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAMA;AACA;AACA;AAEA;AAAuC;AAAA;AAAA;AAAA;AAEvC,IAAMA,8BAA8B,GAClC,mEAAmE;AACrE,IAAMC,6BAA6B,GACjC,qEAAqE;AACvE,IAAMC,2BAA2B,GAC/B,iEAAiE;AACnE,IAAMC,qCAAqC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;AAC9D,IAAMC,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;AAE3E;AACA;AACA;AAFA,IAGaC,0BAA0B;EAAA;EAAA;EAMrC;AACF;AACA;AACA;AACA;AACA;AACA;EACE,oCACEC,kBAA2B,EAC3BC,WAAoB,EAEpB;IAAA;IAAA,IADAC,OAAe,uEAAGR,8BAA8B;IAAA;IAEhD,oCAASQ,OAAO,oBAAUF,kBAAkB;IAAI;IAAA;IAAA;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ICY_ERROR_CODES","MeetingInfoV2PasswordError","wbxAppApiErrorCode","meetingInfo","message","name","sdkMessage","stack","Error","wbxAppApiCode","MeetingInfoV2AdhocMeetingError","MeetingInfoV2PolicyError","MeetingInfoV2CaptchaError","captchaInfo","isPasswordRequired","includes","MeetingInfoV2","webex","err","body","code","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","MEETING_INFO_POLICY_ERROR","data","destination","type","MeetingInfoUtil","getDestinationType","conversationUrl","installedOrgID","meetings","preferredWebexSite","getInvitees","particpants","invitees","forEach","participant","push","email","emailAddress","ciUserUuid","entryUUID","internal","conversation","get","url","includeParticipants","disableTransform","then","title","displayName","spaceUrl","keyUrl","encryptionKeyUrl","kroUrl","kmsResourceObjectUrl","participants","items","uri","request","method","HTTP_VERBS","POST","requestResult","ADHOC_MEETING_SUCCESS","catch","handlePolicyError","ADHOC_MEETING_FAILURE","reason","password","locusId","extraParams","options","meetingId","destinationType","_CONVERSATION_URL_","config","experimental","enableAdhocMeetings","createAdhocSpaceMeeting","getRequestBody","DEFAULT_MEETING_INFO_REQUEST_BODY","length","FETCH_MEETING_INFO_V1_FAILURE","webExMeetingId","info","sipUri","requestOptions","getDirectMeetingInfoURI","directURI","service","WBXAPPAPI_SERVICE","resource","response","FETCH_MEETING_INFO_V1_SUCCESS","postEvent","event","eventType","MEETING_INFO_RESPONSE","errors","parseWebexApiError","meetingLookupUrl","statusCode","VERIFY_PASSWORD_ERROR","VERIFY_CAPTCHA_ERROR","captchaId","captchaID","verificationImageURL","verificationAudioURL","refreshURL"],"sources":["meeting-info-v2.ts"],"sourcesContent":["import lodash from 'lodash';\nimport {\n HTTP_VERBS,\n _CONVERSATION_URL_,\n WBXAPPAPI_SERVICE,\n DEFAULT_MEETING_INFO_REQUEST_BODY,\n} from '../constants';\nimport Metrics from '../metrics';\nimport {eventType} from '../metrics/config';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\n\nimport MeetingInfoUtil from './utilv2';\n\nconst PASSWORD_ERROR_DEFAULT_MESSAGE =\n 'Password required. Call fetchMeetingInfo() with password argument';\nconst CAPTCHA_ERROR_DEFAULT_MESSAGE =\n 'Captcha required. Call fetchMeetingInfo() with captchaInfo argument';\nconst ADHOC_MEETING_DEFAULT_ERROR =\n 'Failed starting the adhoc meeting, Please contact support team ';\nconst CAPTCHA_ERROR_REQUIRES_PASSWORD_CODES = [423005, 423006];\nconst POLICY_ERROR_CODES = [403049, 403104, 403103, 403048, 403102, 403101];\n\n/**\n * Error to indicate that wbxappapi requires a password\n */\nexport class MeetingInfoV2PasswordError extends Error {\n meetingInfo: any;\n sdkMessage: any;\n wbxAppApiCode: any;\n body: any;\n\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(\n wbxAppApiErrorCode?: number,\n meetingInfo?: object,\n message: string = PASSWORD_ERROR_DEFAULT_MESSAGE\n ) {\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 sdkMessage: any;\n wbxAppApiCode: any;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode?: number, message: string = 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 * Error preventing join because of a meeting policy\n */\nexport class MeetingInfoV2PolicyError extends Error {\n meetingInfo: object;\n sdkMessage: string;\n wbxAppApiCode: number;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [meetingInfo]\n * @param {String} [message]\n */\n constructor(wbxAppApiErrorCode?: number, meetingInfo?: object, message?: string) {\n super(`${message}, code=${wbxAppApiErrorCode}`);\n this.name = 'MeetingInfoV2AdhocMeetingError';\n this.sdkMessage = message;\n this.stack = new Error().stack;\n this.wbxAppApiCode = wbxAppApiErrorCode;\n this.meetingInfo = meetingInfo;\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 captchaInfo: any;\n isPasswordRequired: any;\n sdkMessage: any;\n wbxAppApiCode: any;\n body: any;\n /**\n *\n * @constructor\n * @param {Number} [wbxAppApiErrorCode]\n * @param {Object} [captchaInfo]\n * @param {String} [message]\n */\n constructor(\n wbxAppApiErrorCode?: number,\n captchaInfo?: object,\n message: string = CAPTCHA_ERROR_DEFAULT_MESSAGE\n ) {\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 webex: any;\n\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: string, type: string = null) {\n return MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex,\n });\n }\n\n /**\n * Raises a MeetingInfoV2PolicyError for policy error codes\n * @param {any} err the error from the request\n * @returns {void}\n */\n handlePolicyError = (err) => {\n if (!err.body) {\n return;\n }\n\n if (POLICY_ERROR_CODES.includes(err.body?.code)) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR, {\n code: err.body?.code,\n });\n\n throw new MeetingInfoV2PolicyError(\n err.body?.code,\n err.body?.data?.meetingInfo,\n err.body?.message\n );\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 * @param {String} installedOrgID org ID of user's machine\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async createAdhocSpaceMeeting(conversationUrl: string, installedOrgID?: string) {\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\n .get({url: conversationUrl}, {includeParticipants: true, disableTransform: true})\n .then((conversation) => {\n const body: {\n title: string;\n spaceUrl: string;\n keyUrl: string;\n kroUrl: string;\n invitees: any[];\n installedOrgID?: string;\n } = {\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 if (installedOrgID) {\n body.installedOrgID = installedOrgID;\n }\n\n const uri = this.webex.meetings.preferredWebexSite\n ? `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant`\n : '';\n\n return this.webex.request({\n method: HTTP_VERBS.POST,\n uri,\n body,\n });\n })\n .then((requestResult) => {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);\n\n return requestResult;\n })\n .catch((err) => {\n this.handlePolicyError(err);\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE, {\n reason: err.message,\n stack: err.stack,\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 * @param {String} installedOrgID org ID of user's machine\n * @param {String} locusId\n * @param {Object} extraParams\n * @param {Object} options\n * @returns {Promise} returns a meeting info object\n * @public\n * @memberof MeetingInfo\n */\n async fetchMeetingInfo(\n destination: string,\n type: string = null,\n password: string = null,\n captchaInfo: {\n code: string;\n id: string;\n } = null,\n installedOrgID = null,\n locusId = null,\n extraParams: object = {},\n options: {meetingId?: string} = {}\n ) {\n const {meetingId} = options;\n\n const destinationType = await MeetingInfoUtil.getDestinationType({\n destination,\n type,\n webex: this.webex,\n });\n\n if (\n destinationType.type === _CONVERSATION_URL_ &&\n this.webex.config.meetings.experimental.enableAdhocMeetings &&\n this.webex.meetings.preferredWebexSite\n ) {\n return this.createAdhocSpaceMeeting(destinationType.destination, installedOrgID);\n }\n\n const body = await MeetingInfoUtil.getRequestBody({\n ...destinationType,\n password,\n captchaInfo,\n installedOrgID,\n locusId,\n extraParams,\n });\n\n // If the body only contains the default properties, we don't have enough to\n // fetch the meeting info so don't bother trying.\n if (\n !lodash.difference(Object.keys(body), Object.keys(DEFAULT_MEETING_INFO_REQUEST_BODY)).length\n ) {\n const err = new Error('Not enough information to fetch meeting info');\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE, {\n reason: err.message,\n destinationType: destinationType?.type,\n webExMeetingId: destinationType?.info?.webExMeetingId,\n sipUri: destinationType?.info?.sipUri,\n });\n\n throw err;\n }\n\n const requestOptions: any = {\n method: HTTP_VERBS.POST,\n body,\n };\n\n const directURI = await MeetingInfoUtil.getDirectMeetingInfoURI(destinationType);\n\n if (directURI) {\n requestOptions.uri = directURI;\n } else {\n requestOptions.service = WBXAPPAPI_SERVICE;\n requestOptions.resource = 'meetingInfo';\n }\n\n return this.webex\n .request(requestOptions)\n .then((response) => {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_SUCCESS);\n\n return response;\n })\n .catch((err) => {\n if (meetingId) {\n Metrics.postEvent({\n event: eventType.MEETING_INFO_RESPONSE,\n meetingId,\n data: {\n errors: [Metrics.parseWebexApiError(err, true)],\n meetingLookupUrl: err?.url,\n },\n });\n }\n\n if (err?.statusCode === 403) {\n this.handlePolicyError(err);\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR, {\n reason: err.message,\n stack: err.stack,\n });\n\n throw new MeetingInfoV2PasswordError(err.body?.code, err.body?.data?.meetingInfo);\n }\n if (err?.statusCode === 423) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_CAPTCHA_ERROR, {\n reason: err.message,\n stack: err.stack,\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(BEHAVIORAL_METRICS.FETCH_MEETING_INFO_V1_FAILURE, {\n reason: err.message,\n stack: err.stack,\n });\n throw err;\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAMA;AACA;AACA;AAEA;AAAuC;AAAA;AAAA;AAAA;AAEvC,IAAMA,8BAA8B,GAClC,mEAAmE;AACrE,IAAMC,6BAA6B,GACjC,qEAAqE;AACvE,IAAMC,2BAA2B,GAC/B,iEAAiE;AACnE,IAAMC,qCAAqC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;AAC9D,IAAMC,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;A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E3F,GAAG,CAACC,IAAI,CAAC0F,oBAAoB;oBACnDC,oBAAoB,EAAE5F,GAAG,CAACC,IAAI,CAAC2F,oBAAoB;oBACnDC,UAAU,EAAE7F,GAAG,CAACC,IAAI,CAAC4F;kBACvB,CAAC,CAAC;gBACJ;gBAEA1F,gBAAO,CAACC,oBAAoB,CAACC,mBAAkB,CAAC8D,6BAA6B,EAAE;kBAC7Ef,MAAM,EAAEpD,GAAG,CAACd,OAAO;kBACnBG,KAAK,EAAEW,GAAG,CAACX;gBACb,CAAC,CAAC;gBACF,MAAMW,GAAG;cACX,CAAC,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CACL;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA;AAAA"}
@@ -251,6 +251,7 @@ MeetingInfoUtil.getDestinationType = /*#__PURE__*/function () {
251
251
  * Helper function to build up a correct locus url depending on the value passed
252
252
  * @param {Object} options type and value to fetch meeting info
253
253
  * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
254
+ * @param {String} options.installedOrgID org ID of user's machine
254
255
  * @param {Object} options.destination ?? value.value
255
256
  * @returns {Object} returns an object with {resource, method}
256
257
  */
@@ -1 +1 @@
1
- {"version":3,"names":["MeetingInfoUtil","getParsedUrl","link","parsedUrl","url","parse","protocol","HTTPS_PROTOCOL","error","LoggerProxy","logger","warn","isMeetingLink","value","hostNameBool","hostname","includes","WEBEX_DOT_COM","pathNameBool","pathname","MEET","MEET_M","JOIN","isConversationUrl","webex","clusterId","internal","services","getClusterId","endsWith","CONVERSATION_SERVICE","isSipUri","sipString","sipUri","DIALER_REGEX","SIP_ADDRESS","exec","isPhoneNumber","phoneNumber","isValidNumber","PHONE_NUMBER","test","getHydraId","destination","deconstructHydraId","type","id","cluster","UUID_REG","_ROOM_","room","_PEOPLE_","people","getSipUriFromHydraPersonId","get","then","res","emails","length","ParameterError","catch","err","getDestinationType","from","_PERSONAL_ROOM_","userId","device","orgId","options","VALID_EMAIL_ADDRESS","email","list","items","hydraId","_MEETING_LINK_","_SIP_URI_","_CONVERSATION_URL_","wasHydraPerson","resolve","waitForCatalog","conversationUrl","conversation","getUrlFromClusterId","getRequestBody","password","captchaInfo","installedOrgID","locusId","extraParams","body","DEFAULT_MEETING_INFO_REQUEST_BODY","sipUrl","_MEETING_ID_","meetingKey","_LOCUS_ID_","info","webExMeetingId","meetingUrl","_MEETING_UUID_","meetingUUID","captchaID","captchaVerifyCode","code","getWebexSite","uri","exceptedDomains","site","match","getDirectMeetingInfoURI","preferredWebexSite","webExSite"],"sources":["utilv2.ts"],"sourcesContent":["import url from 'url';\n\nimport {\n // @ts-ignore\n deconstructHydraId,\n} from '@webex/common';\n\nimport {\n _SIP_URI_,\n _PERSONAL_ROOM_,\n _MEETING_ID_,\n _CONVERSATION_URL_,\n _LOCUS_ID_,\n _MEETING_LINK_,\n _PEOPLE_,\n _ROOM_,\n _MEETING_UUID_,\n DIALER_REGEX,\n WEBEX_DOT_COM,\n CONVERSATION_SERVICE,\n JOIN,\n MEET,\n MEET_M,\n HTTPS_PROTOCOL,\n UUID_REG,\n VALID_EMAIL_ADDRESS,\n DEFAULT_MEETING_INFO_REQUEST_BODY,\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nconst MeetingInfoUtil: any = {};\n\nMeetingInfoUtil.getParsedUrl = (link) => {\n try {\n let parsedUrl = url.parse(link);\n\n if (!parsedUrl) {\n return false;\n }\n // hack for links such as <company>.webex.com/meet/<user> without a protocol\n if (!parsedUrl.protocol) {\n parsedUrl = url.parse(`${HTTPS_PROTOCOL}${link}`);\n }\n\n return parsedUrl;\n } catch (error) {\n LoggerProxy.logger.warn(\n `Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ${error}`\n );\n\n return null;\n }\n};\n\n/**\n * Helper function to check if a string matches a known meeting link pattern\n * @param {String} value string to parse and see if it matches a meeting link\n * @returns {Boolean}\n */\nMeetingInfoUtil.isMeetingLink = (value: string) => {\n const parsedUrl = MeetingInfoUtil.getParsedUrl(value);\n const hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(WEBEX_DOT_COM);\n const pathNameBool =\n parsedUrl.pathname &&\n (parsedUrl.pathname.includes(`/${MEET}`) ||\n parsedUrl.pathname.includes(`/${MEET_M}`) ||\n parsedUrl.pathname.includes(`/${JOIN}`));\n\n return hostNameBool && pathNameBool;\n};\n\nMeetingInfoUtil.isConversationUrl = (value, webex) => {\n const clusterId = webex.internal.services.getClusterId(value);\n\n if (clusterId) {\n return clusterId.endsWith(CONVERSATION_SERVICE);\n }\n\n return false;\n};\n\nMeetingInfoUtil.isSipUri = (sipString) => {\n // TODO: lets remove regex from this equation and user URI matchers and such\n // have not found a great sip uri parser library as of now\n const sipUri = DIALER_REGEX.SIP_ADDRESS.exec(sipString);\n\n return sipUri;\n};\n\nMeetingInfoUtil.isPhoneNumber = (phoneNumber) => {\n const isValidNumber = DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);\n\n return isValidNumber;\n};\n\nMeetingInfoUtil.getHydraId = (destination) => {\n const {type, id, cluster} = deconstructHydraId(destination);\n\n if (id && UUID_REG.test(id)) {\n if (type === _ROOM_) {\n return {room: true, destination: id, cluster};\n }\n if (type === _PEOPLE_) {\n return {people: true, destination: id, cluster};\n }\n\n return {};\n }\n\n return {};\n};\n\nMeetingInfoUtil.getSipUriFromHydraPersonId = (destination, webex) =>\n webex.people\n .get(destination)\n .then((res) => {\n if (res.emails && res.emails.length) {\n return res.emails[0];\n }\n throw new ParameterError('Hydra Id Lookup was an invalid hydra person id.');\n })\n .catch((err) => {\n LoggerProxy.logger.error(\n `Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ${err} `\n );\n throw err;\n });\n\nMeetingInfoUtil.getDestinationType = async (from) => {\n const {type, webex} = from;\n let {destination} = from;\n\n if (type === _PERSONAL_ROOM_) {\n // this case checks if your type is personal room\n if (!destination) {\n // if we are not getting anything in desination we fetch org and user ids from webex instance\n destination = {\n userId: webex.internal.device.userId,\n orgId: webex.internal.device.orgId,\n };\n } else {\n const options = VALID_EMAIL_ADDRESS.test(destination)\n ? {email: destination}\n : {id: destination}; // we are assuming userId as default\n const res = await webex.people.list(options);\n\n let {orgId, id: userId} = res.items[0];\n\n userId = deconstructHydraId(userId).id;\n orgId = deconstructHydraId(orgId).id;\n destination = {userId, orgId};\n }\n }\n if (type) {\n return {\n destination,\n type,\n };\n }\n const options: any = {};\n const hydraId = MeetingInfoUtil.getHydraId(destination);\n\n if (MeetingInfoUtil.isMeetingLink(destination)) {\n LoggerProxy.logger.warn(\n 'Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead'\n );\n\n options.type = _MEETING_LINK_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isSipUri(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isPhoneNumber(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isConversationUrl(destination, webex)) {\n options.type = _CONVERSATION_URL_;\n options.destination = destination;\n } else if (hydraId.people) {\n options.type = _SIP_URI_;\n\n return MeetingInfoUtil.getSipUriFromHydraPersonId(hydraId.destination, webex).then((res) => {\n options.destination = res;\n\n // Since hydra person ids require a unique case in which they are\n // entirely converted to a SIP URI, we need to set a flag for detecting\n // this type of destination.\n options.wasHydraPerson = true;\n\n return Promise.resolve(options);\n });\n } else if (hydraId.room) {\n options.type = _CONVERSATION_URL_;\n try {\n await webex.internal.services.waitForCatalog('postauth');\n\n const conversationUrl = webex.internal.conversation.getUrlFromClusterId({\n cluster: hydraId.cluster,\n id: hydraId.destination,\n });\n\n options.destination = conversationUrl;\n } catch (e) {\n LoggerProxy.logger.error(`Meeting-info:util#getDestinationType --> ${e}`);\n throw e;\n }\n } else {\n LoggerProxy.logger.warn(\n \"Meeting-info:util#getDestinationType --> ('MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.\"\n );\n throw new ParameterError(\n 'MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.'\n );\n }\n\n return Promise.resolve(options);\n};\n\n/**\n * Helper function to build up a correct locus url depending on the value passed\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {Object} options.destination ?? value.value\n * @returns {Object} returns an object with {resource, method}\n */\nMeetingInfoUtil.getRequestBody = (options: {type: string; destination: object} | any) => {\n const {type, destination, password, captchaInfo, installedOrgID, locusId, extraParams} = options;\n const body: any = {\n ...DEFAULT_MEETING_INFO_REQUEST_BODY,\n ...extraParams,\n };\n\n switch (type) {\n case _SIP_URI_:\n body.sipUrl = destination;\n break;\n case _PERSONAL_ROOM_:\n body.userId = destination.userId;\n body.orgId = destination.orgId;\n break;\n case _MEETING_ID_:\n body.meetingKey = destination;\n break;\n case _CONVERSATION_URL_:\n body.conversationUrl = destination;\n break;\n case _LOCUS_ID_:\n // use meetingID for the completer meeting info for the already started meeting\n if (destination.info?.webExMeetingId) {\n body.meetingKey = destination.info.webExMeetingId;\n } else if (destination.info?.sipUri) {\n body.sipUrl = destination.info.sipUri;\n }\n break;\n case _MEETING_LINK_:\n body.meetingUrl = destination;\n break;\n case _MEETING_UUID_: {\n body.meetingUUID = destination;\n break;\n }\n default:\n }\n\n if (password) {\n body.password = password;\n }\n\n if (captchaInfo) {\n body.captchaID = captchaInfo.id;\n body.captchaVerifyCode = captchaInfo.code;\n }\n\n if (installedOrgID) {\n body.installedOrgID = installedOrgID;\n }\n\n if (locusId) {\n body.locusId = locusId;\n }\n\n return body;\n};\n\n/**\n * Helper function to parse the webex site/host from a URI string.\n * @param {String} uri string (e.g. '10019857020@convergedats.webex.com')\n * @returns {String} the site/host part of the URI string (e.g. 'convergedats.webex.com')\n */\nMeetingInfoUtil.getWebexSite = (uri: string) => {\n const exceptedDomains = ['meet.webex.com', 'meetup.webex.com', 'ciscospark.com'];\n const site = uri?.match(/.+@([^.]+\\.[^.]+\\.[^.]+)$/)?.[1];\n\n return exceptedDomains.includes(site) ? null : site;\n};\n\n/**\n * Helper function to return the direct URI for fetching meeting info (to avoid a redirect).\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {Object} options.destination ?? value.value\n * @returns {String} returns a URI string or null of there is no direct URI\n */\nMeetingInfoUtil.getDirectMeetingInfoURI = (options: {type: string; destination: any}) => {\n const {type, destination} = options;\n\n let preferredWebexSite = null;\n\n switch (type) {\n case _SIP_URI_:\n preferredWebexSite = MeetingInfoUtil.getWebexSite(destination);\n break;\n case _LOCUS_ID_:\n preferredWebexSite = destination.info?.webExSite;\n break;\n default:\n }\n\n return preferredWebexSite ? `https://${preferredWebexSite}/wbxappapi/v1/meetingInfo` : null;\n};\n\nexport default MeetingInfoUtil;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAEA;AAKA;AAqBA;AACA;AAAsD;AAAA;AAEtD,IAAMA,eAAoB,GAAG,CAAC,CAAC;AAE/BA,eAAe,CAACC,YAAY,GAAG,UAACC,IAAI,EAAK;EACvC,IAAI;IACF,IAAIC,SAAS,GAAGC,YAAG,CAACC,KAAK,CAACH,IAAI,CAAC;IAE/B,IAAI,CAACC,SAAS,EAAE;MACd,OAAO,KAAK;IACd;IACA;IACA,IAAI,CAACA,SAAS,CAACG,QAAQ,EAAE;MACvBH,SAAS,GAAGC,YAAG,CAACC,KAAK,WAAIE,yBAAc,SAAGL,IAAI,EAAG;IACnD;IAEA,OAAOC,SAAS;EAClB,CAAC,CAAC,OAAOK,KAAK,EAAE;IACdC,oBAAW,CAACC,MAAM,CAACC,IAAI,8EACiDH,KAAK,EAC5E;IAED,OA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F,IAAI,CAAC,GAAG,IAAI,GAAGA,IAAI;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA1G,eAAe,CAAC4G,uBAAuB,GAAG,UAACxC,OAAyC,EAAK;EAAA;EACvF,IAAOvB,IAAI,GAAiBuB,OAAO,CAA5BvB,IAAI;IAAEF,WAAW,GAAIyB,OAAO,CAAtBzB,WAAW;EAExB,IAAIkE,kBAAkB,GAAG,IAAI;EAE7B,QAAQhE,IAAI;IACV,KAAK8B,oBAAS;MACZkC,kBAAkB,GAAG7G,eAAe,CAACuG,YAAY,CAAC5D,WAAW,CAAC;MAC9D;IACF,KAAKmD,qBAAU;MACbe,kBAAkB,yBAAGlE,WAAW,CAACoD,IAAI,uDAAhB,mBAAkBe,SAAS;MAChD;IACF;EAAQ;EAGV,OAAOD,kBAAkB,qBAAcA,kBAAkB,iCAA8B,IAAI;AAC7F,CAAC;AAAC,eAEa7G,eAAe;AAAA"}
1
+ {"version":3,"names":["MeetingInfoUtil","getParsedUrl","link","parsedUrl","url","parse","protocol","HTTPS_PROTOCOL","error","LoggerProxy","logger","warn","isMeetingLink","value","hostNameBool","hostname","includes","WEBEX_DOT_COM","pathNameBool","pathname","MEET","MEET_M","JOIN","isConversationUrl","webex","clusterId","internal","services","getClusterId","endsWith","CONVERSATION_SERVICE","isSipUri","sipString","sipUri","DIALER_REGEX","SIP_ADDRESS","exec","isPhoneNumber","phoneNumber","isValidNumber","PHONE_NUMBER","test","getHydraId","destination","deconstructHydraId","type","id","cluster","UUID_REG","_ROOM_","room","_PEOPLE_","people","getSipUriFromHydraPersonId","get","then","res","emails","length","ParameterError","catch","err","getDestinationType","from","_PERSONAL_ROOM_","userId","device","orgId","options","VALID_EMAIL_ADDRESS","email","list","items","hydraId","_MEETING_LINK_","_SIP_URI_","_CONVERSATION_URL_","wasHydraPerson","resolve","waitForCatalog","conversationUrl","conversation","getUrlFromClusterId","getRequestBody","password","captchaInfo","installedOrgID","locusId","extraParams","body","DEFAULT_MEETING_INFO_REQUEST_BODY","sipUrl","_MEETING_ID_","meetingKey","_LOCUS_ID_","info","webExMeetingId","meetingUrl","_MEETING_UUID_","meetingUUID","captchaID","captchaVerifyCode","code","getWebexSite","uri","exceptedDomains","site","match","getDirectMeetingInfoURI","preferredWebexSite","webExSite"],"sources":["utilv2.ts"],"sourcesContent":["import url from 'url';\n\nimport {\n // @ts-ignore\n deconstructHydraId,\n} from '@webex/common';\n\nimport {\n _SIP_URI_,\n _PERSONAL_ROOM_,\n _MEETING_ID_,\n _CONVERSATION_URL_,\n _LOCUS_ID_,\n _MEETING_LINK_,\n _PEOPLE_,\n _ROOM_,\n _MEETING_UUID_,\n DIALER_REGEX,\n WEBEX_DOT_COM,\n CONVERSATION_SERVICE,\n JOIN,\n MEET,\n MEET_M,\n HTTPS_PROTOCOL,\n UUID_REG,\n VALID_EMAIL_ADDRESS,\n DEFAULT_MEETING_INFO_REQUEST_BODY,\n} from '../constants';\nimport ParameterError from '../common/errors/parameter';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nconst MeetingInfoUtil: any = {};\n\nMeetingInfoUtil.getParsedUrl = (link) => {\n try {\n let parsedUrl = url.parse(link);\n\n if (!parsedUrl) {\n return false;\n }\n // hack for links such as <company>.webex.com/meet/<user> without a protocol\n if (!parsedUrl.protocol) {\n parsedUrl = url.parse(`${HTTPS_PROTOCOL}${link}`);\n }\n\n return parsedUrl;\n } catch (error) {\n LoggerProxy.logger.warn(\n `Meeting-info:util#getParsedUrl --> unable to parse the URL, error: ${error}`\n );\n\n return null;\n }\n};\n\n/**\n * Helper function to check if a string matches a known meeting link pattern\n * @param {String} value string to parse and see if it matches a meeting link\n * @returns {Boolean}\n */\nMeetingInfoUtil.isMeetingLink = (value: string) => {\n const parsedUrl = MeetingInfoUtil.getParsedUrl(value);\n const hostNameBool = parsedUrl.hostname && parsedUrl.hostname.includes(WEBEX_DOT_COM);\n const pathNameBool =\n parsedUrl.pathname &&\n (parsedUrl.pathname.includes(`/${MEET}`) ||\n parsedUrl.pathname.includes(`/${MEET_M}`) ||\n parsedUrl.pathname.includes(`/${JOIN}`));\n\n return hostNameBool && pathNameBool;\n};\n\nMeetingInfoUtil.isConversationUrl = (value, webex) => {\n const clusterId = webex.internal.services.getClusterId(value);\n\n if (clusterId) {\n return clusterId.endsWith(CONVERSATION_SERVICE);\n }\n\n return false;\n};\n\nMeetingInfoUtil.isSipUri = (sipString) => {\n // TODO: lets remove regex from this equation and user URI matchers and such\n // have not found a great sip uri parser library as of now\n const sipUri = DIALER_REGEX.SIP_ADDRESS.exec(sipString);\n\n return sipUri;\n};\n\nMeetingInfoUtil.isPhoneNumber = (phoneNumber) => {\n const isValidNumber = DIALER_REGEX.PHONE_NUMBER.test(phoneNumber);\n\n return isValidNumber;\n};\n\nMeetingInfoUtil.getHydraId = (destination) => {\n const {type, id, cluster} = deconstructHydraId(destination);\n\n if (id && UUID_REG.test(id)) {\n if (type === _ROOM_) {\n return {room: true, destination: id, cluster};\n }\n if (type === _PEOPLE_) {\n return {people: true, destination: id, cluster};\n }\n\n return {};\n }\n\n return {};\n};\n\nMeetingInfoUtil.getSipUriFromHydraPersonId = (destination, webex) =>\n webex.people\n .get(destination)\n .then((res) => {\n if (res.emails && res.emails.length) {\n return res.emails[0];\n }\n throw new ParameterError('Hydra Id Lookup was an invalid hydra person id.');\n })\n .catch((err) => {\n LoggerProxy.logger.error(\n `Meeting-info:util#MeetingInfoUtil.getSipUriFromHydraPersonId --> getSipUriFromHydraPersonId ${err} `\n );\n throw err;\n });\n\nMeetingInfoUtil.getDestinationType = async (from) => {\n const {type, webex} = from;\n let {destination} = from;\n\n if (type === _PERSONAL_ROOM_) {\n // this case checks if your type is personal room\n if (!destination) {\n // if we are not getting anything in desination we fetch org and user ids from webex instance\n destination = {\n userId: webex.internal.device.userId,\n orgId: webex.internal.device.orgId,\n };\n } else {\n const options = VALID_EMAIL_ADDRESS.test(destination)\n ? {email: destination}\n : {id: destination}; // we are assuming userId as default\n const res = await webex.people.list(options);\n\n let {orgId, id: userId} = res.items[0];\n\n userId = deconstructHydraId(userId).id;\n orgId = deconstructHydraId(orgId).id;\n destination = {userId, orgId};\n }\n }\n if (type) {\n return {\n destination,\n type,\n };\n }\n const options: any = {};\n const hydraId = MeetingInfoUtil.getHydraId(destination);\n\n if (MeetingInfoUtil.isMeetingLink(destination)) {\n LoggerProxy.logger.warn(\n 'Meeting-info:util#generateOptions --> WARN, use of Meeting Link is deprecated, please use a SIP URI instead'\n );\n\n options.type = _MEETING_LINK_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isSipUri(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isPhoneNumber(destination)) {\n options.type = _SIP_URI_;\n options.destination = destination;\n } else if (MeetingInfoUtil.isConversationUrl(destination, webex)) {\n options.type = _CONVERSATION_URL_;\n options.destination = destination;\n } else if (hydraId.people) {\n options.type = _SIP_URI_;\n\n return MeetingInfoUtil.getSipUriFromHydraPersonId(hydraId.destination, webex).then((res) => {\n options.destination = res;\n\n // Since hydra person ids require a unique case in which they are\n // entirely converted to a SIP URI, we need to set a flag for detecting\n // this type of destination.\n options.wasHydraPerson = true;\n\n return Promise.resolve(options);\n });\n } else if (hydraId.room) {\n options.type = _CONVERSATION_URL_;\n try {\n await webex.internal.services.waitForCatalog('postauth');\n\n const conversationUrl = webex.internal.conversation.getUrlFromClusterId({\n cluster: hydraId.cluster,\n id: hydraId.destination,\n });\n\n options.destination = conversationUrl;\n } catch (e) {\n LoggerProxy.logger.error(`Meeting-info:util#getDestinationType --> ${e}`);\n throw e;\n }\n } else {\n LoggerProxy.logger.warn(\n \"Meeting-info:util#getDestinationType --> ('MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.\"\n );\n throw new ParameterError(\n 'MeetingInfo is fetched with meeting link, sip uri, phone number, hydra room id, hydra people id, or a conversation url.'\n );\n }\n\n return Promise.resolve(options);\n};\n\n/**\n * Helper function to build up a correct locus url depending on the value passed\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {String} options.installedOrgID org ID of user's machine\n * @param {Object} options.destination ?? value.value\n * @returns {Object} returns an object with {resource, method}\n */\nMeetingInfoUtil.getRequestBody = (options: {type: string; destination: object} | any) => {\n const {type, destination, password, captchaInfo, installedOrgID, locusId, extraParams} = options;\n const body: any = {\n ...DEFAULT_MEETING_INFO_REQUEST_BODY,\n ...extraParams,\n };\n\n switch (type) {\n case _SIP_URI_:\n body.sipUrl = destination;\n break;\n case _PERSONAL_ROOM_:\n body.userId = destination.userId;\n body.orgId = destination.orgId;\n break;\n case _MEETING_ID_:\n body.meetingKey = destination;\n break;\n case _CONVERSATION_URL_:\n body.conversationUrl = destination;\n break;\n case _LOCUS_ID_:\n // use meetingID for the completer meeting info for the already started meeting\n if (destination.info?.webExMeetingId) {\n body.meetingKey = destination.info.webExMeetingId;\n } else if (destination.info?.sipUri) {\n body.sipUrl = destination.info.sipUri;\n }\n break;\n case _MEETING_LINK_:\n body.meetingUrl = destination;\n break;\n case _MEETING_UUID_: {\n body.meetingUUID = destination;\n break;\n }\n default:\n }\n\n if (password) {\n body.password = password;\n }\n\n if (captchaInfo) {\n body.captchaID = captchaInfo.id;\n body.captchaVerifyCode = captchaInfo.code;\n }\n\n if (installedOrgID) {\n body.installedOrgID = installedOrgID;\n }\n\n if (locusId) {\n body.locusId = locusId;\n }\n\n return body;\n};\n\n/**\n * Helper function to parse the webex site/host from a URI string.\n * @param {String} uri string (e.g. '10019857020@convergedats.webex.com')\n * @returns {String} the site/host part of the URI string (e.g. 'convergedats.webex.com')\n */\nMeetingInfoUtil.getWebexSite = (uri: string) => {\n const exceptedDomains = ['meet.webex.com', 'meetup.webex.com', 'ciscospark.com'];\n const site = uri?.match(/.+@([^.]+\\.[^.]+\\.[^.]+)$/)?.[1];\n\n return exceptedDomains.includes(site) ? null : site;\n};\n\n/**\n * Helper function to return the direct URI for fetching meeting info (to avoid a redirect).\n * @param {Object} options type and value to fetch meeting info\n * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]\n * @param {Object} options.destination ?? value.value\n * @returns {String} returns a URI string or null of there is no direct URI\n */\nMeetingInfoUtil.getDirectMeetingInfoURI = (options: {type: string; destination: any}) => {\n const {type, destination} = options;\n\n let preferredWebexSite = null;\n\n switch (type) {\n case _SIP_URI_:\n preferredWebexSite = MeetingInfoUtil.getWebexSite(destination);\n break;\n case _LOCUS_ID_:\n preferredWebexSite = destination.info?.webExSite;\n break;\n default:\n }\n\n return preferredWebexSite ? `https://${preferredWebexSite}/wbxappapi/v1/meetingInfo` : null;\n};\n\nexport default MeetingInfoUtil;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAEA;AAKA;AAqBA;AACA;AAAsD;AAAA;AAEtD,IAAMA,eAAoB,GAAG,CAAC,CAAC;AAE/BA,eAAe,CAACC,YAAY,GAAG,UAACC,IAAI,EAAK;EACvC,IAAI;IACF,IAAIC,SAAS,GAAGC,YAAG,CAACC,KAAK,CAACH,IAAI,CAAC;IAE/B,IAAI,CAACC,SAAS,EAAE;MACd,OAAO,KAAK;IACd;IACA;IACA,IAAI,CAACA,SAAS,CAACG,QAAQ,EAAE;MACvBH,SAAS,GAAGC,YAAG,CAACC,KAAK,WAAIE,yBAAc,SAAGL,IAAI,EAAG;IACnD;IAEA,OAAOC,SAAS;EAClB,CAAC,CAAC,OAAOK,KAAK,EAAE;IACdC,oBAAW,CAACC,MAAM,CAACC,IAAI,8EACiDH,KAAK,EAC5E;IAED,OAAO,IAAI;EACb;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACAR,eAAe,CAACY,aAAa,GAAG,UAACC,KAAa,EAAK;EACjD,IAAMV,SAAS,GAAGH,eAAe,CAACC,YAAY,CAACY,KAAK,CAAC;EACrD,IAAM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I,GAAiBuB,OAAO,CAA5BvB,IAAI;IAAEF,WAAW,GAAIyB,OAAO,CAAtBzB,WAAW;EAExB,IAAIkE,kBAAkB,GAAG,IAAI;EAE7B,QAAQhE,IAAI;IACV,KAAK8B,oBAAS;MACZkC,kBAAkB,GAAG7G,eAAe,CAACuG,YAAY,CAAC5D,WAAW,CAAC;MAC9D;IACF,KAAKmD,qBAAU;MACbe,kBAAkB,yBAAGlE,WAAW,CAACoD,IAAI,uDAAhB,mBAAkBe,SAAS;MAChD;IACF;EAAQ;EAGV,OAAOD,kBAAkB,qBAAcA,kBAAkB,iCAA8B,IAAI;AAC7F,CAAC;AAAC,eAEa7G,eAAe;AAAA"}
@@ -82,14 +82,21 @@ export default class MeetingInfoV2 {
82
82
  * @memberof MeetingInfo
83
83
  */
84
84
  fetchInfoOptions(destination: string, type?: string): any;
85
+ /**
86
+ * Raises a MeetingInfoV2PolicyError for policy error codes
87
+ * @param {any} err the error from the request
88
+ * @returns {void}
89
+ */
90
+ handlePolicyError: (err: any) => void;
85
91
  /**
86
92
  * Creates adhoc space meetings for a space by fetching the conversation infomation
87
93
  * @param {String} conversationUrl conversationUrl to start adhoc meeting on
94
+ * @param {String} installedOrgID org ID of user's machine
88
95
  * @returns {Promise} returns a meeting info object
89
96
  * @public
90
97
  * @memberof MeetingInfo
91
98
  */
92
- createAdhocSpaceMeeting(conversationUrl: string): Promise<any>;
99
+ createAdhocSpaceMeeting(conversationUrl: string, installedOrgID?: string): Promise<any>;
93
100
  /**
94
101
  * Fetches meeting info from the server
95
102
  * @param {String} destination one of many different types of destinations to look up info for
@@ -98,7 +105,7 @@ export default class MeetingInfoV2 {
98
105
  * @param {Object} captchaInfo
99
106
  * @param {String} captchaInfo.code
100
107
  * @param {String} captchaInfo.id
101
- * @param {String} installedOrgID
108
+ * @param {String} installedOrgID org ID of user's machine
102
109
  * @param {String} locusId
103
110
  * @param {Object} extraParams
104
111
  * @param {Object} options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/plugin-meetings",
3
- "version": "3.0.0-beta.113",
3
+ "version": "3.0.0-beta.114",
4
4
  "description": "",
5
5
  "license": "Cisco EULA (https://www.cisco.com/c/en/us/products/end-user-license-agreement.html)",
6
6
  "contributors": [
@@ -32,12 +32,12 @@
32
32
  "build": "yarn run -T tsc --declaration true --declarationDir ./dist/types"
33
33
  },
34
34
  "devDependencies": {
35
- "@webex/plugin-meetings": "3.0.0-beta.113",
36
- "@webex/test-helper-chai": "3.0.0-beta.113",
37
- "@webex/test-helper-mocha": "3.0.0-beta.113",
38
- "@webex/test-helper-mock-webex": "3.0.0-beta.113",
39
- "@webex/test-helper-retry": "3.0.0-beta.113",
40
- "@webex/test-helper-test-users": "3.0.0-beta.113",
35
+ "@webex/plugin-meetings": "3.0.0-beta.114",
36
+ "@webex/test-helper-chai": "3.0.0-beta.114",
37
+ "@webex/test-helper-mocha": "3.0.0-beta.114",
38
+ "@webex/test-helper-mock-webex": "3.0.0-beta.114",
39
+ "@webex/test-helper-retry": "3.0.0-beta.114",
40
+ "@webex/test-helper-test-users": "3.0.0-beta.114",
41
41
  "chai": "^4.3.4",
42
42
  "chai-as-promised": "^7.1.1",
43
43
  "jsdom-global": "3.0.2",
@@ -46,19 +46,19 @@
46
46
  "typescript": "^4.7.4"
47
47
  },
48
48
  "dependencies": {
49
- "@webex/common": "3.0.0-beta.113",
49
+ "@webex/common": "3.0.0-beta.114",
50
50
  "@webex/internal-media-core": "1.38.0",
51
- "@webex/internal-plugin-conversation": "3.0.0-beta.113",
52
- "@webex/internal-plugin-device": "3.0.0-beta.113",
53
- "@webex/internal-plugin-llm": "3.0.0-beta.113",
54
- "@webex/internal-plugin-mercury": "3.0.0-beta.113",
55
- "@webex/internal-plugin-metrics": "3.0.0-beta.113",
56
- "@webex/internal-plugin-support": "3.0.0-beta.113",
57
- "@webex/internal-plugin-user": "3.0.0-beta.113",
58
- "@webex/media-helpers": "3.0.0-beta.113",
59
- "@webex/plugin-people": "3.0.0-beta.113",
60
- "@webex/plugin-rooms": "3.0.0-beta.113",
61
- "@webex/webex-core": "3.0.0-beta.113",
51
+ "@webex/internal-plugin-conversation": "3.0.0-beta.114",
52
+ "@webex/internal-plugin-device": "3.0.0-beta.114",
53
+ "@webex/internal-plugin-llm": "3.0.0-beta.114",
54
+ "@webex/internal-plugin-mercury": "3.0.0-beta.114",
55
+ "@webex/internal-plugin-metrics": "3.0.0-beta.114",
56
+ "@webex/internal-plugin-support": "3.0.0-beta.114",
57
+ "@webex/internal-plugin-user": "3.0.0-beta.114",
58
+ "@webex/media-helpers": "3.0.0-beta.114",
59
+ "@webex/plugin-people": "3.0.0-beta.114",
60
+ "@webex/plugin-rooms": "3.0.0-beta.114",
61
+ "@webex/webex-core": "3.0.0-beta.114",
62
62
  "ampersand-collection": "^2.0.2",
63
63
  "bowser": "^2.11.0",
64
64
  "btoa": "^1.2.1",
@@ -156,14 +156,38 @@ export default class MeetingInfoV2 {
156
156
  });
157
157
  }
158
158
 
159
+ /**
160
+ * Raises a MeetingInfoV2PolicyError for policy error codes
161
+ * @param {any} err the error from the request
162
+ * @returns {void}
163
+ */
164
+ handlePolicyError = (err) => {
165
+ if (!err.body) {
166
+ return;
167
+ }
168
+
169
+ if (POLICY_ERROR_CODES.includes(err.body?.code)) {
170
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR, {
171
+ code: err.body?.code,
172
+ });
173
+
174
+ throw new MeetingInfoV2PolicyError(
175
+ err.body?.code,
176
+ err.body?.data?.meetingInfo,
177
+ err.body?.message
178
+ );
179
+ }
180
+ };
181
+
159
182
  /**
160
183
  * Creates adhoc space meetings for a space by fetching the conversation infomation
161
184
  * @param {String} conversationUrl conversationUrl to start adhoc meeting on
185
+ * @param {String} installedOrgID org ID of user's machine
162
186
  * @returns {Promise} returns a meeting info object
163
187
  * @public
164
188
  * @memberof MeetingInfo
165
189
  */
166
- async createAdhocSpaceMeeting(conversationUrl: string) {
190
+ async createAdhocSpaceMeeting(conversationUrl: string, installedOrgID?: string) {
167
191
  if (!this.webex.meetings.preferredWebexSite) {
168
192
  throw Error('No preferred webex site found');
169
193
  }
@@ -185,7 +209,14 @@ export default class MeetingInfoV2 {
185
209
  return this.webex.internal.conversation
186
210
  .get({url: conversationUrl}, {includeParticipants: true, disableTransform: true})
187
211
  .then((conversation) => {
188
- const body = {
212
+ const body: {
213
+ title: string;
214
+ spaceUrl: string;
215
+ keyUrl: string;
216
+ kroUrl: string;
217
+ invitees: any[];
218
+ installedOrgID?: string;
219
+ } = {
189
220
  title: conversation.displayName,
190
221
  spaceUrl: conversation.url,
191
222
  keyUrl: conversation.encryptionKeyUrl,
@@ -193,19 +224,28 @@ export default class MeetingInfoV2 {
193
224
  invitees: getInvitees(conversation.participants?.items),
194
225
  };
195
226
 
227
+ if (installedOrgID) {
228
+ body.installedOrgID = installedOrgID;
229
+ }
230
+
196
231
  const uri = this.webex.meetings.preferredWebexSite
197
232
  ? `https://${this.webex.meetings.preferredWebexSite}/wbxappapi/v2/meetings/spaceInstant`
198
233
  : '';
199
234
 
200
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
201
-
202
235
  return this.webex.request({
203
236
  method: HTTP_VERBS.POST,
204
237
  uri,
205
238
  body,
206
239
  });
207
240
  })
241
+ .then((requestResult) => {
242
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
243
+
244
+ return requestResult;
245
+ })
208
246
  .catch((err) => {
247
+ this.handlePolicyError(err);
248
+
209
249
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE, {
210
250
  reason: err.message,
211
251
  stack: err.stack,
@@ -222,7 +262,7 @@ export default class MeetingInfoV2 {
222
262
  * @param {Object} captchaInfo
223
263
  * @param {String} captchaInfo.code
224
264
  * @param {String} captchaInfo.id
225
- * @param {String} installedOrgID
265
+ * @param {String} installedOrgID org ID of user's machine
226
266
  * @param {String} locusId
227
267
  * @param {Object} extraParams
228
268
  * @param {Object} options
@@ -256,7 +296,7 @@ export default class MeetingInfoV2 {
256
296
  this.webex.config.meetings.experimental.enableAdhocMeetings &&
257
297
  this.webex.meetings.preferredWebexSite
258
298
  ) {
259
- return this.createAdhocSpaceMeeting(destinationType.destination);
299
+ return this.createAdhocSpaceMeeting(destinationType.destination, installedOrgID);
260
300
  }
261
301
 
262
302
  const body = await MeetingInfoUtil.getRequestBody({
@@ -318,17 +358,7 @@ export default class MeetingInfoV2 {
318
358
  }
319
359
 
320
360
  if (err?.statusCode === 403) {
321
- if (POLICY_ERROR_CODES.includes(err.body?.code)) {
322
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR, {
323
- code: err.body?.code,
324
- });
325
-
326
- throw new MeetingInfoV2PolicyError(
327
- err.body?.code,
328
- err.body?.data?.meetingInfo,
329
- err.body?.message
330
- );
331
- }
361
+ this.handlePolicyError(err);
332
362
 
333
363
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.VERIFY_PASSWORD_ERROR, {
334
364
  reason: err.message,
@@ -221,6 +221,7 @@ MeetingInfoUtil.getDestinationType = async (from) => {
221
221
  * Helper function to build up a correct locus url depending on the value passed
222
222
  * @param {Object} options type and value to fetch meeting info
223
223
  * @param {String} options.type One of [SIP_URI, PERSONAL_ROOM, MEETING_ID, CONVERSATION_URL, LOCUS_ID, MEETING_LINK]
224
+ * @param {String} options.installedOrgID org ID of user's machine
224
225
  * @param {Object} options.destination ?? value.value
225
226
  * @returns {Object} returns an object with {resource, method}
226
227
  */
@@ -304,6 +304,29 @@ describe('plugin-meetings', () => {
304
304
  meetingInfo.createAdhocSpaceMeeting.restore();
305
305
  });
306
306
 
307
+ it('create adhoc meeting when conversationUrl and installedOrgID passed with enableAdhocMeetings toggle', async () => {
308
+ sinon.stub(meetingInfo, 'createAdhocSpaceMeeting').returns(Promise.resolve());
309
+
310
+ const installedOrgID = '12345'
311
+
312
+ await meetingInfo.fetchMeetingInfo(
313
+ 'conversationUrl',
314
+ _CONVERSATION_URL_,
315
+ null,
316
+ null,
317
+ installedOrgID
318
+ );
319
+
320
+ assert.calledOnceWithExactly(
321
+ meetingInfo.createAdhocSpaceMeeting,
322
+ 'conversationUrl',
323
+ installedOrgID
324
+ );
325
+ assert.notCalled(webex.request);
326
+ meetingInfo.createAdhocSpaceMeeting.restore();
327
+ });
328
+
329
+
307
330
  it('should not call createAdhocSpaceMeeting if enableAdhocMeetings toggle is off', async () => {
308
331
  webex.config.meetings.experimental.enableAdhocMeetings = false;
309
332
  sinon.stub(meetingInfo, 'createAdhocSpaceMeeting').returns(Promise.resolve());
@@ -329,7 +352,7 @@ describe('plugin-meetings', () => {
329
352
  it('should throw an error MeetingInfoV2AdhocMeetingError if not able to start adhoc meeting for a conversation', async () => {
330
353
  webex.config.meetings.experimental.enableAdhocMeetings = true;
331
354
 
332
- webex.request = sinon.stub().rejects({statusCode: 403, body: {code: 400000}});
355
+ webex.request = sinon.stub().rejects({stack: 'a stack', message: 'a message', statusCode: 403, body: {code: 400000}});
333
356
  try {
334
357
  await meetingInfo.createAdhocSpaceMeeting('conversationUrl');
335
358
  } catch (err) {
@@ -339,6 +362,12 @@ describe('plugin-meetings', () => {
339
362
  'Failed starting the adhoc meeting, Please contact support team , code=400000'
340
363
  );
341
364
  assert.equal(err.wbxAppApiCode, 400000);
365
+ assert(Metrics.sendBehavioralMetric.calledOnce);
366
+ assert.calledWith(
367
+ Metrics.sendBehavioralMetric,
368
+ BEHAVIORAL_METRICS.ADHOC_MEETING_FAILURE,
369
+ {reason: 'a message', stack: 'a stack'}
370
+ );
342
371
  }
343
372
  });
344
373
 
@@ -563,8 +592,10 @@ describe('plugin-meetings', () => {
563
592
  });
564
593
 
565
594
  describe('createAdhocSpaceMeeting', () => {
566
- it('Make a request to /instantSpace when conversationUrl', async () => {
567
- const conversationUrl = 'https://conversationUrl/xxx';
595
+ const conversationUrl = 'https://conversationUrl/xxx';
596
+ const installedOrgID = '12345';
597
+
598
+ const setup = () => {
568
599
  const invitee = [];
569
600
 
570
601
  invitee.push({
@@ -577,7 +608,13 @@ describe('plugin-meetings', () => {
577
608
  ciUserUuid: conversation.participants.items[1].entryUUID,
578
609
  });
579
610
 
580
- await meetingInfo.createAdhocSpaceMeeting(conversationUrl);
611
+ return {invitee}
612
+ }
613
+
614
+ it('Make a request to /spaceInstant when conversationUrl', async () => {
615
+ const {invitee} = setup();
616
+
617
+ const result = await meetingInfo.createAdhocSpaceMeeting(conversationUrl);
581
618
 
582
619
  assert.calledWith(
583
620
  webex.internal.conversation.get,
@@ -598,7 +635,78 @@ describe('plugin-meetings', () => {
598
635
  });
599
636
  assert(Metrics.sendBehavioralMetric.calledOnce);
600
637
  assert.calledWith(Metrics.sendBehavioralMetric, BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
638
+ assert.deepEqual(result, {
639
+ body: {},
640
+ statusCode: 200
641
+ });
601
642
  });
643
+
644
+ it('Make a request to /spaceInstant when conversationUrl with installed org ID', async () => {
645
+ const {invitee} = setup();
646
+
647
+ await meetingInfo.createAdhocSpaceMeeting(conversationUrl, installedOrgID);
648
+
649
+ assert.calledWith(
650
+ webex.internal.conversation.get,
651
+ {url: conversationUrl},
652
+ {includeParticipants: true, disableTransform: true}
653
+ );
654
+
655
+ assert.calledWith(webex.request, {
656
+ method: 'POST',
657
+ uri: 'https://go.webex.com/wbxappapi/v2/meetings/spaceInstant',
658
+ body: {
659
+ title: conversation.displayName,
660
+ spaceUrl: conversation.url,
661
+ keyUrl: conversation.encryptionKeyUrl,
662
+ kroUrl: conversation.kmsResourceObjectUrl,
663
+ invitees: invitee,
664
+ installedOrgID,
665
+ },
666
+ });
667
+ assert(Metrics.sendBehavioralMetric.calledOnce);
668
+ assert.calledWith(Metrics.sendBehavioralMetric, BEHAVIORAL_METRICS.ADHOC_MEETING_SUCCESS);
669
+ });
670
+
671
+
672
+ forEach(
673
+ [
674
+ {errorCode: 403049},
675
+ {errorCode: 403104},
676
+ {errorCode: 403103},
677
+ {errorCode: 403048},
678
+ {errorCode: 403102},
679
+ {errorCode: 403101},
680
+ ],
681
+ ({errorCode}) => {
682
+ it(`should throw a MeetingInfoV2PolicyError for error code ${errorCode}`, async () => {
683
+ const message = 'a message';
684
+ const meetingInfoData = 'meeting info';
685
+
686
+ webex.request = sinon.stub().rejects({
687
+ statusCode: 403,
688
+ body: {message, code: errorCode, data: {meetingInfo: meetingInfoData}},
689
+ });
690
+ try {
691
+ await meetingInfo.createAdhocSpaceMeeting(conversationUrl, installedOrgID);
692
+ assert.fail('createAdhocSpaceMeeting should have thrown, but has not done that');
693
+ } catch (err) {
694
+ assert.instanceOf(err, MeetingInfoV2PolicyError);
695
+ assert.deepEqual(err.message, `${message}, code=${errorCode}`);
696
+ assert.equal(err.wbxAppApiCode, errorCode);
697
+ assert.deepEqual(err.meetingInfo, meetingInfoData);
698
+
699
+ assert(Metrics.sendBehavioralMetric.calledOnce);
700
+ assert.calledWith(
701
+ Metrics.sendBehavioralMetric,
702
+ BEHAVIORAL_METRICS.MEETING_INFO_POLICY_ERROR,
703
+ {code: errorCode}
704
+ );
705
+
706
+ }
707
+ });
708
+ }
709
+ );
602
710
  });
603
711
  });
604
712
  });