@webex/internal-plugin-conversation 3.0.0-beta.42 → 3.0.0-beta.421

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/constants.js CHANGED
@@ -4,18 +4,11 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
4
4
  _Object$defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.KEY_ROTATION_REQUIRED = exports.KEY_ALREADY_ROTATED = exports.ENCRYPTION_KEY_URL_MISMATCH = exports.DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER = void 0;
7
+ exports.KEY_ROTATION_REQUIRED = exports.KEY_ALREADY_ROTATED = exports.ENCRYPTION_KEY_URL_MISMATCH = void 0;
8
8
  var KEY_ROTATION_REQUIRED = 1400087;
9
9
  exports.KEY_ROTATION_REQUIRED = KEY_ROTATION_REQUIRED;
10
10
  var KEY_ALREADY_ROTATED = 1409004;
11
11
  exports.KEY_ALREADY_ROTATED = KEY_ALREADY_ROTATED;
12
12
  var ENCRYPTION_KEY_URL_MISMATCH = 1400049;
13
-
14
- // The default cluster when one is not provided (usually as 'US' from hydra)
15
13
  exports.ENCRYPTION_KEY_URL_MISMATCH = ENCRYPTION_KEY_URL_MISMATCH;
16
- var DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';
17
- // The default service name for convo (currently identityLookup due to some weird CSB issue)
18
- exports.DEFAULT_CLUSTER = DEFAULT_CLUSTER;
19
- var DEFAULT_CLUSTER_SERVICE = 'identityLookup';
20
- exports.DEFAULT_CLUSTER_SERVICE = DEFAULT_CLUSTER_SERVICE;
21
14
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KEY_ROTATION_REQUIRED","KEY_ALREADY_ROTATED","ENCRYPTION_KEY_URL_MISMATCH","DEFAULT_CLUSTER","DEFAULT_CLUSTER_SERVICE"],"sources":["constants.js"],"sourcesContent":["export const KEY_ROTATION_REQUIRED = 1400087;\nexport const KEY_ALREADY_ROTATED = 1409004;\nexport const ENCRYPTION_KEY_URL_MISMATCH = 1400049;\n\n// The default cluster when one is not provided (usually as 'US' from hydra)\nexport const DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';\n// The default service name for convo (currently identityLookup due to some weird CSB issue)\nexport const DEFAULT_CLUSTER_SERVICE = 'identityLookup';\n"],"mappings":";;;;;;;AAAO,IAAMA,qBAAqB,GAAG,OAAO;AAAC;AACtC,IAAMC,mBAAmB,GAAG,OAAO;AAAC;AACpC,IAAMC,2BAA2B,GAAG,OAAO;;AAElD;AAAA;AACO,IAAMC,eAAe,GAAG,sBAAsB;AACrD;AAAA;AACO,IAAMC,uBAAuB,GAAG,gBAAgB;AAAC"}
1
+ {"version":3,"names":["KEY_ROTATION_REQUIRED","KEY_ALREADY_ROTATED","ENCRYPTION_KEY_URL_MISMATCH"],"sources":["constants.js"],"sourcesContent":["export const KEY_ROTATION_REQUIRED = 1400087;\nexport const KEY_ALREADY_ROTATED = 1409004;\nexport const ENCRYPTION_KEY_URL_MISMATCH = 1400049;\n"],"mappings":";;;;;;;AAAO,IAAMA,qBAAqB,GAAG,OAAO;AAAC;AACtC,IAAMC,mBAAmB,GAAG,OAAO;AAAC;AACpC,IAAMC,2BAA2B,GAAG,OAAO;AAAC"}
@@ -57,8 +57,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
57
57
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
58
58
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
59
59
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
60
- var CLUSTER_SERVICE = process.env.WEBEX_CONVERSATION_CLUSTER_SERVICE || _constants.DEFAULT_CLUSTER_SERVICE;
61
- var DEFAULT_CLUSTER_IDENTIFIER = process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || "".concat(_constants.DEFAULT_CLUSTER, ":").concat(CLUSTER_SERVICE);
62
60
  var idToUrl = new _map2.default();
63
61
  var getConvoLimit = function getConvoLimit() {
64
62
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -84,20 +82,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
84
82
  _ref$cluster = _ref.cluster,
85
83
  cluster = _ref$cluster === void 0 ? 'us' : _ref$cluster,
86
84
  id = _ref.id;
87
- var clusterId = cluster === 'us' ? DEFAULT_CLUSTER_IDENTIFIER : cluster;
88
-
89
- // Determine if cluster has service name (non-US clusters from hydra do not)
90
- if (clusterId.split(':').length < 4) {
91
- // Add Service to cluster identifier
92
- clusterId = "".concat(cluster, ":").concat(CLUSTER_SERVICE);
93
- }
94
- var _ref2 = this.webex.internal.services.getServiceFromClusterId({
95
- clusterId: clusterId
96
- }) || {},
97
- url = _ref2.url;
98
- if (!url) {
99
- throw Error("Could not find service for cluster [".concat(cluster, "]"));
100
- }
85
+ var url = this.webex.internal.services.getServiceUrlFromClusterId({
86
+ cluster: cluster
87
+ }, this.webex);
101
88
  return id ? "".concat(url, "/conversations/").concat(id) : url;
102
89
  },
103
90
  /**
@@ -294,10 +281,11 @@ var Conversation = _webexCore.WebexPlugin.extend({
294
281
  /**
295
282
  * delete a reaction
296
283
  * @param {Object} conversation
297
- * @param {Object} reactionId
284
+ * @param {Object} reactionId,
285
+ * @param {String} recipientId,
298
286
  * @returns {Promise<Activity>}
299
287
  */
300
- deleteReaction: function deleteReaction(conversation, reactionId) {
288
+ deleteReaction: function deleteReaction(conversation, reactionId, recipientId) {
301
289
  var deleteReactionPayload = {
302
290
  actor: {
303
291
  objectType: 'person',
@@ -314,6 +302,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
314
302
  },
315
303
  verb: 'delete'
316
304
  };
305
+
306
+ // Is not required for the request to be accepted, but follows specification.
307
+ if (recipientId) {
308
+ deleteReactionPayload.recipients = {
309
+ items: [{
310
+ id: recipientId,
311
+ objectType: 'person'
312
+ }]
313
+ };
314
+ }
317
315
  return this.sendReaction(conversation, deleteReactionPayload);
318
316
  },
319
317
  /**
@@ -321,9 +319,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
321
319
  * @param {Object} conversation
322
320
  * @param {Object} displayName must be 'celebrate', 'heart', 'thumbsup', 'smiley', 'haha', 'confused', 'sad'
323
321
  * @param {Object} activity activity object from convo we are reacting to
322
+ * @param {String} recipientId,
324
323
  * @returns {Promise<Activity>}
325
324
  */
326
- addReaction: function addReaction(conversation, displayName, activity) {
325
+ addReaction: function addReaction(conversation, displayName, activity, recipientId) {
327
326
  var _this6 = this;
328
327
  return this.createReactionHmac(displayName, activity).then(function (hmac) {
329
328
  var addReactionPayload = {
@@ -347,6 +346,14 @@ var Conversation = _webexCore.WebexPlugin.extend({
347
346
  hmac: hmac
348
347
  }
349
348
  };
349
+ if (recipientId) {
350
+ addReactionPayload.recipients = {
351
+ items: [{
352
+ id: recipientId,
353
+ objectType: 'person'
354
+ }]
355
+ };
356
+ }
350
357
  return _this6.sendReaction(conversation, addReactionPayload);
351
358
  });
352
359
  },
@@ -404,9 +411,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
404
411
  var shunt = new _events.EventEmitter();
405
412
  var promise;
406
413
  if (isEncrypted) {
407
- promise = this.webex.internal.encryption.download(item.scr, item.options);
408
- } else if (item.scr && item.scr.loc) {
409
- promise = this._downloadUnencryptedFile(item.scr.loc, options);
414
+ promise = this.webex.internal.encryption.download(item.url, item.scr, item.options);
410
415
  } else {
411
416
  promise = this._downloadUnencryptedFile(item.url, options);
412
417
  }
@@ -585,8 +590,8 @@ var Conversation = _webexCore.WebexPlugin.extend({
585
590
  params.uri = uri;
586
591
  }
587
592
  return _this9.request(params);
588
- }).then((0, _common.tap)(function (_ref3) {
589
- var body = _ref3.body;
593
+ }).then((0, _common.tap)(function (_ref2) {
594
+ var body = _ref2.body;
590
595
  var id = body.id,
591
596
  url = body.url;
592
597
  _this9._recordUUIDs(body);
@@ -1081,6 +1086,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
1081
1086
  type: activity.activityType || activity.parent.type
1082
1087
  };
1083
1088
  }
1089
+ if (activity.recipients) {
1090
+ act.recipients = activity.recipients;
1091
+ }
1084
1092
  if ((0, _isString2.default)(act.actor)) {
1085
1093
  act.actor = {
1086
1094
  objectType: 'person',
@@ -1225,12 +1233,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
1225
1233
  * @param {Object} conversations If this is a team, the list of conversations in the team
1226
1234
  * @returns {String} url for the specific convo
1227
1235
  */
1228
- getConvoUrl: function getConvoUrl(_ref4) {
1229
- var id = _ref4.id,
1230
- url = _ref4.url,
1231
- cluster = _ref4.cluster,
1232
- conversations = _ref4.conversations,
1233
- generalConversationUuid = _ref4.generalConversationUuid;
1236
+ getConvoUrl: function getConvoUrl(_ref3) {
1237
+ var id = _ref3.id,
1238
+ url = _ref3.url,
1239
+ cluster = _ref3.cluster,
1240
+ conversations = _ref3.conversations,
1241
+ generalConversationUuid = _ref3.generalConversationUuid;
1234
1242
  if (generalConversationUuid) {
1235
1243
  // This is a Team
1236
1244
  // Because Convo doesn't have an endpoint for the team URL
@@ -1703,7 +1711,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1703
1711
  * @returns {IGeneratorResponse}
1704
1712
  */
1705
1713
  var jumpToActivity = /*#__PURE__*/function () {
1706
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(searchObject) {
1714
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(searchObject) {
1707
1715
  var newUrl, searchOptions, _yield$threadOrderer$, searchResults;
1708
1716
  return _regenerator.default.wrap(function _callee7$(_context7) {
1709
1717
  while (1) switch (_context7.prev = _context7.next) {
@@ -1743,7 +1751,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1743
1751
  }, _callee7);
1744
1752
  }));
1745
1753
  return function jumpToActivity(_x) {
1746
- return _ref5.apply(this, arguments);
1754
+ return _ref4.apply(this, arguments);
1747
1755
  };
1748
1756
  }();
1749
1757
 
@@ -1752,7 +1760,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1752
1760
  * @returns {IGeneratorResponse}
1753
1761
  */
1754
1762
  var getOlder = /*#__PURE__*/function () {
1755
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1763
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
1756
1764
  var _yield$threadOrderer$2, _yield$threadOrderer$3, value, oldestInBatch, moreActivitiesExist;
1757
1765
  return _regenerator.default.wrap(function _callee8$(_context8) {
1758
1766
  while (1) switch (_context8.prev = _context8.next) {
@@ -1776,7 +1784,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1776
1784
  }, _callee8);
1777
1785
  }));
1778
1786
  return function getOlder() {
1779
- return _ref6.apply(this, arguments);
1787
+ return _ref5.apply(this, arguments);
1780
1788
  };
1781
1789
  }();
1782
1790
 
@@ -1785,7 +1793,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1785
1793
  * @returns {IGeneratorResponse}
1786
1794
  */
1787
1795
  var getNewer = /*#__PURE__*/function () {
1788
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1796
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
1789
1797
  var newerOptions, _yield$threadOrderer$4, value;
1790
1798
  return _regenerator.default.wrap(function _callee9$(_context9) {
1791
1799
  while (1) switch (_context9.prev = _context9.next) {
@@ -1809,7 +1817,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1809
1817
  }, _callee9);
1810
1818
  }));
1811
1819
  return function getNewer() {
1812
- return _ref7.apply(this, arguments);
1820
+ return _ref6.apply(this, arguments);
1813
1821
  };
1814
1822
  }();
1815
1823
  return {
@@ -2496,7 +2504,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2496
2504
  });
2497
2505
  }));
2498
2506
  },
2499
- version: "3.0.0-beta.42"
2507
+ version: "3.0.0-beta.421"
2500
2508
  });
2501
2509
  ['favorite', 'hide', 'lock', 'mute', 'unfavorite', 'unhide', 'unlock', 'unmute'].forEach(function (verb) {
2502
2510
  Conversation.prototype[verb] = function submitSimpleActivity(conversation, activity) {
@@ -2519,10 +2527,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
2519
2527
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
2520
2528
  url: this.getConvoUrl(conversation)
2521
2529
  });
2522
- return _promise.default.all([convoWithUrl, moderator ? this.webex.internal.user.asUUID(moderator) : this.webex.internal.device.userId]).then(function (_ref8) {
2523
- var _ref9 = (0, _slicedToArray2.default)(_ref8, 2),
2524
- c = _ref9[0],
2525
- userId = _ref9[1];
2530
+ return _promise.default.all([convoWithUrl, moderator ? this.webex.internal.user.asUUID(moderator) : this.webex.internal.device.userId]).then(function (_ref7) {
2531
+ var _ref8 = (0, _slicedToArray2.default)(_ref7, 2),
2532
+ c = _ref8[0],
2533
+ userId = _ref8[1];
2526
2534
  return _this35.prepare(activity, {
2527
2535
  verb: verb,
2528
2536
  target: _this35.prepareConversation(c),