@webex/internal-plugin-conversation 3.6.0-next.1 → 3.6.0-next.2

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