@webex/internal-plugin-conversation 3.6.0 → 3.7.0-ipv6-multi-turn-urls.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.
- package/dist/config.js +9 -1
- package/dist/config.js.map +1 -1
- package/dist/conversation.js +304 -271
- package/dist/conversation.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/share-activity.js +1 -1
- package/package.json +14 -14
- package/src/config.js +10 -0
- package/src/conversation.js +53 -35
- package/src/index.js +1 -5
- package/test/integration/spec/get.js +9 -0
- package/test/unit/spec/conversation.js +127 -61
package/dist/conversation.js
CHANGED
|
@@ -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$
|
|
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$
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
138
|
+
return _this4.prepare(activity, {
|
|
126
139
|
verb: 'add',
|
|
127
|
-
target:
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
203
|
+
return _this5._createOneOnOne(params);
|
|
191
204
|
}
|
|
192
|
-
return
|
|
205
|
+
return _this5._maybeCreateOneOnOneThenPost(params, options);
|
|
193
206
|
}
|
|
194
|
-
return
|
|
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
|
|
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
|
|
269
|
+
var _this6 = this;
|
|
257
270
|
var url = this.getConvoUrl(conversation);
|
|
258
271
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
259
272
|
url: url
|
|
@@ -265,21 +278,22 @@ 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
|
|
281
|
+
return _this6.submit(act);
|
|
269
282
|
});
|
|
270
283
|
},
|
|
271
284
|
/**
|
|
272
|
-
*
|
|
273
|
-
* @param {Object} conversation
|
|
274
|
-
* @param {Object} reactionId
|
|
275
|
-
* @param {
|
|
285
|
+
* create a reaction
|
|
286
|
+
* @param {Object} conversation the conversation in which the reaction will be added
|
|
287
|
+
* @param {Object} reactionId reaction activity to be deleted
|
|
288
|
+
* @param {Object} actorId id of person object who is reacting
|
|
289
|
+
* @param {String} recipientId used when reacting to direct IMC messages
|
|
276
290
|
* @returns {Promise<Activity>}
|
|
277
291
|
*/
|
|
278
|
-
deleteReaction: function deleteReaction(conversation, reactionId, recipientId) {
|
|
292
|
+
deleteReaction: function deleteReaction(conversation, reactionId, actorId, recipientId) {
|
|
279
293
|
var deleteReactionPayload = {
|
|
280
294
|
actor: {
|
|
281
295
|
objectType: 'person',
|
|
282
|
-
id: this.webex.internal.device.userId
|
|
296
|
+
id: actorId !== null && actorId !== void 0 ? actorId : this.webex.internal.device.userId
|
|
283
297
|
},
|
|
284
298
|
object: {
|
|
285
299
|
id: reactionId,
|
|
@@ -306,46 +320,65 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
306
320
|
},
|
|
307
321
|
/**
|
|
308
322
|
* create a reaction
|
|
309
|
-
* @param {Object} conversation
|
|
323
|
+
* @param {Object} conversation the conversation in which the reaction will be added
|
|
310
324
|
* @param {Object} displayName must be 'celebrate', 'heart', 'thumbsup', 'smiley', 'haha', 'confused', 'sad'
|
|
311
|
-
* @param {Object}
|
|
312
|
-
* @param {
|
|
325
|
+
* @param {Object} parentActivity activity object from that we are reacting to
|
|
326
|
+
* @param {Object} actorId id of person object who is reacting
|
|
327
|
+
* @param {String} recipientId used when reacting to direct IMC messages
|
|
313
328
|
* @returns {Promise<Activity>}
|
|
314
329
|
*/
|
|
315
|
-
addReaction: function addReaction(conversation, displayName,
|
|
316
|
-
var
|
|
317
|
-
return
|
|
318
|
-
var addReactionPayload
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
addReaction: function addReaction(conversation, displayName, parentActivity, actorId, recipientId) {
|
|
331
|
+
var _this7 = this;
|
|
332
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
333
|
+
var hmac, addReactionPayload;
|
|
334
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
335
|
+
while (1) switch (_context.prev = _context.next) {
|
|
336
|
+
case 0:
|
|
337
|
+
if (!_this7.config.includeEncryptionTransforms) {
|
|
338
|
+
_context.next = 4;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
_context.next = 3;
|
|
342
|
+
return _this7.createReactionHmac(displayName, parentActivity);
|
|
343
|
+
case 3:
|
|
344
|
+
hmac = _context.sent;
|
|
345
|
+
case 4:
|
|
346
|
+
addReactionPayload = {
|
|
347
|
+
actor: {
|
|
348
|
+
objectType: 'person',
|
|
349
|
+
id: actorId !== null && actorId !== void 0 ? actorId : _this7.webex.internal.device.userId
|
|
350
|
+
},
|
|
351
|
+
target: {
|
|
352
|
+
id: conversation.id,
|
|
353
|
+
objectType: 'conversation'
|
|
354
|
+
},
|
|
355
|
+
verb: 'add',
|
|
356
|
+
objectType: 'activity',
|
|
357
|
+
parent: {
|
|
358
|
+
type: 'reaction',
|
|
359
|
+
id: parentActivity.id
|
|
360
|
+
},
|
|
361
|
+
object: {
|
|
362
|
+
objectType: 'reaction2',
|
|
363
|
+
displayName: displayName,
|
|
364
|
+
hmac: hmac
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
if (recipientId) {
|
|
368
|
+
addReactionPayload.recipients = {
|
|
369
|
+
items: [{
|
|
370
|
+
id: recipientId,
|
|
371
|
+
objectType: 'person'
|
|
372
|
+
}]
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
return _context.abrupt("return", _this7.sendReaction(conversation, addReactionPayload));
|
|
376
|
+
case 7:
|
|
377
|
+
case "end":
|
|
378
|
+
return _context.stop();
|
|
337
379
|
}
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
addReactionPayload.recipients = {
|
|
341
|
-
items: [{
|
|
342
|
-
id: recipientId,
|
|
343
|
-
objectType: 'person'
|
|
344
|
-
}]
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
return _this6.sendReaction(conversation, addReactionPayload);
|
|
348
|
-
});
|
|
380
|
+
}, _callee);
|
|
381
|
+
}))();
|
|
349
382
|
},
|
|
350
383
|
/**
|
|
351
384
|
* delete content
|
|
@@ -355,7 +388,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
355
388
|
* @returns {Promise}
|
|
356
389
|
*/
|
|
357
390
|
delete: function _delete(conversation, object, activity) {
|
|
358
|
-
var
|
|
391
|
+
var _this8 = this;
|
|
359
392
|
var url = this.getConvoUrl(conversation);
|
|
360
393
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
361
394
|
url: url
|
|
@@ -381,7 +414,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
381
414
|
};
|
|
382
415
|
}
|
|
383
416
|
return this.prepare(activity, request).then(function (a) {
|
|
384
|
-
return
|
|
417
|
+
return _this8.submit(a);
|
|
385
418
|
});
|
|
386
419
|
},
|
|
387
420
|
/**
|
|
@@ -395,7 +428,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
395
428
|
* @returns {Promise<File>}
|
|
396
429
|
*/
|
|
397
430
|
download: function download(item) {
|
|
398
|
-
var
|
|
431
|
+
var _this9 = this;
|
|
399
432
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
400
433
|
var isEncrypted = Boolean(item.scr && item.scr.key);
|
|
401
434
|
var shunt = new _events.EventEmitter();
|
|
@@ -416,7 +449,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
416
449
|
}
|
|
417
450
|
return (0, _helperImage.readExifData)(item, res);
|
|
418
451
|
}).then(function (file) {
|
|
419
|
-
|
|
452
|
+
_this9.logger.info('conversation: file downloaded');
|
|
420
453
|
if (item.displayName && !file.name) {
|
|
421
454
|
file.name = item.displayName;
|
|
422
455
|
}
|
|
@@ -543,7 +576,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
543
576
|
* @returns {Promise<Conversation>}
|
|
544
577
|
*/
|
|
545
578
|
get: function get(conversation) {
|
|
546
|
-
var
|
|
579
|
+
var _this10 = this;
|
|
547
580
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
548
581
|
var user = conversation.user;
|
|
549
582
|
var uri;
|
|
@@ -579,12 +612,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
579
612
|
} else {
|
|
580
613
|
params.uri = uri;
|
|
581
614
|
}
|
|
582
|
-
return
|
|
615
|
+
return _this10.request(params);
|
|
583
616
|
}).then((0, _common.tap)(function (_ref2) {
|
|
584
617
|
var body = _ref2.body;
|
|
585
618
|
var id = body.id,
|
|
586
619
|
url = body.url;
|
|
587
|
-
|
|
620
|
+
_this10._recordUUIDs(body);
|
|
588
621
|
idToUrl.set(id, url);
|
|
589
622
|
})).then(function (res) {
|
|
590
623
|
return res.body;
|
|
@@ -602,18 +635,18 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
602
635
|
* @returns {Promise<Activity>}
|
|
603
636
|
*/
|
|
604
637
|
leave: function leave(conversation, participant, activity) {
|
|
605
|
-
var
|
|
638
|
+
var _this11 = this;
|
|
606
639
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
607
640
|
url: this.getConvoUrl(conversation)
|
|
608
641
|
});
|
|
609
642
|
return _promise.default.resolve().then(function () {
|
|
610
643
|
if (!participant) {
|
|
611
|
-
participant =
|
|
644
|
+
participant = _this11.webex.internal.device.userId;
|
|
612
645
|
}
|
|
613
|
-
return
|
|
614
|
-
return
|
|
646
|
+
return _this11.webex.internal.user.asUUID(participant).then(function (id) {
|
|
647
|
+
return _this11.prepare(activity, {
|
|
615
648
|
verb: 'leave',
|
|
616
|
-
target:
|
|
649
|
+
target: _this11.prepareConversation(convoWithUrl),
|
|
617
650
|
object: {
|
|
618
651
|
id: id,
|
|
619
652
|
objectType: 'person'
|
|
@@ -627,7 +660,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
627
660
|
});
|
|
628
661
|
});
|
|
629
662
|
}).then(function (a) {
|
|
630
|
-
return
|
|
663
|
+
return _this11.submit(a);
|
|
631
664
|
});
|
|
632
665
|
},
|
|
633
666
|
/**
|
|
@@ -680,28 +713,28 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
680
713
|
*/
|
|
681
714
|
paginate: function paginate() {
|
|
682
715
|
var _arguments = arguments,
|
|
683
|
-
|
|
684
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
716
|
+
_this12 = this;
|
|
717
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
685
718
|
var options, queryOptions, reqOptions;
|
|
686
|
-
return _regenerator.default.wrap(function
|
|
687
|
-
while (1) switch (
|
|
719
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
720
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
688
721
|
case 0:
|
|
689
722
|
options = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
|
|
690
723
|
if (!options.page) {
|
|
691
|
-
|
|
724
|
+
_context2.next = 5;
|
|
692
725
|
break;
|
|
693
726
|
}
|
|
694
727
|
if (!(!options.page.links || !options.page.links.next)) {
|
|
695
|
-
|
|
728
|
+
_context2.next = 4;
|
|
696
729
|
break;
|
|
697
730
|
}
|
|
698
731
|
throw new Error('No link to follow for the provided page');
|
|
699
732
|
case 4:
|
|
700
|
-
return
|
|
733
|
+
return _context2.abrupt("return", _this12.request({
|
|
701
734
|
url: options.page.links.next
|
|
702
735
|
}).then(function (res) {
|
|
703
736
|
return {
|
|
704
|
-
page: new _webexCore.Page(res,
|
|
737
|
+
page: new _webexCore.Page(res, _this12.webex)
|
|
705
738
|
};
|
|
706
739
|
}));
|
|
707
740
|
case 5:
|
|
@@ -725,9 +758,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
725
758
|
reqOptions.service = 'conversation';
|
|
726
759
|
reqOptions.resource = 'conversations';
|
|
727
760
|
}
|
|
728
|
-
return
|
|
761
|
+
return _context2.abrupt("return", _this12.request(reqOptions).then(function (res) {
|
|
729
762
|
var response = {
|
|
730
|
-
page: new _webexCore.Page(res,
|
|
763
|
+
page: new _webexCore.Page(res, _this12.webex)
|
|
731
764
|
};
|
|
732
765
|
if (res.body && res.body.additionalUrls) {
|
|
733
766
|
response.additionalUrls = res.body.additionalUrls;
|
|
@@ -736,9 +769,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
736
769
|
}));
|
|
737
770
|
case 9:
|
|
738
771
|
case "end":
|
|
739
|
-
return
|
|
772
|
+
return _context2.stop();
|
|
740
773
|
}
|
|
741
|
-
},
|
|
774
|
+
}, _callee2);
|
|
742
775
|
}))();
|
|
743
776
|
},
|
|
744
777
|
/**
|
|
@@ -798,27 +831,27 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
798
831
|
* @returns {Promise<Array<String>>}
|
|
799
832
|
*/
|
|
800
833
|
listParentActivityIds: function listParentActivityIds(conversationUrl, query) {
|
|
801
|
-
var
|
|
802
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
834
|
+
var _this13 = this;
|
|
835
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
803
836
|
var params, response;
|
|
804
|
-
return _regenerator.default.wrap(function
|
|
805
|
-
while (1) switch (
|
|
837
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
838
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
806
839
|
case 0:
|
|
807
840
|
params = {
|
|
808
841
|
method: 'GET',
|
|
809
842
|
url: "".concat(conversationUrl, "/parents"),
|
|
810
843
|
qs: query
|
|
811
844
|
};
|
|
812
|
-
|
|
813
|
-
return
|
|
845
|
+
_context3.next = 3;
|
|
846
|
+
return _this13.request(params);
|
|
814
847
|
case 3:
|
|
815
|
-
response =
|
|
816
|
-
return
|
|
848
|
+
response = _context3.sent;
|
|
849
|
+
return _context3.abrupt("return", response.body);
|
|
817
850
|
case 5:
|
|
818
851
|
case "end":
|
|
819
|
-
return
|
|
852
|
+
return _context3.stop();
|
|
820
853
|
}
|
|
821
|
-
},
|
|
854
|
+
}, _callee3);
|
|
822
855
|
}))();
|
|
823
856
|
},
|
|
824
857
|
/**
|
|
@@ -831,30 +864,30 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
831
864
|
*/
|
|
832
865
|
listAllChildActivitiesByParentId: function listAllChildActivitiesByParentId() {
|
|
833
866
|
var _arguments2 = arguments,
|
|
834
|
-
|
|
835
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
867
|
+
_this14 = this;
|
|
868
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
836
869
|
var options, conversationUrl, activityParentId, query, activityType, initialResponse, page, items, _iterator3, _step3, activity;
|
|
837
|
-
return _regenerator.default.wrap(function
|
|
838
|
-
while (1) switch (
|
|
870
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
871
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
839
872
|
case 0:
|
|
840
873
|
options = _arguments2.length > 0 && _arguments2[0] !== undefined ? _arguments2[0] : {};
|
|
841
874
|
conversationUrl = options.conversationUrl, activityParentId = options.activityParentId, query = options.query;
|
|
842
875
|
activityType = query.activityType;
|
|
843
|
-
|
|
844
|
-
return
|
|
876
|
+
_context4.next = 5;
|
|
877
|
+
return _this14.listChildActivitiesByParentId(conversationUrl, activityParentId, activityType, query);
|
|
845
878
|
case 5:
|
|
846
|
-
initialResponse =
|
|
847
|
-
page = new _webexCore.Page(initialResponse,
|
|
879
|
+
initialResponse = _context4.sent;
|
|
880
|
+
page = new _webexCore.Page(initialResponse, _this14.webex);
|
|
848
881
|
items = (0, _toConsumableArray2.default)(page.items);
|
|
849
882
|
case 8:
|
|
850
883
|
if (!page.hasNext()) {
|
|
851
|
-
|
|
884
|
+
_context4.next = 16;
|
|
852
885
|
break;
|
|
853
886
|
}
|
|
854
|
-
|
|
887
|
+
_context4.next = 11;
|
|
855
888
|
return page.next();
|
|
856
889
|
case 11:
|
|
857
|
-
page =
|
|
890
|
+
page = _context4.sent;
|
|
858
891
|
_iterator3 = _createForOfIteratorHelper(page);
|
|
859
892
|
try {
|
|
860
893
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
@@ -866,19 +899,19 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
866
899
|
} finally {
|
|
867
900
|
_iterator3.f();
|
|
868
901
|
}
|
|
869
|
-
|
|
902
|
+
_context4.next = 8;
|
|
870
903
|
break;
|
|
871
904
|
case 16:
|
|
872
905
|
// reverse list if needed (see _list for precedent)
|
|
873
906
|
if (items.length && (0, _lodash.last)(items).published < items[0].published) {
|
|
874
907
|
items.reverse();
|
|
875
908
|
}
|
|
876
|
-
return
|
|
909
|
+
return _context4.abrupt("return", items);
|
|
877
910
|
case 18:
|
|
878
911
|
case "end":
|
|
879
|
-
return
|
|
912
|
+
return _context4.stop();
|
|
880
913
|
}
|
|
881
|
-
},
|
|
914
|
+
}, _callee4);
|
|
882
915
|
}))();
|
|
883
916
|
},
|
|
884
917
|
/**
|
|
@@ -892,11 +925,11 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
892
925
|
*/
|
|
893
926
|
listChildActivitiesByParentId: function listChildActivitiesByParentId(conversationUrl, activityParentId, activityType) {
|
|
894
927
|
var _arguments3 = arguments,
|
|
895
|
-
|
|
896
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
928
|
+
_this15 = this;
|
|
929
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
897
930
|
var query, finalQuery, params;
|
|
898
|
-
return _regenerator.default.wrap(function
|
|
899
|
-
while (1) switch (
|
|
931
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
932
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
900
933
|
case 0:
|
|
901
934
|
query = _arguments3.length > 3 && _arguments3[3] !== undefined ? _arguments3[3] : {};
|
|
902
935
|
finalQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
@@ -907,12 +940,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
907
940
|
url: "".concat(conversationUrl, "/parents/").concat(activityParentId),
|
|
908
941
|
qs: finalQuery
|
|
909
942
|
};
|
|
910
|
-
return
|
|
943
|
+
return _context5.abrupt("return", _this15.request(params));
|
|
911
944
|
case 4:
|
|
912
945
|
case "end":
|
|
913
|
-
return
|
|
946
|
+
return _context5.stop();
|
|
914
947
|
}
|
|
915
|
-
},
|
|
948
|
+
}, _callee5);
|
|
916
949
|
}))();
|
|
917
950
|
},
|
|
918
951
|
/**
|
|
@@ -923,30 +956,30 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
923
956
|
* @returns {Promise<Array>}
|
|
924
957
|
*/
|
|
925
958
|
getReactionSummaryByParentId: function getReactionSummaryByParentId(conversationUrl, activityParentId, query) {
|
|
926
|
-
var
|
|
927
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
928
|
-
var _yield$
|
|
929
|
-
return _regenerator.default.wrap(function
|
|
930
|
-
while (1) switch (
|
|
959
|
+
var _this16 = this;
|
|
960
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
961
|
+
var _yield$_this16$reques, body, reactionObjects;
|
|
962
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
963
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
931
964
|
case 0:
|
|
932
|
-
|
|
933
|
-
return
|
|
965
|
+
_context6.next = 2;
|
|
966
|
+
return _this16.request({
|
|
934
967
|
method: 'GET',
|
|
935
968
|
url: "".concat(conversationUrl, "/activities/").concat(activityParentId),
|
|
936
969
|
qs: query
|
|
937
970
|
});
|
|
938
971
|
case 2:
|
|
939
|
-
_yield$
|
|
940
|
-
body = _yield$
|
|
972
|
+
_yield$_this16$reques = _context6.sent;
|
|
973
|
+
body = _yield$_this16$reques.body;
|
|
941
974
|
reactionObjects = body.children ? body.children.filter(function (child) {
|
|
942
975
|
return child.type === 'reactionSelfSummary' || child.type === 'reactionSummary';
|
|
943
976
|
}) : [];
|
|
944
|
-
return
|
|
977
|
+
return _context6.abrupt("return", reactionObjects);
|
|
945
978
|
case 6:
|
|
946
979
|
case "end":
|
|
947
|
-
return
|
|
980
|
+
return _context6.stop();
|
|
948
981
|
}
|
|
949
|
-
},
|
|
982
|
+
}, _callee6);
|
|
950
983
|
}))();
|
|
951
984
|
},
|
|
952
985
|
/**
|
|
@@ -1002,7 +1035,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1002
1035
|
* @returns {Promise}
|
|
1003
1036
|
*/
|
|
1004
1037
|
cardAction: function cardAction(conversation, inputs, parentActivity) {
|
|
1005
|
-
var
|
|
1038
|
+
var _this17 = this;
|
|
1006
1039
|
var activity = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1007
1040
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
1008
1041
|
url: this.getConvoUrl(conversation)
|
|
@@ -1018,7 +1051,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1018
1051
|
objectType: 'submit'
|
|
1019
1052
|
}, inputs)
|
|
1020
1053
|
}).then(function (a) {
|
|
1021
|
-
return
|
|
1054
|
+
return _this17.submit(a);
|
|
1022
1055
|
});
|
|
1023
1056
|
},
|
|
1024
1057
|
/**
|
|
@@ -1032,7 +1065,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1032
1065
|
* @returns {Promise<Activity>}
|
|
1033
1066
|
*/
|
|
1034
1067
|
post: function post(conversation, message, activity) {
|
|
1035
|
-
var
|
|
1068
|
+
var _this18 = this;
|
|
1036
1069
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
1037
1070
|
url: this.getConvoUrl(conversation)
|
|
1038
1071
|
});
|
|
@@ -1048,7 +1081,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1048
1081
|
objectType: 'comment'
|
|
1049
1082
|
}, message)
|
|
1050
1083
|
}).then(function (a) {
|
|
1051
|
-
return
|
|
1084
|
+
return _this18.submit(a);
|
|
1052
1085
|
});
|
|
1053
1086
|
},
|
|
1054
1087
|
prepareConversation: function prepareConversation(conversation) {
|
|
@@ -1057,7 +1090,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1057
1090
|
});
|
|
1058
1091
|
},
|
|
1059
1092
|
prepare: function prepare(activity, params) {
|
|
1060
|
-
var
|
|
1093
|
+
var _this19 = this;
|
|
1061
1094
|
params = params || {};
|
|
1062
1095
|
activity = activity || {};
|
|
1063
1096
|
return _promise.default.resolve(activity.prepare ? activity.prepare(params) : activity).then(function (act) {
|
|
@@ -1066,7 +1099,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1066
1099
|
kmsMessage: params.kmsMessage,
|
|
1067
1100
|
objectType: 'activity',
|
|
1068
1101
|
clientTempId: _uuid.default.v4(),
|
|
1069
|
-
actor:
|
|
1102
|
+
actor: _this19.webex.internal.device.userId
|
|
1070
1103
|
});
|
|
1071
1104
|
|
|
1072
1105
|
// Workaround because parent is a reserved props in Ampersand
|
|
@@ -1120,21 +1153,21 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1120
1153
|
* @returns {Promise<Array<Activity>>}
|
|
1121
1154
|
*/
|
|
1122
1155
|
listThreads: function listThreads(options) {
|
|
1123
|
-
var
|
|
1124
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1125
|
-
return _regenerator.default.wrap(function
|
|
1126
|
-
while (1) switch (
|
|
1156
|
+
var _this20 = this;
|
|
1157
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
1158
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1159
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1127
1160
|
case 0:
|
|
1128
|
-
return
|
|
1161
|
+
return _context7.abrupt("return", _this20._list({
|
|
1129
1162
|
service: 'conversation',
|
|
1130
1163
|
resource: 'threads',
|
|
1131
1164
|
qs: (0, _lodash.omit)(options, 'showAllTypes')
|
|
1132
1165
|
}));
|
|
1133
1166
|
case 1:
|
|
1134
1167
|
case "end":
|
|
1135
|
-
return
|
|
1168
|
+
return _context7.stop();
|
|
1136
1169
|
}
|
|
1137
|
-
},
|
|
1170
|
+
}, _callee7);
|
|
1138
1171
|
}))();
|
|
1139
1172
|
},
|
|
1140
1173
|
/**
|
|
@@ -1189,7 +1222,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1189
1222
|
* @returns {Promise<Activity>}
|
|
1190
1223
|
*/
|
|
1191
1224
|
assign: function assign(conversation, avatar) {
|
|
1192
|
-
var
|
|
1225
|
+
var _this21 = this;
|
|
1193
1226
|
var uploadOptions = {
|
|
1194
1227
|
role: 'spaceAvatar'
|
|
1195
1228
|
};
|
|
@@ -1200,17 +1233,17 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1200
1233
|
url: this.getConvoUrl(conversation)
|
|
1201
1234
|
});
|
|
1202
1235
|
return _promise.default.resolve().then(function () {
|
|
1203
|
-
var activity = _shareActivity.default.create(conversation, null,
|
|
1236
|
+
var activity = _shareActivity.default.create(conversation, null, _this21.webex);
|
|
1204
1237
|
activity.enableThumbnails = false;
|
|
1205
1238
|
activity.add(avatar, uploadOptions);
|
|
1206
|
-
return
|
|
1207
|
-
target:
|
|
1239
|
+
return _this21.prepare(activity, {
|
|
1240
|
+
target: _this21.prepareConversation(convoWithUrl)
|
|
1208
1241
|
});
|
|
1209
1242
|
}).then(function (a) {
|
|
1210
1243
|
// yes, this seems a little hacky; will likely be resolved as a result
|
|
1211
1244
|
// of #213
|
|
1212
1245
|
a.verb = 'assign';
|
|
1213
|
-
return
|
|
1246
|
+
return _this21.submit(a);
|
|
1214
1247
|
});
|
|
1215
1248
|
},
|
|
1216
1249
|
/**
|
|
@@ -1298,7 +1331,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1298
1331
|
* @returns {Promise<Activity>}
|
|
1299
1332
|
*/
|
|
1300
1333
|
share: function share(conversation, activity) {
|
|
1301
|
-
var
|
|
1334
|
+
var _this22 = this;
|
|
1302
1335
|
if ((0, _lodash.isArray)(activity)) {
|
|
1303
1336
|
activity = {
|
|
1304
1337
|
object: {
|
|
@@ -1315,7 +1348,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1315
1348
|
return this.prepare(activity, {
|
|
1316
1349
|
target: this.prepareConversation(convoWithUrl)
|
|
1317
1350
|
}).then(function (a) {
|
|
1318
|
-
return
|
|
1351
|
+
return _this22.submit(a);
|
|
1319
1352
|
});
|
|
1320
1353
|
},
|
|
1321
1354
|
/**
|
|
@@ -1325,7 +1358,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1325
1358
|
* @returns {Promise<Activity>}
|
|
1326
1359
|
*/
|
|
1327
1360
|
submit: function submit(activity, endpoint) {
|
|
1328
|
-
var
|
|
1361
|
+
var _this23 = this;
|
|
1329
1362
|
var url = endpoint || this.getConvoUrl(activity.target);
|
|
1330
1363
|
var resource = activity.verb === 'share' ? 'content' : 'activities';
|
|
1331
1364
|
var params = {
|
|
@@ -1367,16 +1400,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1367
1400
|
// handle when key need to rotate
|
|
1368
1401
|
if (error.body && error.body.errorCode === _constants.KEY_ROTATION_REQUIRED) {
|
|
1369
1402
|
cloneActivity.body.target.defaultActivityEncryptionKeyUrl = null;
|
|
1370
|
-
|
|
1403
|
+
_this23.request(cloneActivity);
|
|
1371
1404
|
} else if (error.body && (error.body.errorCode === _constants.KEY_ALREADY_ROTATED || error.body.errorCode === _constants.ENCRYPTION_KEY_URL_MISMATCH)) {
|
|
1372
1405
|
// handle when key need to update
|
|
1373
|
-
|
|
1406
|
+
_this23.webex.request({
|
|
1374
1407
|
method: 'GET',
|
|
1375
1408
|
api: 'conversation',
|
|
1376
1409
|
resource: "conversations/".concat(params.body.target.id)
|
|
1377
1410
|
}).then(function (res) {
|
|
1378
1411
|
cloneActivity.body.target.defaultActivityEncryptionKeyUrl = res.body.defaultActivityEncryptionkeyUrl;
|
|
1379
|
-
|
|
1412
|
+
_this23.request(cloneActivity);
|
|
1380
1413
|
});
|
|
1381
1414
|
} else {
|
|
1382
1415
|
throw error;
|
|
@@ -1390,7 +1423,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1390
1423
|
* @returns {Promise}
|
|
1391
1424
|
*/
|
|
1392
1425
|
unassign: function unassign(conversation, activity) {
|
|
1393
|
-
var
|
|
1426
|
+
var _this24 = this;
|
|
1394
1427
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
1395
1428
|
url: this.getConvoUrl(conversation)
|
|
1396
1429
|
});
|
|
@@ -1404,7 +1437,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1404
1437
|
}
|
|
1405
1438
|
}
|
|
1406
1439
|
}).then(function (a) {
|
|
1407
|
-
return
|
|
1440
|
+
return _this24.submit(a);
|
|
1408
1441
|
});
|
|
1409
1442
|
},
|
|
1410
1443
|
/**
|
|
@@ -1448,7 +1481,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1448
1481
|
* @returns {Promise}
|
|
1449
1482
|
*/
|
|
1450
1483
|
update: function update(conversation, object, activity) {
|
|
1451
|
-
var
|
|
1484
|
+
var _this25 = this;
|
|
1452
1485
|
if (!(0, _lodash.isObject)(object)) {
|
|
1453
1486
|
return _promise.default.reject(new Error('`object` must be an object'));
|
|
1454
1487
|
}
|
|
@@ -1460,7 +1493,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1460
1493
|
target: this.prepareConversation(convoWithUrl),
|
|
1461
1494
|
object: object
|
|
1462
1495
|
}).then(function (a) {
|
|
1463
|
-
return
|
|
1496
|
+
return _this25.submit(a);
|
|
1464
1497
|
});
|
|
1465
1498
|
},
|
|
1466
1499
|
/**
|
|
@@ -1473,7 +1506,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1473
1506
|
* @returns {Promise<Activity>}
|
|
1474
1507
|
*/
|
|
1475
1508
|
updateKey: function updateKey(conversation, key, activity) {
|
|
1476
|
-
var
|
|
1509
|
+
var _this26 = this;
|
|
1477
1510
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
1478
1511
|
url: this.getConvoUrl(conversation)
|
|
1479
1512
|
});
|
|
@@ -1481,7 +1514,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1481
1514
|
activitiesLimit: 0,
|
|
1482
1515
|
includeParticipants: true
|
|
1483
1516
|
}).then(function (c) {
|
|
1484
|
-
return
|
|
1517
|
+
return _this26._updateKey(c, key, activity);
|
|
1485
1518
|
});
|
|
1486
1519
|
},
|
|
1487
1520
|
/**
|
|
@@ -1495,7 +1528,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1495
1528
|
* @returns {Promise<Activity>}
|
|
1496
1529
|
*/
|
|
1497
1530
|
_updateKey: function _updateKey(conversation, key, activity) {
|
|
1498
|
-
var
|
|
1531
|
+
var _this27 = this;
|
|
1499
1532
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
1500
1533
|
url: this.getConvoUrl(conversation)
|
|
1501
1534
|
});
|
|
@@ -1505,7 +1538,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1505
1538
|
var k = (0, _lodash.isArray)(keys) ? keys[0] : keys;
|
|
1506
1539
|
var params = {
|
|
1507
1540
|
verb: 'updateKey',
|
|
1508
|
-
target:
|
|
1541
|
+
target: _this27.prepareConversation(convoWithUrl),
|
|
1509
1542
|
object: {
|
|
1510
1543
|
defaultActivityEncryptionKeyUrl: k.uri,
|
|
1511
1544
|
objectType: 'conversation'
|
|
@@ -1529,8 +1562,8 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1529
1562
|
keyUris: [k.uri]
|
|
1530
1563
|
};
|
|
1531
1564
|
}
|
|
1532
|
-
return
|
|
1533
|
-
return
|
|
1565
|
+
return _this27.prepare(activity, params).then(function (a) {
|
|
1566
|
+
return _this27.submit(a);
|
|
1534
1567
|
});
|
|
1535
1568
|
});
|
|
1536
1569
|
},
|
|
@@ -1580,7 +1613,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1580
1613
|
* @returns {Promise<string>} - conversation url
|
|
1581
1614
|
*/
|
|
1582
1615
|
getConversationUrl: function getConversationUrl() {
|
|
1583
|
-
var
|
|
1616
|
+
var _this28 = this;
|
|
1584
1617
|
this.logger.info('conversation: getting the conversation service url');
|
|
1585
1618
|
var convoUrl = this.webex.internal.services.get('conversation');
|
|
1586
1619
|
|
|
@@ -1593,9 +1626,9 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1593
1626
|
// Wait for the postauth catalog to update and then try to retrieve the
|
|
1594
1627
|
// conversation service url again.
|
|
1595
1628
|
return this.webex.internal.waitForCatalog('postauth').then(function () {
|
|
1596
|
-
return
|
|
1629
|
+
return _this28.webex.internal.services.get('conversation');
|
|
1597
1630
|
}).catch(function (error) {
|
|
1598
|
-
|
|
1631
|
+
_this28.logger.warn('conversation: unable to get conversation url', error.message);
|
|
1599
1632
|
return _promise.default.reject(error);
|
|
1600
1633
|
});
|
|
1601
1634
|
},
|
|
@@ -1605,23 +1638,23 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1605
1638
|
* @returns {Promise}
|
|
1606
1639
|
*/
|
|
1607
1640
|
_inferConversationUrl: function _inferConversationUrl(conversation) {
|
|
1608
|
-
var
|
|
1641
|
+
var _this29 = this;
|
|
1609
1642
|
if (conversation.id) {
|
|
1610
1643
|
return this.webex.internal.feature.getFeature('developer', 'web-high-availability').then(function (haMessagingEnabled) {
|
|
1611
1644
|
if (haMessagingEnabled) {
|
|
1612
1645
|
// recompute conversation URL each time as the host may have changed
|
|
1613
1646
|
// since last usage
|
|
1614
|
-
return
|
|
1647
|
+
return _this29.getConversationUrl().then(function (url) {
|
|
1615
1648
|
conversation.url = "".concat(url, "/conversations/").concat(conversation.id);
|
|
1616
1649
|
return conversation;
|
|
1617
1650
|
});
|
|
1618
1651
|
}
|
|
1619
1652
|
if (!conversation.url) {
|
|
1620
|
-
return
|
|
1653
|
+
return _this29.getConversationUrl().then(function (url) {
|
|
1621
1654
|
conversation.url = "".concat(url, "/conversations/").concat(conversation.id);
|
|
1622
1655
|
/* istanbul ignore else */
|
|
1623
1656
|
if (process.env.NODE_ENV !== 'production') {
|
|
1624
|
-
|
|
1657
|
+
_this29.logger.warn('conversation: inferred conversation url from conversation id; please pass whole conversation objects to Conversation methods');
|
|
1625
1658
|
}
|
|
1626
1659
|
return conversation;
|
|
1627
1660
|
});
|
|
@@ -1675,7 +1708,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1675
1708
|
* jumpToActivity - gets searched-for activity and surrounding activities
|
|
1676
1709
|
*/
|
|
1677
1710
|
listActivitiesThreadOrdered: function listActivitiesThreadOrdered(options) {
|
|
1678
|
-
var
|
|
1711
|
+
var _this30 = this;
|
|
1679
1712
|
var conversationUrl = options.conversationUrl,
|
|
1680
1713
|
conversationId = options.conversationId;
|
|
1681
1714
|
if (!conversationUrl && !conversationId) {
|
|
@@ -1701,20 +1734,20 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1701
1734
|
* @returns {IGeneratorResponse}
|
|
1702
1735
|
*/
|
|
1703
1736
|
var jumpToActivity = /*#__PURE__*/function () {
|
|
1704
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1737
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(searchObject) {
|
|
1705
1738
|
var newUrl, searchOptions, _yield$threadOrderer$, searchResults;
|
|
1706
|
-
return _regenerator.default.wrap(function
|
|
1707
|
-
while (1) switch (
|
|
1739
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1740
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1708
1741
|
case 0:
|
|
1709
1742
|
if (searchObject) {
|
|
1710
|
-
|
|
1743
|
+
_context8.next = 2;
|
|
1711
1744
|
break;
|
|
1712
1745
|
}
|
|
1713
1746
|
throw new Error('Search must be an activity object from conversation service');
|
|
1714
1747
|
case 2:
|
|
1715
1748
|
newUrl = searchObject.target && searchObject.target.url;
|
|
1716
1749
|
if (newUrl) {
|
|
1717
|
-
|
|
1750
|
+
_context8.next = 5;
|
|
1718
1751
|
break;
|
|
1719
1752
|
}
|
|
1720
1753
|
throw new Error('Search object must have a target url!');
|
|
@@ -1724,21 +1757,21 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1724
1757
|
queryType: _activities.MID,
|
|
1725
1758
|
search: searchObject
|
|
1726
1759
|
});
|
|
1727
|
-
threadOrderer =
|
|
1728
|
-
|
|
1760
|
+
threadOrderer = _this30._listActivitiesThreadOrdered(searchOptions);
|
|
1761
|
+
_context8.next = 9;
|
|
1729
1762
|
return threadOrderer.next(searchOptions);
|
|
1730
1763
|
case 9:
|
|
1731
|
-
_yield$threadOrderer$ =
|
|
1764
|
+
_yield$threadOrderer$ = _context8.sent;
|
|
1732
1765
|
searchResults = _yield$threadOrderer$.value;
|
|
1733
|
-
return
|
|
1766
|
+
return _context8.abrupt("return", {
|
|
1734
1767
|
done: true,
|
|
1735
1768
|
value: searchResults
|
|
1736
1769
|
});
|
|
1737
1770
|
case 12:
|
|
1738
1771
|
case "end":
|
|
1739
|
-
return
|
|
1772
|
+
return _context8.stop();
|
|
1740
1773
|
}
|
|
1741
|
-
},
|
|
1774
|
+
}, _callee8);
|
|
1742
1775
|
}));
|
|
1743
1776
|
return function jumpToActivity(_x) {
|
|
1744
1777
|
return _ref4.apply(this, arguments);
|
|
@@ -1750,28 +1783,28 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1750
1783
|
* @returns {IGeneratorResponse}
|
|
1751
1784
|
*/
|
|
1752
1785
|
var getOlder = /*#__PURE__*/function () {
|
|
1753
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1786
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
1754
1787
|
var _yield$threadOrderer$2, _yield$threadOrderer$3, value, oldestInBatch, moreActivitiesExist;
|
|
1755
|
-
return _regenerator.default.wrap(function
|
|
1756
|
-
while (1) switch (
|
|
1788
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1789
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1757
1790
|
case 0:
|
|
1758
|
-
|
|
1791
|
+
_context9.next = 2;
|
|
1759
1792
|
return threadOrderer.next(olderOptions);
|
|
1760
1793
|
case 2:
|
|
1761
|
-
_yield$threadOrderer$2 =
|
|
1794
|
+
_yield$threadOrderer$2 = _context9.sent;
|
|
1762
1795
|
_yield$threadOrderer$3 = _yield$threadOrderer$2.value;
|
|
1763
1796
|
value = _yield$threadOrderer$3 === void 0 ? [] : _yield$threadOrderer$3;
|
|
1764
1797
|
oldestInBatch = value[0] && value[0].activity;
|
|
1765
1798
|
moreActivitiesExist = oldestInBatch && (0, _activities.getActivityType)(oldestInBatch) !== _activities.ACTIVITY_TYPES.CREATE;
|
|
1766
|
-
return
|
|
1799
|
+
return _context9.abrupt("return", {
|
|
1767
1800
|
done: !moreActivitiesExist,
|
|
1768
1801
|
value: value
|
|
1769
1802
|
});
|
|
1770
1803
|
case 8:
|
|
1771
1804
|
case "end":
|
|
1772
|
-
return
|
|
1805
|
+
return _context9.stop();
|
|
1773
1806
|
}
|
|
1774
|
-
},
|
|
1807
|
+
}, _callee9);
|
|
1775
1808
|
}));
|
|
1776
1809
|
return function getOlder() {
|
|
1777
1810
|
return _ref5.apply(this, arguments);
|
|
@@ -1783,28 +1816,28 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1783
1816
|
* @returns {IGeneratorResponse}
|
|
1784
1817
|
*/
|
|
1785
1818
|
var getNewer = /*#__PURE__*/function () {
|
|
1786
|
-
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1819
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1787
1820
|
var newerOptions, _yield$threadOrderer$4, value;
|
|
1788
|
-
return _regenerator.default.wrap(function
|
|
1789
|
-
while (1) switch (
|
|
1821
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1822
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1790
1823
|
case 0:
|
|
1791
1824
|
newerOptions = _objectSpread(_objectSpread({}, baseOptions), {}, {
|
|
1792
1825
|
queryType: _activities.NEWER
|
|
1793
1826
|
});
|
|
1794
|
-
|
|
1827
|
+
_context10.next = 3;
|
|
1795
1828
|
return threadOrderer.next(newerOptions);
|
|
1796
1829
|
case 3:
|
|
1797
|
-
_yield$threadOrderer$4 =
|
|
1830
|
+
_yield$threadOrderer$4 = _context10.sent;
|
|
1798
1831
|
value = _yield$threadOrderer$4.value;
|
|
1799
|
-
return
|
|
1832
|
+
return _context10.abrupt("return", {
|
|
1800
1833
|
done: !value.length,
|
|
1801
1834
|
value: value
|
|
1802
1835
|
});
|
|
1803
1836
|
case 6:
|
|
1804
1837
|
case "end":
|
|
1805
|
-
return
|
|
1838
|
+
return _context10.stop();
|
|
1806
1839
|
}
|
|
1807
|
-
},
|
|
1840
|
+
}, _callee10);
|
|
1808
1841
|
}));
|
|
1809
1842
|
return function getNewer() {
|
|
1810
1843
|
return _ref6.apply(this, arguments);
|
|
@@ -1847,10 +1880,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1847
1880
|
_listActivitiesThreadOrdered: function _listActivitiesThreadOrdered() {
|
|
1848
1881
|
var _this = this;
|
|
1849
1882
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1850
|
-
return (0, _wrapAsyncGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
1883
|
+
return (0, _wrapAsyncGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1851
1884
|
var _options$minActivitie, minActivities, _options$queryType, queryType, convoUrl, _options$search, search, includeChildren, _bookendManager, setBookends, getNewestAct, getOldestAct, defaultBatchSize, batchSize, _activityManager, getActivityHandlerByKey, getActivityByTypeAndParentId, query, _loop, _ret;
|
|
1852
|
-
return _regenerator.default.wrap(function
|
|
1853
|
-
while (1) switch (
|
|
1885
|
+
return _regenerator.default.wrap(function _callee11$(_context13) {
|
|
1886
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1854
1887
|
case 0:
|
|
1855
1888
|
// ***********************************************
|
|
1856
1889
|
// INSTANCE STATE VARIABLES
|
|
@@ -1874,8 +1907,8 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1874
1907
|
/* eslint-disable no-loop-func */
|
|
1875
1908
|
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
|
|
1876
1909
|
var _rootActivityManager, getRootActivityHash, addNewRoot, _noMoreActivitiesMana, getNoMoreActs, checkAndSetNoMoreActs, checkAndSetNoOlderActs, checkAndSetNoNewerActs, getActivityHandlerByType, handleNewActivity, handleNewActivities, handleOlderQuery, handleNewerQuery, handleSearch, getQueryResponseHandler, incrementLoopCounter, _loop2, orderedActivities, getRepliesByParentId, orderedRoots, nextOptions, currentOldestPublishedDate, currentNewestPublishedDate;
|
|
1877
|
-
return _regenerator.default.wrap(function _loop$(
|
|
1878
|
-
while (1) switch (
|
|
1910
|
+
return _regenerator.default.wrap(function _loop$(_context12) {
|
|
1911
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1879
1912
|
case 0:
|
|
1880
1913
|
// ***********************************************
|
|
1881
1914
|
// EXECUTION STATE VARIABLES
|
|
@@ -1929,8 +1962,8 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1929
1962
|
incrementLoopCounter = (0, _activityThreadOrdering.getLoopCounterFailsafe)();
|
|
1930
1963
|
_loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
|
|
1931
1964
|
var allBatchActivitiesConfig, $allBatchActivitiesFetch, $fetchRequests, params, $parentsFetch, _yield$_awaitAsyncGen, _yield$_awaitAsyncGen2, allBatchActivities, _yield$_awaitAsyncGen3, parents, handler, _parents$reply, replyIds, _parents$edit, editIds, _parents$reaction, reactionIds, $reactionFetches, $replyFetches, $editFetches, _iterator4, _step4, activity, actId, childFetchOptions, _yield$_awaitAsyncGen4, _yield$_awaitAsyncGen5, reactions, replies, edits, newReplyReactions, allReactions, rootActivityHash, visibleActivitiesCount, _iterator5, _step5, rootActivity, rootId, repliesByRootId, currentOldestPublishedDate, currentNewestPublishedDate;
|
|
1932
|
-
return _regenerator.default.wrap(function _loop2$(
|
|
1933
|
-
while (1) switch (
|
|
1965
|
+
return _regenerator.default.wrap(function _loop2$(_context11) {
|
|
1966
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1934
1967
|
case 0:
|
|
1935
1968
|
// count loops and throw if we detect infinite loop
|
|
1936
1969
|
incrementLoopCounter();
|
|
@@ -1955,10 +1988,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1955
1988
|
}
|
|
1956
1989
|
|
|
1957
1990
|
// we dont always need to fetch for parents
|
|
1958
|
-
|
|
1991
|
+
_context11.next = 7;
|
|
1959
1992
|
return (0, _awaitAsyncGenerator2.default)(_promise.default.all($fetchRequests));
|
|
1960
1993
|
case 7:
|
|
1961
|
-
_yield$_awaitAsyncGen =
|
|
1994
|
+
_yield$_awaitAsyncGen = _context11.sent;
|
|
1962
1995
|
_yield$_awaitAsyncGen2 = (0, _slicedToArray2.default)(_yield$_awaitAsyncGen, 2);
|
|
1963
1996
|
allBatchActivities = _yield$_awaitAsyncGen2[0];
|
|
1964
1997
|
_yield$_awaitAsyncGen3 = _yield$_awaitAsyncGen2[1];
|
|
@@ -1974,7 +2007,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
1974
2007
|
*/
|
|
1975
2008
|
_parents$reply = parents.reply, replyIds = _parents$reply === void 0 ? [] : _parents$reply, _parents$edit = parents.edit, editIds = _parents$edit === void 0 ? [] : _parents$edit, _parents$reaction = parents.reaction, reactionIds = _parents$reaction === void 0 ? [] : _parents$reaction; // if no parent IDs returned, do nothing
|
|
1976
2009
|
if (!(replyIds.length || editIds.length || reactionIds.length)) {
|
|
1977
|
-
|
|
2010
|
+
_context11.next = 35;
|
|
1978
2011
|
break;
|
|
1979
2012
|
}
|
|
1980
2013
|
$reactionFetches = [];
|
|
@@ -2015,15 +2048,15 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2015
2048
|
} finally {
|
|
2016
2049
|
_iterator4.f();
|
|
2017
2050
|
}
|
|
2018
|
-
|
|
2051
|
+
_context11.next = 23;
|
|
2019
2052
|
return (0, _awaitAsyncGenerator2.default)(_promise.default.all([_promise.default.all($reactionFetches), _promise.default.all($replyFetches), _promise.default.all($editFetches)]));
|
|
2020
2053
|
case 23:
|
|
2021
|
-
_yield$_awaitAsyncGen4 =
|
|
2054
|
+
_yield$_awaitAsyncGen4 = _context11.sent;
|
|
2022
2055
|
_yield$_awaitAsyncGen5 = (0, _slicedToArray2.default)(_yield$_awaitAsyncGen4, 3);
|
|
2023
2056
|
reactions = _yield$_awaitAsyncGen5[0];
|
|
2024
2057
|
replies = _yield$_awaitAsyncGen5[1];
|
|
2025
2058
|
edits = _yield$_awaitAsyncGen5[2];
|
|
2026
|
-
|
|
2059
|
+
_context11.next = 30;
|
|
2027
2060
|
return (0, _awaitAsyncGenerator2.default)(_promise.default.all(replies.filter(function (reply) {
|
|
2028
2061
|
return replyIds.includes(reply.id);
|
|
2029
2062
|
}).map(function (reply) {
|
|
@@ -2033,7 +2066,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2033
2066
|
});
|
|
2034
2067
|
})));
|
|
2035
2068
|
case 30:
|
|
2036
|
-
newReplyReactions =
|
|
2069
|
+
newReplyReactions = _context11.sent;
|
|
2037
2070
|
allReactions = [].concat((0, _toConsumableArray2.default)(reactions), (0, _toConsumableArray2.default)(newReplyReactions)); // stick them into activity hashes
|
|
2038
2071
|
replies.forEach(function (replyArr) {
|
|
2039
2072
|
return handleNewActivities(replyArr);
|
|
@@ -2065,10 +2098,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2065
2098
|
_iterator5.f();
|
|
2066
2099
|
}
|
|
2067
2100
|
if (!(visibleActivitiesCount >= minActivities)) {
|
|
2068
|
-
|
|
2101
|
+
_context11.next = 41;
|
|
2069
2102
|
break;
|
|
2070
2103
|
}
|
|
2071
|
-
return
|
|
2104
|
+
return _context11.abrupt("return", 1);
|
|
2072
2105
|
case 41:
|
|
2073
2106
|
checkAndSetNoMoreActs(queryType, visibleActivitiesCount, batchSize);
|
|
2074
2107
|
|
|
@@ -2105,24 +2138,24 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2105
2138
|
}
|
|
2106
2139
|
case 48:
|
|
2107
2140
|
case "end":
|
|
2108
|
-
return
|
|
2141
|
+
return _context11.stop();
|
|
2109
2142
|
}
|
|
2110
2143
|
}, _loop2);
|
|
2111
2144
|
});
|
|
2112
2145
|
case 11:
|
|
2113
2146
|
if (getNoMoreActs()) {
|
|
2114
|
-
|
|
2147
|
+
_context12.next = 17;
|
|
2115
2148
|
break;
|
|
2116
2149
|
}
|
|
2117
|
-
return
|
|
2150
|
+
return _context12.delegateYield(_loop2(), "t0", 13);
|
|
2118
2151
|
case 13:
|
|
2119
|
-
if (!
|
|
2120
|
-
|
|
2152
|
+
if (!_context12.t0) {
|
|
2153
|
+
_context12.next = 15;
|
|
2121
2154
|
break;
|
|
2122
2155
|
}
|
|
2123
|
-
return
|
|
2156
|
+
return _context12.abrupt("break", 17);
|
|
2124
2157
|
case 15:
|
|
2125
|
-
|
|
2158
|
+
_context12.next = 11;
|
|
2126
2159
|
break;
|
|
2127
2160
|
case 17:
|
|
2128
2161
|
orderedActivities = [];
|
|
@@ -2178,12 +2211,12 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2178
2211
|
return orderedActivities.push(reply);
|
|
2179
2212
|
});
|
|
2180
2213
|
});
|
|
2181
|
-
|
|
2214
|
+
_context12.next = 23;
|
|
2182
2215
|
return orderedActivities;
|
|
2183
2216
|
case 23:
|
|
2184
|
-
nextOptions =
|
|
2217
|
+
nextOptions = _context12.sent;
|
|
2185
2218
|
if (!nextOptions) {
|
|
2186
|
-
|
|
2219
|
+
_context12.next = 32;
|
|
2187
2220
|
break;
|
|
2188
2221
|
}
|
|
2189
2222
|
minActivities = nextOptions.minActivities || minActivities;
|
|
@@ -2196,39 +2229,39 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2196
2229
|
newestPublishedDate: currentNewestPublishedDate,
|
|
2197
2230
|
batchSize: batchSize
|
|
2198
2231
|
});
|
|
2199
|
-
|
|
2232
|
+
_context12.next = 33;
|
|
2200
2233
|
break;
|
|
2201
2234
|
case 32:
|
|
2202
|
-
return
|
|
2235
|
+
return _context12.abrupt("return", {
|
|
2203
2236
|
v: void 0
|
|
2204
2237
|
});
|
|
2205
2238
|
case 33:
|
|
2206
2239
|
case "end":
|
|
2207
|
-
return
|
|
2240
|
+
return _context12.stop();
|
|
2208
2241
|
}
|
|
2209
2242
|
}, _loop);
|
|
2210
2243
|
});
|
|
2211
2244
|
case 9:
|
|
2212
2245
|
if (!true) {
|
|
2213
|
-
|
|
2246
|
+
_context13.next = 16;
|
|
2214
2247
|
break;
|
|
2215
2248
|
}
|
|
2216
|
-
return
|
|
2249
|
+
return _context13.delegateYield(_loop(), "t0", 11);
|
|
2217
2250
|
case 11:
|
|
2218
|
-
_ret =
|
|
2251
|
+
_ret = _context13.t0;
|
|
2219
2252
|
if (!_ret) {
|
|
2220
|
-
|
|
2253
|
+
_context13.next = 14;
|
|
2221
2254
|
break;
|
|
2222
2255
|
}
|
|
2223
|
-
return
|
|
2256
|
+
return _context13.abrupt("return", _ret.v);
|
|
2224
2257
|
case 14:
|
|
2225
|
-
|
|
2258
|
+
_context13.next = 9;
|
|
2226
2259
|
break;
|
|
2227
2260
|
case 16:
|
|
2228
2261
|
case "end":
|
|
2229
|
-
return
|
|
2262
|
+
return _context13.stop();
|
|
2230
2263
|
}
|
|
2231
|
-
},
|
|
2264
|
+
}, _callee11);
|
|
2232
2265
|
}))();
|
|
2233
2266
|
},
|
|
2234
2267
|
/**
|
|
@@ -2293,11 +2326,11 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2293
2326
|
* @returns {Promise<Array<Conversation>>}
|
|
2294
2327
|
*/
|
|
2295
2328
|
_list: function _list(options) {
|
|
2296
|
-
var
|
|
2297
|
-
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2329
|
+
var _this31 = this;
|
|
2330
|
+
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
2298
2331
|
var res, list, limit, results, _iterator6, _step6, result, items;
|
|
2299
|
-
return _regenerator.default.wrap(function
|
|
2300
|
-
while (1) switch (
|
|
2332
|
+
return _regenerator.default.wrap(function _callee12$(_context14) {
|
|
2333
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2301
2334
|
case 0:
|
|
2302
2335
|
options.qs = _objectSpread({
|
|
2303
2336
|
personRefresh: true,
|
|
@@ -2305,10 +2338,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2305
2338
|
activitiesLimit: 0,
|
|
2306
2339
|
participantsLimit: 0
|
|
2307
2340
|
}, options.qs);
|
|
2308
|
-
|
|
2309
|
-
return
|
|
2341
|
+
_context14.next = 3;
|
|
2342
|
+
return _this31.request(options);
|
|
2310
2343
|
case 3:
|
|
2311
|
-
res =
|
|
2344
|
+
res = _context14.sent;
|
|
2312
2345
|
if (!res.body || !res.body.items || res.body.items.length === 0) {
|
|
2313
2346
|
list = [];
|
|
2314
2347
|
} else {
|
|
@@ -2321,7 +2354,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2321
2354
|
// The user has more data in another cluster.
|
|
2322
2355
|
// Follow the 'additionalUrls' for that data.
|
|
2323
2356
|
if (!res.body.additionalUrls) {
|
|
2324
|
-
|
|
2357
|
+
_context14.next = 14;
|
|
2325
2358
|
break;
|
|
2326
2359
|
}
|
|
2327
2360
|
limit = 0; // If the user asked for a specific amount of data,
|
|
@@ -2337,10 +2370,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2337
2370
|
// If the limit is 0 for some reason,
|
|
2338
2371
|
// don't bother requesting from other clusters
|
|
2339
2372
|
if (!(!options.limit || limit !== 0)) {
|
|
2340
|
-
|
|
2373
|
+
_context14.next = 14;
|
|
2341
2374
|
break;
|
|
2342
2375
|
}
|
|
2343
|
-
|
|
2376
|
+
_context14.next = 11;
|
|
2344
2377
|
return _promise.default.all(res.body.additionalUrls.map(function (host) {
|
|
2345
2378
|
var url = "".concat(host, "/").concat(options.resource);
|
|
2346
2379
|
var newOptions = _objectSpread(_objectSpread({}, options), {}, {
|
|
@@ -2350,10 +2383,10 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2350
2383
|
if (options.limit) {
|
|
2351
2384
|
newOptions.qs[newOptions.limit.name] = limit;
|
|
2352
2385
|
}
|
|
2353
|
-
return
|
|
2386
|
+
return _this31.request(newOptions);
|
|
2354
2387
|
}));
|
|
2355
2388
|
case 11:
|
|
2356
|
-
results =
|
|
2389
|
+
results = _context14.sent;
|
|
2357
2390
|
_iterator6 = _createForOfIteratorHelper(results);
|
|
2358
2391
|
try {
|
|
2359
2392
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
@@ -2372,17 +2405,17 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2372
2405
|
_iterator6.f();
|
|
2373
2406
|
}
|
|
2374
2407
|
case 14:
|
|
2375
|
-
|
|
2408
|
+
_context14.next = 16;
|
|
2376
2409
|
return _promise.default.all(list.map(function (item) {
|
|
2377
|
-
return
|
|
2410
|
+
return _this31._recordUUIDs(item);
|
|
2378
2411
|
}));
|
|
2379
2412
|
case 16:
|
|
2380
|
-
return
|
|
2413
|
+
return _context14.abrupt("return", list);
|
|
2381
2414
|
case 17:
|
|
2382
2415
|
case "end":
|
|
2383
|
-
return
|
|
2416
|
+
return _context14.stop();
|
|
2384
2417
|
}
|
|
2385
|
-
},
|
|
2418
|
+
}, _callee12);
|
|
2386
2419
|
}))();
|
|
2387
2420
|
},
|
|
2388
2421
|
/**
|
|
@@ -2392,7 +2425,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2392
2425
|
* @returns {Promise<Conversation>}
|
|
2393
2426
|
*/
|
|
2394
2427
|
_maybeCreateOneOnOneThenPost: function _maybeCreateOneOnOneThenPost(params, options) {
|
|
2395
|
-
var
|
|
2428
|
+
var _this32 = this;
|
|
2396
2429
|
return this.get((0, _lodash.defaults)({
|
|
2397
2430
|
// the use of uniq in Conversation#create guarantees participant[1] will
|
|
2398
2431
|
// always be the other user
|
|
@@ -2402,7 +2435,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2402
2435
|
includeParticipants: true
|
|
2403
2436
|
})).then(function (conversation) {
|
|
2404
2437
|
if (params.comment || params.html) {
|
|
2405
|
-
return
|
|
2438
|
+
return _this32.post(conversation, {
|
|
2406
2439
|
content: params.html,
|
|
2407
2440
|
displayName: params.comment
|
|
2408
2441
|
}).then(function (activity) {
|
|
@@ -2415,7 +2448,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2415
2448
|
if (reason.statusCode !== 404) {
|
|
2416
2449
|
return _promise.default.reject(reason);
|
|
2417
2450
|
}
|
|
2418
|
-
return
|
|
2451
|
+
return _this32._createOneOnOne(params);
|
|
2419
2452
|
});
|
|
2420
2453
|
},
|
|
2421
2454
|
/**
|
|
@@ -2424,7 +2457,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2424
2457
|
* @returns {Object}
|
|
2425
2458
|
*/
|
|
2426
2459
|
_prepareConversationForCreation: function _prepareConversationForCreation(params) {
|
|
2427
|
-
var
|
|
2460
|
+
var _this33 = this;
|
|
2428
2461
|
var payload = {
|
|
2429
2462
|
activities: {
|
|
2430
2463
|
items: [this.expand('create')]
|
|
@@ -2444,7 +2477,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2444
2477
|
payload.tags = params.tags;
|
|
2445
2478
|
}
|
|
2446
2479
|
params.participants.forEach(function (participant) {
|
|
2447
|
-
payload.activities.items.push(
|
|
2480
|
+
payload.activities.items.push(_this33.expand('add', {
|
|
2448
2481
|
objectType: 'person',
|
|
2449
2482
|
id: participant
|
|
2450
2483
|
}));
|
|
@@ -2476,7 +2509,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2476
2509
|
* @returns {Promise}
|
|
2477
2510
|
*/
|
|
2478
2511
|
_recordUUIDs: function _recordUUIDs(conversation) {
|
|
2479
|
-
var
|
|
2512
|
+
var _this34 = this;
|
|
2480
2513
|
if (!conversation.participants || !conversation.participants.items) {
|
|
2481
2514
|
return _promise.default.resolve(conversation);
|
|
2482
2515
|
}
|
|
@@ -2486,16 +2519,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2486
2519
|
if (participant.type === 'ROOM' || participant.type === 'LYRA_SPACE') {
|
|
2487
2520
|
return _promise.default.resolve();
|
|
2488
2521
|
}
|
|
2489
|
-
return
|
|
2490
|
-
return
|
|
2522
|
+
return _this34.webex.internal.user.recordUUID(participant).catch(function (err) {
|
|
2523
|
+
return _this34.logger.warn('Could not record uuid', err);
|
|
2491
2524
|
});
|
|
2492
2525
|
}));
|
|
2493
2526
|
},
|
|
2494
|
-
version: "3.
|
|
2527
|
+
version: "3.7.0-ipv6-multi-turn-urls.1"
|
|
2495
2528
|
});
|
|
2496
2529
|
['favorite', 'hide', 'lock', 'mute', 'unfavorite', 'unhide', 'unlock', 'unmute'].forEach(function (verb) {
|
|
2497
2530
|
Conversation.prototype[verb] = function submitSimpleActivity(conversation, activity) {
|
|
2498
|
-
var
|
|
2531
|
+
var _this35 = this;
|
|
2499
2532
|
var convoWithUrl = this.prepareConversation(_objectSpread(_objectSpread({}, conversation), {}, {
|
|
2500
2533
|
url: this.getConvoUrl(conversation)
|
|
2501
2534
|
}));
|
|
@@ -2504,13 +2537,13 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2504
2537
|
object: convoWithUrl,
|
|
2505
2538
|
target: convoWithUrl
|
|
2506
2539
|
}).then(function (a) {
|
|
2507
|
-
return
|
|
2540
|
+
return _this35.submit(a);
|
|
2508
2541
|
});
|
|
2509
2542
|
};
|
|
2510
2543
|
});
|
|
2511
2544
|
['assignModerator', 'unassignModerator'].forEach(function (verb) {
|
|
2512
2545
|
Conversation.prototype[verb] = function submitModerationChangeActivity(conversation, moderator, activity) {
|
|
2513
|
-
var
|
|
2546
|
+
var _this36 = this;
|
|
2514
2547
|
var convoWithUrl = _objectSpread(_objectSpread({}, conversation), {}, {
|
|
2515
2548
|
url: this.getConvoUrl(conversation)
|
|
2516
2549
|
});
|
|
@@ -2518,16 +2551,16 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2518
2551
|
var _ref8 = (0, _slicedToArray2.default)(_ref7, 2),
|
|
2519
2552
|
c = _ref8[0],
|
|
2520
2553
|
userId = _ref8[1];
|
|
2521
|
-
return
|
|
2554
|
+
return _this36.prepare(activity, {
|
|
2522
2555
|
verb: verb,
|
|
2523
|
-
target:
|
|
2556
|
+
target: _this36.prepareConversation(c),
|
|
2524
2557
|
object: {
|
|
2525
2558
|
id: userId,
|
|
2526
2559
|
objectType: 'person'
|
|
2527
2560
|
}
|
|
2528
2561
|
});
|
|
2529
2562
|
}).then(function (a) {
|
|
2530
|
-
return
|
|
2563
|
+
return _this36.submit(a);
|
|
2531
2564
|
});
|
|
2532
2565
|
};
|
|
2533
2566
|
});
|
|
@@ -2542,7 +2575,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2542
2575
|
['setSpaceProperty', 'unsetSpaceProperty'].forEach(function (fnName) {
|
|
2543
2576
|
var verb = fnName.startsWith('set') ? 'set' : 'unset';
|
|
2544
2577
|
Conversation.prototype[fnName] = function submitSpacePropertyActivity(conversation, tag, activity) {
|
|
2545
|
-
var
|
|
2578
|
+
var _this37 = this;
|
|
2546
2579
|
if (!(0, _lodash.isString)(tag)) {
|
|
2547
2580
|
return _promise.default.reject(new Error('`tag` must be a string'));
|
|
2548
2581
|
}
|
|
@@ -2557,13 +2590,13 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2557
2590
|
objectType: 'spaceProperty'
|
|
2558
2591
|
}
|
|
2559
2592
|
}).then(function (a) {
|
|
2560
|
-
return
|
|
2593
|
+
return _this37.submit(a);
|
|
2561
2594
|
});
|
|
2562
2595
|
};
|
|
2563
2596
|
});
|
|
2564
2597
|
['tag', 'untag'].forEach(function (verb) {
|
|
2565
2598
|
Conversation.prototype[verb] = function submitObjectActivity(conversation, object, activity) {
|
|
2566
|
-
var
|
|
2599
|
+
var _this38 = this;
|
|
2567
2600
|
if (!(0, _lodash.isObject)(object)) {
|
|
2568
2601
|
return _promise.default.reject(new Error('`object` must be an object'));
|
|
2569
2602
|
}
|
|
@@ -2575,7 +2608,7 @@ var Conversation = _webexCore.WebexPlugin.extend({
|
|
|
2575
2608
|
target: c,
|
|
2576
2609
|
object: (0, _assign.default)(c, object)
|
|
2577
2610
|
}).then(function (a) {
|
|
2578
|
-
return
|
|
2611
|
+
return _this38.submit(a);
|
|
2579
2612
|
});
|
|
2580
2613
|
};
|
|
2581
2614
|
});
|