@webex/plugin-rooms 3.0.0-beta.9 → 3.0.0-beta.91
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/README.md +3 -6
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/rooms.js +92 -168
- package/dist/rooms.js.map +1 -1
- package/package.json +12 -12
- package/src/rooms.js +76 -78
- package/test/integration/spec/rooms.js +218 -190
package/README.md
CHANGED
|
@@ -29,15 +29,12 @@ npm install --save @webex/plugin-rooms
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
|
|
33
32
|
const Webex = require('webex');
|
|
34
33
|
|
|
35
34
|
const webex = Webex.init();
|
|
36
|
-
webex.rooms.get(id)
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
})
|
|
40
|
-
|
|
35
|
+
webex.rooms.get(id).then((room) => {
|
|
36
|
+
console.log(room);
|
|
37
|
+
});
|
|
41
38
|
```
|
|
42
39
|
|
|
43
40
|
## Maintainers
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
require("@webex/internal-plugin-conversation");
|
|
14
|
-
|
|
15
10
|
require("@webex/internal-plugin-mercury");
|
|
16
|
-
|
|
17
11
|
var _webexCore = require("@webex/webex-core");
|
|
18
|
-
|
|
19
12
|
var _rooms = _interopRequireDefault(require("./rooms"));
|
|
20
|
-
|
|
21
13
|
/*!
|
|
22
14
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
23
15
|
*/
|
|
16
|
+
|
|
24
17
|
(0, _webexCore.registerPlugin)('rooms', _rooms.default);
|
|
25
18
|
var _default = _rooms.default;
|
|
26
19
|
exports.default = _default;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerPlugin","Rooms"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation';\nimport '@webex/internal-plugin-mercury';\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Rooms from './rooms';\n\nregisterPlugin('rooms', Rooms);\n\nexport default Rooms;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["registerPlugin","Rooms"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-conversation';\nimport '@webex/internal-plugin-mercury';\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Rooms from './rooms';\n\nregisterPlugin('rooms', Rooms);\n\nexport default Rooms;\n"],"mappings":";;;;;;;;AAIA;AACA;AAEA;AAEA;AATA;AACA;AACA;;AASA,IAAAA,yBAAc,EAAC,OAAO,EAAEC,cAAK,CAAC;AAAC,eAEhBA,cAAK;AAAA"}
|
package/dist/rooms.js
CHANGED
|
@@ -1,60 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
-
|
|
5
4
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
-
|
|
7
5
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
10
|
-
|
|
11
7
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
12
|
-
|
|
13
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
14
|
-
|
|
15
9
|
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
16
|
-
|
|
17
10
|
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
18
|
-
|
|
19
11
|
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
20
|
-
|
|
21
12
|
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
22
|
-
|
|
23
13
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
24
|
-
|
|
25
14
|
_Object$defineProperty(exports, "__esModule", {
|
|
26
15
|
value: true
|
|
27
16
|
});
|
|
28
|
-
|
|
29
17
|
exports.default = void 0;
|
|
30
|
-
|
|
31
18
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
32
|
-
|
|
33
19
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
34
|
-
|
|
35
20
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
36
|
-
|
|
37
21
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
38
|
-
|
|
39
22
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
40
|
-
|
|
41
23
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
42
|
-
|
|
43
24
|
var _webexCore = require("@webex/webex-core");
|
|
44
|
-
|
|
45
25
|
var _common = require("@webex/common");
|
|
46
|
-
|
|
47
26
|
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; } } }; }
|
|
48
|
-
|
|
49
27
|
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); }
|
|
50
|
-
|
|
51
|
-
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; }
|
|
52
|
-
|
|
28
|
+
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; }
|
|
53
29
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
54
|
-
|
|
55
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
56
|
-
|
|
57
31
|
var debug = require('debug')('rooms');
|
|
32
|
+
|
|
58
33
|
/**
|
|
59
34
|
* @typedef {Object} RoomObject
|
|
60
35
|
* @property {string} id - (server generated) Unique identifier for the room
|
|
@@ -74,8 +49,6 @@ var debug = require('debug')('rooms');
|
|
|
74
49
|
* @class
|
|
75
50
|
* @name Rooms
|
|
76
51
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
52
|
var Rooms = _webexCore.WebexPlugin.extend({
|
|
80
53
|
/**
|
|
81
54
|
* Register to listen for incoming rooms events
|
|
@@ -107,7 +80,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
107
80
|
*/
|
|
108
81
|
listen: function listen() {
|
|
109
82
|
var _this = this;
|
|
110
|
-
|
|
111
83
|
return (0, _common.createEventEnvelope)(this.webex, _common.SDK_EVENT.EXTERNAL.RESOURCE.ROOMS).then(function (envelope) {
|
|
112
84
|
_this.eventEnvelope = envelope;
|
|
113
85
|
return _this.webex.internal.mercury.connect().then(function () {
|
|
@@ -117,7 +89,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
117
89
|
});
|
|
118
90
|
});
|
|
119
91
|
},
|
|
120
|
-
|
|
121
92
|
/**
|
|
122
93
|
* Creates a new room. The authenticated user is automatically added as a
|
|
123
94
|
* member of the room. See the {@link Memberships} API to learn how to add
|
|
@@ -148,7 +119,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
148
119
|
return res.body;
|
|
149
120
|
});
|
|
150
121
|
},
|
|
151
|
-
|
|
152
122
|
/**
|
|
153
123
|
* Returns a single room.
|
|
154
124
|
* @instance
|
|
@@ -180,7 +150,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
180
150
|
return res.body.items || res.body;
|
|
181
151
|
});
|
|
182
152
|
},
|
|
183
|
-
|
|
184
153
|
/**
|
|
185
154
|
* Returns a list of rooms. In most cases the results will only contain rooms
|
|
186
155
|
* that the authenticated user is a member of.
|
|
@@ -215,7 +184,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
215
184
|
*/
|
|
216
185
|
list: function list(options) {
|
|
217
186
|
var _this2 = this;
|
|
218
|
-
|
|
219
187
|
return this.request({
|
|
220
188
|
service: 'hydra',
|
|
221
189
|
resource: 'rooms/',
|
|
@@ -224,7 +192,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
224
192
|
return new _webexCore.Page(res, _this2.webex);
|
|
225
193
|
});
|
|
226
194
|
},
|
|
227
|
-
|
|
228
195
|
/**
|
|
229
196
|
* Returns a list of rooms with details about the data of the last
|
|
230
197
|
* activity in the room, and the date of the users last presences in
|
|
@@ -271,57 +238,47 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
271
238
|
*/
|
|
272
239
|
listWithReadStatus: function listWithReadStatus() {
|
|
273
240
|
var _arguments = arguments,
|
|
274
|
-
|
|
275
|
-
|
|
241
|
+
_this3 = this;
|
|
276
242
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
277
243
|
var maxRecent, now, options;
|
|
278
244
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
279
|
-
while (1) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
245
|
+
while (1) switch (_context.prev = _context.next) {
|
|
246
|
+
case 0:
|
|
247
|
+
maxRecent = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : 0;
|
|
248
|
+
now = new Date();
|
|
249
|
+
options = {
|
|
250
|
+
activitiesLimit: 0,
|
|
251
|
+
computeTitleIfEmpty: true,
|
|
252
|
+
conversationsLimit: 1000,
|
|
253
|
+
isActive: true
|
|
254
|
+
};
|
|
255
|
+
if (!(maxRecent > 0)) {
|
|
256
|
+
_context.next = 8;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
options.conversationsLimit = maxRecent;
|
|
260
|
+
options.sinceDate = now.setDate(now.getDate() - 14);
|
|
261
|
+
_context.next = 10;
|
|
262
|
+
break;
|
|
263
|
+
case 8:
|
|
264
|
+
if (!(maxRecent < 0 || maxRecent > 100)) {
|
|
298
265
|
_context.next = 10;
|
|
299
266
|
break;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
return _this3.webex.internal.conversation.list(options);
|
|
312
|
-
}).then(function (conversations) {
|
|
313
|
-
return buildRoomInfoList(_this3.webex, conversations);
|
|
314
|
-
}));
|
|
315
|
-
|
|
316
|
-
case 11:
|
|
317
|
-
case "end":
|
|
318
|
-
return _context.stop();
|
|
319
|
-
}
|
|
267
|
+
}
|
|
268
|
+
return _context.abrupt("return", _promise.default.reject(new Error('rooms.listWithReadStatus: ' + 'optional maxRecent parameter must be an integer between 1 and 100')));
|
|
269
|
+
case 10:
|
|
270
|
+
return _context.abrupt("return", _this3.webex.internal.services.waitForCatalog('postauth').then(function () {
|
|
271
|
+
return _this3.webex.internal.conversation.list(options);
|
|
272
|
+
}).then(function (conversations) {
|
|
273
|
+
return buildRoomInfoList(_this3.webex, conversations);
|
|
274
|
+
}));
|
|
275
|
+
case 11:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context.stop();
|
|
320
278
|
}
|
|
321
279
|
}, _callee);
|
|
322
280
|
}))();
|
|
323
281
|
},
|
|
324
|
-
|
|
325
282
|
/**
|
|
326
283
|
* Returns a single room object with details about the data of the last
|
|
327
284
|
* activity in the room, and the date of the users last presence in
|
|
@@ -355,7 +312,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
355
312
|
*/
|
|
356
313
|
getWithReadStatus: function getWithReadStatus(roomId) {
|
|
357
314
|
var _this4 = this;
|
|
358
|
-
|
|
359
315
|
var deconstructedId = (0, _common.deconstructHydraId)(roomId);
|
|
360
316
|
var conversation = {
|
|
361
317
|
id: deconstructedId.id,
|
|
@@ -365,13 +321,11 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
365
321
|
return _this4.webex.internal.conversation.get(conversation, {
|
|
366
322
|
computeTitleIfEmpty: true,
|
|
367
323
|
activitiesLimit: 0 // don't send the whole history of activity
|
|
368
|
-
|
|
369
324
|
}).then(function (convo) {
|
|
370
325
|
return buildRoomInfo(_this4.webex, convo);
|
|
371
326
|
});
|
|
372
327
|
});
|
|
373
328
|
},
|
|
374
|
-
|
|
375
329
|
/**
|
|
376
330
|
* Deletes a single room.
|
|
377
331
|
* @instance
|
|
@@ -411,11 +365,9 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
411
365
|
if (res.statusCode === 204) {
|
|
412
366
|
return undefined;
|
|
413
367
|
}
|
|
414
|
-
|
|
415
368
|
return res.body;
|
|
416
369
|
});
|
|
417
370
|
},
|
|
418
|
-
|
|
419
371
|
/**
|
|
420
372
|
* Used to update a single room's properties.
|
|
421
373
|
* @instance
|
|
@@ -451,7 +403,6 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
451
403
|
return res.body;
|
|
452
404
|
});
|
|
453
405
|
},
|
|
454
|
-
|
|
455
406
|
/**
|
|
456
407
|
* This function is called when an internal membership events fires,
|
|
457
408
|
* if the user registered for these events with the listen() function.
|
|
@@ -463,37 +414,30 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
463
414
|
*/
|
|
464
415
|
onWebexApiEvent: function onWebexApiEvent(event) {
|
|
465
416
|
var activity = event.data.activity;
|
|
466
|
-
/* eslint-disable no-case-declarations */
|
|
467
417
|
|
|
418
|
+
/* eslint-disable no-case-declarations */
|
|
468
419
|
switch (activity.verb) {
|
|
469
420
|
case _common.SDK_EVENT.INTERNAL.ACTIVITY_VERB.CREATE:
|
|
470
421
|
var roomCreatedEvent = this.getRoomEvent(this.webex, activity, _common.SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED);
|
|
471
|
-
|
|
472
422
|
if (roomCreatedEvent) {
|
|
473
423
|
debug("room \"created\" payload: ".concat((0, _stringify.default)(roomCreatedEvent)));
|
|
474
424
|
this.trigger(_common.SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED, roomCreatedEvent);
|
|
475
425
|
}
|
|
476
|
-
|
|
477
426
|
break;
|
|
478
|
-
|
|
479
427
|
case _common.SDK_EVENT.INTERNAL.ACTIVITY_VERB.UPDATE:
|
|
480
428
|
case _common.SDK_EVENT.INTERNAL.ACTIVITY_VERB.LOCK:
|
|
481
429
|
case _common.SDK_EVENT.INTERNAL.ACTIVITY_VERB.UNLOCK:
|
|
482
430
|
debug("generating a rooms:updated based on ".concat(activity.verb, " activity"));
|
|
483
431
|
var roomUpdatedEvent = this.getRoomEvent(this.webex, activity, _common.SDK_EVENT.EXTERNAL.EVENT_TYPE.UPDATED);
|
|
484
|
-
|
|
485
432
|
if (roomUpdatedEvent) {
|
|
486
433
|
debug("room \"updated\" payload: ".concat((0, _stringify.default)(roomUpdatedEvent)));
|
|
487
434
|
this.trigger(_common.SDK_EVENT.EXTERNAL.EVENT_TYPE.UPDATED, roomUpdatedEvent);
|
|
488
435
|
}
|
|
489
|
-
|
|
490
436
|
break;
|
|
491
|
-
|
|
492
437
|
default:
|
|
493
438
|
break;
|
|
494
439
|
}
|
|
495
440
|
},
|
|
496
|
-
|
|
497
441
|
/**
|
|
498
442
|
* Constructs the data object for an event on the rooms resource,
|
|
499
443
|
* adhering to Hydra's Webhook data structure.
|
|
@@ -513,13 +457,11 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
513
457
|
sdkEvent.event = event;
|
|
514
458
|
sdkEvent.data.created = activity.published;
|
|
515
459
|
sdkEvent.actorId = (0, _common.buildHydraPersonId)(activity.actor.entryUUID, cluster);
|
|
516
|
-
|
|
517
460
|
if (activity.object.id) {
|
|
518
461
|
sdkEvent.data.id = (0, _common.buildHydraRoomId)(activity.object.id, cluster);
|
|
519
462
|
} else {
|
|
520
463
|
sdkEvent.data.id = (0, _common.buildHydraRoomId)(activity.target.id, cluster);
|
|
521
464
|
}
|
|
522
|
-
|
|
523
465
|
if (event === _common.SDK_EVENT.EXTERNAL.EVENT_TYPE.CREATED) {
|
|
524
466
|
sdkEvent.data.creatorId = (0, _common.buildHydraPersonId)(activity.actor.entryUUID, cluster);
|
|
525
467
|
sdkEvent.data.lastActivity = activity.published;
|
|
@@ -528,20 +470,18 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
528
470
|
// For some reason the tags are not in the object for an update activity
|
|
529
471
|
tags = activity.target.tags;
|
|
530
472
|
}
|
|
531
|
-
|
|
532
473
|
if (activity.object.creatorUUID) {
|
|
533
474
|
// This seems to be set in lock/unlock activities but not updated...
|
|
534
475
|
debug("Found a creatorId: ".concat(activity.object.creatorUUID, " in a ").concat(activity.verb, " event"));
|
|
535
476
|
sdkEvent.data.creatorId = (0, _common.buildHydraPersonId)(activity.object.creatorUUID, cluster);
|
|
536
|
-
}
|
|
477
|
+
}
|
|
478
|
+
// Webhook engine team sets this based on lastReadableActivityDate
|
|
537
479
|
// in the activity.target object. See: hydra/HydraRoom.java#L51
|
|
538
480
|
// This elements seems to be missing from the activity that the SDK is getting
|
|
539
481
|
// sdkEvent.data.lastActivity = activity.target.lastReadableActivityDate;
|
|
540
|
-
|
|
541
482
|
} else {
|
|
542
483
|
throw new Error('unexpected event type');
|
|
543
484
|
}
|
|
544
|
-
|
|
545
485
|
sdkEvent.data.type = (0, _common.getHydraRoomType)(tags);
|
|
546
486
|
sdkEvent.data.isLocked = tags.includes(_common.SDK_EVENT.INTERNAL.ACTIVITY_TAG.LOCKED);
|
|
547
487
|
return sdkEvent;
|
|
@@ -550,9 +490,8 @@ var Rooms = _webexCore.WebexPlugin.extend({
|
|
|
550
490
|
return null;
|
|
551
491
|
}
|
|
552
492
|
},
|
|
553
|
-
version: "3.0.0-beta.
|
|
493
|
+
version: "3.0.0-beta.91"
|
|
554
494
|
});
|
|
555
|
-
|
|
556
495
|
var _default = Rooms;
|
|
557
496
|
/**
|
|
558
497
|
* Helper method to build a roomInfo object from a conversation object
|
|
@@ -560,9 +499,7 @@ var _default = Rooms;
|
|
|
560
499
|
* @param {Conversation~ConversationObject} conversation
|
|
561
500
|
* @returns {Promise<RoomInfoObject>}
|
|
562
501
|
*/
|
|
563
|
-
|
|
564
502
|
exports.default = _default;
|
|
565
|
-
|
|
566
503
|
function buildRoomInfo(_x, _x2) {
|
|
567
504
|
return _buildRoomInfo.apply(this, arguments);
|
|
568
505
|
}
|
|
@@ -572,90 +509,77 @@ function buildRoomInfo(_x, _x2) {
|
|
|
572
509
|
* @param {Conversation~ConversationObjectList} conversations
|
|
573
510
|
* @returns {Promise<RoomInfoList>}
|
|
574
511
|
*/
|
|
575
|
-
|
|
576
|
-
|
|
577
512
|
function _buildRoomInfo() {
|
|
578
513
|
_buildRoomInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(webex, conversation) {
|
|
579
514
|
var type, cluster, title, lastActivityDate, roomInfo;
|
|
580
515
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
581
|
-
while (1) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
case "end":
|
|
609
|
-
return _context2.stop();
|
|
610
|
-
}
|
|
516
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
517
|
+
case 0:
|
|
518
|
+
_context2.prev = 0;
|
|
519
|
+
type = (0, _common.getHydraRoomType)(conversation.tags);
|
|
520
|
+
cluster = (0, _common.getHydraClusterString)(webex, conversation.url);
|
|
521
|
+
title = conversation.displayName ? conversation.displayName : conversation.computedTitle;
|
|
522
|
+
lastActivityDate = conversation.lastReadableActivityDate ? conversation.lastReadableActivityDate : conversation.lastRelevantActivityDate;
|
|
523
|
+
roomInfo = _objectSpread(_objectSpread(_objectSpread({
|
|
524
|
+
id: (0, _common.buildHydraRoomId)(conversation.id, cluster),
|
|
525
|
+
type: type
|
|
526
|
+
}, title && {
|
|
527
|
+
title: conversation.displayName
|
|
528
|
+
}), lastActivityDate && {
|
|
529
|
+
lastActivityDate: lastActivityDate
|
|
530
|
+
}), {}, {
|
|
531
|
+
lastSeenActivityDate: conversation.lastSeenActivityDate ? conversation.lastSeenActivityDate :
|
|
532
|
+
// If user has never been seen set the date to "a long time ago"
|
|
533
|
+
new Date(0).toISOString()
|
|
534
|
+
});
|
|
535
|
+
return _context2.abrupt("return", _promise.default.resolve(roomInfo));
|
|
536
|
+
case 9:
|
|
537
|
+
_context2.prev = 9;
|
|
538
|
+
_context2.t0 = _context2["catch"](0);
|
|
539
|
+
return _context2.abrupt("return", _promise.default.reject(_context2.t0));
|
|
540
|
+
case 12:
|
|
541
|
+
case "end":
|
|
542
|
+
return _context2.stop();
|
|
611
543
|
}
|
|
612
544
|
}, _callee2, null, [[0, 9]]);
|
|
613
545
|
}));
|
|
614
546
|
return _buildRoomInfo.apply(this, arguments);
|
|
615
547
|
}
|
|
616
|
-
|
|
617
548
|
function buildRoomInfoList(_x3, _x4) {
|
|
618
549
|
return _buildRoomInfoList.apply(this, arguments);
|
|
619
550
|
}
|
|
620
|
-
|
|
621
551
|
function _buildRoomInfoList() {
|
|
622
552
|
_buildRoomInfoList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(webex, conversations) {
|
|
623
553
|
var roomReadInfo, roomInfoPromises, _iterator, _step, conversation;
|
|
624
|
-
|
|
625
554
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
626
|
-
while (1) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
conversation = _step.value;
|
|
639
|
-
roomInfoPromises.push(buildRoomInfo(webex, conversation));
|
|
640
|
-
}
|
|
641
|
-
} catch (err) {
|
|
642
|
-
_iterator.e(err);
|
|
643
|
-
} finally {
|
|
644
|
-
_iterator.f();
|
|
555
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
556
|
+
case 0:
|
|
557
|
+
// Convert each Conversation into a roomInfo object
|
|
558
|
+
roomReadInfo = {
|
|
559
|
+
items: []
|
|
560
|
+
};
|
|
561
|
+
roomInfoPromises = [];
|
|
562
|
+
_iterator = _createForOfIteratorHelper(conversations);
|
|
563
|
+
try {
|
|
564
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
565
|
+
conversation = _step.value;
|
|
566
|
+
roomInfoPromises.push(buildRoomInfo(webex, conversation));
|
|
645
567
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
568
|
+
} catch (err) {
|
|
569
|
+
_iterator.e(err);
|
|
570
|
+
} finally {
|
|
571
|
+
_iterator.f();
|
|
572
|
+
}
|
|
573
|
+
return _context3.abrupt("return", _promise.default.all(roomInfoPromises).then(function (roomInfoList) {
|
|
574
|
+
roomReadInfo.items = roomInfoList;
|
|
575
|
+
roomReadInfo.items.sort(function (a, b) {
|
|
576
|
+
return a.lastActivityDate < b.lastActivityDate ? 1 : -1;
|
|
577
|
+
});
|
|
578
|
+
return roomReadInfo;
|
|
579
|
+
}));
|
|
580
|
+
case 5:
|
|
581
|
+
case "end":
|
|
582
|
+
return _context3.stop();
|
|
659
583
|
}
|
|
660
584
|
}, _callee3);
|
|
661
585
|
}));
|