@webex/internal-plugin-conversation 3.6.0 → 3.7.0-next.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.
@@ -9,7 +9,7 @@ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/defi
9
9
  var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
10
10
  var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
11
11
  var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
12
- var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
12
+ var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
13
13
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
14
14
  _Object$defineProperty(exports, "__esModule", {
15
15
  value: true
@@ -17,6 +17,7 @@ _Object$defineProperty(exports, "__esModule", {
17
17
  exports.default = void 0;
18
18
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
19
19
  var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
20
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
20
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
21
22
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
22
23
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
@@ -35,12 +36,14 @@ var _webexCore = require("@webex/webex-core");
35
36
  var _lodash = require("lodash");
36
37
  var _helperImage = require("@webex/helper-image");
37
38
  var _uuid = _interopRequireDefault(require("uuid"));
39
+ var _encryptionTransforms = require("./encryption-transforms");
40
+ var _decryptionTransforms = require("./decryption-transforms");
38
41
  var _convoError = require("./convo-error");
39
42
  var _shareActivity = _interopRequireDefault(require("./share-activity"));
40
43
  var _activityThreadOrdering = require("./activity-thread-ordering");
41
44
  var _activities = require("./activities");
42
45
  var _constants = require("./constants");
43
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
46
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
44
47
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
45
48
  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; }
46
49
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -52,8 +55,9 @@ var getConvoLimit = function getConvoLimit() {
52
55
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
56
  var limit;
54
57
  if (options.conversationsLimit) {
58
+ var value = Math.max(options.conversationsLimit, 0);
55
59
  limit = {
56
- value: options.conversationsLimit,
60
+ value: value,
57
61
  name: 'conversationsLimit'
58
62
  };
59
63
  }
@@ -61,6 +65,15 @@ var getConvoLimit = function getConvoLimit() {
61
65
  };
62
66
  var Conversation = _webexCore.WebexPlugin.extend({
63
67
  namespace: 'Conversation',
68
+ initialize: function initialize() {
69
+ var _this2 = this;
70
+ this.listenToOnce(this.webex, 'ready', function () {
71
+ var _this2$webex$config$p;
72
+ if ((0, _isArray.default)((_this2$webex$config$p = _this2.webex.config.payloadTransformer) === null || _this2$webex$config$p === void 0 ? void 0 : _this2$webex$config$p.transforms)) {
73
+ _this2.webex.config.payloadTransformer.transforms = _this2.webex.config.payloadTransformer.transforms.concat(_this2.config.includeDecryptionTransforms ? _decryptionTransforms.transforms : []).concat(_this2.config.includeEncryptionTransforms ? _encryptionTransforms.transforms : []);
74
+ }
75
+ });
76
+ },
64
77
  /**
65
78
  * @param {String} cluster the cluster containing the id
66
79
  * @param {UUID} [id] the id of the conversation.
@@ -84,7 +97,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
84
97
  * @returns {Promise}
85
98
  */
86
99
  acknowledge: function acknowledge(conversation, object, activity) {
87
- var _this2 = this;
100
+ var _this3 = this;
88
101
  var url = this.getConvoUrl(conversation);
89
102
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
90
103
  url: url
@@ -101,7 +114,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
101
114
  url: object.url
102
115
  }
103
116
  }).then(function (a) {
104
- return _this2.submit(a);
117
+ return _this3.submit(a);
105
118
  });
106
119
  },
107
120
  /**
@@ -114,7 +127,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
114
127
  * @returns {Promise<Activity>}
115
128
  */
116
129
  add: function add(conversation, participant, activity) {
117
- var _this3 = this;
130
+ var _this4 = this;
118
131
  var url = this.getConvoUrl(conversation);
119
132
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
120
133
  url: url
@@ -122,9 +135,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
122
135
  return this.webex.internal.user.asUUID(participant, {
123
136
  create: true
124
137
  }).then(function (id) {
125
- return _this3.prepare(activity, {
138
+ return _this4.prepare(activity, {
126
139
  verb: 'add',
127
- target: _this3.prepareConversation(convoWithUrl),
140
+ target: _this4.prepareConversation(convoWithUrl),
128
141
  object: {
129
142
  id: id,
130
143
  objectType: 'person'
@@ -136,7 +149,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
136
149
  userIds: [id]
137
150
  }
138
151
  }).then(function (a) {
139
- return _this3.submit(a);
152
+ return _this4.submit(a);
140
153
  });
141
154
  });
142
155
  },
@@ -160,13 +173,13 @@ var Conversation = _webexCore.WebexPlugin.extend({
160
173
  * @returns {Promise<Conversation>}
161
174
  */
162
175
  create: function create(params) {
163
- var _this4 = this;
176
+ var _this5 = this;
164
177
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
165
178
  if (!params.participants || params.participants.length === 0) {
166
179
  return _promise.default.reject(new Error('`params.participants` is required'));
167
180
  }
168
181
  return _promise.default.all(params.participants.map(function (participant) {
169
- return _this4.webex.internal.user.asUUID(participant, {
182
+ return _this5.webex.internal.user.asUUID(participant, {
170
183
  create: true
171
184
  })
172
185
  // eslint-disable-next-line arrow-body-style
@@ -174,7 +187,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
174
187
  return options.allowPartialCreation ? undefined : _promise.default.reject(err);
175
188
  });
176
189
  })).then(function (participants) {
177
- participants.unshift(_this4.webex.internal.device.userId);
190
+ participants.unshift(_this5.webex.internal.device.userId);
178
191
  participants = (0, _lodash.uniq)(participants);
179
192
  var validParticipants = participants.filter(function (participant) {
180
193
  return participant;
@@ -187,17 +200,17 @@ var Conversation = _webexCore.WebexPlugin.extend({
187
200
  return _promise.default.reject(new _convoError.InvalidUserCreation());
188
201
  }
189
202
  if (options.skipOneOnOneFetch) {
190
- return _this4._createOneOnOne(params);
203
+ return _this5._createOneOnOne(params);
191
204
  }
192
- return _this4._maybeCreateOneOnOneThenPost(params, options);
205
+ return _this5._maybeCreateOneOnOneThenPost(params, options);
193
206
  }
194
- return _this4._createGrouped(params, options);
207
+ return _this5._createGrouped(params, options);
195
208
  }).then(function (c) {
196
209
  idToUrl.set(c.id, c.url);
197
210
  if (!params.files) {
198
211
  return c;
199
212
  }
200
- return _this4.webex.internal.conversation.share(c, params.files).then(function (a) {
213
+ return _this5.webex.internal.conversation.share(c, params.files).then(function (a) {
201
214
  c.activities.items.push(a);
202
215
  return c;
203
216
  });
@@ -253,7 +266,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
253
266
  * @returns {Promise<Activity>}
254
267
  */
255
268
  sendReaction: function sendReaction(conversation, reactionPayload) {
256
- var _this5 = this;
269
+ var _this6 = this;
257
270
  var url = this.getConvoUrl(conversation);
258
271
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
259
272
  url: url
@@ -265,7 +278,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
265
278
  target: this.prepareConversation(convoWithUrl),
266
279
  object: (0, _lodash.pick)(reactionPayload, 'id', 'url', 'objectType')
267
280
  }).then(function (act) {
268
- return _this5.submit(act);
281
+ return _this6.submit(act);
269
282
  });
270
283
  },
271
284
  /**
@@ -313,12 +326,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
313
326
  * @returns {Promise<Activity>}
314
327
  */
315
328
  addReaction: function addReaction(conversation, displayName, activity, recipientId) {
316
- var _this6 = this;
329
+ var _this7 = this;
317
330
  return this.createReactionHmac(displayName, activity).then(function (hmac) {
318
331
  var addReactionPayload = {
319
332
  actor: {
320
333
  objectType: 'person',
321
- id: _this6.webex.internal.device.userId
334
+ id: _this7.webex.internal.device.userId
322
335
  },
323
336
  target: {
324
337
  id: conversation.id,
@@ -344,7 +357,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
344
357
  }]
345
358
  };
346
359
  }
347
- return _this6.sendReaction(conversation, addReactionPayload);
360
+ return _this7.sendReaction(conversation, addReactionPayload);
348
361
  });
349
362
  },
350
363
  /**
@@ -355,7 +368,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
355
368
  * @returns {Promise}
356
369
  */
357
370
  delete: function _delete(conversation, object, activity) {
358
- var _this7 = this;
371
+ var _this8 = this;
359
372
  var url = this.getConvoUrl(conversation);
360
373
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
361
374
  url: url
@@ -381,7 +394,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
381
394
  };
382
395
  }
383
396
  return this.prepare(activity, request).then(function (a) {
384
- return _this7.submit(a);
397
+ return _this8.submit(a);
385
398
  });
386
399
  },
387
400
  /**
@@ -395,7 +408,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
395
408
  * @returns {Promise<File>}
396
409
  */
397
410
  download: function download(item) {
398
- var _this8 = this;
411
+ var _this9 = this;
399
412
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
400
413
  var isEncrypted = Boolean(item.scr && item.scr.key);
401
414
  var shunt = new _events.EventEmitter();
@@ -416,7 +429,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
416
429
  }
417
430
  return (0, _helperImage.readExifData)(item, res);
418
431
  }).then(function (file) {
419
- _this8.logger.info('conversation: file downloaded');
432
+ _this9.logger.info('conversation: file downloaded');
420
433
  if (item.displayName && !file.name) {
421
434
  file.name = item.displayName;
422
435
  }
@@ -543,7 +556,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
543
556
  * @returns {Promise<Conversation>}
544
557
  */
545
558
  get: function get(conversation) {
546
- var _this9 = this;
559
+ var _this10 = this;
547
560
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
548
561
  var user = conversation.user;
549
562
  var uri;
@@ -579,12 +592,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
579
592
  } else {
580
593
  params.uri = uri;
581
594
  }
582
- return _this9.request(params);
595
+ return _this10.request(params);
583
596
  }).then((0, _common.tap)(function (_ref2) {
584
597
  var body = _ref2.body;
585
598
  var id = body.id,
586
599
  url = body.url;
587
- _this9._recordUUIDs(body);
600
+ _this10._recordUUIDs(body);
588
601
  idToUrl.set(id, url);
589
602
  })).then(function (res) {
590
603
  return res.body;
@@ -602,18 +615,18 @@ var Conversation = _webexCore.WebexPlugin.extend({
602
615
  * @returns {Promise<Activity>}
603
616
  */
604
617
  leave: function leave(conversation, participant, activity) {
605
- var _this10 = this;
618
+ var _this11 = this;
606
619
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
607
620
  url: this.getConvoUrl(conversation)
608
621
  });
609
622
  return _promise.default.resolve().then(function () {
610
623
  if (!participant) {
611
- participant = _this10.webex.internal.device.userId;
624
+ participant = _this11.webex.internal.device.userId;
612
625
  }
613
- return _this10.webex.internal.user.asUUID(participant).then(function (id) {
614
- return _this10.prepare(activity, {
626
+ return _this11.webex.internal.user.asUUID(participant).then(function (id) {
627
+ return _this11.prepare(activity, {
615
628
  verb: 'leave',
616
- target: _this10.prepareConversation(convoWithUrl),
629
+ target: _this11.prepareConversation(convoWithUrl),
617
630
  object: {
618
631
  id: id,
619
632
  objectType: 'person'
@@ -627,7 +640,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
627
640
  });
628
641
  });
629
642
  }).then(function (a) {
630
- return _this10.submit(a);
643
+ return _this11.submit(a);
631
644
  });
632
645
  },
633
646
  /**
@@ -680,7 +693,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
680
693
  */
681
694
  paginate: function paginate() {
682
695
  var _arguments = arguments,
683
- _this11 = this;
696
+ _this12 = this;
684
697
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
685
698
  var options, queryOptions, reqOptions;
686
699
  return _regenerator.default.wrap(function _callee$(_context) {
@@ -697,11 +710,11 @@ var Conversation = _webexCore.WebexPlugin.extend({
697
710
  }
698
711
  throw new Error('No link to follow for the provided page');
699
712
  case 4:
700
- return _context.abrupt("return", _this11.request({
713
+ return _context.abrupt("return", _this12.request({
701
714
  url: options.page.links.next
702
715
  }).then(function (res) {
703
716
  return {
704
- page: new _webexCore.Page(res, _this11.webex)
717
+ page: new _webexCore.Page(res, _this12.webex)
705
718
  };
706
719
  }));
707
720
  case 5:
@@ -725,9 +738,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
725
738
  reqOptions.service = 'conversation';
726
739
  reqOptions.resource = 'conversations';
727
740
  }
728
- return _context.abrupt("return", _this11.request(reqOptions).then(function (res) {
741
+ return _context.abrupt("return", _this12.request(reqOptions).then(function (res) {
729
742
  var response = {
730
- page: new _webexCore.Page(res, _this11.webex)
743
+ page: new _webexCore.Page(res, _this12.webex)
731
744
  };
732
745
  if (res.body && res.body.additionalUrls) {
733
746
  response.additionalUrls = res.body.additionalUrls;
@@ -798,7 +811,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
798
811
  * @returns {Promise<Array<String>>}
799
812
  */
800
813
  listParentActivityIds: function listParentActivityIds(conversationUrl, query) {
801
- var _this12 = this;
814
+ var _this13 = this;
802
815
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
803
816
  var params, response;
804
817
  return _regenerator.default.wrap(function _callee2$(_context2) {
@@ -810,7 +823,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
810
823
  qs: query
811
824
  };
812
825
  _context2.next = 3;
813
- return _this12.request(params);
826
+ return _this13.request(params);
814
827
  case 3:
815
828
  response = _context2.sent;
816
829
  return _context2.abrupt("return", response.body);
@@ -831,7 +844,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
831
844
  */
832
845
  listAllChildActivitiesByParentId: function listAllChildActivitiesByParentId() {
833
846
  var _arguments2 = arguments,
834
- _this13 = this;
847
+ _this14 = this;
835
848
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
836
849
  var options, conversationUrl, activityParentId, query, activityType, initialResponse, page, items, _iterator3, _step3, activity;
837
850
  return _regenerator.default.wrap(function _callee3$(_context3) {
@@ -841,10 +854,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
841
854
  conversationUrl = options.conversationUrl, activityParentId = options.activityParentId, query = options.query;
842
855
  activityType = query.activityType;
843
856
  _context3.next = 5;
844
- return _this13.listChildActivitiesByParentId(conversationUrl, activityParentId, activityType, query);
857
+ return _this14.listChildActivitiesByParentId(conversationUrl, activityParentId, activityType, query);
845
858
  case 5:
846
859
  initialResponse = _context3.sent;
847
- page = new _webexCore.Page(initialResponse, _this13.webex);
860
+ page = new _webexCore.Page(initialResponse, _this14.webex);
848
861
  items = (0, _toConsumableArray2.default)(page.items);
849
862
  case 8:
850
863
  if (!page.hasNext()) {
@@ -892,7 +905,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
892
905
  */
893
906
  listChildActivitiesByParentId: function listChildActivitiesByParentId(conversationUrl, activityParentId, activityType) {
894
907
  var _arguments3 = arguments,
895
- _this14 = this;
908
+ _this15 = this;
896
909
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
897
910
  var query, finalQuery, params;
898
911
  return _regenerator.default.wrap(function _callee4$(_context4) {
@@ -907,7 +920,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
907
920
  url: "".concat(conversationUrl, "/parents/").concat(activityParentId),
908
921
  qs: finalQuery
909
922
  };
910
- return _context4.abrupt("return", _this14.request(params));
923
+ return _context4.abrupt("return", _this15.request(params));
911
924
  case 4:
912
925
  case "end":
913
926
  return _context4.stop();
@@ -923,21 +936,21 @@ var Conversation = _webexCore.WebexPlugin.extend({
923
936
  * @returns {Promise<Array>}
924
937
  */
925
938
  getReactionSummaryByParentId: function getReactionSummaryByParentId(conversationUrl, activityParentId, query) {
926
- var _this15 = this;
939
+ var _this16 = this;
927
940
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
928
- var _yield$_this15$reques, body, reactionObjects;
941
+ var _yield$_this16$reques, body, reactionObjects;
929
942
  return _regenerator.default.wrap(function _callee5$(_context5) {
930
943
  while (1) switch (_context5.prev = _context5.next) {
931
944
  case 0:
932
945
  _context5.next = 2;
933
- return _this15.request({
946
+ return _this16.request({
934
947
  method: 'GET',
935
948
  url: "".concat(conversationUrl, "/activities/").concat(activityParentId),
936
949
  qs: query
937
950
  });
938
951
  case 2:
939
- _yield$_this15$reques = _context5.sent;
940
- body = _yield$_this15$reques.body;
952
+ _yield$_this16$reques = _context5.sent;
953
+ body = _yield$_this16$reques.body;
941
954
  reactionObjects = body.children ? body.children.filter(function (child) {
942
955
  return child.type === 'reactionSelfSummary' || child.type === 'reactionSummary';
943
956
  }) : [];
@@ -1002,7 +1015,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1002
1015
  * @returns {Promise}
1003
1016
  */
1004
1017
  cardAction: function cardAction(conversation, inputs, parentActivity) {
1005
- var _this16 = this;
1018
+ var _this17 = this;
1006
1019
  var activity = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1007
1020
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
1008
1021
  url: this.getConvoUrl(conversation)
@@ -1018,7 +1031,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1018
1031
  objectType: 'submit'
1019
1032
  }, inputs)
1020
1033
  }).then(function (a) {
1021
- return _this16.submit(a);
1034
+ return _this17.submit(a);
1022
1035
  });
1023
1036
  },
1024
1037
  /**
@@ -1032,7 +1045,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1032
1045
  * @returns {Promise<Activity>}
1033
1046
  */
1034
1047
  post: function post(conversation, message, activity) {
1035
- var _this17 = this;
1048
+ var _this18 = this;
1036
1049
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
1037
1050
  url: this.getConvoUrl(conversation)
1038
1051
  });
@@ -1048,7 +1061,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1048
1061
  objectType: 'comment'
1049
1062
  }, message)
1050
1063
  }).then(function (a) {
1051
- return _this17.submit(a);
1064
+ return _this18.submit(a);
1052
1065
  });
1053
1066
  },
1054
1067
  prepareConversation: function prepareConversation(conversation) {
@@ -1057,7 +1070,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1057
1070
  });
1058
1071
  },
1059
1072
  prepare: function prepare(activity, params) {
1060
- var _this18 = this;
1073
+ var _this19 = this;
1061
1074
  params = params || {};
1062
1075
  activity = activity || {};
1063
1076
  return _promise.default.resolve(activity.prepare ? activity.prepare(params) : activity).then(function (act) {
@@ -1066,7 +1079,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1066
1079
  kmsMessage: params.kmsMessage,
1067
1080
  objectType: 'activity',
1068
1081
  clientTempId: _uuid.default.v4(),
1069
- actor: _this18.webex.internal.device.userId
1082
+ actor: _this19.webex.internal.device.userId
1070
1083
  });
1071
1084
 
1072
1085
  // Workaround because parent is a reserved props in Ampersand
@@ -1120,12 +1133,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
1120
1133
  * @returns {Promise<Array<Activity>>}
1121
1134
  */
1122
1135
  listThreads: function listThreads(options) {
1123
- var _this19 = this;
1136
+ var _this20 = this;
1124
1137
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1125
1138
  return _regenerator.default.wrap(function _callee6$(_context6) {
1126
1139
  while (1) switch (_context6.prev = _context6.next) {
1127
1140
  case 0:
1128
- return _context6.abrupt("return", _this19._list({
1141
+ return _context6.abrupt("return", _this20._list({
1129
1142
  service: 'conversation',
1130
1143
  resource: 'threads',
1131
1144
  qs: (0, _lodash.omit)(options, 'showAllTypes')
@@ -1189,7 +1202,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1189
1202
  * @returns {Promise<Activity>}
1190
1203
  */
1191
1204
  assign: function assign(conversation, avatar) {
1192
- var _this20 = this;
1205
+ var _this21 = this;
1193
1206
  var uploadOptions = {
1194
1207
  role: 'spaceAvatar'
1195
1208
  };
@@ -1200,17 +1213,17 @@ var Conversation = _webexCore.WebexPlugin.extend({
1200
1213
  url: this.getConvoUrl(conversation)
1201
1214
  });
1202
1215
  return _promise.default.resolve().then(function () {
1203
- var activity = _shareActivity.default.create(conversation, null, _this20.webex);
1216
+ var activity = _shareActivity.default.create(conversation, null, _this21.webex);
1204
1217
  activity.enableThumbnails = false;
1205
1218
  activity.add(avatar, uploadOptions);
1206
- return _this20.prepare(activity, {
1207
- target: _this20.prepareConversation(convoWithUrl)
1219
+ return _this21.prepare(activity, {
1220
+ target: _this21.prepareConversation(convoWithUrl)
1208
1221
  });
1209
1222
  }).then(function (a) {
1210
1223
  // yes, this seems a little hacky; will likely be resolved as a result
1211
1224
  // of #213
1212
1225
  a.verb = 'assign';
1213
- return _this20.submit(a);
1226
+ return _this21.submit(a);
1214
1227
  });
1215
1228
  },
1216
1229
  /**
@@ -1298,7 +1311,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1298
1311
  * @returns {Promise<Activity>}
1299
1312
  */
1300
1313
  share: function share(conversation, activity) {
1301
- var _this21 = this;
1314
+ var _this22 = this;
1302
1315
  if ((0, _lodash.isArray)(activity)) {
1303
1316
  activity = {
1304
1317
  object: {
@@ -1315,7 +1328,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1315
1328
  return this.prepare(activity, {
1316
1329
  target: this.prepareConversation(convoWithUrl)
1317
1330
  }).then(function (a) {
1318
- return _this21.submit(a);
1331
+ return _this22.submit(a);
1319
1332
  });
1320
1333
  },
1321
1334
  /**
@@ -1325,7 +1338,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1325
1338
  * @returns {Promise<Activity>}
1326
1339
  */
1327
1340
  submit: function submit(activity, endpoint) {
1328
- var _this22 = this;
1341
+ var _this23 = this;
1329
1342
  var url = endpoint || this.getConvoUrl(activity.target);
1330
1343
  var resource = activity.verb === 'share' ? 'content' : 'activities';
1331
1344
  var params = {
@@ -1367,16 +1380,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
1367
1380
  // handle when key need to rotate
1368
1381
  if (error.body && error.body.errorCode === _constants.KEY_ROTATION_REQUIRED) {
1369
1382
  cloneActivity.body.target.defaultActivityEncryptionKeyUrl = null;
1370
- _this22.request(cloneActivity);
1383
+ _this23.request(cloneActivity);
1371
1384
  } else if (error.body && (error.body.errorCode === _constants.KEY_ALREADY_ROTATED || error.body.errorCode === _constants.ENCRYPTION_KEY_URL_MISMATCH)) {
1372
1385
  // handle when key need to update
1373
- _this22.webex.request({
1386
+ _this23.webex.request({
1374
1387
  method: 'GET',
1375
1388
  api: 'conversation',
1376
1389
  resource: "conversations/".concat(params.body.target.id)
1377
1390
  }).then(function (res) {
1378
1391
  cloneActivity.body.target.defaultActivityEncryptionKeyUrl = res.body.defaultActivityEncryptionkeyUrl;
1379
- _this22.request(cloneActivity);
1392
+ _this23.request(cloneActivity);
1380
1393
  });
1381
1394
  } else {
1382
1395
  throw error;
@@ -1390,7 +1403,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1390
1403
  * @returns {Promise}
1391
1404
  */
1392
1405
  unassign: function unassign(conversation, activity) {
1393
- var _this23 = this;
1406
+ var _this24 = this;
1394
1407
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
1395
1408
  url: this.getConvoUrl(conversation)
1396
1409
  });
@@ -1404,7 +1417,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1404
1417
  }
1405
1418
  }
1406
1419
  }).then(function (a) {
1407
- return _this23.submit(a);
1420
+ return _this24.submit(a);
1408
1421
  });
1409
1422
  },
1410
1423
  /**
@@ -1448,7 +1461,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1448
1461
  * @returns {Promise}
1449
1462
  */
1450
1463
  update: function update(conversation, object, activity) {
1451
- var _this24 = this;
1464
+ var _this25 = this;
1452
1465
  if (!(0, _lodash.isObject)(object)) {
1453
1466
  return _promise.default.reject(new Error('`object` must be an object'));
1454
1467
  }
@@ -1460,7 +1473,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1460
1473
  target: this.prepareConversation(convoWithUrl),
1461
1474
  object: object
1462
1475
  }).then(function (a) {
1463
- return _this24.submit(a);
1476
+ return _this25.submit(a);
1464
1477
  });
1465
1478
  },
1466
1479
  /**
@@ -1473,7 +1486,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1473
1486
  * @returns {Promise<Activity>}
1474
1487
  */
1475
1488
  updateKey: function updateKey(conversation, key, activity) {
1476
- var _this25 = this;
1489
+ var _this26 = this;
1477
1490
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
1478
1491
  url: this.getConvoUrl(conversation)
1479
1492
  });
@@ -1481,7 +1494,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1481
1494
  activitiesLimit: 0,
1482
1495
  includeParticipants: true
1483
1496
  }).then(function (c) {
1484
- return _this25._updateKey(c, key, activity);
1497
+ return _this26._updateKey(c, key, activity);
1485
1498
  });
1486
1499
  },
1487
1500
  /**
@@ -1495,7 +1508,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1495
1508
  * @returns {Promise<Activity>}
1496
1509
  */
1497
1510
  _updateKey: function _updateKey(conversation, key, activity) {
1498
- var _this26 = this;
1511
+ var _this27 = this;
1499
1512
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
1500
1513
  url: this.getConvoUrl(conversation)
1501
1514
  });
@@ -1505,7 +1518,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1505
1518
  var k = (0, _lodash.isArray)(keys) ? keys[0] : keys;
1506
1519
  var params = {
1507
1520
  verb: 'updateKey',
1508
- target: _this26.prepareConversation(convoWithUrl),
1521
+ target: _this27.prepareConversation(convoWithUrl),
1509
1522
  object: {
1510
1523
  defaultActivityEncryptionKeyUrl: k.uri,
1511
1524
  objectType: 'conversation'
@@ -1529,8 +1542,8 @@ var Conversation = _webexCore.WebexPlugin.extend({
1529
1542
  keyUris: [k.uri]
1530
1543
  };
1531
1544
  }
1532
- return _this26.prepare(activity, params).then(function (a) {
1533
- return _this26.submit(a);
1545
+ return _this27.prepare(activity, params).then(function (a) {
1546
+ return _this27.submit(a);
1534
1547
  });
1535
1548
  });
1536
1549
  },
@@ -1580,7 +1593,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1580
1593
  * @returns {Promise<string>} - conversation url
1581
1594
  */
1582
1595
  getConversationUrl: function getConversationUrl() {
1583
- var _this27 = this;
1596
+ var _this28 = this;
1584
1597
  this.logger.info('conversation: getting the conversation service url');
1585
1598
  var convoUrl = this.webex.internal.services.get('conversation');
1586
1599
 
@@ -1593,9 +1606,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
1593
1606
  // Wait for the postauth catalog to update and then try to retrieve the
1594
1607
  // conversation service url again.
1595
1608
  return this.webex.internal.waitForCatalog('postauth').then(function () {
1596
- return _this27.webex.internal.services.get('conversation');
1609
+ return _this28.webex.internal.services.get('conversation');
1597
1610
  }).catch(function (error) {
1598
- _this27.logger.warn('conversation: unable to get conversation url', error.message);
1611
+ _this28.logger.warn('conversation: unable to get conversation url', error.message);
1599
1612
  return _promise.default.reject(error);
1600
1613
  });
1601
1614
  },
@@ -1605,23 +1618,23 @@ var Conversation = _webexCore.WebexPlugin.extend({
1605
1618
  * @returns {Promise}
1606
1619
  */
1607
1620
  _inferConversationUrl: function _inferConversationUrl(conversation) {
1608
- var _this28 = this;
1621
+ var _this29 = this;
1609
1622
  if (conversation.id) {
1610
1623
  return this.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {
1611
1624
  if (haMessagingEnabled) {
1612
1625
  // recompute conversation URL each time as the host may have changed
1613
1626
  // since last usage
1614
- return _this28.getConversationUrl().then(function (url) {
1627
+ return _this29.getConversationUrl().then(function (url) {
1615
1628
  conversation.url = "".concat(url, "/conversations/").concat(conversation.id);
1616
1629
  return conversation;
1617
1630
  });
1618
1631
  }
1619
1632
  if (!conversation.url) {
1620
- return _this28.getConversationUrl().then(function (url) {
1633
+ return _this29.getConversationUrl().then(function (url) {
1621
1634
  conversation.url = "".concat(url, "/conversations/").concat(conversation.id);
1622
1635
  /* istanbul ignore else */
1623
1636
  if (process.env.NODE_ENV !== 'production') {
1624
- _this28.logger.warn('conversation: inferred conversation url from conversation id; please pass whole conversation objects to Conversation methods');
1637
+ _this29.logger.warn('conversation: inferred conversation url from conversation id; please pass whole conversation objects to Conversation methods');
1625
1638
  }
1626
1639
  return conversation;
1627
1640
  });
@@ -1675,7 +1688,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1675
1688
  * jumpToActivity - gets searched-for activity and surrounding activities
1676
1689
  */
1677
1690
  listActivitiesThreadOrdered: function listActivitiesThreadOrdered(options) {
1678
- var _this29 = this;
1691
+ var _this30 = this;
1679
1692
  var conversationUrl = options.conversationUrl,
1680
1693
  conversationId = options.conversationId;
1681
1694
  if (!conversationUrl && !conversationId) {
@@ -1724,7 +1737,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
1724
1737
  queryType: _activities.MID,
1725
1738
  search: searchObject
1726
1739
  });
1727
- threadOrderer = _this29._listActivitiesThreadOrdered(searchOptions);
1740
+ threadOrderer = _this30._listActivitiesThreadOrdered(searchOptions);
1728
1741
  _context7.next = 9;
1729
1742
  return threadOrderer.next(searchOptions);
1730
1743
  case 9:
@@ -2293,7 +2306,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2293
2306
  * @returns {Promise<Array<Conversation>>}
2294
2307
  */
2295
2308
  _list: function _list(options) {
2296
- var _this30 = this;
2309
+ var _this31 = this;
2297
2310
  return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
2298
2311
  var res, list, limit, results, _iterator6, _step6, result, items;
2299
2312
  return _regenerator.default.wrap(function _callee11$(_context13) {
@@ -2306,7 +2319,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2306
2319
  participantsLimit: 0
2307
2320
  }, options.qs);
2308
2321
  _context13.next = 3;
2309
- return _this30.request(options);
2322
+ return _this31.request(options);
2310
2323
  case 3:
2311
2324
  res = _context13.sent;
2312
2325
  if (!res.body || !res.body.items || res.body.items.length === 0) {
@@ -2350,7 +2363,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2350
2363
  if (options.limit) {
2351
2364
  newOptions.qs[newOptions.limit.name] = limit;
2352
2365
  }
2353
- return _this30.request(newOptions);
2366
+ return _this31.request(newOptions);
2354
2367
  }));
2355
2368
  case 11:
2356
2369
  results = _context13.sent;
@@ -2374,7 +2387,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2374
2387
  case 14:
2375
2388
  _context13.next = 16;
2376
2389
  return _promise.default.all(list.map(function (item) {
2377
- return _this30._recordUUIDs(item);
2390
+ return _this31._recordUUIDs(item);
2378
2391
  }));
2379
2392
  case 16:
2380
2393
  return _context13.abrupt("return", list);
@@ -2392,7 +2405,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2392
2405
  * @returns {Promise<Conversation>}
2393
2406
  */
2394
2407
  _maybeCreateOneOnOneThenPost: function _maybeCreateOneOnOneThenPost(params, options) {
2395
- var _this31 = this;
2408
+ var _this32 = this;
2396
2409
  return this.get((0, _lodash.defaults)({
2397
2410
  // the use of uniq in Conversation#create guarantees participant[1] will
2398
2411
  // always be the other user
@@ -2402,7 +2415,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2402
2415
  includeParticipants: true
2403
2416
  })).then(function (conversation) {
2404
2417
  if (params.comment || params.html) {
2405
- return _this31.post(conversation, {
2418
+ return _this32.post(conversation, {
2406
2419
  content: params.html,
2407
2420
  displayName: params.comment
2408
2421
  }).then(function (activity) {
@@ -2415,7 +2428,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2415
2428
  if (reason.statusCode !== 404) {
2416
2429
  return _promise.default.reject(reason);
2417
2430
  }
2418
- return _this31._createOneOnOne(params);
2431
+ return _this32._createOneOnOne(params);
2419
2432
  });
2420
2433
  },
2421
2434
  /**
@@ -2424,7 +2437,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2424
2437
  * @returns {Object}
2425
2438
  */
2426
2439
  _prepareConversationForCreation: function _prepareConversationForCreation(params) {
2427
- var _this32 = this;
2440
+ var _this33 = this;
2428
2441
  var payload = {
2429
2442
  activities: {
2430
2443
  items: [this.expand('create')]
@@ -2444,7 +2457,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2444
2457
  payload.tags = params.tags;
2445
2458
  }
2446
2459
  params.participants.forEach(function (participant) {
2447
- payload.activities.items.push(_this32.expand('add', {
2460
+ payload.activities.items.push(_this33.expand('add', {
2448
2461
  objectType: 'person',
2449
2462
  id: participant
2450
2463
  }));
@@ -2476,7 +2489,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2476
2489
  * @returns {Promise}
2477
2490
  */
2478
2491
  _recordUUIDs: function _recordUUIDs(conversation) {
2479
- var _this33 = this;
2492
+ var _this34 = this;
2480
2493
  if (!conversation.participants || !conversation.participants.items) {
2481
2494
  return _promise.default.resolve(conversation);
2482
2495
  }
@@ -2486,16 +2499,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
2486
2499
  if (participant.type === 'ROOM' || participant.type === 'LYRA_SPACE') {
2487
2500
  return _promise.default.resolve();
2488
2501
  }
2489
- return _this33.webex.internal.user.recordUUID(participant).catch(function (err) {
2490
- return _this33.logger.warn('Could not record uuid', err);
2502
+ return _this34.webex.internal.user.recordUUID(participant).catch(function (err) {
2503
+ return _this34.logger.warn('Could not record uuid', err);
2491
2504
  });
2492
2505
  }));
2493
2506
  },
2494
- version: "3.6.0"
2507
+ version: "3.7.0-next.1"
2495
2508
  });
2496
2509
  ['favorite', 'hide', 'lock', 'mute', 'unfavorite', 'unhide', 'unlock', 'unmute'].forEach(function (verb) {
2497
2510
  Conversation.prototype[verb] = function submitSimpleActivity(conversation, activity) {
2498
- var _this34 = this;
2511
+ var _this35 = this;
2499
2512
  var convoWithUrl = this.prepareConversation(_objectSpread(_objectSpread({}, conversation), {}, {
2500
2513
  url: this.getConvoUrl(conversation)
2501
2514
  }));
@@ -2504,13 +2517,13 @@ var Conversation = _webexCore.WebexPlugin.extend({
2504
2517
  object: convoWithUrl,
2505
2518
  target: convoWithUrl
2506
2519
  }).then(function (a) {
2507
- return _this34.submit(a);
2520
+ return _this35.submit(a);
2508
2521
  });
2509
2522
  };
2510
2523
  });
2511
2524
  ['assignModerator', 'unassignModerator'].forEach(function (verb) {
2512
2525
  Conversation.prototype[verb] = function submitModerationChangeActivity(conversation, moderator, activity) {
2513
- var _this35 = this;
2526
+ var _this36 = this;
2514
2527
  var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
2515
2528
  url: this.getConvoUrl(conversation)
2516
2529
  });
@@ -2518,16 +2531,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
2518
2531
  var _ref8 = (0, _slicedToArray2.default)(_ref7, 2),
2519
2532
  c = _ref8[0],
2520
2533
  userId = _ref8[1];
2521
- return _this35.prepare(activity, {
2534
+ return _this36.prepare(activity, {
2522
2535
  verb: verb,
2523
- target: _this35.prepareConversation(c),
2536
+ target: _this36.prepareConversation(c),
2524
2537
  object: {
2525
2538
  id: userId,
2526
2539
  objectType: 'person'
2527
2540
  }
2528
2541
  });
2529
2542
  }).then(function (a) {
2530
- return _this35.submit(a);
2543
+ return _this36.submit(a);
2531
2544
  });
2532
2545
  };
2533
2546
  });
@@ -2542,7 +2555,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2542
2555
  ['setSpaceProperty', 'unsetSpaceProperty'].forEach(function (fnName) {
2543
2556
  var verb = fnName.startsWith('set') ? 'set' : 'unset';
2544
2557
  Conversation.prototype[fnName] = function submitSpacePropertyActivity(conversation, tag, activity) {
2545
- var _this36 = this;
2558
+ var _this37 = this;
2546
2559
  if (!(0, _lodash.isString)(tag)) {
2547
2560
  return _promise.default.reject(new Error('`tag` must be a string'));
2548
2561
  }
@@ -2557,13 +2570,13 @@ var Conversation = _webexCore.WebexPlugin.extend({
2557
2570
  objectType: 'spaceProperty'
2558
2571
  }
2559
2572
  }).then(function (a) {
2560
- return _this36.submit(a);
2573
+ return _this37.submit(a);
2561
2574
  });
2562
2575
  };
2563
2576
  });
2564
2577
  ['tag', 'untag'].forEach(function (verb) {
2565
2578
  Conversation.prototype[verb] = function submitObjectActivity(conversation, object, activity) {
2566
- var _this37 = this;
2579
+ var _this38 = this;
2567
2580
  if (!(0, _lodash.isObject)(object)) {
2568
2581
  return _promise.default.reject(new Error('`object` must be an object'));
2569
2582
  }
@@ -2575,7 +2588,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
2575
2588
  target: c,
2576
2589
  object: (0, _assign.default)(c, object)
2577
2590
  }).then(function (a) {
2578
- return _this37.submit(a);
2591
+ return _this38.submit(a);
2579
2592
  });
2580
2593
  };
2581
2594
  });